Add sound and tray notification support
Add conversejs locale support based on navigator.language
This commit is contained in:
parent
557a65ad97
commit
8b75816a22
16
renderer.js
16
renderer.js
|
@ -6,19 +6,28 @@ const keytar = require('keytar');
|
||||||
const angular = require('angular');
|
const angular = require('angular');
|
||||||
const settings = require('electron-settings');
|
const settings = require('electron-settings');
|
||||||
|
|
||||||
|
|
||||||
|
var remote = require('electron').remote;
|
||||||
|
|
||||||
var angApp = angular.module('app', []);
|
var angApp = angular.module('app', []);
|
||||||
|
|
||||||
angApp.controller('AppController', function ($scope) {
|
angApp.controller('AppController', function ($scope) {
|
||||||
$scope.loginExist = false;
|
$scope.loginExist = false;
|
||||||
$scope.login = settings.get('login');
|
$scope.login = settings.get('login');
|
||||||
|
|
||||||
|
$scope.playAudio = function() {
|
||||||
|
var audio = new Audio('sounds/graceful.ogg');
|
||||||
|
audio.play();
|
||||||
|
};
|
||||||
|
|
||||||
if ($scope.login) {
|
if ($scope.login) {
|
||||||
|
var showEnvelope = remote.require('./main').showEnvelope;
|
||||||
$scope.loginExist = true;
|
$scope.loginExist = true;
|
||||||
$scope.boshService = settings.get('bosh');
|
$scope.boshService = settings.get('bosh');
|
||||||
var xmppService = $scope.login.split('@').pop();
|
var xmppService = $scope.login.split('@').pop();
|
||||||
var password = keytar.getPassword(xmppService, $scope.login);
|
var password = keytar.getPassword(xmppService, $scope.login);
|
||||||
password.then((result) => {
|
password.then((result) => {
|
||||||
$scope.password = result;
|
$scope.password = result;
|
||||||
|
|
||||||
converse.plugins.add('chimeVerse', {
|
converse.plugins.add('chimeVerse', {
|
||||||
initialize: function() {
|
initialize: function() {
|
||||||
var _converse = this._converse;
|
var _converse = this._converse;
|
||||||
|
@ -28,12 +37,16 @@ angApp.controller('AppController', function ($scope) {
|
||||||
]).then(function() {
|
]).then(function() {
|
||||||
_converse.on('message', function (data) {
|
_converse.on('message', function (data) {
|
||||||
//_converse.api.archive.query({'with': 'admin2@localhost'});
|
//_converse.api.archive.query({'with': 'admin2@localhost'});
|
||||||
|
$scope.playAudio();
|
||||||
|
showEnvelope();
|
||||||
console.log(data);
|
console.log(data);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
var lang = navigator.language;
|
||||||
|
|
||||||
converse.initialize({
|
converse.initialize({
|
||||||
bosh_service_url: $scope.boshService,
|
bosh_service_url: $scope.boshService,
|
||||||
view_mode: 'fullscreen',
|
view_mode: 'fullscreen',
|
||||||
|
@ -41,6 +54,7 @@ angApp.controller('AppController', function ($scope) {
|
||||||
password: $scope.password,
|
password: $scope.password,
|
||||||
auto_login: true,
|
auto_login: true,
|
||||||
whitelisted_plugins: ['chimeVerse'],
|
whitelisted_plugins: ['chimeVerse'],
|
||||||
|
i18n: lang
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Binary file not shown.
Loading…
Reference in New Issue