Skip to content

Commit

Permalink
refactor(app): settings page
Browse files Browse the repository at this point in the history
  • Loading branch information
krystxf committed Dec 2, 2024
1 parent 8195d15 commit 7c126ba
Show file tree
Hide file tree
Showing 14 changed files with 286 additions and 128 deletions.
4 changes: 4 additions & 0 deletions apps/mobile/metro-now/common/const/review-url.const.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
2 changes: 2 additions & 0 deletions apps/mobile/metro-now/metro-now.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -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\"";
Expand Down Expand Up @@ -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\"";
Expand Down
Original file line number Diff line number Diff line change
@@ -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
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -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
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"info": {
"author": "xcode",
"version": 1
}
}

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -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()
}
Original file line number Diff line number Diff line change
@@ -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()
}
Loading

0 comments on commit 7c126ba

Please sign in to comment.