mirror of
https://github.com/Dimillian/IceCubesApp.git
synced 2025-06-05 21:38:50 +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
|
@ -14,6 +14,14 @@ public struct AppAccountsSelectorView: View {
|
||||||
private let accountCreationEnabled: Bool
|
private let accountCreationEnabled: Bool
|
||||||
private let avatarSize: AvatarView.Size
|
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,
|
public init(routerPath: RouterPath,
|
||||||
accountCreationEnabled: Bool = true,
|
accountCreationEnabled: Bool = true,
|
||||||
avatarSize: AvatarView.Size = .badge)
|
avatarSize: AvatarView.Size = .badge)
|
||||||
|
@ -59,7 +67,7 @@ public struct AppAccountsSelectorView: View {
|
||||||
.redacted(reason: .placeholder)
|
.redacted(reason: .placeholder)
|
||||||
}
|
}
|
||||||
}.overlay(alignment: .topTrailing) {
|
}.overlay(alignment: .topTrailing) {
|
||||||
if !currentAccount.followRequests.isEmpty {
|
if !currentAccount.followRequests.isEmpty || showNotificationBadge {
|
||||||
Circle()
|
Circle()
|
||||||
.fill(Color.red)
|
.fill(Color.red)
|
||||||
.frame(width: 9, height: 9)
|
.frame(width: 9, height: 9)
|
||||||
|
|
Loading…
Reference in a new issue