Skip to content

Commit

Permalink
fix multiple dialogs issue
Browse files Browse the repository at this point in the history
  • Loading branch information
nethical6 committed Dec 30, 2024
1 parent 52a6cfb commit 9c59378
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,10 @@ class AppBlockerService : BaseBlockingService() {
private var warningMessage = ""
private var isDynamicCooldownALlowed = false
private var isProceedDisabled = false

override fun onAccessibilityEvent(event: AccessibilityEvent?) {

val packageName = event?.packageName.toString()
if (!isDelayOver()) {
if (!isDelayOver(4000)) {
return
}
handleAppBlockerResult(appBlocker.doesAppNeedToBeBlocked(packageName), packageName)
Expand Down Expand Up @@ -99,6 +98,7 @@ class AppBlockerService : BaseBlockingService() {
dialogIntent.putExtra("is_proceed_disabled", isProceedDisabled)
startActivity(dialogIntent)

lastEventActionTakenTimeStamp = SystemClock.uptimeMillis()
}

private fun setupBlocker() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class ViewBlockerService : BaseBlockingService() {
private var isProceedBtnDisabled = false

override fun onAccessibilityEvent(event: AccessibilityEvent?) {
if(!isDelayOver()){
if (!isDelayOver(4000)) {
return
}
val rootNode: AccessibilityNodeInfo? = rootInActiveWindow
Expand Down Expand Up @@ -64,7 +64,7 @@ class ViewBlockerService : BaseBlockingService() {
dialogIntent.putExtra("is_proceed_disabled", isProceedBtnDisabled)
dialogIntent.putExtra("is_press_home", result.requestHomePressInstead)
startActivity(dialogIntent)

lastEventActionTakenTimeStamp = SystemClock.uptimeMillis()
}

private val refreshReceiver = object : BroadcastReceiver() {
Expand Down

0 comments on commit 9c59378

Please sign in to comment.