mirror of
https://github.com/SimpleMobileTools/Simple-Flashlight.git
synced 2025-02-16 20:00:40 +01:00
Use eventValue
for isOrWasThankYouInstalled
This commit is contained in:
parent
6c8b301c9f
commit
3c4c4a4001
@ -14,6 +14,7 @@ import com.simplemobiletools.commons.activities.AboutActivity
|
||||
import com.simplemobiletools.commons.activities.CustomizationActivity
|
||||
import com.simplemobiletools.commons.compose.alert_dialog.rememberAlertDialogState
|
||||
import com.simplemobiletools.commons.compose.extensions.getActivity
|
||||
import com.simplemobiletools.commons.compose.extensions.onEventValue
|
||||
import com.simplemobiletools.commons.dialogs.FeatureLockedAlertDialog
|
||||
import com.simplemobiletools.commons.extensions.hideKeyboard
|
||||
import com.simplemobiletools.commons.extensions.isOrWasThankYouInstalled
|
||||
@ -92,21 +93,24 @@ fun CheckFeatureLocked(
|
||||
skipCheck: Boolean
|
||||
) {
|
||||
val context = LocalContext.current.getActivity()
|
||||
val isOrWasThankYouInstalled = onEventValue {
|
||||
context.isOrWasThankYouInstalled()
|
||||
}
|
||||
val featureLockedAlertDialogState = rememberAlertDialogState().apply {
|
||||
DialogMember {
|
||||
FeatureLockedAlertDialog(
|
||||
alertDialogState = this,
|
||||
) {
|
||||
if (!context.isOrWasThankYouInstalled()) {
|
||||
if (!isOrWasThankYouInstalled) {
|
||||
context.finish()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
LaunchedEffect(context.isOrWasThankYouInstalled()) {
|
||||
if (!skipCheck && !context.isOrWasThankYouInstalled()) {
|
||||
LaunchedEffect(isOrWasThankYouInstalled) {
|
||||
if (!skipCheck && !isOrWasThankYouInstalled) {
|
||||
featureLockedAlertDialogState.show()
|
||||
} else if (context.isOrWasThankYouInstalled()) {
|
||||
} else if (isOrWasThankYouInstalled) {
|
||||
featureLockedAlertDialogState.hide()
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user