diff --git a/apps/mobile/metro-now/metro-now/pages/settings/components/settings-page-footer.view.swift b/apps/mobile/metro-now/metro-now/pages/settings/components/settings-page-footer.view.swift deleted file mode 100644 index 1a980052..00000000 --- a/apps/mobile/metro-now/metro-now/pages/settings/components/settings-page-footer.view.swift +++ /dev/null @@ -1,24 +0,0 @@ -// metro-now -// https://github.com/krystxf/metro-now - -import SwiftUI - -struct SettingsPageFooterView: View { - var body: some View { - VStack { - Text("metro-now") - - Text("version: ") - + Text(getFormattedVersionNumber()).fontDesign(.monospaced) - - if let sourceCodeUrl = URL(string: GITHUB_URL) { - Link("source code", destination: sourceCodeUrl) - } - } - } -} - -#Preview { - Spacer() - SettingsPageFooterView() -} diff --git a/apps/mobile/metro-now/metro-now/pages/settings/components/settings-page-general-section.view.swift b/apps/mobile/metro-now/metro-now/pages/settings/components/settings-page-general-section.view.swift deleted file mode 100644 index 27fbc005..00000000 --- a/apps/mobile/metro-now/metro-now/pages/settings/components/settings-page-general-section.view.swift +++ /dev/null @@ -1,29 +0,0 @@ -// metro-now -// https://github.com/krystxf/metro-now - -import SwiftUI - -struct SettingsPageGeneralSectionView: View { - @AppStorage( - AppStorageKeys.showMetroOnly.rawValue - ) var showMetroOnly = false - - var body: some View { - Section( - header: - Label("General", systemImage: "gear"), - footer: - Text("Other means of transport will be hidden") - ) { - Toggle(isOn: $showMetroOnly) { - Text("Show only metro") - } - } - } -} - -#Preview { - List { - SettingsPageGeneralSectionView() - } -} diff --git a/apps/mobile/metro-now/metro-now/pages/settings/components/settings-page-about-section.view.swift b/apps/mobile/metro-now/metro-now/pages/settings/settings-about-page.swift similarity index 63% rename from apps/mobile/metro-now/metro-now/pages/settings/components/settings-page-about-section.view.swift rename to apps/mobile/metro-now/metro-now/pages/settings/settings-about-page.swift index ba77ab36..7bfe5297 100644 --- a/apps/mobile/metro-now/metro-now/pages/settings/components/settings-page-about-section.view.swift +++ b/apps/mobile/metro-now/metro-now/pages/settings/settings-about-page.swift @@ -7,13 +7,14 @@ private let appStoreUrl = URL( string: "https://apps.apple.com/cz/app/metro-now/id6504659402?platform=iphone" ) -struct SettingsPageAboutSectionView: View { - let version = getFormattedVersionNumber() +struct SettingsAboutPageView: View { + private let formattedVersion = getFormattedVersionNumber() + private let application = UIApplication.shared + private let version = Bundle.main.versionNumber ?? "" + private let build = Bundle.main.buildNumber ?? "" var body: some View { - Section( - header: Label("About", systemImage: "info.circle") - ) { + List { if let appStoreUrl { ShareLink(item: appStoreUrl) { Label( @@ -35,7 +36,7 @@ struct SettingsPageAboutSectionView: View { if let reportBugUrl = getGithubIssueUrl( template: .bug_report, - title: "Bug in version \(version)" + title: "Bug in version \(formattedVersion)" ) { Link(destination: reportBugUrl) { Label( @@ -57,12 +58,28 @@ struct SettingsPageAboutSectionView: View { } .accessibilityHint("Opens Github feature request form") } + + Section { + HStack{ + Text("Version") + Spacer() + Text(version).fontDesign(.monospaced) + } + HStack{ + Text("Build") + Spacer() + Text(String(build)).fontDesign(.monospaced) + } + + if let sourceCodeUrl = URL(string: GITHUB_URL) { + Link("Source code", destination: sourceCodeUrl) + } + } } + .navigationTitle("About") } } #Preview { - List { - SettingsPageAboutSectionView() - } + SettingsAboutPageView() } diff --git a/apps/mobile/metro-now/metro-now/pages/settings/settings-app-changelog.swift b/apps/mobile/metro-now/metro-now/pages/settings/settings-app-changelog.swift new file mode 100644 index 00000000..1218df9e --- /dev/null +++ b/apps/mobile/metro-now/metro-now/pages/settings/settings-app-changelog.swift @@ -0,0 +1,14 @@ + + +// metro-now +// https://github.com/krystxf/metro-now + +import SwiftUI + +struct SettingsChangelogPageView: View { + + var body: some View { + Text("Lorem ipsum") + .navigationTitle("What's new") + } +} diff --git a/apps/mobile/metro-now/metro-now/pages/settings/settings-app-icon.swift b/apps/mobile/metro-now/metro-now/pages/settings/settings-app-icon.swift new file mode 100644 index 00000000..67e38151 --- /dev/null +++ b/apps/mobile/metro-now/metro-now/pages/settings/settings-app-icon.swift @@ -0,0 +1,52 @@ + +// metro-now +// https://github.com/krystxf/metro-now + +import SwiftUI + +struct SettingsAppIconPageView: View { + private let application = UIApplication.shared + + + var body: some View { + + List{ + Section(header: Text("Choose your app icon")){ +// if application.supportsAlternateIcons { + HStack{ + Text("Prague metro") + } + .onTapGesture { + Task { @MainActor in + do { + try await application.setAlternateIconName("AppIconPragueMetro") + } catch { + print("error: \(error)") + } + } + } +// } + HStack{ + Text("metro-now") + } + .onTapGesture { + Task { @MainActor in + do { + try await application.setAlternateIconName("AppIcon") + } catch { + print("error: \(error)") + } + } + } + + } + } + .navigationTitle("App icon") + + } +} + + +#Preview { + SettingsAppIconPageView() +} diff --git a/apps/mobile/metro-now/metro-now/pages/settings/settings-page.view.swift b/apps/mobile/metro-now/metro-now/pages/settings/settings-page.view.swift index 5d6bda3e..dc7b2322 100644 --- a/apps/mobile/metro-now/metro-now/pages/settings/settings-page.view.swift +++ b/apps/mobile/metro-now/metro-now/pages/settings/settings-page.view.swift @@ -4,16 +4,40 @@ import SwiftUI struct SettingsPageView: View { + @AppStorage( + AppStorageKeys.showMetroOnly.rawValue + ) var showMetroOnly = false + var body: some View { - VStack { - List { - SettingsPageGeneralSectionView() - SettingsPageAboutSectionView() - } - Spacer() - SettingsPageFooterView() - } - .background(Color(UIColor.systemGroupedBackground)) + List { + Section(header: Text("Customize")){ + NavigationLink( + destination: SettingsAppIconPageView() + ){ + Label("App icon", systemImage: "app.dashed") + } + Toggle(isOn: $showMetroOnly) { + Text("Show only metro") + } + } + + + + Section(header: Text("More")){ + NavigationLink( + destination: SettingsChangelogPageView() + ) + { + Label("What's new", systemImage: "sparkles") + } + NavigationLink( + destination: SettingsAboutPageView() + ) + { + Label("About", systemImage: "info.square") + } + } + } .navigationTitle("Settings") } }