1
0
mirror of https://github.com/AllanWang/Frost-for-Facebook.git synced 2024-11-08 12:02:33 +01:00

Merge pull request #1535 from AllanWang/fix-biometrics

Move biometric init out of coroutine launch
This commit is contained in:
Allan Wang 2019-09-09 00:41:19 -07:00 committed by GitHub
commit 35a2e236e3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 11 additions and 4 deletions

View File

@ -70,8 +70,8 @@ class StartActivity : KauBaseActivity() {
showInvalidWebView() showInvalidWebView()
} }
val authDefer = BiometricUtils.authenticate(this@StartActivity)
launch { launch {
val authDefer = BiometricUtils.authenticate(this@StartActivity)
try { try {
FbCookie.switchBackUser() FbCookie.switchBackUser()
val cookies = ArrayList(cookieDao.selectAll()) val cookies = ArrayList(cookieDao.selectAll())

View File

@ -209,8 +209,8 @@ abstract class WebOverlayActivityBase : BaseActivity(),
with(web) { with(web) {
Prefs.prevId = Prefs.userId Prefs.prevId = Prefs.userId
val authDefer = BiometricUtils.authenticate(this@WebOverlayActivityBase)
launch { launch {
val authDefer = BiometricUtils.authenticate(this@WebOverlayActivityBase)
if (userId != Prefs.userId) if (userId != Prefs.userId)
FbCookie.switchUser(userId) FbCookie.switchUser(userId)
authDefer.await() authDefer.await()

View File

@ -65,6 +65,11 @@ object BiometricUtils {
return Prefs.biometricsEnabled && System.currentTimeMillis() - lastUnlockTime > UNLOCK_TIME_INTERVAL return Prefs.biometricsEnabled && System.currentTimeMillis() - lastUnlockTime > UNLOCK_TIME_INTERVAL
} }
/**
* Generates a prompt dialog and attempt to return an auth object.
* Note that the underlying request will call [androidx.fragment.app.FragmentTransaction.commit],
* so this cannot happen after onSaveInstanceState.
*/
fun authenticate(activity: FragmentActivity, force: Boolean = false): BiometricDeferred { fun authenticate(activity: FragmentActivity, force: Boolean = false): BiometricDeferred {
val deferred: BiometricDeferred = CompletableDeferred() val deferred: BiometricDeferred = CompletableDeferred()
if (!force && !shouldPrompt(activity)) { if (!force && !shouldPrompt(activity)) {

View File

@ -1,3 +1,4 @@
v2.4.0 v2.4.0
* Removed web only mode for auth requests. Marking notifications as read is now disabled by default to deal with phishing accusations. * Removed web only mode for auth requests. Marking notifications as read is now disabled by default to deal with phishing accusations.
* Save images with the correct extensions.

View File

@ -8,7 +8,7 @@
<version title="v2.4.0" /> <version title="v2.4.0" />
<item text="Removed web only mode for auth requests. Marking notifications as read is now disabled by default to deal with phishing accusations." /> <item text="Removed web only mode for auth requests. Marking notifications as read is now disabled by default to deal with phishing accusations." />
<item text="" /> <item text="Save images with the correct extensions." />
<item text="" /> <item text="" />
<version title="v2.3.2" /> <version title="v2.3.2" />

View File

@ -2,6 +2,7 @@
## v2.4.0 ## v2.4.0
* Removed web only mode for auth requests. Marking notifications as read is now disabled by default to deal with phishing accusations. * Removed web only mode for auth requests. Marking notifications as read is now disabled by default to deal with phishing accusations.
* Save images with the correct extensions.
## v2.3.2 ## v2.3.2
* Disable auto feed refresh by default and add setting to re-enable it * Disable auto feed refresh by default and add setting to re-enable it