Merge pull request #314 from cyb3rko/fix-permission-blocking
Fix blocking permission requests
This commit is contained in:
@@ -74,7 +74,7 @@ dependencies {
|
|||||||
implementation 'androidx.vectordrawable:vectordrawable:1.1.0'
|
implementation 'androidx.vectordrawable:vectordrawable:1.1.0'
|
||||||
implementation 'androidx.preference:preference-ktx:1.2.0'
|
implementation 'androidx.preference:preference-ktx:1.2.0'
|
||||||
|
|
||||||
implementation 'com.github.cyb3rko:QuickPermissions-Kotlin:1.0.2'
|
implementation 'com.github.cyb3rko:QuickPermissions-Kotlin:1.1.2'
|
||||||
implementation 'com.hypertrack:hyperlog:0.0.10'
|
implementation 'com.hypertrack:hyperlog:0.0.10'
|
||||||
implementation 'com.squareup.picasso:picasso:2.71828'
|
implementation 'com.squareup.picasso:picasso:2.71828'
|
||||||
implementation 'io.noties.markwon:core:4.6.2'
|
implementation 'io.noties.markwon:core:4.6.2'
|
||||||
|
|||||||
@@ -85,6 +85,7 @@ internal class InitializationActivity : AppCompatActivity() {
|
|||||||
if (manager?.canScheduleExactAlarms() == true) {
|
if (manager?.canScheduleExactAlarms() == true) {
|
||||||
tryAuthenticate()
|
tryAuthenticate()
|
||||||
} else {
|
} else {
|
||||||
|
stopSlashScreen()
|
||||||
alarmDialog()
|
alarmDialog()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -108,8 +109,7 @@ internal class InitializationActivity : AppCompatActivity() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun failed(exception: ApiException) {
|
private fun failed(exception: ApiException) {
|
||||||
splashScreenActive = false
|
stopSlashScreen()
|
||||||
setContentView(R.layout.splash)
|
|
||||||
when (exception.code) {
|
when (exception.code) {
|
||||||
0 -> {
|
0 -> {
|
||||||
dialog(getString(R.string.not_available, settings.url))
|
dialog(getString(R.string.not_available, settings.url))
|
||||||
@@ -195,6 +195,7 @@ internal class InitializationActivity : AppCompatActivity() {
|
|||||||
val quickPermissionsOption = QuickPermissionsOptions(
|
val quickPermissionsOption = QuickPermissionsOptions(
|
||||||
handleRationale = true,
|
handleRationale = true,
|
||||||
handlePermanentlyDenied = true,
|
handlePermanentlyDenied = true,
|
||||||
|
preRationaleAction = { stopSlashScreen() },
|
||||||
rationaleMethod = { req -> processPermissionRationale(req) },
|
rationaleMethod = { req -> processPermissionRationale(req) },
|
||||||
permissionsDeniedMethod = { req -> processPermissionRationale(req) },
|
permissionsDeniedMethod = { req -> processPermissionRationale(req) },
|
||||||
permanentDeniedMethod = { req -> processPermissionsPermanentDenied(req) }
|
permanentDeniedMethod = { req -> processPermissionsPermanentDenied(req) }
|
||||||
@@ -210,6 +211,11 @@ internal class InitializationActivity : AppCompatActivity() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun stopSlashScreen() {
|
||||||
|
splashScreenActive = false
|
||||||
|
setContentView(R.layout.splash)
|
||||||
|
}
|
||||||
|
|
||||||
private fun processPermissionRationale(req: QuickPermissionsRequest) {
|
private fun processPermissionRationale(req: QuickPermissionsRequest) {
|
||||||
MaterialAlertDialogBuilder(this)
|
MaterialAlertDialogBuilder(this)
|
||||||
.setMessage(getString(R.string.permissions_notification_denied_temp))
|
.setMessage(getString(R.string.permissions_notification_denied_temp))
|
||||||
|
|||||||
Reference in New Issue
Block a user