Compare commits
1 Commits
web-of-tru
...
tyiu/delet
| Author | SHA1 | Date | |
|---|---|---|---|
|
e0c6a607c6
|
@@ -473,6 +473,18 @@ struct ContentView: View {
|
|||||||
.onReceive(handle_notify(.new_mutes)) { notif in
|
.onReceive(handle_notify(.new_mutes)) { notif in
|
||||||
home.filter_muted()
|
home.filter_muted()
|
||||||
}
|
}
|
||||||
|
.onReceive(handle_notify(.logout)) { _ in
|
||||||
|
guard damus_state != nil else {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
do {
|
||||||
|
try damus_state!.settings.delete_settings(damus_state!.pubkey)
|
||||||
|
} catch {
|
||||||
|
// Could not delete all settings for some reason. Continue with logout.
|
||||||
|
print("Unable to delete all user settings for \(damus_state!.pubkey). Continuing with logout.")
|
||||||
|
}
|
||||||
|
}
|
||||||
.alert(NSLocalizedString("Deleted Account", comment: "Alert message to indicate this is a deleted account"), isPresented: $is_deleted_account) {
|
.alert(NSLocalizedString("Deleted Account", comment: "Alert message to indicate this is a deleted account"), isPresented: $is_deleted_account) {
|
||||||
Button(NSLocalizedString("Logout", comment: "Button to close the alert that informs that the current account has been deleted.")) {
|
Button(NSLocalizedString("Logout", comment: "Button to close the alert that informs that the current account has been deleted.")) {
|
||||||
is_deleted_account = false
|
is_deleted_account = false
|
||||||
|
|||||||
@@ -227,6 +227,19 @@ class UserSettingsStore: ObservableObject {
|
|||||||
return deepl_api_key != ""
|
return deepl_api_key != ""
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func delete_settings(_ pubkey: String) throws {
|
||||||
|
UserDefaults.standard.removeObject(forKey: pk_setting_key(pubkey, key: tip_amount_key))
|
||||||
|
UserDefaults.standard.removeObject(forKey: "show_wallet_selector")
|
||||||
|
UserDefaults.standard.removeObject(forKey: "default_wallet")
|
||||||
|
UserDefaults.standard.removeObject(forKey: "left_handed")
|
||||||
|
UserDefaults.standard.removeObject(forKey: "translation_service")
|
||||||
|
UserDefaults.standard.removeObject(forKey: "deepl_plan")
|
||||||
|
UserDefaults.standard.removeObject(forKey: "libretranslate_server")
|
||||||
|
UserDefaults.standard.removeObject(forKey: "libretranslate_url")
|
||||||
|
try clearLibreTranslateApiKey()
|
||||||
|
try clearDeepLApiKey()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
struct DamusLibreTranslateKeychainConfiguration: KeychainConfiguration {
|
struct DamusLibreTranslateKeychainConfiguration: KeychainConfiguration {
|
||||||
|
|||||||
Reference in New Issue
Block a user