mirror of
https://github.com/gitnex-org/gitnex.git
synced 2026-04-27 19:16:55 -05:00
Fix biometric lock on cancel
This commit is contained in:
@@ -4,6 +4,7 @@ import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.biometric.BiometricManager;
|
||||
import java.util.Locale;
|
||||
import org.mian.gitnex.R;
|
||||
import org.mian.gitnex.core.MainApplication;
|
||||
@@ -118,15 +119,20 @@ public abstract class BaseActivity extends AppCompatActivity {
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
|
||||
if (Boolean.parseBoolean(
|
||||
AppDatabaseSettings.getSettingsValue(
|
||||
ctx, AppDatabaseSettings.APP_BIOMETRIC_KEY))
|
||||
&& !Boolean.parseBoolean(
|
||||
AppDatabaseSettings.getSettingsValue(
|
||||
ctx, AppDatabaseSettings.APP_BIOMETRIC_LIFE_CYCLE_KEY))) {
|
||||
if (BiometricManager.from(ctx)
|
||||
.canAuthenticate(BiometricManager.Authenticators.BIOMETRIC_WEAK)
|
||||
== BiometricManager.BIOMETRIC_SUCCESS) {
|
||||
|
||||
Intent unlockIntent = new Intent(ctx, BiometricUnlock.class);
|
||||
ctx.startActivity(unlockIntent);
|
||||
if (Boolean.parseBoolean(
|
||||
AppDatabaseSettings.getSettingsValue(
|
||||
ctx, AppDatabaseSettings.APP_BIOMETRIC_KEY))
|
||||
&& !Boolean.parseBoolean(
|
||||
AppDatabaseSettings.getSettingsValue(
|
||||
ctx, AppDatabaseSettings.APP_BIOMETRIC_LIFE_CYCLE_KEY))) {
|
||||
|
||||
Intent unlockIntent = new Intent(ctx, BiometricUnlock.class);
|
||||
ctx.startActivity(unlockIntent);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ public class BiometricUnlock extends AppCompatActivity {
|
||||
|
||||
super.onAuthenticationError(errorCode, errString);
|
||||
|
||||
// Authentication error, close the app
|
||||
MainActivity.closeActivity = true;
|
||||
finish();
|
||||
}
|
||||
|
||||
|
||||
@@ -87,6 +87,7 @@ public class MainActivity extends BaseActivity
|
||||
private BottomSheetListener profileInitListener;
|
||||
private FragmentRefreshListener fragmentRefreshListenerMyIssues;
|
||||
private String username;
|
||||
public static boolean closeActivity = false;
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
@@ -582,6 +583,11 @@ public class MainActivity extends BaseActivity
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
|
||||
if (closeActivity) {
|
||||
finishAndRemoveTask();
|
||||
closeActivity = false;
|
||||
}
|
||||
|
||||
if (refActivity) {
|
||||
this.recreate();
|
||||
this.overridePendingTransition(0, 0);
|
||||
|
||||
Reference in New Issue
Block a user