diff --git a/app/scripts/comp/launcher-cordova.js b/app/scripts/comp/launcher-cordova.js index cd2dbf43..389c6bdd 100644 --- a/app/scripts/comp/launcher-cordova.js +++ b/app/scripts/comp/launcher-cordova.js @@ -48,7 +48,10 @@ const Launcher = { }, callback); }; - window.resolveLocalFileSystemURL(path, writeFile, callback, callback); + const filePath = this.parsePath(path); + window.resolveLocalFileSystemURL(filePath.dir, dir => { + dir.getFile(filePath.file, {create: true}, writeFile); + }, callback, callback); }, readFile: function(path, encoding, callback) { window.resolveLocalFileSystemURL(path, fileEntry => { @@ -109,8 +112,8 @@ const Launcher = { return { path: fileName, - dir: parts.pop(), - file: parts.join('/') + file: parts.pop(), + dir: parts.join('/') }; }, createFsWatcher: function(path) { @@ -184,7 +187,7 @@ const Launcher = { const encryptConfig = _.extend({}, this.config, { username: fileId, - password: password + password: password.getText() }); FingerprintAuth.encrypt(encryptConfig, result => { diff --git a/app/scripts/models/app-model.js b/app/scripts/models/app-model.js index b4dee7bd..83f08bb8 100644 --- a/app/scripts/models/app-model.js +++ b/app/scripts/models/app-model.js @@ -1021,12 +1021,12 @@ const AppModel = Backbone.Model.extend({ }, saveFileFingerprint: function(file, password) { - if (Launcher && Launcher.fingerprints && password) { + if (Launcher && Launcher.fingerprints && !file.has('fingerprint')) { const fileInfo = this.fileInfos.get(file.id); - Launcher.fingerprints.register(file.id, this.params.password, token => { + Launcher.fingerprints.register(file.id, password, token => { if (token) { fileInfo.set('fingerprint', token); - this.model.fileInfos.save(); + this.fileInfos.save(); } }); }