mirror of
https://github.com/topjohnwu/Magisk.git
synced 2025-04-17 02:01:24 +00:00
Ignore the response until showDialog done
This commit is contained in:
parent
8c858592c4
commit
cffd024e9e
@ -73,7 +73,8 @@ class SuRequestViewModel(
|
|||||||
val itemBinding = ItemBinding.of<String>(BR.item, R.layout.item_spinner)
|
val itemBinding = ItemBinding.of<String>(BR.item, R.layout.item_spinner)
|
||||||
|
|
||||||
private val handler = SuRequestHandler(AppContext.packageManager, policyDB)
|
private val handler = SuRequestHandler(AppContext.packageManager, policyDB)
|
||||||
private var timer: CountDownTimer? = null
|
private lateinit var timer: CountDownTimer
|
||||||
|
private var initialized = false
|
||||||
|
|
||||||
fun grantPressed() {
|
fun grantPressed() {
|
||||||
cancelTimer()
|
cancelTimer()
|
||||||
@ -122,10 +123,16 @@ class SuRequestViewModel(
|
|||||||
|
|
||||||
// Actually show the UI
|
// Actually show the UI
|
||||||
ShowUIEvent(if (Config.suTapjack) EmptyAccessibilityDelegate else null).publish()
|
ShowUIEvent(if (Config.suTapjack) EmptyAccessibilityDelegate else null).publish()
|
||||||
|
initialized = true
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun respond(action: Int) {
|
private fun respond(action: Int) {
|
||||||
timer?.cancel()
|
if (!initialized) {
|
||||||
|
// ignore the response until showDialog done
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
timer.cancel()
|
||||||
|
|
||||||
val pos = selectedItemPosition
|
val pos = selectedItemPosition
|
||||||
timeoutPrefs.edit().putInt(handler.pkgInfo.packageName, pos).apply()
|
timeoutPrefs.edit().putInt(handler.pkgInfo.packageName, pos).apply()
|
||||||
@ -138,7 +145,7 @@ class SuRequestViewModel(
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun cancelTimer() {
|
private fun cancelTimer() {
|
||||||
timer?.cancel()
|
timer.cancel()
|
||||||
denyText.seconds = 0
|
denyText.seconds = 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user