Skip to content

Commit

Permalink
set badge counter to 0 when user changes setting
Browse files Browse the repository at this point in the history
  • Loading branch information
JohanDegraeve committed Jul 19, 2020
1 parent 173d47c commit 1eada0a
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -640,6 +640,14 @@ final class RootViewController: UIViewController {

case UserDefaults.Key.multipleAppBadgeValueWith10, UserDefaults.Key.showReadingInAppBadge, UserDefaults.Key.bloodGlucoseUnitIsMgDl:

// if showReadingInAppBadge = false, means user set it from true to false
// set applicationIconBadgeNumber to 0. This will cause removal of the badge counter, but als removal of any existing notification on the screen
if !UserDefaults.standard.showReadingInAppBadge {

UIApplication.shared.applicationIconBadgeNumber = 0

}

// this will trigger update of app badge, will also create notification, but as app is most likely in foreground, this won't show up
createBgReadingNotificationAndSetAppBadge(overrideShowReadingInNotification: true)

Expand Down

0 comments on commit 1eada0a

Please sign in to comment.