Skip to content
Snippets Groups Projects
Commit fb2613c2 authored by Bruno Muniz's avatar Bruno Muniz :apple:
Browse files

fix account deleting

parent f135a7af
No related branches found
No related tags found
1 merge request!80Fix account deleting
......@@ -710,6 +710,10 @@
= "Deleting Your Account";
"settings.delete.info.subtitle"
= "On deletion, all keys for your account are purged from your phone. This action will not notify your contacts. Your keys and any registered emails or phone numbers are removed from the user discovery system.";
"settings.delete.success.title"
= "Account deleted";
"settings.delete.success.subtitle"
= "Now, kill the app and re-open.";
"settings.infoDrawer.notifications.title"
= "Notifications";
......
......@@ -1172,6 +1172,12 @@ public enum Localized {
/// Deleting Your Account
public static let title = Localized.tr("Localizable", "settings.delete.info.title")
}
public enum Success {
/// Now, kill the app and re-open.
public static let subtitle = Localized.tr("Localizable", "settings.delete.success.subtitle")
/// Account deleted
public static let title = Localized.tr("Localizable", "settings.delete.success.title")
}
}
public enum Drawer {
/// %@ will be opened using your default browser
......
......@@ -3,6 +3,7 @@ import Defaults
import Keychain
import Foundation
import Dependencies
import AppResources
import XXMessengerClient
final class SettingsDeleteViewModel {
......@@ -25,15 +26,14 @@ final class SettingsDeleteViewModel {
try messenger.destroy()
try keychain.destroy()
try dbManager.removeDB()
try deleteDatabase()
UserDefaults.resetStandardUserDefaults()
UserDefaults.standard.removePersistentDomain(forName: Bundle.main.bundleIdentifier!)
UserDefaults.standard.synchronize()
hudManager.show(.init(
title: "Account deleted",
content: "Now kill the app and re-open"
title: Localized.Settings.Delete.Success.title,
content: Localized.Settings.Delete.Success.subtitle
))
} catch {
DispatchQueue.main.async { [weak self] in
......@@ -48,13 +48,4 @@ final class SettingsDeleteViewModel {
username: .init(type: .username, value: username!)
)
}
private func deleteDatabase() throws {
let dbPath = FileManager.default
.containerURL(forSecurityApplicationGroupIdentifier: "group.elixxir.messenger")!
.appendingPathComponent("xxm_database")
.appendingPathExtension("sqlite").path
try FileManager.default.removeItem(atPath: dbPath)
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment