Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge TS context isolation branch onto Typescript master branch #598

Merged
merged 77 commits into from
Mar 19, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
77 commits
Select commit Hold shift + click to select a range
8724d90
Typescript 🎉
KiranNiranjan Oct 5, 2018
446c7d9
Typescript 🎉 (logger, get-guid, string-format and throttle)
KiranNiranjan Oct 6, 2018
257a122
Refactor typescript code
Oct 26, 2018
c2830f7
consolidate all the utility functions to one file
Oct 26, 2018
4852c9e
Typescript:
KiranNiranjan Oct 29, 2018
f0e55ed
Typescript: Fix logger formatting
KiranNiranjan Oct 29, 2018
e0d52d7
Typescript: Add support for react
KiranNiranjan Oct 29, 2018
86bfb90
Typescript: Completed about app
KiranNiranjan Oct 29, 2018
abbe0b5
refactor protocol handler feature
Oct 29, 2018
ed81976
Typescript: Completed about app
KiranNiranjan Nov 5, 2018
c34bbc0
Typescript: Completed about app
KiranNiranjan Nov 15, 2018
2fafa93
Typescript - Fix issues with about-app and add login to convert less …
KiranNiranjan Nov 16, 2018
e7b0a71
Typescript - Fix loading screen
KiranNiranjan Nov 16, 2018
a9f3c49
Typescript - Add custom title bar
KiranNiranjan Nov 20, 2018
4a7e25f
Typescript - Add method to get locale
KiranNiranjan Nov 27, 2018
b4895bf
Typescript - Add logic to clean up old logs
KiranNiranjan Nov 30, 2018
39cf1dc
Typescript - Add set badge count api
KiranNiranjan Dec 1, 2018
6f45742
Typescript - Complete application menu
KiranNiranjan Dec 3, 2018
900f697
Typescript - Add logic to translate menu items
KiranNiranjan Dec 4, 2018
b921491
Typescript - freeze window.ssf api
KiranNiranjan Dec 4, 2018
419aece
Typescript - Handle popup menu on alt key press
KiranNiranjan Dec 4, 2018
301f5a8
Typescript - Completed activity detection
KiranNiranjan Dec 4, 2018
e371c40
Typescript - Completed screen snippet
KiranNiranjan Dec 5, 2018
c9ae152
Typescript - Add login to close screen snippet
KiranNiranjan Dec 6, 2018
959e97f
Typescript - Completed window actions & snackbar, Updated i18n module
KiranNiranjan Dec 8, 2018
26f14a1
Typescript - Completed native crypto implementation & fixed bugs
KiranNiranjan Dec 9, 2018
5c6bda9
Typescript - Completed Desktop capturer & screen picker implementation
KiranNiranjan Dec 19, 2018
599aaa9
Typescript - Optimize window actions
KiranNiranjan Dec 19, 2018
70dffaf
Typescript - Add support for child window
KiranNiranjan Dec 26, 2018
402bf06
Typescript - fix pop url validation issue & browserify preload
KiranNiranjan Dec 28, 2018
b8924d7
Typescript - Completed context menu implementation and fixed screen s…
KiranNiranjan Dec 28, 2018
94d9780
Typescript - Completed screen sharing indicator and fixed i18n usage …
KiranNiranjan Jan 2, 2019
e782e83
Typescript - Fix i18n locale setting issue
KiranNiranjan Jan 3, 2019
3f4c2b2
Typescript - Completed download manager
KiranNiranjan Jan 4, 2019
c3120d8
Typescript - Completed Basic auth
KiranNiranjan Jan 7, 2019
d9bf3cf
Typescript - Network connectivity dialog
KiranNiranjan Jan 7, 2019
6d1ee26
Typescript - Handle certificate error
KiranNiranjan Jan 7, 2019
f96c609
Typescript - Add translation for certificate error dialog buttons
KiranNiranjan Jan 7, 2019
f5b3f36
Typescript - Add gulp tasks to compile less, typescript and copy files
KiranNiranjan Jan 8, 2019
4f3a90f
Typescript - Fix some issues with custom title bar, loading screen & …
KiranNiranjan Jan 8, 2019
165aa13
Typescript - Remove ES2015 lib
KiranNiranjan Jan 8, 2019
840ccd9
:typescript: - Do not inject custom title bar for mac
KiranNiranjan Jan 16, 2019
bd66296
:typescript: - Fix screen sharing indicator text and format string
KiranNiranjan Jan 16, 2019
9a3fa7b
Typescript - Fix esc to full screen
KiranNiranjan Jan 16, 2019
ce78261
Typescript - handle multiple/single instance of the client and add sa…
KiranNiranjan Jan 16, 2019
b553f5f
Typescript - Refactor code base
KiranNiranjan Jan 16, 2019
f38bd1f
Typescript - Optimize window validation and fix screen picker issue
KiranNiranjan Jan 18, 2019
c5ad6a3
Typescript - Optimize protocol handler
KiranNiranjan Jan 21, 2019
3eea5b6
typescript: logger unit test
Jan 22, 2019
669d874
typescript: activityDetection unit test (#560)
Feb 4, 2019
71f8cd5
ELECTRON-1022 - Create app bridge that communicates between renderer …
KiranNiranjan Feb 5, 2019
89888be
ELECTRON-1024 - Add support for screen share and screen sharing indic…
KiranNiranjan Feb 11, 2019
e625ce9
config unit test (#566)
Feb 12, 2019
3fe9dc0
ELECTRON-1024 - Fix screen sharing indicator close issue
KiranNiranjan Feb 15, 2019
9980978
ELECTRON-1022 - Bump Symphony version to 5.0.0 (1.55)
KiranNiranjan Feb 15, 2019
83b6a6c
fixing jest coverage output report (#575)
Mar 1, 2019
cab3576
protocol handle unit test (#576)
Mar 1, 2019
6b35f48
Typescript - Remove unwanted checks in protocol handler and add test …
KiranNiranjan Mar 1, 2019
315c211
added more tests to increase coverage to 100 for protocol handler
Mar 1, 2019
d01dd81
Typescript download manager unit test (#579)
Mar 6, 2019
16f33e7
Typescript - Completed notification workflow
KiranNiranjan Mar 6, 2019
c5741df
Typescript - Fix notification styles
KiranNiranjan Mar 8, 2019
d1e0daf
fixing Compiler error: Generic type ReactElement<P, T> (#583)
Mar 11, 2019
95ca435
fix app path on windows (#580)
Mar 11, 2019
f924d2d
basic auth unit test (#582)
Mar 13, 2019
c71e448
screen picker unit test (#587)
Mar 13, 2019
3bf3c00
loading screen unit test (#588)
Mar 13, 2019
52253af
about app unit test
Mar 6, 2019
45082b3
improving snapshot using snapshotSerializers to remove unnecessary th…
Mar 15, 2019
477f432
Typescript - Enforce braces for if/for/do/while statements.
KiranNiranjan Mar 19, 2019
821fbce
Typescript - Fix Lint issues and Unit test
KiranNiranjan Mar 19, 2019
daec925
Typescript - Enable eofline (Ensure the file ends with a newline.)
KiranNiranjan Mar 19, 2019
a236769
Typescript - Update logger logic and format
KiranNiranjan Mar 19, 2019
2747ed9
Typescript - Provide option for user to set custom log path
KiranNiranjan Mar 19, 2019
6f9c315
Typescript - Fix eofline in css files
KiranNiranjan Mar 19, 2019
9da3dab
Merge remote-tracking branch 'upstream/typescript-2' into TS-ELECTRON…
KiranNiranjan Mar 19, 2019
39efa8c
Typescript - ignore spec from compiling and remove unwanted rebuild c…
KiranNiranjan Mar 19, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 8 additions & 17 deletions demo/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,9 @@ <h1>Symphony Electron API Demo</h1>

num++;

var notf = new ssf.Notification(title, {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we retain this till we completely move to context isolation?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No. In this branch, ssf does not exist

var notf = {
id: num,
title,
body: (body + ' num=' + num + ' tag=' + tag),
image: imageUrl,
flash: shouldFlash,
Expand All @@ -142,24 +144,11 @@ <h1>Symphony Electron API Demo</h1>
hello: 'hello word'
},
tag: tag,
company: company
});

notf.addEventListener('click', onclick);
function onclick(event) {
event.target.close();
alert('notification clicked: ' + event.target.data.hello);
}

notf.addEventListener('close', onclose);
function onclose() {
alert('notification closed');
company: company,
method: 'notification',
};

notf.addEventListener('error', onerror);
function onerror(event) {
alert('error=' + event.result);
};
window.postMessage({ method: 'notification', data: notf }, '*');
});

var badgeCount = 0;
Expand Down Expand Up @@ -292,5 +281,7 @@ <h1>Symphony Electron API Demo</h1>
document.location.reload();
});

window.addEventListener('message', (event) => console.log(event));

</script>
</html>
4 changes: 2 additions & 2 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ gulp.task('clean', function() {
});

gulp.task('compile', function() {
return gulp.src(['src/**/*.ts'])
return gulp.src(['src/**/*.ts', 'src/**/*.tsx'])
.pipe(tsc({ project: './tsconfig.json' }))
.pipe(gulp.dest('lib/'))
});
Expand All @@ -35,4 +35,4 @@ gulp.task('copy', function () {
}).pipe(gulp.dest('lib/src'))
});

gulp.task('build', gulp.series('clean', 'compile', 'less', 'copy'));
gulp.task('build', gulp.series('clean', 'compile', 'less', 'copy'));
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"name": "Symphony",
"productName": "Symphony",
"version": "4.4.2",
"clientVersion": "1.54",
"version": "5.0.0",
"clientVersion": "1.55",
"buildNumber": "0",
"description": "Symphony desktop app (Foundation ODP)",
"author": "Symphony",
Expand All @@ -16,7 +16,7 @@
"browserify-preload": "browserify -o lib/src/renderer/_preload-main.js -x electron --insert-global-vars=__filename,__dirname lib/src/renderer/preload-main.js",
"rebuild": "electron-rebuild -f",
"dev": "npm run prebuild && cross-env ELECTRON_DEV=true electron .",
"test": "npm run lint && npm rebuild --build-from-source && cross-env ELECTRON_QA=true jest --config jest.unit.config.json --runInBand && npm run rebuild",
"test": "npm run lint && cross-env ELECTRON_QA=true jest --config jest.unit.config.json --runInBand",
"spectron-test": "npm run lint && npm rebuild --build-from-source robotjs && cross-env ELECTRON_QA=true jest --config jest.spectron.config.json --runInBand --detectOpenHandles",
"demo-win": "npm run prebuild && cross-env ELECTRON_DEV=true electron . --url=file:///demo/index.html",
"demo-mac": "npm run prebuild && cross-env ELECTRON_DEV=true electron . --url=file://$(pwd)/demo/index.html",
Expand Down
2 changes: 2 additions & 0 deletions spec/screenSharingIndicator.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,11 @@ describe('screen sharing indicator', () => {
const closeIpcRendererMock = {
cmd: 'close-window',
windowType: 'screen-sharing-indicator',
winKey: 'id-123',
};
const spy = jest.spyOn(ipcRenderer, sendEventLabel);
const wrapper = shallow(React.createElement(ScreenSharingIndicator));
wrapper.setState({ streamId: 'id-123' });
wrapper.find(customSelector).simulate('click');
expect(spy).lastCalledWith(symphonyAPIEventLabel, closeIpcRendererMock);
});
Expand Down
6 changes: 4 additions & 2 deletions src/app/activity-detection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,9 @@ class ActivityDetection {
const idleTimeInMillis = idleTime * 1000;
if (idleTimeInMillis < this.idleThreshold) {
this.sendActivity(idleTimeInMillis);
if (this.timer) clearInterval(this.timer);
if (this.timer) {
clearInterval(this.timer);
}
this.timer = undefined;
logger.info(`activity-detection: activity occurred`);
return;
Expand Down Expand Up @@ -78,4 +80,4 @@ class ActivityDetection {

const activityDetection = new ActivityDetection();

export { activityDetection };
export { activityDetection };
2 changes: 1 addition & 1 deletion src/app/app-cache-handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ export const cleanUpAppCache = async (): Promise<void> => {
*/
export const createAppCacheFile = (): void => {
fs.writeFileSync(cacheCheckFilePath, '');
};
};
2 changes: 1 addition & 1 deletion src/app/auto-launch-controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,4 +111,4 @@ const autoLaunchInstance = new AutoLaunchController(props);

export {
autoLaunchInstance,
};
};
14 changes: 10 additions & 4 deletions src/app/child-window-handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,12 @@ const getParsedUrl = (configURL: string): Url => {
export const handleChildWindow = (webContents: WebContents): void => {
const childWindow = (event, newWinUrl, frameName, disposition, newWinOptions): void => {
const mainWindow = windowHandler.getMainWindow();
if (!mainWindow || mainWindow.isDestroyed()) return;
if (!windowHandler.url) return;
if (!mainWindow || mainWindow.isDestroyed()) {
return;
}
if (!windowHandler.url) {
return;
}

if (!newWinOptions.webPreferences) {
newWinOptions.webPreferences = {};
Expand Down Expand Up @@ -104,7 +108,9 @@ export const handleChildWindow = (webContents: WebContents): void => {

childWebContents.once('did-finish-load', async () => {
const browserWin: ICustomBrowserWindow = BrowserWindow.fromWebContents(childWebContents) as ICustomBrowserWindow;
if (!browserWin) return;
if (!browserWin) {
return;
}
windowHandler.addWindow(newWinKey, browserWin);
browserWin.webContents.send('page-load', { isWindowsOS });
// Inserts css on to the window
Expand All @@ -129,4 +135,4 @@ export const handleChildWindow = (webContents: WebContents): void => {
}
};
webContents.on('new-window', childWindow);
};
};
2 changes: 1 addition & 1 deletion src/app/chrome-flags.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,4 +63,4 @@ export const setChromeFlags = () => {
}
}
}
};
};
2 changes: 1 addition & 1 deletion src/app/config-handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -224,4 +224,4 @@ const config = new Config();

export {
config,
};
};
4 changes: 2 additions & 2 deletions src/app/crypto-handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { logger } from '../common/logger';
const TAG_LENGTH = 16;
const arch = process.arch === 'ia32';
const winLibraryPath = isDevEnv ? path.join(__dirname, '..', '..', 'library') : path.join(execPath, 'library');
const macLibraryPath = isDevEnv ? path.join(__dirname, '..', '..', 'library') : path.join(execPath, '..', 'library');
const macLibraryPath = isDevEnv ? path.join(__dirname, '..', '..', '..', 'library') : path.join(execPath, '..', 'library');

const cryptoLibPath = isMac ?
path.join(macLibraryPath, 'cryptoLib.dylib') :
Expand Down Expand Up @@ -133,4 +133,4 @@ class CryptoLibrary implements ICryptoLib {

const cryptoLibrary = new CryptoLibrary();

export { cryptoLibrary };
export { cryptoLibrary };
10 changes: 7 additions & 3 deletions src/app/dialog-handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,12 @@ electron.app.on('certificate-error', (event, webContents, url, error, _certifica
*/
export const showLoadFailure = (browserWindow: Electron.BrowserWindow, url: string, errorDesc: string, errorCode: number, retryCallback: () => void, showDialog: boolean): void => {
let message = url ? `${i18n.t('Error loading URL')()}:\n${url}` : i18n.t('Error loading window')();
if (errorDesc) message += `\n\n${errorDesc}`;
if (errorCode) message += `\n\nError Code: ${errorCode}`;
if (errorDesc) {
message += `\n\n${errorDesc}`;
}
if (errorCode) {
message += `\n\nError Code: ${errorCode}`;
}

// async handle of user input
const response = (buttonId: number): void => {
Expand Down Expand Up @@ -132,4 +136,4 @@ export const showLoadFailure = (browserWindow: Electron.BrowserWindow, url: stri
export const showNetworkConnectivityError = (browserWindow: Electron.BrowserWindow, url: string = '', retryCallback: () => void): void => {
const errorDesc = i18n.t('Network connectivity has been lost. Check your internet connection.')();
showLoadFailure(browserWindow, url, errorDesc, 0, retryCallback, true);
};
};
27 changes: 7 additions & 20 deletions src/app/main-api-handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,9 @@ ipcMain.on(apiName.symphonyApi, (event: Electron.Event, arg: IApiArgs) => {
// validates the user bring to front config and activates the wrapper
if (typeof arg.reason === 'string' && arg.reason === 'notification') {
const shouldBringToFront = config.getConfigFields([ 'bringToFront' ]);
if (shouldBringToFront) activate(arg.windowName, false);
if (shouldBringToFront) {
activate(arg.windowName, false);
}
}
break;
case apiCmds.openScreenPickerWindow:
Expand All @@ -95,21 +97,6 @@ ipcMain.on(apiName.symphonyApi, (event: Electron.Event, arg: IApiArgs) => {
}
break;
}
/*case ApiCmds.optimizeMemoryConsumption:
if (typeof arg.memory === 'object'
&& typeof arg.cpuUsage === 'object'
&& typeof arg.memory.workingSetSize === 'number') {
setPreloadMemoryInfo(arg.memory, arg.cpuUsage);
}
break;
case ApiCmds.optimizeMemoryRegister:
setPreloadWindow(event.sender);
break;
case ApiCmds.setIsInMeeting:
if (typeof arg.isInMeeting === 'boolean') {
setIsInMeeting(arg.isInMeeting);
}
break;*/
case apiCmds.setLocale:
if (typeof arg.locale === 'string') {
updateLocale(arg.locale as LocaleType);
Expand All @@ -124,12 +111,12 @@ ipcMain.on(apiName.symphonyApi, (event: Electron.Event, arg: IApiArgs) => {
screenSnippet.capture(event.sender);
break;
case apiCmds.closeWindow:
windowHandler.closeWindow(arg.windowType);
windowHandler.closeWindow(arg.windowType, arg.winKey);
break;
case apiCmds.openScreenSharingIndicator:
const { displayId, id } = arg;
if (typeof displayId === 'string' && typeof id === 'number') {
windowHandler.createScreenSharingIndicatorWindow(event.sender, displayId, id);
const { displayId, id, streamId } = arg;
if (typeof displayId === 'string' && typeof id === 'number' && typeof streamId === 'string') {
windowHandler.createScreenSharingIndicatorWindow(event.sender, displayId, id, streamId);
}
break;
case apiCmds.downloadManagerAction:
Expand Down
6 changes: 4 additions & 2 deletions src/app/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,9 @@ if (!allowMultiInstance) {
// Someone tried to run a second instance, we should focus our window.
const mainWindow = windowHandler.getMainWindow();
if (mainWindow && !mainWindow.isDestroyed()) {
if (isMac) return mainWindow.show();
if (isMac) {
return mainWindow.show();
}
if (mainWindow.isMinimized()) {
mainWindow.restore();
}
Expand Down Expand Up @@ -117,4 +119,4 @@ app.on('activate', () => {
*
* This event is emitted only on macOS at this moment
*/
app.on('open-url', (_event, url) => protocolHandler.sendProtocol(url));
app.on('open-url', (_event, url) => protocolHandler.sendProtocol(url));
2 changes: 1 addition & 1 deletion src/app/protocol-handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,4 +69,4 @@ class ProtocolHandler {

const protocolHandler = new ProtocolHandler();

export { protocolHandler };
export { protocolHandler };
2 changes: 1 addition & 1 deletion src/app/reports-handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,4 +131,4 @@ export const exportCrashDumps = (): void => {
});
}
});
};
};
10 changes: 7 additions & 3 deletions src/app/screen-snippet-handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,9 @@ class ScreenSnippet {
updateAlwaysOnTop(false, false);
}
// only allow one screen capture at a time.
if (this.child) this.child.kill();
if (this.child) {
this.child.kill();
}
try {
await this.execCmd(this.captureUtil, this.captureUtilArgs);
const { message, data, type }: IScreenSnippet = await this.convertFileToData();
Expand Down Expand Up @@ -86,7 +88,9 @@ class ScreenSnippet {
private execCmd(captureUtil: string, captureUtilArgs: ReadonlyArray<string>): Promise<ChildProcess> {
return new Promise<ChildProcess>((resolve, reject) => {
return this.child = execFile(captureUtil, captureUtilArgs, (error: ExecException | null) => {
if (this.isAlwaysOnTop) updateAlwaysOnTop(true, false);
if (this.isAlwaysOnTop) {
updateAlwaysOnTop(true, false);
}
if (error && error.killed) {
// processs was killed, just resolve with no data.
return reject(error);
Expand Down Expand Up @@ -140,4 +144,4 @@ class ScreenSnippet {

const screenSnippet = new ScreenSnippet();

export { screenSnippet };
export { screenSnippet };
2 changes: 1 addition & 1 deletion src/app/spell-check-handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,4 +99,4 @@ export class SpellChecker {
}
return menu;
}
}
}
Loading