diff --git a/Session/Meta/AppDelegate.swift b/Session/Meta/AppDelegate.swift index 25b860eee..f677ca9fb 100644 --- a/Session/Meta/AppDelegate.swift +++ b/Session/Meta/AppDelegate.swift @@ -390,9 +390,13 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD let unreadCount: Int = dependencies[singleton: .storage] .read { db in try Interaction.fetchAppBadgeUnreadCount(db, using: dependencies) } .defaulting(to: 0) - UIApplication.shared.applicationIconBadgeNumber = unreadCount + + DispatchQueue.main.async(using: dependencies) { + UIApplication.shared.applicationIconBadgeNumber = unreadCount + } } + // If we are still running in the background then suspend the network & database if dependencies[singleton: .appContext].isInBackground { dependencies.mutate(cache: .libSessionNetwork) { $0.suspendNetworkAccess() } dependencies[singleton: .storage].suspendDatabaseAccess()