Compare commits
2 Commits
Author | SHA1 | Date |
---|---|---|
ffqq | 78a7952687 | |
ffqq | e8babbfcd1 |
|
@ -2,3 +2,4 @@
|
||||||
.burgernotes/
|
.burgernotes/
|
||||||
packages/
|
packages/
|
||||||
.DS_Store
|
.DS_Store
|
||||||
|
Burgernotes.xcodeproj/project.xcworkspace/xcuserdata/ffqq.xcuserdatad/UserInterfaceState.xcuserstate
|
||||||
|
|
|
@ -24,7 +24,6 @@
|
||||||
"buildVersion": "1",
|
"buildVersion": "1",
|
||||||
"date": "2024-02-29",
|
"date": "2024-02-29",
|
||||||
"downloadURL": "https://centrifuge.hectabit.org/HectaBit/Burgernotes-iOS/releases/download/b1.0.0/Burgernotes.ipa",
|
"downloadURL": "https://centrifuge.hectabit.org/HectaBit/Burgernotes-iOS/releases/download/b1.0.0/Burgernotes.ipa",
|
||||||
"size": 79821,
|
|
||||||
"minOSVersion": "15.0",
|
"minOSVersion": "15.0",
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
|
Binary file not shown.
|
@ -212,14 +212,13 @@ struct ContentView: View {
|
||||||
}
|
}
|
||||||
.padding()
|
.padding()
|
||||||
|
|
||||||
Text("Burgernotes")
|
|
||||||
.font(.title)
|
|
||||||
.padding()
|
|
||||||
|
|
||||||
Group {
|
Group {
|
||||||
if isOnline {
|
if isOnline {
|
||||||
if !usingSettings {
|
if !usingSettings {
|
||||||
if !isEditing {
|
if !isEditing {
|
||||||
|
Text("Burgernotes")
|
||||||
|
.font(.title)
|
||||||
|
.padding()
|
||||||
List {
|
List {
|
||||||
ForEach(notes, id: \.id) { note in
|
ForEach(notes, id: \.id) { note in
|
||||||
let noteTitle = note.title.decrypt(password: encryptionKey ?? "this bum ain't got an encryption key!!!")
|
let noteTitle = note.title.decrypt(password: encryptionKey ?? "this bum ain't got an encryption key!!!")
|
||||||
|
@ -285,6 +284,7 @@ struct ContentView: View {
|
||||||
}) {
|
}) {
|
||||||
Image(systemName: "chevron.left")
|
Image(systemName: "chevron.left")
|
||||||
.imageScale(.large)
|
.imageScale(.large)
|
||||||
|
Text("Back")
|
||||||
}
|
}
|
||||||
.padding()
|
.padding()
|
||||||
Spacer()
|
Spacer()
|
||||||
|
@ -352,6 +352,31 @@ struct ContentView: View {
|
||||||
Text("Sign out")
|
Text("Sign out")
|
||||||
.foregroundStyle(Color.red) // Set the text color to red
|
.foregroundStyle(Color.red) // Set the text color to red
|
||||||
}
|
}
|
||||||
|
Button(action: {
|
||||||
|
let dialog = UIAlertController(title: "Delete my account", message: "Are you sure you want to delete your account? THIS CANNOT BE REVERSED", preferredStyle: .alert)
|
||||||
|
// In the case of a signout:
|
||||||
|
let deleteAccount = UIAlertAction(title: "Yes", style: .destructive) { _ in
|
||||||
|
guard let url = URL(string: "https://notes.hectabit.org/api/deleteaccount") else { return }
|
||||||
|
let parameters = ["secretKey": "\(secretKey ?? "bum")"]
|
||||||
|
JSONHelper.sendJSONRequest(url: url, parameters: parameters) { result in
|
||||||
|
switch result {
|
||||||
|
case .success:
|
||||||
|
keychain.delete("secretKey")
|
||||||
|
UserDefaults.standard.removeObject(forKey: "Username") // This will also trigger SwiftUI to change vstacks
|
||||||
|
keychain.delete("encryptionKey")
|
||||||
|
usingSettings = false
|
||||||
|
case .failure(let error):
|
||||||
|
print("Failed to delete account: \(error)") // This is not supposed to happen under any circumstances unless the session was deauthorized remotely
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
let no = UIAlertAction(title: "No", style: .default)
|
||||||
|
dialog.addAction(deleteAccount);dialog.addAction(no)
|
||||||
|
if let topVC = UIApplication.shared.keyWindow?.rootViewController { topVC.present(dialog, animated: true) } // We can keep using keyWindow, it's not a big deal for this specific usecase that it's deprecated
|
||||||
|
}) {
|
||||||
|
Text("Delete my account")
|
||||||
|
.foregroundStyle(Color.red) // Set the text color to red
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
Reference in New Issue