Fix deprecated way of using writeCopyTo - realm method
This commit is contained in:
+1
-6
@@ -205,12 +205,7 @@ export async function changeEncryptionAndRestartApp(hash) {
|
|||||||
const copyPath = dir.join('/')
|
const copyPath = dir.join('/')
|
||||||
const exists = await fs.exists(copyPath)
|
const exists = await fs.exists(copyPath)
|
||||||
if (exists) await fs.unlink(copyPath)
|
if (exists) await fs.unlink(copyPath)
|
||||||
// for some reason, realm complains if we give it a key with value undefined
|
db.writeCopyTo({ path: copyPath, encryptionKey: key })
|
||||||
if (key) {
|
|
||||||
db.writeCopyTo(copyPath, key)
|
|
||||||
} else {
|
|
||||||
db.writeCopyTo(copyPath)
|
|
||||||
}
|
|
||||||
db.close()
|
db.close()
|
||||||
await fs.unlink(defaultPath)
|
await fs.unlink(defaultPath)
|
||||||
await fs.moveFile(copyPath, defaultPath)
|
await fs.moveFile(copyPath, defaultPath)
|
||||||
|
|||||||
Reference in New Issue
Block a user