diff --git a/apps/mobile/metro-now/common/const/review-url.const.swift b/apps/mobile/metro-now/common/const/review-url.const.swift index ebe87165..81ed09ff 100644 --- a/apps/mobile/metro-now/common/const/review-url.const.swift +++ b/apps/mobile/metro-now/common/const/review-url.const.swift @@ -6,3 +6,7 @@ import Foundation let REVIEW_URL = URL( string: "https://itunes.apple.com/us/app/metro-now/id6504659402?mt=8&action=write-review" ) + +let appStoreUrl = URL( + string: "https://apps.apple.com/cz/app/metro-now/id6504659402?platform=iphone" +) diff --git a/apps/mobile/metro-now/metro-now.xcodeproj/project.pbxproj b/apps/mobile/metro-now/metro-now.xcodeproj/project.pbxproj index f2df4f40..4a174a0b 100644 --- a/apps/mobile/metro-now/metro-now.xcodeproj/project.pbxproj +++ b/apps/mobile/metro-now/metro-now.xcodeproj/project.pbxproj @@ -537,6 +537,7 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; + ASSETCATALOG_COMPILER_INCLUDE_ALL_APPICON_ASSETS = YES; CODE_SIGN_STYLE = Automatic; CURRENT_PROJECT_VERSION = 6; DEVELOPMENT_ASSET_PATHS = "\"metro-now/Preview Content\""; @@ -571,6 +572,7 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; + ASSETCATALOG_COMPILER_INCLUDE_ALL_APPICON_ASSETS = YES; CODE_SIGN_STYLE = Automatic; CURRENT_PROJECT_VERSION = 6; DEVELOPMENT_ASSET_PATHS = "\"metro-now/Preview Content\""; diff --git a/apps/mobile/metro-now/metro-now/Assets.xcassets/AbouIcon.imageset/Contents.json b/apps/mobile/metro-now/metro-now/Assets.xcassets/AbouIcon.imageset/Contents.json new file mode 100644 index 00000000..69b4d2b8 --- /dev/null +++ b/apps/mobile/metro-now/metro-now/Assets.xcassets/AbouIcon.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images": [ + { + "filename": "icon-1024x1024.png", + "idiom": "universal", + "scale": "1x" + }, + { + "idiom": "universal", + "scale": "2x" + }, + { + "idiom": "universal", + "scale": "3x" + } + ], + "info": { + "author": "xcode", + "version": 1 + } +} diff --git a/apps/mobile/metro-now/metro-now/Assets.xcassets/AbouIcon.imageset/icon-1024x1024.png b/apps/mobile/metro-now/metro-now/Assets.xcassets/AbouIcon.imageset/icon-1024x1024.png new file mode 100644 index 00000000..4188c67a Binary files /dev/null and b/apps/mobile/metro-now/metro-now/Assets.xcassets/AbouIcon.imageset/icon-1024x1024.png differ diff --git a/apps/mobile/metro-now/metro-now/Assets.xcassets/Images/BlueImage.imageset/Contents.json b/apps/mobile/metro-now/metro-now/Assets.xcassets/Images/BlueImage.imageset/Contents.json new file mode 100644 index 00000000..6bd35adb --- /dev/null +++ b/apps/mobile/metro-now/metro-now/Assets.xcassets/Images/BlueImage.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images": [ + { + "idiom": "universal", + "scale": "1x" + }, + { + "filename": "icon-1024x1024.png", + "idiom": "universal", + "scale": "2x" + }, + { + "idiom": "universal", + "scale": "3x" + } + ], + "info": { + "author": "xcode", + "version": 1 + } +} diff --git a/apps/mobile/metro-now/metro-now/Assets.xcassets/Images/BlueImage.imageset/icon-1024x1024.png b/apps/mobile/metro-now/metro-now/Assets.xcassets/Images/BlueImage.imageset/icon-1024x1024.png new file mode 100644 index 00000000..4188c67a Binary files /dev/null and b/apps/mobile/metro-now/metro-now/Assets.xcassets/Images/BlueImage.imageset/icon-1024x1024.png differ diff --git a/apps/mobile/metro-now/metro-now/Assets.xcassets/Images/Contents.json b/apps/mobile/metro-now/metro-now/Assets.xcassets/Images/Contents.json new file mode 100644 index 00000000..dd65c04e --- /dev/null +++ b/apps/mobile/metro-now/metro-now/Assets.xcassets/Images/Contents.json @@ -0,0 +1,6 @@ +{ + "info": { + "author": "xcode", + "version": 1 + } +} 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/components/settings-page-about-section.view.swift deleted file mode 100644 index ba77ab36..00000000 --- a/apps/mobile/metro-now/metro-now/pages/settings/components/settings-page-about-section.view.swift +++ /dev/null @@ -1,68 +0,0 @@ -// metro-now -// https://github.com/krystxf/metro-now - -import SwiftUI - -private let appStoreUrl = URL( - string: "https://apps.apple.com/cz/app/metro-now/id6504659402?platform=iphone" -) - -struct SettingsPageAboutSectionView: View { - let version = getFormattedVersionNumber() - - var body: some View { - Section( - header: Label("About", systemImage: "info.circle") - ) { - if let appStoreUrl { - ShareLink(item: appStoreUrl) { - Label( - "Share metro-now", - systemImage: "square.and.arrow.up" - ) - } - } - - if let REVIEW_URL { - Link(destination: REVIEW_URL) { - Label( - "Give us a rating", - systemImage: "star" - ) - } - .accessibilityHint("Opens app rating in app store") - } - - if let reportBugUrl = getGithubIssueUrl( - template: .bug_report, - title: "Bug in version \(version)" - ) { - Link(destination: reportBugUrl) { - Label( - "Report bug", - systemImage: "bubble.left.and.exclamationmark.bubble.right" - ) - } - .accessibilityHint("Opens Github issue form") - } - - if let featureRequestUrl = getGithubIssueUrl( - template: .feature_request - ) { - Link(destination: featureRequestUrl) { - Label( - "Feature request", - systemImage: "star.bubble" - ) - } - .accessibilityHint("Opens Github feature request form") - } - } - } -} - -#Preview { - List { - SettingsPageAboutSectionView() - } -} 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/settings-about-page.swift b/apps/mobile/metro-now/metro-now/pages/settings/settings-about-page.swift new file mode 100644 index 00000000..494b5064 --- /dev/null +++ b/apps/mobile/metro-now/metro-now/pages/settings/settings-about-page.swift @@ -0,0 +1,100 @@ +// metro-now +// https://github.com/krystxf/metro-now + +import SwiftUI +import UIKit + +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 { + VStack { + List { + Section { + HStack { + Spacer() + VStack { + Image("BlueImage") + .resizable() + .frame(width: 64, height: 64) + .cornerRadius(16) + Text("About") + .font(.title) + .fontWeight(.bold) + Text("The app is still in development. Stay tuned to see what's next!") + } + Spacer() + } + } + + if let appStoreUrl { + ShareLink(item: appStoreUrl) { + Label( + "Share metro-now", + systemImage: "square.and.arrow.up" + ) + } + } + + if let REVIEW_URL { + Link(destination: REVIEW_URL) { + Label( + "Give us a rating", + systemImage: "star" + ) + } + .accessibilityHint("Opens app rating in app store") + } + + if let reportBugUrl = getGithubIssueUrl( + template: .bug_report, + title: "Bug in version \(formattedVersion)" + ) { + Link(destination: reportBugUrl) { + Label( + "Report bug", + systemImage: "bubble.left.and.exclamationmark.bubble.right" + ) + } + .accessibilityHint("Opens Github issue form") + } + + if let featureRequestUrl = getGithubIssueUrl( + template: .feature_request + ) { + Link(destination: featureRequestUrl) { + Label( + "Feature request", + systemImage: "star.bubble" + ) + } + .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) + } + } + } + }.background(Color(UIColor.systemGroupedBackground)) + } +} + +#Preview { + 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..3aba6321 --- /dev/null +++ b/apps/mobile/metro-now/metro-now/pages/settings/settings-app-changelog.swift @@ -0,0 +1,58 @@ + + +// metro-now +// https://github.com/krystxf/metro-now + +import SwiftUI + +struct ChangelogItem: View { + let version: String + let changes: String + + init(version: String, changes: [String]) { + self.version = version + + self.changes = changes.map { "• \($0)" }.joined(separator: "\n") + } + + var body: some View { + VStack { + Text(version) + .font(.headline) + .fontWeight(.bold) + .frame(maxWidth: .infinity, alignment: .leading) + Text(changes) + .frame(maxWidth: .infinity, alignment: .leading) + } + } +} + +struct SettingsChangelogPageView: View { + var body: some View { + VStack(spacing: 16) { + Divider() + ChangelogItem( + version: "v0.3.0", + changes: [ + "bus departures", + "settings", + "search", + ] + ) + Divider() + ChangelogItem( + version: "v0.1.0", + changes: [ + "metro now is here!🎉", + ] + ) + } + .padding() + .frame(maxHeight: .infinity, alignment: .top) + .navigationTitle("What's new") + } +} + +#Preview { + SettingsChangelogPageView() +} 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..fc44db1e --- /dev/null +++ b/apps/mobile/metro-now/metro-now/pages/settings/settings-app-icon.swift @@ -0,0 +1,47 @@ + +// 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..51e43995 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,36 @@ import SwiftUI struct SettingsPageView: View { + @AppStorage( + AppStorageKeys.showMetroOnly.rawValue + ) var showMetroOnly = false + var body: some View { - VStack { - List { - SettingsPageGeneralSectionView() - SettingsPageAboutSectionView() + 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") + } } - Spacer() - SettingsPageFooterView() } - .background(Color(UIColor.systemGroupedBackground)) .navigationTitle("Settings") } }