From 55fe946f589d6233d81b7f1a6dcb91a89f5d6faa Mon Sep 17 00:00:00 2001 From: TheGoddessInari Date: Wed, 15 May 2019 10:12:03 -0700 Subject: [PATCH] Fix backup/restore functions. --- app/ux/FileBackup.js | 20 +++++++++++--------- app/view/main/MainController.js | 5 +++-- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/app/ux/FileBackup.js b/app/ux/FileBackup.js index 193978bb..bcc3493d 100644 --- a/app/ux/FileBackup.js +++ b/app/ux/FileBackup.js @@ -1,14 +1,16 @@ Ext.define('Rambox.ux.FileBackup', { singleton: true, - initComponent: () => { - this.remote = require('electron').remote; - this.path = this.remote.require('path'); - this.fs = this.remote.require('fs'); - this.userPath = this.remote.app.getPath('userData'); - this.defaultFileName = 'rambox-backup.json'; - this.myDefaultPath = this.userPath + this.path.sep + this.defaultFileName; + constructor() { + const me = this; + me.callParent(arguments); + me.remote = require('electron').remote; + me.path = me.remote.require('path'); + me.fs = me.remote.require('fs'); + me.userPath = me.remote.app.getPath('userData'); + me.defaultFileName = 'rambox-backup.json'; + me.myDefaultPath = me.userPath + me.path.sep + me.defaultFileName; }, - backupConfiguration: function (callback) { + backupConfiguration(callback) { var me = this; let services = []; Ext.getStore('Services').each(function(service) { @@ -31,7 +33,7 @@ Ext.define('Rambox.ux.FileBackup', { }); if (Ext.isFunction(callback)) callback.bind(me)(); }, - restoreConfiguration: function () { + restoreConfiguration() { var me = this; me.remote.dialog.showOpenDialog({ defaultPath: me.myDefaultPath, diff --git a/app/view/main/MainController.js b/app/view/main/MainController.js index 266c9c77..5da74bdc 100644 --- a/app/view/main/MainController.js +++ b/app/view/main/MainController.js @@ -215,14 +215,15 @@ Ext.define('Rambox.view.main.MainController', { })); }); Promise.all(promises) - .then(function(value) { + .then(function(resolve) { if ( Ext.isFunction(callback) ) callback(); + return resolve; }) .catch(function(err) { console.error('Error removing services: ' + err); Ext.Msg.alert('Error!','Error removing services: ' + err); }) - .then(function() { // Replace when Promise.finally when available. + .finally(function() { store.resumeEvent('childmove'); store.resumeEvent('remove'); document.title = 'Rambox-OS';