mirror of
https://github.com/M66B/FairEmail.git
synced 2025-02-24 15:11:03 +00:00
Prevent importing biometrics without available sensor
This commit is contained in:
parent
04286e9175
commit
830c05839a
1 changed files with 20 additions and 14 deletions
|
@ -881,20 +881,26 @@ public class ActivitySetup extends ActivityBase implements FragmentManager.OnBac
|
|||
for (int s = 0; s < jsettings.length(); s++) {
|
||||
JSONObject jsetting = (JSONObject) jsettings.get(s);
|
||||
String key = jsetting.getString("key");
|
||||
if (!"pro".equals(key) || BuildConfig.DEBUG) {
|
||||
Object value = jsetting.get("value");
|
||||
if (value instanceof Boolean)
|
||||
editor.putBoolean(key, (Boolean) value);
|
||||
else if (value instanceof Integer)
|
||||
editor.putInt(key, (Integer) value);
|
||||
else if (value instanceof Long)
|
||||
editor.putLong(key, (Long) value);
|
||||
else if (value instanceof String)
|
||||
editor.putString(key, (String) value);
|
||||
else
|
||||
throw new IllegalArgumentException("Unknown settings type key=" + key);
|
||||
Log.i("Imported setting=" + key);
|
||||
}
|
||||
|
||||
if ("pro".equals(key) && !BuildConfig.DEBUG)
|
||||
continue;
|
||||
|
||||
if ("biometrics".equals(key) && !Helper.canAuthenticate(context))
|
||||
continue;
|
||||
|
||||
Object value = jsetting.get("value");
|
||||
if (value instanceof Boolean)
|
||||
editor.putBoolean(key, (Boolean) value);
|
||||
else if (value instanceof Integer)
|
||||
editor.putInt(key, (Integer) value);
|
||||
else if (value instanceof Long)
|
||||
editor.putLong(key, (Long) value);
|
||||
else if (value instanceof String)
|
||||
editor.putString(key, (String) value);
|
||||
else
|
||||
throw new IllegalArgumentException("Unknown settings type key=" + key);
|
||||
|
||||
Log.i("Imported setting=" + key);
|
||||
}
|
||||
editor.apply();
|
||||
ApplicationEx.upgrade(context);
|
||||
|
|
Loading…
Reference in a new issue