Skip to content

Commit

Permalink
RC: Desktop 3.18
Browse files Browse the repository at this point in the history
  • Loading branch information
bennycode committed May 29, 2020
2 parents 6fd8760 + 42e6718 commit 60b7602
Show file tree
Hide file tree
Showing 36 changed files with 1,523 additions and 1,668 deletions.
2 changes: 1 addition & 1 deletion bin/build-tools/build-cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ const platform = (commander.args[0] || '').toLowerCase();
}

default: {
logger.error(`Invalid or no platform specified.`);
logger.error('Invalid or no platform specified.');
return commander.help();
}
}
Expand Down
2 changes: 1 addition & 1 deletion bin/build-tools/lib/build-linux.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

import * as assert from 'assert';
import * as path from 'path';
import uuid from 'uuid/v4';
import {v4 as uuid} from 'uuid';

import {buildLinuxConfig} from './build-linux';

Expand Down
2 changes: 1 addition & 1 deletion bin/build-tools/lib/build-macos.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

import * as assert from 'assert';
import * as path from 'path';
import uuid from 'uuid/v4';
import {v4 as uuid} from 'uuid';

import {buildMacOSConfig} from './build-macos';

Expand Down
2 changes: 1 addition & 1 deletion bin/build-tools/lib/build-windows-installer.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

import * as assert from 'assert';
import * as path from 'path';
import uuid from 'uuid/v4';
import {v4 as uuid} from 'uuid';

import {buildWindowsInstallerConfig} from './build-windows-installer';

Expand Down
2 changes: 1 addition & 1 deletion bin/build-tools/lib/build.windows.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

import * as assert from 'assert';
import * as path from 'path';
import uuid from 'uuid/v4';
import {v4 as uuid} from 'uuid';

import {buildWindowsConfig} from './build-windows';

Expand Down
2 changes: 1 addition & 1 deletion bin/build-tools/lib/commonConfig.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import * as assert from 'assert';
import * as fs from 'fs-extra';
import * as os from 'os';
import * as path from 'path';
import uuid from 'uuid/v4';
import {v4 as uuid} from 'uuid';

import {getCommonConfig} from './commonConfig';

Expand Down
2 changes: 1 addition & 1 deletion electron/renderer/src/actions/__tests__/actions.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
*
*/

import uuid from 'uuid/v4';
import {v4 as uuid} from 'uuid';

import {ActionType, addAccount, deleteAccount, switchAccount, updateAccount, updateAccountBadge} from '../';

Expand Down
30 changes: 16 additions & 14 deletions electron/renderer/src/actions/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@
/* eslint-disable no-console */

import {v4 as uuid} from 'uuid';
import * as Joi from '@hapi/joi';

import {config} from '../../../dist/settings/config';
import {verifyObjectProperties} from '../lib/verifyObjectProperties';
import {accountAction} from './AccountAction';
import {AccountSelector} from '../selector/AccountSelector';

Expand Down Expand Up @@ -129,21 +129,23 @@ export const addAccountWithSession = () => {
};

export const updateAccountData = (id, data) => {
const accountDataSchema = Joi.object({
accentID: Joi.number(),
name: Joi.string(),
picture: Joi.string().optional(),
teamID: Joi.string().optional(),
teamRole: Joi.string(),
userID: Joi.string(),
webappUrl: Joi.string(),
});

return dispatch => {
const validatedAccountData = verifyObjectProperties(data, {
accentID: 'Number',
name: 'String',
picture: 'String',
teamID: 'String',
teamRole: 'String',
userID: 'String',
webappUrl: 'String',
});

if (validatedAccountData) {
dispatch(updateAccount(id, validatedAccountData));
const validatedAccountData = accountDataSchema.validate(data);

if (!validatedAccountData.error) {
dispatch(updateAccount(id, validatedAccountData.value));
} else {
console.warn('Got invalid account data:', data);
console.warn('Got invalid account data:', validatedAccountData.error);
}
};
};
Expand Down
2 changes: 1 addition & 1 deletion electron/renderer/src/components/Webview.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ const Webview = ({
<webview
className={`Webview${account.visible ? '' : ' hide'}`}
data-accountid={account.id}
visible={!!account.visible}
visible={String(!!account.visible)}
src={url}
partition={account.sessionID ? `persist:${account.sessionID}` : ''}
webpreferences="backgroundThrottling=false"
Expand Down
19 changes: 19 additions & 0 deletions electron/renderer/src/lib/__mocks__/localStorage.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,22 @@
/*
* Wire
* Copyright (C) 2020 Wire Swiss GmbH
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see http://www.gnu.org/licenses/.
*
*/

export class LocalStorageMock {
constructor() {
this.store = {};
Expand Down
105 changes: 0 additions & 105 deletions electron/renderer/src/lib/__tests__/verifyObjectProperties.spec.js

This file was deleted.

43 changes: 0 additions & 43 deletions electron/renderer/src/lib/verifyObjectProperties.js

This file was deleted.

5 changes: 5 additions & 0 deletions electron/renderer/src/reducers/accountReducer.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,11 @@ export default (state = [createAccount()], action) => {
if (account.webappUrl && !action.data.webappUrl) {
delete action.data.webappUrl;
}
// Note: If the current account has a picture but the update does not
// we remove the picture.
if (account.picture && !action.data.picture) {
delete account.picture;
}
return isMatchingAccount ? {...account, ...action.data, isAdding: false, ssoCode: undefined} : account;
});
}
Expand Down
19 changes: 19 additions & 0 deletions electron/renderer/src/selector/AccountSelector.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,22 @@
/*
* Wire
* Copyright (C) 2020 Wire Swiss GmbH
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see http://www.gnu.org/licenses/.
*
*/

import {config as CONFIG} from '../../../dist/settings/config';

export class AccountSelector {
Expand Down
19 changes: 19 additions & 0 deletions electron/renderer/src/selector/ContextMenuSelector.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,22 @@
/*
* Wire
* Copyright (C) 2020 Wire Swiss GmbH
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see http://www.gnu.org/licenses/.
*
*/

export class ContextMenuSelector {
static getContextMenuState = state => state.contextMenuState;
static isEditAccountMenuVisible = state => ContextMenuSelector.getContextMenuState(state).isEditAccountMenuVisible;
Expand Down
2 changes: 1 addition & 1 deletion electron/src/auth/ProxyAuth.test.main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

import * as assert from 'assert';

import ProxyAuth from './ProxyAuth';
import * as ProxyAuth from './ProxyAuth';
import {Protocol} from 'get-proxy-settings';

describe('ProxyAuth', () => {
Expand Down
Loading

0 comments on commit 60b7602

Please sign in to comment.