load preferences
This commit is contained in:
+5
@@ -64,6 +64,11 @@ public class ExpoBackgroundNotificationHandlerModule: Module {
|
||||
SharedPrefs.shared.removeFromSet(INCREMENTED_FOR_KEY, convoId)
|
||||
SharedPrefs.shared.setValue(BadgeType.messages.toKeyName(), count)
|
||||
}
|
||||
|
||||
AsyncFunction("getPrefsAsync") {
|
||||
let keys = Array(DEFAULTS.keys)
|
||||
return SharedPrefs.shared.getValues(keys)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+3
-1
@@ -31,7 +31,9 @@ export function BackgroundNotificationPreferencesProvider({
|
||||
React.useEffect(() => {
|
||||
;(async () => {
|
||||
const prefs = await BackgroundNotifications.getPrefsAsync()
|
||||
setPreferences(prefs)
|
||||
if (prefs) {
|
||||
setPreferences(prefs)
|
||||
}
|
||||
})()
|
||||
}, [])
|
||||
|
||||
|
||||
@@ -19,6 +19,6 @@ export function decrementMessagesCountAsync(
|
||||
throw new NotImplementedError({count, convoId})
|
||||
}
|
||||
|
||||
export function getPrefsAsync(): Promise<BackgroundNotificationHandlerPreferences> {
|
||||
export function getPrefsAsync(): Promise<BackgroundNotificationHandlerPreferences | null> {
|
||||
throw new NotImplementedError()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user