blob: 378385a52fe39bf267d55e7b8428c63ebbec7b9c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
import SwiftUI
struct AboutView: View {
@Environment(\.openURL) private var openURL
var body: some View {
VStack(alignment: .center) {
Spacer()
Image("About Hotline")
.padding(.top, 32)
Text("Hotline")
.font(.title)
.fontWeight(.semibold)
.padding(.top, 16)
let appDetails = getAppVersionAndBuild()
Text("\(appDetails.version)b\(appDetails.build)")
.fontWeight(.semibold)
.opacity(0.6)
Button("Download Latest") {
if let url = URL(string: "https://github.com/mierau/hotline/releases/latest") {
openURL(url)
}
}
.controlSize(.large)
.padding(.top, 16)
Spacer()
}
.frame(width: 300, height: 400)
.ignoresSafeArea()
}
func getAppVersionAndBuild() -> (version: String, build: String) {
let infoDictionary = Bundle.main.infoDictionary
let version = infoDictionary?["CFBundleShortVersionString"] as? String ?? "Unknown"
let build = infoDictionary?["CFBundleVersion"] as? String ?? "Unknown"
return (version, build)
}
}
#Preview {
AboutView()
}
|