Sidebar fixes
This commit is contained in:
parent
469b99f3c9
commit
60ade66251
|
@ -105,28 +105,30 @@ struct SideBarView<Content: View>: View {
|
||||||
|
|
||||||
private var tabsView: some View {
|
private var tabsView: some View {
|
||||||
ForEach(tabs) { tab in
|
ForEach(tabs) { tab in
|
||||||
Button {
|
if tab != .profile {
|
||||||
// ensure keyboard is always dismissed when selecting a tab
|
Button {
|
||||||
hideKeyboard()
|
// ensure keyboard is always dismissed when selecting a tab
|
||||||
|
hideKeyboard()
|
||||||
|
|
||||||
if tab == selectedTab {
|
if tab == selectedTab {
|
||||||
popToRootTab = .other
|
popToRootTab = .other
|
||||||
DispatchQueue.main.asyncAfter(deadline: .now() + 0.01) {
|
DispatchQueue.main.asyncAfter(deadline: .now() + 0.01) {
|
||||||
popToRootTab = tab
|
popToRootTab = tab
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
selectedTab = tab
|
||||||
selectedTab = tab
|
SoundEffectManager.shared.playSound(.tabSelection)
|
||||||
SoundEffectManager.shared.playSound(.tabSelection)
|
if tab == .notifications {
|
||||||
if tab == .notifications {
|
if let token = appAccounts.currentAccount.oauthToken {
|
||||||
if let token = appAccounts.currentAccount.oauthToken {
|
userPreferences.notificationsCount[token] = 0
|
||||||
userPreferences.notificationsCount[token] = 0
|
}
|
||||||
|
watcher.unreadNotificationsCount = 0
|
||||||
}
|
}
|
||||||
watcher.unreadNotificationsCount = 0
|
} label: {
|
||||||
|
makeIconForTab(tab: tab)
|
||||||
}
|
}
|
||||||
} label: {
|
.background(tab == selectedTab ? theme.secondaryBackgroundColor : .clear)
|
||||||
makeIconForTab(tab: tab)
|
|
||||||
}
|
}
|
||||||
.background(tab == selectedTab ? theme.secondaryBackgroundColor : .clear)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,7 @@ enum Tab: Int, Identifiable, Hashable, CaseIterable {
|
||||||
static func loggedInTabs() -> [Tab] {
|
static func loggedInTabs() -> [Tab] {
|
||||||
if UIDevice.current.userInterfaceIdiom == .pad ||
|
if UIDevice.current.userInterfaceIdiom == .pad ||
|
||||||
UIDevice.current.userInterfaceIdiom == .mac {
|
UIDevice.current.userInterfaceIdiom == .mac {
|
||||||
[.timeline, .trending, .federated, .local, .notifications, .mentions, .explore, .messages, .bookmarks, .favorites, .settings]
|
[.timeline, .trending, .federated, .local, .notifications, .mentions, .explore, .messages, .bookmarks, .favorites, .profile, .settings]
|
||||||
} else if UIDevice.current.userInterfaceIdiom == .vision {
|
} else if UIDevice.current.userInterfaceIdiom == .vision {
|
||||||
[.profile, .timeline, .trending, .federated, .local, .notifications, .mentions, .explore, .messages, .settings]
|
[.profile, .timeline, .trending, .federated, .local, .notifications, .mentions, .explore, .messages, .settings]
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue