This commit is contained in:
Ethan Pippin 2022-01-20 22:47:43 -07:00
parent efa69984ac
commit 1a7bef0579
8 changed files with 122 additions and 122 deletions

View File

@ -26,8 +26,8 @@ final class SettingsCoordinator: NavigationCoordinatable {
var customizeViewsSettings = makeCustomizeViewsSettings var customizeViewsSettings = makeCustomizeViewsSettings
@Route(.push) @Route(.push)
var missingSettings = makeMissingSettings var missingSettings = makeMissingSettings
@Route(.push) @Route(.push)
var about = makeAbout var about = makeAbout
@ViewBuilder @ViewBuilder
func makeServerDetail() -> some View { func makeServerDetail() -> some View {
@ -54,11 +54,11 @@ final class SettingsCoordinator: NavigationCoordinatable {
func makeMissingSettings() -> some View { func makeMissingSettings() -> some View {
MissingItemsSettingsView() MissingItemsSettingsView()
} }
@ViewBuilder @ViewBuilder
func makeAbout() -> some View { func makeAbout() -> some View {
AboutView() AboutView()
} }
@ViewBuilder @ViewBuilder
func makeStart() -> some View { func makeStart() -> some View {

View File

@ -9,12 +9,12 @@
import Foundation import Foundation
extension Bundle { extension Bundle {
var iconFileName: String? { var iconFileName: String? {
guard let icons = infoDictionary?["CFBundleIcons"] as? [String: Any], guard let icons = infoDictionary?["CFBundleIcons"] as? [String: Any],
let primaryIcon = icons["CFBundlePrimaryIcon"] as? [String: Any], let primaryIcon = icons["CFBundlePrimaryIcon"] as? [String: Any],
let iconFiles = primaryIcon["CFBundleIconFiles"] as? [String], let iconFiles = primaryIcon["CFBundleIconFiles"] as? [String],
let iconFileName = iconFiles.last let iconFileName = iconFiles.last
else { return nil } else { return nil }
return iconFileName return iconFileName
} }
} }

View File

@ -9,11 +9,11 @@
import UIKit import UIKit
extension UIApplication { extension UIApplication {
static var appVersion: String? { static var appVersion: String? {
return Bundle.main.object(forInfoDictionaryKey: "CFBundleShortVersionString") as? String Bundle.main.object(forInfoDictionaryKey: "CFBundleShortVersionString") as? String
} }
static var bundleVersion: String? { static var bundleVersion: String? {
return Bundle.main.object(forInfoDictionaryKey: "CFBundleVersion") as? String Bundle.main.object(forInfoDictionaryKey: "CFBundleVersion") as? String
} }
} }

View File

@ -9,8 +9,8 @@
import SwiftUI import SwiftUI
struct AboutView: View { struct AboutView: View {
var body: some View { var body: some View {
Text("dud") Text("dud")
} }
} }

View File

@ -159,15 +159,15 @@ struct SettingsView: View {
} }
} }
} }
Button {} label: { Button {} label: {
HStack { HStack {
Text("Version") Text("Version")
Spacer() Spacer()
Text("\(UIApplication.appVersion ?? "--") (\(UIApplication.bundleVersion ?? "--"))") Text("\(UIApplication.appVersion ?? "--") (\(UIApplication.bundleVersion ?? "--"))")
.foregroundColor(.secondary) .foregroundColor(.secondary)
} }
} }
} }
} }
} }

View File

@ -9,9 +9,9 @@
import SwiftUI import SwiftUI
struct AppIcon: View { struct AppIcon: View {
var body: some View { var body: some View {
Bundle.main.iconFileName Bundle.main.iconFileName
.flatMap { UIImage(named: $0) } .flatMap { UIImage(named: $0) }
.map { Image(uiImage: $0).resizable() } .map { Image(uiImage: $0).resizable() }
} }
} }

View File

@ -9,77 +9,77 @@
import SwiftUI import SwiftUI
struct AboutView: View { struct AboutView: View {
var body: some View {
List {
Section {
HStack {
Spacer()
VStack(alignment: .center) {
AppIcon()
.cornerRadius(11)
.frame(width: 150, height: 150)
Text("Swiftfin")
.fontWeight(.semibold)
.font(.title2)
}
Spacer()
}
.listRowBackground(Color.clear)
}
Section {
HStack {
Text("Version")
Spacer()
Text("\(UIApplication.appVersion ?? "--") (\(UIApplication.bundleVersion ?? "--"))")
.foregroundColor(.secondary)
}
HStack {
Image("github-logo")
.renderingMode(.template)
.resizable()
.frame(width: 20, height: 20)
.foregroundColor(.primary)
Link("Source Code",
destination: URL(string: "https://github.com/jellyfin/Swiftfin")!)
.foregroundColor(.primary)
Spacer()
Image(systemName: "chevron.right")
.foregroundColor(.secondary)
}
HStack {
Image(systemName: "plus.circle.fill")
Link("Request a Feature",
destination: URL(string: "https://github.com/jellyfin/Swiftfin/issues")!)
.foregroundColor(.primary)
Spacer()
Image(systemName: "chevron.right") var body: some View {
.foregroundColor(.secondary) List {
} Section {
HStack {
HStack { Spacer()
Image(systemName: "xmark.circle.fill")
Link("Report an Issue",
destination: URL(string: "https://github.com/jellyfin/Swiftfin/issues")!)
.foregroundColor(.primary)
Spacer()
Image(systemName: "chevron.right") VStack(alignment: .center) {
.foregroundColor(.secondary) AppIcon()
} .cornerRadius(11)
} .frame(width: 150, height: 150)
}
} Text("Swiftfin")
.fontWeight(.semibold)
.font(.title2)
}
Spacer()
}
.listRowBackground(Color.clear)
}
Section {
HStack {
Text("Version")
Spacer()
Text("\(UIApplication.appVersion ?? "--") (\(UIApplication.bundleVersion ?? "--"))")
.foregroundColor(.secondary)
}
HStack {
Image("github-logo")
.renderingMode(.template)
.resizable()
.frame(width: 20, height: 20)
.foregroundColor(.primary)
Link("Source Code",
destination: URL(string: "https://github.com/jellyfin/Swiftfin")!)
.foregroundColor(.primary)
Spacer()
Image(systemName: "chevron.right")
.foregroundColor(.secondary)
}
HStack {
Image(systemName: "plus.circle.fill")
Link("Request a Feature",
destination: URL(string: "https://github.com/jellyfin/Swiftfin/issues")!)
.foregroundColor(.primary)
Spacer()
Image(systemName: "chevron.right")
.foregroundColor(.secondary)
}
HStack {
Image(systemName: "xmark.circle.fill")
Link("Report an Issue",
destination: URL(string: "https://github.com/jellyfin/Swiftfin/issues")!)
.foregroundColor(.primary)
Spacer()
Image(systemName: "chevron.right")
.foregroundColor(.secondary)
}
}
}
}
} }

View File

@ -168,17 +168,17 @@ struct SettingsView: View {
} }
} }
} }
Button { Button {
settingsRouter.route(to: \.about) settingsRouter.route(to: \.about)
} label: { } label: {
HStack { HStack {
Text("About") Text("About")
.foregroundColor(.primary) .foregroundColor(.primary)
Spacer() Spacer()
Image(systemName: "chevron.right") Image(systemName: "chevron.right")
} }
} }
} }
.navigationBarTitle(L10n.settings, displayMode: .inline) .navigationBarTitle(L10n.settings, displayMode: .inline)
.toolbar { .toolbar {