ios: restore db (#1063)

* wip

* wip

* wip

* refactor

* clean up

* simplify

* simplify

* refactor

* rename

* rename consts

* refactor

Co-authored-by: Evgeny Poberezkin <2769109+epoberezkin@users.noreply.github.com>
This commit is contained in:
JRoberts
2022-09-17 16:41:20 +04:00
committed by GitHub
co-authored by Evgeny Poberezkin
parent 3351503744
commit 2eca3e789c
5 changed files with 107 additions and 12 deletions
+4
View File
@@ -663,6 +663,10 @@ func initializeChat(start: Bool, dbKey: String? = nil) throws {
let m = ChatModel.shared
(m.chatDbEncrypted, m.chatDbStatus) = migrateChatDatabase(dbKey)
if m.chatDbStatus != .ok { return }
// If we migrated successfully means previous re-encryption process on database level finished successfully too
if encryptionStartedDefault.get() {
encryptionStartedDefault.set(false)
}
let _ = getChatCtrl(dbKey)
try apiSetFilesFolder(filesFolder: getAppFilesDirectory().path)
try apiSetIncognito(incognito: incognitoGroupDefault.get())