Skip to content

Commit ab88e34

Browse files
committed
refactor(app): settings page
1 parent 8195d15 commit ab88e34

File tree

14 files changed

+241
-128
lines changed

14 files changed

+241
-128
lines changed

apps/mobile/metro-now/common/const/review-url.const.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,7 @@ import Foundation
66
let REVIEW_URL = URL(
77
string: "https://itunes.apple.com/us/app/metro-now/id6504659402?mt=8&action=write-review"
88
)
9+
10+
let appStoreUrl = URL(
11+
string: "https://apps.apple.com/cz/app/metro-now/id6504659402?platform=iphone"
12+
)

apps/mobile/metro-now/metro-now.xcodeproj/project.pbxproj

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -537,6 +537,7 @@
537537
buildSettings = {
538538
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
539539
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
540+
ASSETCATALOG_COMPILER_INCLUDE_ALL_APPICON_ASSETS = YES;
540541
CODE_SIGN_STYLE = Automatic;
541542
CURRENT_PROJECT_VERSION = 6;
542543
DEVELOPMENT_ASSET_PATHS = "\"metro-now/Preview Content\"";
@@ -571,6 +572,7 @@
571572
buildSettings = {
572573
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
573574
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
575+
ASSETCATALOG_COMPILER_INCLUDE_ALL_APPICON_ASSETS = YES;
574576
CODE_SIGN_STYLE = Automatic;
575577
CURRENT_PROJECT_VERSION = 6;
576578
DEVELOPMENT_ASSET_PATHS = "\"metro-now/Preview Content\"";
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"images": [
3+
{
4+
"filename": "icon-1024x1024.png",
5+
"idiom": "universal",
6+
"scale": "1x"
7+
},
8+
{
9+
"idiom": "universal",
10+
"scale": "2x"
11+
},
12+
{
13+
"idiom": "universal",
14+
"scale": "3x"
15+
}
16+
],
17+
"info": {
18+
"author": "xcode",
19+
"version": 1
20+
}
21+
}
Loading
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"images": [
3+
{
4+
"idiom": "universal",
5+
"scale": "1x"
6+
},
7+
{
8+
"filename": "icon-1024x1024.png",
9+
"idiom": "universal",
10+
"scale": "2x"
11+
},
12+
{
13+
"idiom": "universal",
14+
"scale": "3x"
15+
}
16+
],
17+
"info": {
18+
"author": "xcode",
19+
"version": 1
20+
}
21+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"info": {
3+
"author": "xcode",
4+
"version": 1
5+
}
6+
}

apps/mobile/metro-now/metro-now/pages/settings/components/settings-page-about-section.view.swift

Lines changed: 0 additions & 68 deletions
This file was deleted.

apps/mobile/metro-now/metro-now/pages/settings/components/settings-page-footer.view.swift

Lines changed: 0 additions & 24 deletions
This file was deleted.

apps/mobile/metro-now/metro-now/pages/settings/components/settings-page-general-section.view.swift

Lines changed: 0 additions & 29 deletions
This file was deleted.
Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
// metro-now
2+
// https://github.com/krystxf/metro-now
3+
4+
import SwiftUI
5+
import UIKit
6+
7+
struct SettingsAboutPageView: View {
8+
private let formattedVersion = getFormattedVersionNumber()
9+
private let application = UIApplication.shared
10+
private let version = Bundle.main.versionNumber ?? ""
11+
private let build = Bundle.main.buildNumber ?? ""
12+
13+
var body: some View {
14+
VStack {
15+
List {
16+
Section {
17+
HStack {
18+
Spacer()
19+
VStack {
20+
Image("BlueImage")
21+
.resizable()
22+
.frame(width: 64, height: 64)
23+
.cornerRadius(16)
24+
Text("About")
25+
.font(.title)
26+
.fontWeight(.bold)
27+
Text("The app is still in development. Stay tuned to see what's next!")
28+
}
29+
Spacer()
30+
}
31+
}
32+
33+
if let appStoreUrl {
34+
ShareLink(item: appStoreUrl) {
35+
Label(
36+
"Share metro-now",
37+
systemImage: "square.and.arrow.up"
38+
)
39+
}
40+
}
41+
42+
if let REVIEW_URL {
43+
Link(destination: REVIEW_URL) {
44+
Label(
45+
"Give us a rating",
46+
systemImage: "star"
47+
)
48+
}
49+
.accessibilityHint("Opens app rating in app store")
50+
}
51+
52+
if let reportBugUrl = getGithubIssueUrl(
53+
template: .bug_report,
54+
title: "Bug in version \(formattedVersion)"
55+
) {
56+
Link(destination: reportBugUrl) {
57+
Label(
58+
"Report bug",
59+
systemImage: "bubble.left.and.exclamationmark.bubble.right"
60+
)
61+
}
62+
.accessibilityHint("Opens Github issue form")
63+
}
64+
65+
if let featureRequestUrl = getGithubIssueUrl(
66+
template: .feature_request
67+
) {
68+
Link(destination: featureRequestUrl) {
69+
Label(
70+
"Feature request",
71+
systemImage: "star.bubble"
72+
)
73+
}
74+
.accessibilityHint("Opens Github feature request form")
75+
}
76+
77+
Section {
78+
HStack {
79+
Text("Version")
80+
Spacer()
81+
Text(version).fontDesign(.monospaced)
82+
}
83+
HStack {
84+
Text("Build")
85+
Spacer()
86+
Text(String(build)).fontDesign(.monospaced)
87+
}
88+
89+
if let sourceCodeUrl = URL(string: GITHUB_URL) {
90+
Link("Source code", destination: sourceCodeUrl)
91+
}
92+
}
93+
}
94+
}.background(Color(UIColor.systemGroupedBackground))
95+
}
96+
}
97+
98+
#Preview {
99+
SettingsAboutPageView()
100+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
2+
3+
// metro-now
4+
// https://github.com/krystxf/metro-now
5+
6+
import SwiftUI
7+
8+
struct SettingsChangelogPageView: View {
9+
var body: some View {
10+
Text("Lorem ipsum")
11+
.navigationTitle("What's new")
12+
}
13+
}
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
2+
// metro-now
3+
// https://github.com/krystxf/metro-now
4+
5+
import SwiftUI
6+
7+
struct SettingsAppIconPageView: View {
8+
private let application = UIApplication.shared
9+
10+
var body: some View {
11+
List {
12+
Section(header: Text("Choose your app icon")) {
13+
// if application.supportsAlternateIcons {
14+
HStack {
15+
Text("Prague metro")
16+
}
17+
.onTapGesture {
18+
Task { @MainActor in
19+
do {
20+
try await application.setAlternateIconName("AppIconPragueMetro")
21+
} catch {
22+
print("error: \(error)")
23+
}
24+
}
25+
}
26+
// }
27+
HStack {
28+
Text("metro-now")
29+
}
30+
.onTapGesture {
31+
Task { @MainActor in
32+
do {
33+
try await application.setAlternateIconName("AppIcon")
34+
} catch {
35+
print("error: \(error)")
36+
}
37+
}
38+
}
39+
}
40+
}
41+
.navigationTitle("App icon")
42+
}
43+
}
44+
45+
#Preview {
46+
SettingsAppIconPageView()
47+
}

0 commit comments

Comments
 (0)