diff --git a/IceCubesApp/App/IceCubesApp.swift b/IceCubesApp/App/IceCubesApp.swift index 9563f303..b1e063a1 100644 --- a/IceCubesApp/App/IceCubesApp.swift +++ b/IceCubesApp/App/IceCubesApp.swift @@ -113,36 +113,34 @@ struct IceCubesApp: App { popToRootTab: $popToRootTab, tabs: availableTabs) { - GeometryReader { _ in - HStack(spacing: 0) { - ZStack { - if selectedTab == .profile { - ProfileTab(popToRootTab: $popToRootTab) - } - ForEach(availableTabs) { tab in - if tab == selectedTab || sideBarLoadedTabs.contains(tab) { - tab - .makeContentView(popToRootTab: $popToRootTab) - .opacity(tab == selectedTab ? 1 : 0) - .transition(.opacity) - .id("\(tab)\(appAccountsManager.currentAccount.id)") - .onAppear { - sideBarLoadedTabs.insert(tab) - } - } else { - EmptyView() + ZStack { + if selectedTab == .profile { + ProfileTab(popToRootTab: $popToRootTab) + } + ForEach(availableTabs) { tab in + if tab == selectedTab || sideBarLoadedTabs.contains(tab) { + tab + .makeContentView(popToRootTab: $popToRootTab) + .opacity(tab == selectedTab ? 1 : 0) + .transition(.opacity) + .id("\(tab)\(appAccountsManager.currentAccount.id)") + .onAppear { + sideBarLoadedTabs.insert(tab) } - } - } - if appAccountsManager.currentClient.isAuth, - userPreferences.showiPadSecondaryColumn - { - Divider().edgesIgnoringSafeArea(.all) - notificationsSecondaryColumn + } else { + EmptyView() } } } - }.onChange(of: $appAccountsManager.currentAccount.id) { + } + .inspector(isPresented: .init(get: { + appAccountsManager.currentClient.isAuth && userPreferences.showiPadSecondaryColumn + }, set: { newValue in + userPreferences.showiPadSecondaryColumn = newValue + }), content: { + notificationsSecondaryColumn + }) + .onChange(of: $appAccountsManager.currentAccount.id) { sideBarLoadedTabs.removeAll() } .environment(sidebarRouterPath) @@ -151,8 +149,8 @@ struct IceCubesApp: App { private var notificationsSecondaryColumn: some View { NotificationsTab(popToRootTab: $popToRootTab, lockedType: nil) .environment(\.isSecondaryColumn, true) - .frame(maxWidth: .secondaryColumnWidth) .id(appAccountsManager.currentAccount.id) + .inspectorColumnWidth(.secondaryColumnWidth) } private var tabBarView: some View { diff --git a/Packages/Notifications/Sources/Notifications/NotificationsListView.swift b/Packages/Notifications/Sources/Notifications/NotificationsListView.swift index 196d3a6a..d95f9291 100644 --- a/Packages/Notifications/Sources/Notifications/NotificationsListView.swift +++ b/Packages/Notifications/Sources/Notifications/NotificationsListView.swift @@ -75,12 +75,14 @@ public struct NotificationsListView: View { .scrollContentBackground(.hidden) .background(theme.primaryBackgroundColor) .task { - viewModel.client = client - viewModel.currentAccount = account - if let lockedType { - viewModel.selectedType = lockedType + if client.isAuth { + viewModel.client = client + viewModel.currentAccount = account + if let lockedType { + viewModel.selectedType = lockedType + } + await viewModel.fetchNotifications() } - await viewModel.fetchNotifications() } .refreshable { SoundEffectManager.shared.playSound(of: .pull) diff --git a/Packages/Notifications/Sources/Notifications/NotificationsViewModel.swift b/Packages/Notifications/Sources/Notifications/NotificationsViewModel.swift index 31c7ae1d..518393f8 100644 --- a/Packages/Notifications/Sources/Notifications/NotificationsViewModel.swift +++ b/Packages/Notifications/Sources/Notifications/NotificationsViewModel.swift @@ -93,6 +93,8 @@ import SwiftUI nextPageState: consolidatedNotifications.isEmpty ? .none : nextPageState) } } catch { + let error = error as NSError + guard error.code != -999 else { return } state = .error(error: error) } }