mirror of
https://github.com/oxen-io/session-android.git
synced 2024-11-21 15:05:19 +00:00
SES-2702 - making sure we hook the permission results everywhere
This commit is contained in:
parent
b452a17b42
commit
0fd801accb
@ -388,6 +388,11 @@ class HomeActivity : PassphraseRequiredActionBarActivity(),
|
||||
super.onDestroy()
|
||||
EventBus.getDefault().unregister(this)
|
||||
}
|
||||
|
||||
override fun onRequestPermissionsResult(requestCode: Int, permissions: Array<out String>, grantResults: IntArray) {
|
||||
super.onRequestPermissionsResult(requestCode, permissions, grantResults)
|
||||
Permissions.onRequestPermissionsResult(this, requestCode, permissions, grantResults)
|
||||
}
|
||||
// endregion
|
||||
|
||||
// region Updating
|
||||
|
@ -13,6 +13,7 @@ import org.session.libsession.utilities.TextSecurePreferences
|
||||
import org.thoughtcrime.securesms.BaseActionBarActivity
|
||||
import org.thoughtcrime.securesms.onboarding.manager.LoadAccountManager
|
||||
import org.thoughtcrime.securesms.onboarding.messagenotifications.MessageNotificationsActivity
|
||||
import org.thoughtcrime.securesms.permissions.Permissions
|
||||
import org.thoughtcrime.securesms.ui.setComposeContent
|
||||
import org.thoughtcrime.securesms.util.start
|
||||
|
||||
@ -45,4 +46,9 @@ class LoadAccountActivity : BaseActionBarActivity() {
|
||||
LoadAccountScreen(state, viewModel.qrErrors, viewModel::onChange, viewModel::onContinue, viewModel::onScanQrCode)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onRequestPermissionsResult(requestCode: Int, permissions: Array<out String>, grantResults: IntArray) {
|
||||
super.onRequestPermissionsResult(requestCode, permissions, grantResults)
|
||||
Permissions.onRequestPermissionsResult(this, requestCode, permissions, grantResults)
|
||||
}
|
||||
}
|
||||
|
@ -120,6 +120,12 @@ fun QRScannerScreen(
|
||||
stringResource(R.string.cameraGrantAccess),
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
onClick = {
|
||||
// NOTE: We used to use the Accompanist's way to handle permissions in compose
|
||||
// but it doesn't seem to offer a solution when a user manually changes a permission
|
||||
// to 'Ask every time' form the app's settings.
|
||||
// So we are using our custom implementation. ONE IMPORTANT THING with this approach
|
||||
// is that we need to make sure every activity where this composable is used NEED to
|
||||
// implement `onRequestPermissionsResult` (see LoadAccountActivity.kt for an example)
|
||||
Permissions.with(context.findActivity())
|
||||
.request(permission)
|
||||
.withPermanentDenialDialog(
|
||||
|
Loading…
Reference in New Issue
Block a user