aboutsummaryrefslogtreecommitdiff
path: root/iosApp/iosApp/Session/AboutView.swift
blob: 7e5325b0e25ba14b5658d302039aa0e5ad50d68c (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
43
44
45
46
47
48
//
//  AboutView.swift
//  iosApp
//
//  Created by Iván on 15/02/22.
//  Copyright © 2022 orgName. All rights reserved.
//

import SwiftUI

struct AboutView: View {
    
    private func getVersion() -> String? {
        return Bundle.main.infoDictionary?["CFBundleShortVersionString"] as? String
    }
    
    var body: some View {
        List {
            Text("about-text").padding()
            if let version = getVersion() {
                HStack {
                    Text("version")
                    Spacer()
                    Text(version).foregroundColor(.secondary)
                }
            }
            
            Button {
                if let url = URL(string: NSLocalizedString("app-source-code", comment: "")) {
                    if UIApplication.shared.canOpenURL(url) {
                        UIApplication.shared.open(url, options: [:])
                    }
                }
            } label: {
                Label("source-code", systemImage: "chevron.left.forwardslash.chevron.right")
            }
            
            Button {
                if let url = URL(string: NSLocalizedString("app-website", comment: "")) {
                    if UIApplication.shared.canOpenURL(url) {
                        UIApplication.shared.open(url, options: [:])
                    }
                }            } label: {
                Label("website", systemImage: "globe")
            }
        }
    }
}