Moved biometric authentication to privacy settings

This commit is contained in:
M66B
2019-11-01 18:08:15 +01:00
parent 98c618b2fc
commit cd2396524f
4 changed files with 80 additions and 66 deletions

View File

@@ -209,20 +209,9 @@ public class ActivitySetup extends ActivityBase implements FragmentManager.OnBac
drawerLayout.closeDrawer(drawerContainer);
onMenuOrder(R.string.title_setup_reorder_folders, TupleFolderSort.class);
}
});
}).setSeparated();
menus.add(order);
if (Helper.canAuthenticate(this))
menus.add(new NavMenuItem(R.drawable.baseline_fingerprint_24, R.string.title_setup_authentication, new Runnable() {
@Override
public void run() {
drawerLayout.closeDrawer(drawerContainer);
onMenuBiometrics();
}
}).setSeparated());
else
order.setSeparated();
menus.add(new NavMenuItem(R.drawable.baseline_help_24, R.string.menu_legend, new Runnable() {
@Override
public void run() {
@@ -423,32 +412,6 @@ public class ActivitySetup extends ActivityBase implements FragmentManager.OnBac
fragmentTransaction.commit();
}
private void onMenuBiometrics() {
final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(ActivitySetup.this);
final boolean biometrics = prefs.getBoolean("biometrics", false);
final boolean pro = ActivityBilling.isPro(this);
Helper.authenticate(this, biometrics, new Runnable() {
@Override
public void run() {
if (pro) {
prefs.edit().putBoolean("biometrics", !biometrics).apply();
ToastEx.makeText(ActivitySetup.this,
biometrics
? R.string.title_setup_biometrics_disable
: R.string.title_setup_biometrics_enable,
Toast.LENGTH_LONG).show();
} else
startActivity(new Intent(ActivitySetup.this, ActivityBilling.class));
}
}, new Runnable() {
@Override
public void run() {
// Do nothing
}
});
}
private void onMenuLegend() {
if (getLifecycle().getCurrentState().isAtLeast(Lifecycle.State.STARTED))
getSupportFragmentManager().popBackStack("legend", FragmentManager.POP_BACK_STACK_INCLUSIVE);