Remove unneeded argument to openDb
This commit is contained in:
@@ -18,7 +18,7 @@ export default class PasswordPrompt extends Component {
|
|||||||
if (hasEncryption) {
|
if (hasEncryption) {
|
||||||
this.setState({showPasswordPrompt: true})
|
this.setState({showPasswordPrompt: true})
|
||||||
} else {
|
} else {
|
||||||
await openDb({persistConnection: true})
|
await openDb()
|
||||||
this.props.showApp()
|
this.props.showApp()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@@ -34,7 +34,7 @@ export default class PasswordPrompt extends Component {
|
|||||||
msg = JSON.parse(msg)
|
msg = JSON.parse(msg)
|
||||||
if (msg.type != 'sha512') return
|
if (msg.type != 'sha512') return
|
||||||
try {
|
try {
|
||||||
await openDb({hash: msg.message, persistConnection: true })
|
await openDb(msg.message)
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
Alert.alert(
|
Alert.alert(
|
||||||
shared.incorrectPassword,
|
shared.incorrectPassword,
|
||||||
|
|||||||
+3
-5
@@ -161,14 +161,12 @@ export function requestHash(pw) {
|
|||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function openDb ({ hash, persistConnection }) {
|
export async function openDb (hash) {
|
||||||
if (hash) {
|
if (hash) {
|
||||||
realmConfig.encryptionKey = hashToInt8Array(hash)
|
realmConfig.encryptionKey = hashToInt8Array(hash)
|
||||||
}
|
}
|
||||||
|
|
||||||
const connection = await Realm.open(realmConfig)
|
db = await Realm.open(realmConfig)
|
||||||
|
|
||||||
if (persistConnection) db = connection
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function changeEncryptionAndRestartApp(hash) {
|
export async function changeEncryptionAndRestartApp(hash) {
|
||||||
@@ -197,7 +195,7 @@ export async function changeEncryptionAndRestartApp(hash) {
|
|||||||
export async function deleteDbAndOpenNew() {
|
export async function deleteDbAndOpenNew() {
|
||||||
const exists = await fs.exists(Realm.defaultPath)
|
const exists = await fs.exists(Realm.defaultPath)
|
||||||
if (exists) await fs.unlink(Realm.defaultPath)
|
if (exists) await fs.unlink(Realm.defaultPath)
|
||||||
await openDb({ persistConnection: true })
|
await openDb()
|
||||||
await saveEncryptionFlag(false)
|
await saveEncryptionFlag(false)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user