From 3ea28b0afb7f3d9bbec8318d2263e16ffff53b66 Mon Sep 17 00:00:00 2001 From: Viktor De Pasquale Date: Mon, 7 Oct 2019 17:26:10 +0200 Subject: [PATCH] Fixed permission event not being executed --- .../java/com/topjohnwu/magisk/ui/flash/FlashActivity.kt | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/app/src/main/java/com/topjohnwu/magisk/ui/flash/FlashActivity.kt b/app/src/main/java/com/topjohnwu/magisk/ui/flash/FlashActivity.kt index 3b2d3c293..2f46401a4 100644 --- a/app/src/main/java/com/topjohnwu/magisk/ui/flash/FlashActivity.kt +++ b/app/src/main/java/com/topjohnwu/magisk/ui/flash/FlashActivity.kt @@ -13,6 +13,7 @@ import com.topjohnwu.magisk.base.BaseActivity import com.topjohnwu.magisk.databinding.ActivityFlashBinding import com.topjohnwu.magisk.extensions.snackbar import com.topjohnwu.magisk.model.events.BackPressEvent +import com.topjohnwu.magisk.model.events.PermissionEvent import com.topjohnwu.magisk.model.events.SnackbarEvent import com.topjohnwu.magisk.model.events.ViewEvent import org.koin.androidx.viewmodel.ext.android.viewModel @@ -46,6 +47,13 @@ open class FlashActivity : BaseActivity() when (event) { is SnackbarEvent -> snackbar(snackbarView, event.message(this), event.length, event.f) is BackPressEvent -> onBackPressed() + is PermissionEvent -> withPermissions(*event.permissions.toTypedArray()) { + onSuccess { event.callback.onNext(true) } + onFailure { + event.callback.onNext(false) + event.callback.onError(SecurityException("User refused permissions")) + } + } } }