diff --git a/README.md b/README.md index cce47947..433a53f5 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ [![Gitter](https://badges.gitter.im/saenzramiro/rambox.svg)](https://gitter.im/saenzramiro/rambox?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge) [![license:mit](https://img.shields.io/badge/license-mit-blue.svg)](https://opensource.org/licenses/MIT) -Free and Open Source messaging app that combines chat and messaging common services into one application. +Free and Open Source messaging and emailing app that combines common web applications into one. Available for Windows, Mac and Linux. diff --git a/app.js b/app.js index 3675f3c2..0eb80cb7 100644 --- a/app.js +++ b/app.js @@ -35,3 +35,7 @@ function sync() { services: services }); } + +require('electron').ipcRenderer.on('showAbout', function(event, message) { + !Ext.cq1('about') ? Ext.create('Rambox.view.main.About') : ''; +}); diff --git a/app.json b/app.json index d5c1c783..6daaaa85 100644 --- a/app.json +++ b/app.json @@ -248,7 +248,10 @@ * */ "output": { - "base": "${workspace.build.dir}/${build.environment}/${app.name}" + "base": "${workspace.build.dir}/${build.environment}/${app.name}", + "appCache": { + "enable": true + } }, /** @@ -259,7 +262,10 @@ * List of items in the CACHE MANIFEST section */ "cache": [ - "index.html" + "index.html", + "app.js", + "resources/Rambox-all.css", + "resources/Icon.png" ], /** * List of items in the NETWORK section diff --git a/app/Application.js b/app/Application.js index bd670c5c..9ba8e597 100644 --- a/app/Application.js +++ b/app/Application.js @@ -26,6 +26,9 @@ Ext.define('Rambox.Application', { Ext.cq1('app-main').setActiveTab(key - 48); } }); + + // Remove spinner after 3 secs + Ext.defer(function() { Ext.get('spinner').destroy(); }, 3000); } ,updateTotalNotifications: function( newValue, oldValue ) { diff --git a/app/model/Service.js b/app/model/Service.js index ad5db198..da0127b9 100644 --- a/app/model/Service.js +++ b/app/model/Service.js @@ -22,9 +22,6 @@ Ext.define('Rambox.model.Service', { },{ name: 'logo' ,type: 'string' - ,convert: function( value, record ) { - return value ? value : record.get('type') + '.png'; - } },{ name: 'name' ,type: 'string' diff --git a/app/package.json b/app/package.json index 4d631c05..8a60ab85 100644 --- a/app/package.json +++ b/app/package.json @@ -25,6 +25,7 @@ "author": "Ramiro Saenz", "license": "MIT", "dependencies": { + "electron-window-state": "^3.0.3", "firebase": "^3.0.5", "firebase-token-generator": "^2.0.0" } diff --git a/app/store/Services.js b/app/store/Services.js index b47b78b8..4db0a0bb 100644 --- a/app/store/Services.js +++ b/app/store/Services.js @@ -21,7 +21,6 @@ Ext.define('Rambox.store.Services', { ,listeners: { load: function( store, records, successful ) { if ( Ext.isEmpty(records) ) { - Ext.get('spinner').destroy(); Ext.cq1('app-main').add({ tabConfig : { xtype : 'tbfill' } }); return; } @@ -33,7 +32,7 @@ Ext.define('Rambox.store.Services', { xtype: 'webview' ,id: 'tab_'+service.get('id') ,title: service.get('name') - ,icon: service.get('type') !== 'custom' ? 'resources/icons/'+service.get('logo') : service.get('logo') + ,icon: service.get('type') !== 'custom' ? 'resources/icons/'+service.get('logo') : ( service.get('logo') === '' ? 'resources/icons/custom.png' : service.get('logo')) ,src: service.get('url') ,type: service.get('type') ,muted: service.get('muted') diff --git a/app/store/ServicesList.js b/app/store/ServicesList.js index 22208f8f..7e64c14a 100644 --- a/app/store/ServicesList.js +++ b/app/store/ServicesList.js @@ -151,9 +151,9 @@ Ext.define('Rambox.store.ServicesList', { ,type: 'email' }, { - id: 'office365' - ,logo: 'office365.png' - ,name: 'Office 365' + id: 'outlook365' + ,logo: 'outlook365.png' + ,name: 'Outlook 365' ,url: 'https://outlook.office.com/owa/' ,type: 'email' }, @@ -262,6 +262,49 @@ Ext.define('Rambox.store.ServicesList', { ,name: 'DingTalk' ,url: 'https://im.dingtalk.com/' ,type: 'messaging' + }, + { + id: 'mysms' + ,logo: 'mysms.png' + ,name: 'mysms' + ,url: 'https://app.mysms.com/' + ,type: 'messaging' + ,js_unread: 'function checkUnread(){var e=document.getElementsByClassName("unread"),t=0;for(i=0;i=1?document.title="("+e+") "+originalTitle:document.title=originalTitle}var originalTitle=document.title;setInterval(checkUnread,3000);' + }, + { + id: 'icq' + ,logo: 'icq.png' + ,name: 'ICQ' + ,url: 'https://web.icq.com/' + ,type: 'messaging' + ,js_unread: 'function checkUnread(){updateBadge(parseInt(document.getElementsByClassName("nwa-msg-counter")[0].style.display==="block"?document.getElementsByClassName("nwa-msg-counter")[0].innerHTML.trim():0))}function updateBadge(e){e>=1?document.title="("+e+") "+originalTitle:document.title=originalTitle}var originalTitle=document.title;setInterval(checkUnread,3000);' + }, + { + id: 'tweetdeck' + ,logo: 'tweetdeck.png' + ,name: 'TweetDeck' + ,url: 'https://tweetdeck.twitter.com/' + ,type: 'messaging' + }, + { + id: 'custom' + ,logo: 'custom.png' + ,name: '_Custom Service' + ,type: 'custom' + }, + { + id: 'zinc' + ,logo: 'zinc.png' + ,name: 'Zinc' + ,url: 'https://zinc-app.com/' + ,type: 'messaging' + }, + { + id: 'freenode' + ,logo: 'freenode.png' + ,name: 'FreeNode' + ,url: 'https://webchat.freenode.net/' + ,type: 'messaging' } ] }); diff --git a/app/ux/WebView.js b/app/ux/WebView.js index 4dbd6d77..aee7219c 100644 --- a/app/ux/WebView.js +++ b/app/ux/WebView.js @@ -38,12 +38,23 @@ Ext.define('Rambox.ux.WebView',{ ,plugins: 'true' ,allowtransparency: 'on' ,autosize: 'on' + ,blinkfeatures: 'ApplicationCache,GlobalCacheStorage' + ,useragent: 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2486.0 Safari/537.36 Edge/13.10586' // Used to enable video and audio calls in Skype } }] ,tabConfig: { listeners: { badgetextchange: me.onBadgeTextChange } + ,clickEvent: 'dblclick' + ,menu: [ + { + text: 'Reload' + ,glyph: 'xf021@FontAwesome' + ,scope: me + ,handler: me.reloadService + } + ] } ,listeners: { afterrender: me.onAfterRender @@ -66,7 +77,9 @@ Ext.define('Rambox.ux.WebView',{ // Show and hide spinner when is loading webview.addEventListener("did-start-loading", function() { console.info('Start loading...', me.src); - me.mask('Loading...'); + me.mask('Loading...', 'bottomMask'); + // Manually remove modal from mask + Ext.cq1('#'+me.id).el.dom.getElementsByClassName('bottomMask')[0].parentElement.className = ''; }); webview.addEventListener("did-stop-loading", function() { me.unmask(); @@ -74,28 +87,25 @@ Ext.define('Rambox.ux.WebView',{ webview.addEventListener("did-finish-load", function(e) { Rambox.app.setTotalServicesLoaded( Rambox.app.getTotalServicesLoaded() + 1 ); - if ( Rambox.app.getTotalServicesLoaded() === Ext.getStore('Services').getCount() && Ext.get('spinner') !== null ) { - Ext.get('spinner').destroy(); + }); + + // Open links in default browser + webview.addEventListener('new-window', function(e) { + const protocol = require('url').parse(e.url).protocol; + if (protocol === 'http:' || protocol === 'https:' || protocol === 'mailto:') { + e.preventDefault(); + require('electron').shell.openExternal(e.url); } }); + webview.addEventListener('will-navigate', function(e, url) { + e.preventDefault(); + }); + webview.addEventListener("dom-ready", function(e) { // Mute Webview if ( !webview.isAudioMuted() && me.muted ) webview.setAudioMuted(me.muted); - // Open links in default browser - webview.addEventListener('new-window', function(e) { - const protocol = require('url').parse(e.url).protocol; - if (protocol === 'http:' || protocol === 'https:') { - e.preventDefault(); - require('electron').shell.openExternal(e.url); - } - }); - - webview.addEventListener('will-navigate', function(e, url) { - e.preventDefault(); - }); - // Injected code to detect new messages if ( me.record && me.record.get('js_unread') !== '' ) { console.info('JS Injected', me.src); @@ -139,4 +149,11 @@ Ext.define('Rambox.ux.WebView',{ } }); } + + ,reloadService: function(btn) { + var me = this; + var webview = me.down('component').el.dom; + + webview.reload(); + } }); diff --git a/app/view/main/About.js b/app/view/main/About.js new file mode 100644 index 00000000..941d628e --- /dev/null +++ b/app/view/main/About.js @@ -0,0 +1,28 @@ +Ext.define('Rambox.view.main.About', { + extend: 'Ext.window.Window' + ,xtype: 'about' + ,title: 'About Rambox' + ,autoShow: true + ,modal: true + ,width: 300 + ,bodyPadding: 10 + ,data: { + version: require('electron').remote.app.getVersion() + ,platform: process.platform + ,arch: process.arch + ,electron: process.versions.electron + ,chromium: process.versions.chrome + ,node: process.versions.node + } + ,tpl: [ + '
' + ,'

Free and Open Source messaging and emailing app that combines common web applications into one.

' + ,'
Version: {version}
' + ,'
Platform: {platform} ({arch})
' + ,'
Electron: {electron}
' + ,'
Chromium: {chromium}
' + ,'
Node: {node}
' + ,'
' + ,'
GitHub - Donate - rambox.pro
' + ] +}); diff --git a/app/view/main/Main.js b/app/view/main/Main.js index fd0265f1..f778be43 100644 --- a/app/view/main/Main.js +++ b/app/view/main/Main.js @@ -101,11 +101,6 @@ Ext.define('Rambox.view.main.Main', { ,specialkey: 'onSearchEnter' } } - ,{ - type: 'plus' - ,tooltip: 'Add a custom service' - ,handler: 'addCustomService' - } ] ,items: [ { @@ -148,7 +143,7 @@ Ext.define('Rambox.view.main.Main', { xtype: 'templatecolumn' ,width: 50 ,variableRowHeight: true - ,tpl: '' + ,tpl: '' } ,{ text: 'Name', dataIndex: 'name', variableRowHeight: true, flex: 1 } ,{ @@ -178,17 +173,17 @@ Ext.define('Rambox.view.main.Main', { ,align: 'center' ,items: [ { - glyph: 0xf1f8 - ,tooltip: 'Remove' - ,handler: 'removeService' - ,getClass: function(){ return 'x-hidden-display'; } - } - ,{ glyph: 0xf013 ,tooltip: 'Configure' ,handler: 'configureService' ,getClass: function(){ return 'x-hidden-display'; } } + ,{ + glyph: 0xf1f8 + ,tooltip: 'Remove' + ,handler: 'removeService' + ,getClass: function(){ return 'x-hidden-display'; } + } ] } ] diff --git a/app/view/main/MainController.js b/app/view/main/MainController.js index a5125ca5..9f0d50c1 100644 --- a/app/view/main/MainController.js +++ b/app/view/main/MainController.js @@ -105,6 +105,7 @@ Ext.define('Rambox.view.main.MainController', { } else { var service = Ext.create('Rambox.model.Service', { type: record.get('id') + ,logo: record.get('logo') ,name: formValues.serviceName ,url: record.get('url') ,align: formValues.align @@ -149,11 +150,11 @@ Ext.define('Rambox.view.main.MainController', { win.down('textfield[name="serviceName"]').focus(true, 100); } - ,showCustomModal: function(record) { + ,showCustomModal: function(record, edit) { var me = this; var win = Ext.create('Ext.window.Window', { - title: 'Add '+record.get('name') + title: (edit ? 'Edit ' : 'Add ') + record.get('name') ,modal: true ,width: 400 ,resizable: false @@ -210,7 +211,7 @@ Ext.define('Rambox.view.main.MainController', { { xtype: 'checkbox' ,boxLabel: 'Align to Right' - ,checked: false + ,checked: edit ? (record.get('align') === 'right' ? true : false) : false ,name: 'align' ,uncheckedValue: 'left' ,inputValue: 'right' @@ -219,7 +220,7 @@ Ext.define('Rambox.view.main.MainController', { xtype: 'checkbox' ,boxLabel: 'Show notifications' ,name: 'notifications' - ,checked: true + ,checked: edit ? record.get('notifications') : true ,uncheckedValue: false ,inputValue: true } @@ -227,7 +228,7 @@ Ext.define('Rambox.view.main.MainController', { xtype: 'checkbox' ,boxLabel: 'Mute all sounds' ,name: 'muted' - ,checked: false + ,checked: edit ? record.get('muted') : false ,uncheckedValue: false ,inputValue: true } @@ -253,39 +254,50 @@ Ext.define('Rambox.view.main.MainController', { var formValues = win.down('form').getValues(); - var service = Ext.create('Rambox.model.Service', { - type: record.get('id') - ,name: formValues.serviceName - ,url: record.get('url').replace('___', formValues.url) - ,align: formValues.align - ,notifications: formValues.notifications - ,muted: formValues.muted - ,js_unread: record.get('js_unread') - }); - service.save(); - Ext.getStore('Services').add(service); - - var tabData = { - xtype: 'webview' - ,id: 'tab_'+service.get('id') - ,title: service.get('name') - ,icon: 'resources/icons/'+record.get('logo') - ,src: service.get('url') - ,type: service.get('type') - ,align: formValues.align - ,notifications: formValues.notifications - ,muted: formValues.muted - ,record: service - ,tabConfig: { - service: service - } - }; - - if ( formValues.align === 'left' ) { - var tbfill = me.getView().getTabBar().down('tbfill'); - me.getView().insert(me.getView().getTabBar().items.indexOf(tbfill), tabData).show(); + if ( edit ) { + record.set({ + name: formValues.serviceName + ,align: formValues.align + ,notifications: formValues.notifications + ,muted: formValues.muted + }); + Ext.getCmp('tab_'+record.get('id')).setTitle(formValues.serviceName); } else { - me.getView().add(tabData).show(); + var service = Ext.create('Rambox.model.Service', { + type: record.get('id') + ,logo: record.get('logo') + ,name: formValues.serviceName + ,url: record.get('url').replace('___', formValues.url) + ,align: formValues.align + ,notifications: formValues.notifications + ,muted: formValues.muted + ,js_unread: record.get('js_unread') + }); + service.save(); + Ext.getStore('Services').add(service); + + var tabData = { + xtype: 'webview' + ,id: 'tab_'+service.get('id') + ,title: service.get('name') + ,icon: 'resources/icons/'+record.get('logo') + ,src: service.get('url') + ,type: service.get('type') + ,align: formValues.align + ,notifications: formValues.notifications + ,muted: formValues.muted + ,record: service + ,tabConfig: { + service: service + } + }; + + if ( formValues.align === 'left' ) { + var tbfill = me.getView().getTabBar().down('tbfill'); + me.getView().insert(me.getView().getTabBar().items.indexOf(tbfill), tabData).show(); + } else { + me.getView().add(tabData).show(); + } } win.close(); @@ -301,6 +313,8 @@ Ext.define('Rambox.view.main.MainController', { ,onNewServiceSelect: function( view, record, item, index, e ) { if ( record.get('url').indexOf('___') >= 0 ) { this.showCustomModal(record); + } else if ( record.get('type') === 'custom' ) { + this.addCustomService(record, false); } else { this.showSimpleModal(record, false); } @@ -355,14 +369,18 @@ Ext.define('Rambox.view.main.MainController', { } ,configureService: function( gridView, rowIndex, colIndex, col, e, rec, rowEl ) { - this.showSimpleModal(rec, true); + if ( rec.get('type') === 'custom' ) { + this.addCustomService(rec, true); + } else { + this.showSimpleModal(rec, true); + } } - ,addCustomService: function( event, toolEl, owner, tool ) { + ,addCustomService: function( record, edit ) { var me = this; var win = Ext.create('Ext.window.Window', { - title: 'Add Custom Service' + title: (edit ? 'Edit ' : 'Add ') + 'Custom Service' ,modal: true ,width: 400 ,resizable: false @@ -376,6 +394,7 @@ Ext.define('Rambox.view.main.MainController', { xtype: 'textfield' ,fieldLabel: 'Name' ,name: 'serviceName' + ,value: (edit ? record.get('name') : '') ,allowBlank: true ,listeners: { specialkey: function(field, e) { @@ -391,6 +410,7 @@ Ext.define('Rambox.view.main.MainController', { ,emptyText: 'http://service.url.com' ,name: 'url' ,vtype: 'url' + ,value: (edit ? record.get('url') : '') ,allowBlank: false ,listeners: { specialkey: function(field, e) { @@ -406,6 +426,7 @@ Ext.define('Rambox.view.main.MainController', { ,emptyText: 'http://image.url.com/image.png' ,name: 'logo' ,vtype: 'url' + ,value: (edit ? record.get('logo') : '') ,allowBlank: true ,listeners: { specialkey: function(field, e) { @@ -423,7 +444,7 @@ Ext.define('Rambox.view.main.MainController', { { xtype: 'checkbox' ,boxLabel: 'Align to Right' - ,checked: false + ,checked: edit ? (record.get('align') === 'right' ? true : false) : false ,name: 'align' ,uncheckedValue: 'left' ,inputValue: 'right' @@ -432,7 +453,7 @@ Ext.define('Rambox.view.main.MainController', { xtype: 'checkbox' ,boxLabel: 'Show notifications' ,name: 'notifications' - ,checked: true + ,checked: edit ? record.get('notifications') : true ,uncheckedValue: false ,inputValue: true } @@ -440,7 +461,7 @@ Ext.define('Rambox.view.main.MainController', { xtype: 'checkbox' ,boxLabel: 'Mute all sounds' ,name: 'muted' - ,checked: false + ,checked: edit ? record.get('muted') : false ,uncheckedValue: false ,inputValue: true } @@ -455,11 +476,11 @@ Ext.define('Rambox.view.main.MainController', { ,items: [ { xtype: 'textarea' - ,fieldLabel: 'Unread Code' + ,fieldLabel: 'Unread Code (read more)' ,allowBlank: true ,name: 'js_unread' + ,value: (edit ? record.get('js_unread') : '') ,anchor: '100%' - ,emptyText: 'Write code here if the service don\'t update the page title when have new activity. The code needs to return an integer, for example: document.body.getElementsByClassName("ee").length;' ,height: 120 } ] @@ -477,47 +498,68 @@ Ext.define('Rambox.view.main.MainController', { } ,'->' ,{ - text: 'Add service' + text: (edit ? 'Edit ' : 'Add ') + ' Service' ,itemId: 'submit' ,handler: function() { if ( !win.down('form').isValid() ) return false; var formValues = win.down('form').getValues(); - var service = Ext.create('Rambox.model.Service', { - type: 'custom' - ,logo: formValues.logo - ,name: formValues.serviceName - ,url: formValues.url - ,align: formValues.align - ,notifications: formValues.notifications - ,muted: formValues.muted - ,js_unread: 'function checkUnread(){updateBadge(' + formValues.js_unread + ')}function updateBadge(e){e>=1?document.title="("+e+") "+originalTitle:document.title=originalTitle}var originalTitle=document.title;setInterval(checkUnread,3000);' - }); - service.save(); - Ext.getStore('Services').add(service); - - var tabData = { - xtype: 'webview' - ,id: 'tab_'+service.get('id') - ,title: service.get('name') - ,icon: formValues.logo - ,src: service.get('url') - ,type: service.get('type') - ,align: formValues.align - ,notifications: formValues.notifications - ,muted: formValues.muted - ,record: service - ,tabConfig: { - service: service - } - }; + if ( edit ) { + // If users change the URL, we change the URL of the Webview + if ( record.get('url') !== formValues.url ) Ext.getCmp('tab_'+record.get('id')).down('component').el.dom.loadURL(formValues.url); + + // Save the service + record.set({ + name: formValues.serviceName + ,url: formValues.url + ,logo: formValues.logo + ,align: formValues.align + ,notifications: formValues.notifications + ,muted: formValues.muted + ,js_unread: formValues.js_unread + }); - if ( formValues.align === 'left' ) { - var tbfill = me.getView().getTabBar().down('tbfill'); - me.getView().insert(me.getView().getTabBar().items.indexOf(tbfill), tabData).show(); + // Change the title of the Tab + Ext.getCmp('tab_'+record.get('id')).setTitle(formValues.serviceName); + // Change the icon of the Tab + Ext.getCmp('tab_'+record.get('id')).setIcon(record.get('logo') === '' ? 'resources/icons/custom.png' : record.get('logo')); } else { - me.getView().add(tabData).show(); + var service = Ext.create('Rambox.model.Service', { + type: 'custom' + ,logo: formValues.logo + ,name: formValues.serviceName + ,url: formValues.url + ,align: formValues.align + ,notifications: formValues.notifications + ,muted: formValues.muted + ,js_unread: formValues.js_unread !== '' ? 'function checkUnread(){updateBadge(' + formValues.js_unread + ')}function updateBadge(e){e>=1?document.title="("+e+") "+originalTitle:document.title=originalTitle}var originalTitle=document.title;setInterval(checkUnread,3000);' : '' + }); + service.save(); + Ext.getStore('Services').add(service); + + var tabData = { + xtype: 'webview' + ,id: 'tab_'+service.get('id') + ,title: service.get('name') + ,icon: formValues.logo + ,src: service.get('url') + ,type: service.get('type') + ,align: formValues.align + ,notifications: formValues.notifications + ,muted: formValues.muted + ,record: service + ,tabConfig: { + service: service + } + }; + + if ( formValues.align === 'left' ) { + var tbfill = me.getView().getTabBar().down('tbfill'); + me.getView().insert(me.getView().getTabBar().items.indexOf(tbfill), tabData).show(); + } else { + me.getView().add(tabData).show(); + } } win.close(); @@ -537,7 +579,7 @@ Ext.define('Rambox.view.main.MainController', { ,onSearchEnter: function( field, e ) { var me = this; - if ( e.getKey() == e.ENTER && Ext.getStore('ServicesList').getCount() === 1 ) { + if ( e.getKey() == e.ENTER && Ext.getStore('ServicesList').getCount() === 2 ) { // Two because we always shows Custom Service option me.onNewServiceSelect(field.up().down('dataview'), Ext.getStore('ServicesList').getAt(0)); me.onClearClick(field); } @@ -548,7 +590,7 @@ Ext.define('Rambox.view.main.MainController', { Ext.getStore('ServicesList').getFilters().replaceAll({ fn: function(record) { - return Ext.Array.contains(Ext.Object.getKeys(cg.getValue()), record.get('type')); + return Ext.Array.contains(Ext.Object.getKeys(cg.getValue()), record.get('type')) || record.get('type') === 'custom'; } }); } @@ -562,6 +604,7 @@ Ext.define('Rambox.view.main.MainController', { Ext.getStore('ServicesList').getFilters().replaceAll({ fn: function(record) { + if ( record.get('type') === 'custom' ) return true; if ( !Ext.Array.contains(Ext.Object.getKeys(cg.getValue()), record.get('type')) ) return false; return record.get('name').toLowerCase().indexOf(newValue.toLowerCase()) > -1 ? true : false; } diff --git a/electron/autoupdater.js b/electron/autoupdater.js index 8891f8fe..66bb5100 100644 --- a/electron/autoupdater.js +++ b/electron/autoupdater.js @@ -13,7 +13,7 @@ const feedUrl = `https://getrambox.herokuapp.com/update/${process.platform}/${ap exports.check = win => { if ( isDev ) return; - + /* autoUpdater.on('update-available', function() { dialog.showMessageBox({ message: 'New version' @@ -21,7 +21,7 @@ exports.check = win => { ,buttons: ['Ok'] }); }); - + */ autoUpdater.on('update-downloaded', function(e, releaseNotes, releaseName, releaseDate, updateURL) { var index = dialog.showMessageBox({ message: 'A new update is ready to install' diff --git a/electron/main.js b/electron/main.js index 842218f1..9f82a35c 100644 --- a/electron/main.js +++ b/electron/main.js @@ -13,6 +13,8 @@ const appMenu = require('./menu'); const tray = require('./tray'); // Require for autpUpdate file const autoupdater = require('./autoupdater'); +// Window State Plugin +const windowStateKeeper = require('electron-window-state'); const MenuItem = electron.MenuItem; @@ -91,11 +93,21 @@ let mainWindow; let isQuitting = false; function createWindow () { - // Create the browser window. + // Load the previous state with fallback to defaults + let mainWindowState = windowStateKeeper({ + defaultWidth: 1000 + ,defaultHeight: 800 + ,maximize: true + }); + // Create the browser window using the state information mainWindow = new BrowserWindow({ title: 'Rambox' ,skipTaskbar: false ,icon: __dirname + '/../resources/Icon.png' + ,x: mainWindowState.x + ,y: mainWindowState.y + ,width: mainWindowState.width + ,height: mainWindowState.height ,webPreferences: { webSecurity: false ,nodeIntegration: true @@ -104,10 +116,12 @@ function createWindow () { } }); - process.setMaxListeners(100); + // Let us register listeners on the window, so we can update the state + // automatically (the listeners will be removed when the window is closed) + // and restore the maximized or full screen state + mainWindowState.manage(mainWindow); - // Start maximize - mainWindow.maximize(); + process.setMaxListeners(100); // and load the index.html of the app. mainWindow.loadURL('file://' + __dirname + '/../index.html'); diff --git a/electron/menu.js b/electron/menu.js index 41b61af6..3362e7f9 100644 --- a/electron/menu.js +++ b/electron/menu.js @@ -122,7 +122,7 @@ let tpl = [ label: 'Close', accelerator: 'CmdOrCtrl+W', role: 'close' - }, + } ] }, { @@ -137,7 +137,9 @@ if (process.platform === 'darwin') { submenu: [ { label: `About ${appName}`, - role: 'about' + click() { + sendAction('showAbout') + } }, { type: 'separator' @@ -194,7 +196,9 @@ if (process.platform === 'darwin') { }); helpSubmenu.push({ label: `About ${appName}`, - role: 'about' + click() { + sendAction('showAbout') + } }); } diff --git a/package.json b/package.json index 50214eef..26526890 100644 --- a/package.json +++ b/package.json @@ -101,7 +101,6 @@ } }, "dependencies": { - "firebase": "^3.0.5", - "firebase-token-generator": "^2.0.0" + } } diff --git a/packages/local/rambox-default-theme/sass/src/LoadMask.scss b/packages/local/rambox-default-theme/sass/src/LoadMask.scss new file mode 100644 index 00000000..b841ac77 --- /dev/null +++ b/packages/local/rambox-default-theme/sass/src/LoadMask.scss @@ -0,0 +1,14 @@ +.bottomMask { + bottom: 0; + height: 32px; + position: fixed; + top: auto !important; + left: 0 !important; + width: 120px; + .x-mask-msg-text { + padding: 0 0 0 24px; + background-image: url(images/loadmask/loading.gif); + background-repeat: no-repeat; + background-position: 0 0; + } +} diff --git a/resources/icons/custom.png b/resources/icons/custom.png new file mode 100644 index 00000000..710acb6a Binary files /dev/null and b/resources/icons/custom.png differ diff --git a/resources/icons/freenode.png b/resources/icons/freenode.png new file mode 100644 index 00000000..0ac9d6e9 Binary files /dev/null and b/resources/icons/freenode.png differ diff --git a/resources/icons/icq.png b/resources/icons/icq.png new file mode 100644 index 00000000..c6f9ca4c Binary files /dev/null and b/resources/icons/icq.png differ diff --git a/resources/icons/mysms.png b/resources/icons/mysms.png new file mode 100644 index 00000000..a99ae87e Binary files /dev/null and b/resources/icons/mysms.png differ diff --git a/resources/icons/outlook365.png b/resources/icons/outlook365.png new file mode 100644 index 00000000..10765276 Binary files /dev/null and b/resources/icons/outlook365.png differ diff --git a/resources/icons/tweetdeck.png b/resources/icons/tweetdeck.png new file mode 100644 index 00000000..aec50613 Binary files /dev/null and b/resources/icons/tweetdeck.png differ diff --git a/resources/icons/zinc.png b/resources/icons/zinc.png new file mode 100644 index 00000000..7991b6f9 Binary files /dev/null and b/resources/icons/zinc.png differ