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 @@ ...@@ -710,6 +710,10 @@
= "Deleting Your Account"; = "Deleting Your Account";
"settings.delete.info.subtitle" "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."; = "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" "settings.infoDrawer.notifications.title"
= "Notifications"; = "Notifications";
......
...@@ -1172,6 +1172,12 @@ public enum Localized { ...@@ -1172,6 +1172,12 @@ public enum Localized {
/// Deleting Your Account /// Deleting Your Account
public static let title = Localized.tr("Localizable", "settings.delete.info.title") 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 { public enum Drawer {
/// %@ will be opened using your default browser /// %@ will be opened using your default browser
......
...@@ -3,6 +3,7 @@ import Defaults ...@@ -3,6 +3,7 @@ import Defaults
import Keychain import Keychain
import Foundation import Foundation
import Dependencies import Dependencies
import AppResources
import XXMessengerClient import XXMessengerClient
final class SettingsDeleteViewModel { final class SettingsDeleteViewModel {
...@@ -25,15 +26,14 @@ final class SettingsDeleteViewModel { ...@@ -25,15 +26,14 @@ final class SettingsDeleteViewModel {
try messenger.destroy() try messenger.destroy()
try keychain.destroy() try keychain.destroy()
try dbManager.removeDB() try dbManager.removeDB()
try deleteDatabase()
UserDefaults.resetStandardUserDefaults() UserDefaults.resetStandardUserDefaults()
UserDefaults.standard.removePersistentDomain(forName: Bundle.main.bundleIdentifier!) UserDefaults.standard.removePersistentDomain(forName: Bundle.main.bundleIdentifier!)
UserDefaults.standard.synchronize() UserDefaults.standard.synchronize()
hudManager.show(.init( hudManager.show(.init(
title: "Account deleted", title: Localized.Settings.Delete.Success.title,
content: "Now kill the app and re-open" content: Localized.Settings.Delete.Success.subtitle
)) ))
} catch { } catch {
DispatchQueue.main.async { [weak self] in DispatchQueue.main.async { [weak self] in
...@@ -48,13 +48,4 @@ final class SettingsDeleteViewModel { ...@@ -48,13 +48,4 @@ final class SettingsDeleteViewModel {
username: .init(type: .username, value: username!) 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