Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setup: Show Shizuku card even if Shizuku app is not detected #647

Merged
merged 1 commit into from
Sep 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions app/src/main/java/eu/darken/sdmse/setup/SetupViewModel.kt
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,7 @@ class SetupViewModel @Inject constructor(
SAFSetupCardVH.Item::class,
UsageStatsSetupCardVH.Item::class,
AutomationSetupCardVH.Item::class,
ShizukuSetupCardVH.Item::class,
RootSetupCardVH.Item::class,
)
private val TAG = logTag("Setup", "ViewModel")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,9 @@ class ShizukuSetupCardVH(parent: ViewGroup) :
item.onToggleUseShizuku(selection)
}
}
allowShizukuOptionsEnable.isEnabled = item.state.isInstalled

shizukuState.apply {
isVisible = item.state.isInstalled && item.state.isEnabled == true
isVisible = item.state.isEnabled == true
text = getString(
if (item.state.ourService) R.string.setup_shizuku_state_ready_label
else R.string.setup_shizuku_state_waiting_label
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,10 @@ class ShizukuSetupModule @Inject constructor(

val baseState = State(
isEnabled = isEnabled,
isInstalled = shizukuManager.isInstalled(),
isCompatible = shizukuManager.isCompatible(),
)

if (isEnabled != true || !baseState.isInstalled) return@combine flowOf(baseState)
if (isEnabled != true) return@combine flowOf(baseState)

combine(
shizukuManager.shizukuBinder.onStart { emit(null) },
Expand Down Expand Up @@ -100,14 +99,13 @@ class ShizukuSetupModule @Inject constructor(

data class State(
val isEnabled: Boolean?,
val isInstalled: Boolean,
val isCompatible: Boolean = false,
val basicService: Boolean = false,
val ourService: Boolean = false,
) : SetupModule.State {

override val isComplete: Boolean =
isEnabled == false || !isCompatible || !isInstalled || (ourService && isEnabled == true)
isEnabled == false || !isCompatible || (ourService && isEnabled == true)
}

@Module @InstallIn(SingletonComponent::class)
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@
<string name="setup_shizuku_card_body2">This setting has no effect if the Shizuku app is not set up on your device.</string>
<string name="setup_shizuku_state_ready_label">Shizuku link is ready.</string>
<string name="setup_shizuku_state_waiting_label">Waiting for link with Shizuku.</string>
<string name="setup_shizuku_enable_shizuku_use_label">Use Shizuku</string>
<string name="setup_shizuku_enable_shizuku_use_label">Use Shizuku if available</string>
<string name="setup_shizuku_disable_shizuku_use_label">Don\'t use Shizuku</string>

<string name="setup_dismiss_hint">You can find the setup screen again via the settings menu.</string>
Expand Down
Loading