2020-02-21 01:24:09 +00:00
|
|
|
//
|
|
|
|
// SettingsList.swift
|
2022-08-07 13:31:15 +01:00
|
|
|
// Mixonomer
|
2020-02-21 01:24:09 +00:00
|
|
|
//
|
|
|
|
// Created by Andy Pack on 20/02/2020.
|
|
|
|
// Copyright © 2020 Sarsoo. All rights reserved.
|
|
|
|
//
|
|
|
|
|
|
|
|
import SwiftUI
|
|
|
|
import KeychainAccess
|
|
|
|
|
|
|
|
struct SettingsList: View {
|
2020-03-03 00:04:20 +00:00
|
|
|
|
2020-04-25 15:44:54 +01:00
|
|
|
@EnvironmentObject var liveUser: LiveUser
|
|
|
|
|
2020-02-21 01:24:09 +00:00
|
|
|
var body: some View {
|
2020-04-26 00:11:07 +01:00
|
|
|
NavigationView {
|
|
|
|
List{
|
|
|
|
Section {
|
|
|
|
Button(action: {
|
2022-08-07 19:34:14 +01:00
|
|
|
if let url = URL(string: "https://mixonomer.sarsoo.xyz") {
|
2020-04-26 00:11:07 +01:00
|
|
|
UIApplication.shared.open(url)
|
|
|
|
}
|
|
|
|
}) {
|
|
|
|
Text("Launch Web Version")
|
2020-03-08 00:47:35 +00:00
|
|
|
}
|
2020-04-26 00:11:07 +01:00
|
|
|
Button(action: {
|
|
|
|
let keychain = Keychain(service: "xyz.sarsoo.music.login")
|
|
|
|
do {
|
|
|
|
try keychain.remove("username")
|
|
|
|
try keychain.remove("password")
|
2022-08-08 21:59:28 +01:00
|
|
|
try keychain.remove("jwt")
|
2020-04-26 00:11:07 +01:00
|
|
|
|
|
|
|
self.liveUser.loggedIn = false
|
|
|
|
|
|
|
|
} catch let error {
|
|
|
|
debugPrint("Could not clear keychain, \(error)")
|
|
|
|
}
|
|
|
|
}) {
|
|
|
|
Text("Log out")
|
2020-03-08 00:47:35 +00:00
|
|
|
}
|
2020-03-03 00:04:20 +00:00
|
|
|
}
|
2020-04-26 00:11:07 +01:00
|
|
|
Section(
|
|
|
|
header:
|
|
|
|
Text("Development"),
|
|
|
|
footer:
|
|
|
|
HStack{
|
|
|
|
Spacer()
|
|
|
|
Image("APFooter")
|
|
|
|
.resizable()
|
|
|
|
.aspectRatio(contentMode: .fit)
|
|
|
|
.frame(width: 100.0)
|
|
|
|
Spacer()
|
|
|
|
}
|
|
|
|
) {
|
|
|
|
Button(action: {
|
2022-08-07 13:31:15 +01:00
|
|
|
if let url = URL(string: "https://github.com/sarsoo/Mixonomer") {
|
2020-04-26 00:11:07 +01:00
|
|
|
UIApplication.shared.open(url)
|
|
|
|
}
|
|
|
|
}) {
|
|
|
|
Text("Server Source")
|
2020-03-08 00:47:35 +00:00
|
|
|
}
|
2020-04-26 00:11:07 +01:00
|
|
|
Button(action: {
|
2022-08-07 13:31:15 +01:00
|
|
|
if let url = URL(string: "https://github.com/sarsoo/Mixonomer-ios") {
|
2020-04-26 00:11:07 +01:00
|
|
|
UIApplication.shared.open(url)
|
|
|
|
}
|
|
|
|
}) {
|
|
|
|
Text("iOS Source")
|
2020-03-08 00:47:35 +00:00
|
|
|
}
|
2020-02-21 01:24:09 +00:00
|
|
|
}
|
|
|
|
}
|
2020-04-26 00:11:07 +01:00
|
|
|
.listStyle(GroupedListStyle())
|
|
|
|
.navigationBarTitle(Text("Settings ⚡️").font(.title))
|
2020-03-03 00:04:20 +00:00
|
|
|
}
|
2020-02-21 01:24:09 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
struct SettingsList_Previews: PreviewProvider {
|
|
|
|
static var previews: some View {
|
|
|
|
SettingsList()
|
|
|
|
}
|
|
|
|
}
|