Import whitelisted settings only

This commit is contained in:
M66B 2018-09-14 11:36:49 +00:00
parent 6cc20c7542
commit ec4205c783
1 changed files with 10 additions and 8 deletions

View File

@ -554,14 +554,16 @@ public class FragmentSetup extends FragmentEx {
for (int s = 0; s < jsettings.length(); s++) {
JSONObject jsetting = (JSONObject) jsettings.get(s);
String key = jsetting.getString("key");
Object value = jsetting.get("value");
if (value instanceof Boolean)
editor.putBoolean(key, (Boolean) value);
else if (value instanceof String)
editor.putString(key, (String) value);
else
throw new IllegalArgumentException("Unknown settings type key=" + key);
Log.i(Helper.TAG, "Imported setting=" + key);
if (EXPORT_SETTINGS.contains(key)) {
Object value = jsetting.get("value");
if (value instanceof Boolean)
editor.putBoolean(key, (Boolean) value);
else if (value instanceof String)
editor.putString(key, (String) value);
else
throw new IllegalArgumentException("Unknown settings type key=" + key);
Log.i(Helper.TAG, "Imported setting=" + key);
}
}
editor.apply();