2020-02-21 01:24:09 +00:00
|
|
|
//
|
|
|
|
// SettingsList.swift
|
|
|
|
// Music Tools
|
|
|
|
//
|
|
|
|
// 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
|
|
|
|
|
|
|
init(){
|
|
|
|
UITableView.appearance().tableFooterView = UIView()
|
|
|
|
}
|
|
|
|
|
2020-02-21 01:24:09 +00:00
|
|
|
var body: some View {
|
2020-03-03 00:04:20 +00:00
|
|
|
VStack{
|
2020-02-21 01:24:09 +00:00
|
|
|
List{
|
2020-03-03 00:04:20 +00:00
|
|
|
Button(action: {
|
|
|
|
if let url = URL(string: "https://music.sarsoo.xyz") {
|
|
|
|
UIApplication.shared.open(url)
|
|
|
|
}
|
|
|
|
}) {
|
|
|
|
Text("Open Web")
|
|
|
|
}
|
2020-02-21 01:24:09 +00:00
|
|
|
Button(action: {
|
|
|
|
let keychain = Keychain(service: "xyz.sarsoo.music.login")
|
|
|
|
do {
|
|
|
|
try keychain.remove("username")
|
|
|
|
try keychain.remove("password")
|
|
|
|
} catch let error {
|
|
|
|
debugPrint("Could not clear keychain, \(error)")
|
|
|
|
}
|
|
|
|
}) {
|
|
|
|
Text("Log out")
|
|
|
|
}
|
|
|
|
}
|
2020-03-03 00:04:20 +00:00
|
|
|
Image("APFooter")
|
|
|
|
.resizable()
|
|
|
|
.aspectRatio(contentMode: .fit)
|
|
|
|
.frame(width: 100.0)
|
|
|
|
}
|
2020-02-21 01:24:09 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
struct SettingsList_Previews: PreviewProvider {
|
|
|
|
static var previews: some View {
|
|
|
|
SettingsList()
|
|
|
|
}
|
|
|
|
}
|