Merge branch 'fix/realm-warning' into 'release'

Fix deprecated way of using writeCopyTo - realm method

See merge request bloodyhealth/drip!460
This commit is contained in:
Sofiya Tepikin
2022-08-10 14:22:56 +00:00
+1 -6
View File
@@ -205,12 +205,7 @@ export async function changeEncryptionAndRestartApp(hash) {
const copyPath = dir.join('/')
const exists = await fs.exists(copyPath)
if (exists) await fs.unlink(copyPath)
// for some reason, realm complains if we give it a key with value undefined
if (key) {
db.writeCopyTo(copyPath, key)
} else {
db.writeCopyTo(copyPath)
}
db.writeCopyTo({ path: copyPath, encryptionKey: key })
db.close()
await fs.unlink(defaultPath)
await fs.moveFile(copyPath, defaultPath)