Skip to content

Commit

Permalink
Fix Duplicate Biometric prompts (#3842)
Browse files Browse the repository at this point in the history
Mitigate duplicate biometric prompts caused by unexpected WindowFocusChanged events.
  • Loading branch information
RoboMagus authored Sep 6, 2023
1 parent 8c612d4 commit 54d5982
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,7 @@ class WebViewActivity : BaseActivity(), io.homeassistant.companion.android.webvi
private var firstAuthTime: Long = 0
private var resourceURL: String = ""
private var appLocked = true
private var unlockingApp = false
private var exoPlayer: ExoPlayer? = null
private var isExoFullScreen = false
private var exoTop = 0 // These margins are from the DOM and scaled to screen
Expand Down Expand Up @@ -1025,6 +1026,7 @@ class WebViewActivity : BaseActivity(), io.homeassistant.companion.android.webvi
}
else -> Log.d(TAG, "Authentication failed, retry attempts allowed")
}
unlockingApp = false
}

override fun onWindowFocusChanged(hasFocus: Boolean) {
Expand Down Expand Up @@ -1053,7 +1055,10 @@ class WebViewActivity : BaseActivity(), io.homeassistant.companion.android.webvi
appLocked = presenter.isAppLocked()
if (appLocked) {
binding.blurView.setBlurEnabled(true)
authenticator.authenticate(getString(commonR.string.biometric_title))
if (!unlockingApp) {
authenticator.authenticate(getString(commonR.string.biometric_title))
}
unlockingApp = true
} else {
binding.blurView.setBlurEnabled(false)
}
Expand Down

0 comments on commit 54d5982

Please sign in to comment.