diff --git a/IceCubesApp.xcodeproj/project.pbxproj b/IceCubesApp.xcodeproj/project.pbxproj index a3450b83..6aa9b324 100644 --- a/IceCubesApp.xcodeproj/project.pbxproj +++ b/IceCubesApp.xcodeproj/project.pbxproj @@ -15,6 +15,7 @@ 639CDF9C296AC82F00C35E58 /* SafariRouter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 639CDF9B296AC82F00C35E58 /* SafariRouter.swift */; }; 9F15D6002B3D6A850008C220 /* NavigationTab.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9F15D5FF2B3D6A850008C220 /* NavigationTab.swift */; }; 9F15D6022B3D6E280008C220 /* TabbarEntriesSettingsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9F15D6012B3D6E280008C220 /* TabbarEntriesSettingsView.swift */; }; + 9F15D6042B3DC2180008C220 /* NavigationSheet.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9F15D6032B3DC2180008C220 /* NavigationSheet.swift */; }; 9F18801229AE477F00D85459 /* tabSelection.wav in Resources */ = {isa = PBXBuildFile; fileRef = 9F18800A29AE477E00D85459 /* tabSelection.wav */; }; 9F18801329AE477F00D85459 /* share.wav in Resources */ = {isa = PBXBuildFile; fileRef = 9F18800B29AE477E00D85459 /* share.wav */; }; 9F18801429AE477F00D85459 /* bookmark.wav in Resources */ = {isa = PBXBuildFile; fileRef = 9F18800C29AE477E00D85459 /* bookmark.wav */; }; @@ -164,6 +165,7 @@ 9664F1A8299BA5F700CBE70E /* es */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = es; path = es.lproj/InfoPlist.strings; sourceTree = ""; }; 9F15D5FF2B3D6A850008C220 /* NavigationTab.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NavigationTab.swift; sourceTree = ""; }; 9F15D6012B3D6E280008C220 /* TabbarEntriesSettingsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TabbarEntriesSettingsView.swift; sourceTree = ""; }; + 9F15D6032B3DC2180008C220 /* NavigationSheet.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NavigationSheet.swift; sourceTree = ""; }; 9F18800A29AE477E00D85459 /* tabSelection.wav */ = {isa = PBXFileReference; lastKnownFileType = audio.wav; path = tabSelection.wav; sourceTree = ""; }; 9F18800B29AE477E00D85459 /* share.wav */ = {isa = PBXFileReference; lastKnownFileType = audio.wav; path = share.wav; sourceTree = ""; }; 9F18800C29AE477E00D85459 /* bookmark.wav */ = {isa = PBXFileReference; lastKnownFileType = audio.wav; path = bookmark.wav; sourceTree = ""; }; @@ -429,6 +431,7 @@ 9F2B92F5295AE04800DE16D0 /* Tabs.swift */, 9F4A48182976B21900A1A038 /* ProfileTab.swift */, 9F15D5FF2B3D6A850008C220 /* NavigationTab.swift */, + 9F15D6032B3DC2180008C220 /* NavigationSheet.swift */, ); path = Tabs; sourceTree = ""; @@ -824,6 +827,7 @@ 069709AA298C9AD7006E4CB5 /* AboutView.swift in Sources */, 9F2B92FC295DA94500DE16D0 /* InstanceInfoView.swift in Sources */, C9B22677297F6C2E001F9EFE /* ContentSettingsView.swift in Sources */, + 9F15D6042B3DC2180008C220 /* NavigationSheet.swift in Sources */, 9FA6FD6229C04A8800E2312C /* TranslationSettingsView.swift in Sources */, 9FB183272AE9279F00BBB692 /* IceCubesApp+Tabbar.swift in Sources */, 9F35DB4C2952005C00B3281A /* MessagesTab.swift in Sources */, diff --git a/IceCubesApp/App/AppRegistry.swift b/IceCubesApp/App/AppRegistry.swift index 3c7f0bba..6d9788bc 100644 --- a/IceCubesApp/App/AppRegistry.swift +++ b/IceCubesApp/App/AppRegistry.swift @@ -97,10 +97,14 @@ extension View { .preferredColorScheme(Theme.shared.selectedScheme == .dark ? .dark : .light) case .accountPushNotficationsSettings: if let subscription = PushNotificationsService.shared.subscriptions.first(where: { $0.account.token == AppAccountsManager.shared.currentAccount.oauthToken }) { - PushNotificationsViewWrapper(subscription: subscription) + NavigationSheet { PushNotificationsView(subscription: subscription) } } else { EmptyView() } + case .about: + NavigationSheet { AboutView() } + case .support: + NavigationSheet { SupportAppView() } case let .report(status): ReportView(status: status) case let .shareImage(image, status): diff --git a/IceCubesApp/App/Tabs/NavigationSheet.swift b/IceCubesApp/App/Tabs/NavigationSheet.swift new file mode 100644 index 00000000..f581def3 --- /dev/null +++ b/IceCubesApp/App/Tabs/NavigationSheet.swift @@ -0,0 +1,30 @@ +import SwiftUI +import Env +import AppAccount +import DesignSystem + +@MainActor +struct NavigationSheet: View { + @Environment(\.dismiss) private var dismiss + + var content: () -> Content + + init(@ViewBuilder content: @escaping () -> Content) { + self.content = content + } + + var body: some View { + NavigationStack { + content() + .toolbar { + ToolbarItem(placement: .navigationBarLeading) { + Button { + dismiss() + } label: { + Image(systemName: "xmark.circle") + } + } + } + } + } +} diff --git a/IceCubesApp/App/Tabs/Settings/PushNotificationsView.swift b/IceCubesApp/App/Tabs/Settings/PushNotificationsView.swift index 3fea4dd2..63b01aaa 100644 --- a/IceCubesApp/App/Tabs/Settings/PushNotificationsView.swift +++ b/IceCubesApp/App/Tabs/Settings/PushNotificationsView.swift @@ -7,27 +7,6 @@ import NukeUI import SwiftUI import UserNotifications -struct PushNotificationsViewWrapper: View { - @Environment(\.dismiss) private var dismiss - - public let subscription: PushNotificationSubscriptionSettings - - var body: some View { - NavigationStack { - PushNotificationsView(subscription: subscription) - .toolbar { - ToolbarItem(placement: .navigationBarLeading) { - Button { - dismiss() - } label: { - Image(systemName: "xmark.circle") - } - } - } - } - } -} - @MainActor struct PushNotificationsView: View { @Environment(Theme.self) private var theme diff --git a/Packages/AppAccount/Sources/AppAccount/AppAccountsSelectorView.swift b/Packages/AppAccount/Sources/AppAccount/AppAccountsSelectorView.swift index 9fc0e8c2..b286dd9f 100644 --- a/Packages/AppAccount/Sources/AppAccount/AppAccountsSelectorView.swift +++ b/Packages/AppAccount/Sources/AppAccount/AppAccountsSelectorView.swift @@ -26,7 +26,7 @@ public struct AppAccountsSelectorView: View { } private var preferredHeight: CGFloat { - var baseHeight: CGFloat = 220 + var baseHeight: CGFloat = 310 baseHeight += CGFloat(60 * accountsViewModel.count) return baseHeight } @@ -95,6 +95,7 @@ public struct AppAccountsSelectorView: View { ForEach(accountsViewModel.sorted { $0.acct < $1.acct }, id: \.appAccount.id) { viewModel in AppAccountView(viewModel: viewModel) } + addAccountButton } #if !os(visionOS) .listRowBackground(theme.primaryBackgroundColor) @@ -102,16 +103,9 @@ public struct AppAccountsSelectorView: View { if accountCreationEnabled { Section { - Button { - isPresented = false - HapticManager.shared.fireHaptic(.buttonPress) - DispatchQueue.main.asyncAfter(deadline: .now() + 0.3) { - routerPath.presentedSheet = .addAccount - } - } label: { - Label("app-account.button.add", systemImage: "person.badge.plus") - } settingsButton + aboutButton + supportButton } #if !os(visionOS) .listRowBackground(theme.primaryBackgroundColor) @@ -135,6 +129,18 @@ public struct AppAccountsSelectorView: View { .environment(routerPath) } } + + private var addAccountButton: some View { + Button { + isPresented = false + HapticManager.shared.fireHaptic(.buttonPress) + DispatchQueue.main.asyncAfter(deadline: .now() + 0.3) { + routerPath.presentedSheet = .addAccount + } + } label: { + Label("app-account.button.add", systemImage: "person.badge.plus") + } + } private var settingsButton: some View { Button { @@ -147,6 +153,30 @@ public struct AppAccountsSelectorView: View { Label("tab.settings", systemImage: "gear") } } + + private var supportButton: some View { + Button { + isPresented = false + HapticManager.shared.fireHaptic(.buttonPress) + DispatchQueue.main.asyncAfter(deadline: .now() + 0.3) { + routerPath.presentedSheet = .support + } + } label: { + Label("settings.app.support", systemImage: "wand.and.stars") + } + } + + private var aboutButton: some View { + Button { + isPresented = false + HapticManager.shared.fireHaptic(.buttonPress) + DispatchQueue.main.asyncAfter(deadline: .now() + 0.3) { + routerPath.presentedSheet = .about + } + } label: { + Label("account.edit.about", systemImage: "info.circle") + } + } private func refreshAccounts() { accountsViewModel = [] diff --git a/Packages/Env/Sources/Env/Router.swift b/Packages/Env/Sources/Env/Router.swift index 2d2ea49b..d9023930 100644 --- a/Packages/Env/Sources/Env/Router.swift +++ b/Packages/Env/Sources/Env/Router.swift @@ -50,6 +50,8 @@ public enum SheetDestination: Identifiable { case addTagGroup case statusEditHistory(status: String) case settings + case about + case support case accountPushNotficationsSettings case report(status: Status) case shareImage(image: UIImage, status: Status) @@ -58,7 +60,7 @@ public enum SheetDestination: Identifiable { public var id: String { switch self { case .editStatusEditor, .newStatusEditor, .replyToStatusEditor, .quoteStatusEditor, - .mentionStatusEditor, .settings, .accountPushNotficationsSettings: + .mentionStatusEditor: "statusEditor" case .listCreate: "listCreate" @@ -80,6 +82,8 @@ public enum SheetDestination: Identifiable { "shareImage" case .editTagGroup: "editTagGroup" + case .settings, .support, .about, .accountPushNotficationsSettings: + "settings" } } }