Compare commits

..

2 Commits
b1.0.0 ... main

4 changed files with 32 additions and 7 deletions

1
.gitignore vendored
View File

@ -2,3 +2,4 @@
.burgernotes/
packages/
.DS_Store
Burgernotes.xcodeproj/project.xcworkspace/xcuserdata/ffqq.xcuserdatad/UserInterfaceState.xcuserstate

View File

@ -24,7 +24,6 @@
"buildVersion": "1",
"date": "2024-02-29",
"downloadURL": "https://centrifuge.hectabit.org/HectaBit/Burgernotes-iOS/releases/download/b1.0.0/Burgernotes.ipa",
"size": 79821,
"minOSVersion": "15.0",
},
],

View File

@ -212,14 +212,13 @@ struct ContentView: View {
}
.padding()
Text("Burgernotes")
.font(.title)
.padding()
Group {
if isOnline {
if !usingSettings {
if !isEditing {
Text("Burgernotes")
.font(.title)
.padding()
List {
ForEach(notes, id: \.id) { note in
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")
.imageScale(.large)
Text("Back")
}
.padding()
Spacer()
@ -352,6 +352,31 @@ struct ContentView: View {
Text("Sign out")
.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 {