mirror of
https://github.com/yggdrasil-network/yggdrasil-ios.git
synced 2025-04-28 14:15:09 +03:00
Some SwiftUI
This commit is contained in:
parent
b58f8e3852
commit
291b12b785
24 changed files with 901 additions and 89 deletions
84
YggdrasilSwiftUI/SettingsView.swift
Normal file
84
YggdrasilSwiftUI/SettingsView.swift
Normal file
|
@ -0,0 +1,84 @@
|
|||
//
|
||||
// SettingsView.swift
|
||||
// YggdrasilSwiftUI
|
||||
//
|
||||
// Created by Neil on 10/02/2023.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
|
||||
struct SettingsView: View {
|
||||
@State private var deviceName = ""
|
||||
|
||||
@State private var autoStartOnWiFi = false
|
||||
@State private var autoStartOnCellular = false
|
||||
|
||||
var body: some View {
|
||||
Form {
|
||||
Section(content: {
|
||||
TextField("Device Name", text: $deviceName)
|
||||
}, header: {
|
||||
Text("Public Identity")
|
||||
})
|
||||
|
||||
Section(content: {
|
||||
Toggle("Wi-Fi", isOn: $autoStartOnWiFi)
|
||||
Toggle("Mobile Network", isOn: $autoStartOnCellular)
|
||||
}, header: {
|
||||
Text("Automatically start when connected to")
|
||||
})
|
||||
|
||||
Section(content: {
|
||||
VStack(alignment: .leading) {
|
||||
Button("Import configuration") {
|
||||
|
||||
}
|
||||
#if os(macOS)
|
||||
.buttonStyle(.link)
|
||||
#endif
|
||||
Text("Import configuration from another device, including the public key and Yggdrasil IP address.")
|
||||
.font(.system(size: 11))
|
||||
.foregroundColor(.gray)
|
||||
}
|
||||
|
||||
VStack(alignment: .leading) {
|
||||
Button("Export configuration") {
|
||||
|
||||
}
|
||||
#if os(macOS)
|
||||
.buttonStyle(.link)
|
||||
#endif
|
||||
Text("Configuration will be exported as a file. Your configuration contains your private key which is extremely sensitive. Do not share it with anyone.")
|
||||
.font(.system(size: 11))
|
||||
.foregroundColor(.gray)
|
||||
}
|
||||
|
||||
VStack(alignment: .leading) {
|
||||
Button("Reset configuration") {
|
||||
|
||||
}
|
||||
#if os(macOS)
|
||||
.buttonStyle(.link)
|
||||
#endif
|
||||
.foregroundColor(.red)
|
||||
Text("Resetting will overwrite with newly generated configuration. Your public key and Yggdrasil IP address will change.")
|
||||
.font(.system(size: 11))
|
||||
.foregroundColor(.gray)
|
||||
}
|
||||
}, header: {
|
||||
Text("Configuration")
|
||||
})
|
||||
}
|
||||
.formStyle(.grouped)
|
||||
.navigationTitle("Settings")
|
||||
#if os(iOS)
|
||||
.navigationBarTitleDisplayMode(.large)
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
struct SettingsView_Previews: PreviewProvider {
|
||||
static var previews: some View {
|
||||
SettingsView()
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue