93 lines
2.6 KiB
Swift
93 lines
2.6 KiB
Swift
//
|
|
// AboutView.swift
|
|
// Tusker
|
|
//
|
|
// Created by Shadowfacts on 12/21/22.
|
|
// Copyright © 2022 Shadowfacts. All rights reserved.
|
|
//
|
|
|
|
import SwiftUI
|
|
|
|
struct AboutView: View {
|
|
private var version: String {
|
|
let marketing = Bundle.main.infoDictionary?["CFBundleShortVersionString"] as? String
|
|
let build = Bundle.main.infoDictionary?["CFBundleVersion"] as? String
|
|
return "\(marketing ?? "<unknown>") (\(build ?? "<unknown>"))"
|
|
}
|
|
|
|
var body: some View {
|
|
List {
|
|
iconOrGame
|
|
.frame(maxWidth: .infinity, alignment: .center)
|
|
.listRowInsets(EdgeInsets(top: 9, leading: 0, bottom: 0, trailing: 0))
|
|
.listRowBackground(EmptyView())
|
|
|
|
Section {
|
|
HStack {
|
|
Text("Version")
|
|
Spacer()
|
|
Text(version)
|
|
.foregroundColor(.secondary)
|
|
}
|
|
.contextMenu {
|
|
Button {
|
|
UIPasteboard.general.string = version
|
|
} label: {
|
|
Label("Copy", systemImage: "doc.on.doc")
|
|
}
|
|
}
|
|
}
|
|
|
|
Section {
|
|
Link("Website", destination: URL(string: "https://vaccor.space/tusker")!)
|
|
Link("Source Code", destination: URL(string: "https://git.shadowfacts.net/shadowfacts/Tusker")!)
|
|
Link("Issue Tracker", destination: URL(string: "https://git.shadowfacts.net/shadowfacts/Tusker/issues")!)
|
|
}
|
|
}
|
|
}
|
|
|
|
@ViewBuilder
|
|
private var iconOrGame: some View {
|
|
if #available(iOS 16.0, *) {
|
|
FlipView {
|
|
appIcon
|
|
} back: {
|
|
TTTView()
|
|
}
|
|
} else {
|
|
appIcon
|
|
}
|
|
}
|
|
|
|
private var appIcon: some View {
|
|
VStack {
|
|
AppIconView()
|
|
.shadow(radius: 6, y: 3)
|
|
.frame(width: 256, height: 256)
|
|
|
|
Text("Tusker")
|
|
.font(.title2.bold())
|
|
}
|
|
}
|
|
}
|
|
|
|
struct AppIconView: UIViewRepresentable {
|
|
func makeUIView(context: Context) -> UIImageView {
|
|
let view = UIImageView(image: UIImage(named: "AboutIcon"))
|
|
view.contentMode = .scaleAspectFit
|
|
view.layer.cornerRadius = 256 / 6.4
|
|
view.layer.cornerCurve = .continuous
|
|
view.layer.masksToBounds = true
|
|
return view
|
|
}
|
|
|
|
func updateUIView(_ uiView: UIImageView, context: Context) {
|
|
}
|
|
}
|
|
|
|
struct AboutView_Previews: PreviewProvider {
|
|
static var previews: some View {
|
|
AboutView()
|
|
}
|
|
}
|