diff --git a/app.js b/app.js index a77c0ea4..c2c0e48b 100644 --- a/app.js +++ b/app.js @@ -1,17 +1,3 @@ -// Initialize Firebase -var firebase = require('firebase/app'); -require('firebase/database'); -require('firebase/auth'); - -// Firebase Config -var config = { - apiKey: firebaseCfg.apiKey - ,authDomain: firebaseCfg.authDomain - ,databaseURL: firebaseCfg.databaseURL - ,storageBucket: firebaseCfg.storageBucket -}; -var fireRef = firebase.initializeApp(config); // Firebase Ref -var FirebaseTokenGenerator = require('firebase-token-generator'); var auth0, lock; // Auth0 vars // Sencha App diff --git a/app/Application.js b/app/Application.js index 806924db..79a76390 100644 --- a/app/Application.js +++ b/app/Application.js @@ -4,8 +4,7 @@ Ext.define('Rambox.Application', { ,name: 'Rambox' ,requires: [ - 'Rambox.ux.Firebase' - ,'Rambox.ux.Auth0' + 'Rambox.ux.Auth0' ,'Rambox.util.MD5' ,'Ext.window.Toast' ] @@ -31,6 +30,12 @@ Ext.define('Rambox.Application', { ga_storage._trackPageview('/index.html', 'main'); ga_storage._trackEvent('Versions', require('electron').remote.app.getVersion()); + // Initialize Auth0 + Rambox.ux.Auth0.init(); + + // Check for updates + Rambox.app.checkUpdate(true); + // Add shortcuts to switch services using CTRL + Number var map = new Ext.util.KeyMap({ target: document @@ -204,54 +209,60 @@ Ext.define('Rambox.Application', { } ,checkUpdate: function(silence) { - fireRef.database().ref('config').once('value', function(snapshot) { - var appVersion = new Ext.Version(require('electron').remote.app.getVersion()); - if ( appVersion.isLessThan(snapshot.val().latestVersion) ) { - console.info('New version is available', snapshot.val().latestVersion); - Ext.cq1('app-main').addDocked({ - xtype: 'toolbar' - ,dock: 'top' - ,ui: 'newversion' - ,items: [ - '->' - ,{ - xtype: 'label' - ,html: 'New version is available! ('+snapshot.val().latestVersion+')' + ( process.platform === 'win32' ? ' Is downloading in the background and you will notify when is ready to install it.' : '' ) - } - ,{ - xtype: 'button' - ,text: 'Download' - ,href: 'https://getrambox.herokuapp.com/download/'+process.platform+'_'+process.arch - ,hidden: process.platform === 'win32' - } - ,{ - xtype: 'button' - ,text: 'Changelog' - ,ui: 'decline' - ,tooltip: 'Click here to see more information about the new version.' - ,href: 'https://github.com/saenzramiro/rambox/releases/tag/'+snapshot.val().latestVersion - } - ,'->' - ,{ - glyph: 'xf00d@FontAwesome' - ,baseCls: '' - ,style: 'cursor:pointer;' - ,handler: function(btn) { Ext.cq1('app-main').removeDocked(btn.up('toolbar'), true); } - } - ] - }); - if ( process.platform === 'win32' ) ipc.send('autoUpdater:check-for-updates'); - return; - } else if ( !silence ) { - Ext.Msg.show({ - title: 'You are up to date!' - ,message: 'You have the latest version of Rambox.' - ,icon: Ext.Msg.INFO - ,buttons: Ext.Msg.OK - }); - } + console.info('Checking for updates...'); + Ext.Ajax.request({ + url: 'http://rambox.pro/api/latestversion.json' + ,method: 'GET' + ,success: function(response) { + var json = Ext.decode(response.responseText); + var appVersion = new Ext.Version(require('electron').remote.app.getVersion()); + if ( appVersion.isLessThan(json.version) ) { + console.info('New version is available', json.version); + Ext.cq1('app-main').addDocked({ + xtype: 'toolbar' + ,dock: 'top' + ,ui: 'newversion' + ,items: [ + '->' + ,{ + xtype: 'label' + ,html: 'New version is available! ('+json.version+')' + ( process.platform === 'win32' ? ' Is downloading in the background and you will notify when is ready to install it.' : '' ) + } + ,{ + xtype: 'button' + ,text: 'Download' + ,href: 'https://getrambox.herokuapp.com/download/'+process.platform+'_'+process.arch + ,hidden: process.platform === 'win32' + } + ,{ + xtype: 'button' + ,text: 'Changelog' + ,ui: 'decline' + ,tooltip: 'Click here to see more information about the new version.' + ,href: 'https://github.com/saenzramiro/rambox/releases/tag/'+json.version + } + ,'->' + ,{ + glyph: 'xf00d@FontAwesome' + ,baseCls: '' + ,style: 'cursor:pointer;' + ,handler: function(btn) { Ext.cq1('app-main').removeDocked(btn.up('toolbar'), true); } + } + ] + }); + if ( process.platform === 'win32' ) ipc.send('autoUpdater:check-for-updates'); + return; + } else if ( !silence ) { + Ext.Msg.show({ + title: 'You are up to date!' + ,message: 'You have the latest version of Rambox.' + ,icon: Ext.Msg.INFO + ,buttons: Ext.Msg.OK + }); + } - console.info('Your version is the latest. No need to update.'); + console.info('Your version is the latest. No need to update.'); + } }); } }); diff --git a/app/model/Service.js b/app/model/Service.js index fe35526b..e7fbdc59 100644 --- a/app/model/Service.js +++ b/app/model/Service.js @@ -60,8 +60,5 @@ Ext.define('Rambox.model.Service', { name: 'js_unread' ,type: 'string' ,defaultValue: '' - },{ - name: 'firebase_key' - ,type: 'int' }] }); diff --git a/app/package.json b/app/package.json index 2b5cc84b..e6c7b3aa 100644 --- a/app/package.json +++ b/app/package.json @@ -30,8 +30,6 @@ "license": "MIT", "dependencies": { "auto-launch": "4.0.0", - "firebase": "^3.0.5", - "firebase-token-generator": "^2.0.0", "tmp": "0.0.28", "electron-spell-check-provider": "^1.0.0", "mime": "^1.3.4", diff --git a/app/profile/Online.js b/app/profile/Online.js index bce6c502..cb320770 100644 --- a/app/profile/Online.js +++ b/app/profile/Online.js @@ -6,7 +6,5 @@ Ext.define('Rambox.profile.Online', { ,launch: function() { console.info('USER LOGGED IN'); - - Rambox.ux.Firebase.createEvents(false); } }); diff --git a/app/store/Services.js b/app/store/Services.js index 6ab34ffe..cb38447f 100644 --- a/app/store/Services.js +++ b/app/store/Services.js @@ -65,50 +65,5 @@ Ext.define('Rambox.store.Services', { store.suspendEvent('load'); Ext.cq1('app-main').resumeEvent('add'); } - ,add: function(store, records, index) { - var record = records[0]; - if ( !localStorage.getItem('id_token') || (!Ext.isEmpty(record.previousValues) && !Ext.isEmpty(record.previousValues.position)) ) return true; - - console.info('Saving into Firebase...', record.data); - - var ref = fireRef.database().ref('users/' + Ext.decode(localStorage.getItem('profile')).user_id).child('services'); - - ref.once('value', function(snap) { - // Generate Key - var i = 0; - while ( snap.child(i).exists() ) { i++; } - - // Save Firebase Key into record - record.set('firebase_key', i); - - // Prevent saving local ID and Firebase Key into Firebase - var data = Ext.clone(record.data); - delete data.id; - delete data.firebase_key; - - // Make the call - ref.child(i).set(data); - }); - } - ,update: function(store, record, operation, data) { - // Is not logged, Skip - if ( !localStorage.getItem('id_token') || operation === 'commit' ) return; - - if ( operation === 'edit' && data[0] !== 'firebase_key' ) { - var obj = {}; - Ext.each(data, function(prop) { - obj[prop] = record.get(prop); - }); - - fireRef.database().ref('users/' + Ext.decode(localStorage.getItem('profile')).user_id + '/services').child(record.get('firebase_key')).update(obj); - } - } - ,remove: function(store, records, index, isMove) { - if ( !localStorage.getItem('id_token') ) return; - - Ext.each(records, function(rec) { - fireRef.database().ref('users/' + Ext.decode(localStorage.getItem('profile')).user_id).child('services').child(rec.get('firebase_key')).remove(); - }); - } } }); diff --git a/app/ux/Auth0.js b/app/ux/Auth0.js index 92c44b83..0d513719 100644 --- a/app/ux/Auth0.js +++ b/app/ux/Auth0.js @@ -41,130 +41,128 @@ Ext.define('Rambox.ux.Auth0', { return; } - console.log('LOGIN', err, profile, authResult.idToken); - // Display a spinner while waiting Ext.Msg.wait('Please wait until we get your configuration.', 'Connecting...'); // Google Analytics Event ga_storage._trackEvent('Users', 'loggedIn'); - // Set the options to retreive a firebase delegation token - var options = { - id_token: authResult.idToken - ,api: 'firebase' - ,scope: 'openid name email displayName' - ,target: auth0Cfg.clientID - }; - - // Make a call to the Auth0 '/delegate' - me.auth0.getDelegationToken(options, function(err, result) { - if ( !err ) { - // Exchange the delegate token for a Firebase auth token - firebase.auth().signInWithCustomToken(result.id_token).then(function(snapshot) { - fireRef.database().ref('users/' + profile.user_id).child('services').orderByChild('position').once('value', function(snapshot2) { - Ext.Msg.hide(); - - // Import Services function - var importServices = function(snap) { - snap.forEach(function(data) { - var s = data.val(); - s.firebase_key = data.key; - var service = Ext.create('Rambox.model.Service', s); - service.save(); - Ext.getStore('Services').add(service); - }); - Ext.getStore('Services').resumeEvent('load'); - Ext.getStore('Services').load(); - - // User is logged in - // Save the profile and JWT. - localStorage.setItem('profile', JSON.stringify(profile)); - localStorage.setItem('id_token', authResult.idToken); - - // Define Events for Firebase - Rambox.ux.Firebase.createEvents(); - } - - // Firebase empty and Have Services - if ( !snapshot2.hasChildren() && Ext.getStore('Services').getCount() > 0 ) { - Ext.Msg.confirm('Import', 'You don\'t have any service saved. Do you want to import your current services?', function(btnId) { - if ( btnId === 'yes' ) { - var services = []; - Ext.getStore('Services').each(function(service, index) { - service.set('firebase_key', index); - // Prevent saving local ID into Firebase - var data = Ext.clone(service.data); - delete data.id; - - services.push(data); - }); - fireRef.database().ref('users/' + profile.user_id).set({ - services: services - }); - - // User is logged in - // Save the profile and JWT. - localStorage.setItem('profile', JSON.stringify(profile)); - localStorage.setItem('id_token', authResult.idToken); - - // Define Events for Firebase - Rambox.ux.Firebase.createEvents(); - } else { - Ext.Msg.confirm('Clear services', 'Do you want to remove all your current services to start over?

If NO, you will be logged out.', function(btnId) { - if ( btnId === 'yes' ) { - Ext.cq1('app-main').getController().removeAllServices(false); - } else { - me.logout(); - } - }); - } - }); - // Firebase not empty and Have Services - } else if ( snapshot2.hasChildren() && Ext.getStore('Services').getCount() > 0 ) { - Ext.Msg.confirm('Confirm', 'To import your configuration, I need to remove all your current services. Do you want to continue?

If NO, you will be logged out.', function(btnId) { - if ( btnId === 'yes' ) { - Ext.cq1('app-main').getController().removeAllServices(false, function() { - importServices(snapshot2); - }); - } else { - me.logout(); - } - }); - // Firebase not empty and Have no Services - } else if ( snapshot2.hasChildren() && Ext.getStore('Services').getCount() === 0 ) { - importServices(snapshot2); - } else { - // Save the profile and JWT. - localStorage.setItem('profile', JSON.stringify(profile)); - localStorage.setItem('id_token', authResult.idToken); - } - }); - })['catch'](function(error) { - Ext.Msg.hide(); - Ext.Msg.show({ - title: 'Firebase Error' - ,message: error.message+'

Code: '+error.code+'

Sorry, try again later.' - ,icon: Ext.Msg.ERROR - ,buttons: Ext.Msg.OK - }); - me.logout(); - Ext.cq1('app-main').getViewModel().set('username', ''); - Ext.cq1('app-main').getViewModel().set('avatar', ''); - }); - } - }); + // User is logged in + // Save the profile and JWT. + localStorage.setItem('profile', JSON.stringify(profile)); + localStorage.setItem('id_token', authResult.idToken); + + if ( !Ext.isEmpty(profile.user_metadata.services) ) { + Ext.each(profile.user_metadata.services, function(s) { + var service = Ext.create('Rambox.model.Service', s); + service.save(); + Ext.getStore('Services').add(service); + }); + + require('electron').remote.getCurrentWindow().reload(); + } + Ext.Msg.hide(); Ext.cq1('app-main').getViewModel().set('username', profile.name); Ext.cq1('app-main').getViewModel().set('avatar', profile.picture); }); }); } - ,login: function() { + ,backupConfiguration: function() { + var me = this; + + Ext.Msg.wait('Saving backup...', 'Please wait...'); + + // Getting all services + var lastupdate = (new Date()).toJSON(); + var services = []; + Ext.getStore('Services').each(function(service) { + delete service.data.id; + services.push(service.data); + }); + + Ext.Ajax.request({ + url: 'https://rambox.auth0.com/api/v2/users/'+Ext.decode(localStorage.getItem('profile')).user_id + ,method: 'PATCH' + ,headers: { authorization: "Bearer " + localStorage.getItem('id_token') } + ,jsonData: { user_metadata: { services: services, services_lastupdate: lastupdate } } + ,success: function(response) { + Ext.Msg.hide(); + // Save the last update in localStorage + var profile = Ext.decode(localStorage.getItem('profile')); + profile.user_metadata.services_lastupdate = lastupdate; + localStorage.setItem('profile', Ext.encode(profile)); + Ext.cq1('app-main').getViewModel().set('last_sync', new Date(lastupdate).toUTCString()); + + Ext.toast({ + html: ' Your configuration were successfully backed up.' + ,title: 'Synchronize Configuration' + ,width: 300 + ,align: 't' + ,closable: false + }); + } + ,failure: function(response) { + Ext.Msg.hide(); + Ext.toast({ + html: ' Error ocurred when trying to backup your configuration.' + ,title: 'Synchronize Configuration' + ,width: 300 + ,align: 't' + ,closable: false + }); + console.error(response); + } + }); + } + + ,restoreConfiguration: function() { var me = this; - if ( !me.auth0 ) Rambox.ux.Auth0.init(); + Ext.cq1('app-main').getController().removeAllServices(false, function() { + me.lock.getProfile(localStorage.getItem('id_token'), function (err, profile) { + if (err) return alert('There was an error getting the profile: ' + err.message); + + Ext.each(profile.user_metadata.services, function(s) { + var service = Ext.create('Rambox.model.Service', s); + service.save(); + Ext.getStore('Services').add(service); + }); + + require('electron').remote.getCurrentWindow().reload(); + }); + }); + } + + ,checkConfiguration: function() { + var me = this; + + me.lock.getProfile(localStorage.getItem('id_token'), function (err, profile) { + if (err) return alert('There was an error getting the profile: ' + err.message); + + if ( Math.floor(new Date(profile.user_metadata.services_lastupdate) / 1000) > Math.floor(new Date(Ext.decode(localStorage.getItem('profile')).user_metadata.services_lastupdate) / 1000) ) { + Ext.toast({ + html: 'Your settings are out of date.' + ,title: 'Synchronize Configuration' + ,width: 300 + ,align: 't' + ,closable: false + }); + } else { + Ext.toast({ + html: 'Latest backup is already applied.' + ,title: 'Synchronize Configuration' + ,width: 300 + ,align: 't' + ,closable: false + }); + } + }); + } + + ,login: function() { + var me = this; me.lock.show(); } diff --git a/app/ux/Firebase.js b/app/ux/Firebase.js deleted file mode 100644 index 6fc3e008..00000000 --- a/app/ux/Firebase.js +++ /dev/null @@ -1,170 +0,0 @@ -Ext.define('Rambox.ux.Firebase', { - singleton: true - - // private - ,eventsDefined: false - - ,createEvents: function() { - //if ( this.eventsDefined || !localStorage.getItem('id_token') ) return; - if ( !localStorage.getItem('id_token') ) return; - - console.log('Define listeners for Firebase'); - - var ref = fireRef.database().ref('users/' + Ext.decode(localStorage.getItem('profile')).user_id).child('services'); - - // Attach an asynchronous callback to read the data at our posts reference - ref.on("child_changed", function(snapshot, prevChildKey) { - // Disable duplicate actions when user edit a service - var rec = Ext.getStore('Services').findRecord('firebase_key', snapshot.key); - var recData = Ext.clone(rec.data); - delete recData.id; - delete recData.firebase_key; - if ( Ext.Object.equals(recData, snapshot.val()) ) return; - - console.info('Firebase - Child Changed', snapshot.val(), snapshot.key, prevChildKey); - - // Suspend events - Ext.getStore('Services').suspendEvent('update'); - - // Change the title of the Tab - Ext.getCmp('tab_'+rec.get('id')).setTitle(snapshot.val().name); - // Change sound of the Tab - Ext.getCmp('tab_'+rec.get('id')).setAudioMuted(snapshot.val().muted); - // Change notifications of the Tab - Ext.getCmp('tab_'+rec.get('id')).setNotifications(snapshot.val().notifications); - // Change the icon of the Tab - if ( rec.get('type') === 'custom' && rec.get('logo') !== snapshot.val().logo ) Ext.getCmp('tab_'+rec.get('id')).setConfig('icon', snapshot.val().logo === '' ? 'resources/icons/custom.png' : snapshot.val().logo); - // Change the URL of the Tab - if ( rec.get('url') !== snapshot.val().url ) Ext.getCmp('tab_'+rec.get('id')).setURL(snapshot.val().url); - - // Change the align of the Tab - if ( rec.get('align') !== snapshot.val().align ) { - if ( rec.get('align') === 'left' ) { - Ext.cq1('app-main').moveBefore(Ext.getCmp('tab_'+rec.get('id')), Ext.getCmp('tbfill')); - } else { - Ext.cq1('app-main').moveAfter(Ext.getCmp('tab_'+rec.get('id')), Ext.getCmp('tbfill')); - } - } - // Apply the JS Code of the Tab - if ( rec.get('js_unread') !== snapshot.val().js_unread ) { - Ext.Msg.confirm('CUSTOM CODE', 'Rambox needs to reload the service to execute the new JavaScript code. Do you want to do it now?', function( btnId ) { - if ( btnId === 'yes' ) Ext.getCmp('tab_'+rec.get('id')).reloadService(); - }); - } - // Position - if ( rec.get('position') !== snapshot.val().position ) { - var pos = parseInt(snapshot.val().position); - if ( rec.get('align') === 'right' ) pos++; - Ext.cq1('app-main').move(Ext.getCmp('tab_'+rec.get('id')), pos); - } - - rec.set(snapshot.val()); - rec.save(); - Ext.getCmp('tab_'+rec.get('id')).record = rec; - Ext.getCmp('tab_'+rec.get('id')).tabConfig.service = rec; - - // Enable/Disable - if ( recData.enabled !== snapshot.val().enabled ) Ext.getCmp('tab_'+rec.get('id')).setEnabled(snapshot.val().enabled); - - Ext.getStore('Services').resumeEvent('update'); - Ext.getStore('Services').load(); - }, function (errorObject) { - - }); - - ref.on("child_added", function(snapshot, prevChildKey) { - console.info('Firebase - Child Added', snapshot.val(), snapshot.key, prevChildKey); - - Ext.getStore('Services').suspendEvents(['add', 'update']); - var rec = Ext.getStore('Services').findRecord('firebase_key', snapshot.key); - - // For all version of Rambox (0.3.0) - if ( rec === null ) rec = Ext.getStore('Services').getById(snapshot.val().id); - - var data = snapshot.val(); - - // Update current services - if ( rec ) { - delete data.id; - data.firebase_key = snapshot.key; - rec.set(data); - rec.save(); - } else { // Add new ones if exist - data.firebase_key = snapshot.key; - rec = Ext.create('Rambox.model.Service', data); - rec.save(); - Ext.getStore('Services').add(rec); - - var tabData = { - xtype: 'webview' - ,id: 'tab_'+rec.get('id') - ,title: rec.get('name') - ,icon: rec.get('type') !== 'custom' ? 'resources/icons/'+rec.get('logo') : ( rec.get('logo') === '' ? 'resources/icons/custom.png' : rec.get('logo')) - ,src: rec.get('url') - ,type: rec.get('type') - ,align: rec.get('align') - ,notifications: rec.get('notifications') - ,muted: rec.get('muted') - ,record: rec - ,tabConfig: { - service: rec - } - }; - - if ( rec.get('align') === 'left' ) { - var tbfill = Ext.cq1('app-main').getTabBar().down('tbfill'); - Ext.cq1('app-main').insert(Ext.cq1('app-main').getTabBar().items.indexOf(tbfill), tabData); - } else { - Ext.cq1('app-main').add(tabData); - } - } - - Ext.getStore('Services').resumeEvents(['add', 'update']); - Ext.getStore('Services').load(); - //rec.commit(); - }, function (errorObject) { - - }); - - ref.on("child_removed", function(snapshot) { - console.info('Firebase - Child Removed', snapshot.val(), snapshot.key); - - var rec = Ext.getStore('Services').findRecord('firebase_key', snapshot.key); - - // Remove record from localStorage - if ( rec ) { - Ext.getStore('Services').suspendEvent('remove'); - Ext.getStore('Services').remove(rec); - Ext.cq1('app-main').suspendEvent('remove'); - Ext.getCmp('tab_'+rec.get('id')).close(); - Ext.cq1('app-main').resumeEvent('remove'); - Ext.getStore('Services').resumeEvent('remove'); - Ext.getStore('Services').load(); - } - }, function (errorObject) { - - }); - - this.eventsDefined = true; - } - - ,removeEvents: function() { - //if ( !this.eventsDefined ) return; - - console.log('Remove listeners for Firebase'); - - var ref = fireRef.database().ref('users/' + Ext.decode(localStorage.getItem('profile')).user_id).child('services'); - - ref.off('child_changed', function() { - console.warn('Firebase - Child Changed event removed'); - }); - - ref.off('child_added', function() { - console.warn('Firebase - Child Added event removed'); - }); - - ref.off('child_removed', function() { - console.warn('Firebase - Child Removed event removed'); - }); - } -}); diff --git a/app/view/main/Main.js b/app/view/main/Main.js index 15852d9e..1a23ad68 100644 --- a/app/view/main/Main.js +++ b/app/view/main/Main.js @@ -263,6 +263,37 @@ Ext.define('Rambox.view.main.Main', { } ,menu: [ { + text: 'Synchronize Configuration' + ,glyph: 'xf0c2@FontAwesome' + ,menu: [ + { + xtype: 'label' + ,bind: { + html: 'Last Sync: {last_sync}' + } + } + ,{ + text: 'Backup' + ,glyph: 'xf0ee@FontAwesome' + ,scope: Rambox.ux.Auth0 + ,handler: Rambox.ux.Auth0.backupConfiguration + } + ,{ + text: 'Restore' + ,glyph: 'xf0ed@FontAwesome' + ,scope: Rambox.ux.Auth0 + ,handler: Rambox.ux.Auth0.restoreConfiguration + } + ,{ + text: 'Check for updated backup' + ,glyph: 'xf021@FontAwesome' + ,scope: Rambox.ux.Auth0 + ,handler: Rambox.ux.Auth0.checkConfiguration + } + ] + } + ,'-' + ,{ text: 'Logout' ,glyph: 'xf08b@FontAwesome' ,handler: 'logout' diff --git a/app/view/main/MainController.js b/app/view/main/MainController.js index 0b3c61fd..786ae565 100644 --- a/app/view/main/MainController.js +++ b/app/view/main/MainController.js @@ -352,22 +352,15 @@ Ext.define('Rambox.view.main.MainController', { // Google Analytics Event ga_storage._trackEvent('Users', 'loggedOut'); - firebase.auth().signOut().then(function() { - // Remove Events for Firebase - Rambox.ux.Firebase.removeEvents(); + // Logout from Auth0 + Rambox.ux.Auth0.logout(); - // Logout from Auth0 - Rambox.ux.Auth0.logout(); + Ext.cq1('app-main').getViewModel().set('username', ''); + Ext.cq1('app-main').getViewModel().set('avatar', ''); - Ext.cq1('app-main').getViewModel().set('username', ''); - Ext.cq1('app-main').getViewModel().set('avatar', ''); - - if ( Ext.isFunction(callback) ) callback(); + if ( Ext.isFunction(callback) ) callback(); - Ext.Msg.hide(); - }, function(error) { - console.error(error); - }); + Ext.Msg.hide(); } if ( btn ) { diff --git a/app/view/main/MainModel.js b/app/view/main/MainModel.js index 50a08b90..8cfeb806 100644 --- a/app/view/main/MainModel.js +++ b/app/view/main/MainModel.js @@ -8,5 +8,6 @@ Ext.define('Rambox.view.main.MainModel', { name: 'Rambox' ,username: localStorage.getItem('profile') ? JSON.parse(localStorage.getItem('profile')).name : '' ,avatar: localStorage.getItem('profile') ? JSON.parse(localStorage.getItem('profile')).picture : '' + ,last_sync: localStorage.getItem('profile') ? new Date(JSON.parse(localStorage.getItem('profile')).user_metadata.services_lastupdate).toUTCString() : '' } }); diff --git a/electron/menu.js b/electron/menu.js index 141cab0f..63faaa32 100644 --- a/electron/menu.js +++ b/electron/menu.js @@ -268,13 +268,7 @@ if (process.platform === 'darwin') { click(item, win) { const webContents = win.webContents; const send = webContents.send.bind(win.webContents); - if ( process.platform === 'win32' ) { - electron.autoUpdater.checkForUpdates(); - electron.autoUpdater.once('update-available', (event) => send('autoUpdater:update-available')); - electron.autoUpdater.once('update-not-available', (event) => send('autoUpdater:update-not-available')); - } else { - send('autoUpdater:check-update'); - } + send('autoUpdater:check-update'); } }); helpSubmenu.push({ diff --git a/electron/updater.js b/electron/updater.js index 1967e110..b6dbf8ec 100644 --- a/electron/updater.js +++ b/electron/updater.js @@ -12,7 +12,7 @@ const initialize = (window) => { ipcMain.on('autoUpdater:check-for-updates', (event) => autoUpdater.checkForUpdates()); webContents.on('did-finish-load', () => { autoUpdater.setFeedURL(url); - autoUpdater.checkForUpdates(); + //autoUpdater.checkForUpdates(); }); }; diff --git a/package.json b/package.json index 2762c4a7..414416b6 100644 --- a/package.json +++ b/package.json @@ -95,9 +95,6 @@ }, "dependencies": { "auto-launch": "4.0.0", - "firebase": "^3.0.5", - "electron-spell-check-provider": "^1.0.0", - "firebase-token-generator": "^2.0.0", "tmp": "0.0.28", "mime": "^1.3.4", "electron-is-dev": "^0.1.1",