19 changed files with 619 additions and 204 deletions
@ -0,0 +1,57 @@
|
||||
|
||||
/** |
||||
* Singleton class for notification dispatching. |
||||
*/ |
||||
Ext.define('Rambox.util.Notifier', { |
||||
|
||||
singleton: true, |
||||
|
||||
constructor: function(config) { |
||||
|
||||
config = config || {}; |
||||
|
||||
/** |
||||
* Returns the notification text depending on the service type. |
||||
* |
||||
* @param view |
||||
* @param count |
||||
* @return {*} |
||||
*/ |
||||
function getNotificationText(view, count) { |
||||
var text; |
||||
switch (Ext.getStore('ServicesList').getById(view.type).get('type')) { |
||||
case 'messaging': |
||||
text = 'You have ' + Ext.util.Format.plural(count, 'new message', 'new messages') + '.'; |
||||
break; |
||||
case 'email': |
||||
text = 'You have ' + Ext.util.Format.plural(count, 'new email', 'new emails') + '.'; |
||||
break; |
||||
default: |
||||
text = 'You have ' + Ext.util.Format.plural(count, 'new activity', 'new activities') + '.'; |
||||
break; |
||||
} |
||||
return text; |
||||
} |
||||
|
||||
/** |
||||
* Dispatches a notification for a specific service. |
||||
* |
||||
* @param view The view of the service |
||||
* @param {number} count The unread count |
||||
*/ |
||||
this.dispatchNotification = function(view, count) { |
||||
var text = getNotificationText(view, count); |
||||
|
||||
var notification = new Notification(view.record.get('name'), { |
||||
body: text, |
||||
icon: view.tab.icon, |
||||
silent: view.record.get('muted') |
||||
}); |
||||
|
||||
notification.onclick = function() { |
||||
require('electron').remote.getCurrentWindow().show(); |
||||
Ext.cq1('app-main').setActiveTab(view); |
||||
}; |
||||
} |
||||
} |
||||
}); |
@ -0,0 +1,75 @@
|
||||
/** |
||||
* Singleton class to handle the global unread counter. |
||||
*/ |
||||
Ext.define('Rambox.util.UnreadCounter', { |
||||
|
||||
singleton: true, |
||||
|
||||
constructor: function(config) { |
||||
|
||||
config = config || {}; |
||||
|
||||
/** |
||||
* Map for storing the global unread count. |
||||
* service id -> unread count |
||||
* |
||||
* @type {Map} |
||||
*/ |
||||
var unreadCountByService = new Map(); |
||||
|
||||
/** |
||||
* Holds the global unread count for internal usage. |
||||
* |
||||
* @type {number} |
||||
*/ |
||||
var totalUnreadCount = 0; |
||||
|
||||
/** |
||||
* Sets the application's unread count to tracked unread count. |
||||
*/ |
||||
function updateAppUnreadCounter() { |
||||
Rambox.app.setTotalNotifications(totalUnreadCount); |
||||
} |
||||
|
||||
/** |
||||
* Returns the global unread count. |
||||
* |
||||
* @return {number} |
||||
*/ |
||||
this.getTotalUnreadCount = function() { |
||||
return totalUnreadCount; |
||||
}; |
||||
|
||||
/** |
||||
* Sets the global unread count for a specific service. |
||||
* |
||||
* @param {*} id Id of the service to set the global unread count for. |
||||
* @param {number} unreadCount The global unread count for the service. |
||||
*/ |
||||
this.setUnreadCountForService = function(id, unreadCount) { |
||||
unreadCount = parseInt(unreadCount, 10); |
||||
|
||||
if (unreadCountByService.has(id)) { |
||||
totalUnreadCount -= unreadCountByService.get(id); |
||||
} |
||||
totalUnreadCount += unreadCount; |
||||
unreadCountByService.set(id, unreadCount); |
||||
|
||||
updateAppUnreadCounter(); |
||||
}; |
||||
|
||||
/** |
||||
* Clears the global unread count for a specific service. |
||||
* |
||||
* @param {*} id Id of the service to clear the global unread count for. |
||||
*/ |
||||
this.clearUnreadCountForService = function(id) { |
||||
if (unreadCountByService.has(id)) { |
||||
totalUnreadCount -= unreadCountByService.get(id); |
||||
} |
||||
unreadCountByService['delete'](id); |
||||
|
||||
updateAppUnreadCounter(); |
||||
} |
||||
} |
||||
}); |
@ -0,0 +1,34 @@
|
||||
/** |
||||
* Per default scrolling the tab bar moves the tabs 20 pixels. |
||||
* To improve the usability of the tab bar this value is increased for Rambox. |
||||
* Also animations are enabled, so the user understands what's going on. |
||||
*/ |
||||
Ext.define('Rambox.overrides.layout.container.boxOverflow.Scroller', { |
||||
override: 'Ext.layout.container.boxOverflow.Scroller', |
||||
|
||||
scrollIncrement: 250, |
||||
wheelIncrement: 50, |
||||
|
||||
animateScroll: true, |
||||
scrollDuration: 250, |
||||
|
||||
/** |
||||
* In difference to the overridden function this one enables scroll animations. |
||||
* |
||||
* @private |
||||
* Scrolls to the left by the configured amount |
||||
*/ |
||||
scrollLeft: function() { |
||||
this.scrollBy(-this.scrollIncrement); |
||||
}, |
||||
|
||||
/** |
||||
* In difference to the overridden function this one enables scroll animations. |
||||
* |
||||
* @private |
||||
* Scrolls to the right by the configured amount |
||||
*/ |
||||
scrollRight: function() { |
||||
this.scrollBy(this.scrollIncrement); |
||||
} |
||||
}); |
@ -1,106 +1,106 @@
|
||||
{ |
||||
"private": true, |
||||
"scripts": { |
||||
"start": "electron electron/main.js", |
||||
"start:debug": "electron electron/main.js --enable-logging", |
||||
"test": "node electron/test.js", |
||||
"sencha:clean": "rm -rf ./build/production", |
||||
"sencha:compile": "sencha app build && cp app/package.json build/production/Rambox/ && npm --prefix ./build/production/Rambox/ install ./build/production/Rambox/", |
||||
"sencha:compile:build": "sencha app build && cp app/package.json build/production/Rambox/ && cp -R build/production/Rambox/* ../rambox-build", |
||||
"clean": "rm -rf ./dist", |
||||
"clean:osx": "rm -rf ./dist/Rambox-darwin-*", |
||||
"clean:win": "rm -rf ./dist/Rambox-win32-*", |
||||
"pack": "npm run pack:osx && npm run pack:win", |
||||
"pack:osx": "electron-packager \"./build/production/Rambox/\" \"Rambox\" --out=dist --platform=darwin --arch=x64 --version=1.3.4 --icon=resources/installer/Icon.icns --app-version=0.2.0 --build-version=64-bit --version-string.CompanyName=\"Rambox\" --version-string.ProductName=\"Rambox\" --asar --prune --overwrite", |
||||
"pack:win": "npm run pack:win32 && npm run pack:win64", |
||||
"pack:win32": "electron-packager \"./build/production/Rambox/\" \"Rambox\" --out=dist --platform=win32 --arch=ia32 --version=1.3.4 --icon=resources/installer/Icon.ico --app-version=0.2.0 --build-version=32-bit --version-string.CompanyName=\"Rambox\" --version-string.ProductName=\"Rambox\" --asar --prune --overwrite", |
||||
"pack:win64": "electron-packager \"./build/production/Rambox/\" \"Rambox\" --out=dist --platform=win32 --arch=x64 --version=1.3.4 --icon=resources/installer/Icon.ico --app-version=0.2.0 --build-version=64-bit --version-string.CompanyName=\"Rambox\" --version-string.ProductName=\"Rambox\" --asar --prune --overwrite", |
||||
"pack:linux": "npm run pack:linux32 && npm run pack:linux64", |
||||
"pack:linux32": "electron-packager \"./build/production/Rambox/\" \"Rambox\" --out=dist --platform=linux --arch=ia32 --version=1.3.4 --icon=resources/installer/Icon.ico --app-version=0.2.0 --build-version=64-bit --version-string.CompanyName=\"Rambox\" --version-string.ProductName=\"Rambox\" --asar --prune --overwrite", |
||||
"pack:linux64": "electron-packager \"./build/production/Rambox/\" \"Rambox\" --out=dist --platform=linux --arch=x64 --version=1.3.4 --icon=resources/installer/Icon.ico --app-version=0.2.0 --build-version=64-bit --version-string.CompanyName=\"Rambox\" --version-string.ProductName=\"Rambox\" --asar --prune --overwrite", |
||||
"build": "npm run build:linux && npm run build:osx && npm run build:win", |
||||
"build:osx": "build --osx", |
||||
"build:linux": "npm run build:linux32 && npm run build:linux64", |
||||
"build:linux32": "build --linux --ia32", |
||||
"build:linux64": "build --linux --x64", |
||||
"build:win32": "build --win --ia32", |
||||
"build:win64": "build --win --x64", |
||||
"setup:osx": "npm run sencha:clean && npm run sencha:compile && npm run clean:osx && npm run pack:osx && npm run build:osx", |
||||
"setup:win": "npm run sencha:clean && npm run sencha:compile && npm run clean:win && npm run pack:win && npm run build:win", |
||||
"all:win": "npm run sencha:clean && npm run sencha:compile && npm run clean:win && npm run pack:win && npm run zip:win32 && npm run zip:win64 && npm run build:win", |
||||
"all:linux": "npm run sencha:clean && npm run sencha:compile && npm run build:linux" |
||||
}, |
||||
"build": { |
||||
"productName": "Rambox", |
||||
"appId": "com.saenzramiro.rambox", |
||||
"category": "public.app-category.productivity", |
||||
"asar": true, |
||||
"mac": { |
||||
"target": [ |
||||
"default" |
||||
], |
||||
"icon": "./resources/installer/Icon.icns" |
||||
}, |
||||
"dmg": { |
||||
"title": "Rambox", |
||||
"icon": "./resources/installer/Icon.icns", |
||||
"icon-size": 128, |
||||
"contents": [ |
||||
{ |
||||
"x": 355, |
||||
"y": 125, |
||||
"type": "link", |
||||
"path": "/Applications" |
||||
}, |
||||
{ |
||||
"x": 155, |
||||
"y": 125, |
||||
"type": "file" |
||||
} |
||||
] |
||||
}, |
||||
"win": { |
||||
"title": "Rambox", |
||||
"target": [ |
||||
"squirrel", |
||||
"zip" |
||||
], |
||||
"loadingGif": "./resources/installer/loading.gif", |
||||
"iconUrl": "https://raw.githubusercontent.com/saenzramiro/rambox/master/resources/Icon.ico", |
||||
"icon": "./resources/Icon.ico", |
||||
"msi": false |
||||
}, |
||||
"linux": { |
||||
"target": [ |
||||
"AppImage", |
||||
"deb", |
||||
"rpm", |
||||
"zip", |
||||
"tar.gz" |
||||
], |
||||
"icon": "./resources/Icon.png" |
||||
} |
||||
}, |
||||
"directories": { |
||||
"buildResources": "resources/installer/", |
||||
"output": "dist/", |
||||
"app": "build/production/Rambox/" |
||||
}, |
||||
"devDependencies": { |
||||
"asar": "^0.12.1", |
||||
"electron": "1.4.7", |
||||
"electron-builder": "6.5.2", |
||||
"electron-rebuild": "^1.5.5", |
||||
"electron-squirrel-startup": "^1.0.0" |
||||
}, |
||||
"dependencies": { |
||||
"auto-launch": "4.0.0", |
||||
"electron-config": "0.2.1", |
||||
"electron-is-dev": "^0.1.1", |
||||
"private": true, |
||||
"scripts": { |
||||
"start": "electron electron/main.js", |
||||
"start:debug": "electron electron/main.js --enable-logging", |
||||
"test": "node electron/test.js", |
||||
"sencha:clean": "rm -rf ./build/production", |
||||
"sencha:compile": "sencha app build && cp app/package.json build/production/Rambox/ && npm --prefix ./build/production/Rambox/ install ./build/production/Rambox/", |
||||
"sencha:compile:build": "sencha app build && cp app/package.json build/production/Rambox/ && cp -R build/production/Rambox/* ../rambox-build", |
||||
"clean": "rm -rf ./dist", |
||||
"clean:osx": "rm -rf ./dist/Rambox-darwin-*", |
||||
"clean:win": "rm -rf ./dist/Rambox-win32-*", |
||||
"pack": "npm run pack:osx && npm run pack:win", |
||||
"pack:osx": "electron-packager \"./build/production/Rambox/\" \"Rambox\" --out=dist --platform=darwin --arch=x64 --version=1.3.4 --icon=resources/installer/Icon.icns --app-version=0.2.0 --build-version=64-bit --version-string.CompanyName=\"Rambox\" --version-string.ProductName=\"Rambox\" --asar --prune --overwrite", |
||||
"pack:win": "npm run pack:win32 && npm run pack:win64", |
||||
"pack:win32": "electron-packager \"./build/production/Rambox/\" \"Rambox\" --out=dist --platform=win32 --arch=ia32 --version=1.3.4 --icon=resources/installer/Icon.ico --app-version=0.2.0 --build-version=32-bit --version-string.CompanyName=\"Rambox\" --version-string.ProductName=\"Rambox\" --asar --prune --overwrite", |
||||
"pack:win64": "electron-packager \"./build/production/Rambox/\" \"Rambox\" --out=dist --platform=win32 --arch=x64 --version=1.3.4 --icon=resources/installer/Icon.ico --app-version=0.2.0 --build-version=64-bit --version-string.CompanyName=\"Rambox\" --version-string.ProductName=\"Rambox\" --asar --prune --overwrite", |
||||
"pack:linux": "npm run pack:linux32 && npm run pack:linux64", |
||||
"pack:linux32": "electron-packager \"./build/production/Rambox/\" \"Rambox\" --out=dist --platform=linux --arch=ia32 --version=1.3.4 --icon=resources/installer/Icon.ico --app-version=0.2.0 --build-version=64-bit --version-string.CompanyName=\"Rambox\" --version-string.ProductName=\"Rambox\" --asar --prune --overwrite", |
||||
"pack:linux64": "electron-packager \"./build/production/Rambox/\" \"Rambox\" --out=dist --platform=linux --arch=x64 --version=1.3.4 --icon=resources/installer/Icon.ico --app-version=0.2.0 --build-version=64-bit --version-string.CompanyName=\"Rambox\" --version-string.ProductName=\"Rambox\" --asar --prune --overwrite", |
||||
"build": "npm run build:linux && npm run build:osx && npm run build:win", |
||||
"build:osx": "build --osx", |
||||
"build:linux": "npm run build:linux32 && npm run build:linux64", |
||||
"build:linux32": "build --linux --ia32", |
||||
"build:linux64": "build --linux --x64", |
||||
"build:win32": "build --win --ia32", |
||||
"build:win64": "build --win --x64", |
||||
"setup:osx": "npm run sencha:clean && npm run sencha:compile && npm run clean:osx && npm run pack:osx && npm run build:osx", |
||||
"setup:win": "npm run sencha:clean && npm run sencha:compile && npm run clean:win && npm run pack:win && npm run build:win", |
||||
"all:win": "npm run sencha:clean && npm run sencha:compile && npm run clean:win && npm run pack:win && npm run zip:win32 && npm run zip:win64 && npm run build:win", |
||||
"all:linux": "npm run sencha:clean && npm run sencha:compile && npm run build:linux" |
||||
}, |
||||
"build": { |
||||
"productName": "Rambox", |
||||
"appId": "com.saenzramiro.rambox", |
||||
"category": "public.app-category.productivity", |
||||
"asar": true, |
||||
"mac": { |
||||
"target": [ |
||||
"default" |
||||
], |
||||
"icon": "./resources/installer/Icon.icns" |
||||
}, |
||||
"dmg": { |
||||
"title": "Rambox", |
||||
"icon": "./resources/installer/Icon.icns", |
||||
"icon-size": 128, |
||||
"contents": [ |
||||
{ |
||||
"x": 355, |
||||
"y": 125, |
||||
"type": "link", |
||||
"path": "/Applications" |
||||
}, |
||||
{ |
||||
"x": 155, |
||||
"y": 125, |
||||
"type": "file" |
||||
} |
||||
] |
||||
}, |
||||
"win": { |
||||
"title": "Rambox", |
||||
|
||||
"target": [ |
||||
"squirrel", |
||||
"zip" |
||||
], |
||||
"loadingGif": "./resources/installer/loading.gif", |
||||
"iconUrl": "https://raw.githubusercontent.com/saenzramiro/rambox/master/resources/Icon.ico", |
||||
"icon": "./resources/Icon.ico", |
||||
"msi": false |
||||
}, |
||||
"linux": { |
||||
"target": [ |
||||
"AppImage", |
||||
"deb", |
||||
"rpm", |
||||
"zip", |
||||
"tar.gz" |
||||
], |
||||
"icon": "./resources/Icon.png" |
||||
} |
||||
}, |
||||
"directories": { |
||||
"buildResources": "resources/installer/", |
||||
"output": "dist/", |
||||
"app": "build/production/Rambox/" |
||||
}, |
||||
"devDependencies": { |
||||
"asar": "^0.12.1", |
||||
"electron-builder": "11.3.0", |
||||
"electron": "1.4.14", |
||||
"electron-squirrel-startup": "^1.0.0" |
||||
}, |
||||
"dependencies": { |
||||
"auto-launch": "4.0.0", |
||||
"firebase": "^3.0.5", |
||||
"electron-spell-check-provider": "^1.0.0", |
||||
"firebase": "^3.0.5", |
||||
"firebase-token-generator": "^2.0.0", |
||||
"mime": "^1.3.4", |
||||
"tmp": "0.0.28" |
||||
} |
||||
"firebase-token-generator": "^2.0.0", |
||||
"tmp": "0.0.28", |
||||
"mime": "^1.3.4", |
||||
"electron-is-dev": "^0.1.1", |
||||
"electron-config": "0.2.1" |
||||
} |
||||
} |
||||
|
After Width: | Height: | Size: 3.2 KiB |
After Width: | Height: | Size: 33 KiB |
@ -0,0 +1,28 @@
|
||||
/** |
||||
* This file is loaded in the service web views to provide a Rambox API. |
||||
*/ |
||||
|
||||
const { ipcRenderer } = require('electron'); |
||||
|
||||
/** |
||||
* Make the Rambox API available via a global "rambox" variable. |
||||
* |
||||
* @type {{}} |
||||
*/ |
||||
window.rambox = {}; |
||||
|
||||
/** |
||||
* Sets the unraed count of the tab. |
||||
* |
||||
* @param {*} count The unread count |
||||
*/ |
||||
window.rambox.setUnreadCount = function(count) { |
||||
ipcRenderer.sendToHost('rambox.setUnreadCount', count); |
||||
}; |
||||
|
||||
/** |
||||
* Clears the unread count. |
||||
*/ |
||||
window.rambox.clearUnreadCount = function() { |
||||
ipcRenderer.sendToHost('rambox.clearUnreadCount'); |
||||
} |
Loading…
Reference in new issue