add getNativeBooleanSetting method
This commit is contained in:
parent
4d1f142f9c
commit
5aa0513324
1 changed files with 10 additions and 0 deletions
|
@ -456,6 +456,16 @@ public class UtilityModule extends ReactContextBaseJavaModule {
|
|||
}
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
public void getNativeBooleanSetting(String key, boolean defaultValue, Promise promise) {
|
||||
if (context != null) {
|
||||
SharedPreferences sp = context.getSharedPreferences(MainActivity.SHARED_PREFERENCES_NAME, Context.MODE_PRIVATE);
|
||||
promise.resolve(sp.getBoolean(key, defaultValue));
|
||||
} else {
|
||||
promise.resolve(null);
|
||||
}
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
public void setNativeStringSetting(String key, String value) {
|
||||
if (context != null) {
|
||||
|
|
Loading…
Reference in a new issue