From 5aa051332447a00c0b6586c31b34108f5c8c132d Mon Sep 17 00:00:00 2001 From: Akinwale Ariwodola Date: Sat, 21 Mar 2020 09:18:48 +0100 Subject: [PATCH] add getNativeBooleanSetting method --- .../io/lbry/browser/reactmodules/UtilityModule.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/app/src/main/java/io/lbry/browser/reactmodules/UtilityModule.java b/app/src/main/java/io/lbry/browser/reactmodules/UtilityModule.java index aac2e999..2be60d7e 100644 --- a/app/src/main/java/io/lbry/browser/reactmodules/UtilityModule.java +++ b/app/src/main/java/io/lbry/browser/reactmodules/UtilityModule.java @@ -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) {