From 60ade6625100b26a2dbb64b635826c093af94938 Mon Sep 17 00:00:00 2001 From: Thomas Ricouard Date: Thu, 4 Jan 2024 16:42:03 +0100 Subject: [PATCH] Sidebar fixes --- IceCubesApp/App/SideBarView.swift | 36 ++++++++++++++++--------------- IceCubesApp/App/Tabs/Tabs.swift | 2 +- 2 files changed, 20 insertions(+), 18 deletions(-) diff --git a/IceCubesApp/App/SideBarView.swift b/IceCubesApp/App/SideBarView.swift index 1c3ff90b..dd02a861 100644 --- a/IceCubesApp/App/SideBarView.swift +++ b/IceCubesApp/App/SideBarView.swift @@ -105,28 +105,30 @@ struct SideBarView: View { private var tabsView: some View { ForEach(tabs) { tab in - Button { - // ensure keyboard is always dismissed when selecting a tab - hideKeyboard() + if tab != .profile { + Button { + // ensure keyboard is always dismissed when selecting a tab + hideKeyboard() - if tab == selectedTab { - popToRootTab = .other - DispatchQueue.main.asyncAfter(deadline: .now() + 0.01) { - popToRootTab = tab + if tab == selectedTab { + popToRootTab = .other + DispatchQueue.main.asyncAfter(deadline: .now() + 0.01) { + popToRootTab = tab + } } - } - selectedTab = tab - SoundEffectManager.shared.playSound(.tabSelection) - if tab == .notifications { - if let token = appAccounts.currentAccount.oauthToken { - userPreferences.notificationsCount[token] = 0 + selectedTab = tab + SoundEffectManager.shared.playSound(.tabSelection) + if tab == .notifications { + if let token = appAccounts.currentAccount.oauthToken { + userPreferences.notificationsCount[token] = 0 + } + watcher.unreadNotificationsCount = 0 } - watcher.unreadNotificationsCount = 0 + } label: { + makeIconForTab(tab: tab) } - } label: { - makeIconForTab(tab: tab) + .background(tab == selectedTab ? theme.secondaryBackgroundColor : .clear) } - .background(tab == selectedTab ? theme.secondaryBackgroundColor : .clear) } } diff --git a/IceCubesApp/App/Tabs/Tabs.swift b/IceCubesApp/App/Tabs/Tabs.swift index c8ecf700..3e5d061e 100644 --- a/IceCubesApp/App/Tabs/Tabs.swift +++ b/IceCubesApp/App/Tabs/Tabs.swift @@ -24,7 +24,7 @@ enum Tab: Int, Identifiable, Hashable, CaseIterable { static func loggedInTabs() -> [Tab] { if UIDevice.current.userInterfaceIdiom == .pad || 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 { [.profile, .timeline, .trending, .federated, .local, .notifications, .mentions, .explore, .messages, .settings] } else {