mirror of
https://github.com/M66B/FairEmail.git
synced 2026-04-11 19:43:11 +02:00
Removed close on autolock/nav
This commit is contained in:
@@ -370,26 +370,24 @@ abstract class ActivityBase extends AppCompatActivity implements SharedPreferenc
|
||||
if (this.getClass().equals(ActivityMain.class))
|
||||
return;
|
||||
|
||||
if (Helper.shouldAuthenticate(this, !auth)) {
|
||||
lock();
|
||||
if (!Helper.shouldAuthenticate(this, !auth))
|
||||
return;
|
||||
|
||||
if (auth) {
|
||||
if (this instanceof ActivityWidget ||
|
||||
this instanceof ActivityWidgetSync ||
|
||||
this instanceof ActivityWidgetUnified) {
|
||||
Toast.makeText(this, R.string.title_notification_redacted, Toast.LENGTH_LONG).show();
|
||||
} else {
|
||||
Intent intent = getIntent();
|
||||
processStreams(intent);
|
||||
Intent main = new Intent(this, ActivityMain.class)
|
||||
.putExtra("intent", intent);
|
||||
main.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
|
||||
startActivity(main);
|
||||
}
|
||||
lock();
|
||||
|
||||
if (auth) {
|
||||
if (this instanceof ActivityWidget ||
|
||||
this instanceof ActivityWidgetSync ||
|
||||
this instanceof ActivityWidgetUnified) {
|
||||
Toast.makeText(this, R.string.title_notification_redacted, Toast.LENGTH_LONG).show();
|
||||
} else {
|
||||
Intent intent = getIntent();
|
||||
processStreams(intent);
|
||||
Intent main = new Intent(this, ActivityMain.class)
|
||||
.putExtra("intent", intent);
|
||||
main.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
|
||||
startActivity(main);
|
||||
}
|
||||
} else {
|
||||
if (!auth && Helper.shouldAutoLockNav(this))
|
||||
getMainHandler().postDelayed(autoLockNav, Helper.AUTOLOCK_GRACE * 1000L);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -399,18 +397,6 @@ abstract class ActivityBase extends AppCompatActivity implements SharedPreferenc
|
||||
finishAffinity();
|
||||
}
|
||||
|
||||
private final Runnable autoLockNav = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
if (Helper.willAuthenticate(ActivityBase.this))
|
||||
lock();
|
||||
} catch (Throwable ex) {
|
||||
Log.e(ex);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
private void processStreams(Intent intent) {
|
||||
intent.setClipData(null);
|
||||
|
||||
|
||||
@@ -2012,14 +2012,6 @@ public class Helper {
|
||||
return false;
|
||||
}
|
||||
|
||||
static boolean willAuthenticate(Context context) {
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
||||
long now = new Date().getTime();
|
||||
long last_authentication = prefs.getLong("last_authentication", 0);
|
||||
long biometrics_timeout = prefs.getInt("biometrics_timeout", 2) * 60 * 1000L;
|
||||
return (last_authentication + biometrics_timeout < now);
|
||||
}
|
||||
|
||||
static boolean shouldAutoLock(Context context) {
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
||||
boolean biometrics = prefs.getBoolean("biometrics", false);
|
||||
@@ -2028,14 +2020,6 @@ public class Helper {
|
||||
return (autolock && (biometrics || !TextUtils.isEmpty(pin)));
|
||||
}
|
||||
|
||||
static boolean shouldAutoLockNav(Context context) {
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
||||
boolean biometrics = prefs.getBoolean("biometrics", false);
|
||||
String pin = prefs.getString("pin", null);
|
||||
boolean autolock_nav = prefs.getBoolean("autolock_nav", false);
|
||||
return (autolock_nav && (biometrics || !TextUtils.isEmpty(pin)));
|
||||
}
|
||||
|
||||
static void authenticate(final FragmentActivity activity, final LifecycleOwner owner,
|
||||
Boolean enabled, final
|
||||
Runnable authenticated, final Runnable cancelled) {
|
||||
|
||||
Reference in New Issue
Block a user