Merge pull request #1133 from mastodon/1132-notification-badge
Show a little red badge when there are notifications (#1132)
This commit is contained in:
commit
2fdbb9da1e
|
@ -231,14 +231,15 @@ extension MainTabBarController {
|
|||
let count = UserDefaults.shared.getNotificationCountWithAccessToken(accessToken: authentication.accessToken)
|
||||
return count > 0
|
||||
} ?? false
|
||||
|
||||
let image: UIImage
|
||||
if hasUnreadPushNotification {
|
||||
let imageConfiguration = UIImage.SymbolConfiguration(paletteColors: [.red, SystemTheme.tabBarItemNormalIconColor])
|
||||
image = UIImage(systemName: "bell.badge", withConfiguration: imageConfiguration)!
|
||||
} else {
|
||||
image = Tab.notifications.image
|
||||
}
|
||||
|
||||
let image: UIImage = {
|
||||
if hasUnreadPushNotification {
|
||||
return UIImage(systemName: "bell.badge")!
|
||||
} else {
|
||||
return Tab.notifications.image
|
||||
}
|
||||
}()
|
||||
notificationViewController.tabBarItem.image = image.imageWithoutBaseline()
|
||||
notificationViewController.navigationController?.tabBarItem.image = image.imageWithoutBaseline()
|
||||
}
|
||||
|
|
|
@ -119,13 +119,13 @@ extension SidebarViewModel {
|
|||
return count > 0
|
||||
}()
|
||||
|
||||
let image: UIImage = {
|
||||
if hasUnreadPushNotification {
|
||||
return UIImage(systemName: "bell.badge")!
|
||||
} else {
|
||||
return MainTabBarController.Tab.notifications.image
|
||||
}
|
||||
}()
|
||||
let image: UIImage
|
||||
if hasUnreadPushNotification {
|
||||
let imageConfiguration = UIImage.SymbolConfiguration(paletteColors: [.red, SystemTheme.tabBarItemNormalIconColor])
|
||||
image = UIImage(systemName: "bell.badge", withConfiguration: imageConfiguration)!
|
||||
} else {
|
||||
image = MainTabBarController.Tab.notifications.image
|
||||
}
|
||||
cell.item?.image = image
|
||||
cell.item?.activeImage = image.withTintColor(Asset.Colors.Brand.blurple.color, renderingMode: .alwaysOriginal)
|
||||
cell.setNeedsUpdateConfiguration()
|
||||
|
|
Loading…
Reference in New Issue