diff options
Diffstat (limited to 'modules/expo-background-notification-handler')
4 files changed, 12 insertions, 1 deletions
diff --git a/modules/expo-background-notification-handler/android/src/main/java/expo/modules/backgroundnotificationhandler/ExpoBackgroundNotificationHandlerModule.kt b/modules/expo-background-notification-handler/android/src/main/java/expo/modules/backgroundnotificationhandler/ExpoBackgroundNotificationHandlerModule.kt index 083ff1223..c876f899a 100644 --- a/modules/expo-background-notification-handler/android/src/main/java/expo/modules/backgroundnotificationhandler/ExpoBackgroundNotificationHandlerModule.kt +++ b/modules/expo-background-notification-handler/android/src/main/java/expo/modules/backgroundnotificationhandler/ExpoBackgroundNotificationHandlerModule.kt @@ -66,5 +66,9 @@ class ExpoBackgroundNotificationHandlerModule : Module() { AsyncFunction("removeManyFromStringArrayAsync") { forKey: String, strings: Array<String> -> NotificationPrefs(appContext.reactContext).removeManyFromStringArray(forKey, strings) } + + AsyncFunction("setBadgeCountAsync") { _: Int -> + // This does nothing on Android + } } } diff --git a/modules/expo-background-notification-handler/ios/ExpoBackgroundNotificationHandlerModule.swift b/modules/expo-background-notification-handler/ios/ExpoBackgroundNotificationHandlerModule.swift index 08972a04c..5f8c7fc3b 100644 --- a/modules/expo-background-notification-handler/ios/ExpoBackgroundNotificationHandlerModule.swift +++ b/modules/expo-background-notification-handler/ios/ExpoBackgroundNotificationHandlerModule.swift @@ -10,7 +10,8 @@ let DEFAULTS: [String:Any] = [ "playSoundQuote": false, "playSoundReply": false, "playSoundRepost": false, - "mutedThreads": [:] as! [String:[String]] + "mutedThreads": [:] as! [String:[String]], + "badgeCount": 0, ] /* @@ -112,5 +113,9 @@ public class ExpoBackgroundNotificationHandlerModule: Module { userDefaults?.setValue(curr, forKey: forKey) } } + + AsyncFunction("setBadgeCountAsync") { (count: Int) in + userDefaults?.setValue(count, forKey: "badgeCount") + } } } diff --git a/modules/expo-background-notification-handler/src/ExpoBackgroundNotificationHandler.types.ts b/modules/expo-background-notification-handler/src/ExpoBackgroundNotificationHandler.types.ts index 5fbd302da..b74148db4 100644 --- a/modules/expo-background-notification-handler/src/ExpoBackgroundNotificationHandler.types.ts +++ b/modules/expo-background-notification-handler/src/ExpoBackgroundNotificationHandler.types.ts @@ -31,6 +31,7 @@ export type ExpoBackgroundNotificationHandlerModule = { forKey: keyof BackgroundNotificationHandlerPreferences, value: string[], ) => Promise<void> + setBadgeCountAsync: (count: number) => Promise<void> } // TODO there are more preferences in the native code, however they have not been added here yet. diff --git a/modules/expo-background-notification-handler/src/ExpoBackgroundNotificationHandlerModule.web.ts b/modules/expo-background-notification-handler/src/ExpoBackgroundNotificationHandlerModule.web.ts index 29e27fd0f..893548e18 100644 --- a/modules/expo-background-notification-handler/src/ExpoBackgroundNotificationHandlerModule.web.ts +++ b/modules/expo-background-notification-handler/src/ExpoBackgroundNotificationHandlerModule.web.ts @@ -24,4 +24,5 @@ export const BackgroundNotificationHandler = { removeFromStringArrayAsync: async (_: string, __: string) => {}, addManyToStringArrayAsync: async (_: string, __: string[]) => {}, removeManyFromStringArrayAsync: async (_: string, __: string[]) => {}, + setBadgeCountAsync: async (_: number) => {}, } as ExpoBackgroundNotificationHandlerModule |