-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPlusSettingsForm.swift
More file actions
59 lines (50 loc) · 1.61 KB
/
PlusSettingsForm.swift
File metadata and controls
59 lines (50 loc) · 1.61 KB
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
49
50
51
52
53
54
55
56
57
58
59
//
// PlusSettingsForm.swift
//
// Copyright 2023 OpenAlloc LLC
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at https://mozilla.org/MPL/2.0/.
//
import os
import SwiftUI
import TrackerLib
import TrackerUI
import TroutLib
import TroutUI
struct PlusSettingsForm: View {
@Environment(\.managedObjectContext) private var viewContext
@EnvironmentObject private var manager: CoreDataStack
@EnvironmentObject private var router: TroutRouter
// MARK: - Views
var body: some View {
if let appSetting = try? AppSetting.getOrCreate(viewContext),
let mainStore = manager.getMainStore(viewContext),
let archiveStore = manager.getArchiveStore(viewContext)
{
TroutSettings(appSetting: appSetting, onRestoreToDefaults: {}) {
ExportSettings(mainStore: mainStore,
archiveStore: archiveStore,
filePrefix: "grt-",
createZipArchive: troutCreateZipArchive)
Button(action: {
router.path.append(TroutRoute.about)
}) {
Text("About \(appName)")
}
}
} else {
Text("Settings not available.")
}
}
// MARK: - Properties
private var appName: String {
Bundle.main.appName ?? "unknown"
}
}
struct PlusSettingsForm_Previews: PreviewProvider {
static var previews: some View {
PlusSettingsForm()
}
}