Skip to content

Commit

Permalink
Applied style guide spacing.
Browse files Browse the repository at this point in the history
  • Loading branch information
kicken committed Mar 29, 2022
1 parent 50c0978 commit 9436bb9
Show file tree
Hide file tree
Showing 8 changed files with 34 additions and 34 deletions.
6 changes: 3 additions & 3 deletions app/converse-plugins/desktop-credentials.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
6 changes: 3 additions & 3 deletions app/converse-plugins/desktop-trayicon.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
6 changes: 3 additions & 3 deletions app/credentials.js
Original file line number Diff line number Diff line change
@@ -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) {
Expand All @@ -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');
Expand Down
10 changes: 5 additions & 5 deletions main.js
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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();
}
Expand All @@ -26,7 +26,7 @@ function initApp() {
}
}

function createWindow() {
function createWindow () {
// Main window options
const mainWindowOptions = {
zoomToPageWidth: true,
Expand Down Expand Up @@ -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()
Expand All @@ -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) => {
Expand Down
2 changes: 1 addition & 1 deletion modules/menu-service.js
Original file line number Diff line number Diff line change
@@ -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 = {}
Expand Down
10 changes: 5 additions & 5 deletions modules/tray-service.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Module for Tray functions.
*/

const { Tray } = require('electron')
const { Tray } = require('electron')

const path = require('path')

Expand All @@ -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()
Expand Down
22 changes: 11 additions & 11 deletions preload.js
Original file line number Diff line number Diff line change
@@ -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');
}
}
Expand Down
6 changes: 3 additions & 3 deletions setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -15,8 +15,8 @@ if (connectionManager?.startsWith('ws')) {
}

converse.plugins.add('converse-debug', {
initialize() {
const {_converse} = this;
initialize () {
const { _converse } = this;
window._converse = _converse;
}
});
Expand Down

0 comments on commit 9436bb9

Please sign in to comment.