mirror of
https://github.com/oxen-io/session-ios.git
synced 2023-12-13 21:30:14 +01:00
Added a button to the settings screen to trigger a re-migration of the database
This commit is contained in:
parent
5722cfe7d0
commit
346ce3d24a
|
@ -299,6 +299,8 @@ final class SettingsVC: BaseVC, AvatarViewHelperDelegate {
|
|||
return button
|
||||
}
|
||||
|
||||
let debugReMigrateButton = getSettingButton(withTitle: "DEBUG - Re-Migrate Database", color: Colors.destructive, action: #selector(remigrateDatabase))
|
||||
|
||||
let pathButton = getSettingButton(withTitle: NSLocalizedString("vc_path_title", comment: ""), color: Colors.text, action: #selector(showPath))
|
||||
let pathStatusView = PathStatusView()
|
||||
pathStatusView.set(.width, to: PathStatusView.size)
|
||||
|
@ -309,6 +311,8 @@ final class SettingsVC: BaseVC, AvatarViewHelperDelegate {
|
|||
pathStatusView.autoVCenterInSuperview()
|
||||
|
||||
return [
|
||||
getSeparator(),
|
||||
debugReMigrateButton,
|
||||
getSeparator(),
|
||||
pathButton,
|
||||
getSeparator(),
|
||||
|
@ -588,6 +592,12 @@ final class SettingsVC: BaseVC, AvatarViewHelperDelegate {
|
|||
navigationController!.present(shareVC, animated: true, completion: nil)
|
||||
}
|
||||
|
||||
@objc private func remigrateDatabase() {
|
||||
GRDBStorage.deleteDatabaseFiles()
|
||||
try? GRDBStorage.deleteDbKeys()
|
||||
exit(1)
|
||||
}
|
||||
|
||||
@objc private func showPath() {
|
||||
let pathVC = PathVC()
|
||||
navigationController!.pushViewController(pathVC, animated: true)
|
||||
|
|
|
@ -297,13 +297,13 @@ public final class GRDBStorage {
|
|||
// TODO: Delete Profiles on Disk?
|
||||
}
|
||||
|
||||
private static func deleteDatabaseFiles() {
|
||||
public/*private*/ static func deleteDatabaseFiles() {
|
||||
OWSFileSystem.deleteFile(databasePath)
|
||||
OWSFileSystem.deleteFile(databasePathShm)
|
||||
OWSFileSystem.deleteFile(databasePathWal)
|
||||
}
|
||||
|
||||
private static func deleteDbKeys() throws {
|
||||
public/*private*/ static func deleteDbKeys() throws {
|
||||
try SSKDefaultKeychainStorage.shared.remove(service: keychainService, key: dbCipherKeySpecKey)
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue