Applied style guide spacing.

pull/14/head
Keith Maika 10 months ago
parent 50c0978148
commit 9436bb9802
No known key found for this signature in database
GPG Key ID: F71740E8722C75F1

@ -2,9 +2,9 @@ const credentials = await import('../credentials.js');
converse.plugins.add('converse-desktop-credentials', {
initialize() {
const {_converse} = this;
const {api} = _converse;
initialize () {
const { _converse } = this;
const { api } = _converse;
api.listen.on('afterResourceBinding', () => {
if (_converse.connection.pass) {

@ -2,11 +2,11 @@
converse.plugins.add('converse-desktop-trayicon', {
initialize() {
const {_converse} = this;
initialize () {
const { _converse } = this;
let envelopeIsShowing = false;
async function hideEnvelope() {
async function hideEnvelope () {
if (envelopeIsShowing) {
await api.trayService.hideEnvelope();
envelopeIsShowing = false;

@ -1,13 +1,13 @@
/* global api */
async function addCredentials(connectionManager, login, password) {
async function addCredentials (connectionManager, login, password) {
const xmppService = login.split('@').pop()
await api.settings.set('connectionManager', connectionManager)
await api.settings.set('login', login)
await api.keytar.setPassword(xmppService, login, password)
}
async function getCredentials() {
async function getCredentials () {
const credentials = {}
credentials.login = (await api.settings.get('login')) || '';
if (credentials.login) {
@ -19,7 +19,7 @@ async function getCredentials() {
return credentials;
}
async function removeCredentials(login) {
async function removeCredentials (login) {
const xmppService = login.split('@').pop();
await api.keytar.deletePassword(xmppService, login);
await api.settings.unset('login');

@ -1,5 +1,5 @@
// Modules to control application life and create native browser window
const {app, BrowserWindow, ipcMain, shell} = require('electron')
const { app, BrowserWindow, ipcMain, shell } = require('electron')
const path = require('path');
// Keep a global reference of the window object, if you don't, the window will
@ -14,7 +14,7 @@ const settingsService = require(__dirname + '/modules/settings-service')
const isMac = process.platform === 'darwin'
const isWin = process.platform === 'win32'
function initApp() {
function initApp () {
if (!app.requestSingleInstanceLock()) {
app.quit();
}
@ -26,7 +26,7 @@ function initApp() {
}
}
function createWindow() {
function createWindow () {
// Main window options
const mainWindowOptions = {
zoomToPageWidth: true,
@ -61,7 +61,7 @@ function createWindow() {
// Handle shutdown event on Mac with minimizeOnClose
// to prevent shutdown interrupt
if (isMac) {
const {powerMonitor} = require('electron')
const { powerMonitor } = require('electron')
powerMonitor.on('shutdown', () => {
app.isQuitting = true
app.quit()
@ -87,7 +87,7 @@ function createWindow() {
shell.openExternal(details.url).catch((reason) => {
console.log(reason);
});
return {action: 'deny'};
return { action: 'deny' };
})
ipcMain.handle('settings', (e, method, ...args) => {

@ -1,7 +1,7 @@
/**
* Module for Menu functions.
*/
const {app, Menu, MenuItem} = require('electron')
const { app, Menu, MenuItem } = require('electron')
const settingsService = require(__dirname + '/../modules/settings-service')
const menuService = {}

@ -2,7 +2,7 @@
* Module for Tray functions.
*/
const { Tray } = require('electron')
const { Tray } = require('electron')
const path = require('path')
@ -13,18 +13,18 @@ const trayService = {}
const getTrayServiceIcon = (iconName = 'icon') => {
let iconImage;
if (process.platform === 'darwin' || process.platform === 'win32') {
iconImage = iconName+'-16x16'
iconImage = iconName + '-16x16'
} else {
iconImage = iconName+'-48x48'
iconImage = iconName + '-48x48'
}
return path.join(__dirname, '..','resources','images', iconImage + '.png')
return path.join(__dirname, '..', 'resources', 'images', iconImage + '.png')
}
trayService.initTray = (window) => {
const iconPath = getTrayServiceIcon()
tray = new Tray(iconPath)
tray.setToolTip('Converse Desktop')
tray.on('click', function() {
tray.on('click', function () {
window.webContents.send('open-unread-chat')
trayService.hideEnvelope()
window.show()

@ -1,42 +1,42 @@
const {ipcRenderer, contextBridge} = require('electron');
const { ipcRenderer, contextBridge } = require('electron');
const keytar = require('keytar');
contextBridge.exposeInMainWorld('api', {
settings: {
has(setting) {
has (setting) {
return ipcRenderer.invoke('settings', 'has', setting);
},
set(setting, value) {
set (setting, value) {
return ipcRenderer.invoke('settings', 'set', setting, value);
},
unset(setting) {
unset (setting) {
return ipcRenderer.invoke('settings', 'unset', setting);
},
get(setting) {
get (setting) {
return ipcRenderer.invoke('settings', 'get', setting);
}
},
trayService: {
showEnvelope() {
showEnvelope () {
return ipcRenderer.invoke('trayService', 'showEnvelope');
},
hideEnvelope() {
hideEnvelope () {
return ipcRenderer.invoke('trayService', 'hideEnvelope');
}
},
keytar: {
getPassword(service, login) {
getPassword (service, login) {
return keytar.getPassword(service, login);
},
setPassword(service, login, password) {
setPassword (service, login, password) {
return keytar.setPassword(service, login, password);
},
deletePassword(service, login) {
deletePassword (service, login) {
return keytar.deletePassword(service, login);
}
},
app: {
quit() {
quit () {
ipcRenderer.send('app-quit');
}
}

@ -6,7 +6,7 @@ const getCredentials = (await import('./app/credentials.js')).getCredentials;
let websocket_url, bosh_service_url;
const {connectionManager, login, password} = await getCredentials()
const { connectionManager, login, password } = await getCredentials()
if (connectionManager?.startsWith('ws')) {
websocket_url = connectionManager
@ -15,8 +15,8 @@ if (connectionManager?.startsWith('ws')) {
}
converse.plugins.add('converse-debug', {
initialize() {
const {_converse} = this;
initialize () {
const { _converse } = this;
window._converse = _converse;
}
});

Loading…
Cancel
Save