mirror of
https://github.com/Dimillian/IceCubesApp.git
synced 2025-01-23 22:38:08 +00:00
Notifications: Show badge on account switcher on iOS
This commit is contained in:
parent
26e09d230b
commit
f01a742845
1 changed files with 9 additions and 1 deletions
|
@ -13,6 +13,14 @@ public struct AppAccountsSelectorView: View {
|
|||
|
||||
private let accountCreationEnabled: Bool
|
||||
private let avatarSize: AvatarView.Size
|
||||
|
||||
var showNotificationBadge: Bool {
|
||||
accountsViewModel
|
||||
.filter { $0.account?.id != currentAccount.account?.id }
|
||||
.compactMap{ $0.appAccount.oauthToken }
|
||||
.map{ preferences.getNotificationsCount(for: $0) }
|
||||
.reduce(0, +) > 0
|
||||
}
|
||||
|
||||
public init(routerPath: RouterPath,
|
||||
accountCreationEnabled: Bool = true,
|
||||
|
@ -59,7 +67,7 @@ public struct AppAccountsSelectorView: View {
|
|||
.redacted(reason: .placeholder)
|
||||
}
|
||||
}.overlay(alignment: .topTrailing) {
|
||||
if !currentAccount.followRequests.isEmpty {
|
||||
if !currentAccount.followRequests.isEmpty || showNotificationBadge {
|
||||
Circle()
|
||||
.fill(Color.red)
|
||||
.frame(width: 9, height: 9)
|
||||
|
|
Loading…
Reference in a new issue