diff --git a/app/scripts/comp/launcher-cordova.js b/app/scripts/comp/launcher-cordova.js index 389c6bdd..fad6d3ce 100644 --- a/app/scripts/comp/launcher-cordova.js +++ b/app/scripts/comp/launcher-cordova.js @@ -48,10 +48,14 @@ const Launcher = { }, callback); }; - const filePath = this.parsePath(path); - window.resolveLocalFileSystemURL(filePath.dir, dir => { - dir.getFile(filePath.file, {create: true}, writeFile); - }, callback, callback); + if (path.startsWith('cdvfile://')) { // then file exists + window.resolveLocalFileSystemURL(path, writeFile, callback, callback); + } else { // create file on sd card + 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 => { @@ -187,7 +191,7 @@ const Launcher = { const encryptConfig = _.extend({}, this.config, { username: fileId, - password: password.getText() + password: password }); FingerprintAuth.encrypt(encryptConfig, result => { diff --git a/app/scripts/views/settings/settings-file-view.js b/app/scripts/views/settings/settings-file-view.js index e4b742fd..14d5c9da 100644 --- a/app/scripts/views/settings/settings-file-view.js +++ b/app/scripts/views/settings/settings-file-view.js @@ -163,7 +163,16 @@ const SettingsFileView = Backbone.View.extend({ return; } } - this.appModel.syncFile(this.model, arg); + + const password = this.$el.find('#settings__file-master-pass').val(); + const shouldUpdateFingerprint = this.model.get('passwordChanged') && this.model.get('fingerprint'); // save to suggest fingerprint auth after sync + + this.appModel.syncFile(this.model, arg, () => { + if (shouldUpdateFingerprint) { + this.model.set('fingerprint', null); // erase old fingerprint token + this.appModel.saveFileFingerprint(this.model, password); + } + }); }, saveDefault: function() {