mirror of
https://github.com/greenart7c3/Amber.git
synced 2026-10-05 19:08:23 +00:00
Added string resources to the permission dialog
This commit is contained in:
@@ -101,7 +101,7 @@ object LocalPreferences {
|
||||
return encryptedPreferences(context).getBoolean(PrefKeys.RATIONALE, true)
|
||||
}
|
||||
|
||||
fun updateShoulShowRationale(context: Context, value: Boolean) {
|
||||
fun updateShouldShowRationale(context: Context, value: Boolean) {
|
||||
encryptedPreferences(context).edit().apply {
|
||||
putBoolean(PrefKeys.RATIONALE, value)
|
||||
}.apply()
|
||||
|
||||
@@ -6,6 +6,7 @@ import android.content.Intent
|
||||
import android.content.pm.PackageManager
|
||||
import android.net.Uri
|
||||
import android.os.Build
|
||||
import android.provider.Settings
|
||||
import android.util.Log
|
||||
import android.widget.Toast
|
||||
import androidx.activity.compose.ManagedActivityResultLauncher
|
||||
@@ -438,10 +439,11 @@ fun MainScreen(
|
||||
}
|
||||
} else {
|
||||
if (LocalPreferences.shouldShowRationale(context) == null) {
|
||||
LocalPreferences.updateShoulShowRationale(context, true)
|
||||
LocalPreferences.updateShouldShowRationale(context, true)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var showDialog by remember { mutableStateOf(false) }
|
||||
|
||||
@Suppress("KotlinConstantConditions")
|
||||
@@ -465,10 +467,10 @@ fun MainScreen(
|
||||
showDialog = false
|
||||
},
|
||||
title = {
|
||||
Text(text = "Permission Needed")
|
||||
Text(text = stringResource(R.string.permission_needed))
|
||||
},
|
||||
text = {
|
||||
Text(text = "Notifications are needed to use Amber as a nsec bunker.")
|
||||
Text(text = stringResource(R.string.notifications_are_needed_to_use_amber_as_a_nsec_bunker))
|
||||
},
|
||||
confirmButton = {
|
||||
Button(
|
||||
@@ -477,17 +479,17 @@ fun MainScreen(
|
||||
requestPermissionLauncher.launch("android.permission.POST_NOTIFICATIONS")
|
||||
},
|
||||
) {
|
||||
Text(text = "Allow")
|
||||
Text(text = stringResource(R.string.allow))
|
||||
}
|
||||
},
|
||||
dismissButton = {
|
||||
Button(
|
||||
onClick = {
|
||||
showDialog = false
|
||||
LocalPreferences.updateShoulShowRationale(context, false)
|
||||
LocalPreferences.updateShouldShowRationale(context, false)
|
||||
},
|
||||
) {
|
||||
Text(text = "Deny")
|
||||
Text(text = stringResource(R.string.deny))
|
||||
}
|
||||
},
|
||||
)
|
||||
|
||||
@@ -414,4 +414,8 @@
|
||||
<string name="pin_does_not_match">Pin does not match</string>
|
||||
<string name="confirm_pin">Confirm Pin</string>
|
||||
<string name="enter_pin">Enter PIN</string>
|
||||
<string name="permission_needed">Permission Needed</string>
|
||||
<string name="notifications_are_needed_to_use_amber_as_a_nsec_bunker">Notifications are needed to use Amber as a nsec bunker.</string>
|
||||
<string name="allow">Allow</string>
|
||||
<string name="deny">Deny</string>
|
||||
</resources>
|
||||
|
||||
Reference in New Issue
Block a user