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

Conversation

KiranNiranjan
Copy link
Member

@KiranNiranjan KiranNiranjan commented Mar 18, 2019

Merge Typescript context isolation branch onto Typescript master branch

Unit test result

Screenshot 2019-03-19 at 2 42 09 PM

Copy link
Contributor

@VishwasShashidhar VishwasShashidhar left a comment

Choose a reason for hiding this comment

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

Please handle the below points

  1. Surround all if statements with braces.
  2. Update the logger code to include rotation based on date & remove max size
  3. Add comments where the logic is complex

@@ -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

demo/index.html Outdated

notf.addEventListener('click', onclick);
/*notf.addEventListener('click', onclick);
Copy link
Contributor

Choose a reason for hiding this comment

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

remove commented code

if (this.screenSharingIndicatorWindow
&& this.windowExists(this.screenSharingIndicatorWindow)) this.screenSharingIndicatorWindow.close();
if (winKey) {
const browserWindow = this.windows[ winKey ];
Copy link
Contributor

Choose a reason for hiding this comment

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

remove extra spaces inside the array

Copy link
Member Author

Choose a reason for hiding this comment

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

This is TS recommended

displayId.includes(d.id.toString()))[ 0 ]) || electron.screen.getPrimaryDisplay();

const screenRect = indicatorScreen.workArea;
let opts = { ...WindowHandler.getScreenSharingIndicatorOpts(), ...{ winKey: streamId } };
Copy link
Contributor

Choose a reason for hiding this comment

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

can you add a comment above explaining what this logic is about

* @param object
*/
public animate(object) {
object.func.apply(null, object.args)
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 not use async await?

*/
public setWindowPosition(window: Electron.BrowserWindow, x: number, y: number) {
if (window && !window.isDestroyed()) {
window.setPosition(parseInt(String(x), 10), parseInt(String(y), 10));
Copy link
Contributor

Choose a reason for hiding this comment

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

what happens if parseInt fails? wouldn't it be better to have defaults?

*/
public setupNotificationPosition() {
// This feature only applies to windows
if (!isMac) {
Copy link
Contributor

Choose a reason for hiding this comment

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

let's invert the condition. If it is mac, return.

constructor(opts) {
super(opts);
ipcMain.on('close-notification', (_event, windowId) => {
this.hideNotification(windowId);
Copy link
Contributor

Choose a reason for hiding this comment

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

does this destroy the browser window or just hide it?

Copy link
Member Author

Choose a reason for hiding this comment

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

This just hides the browser window

Copy link
Contributor

Choose a reason for hiding this comment

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

But won't that be waste of resources. What happens if we close it?

Copy link
Member Author

Choose a reason for hiding this comment

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

Approx 200mb will be reserved based on the display width for about a min. Without this, every notification will be rendered a fresh which looks delayed

Copy link
Contributor

Choose a reason for hiding this comment

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

Understood, thanks for the explanation.

Copy link

@vrbsm vrbsm left a comment

Choose a reason for hiding this comment

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

Please, fix this variable in /.../SymphonyElectron/spec/screenSharingIndicator.spec.ts

 wrapper.setState({ streamId: 'id-123' }); // add this
 const closeIpcRendererMock = {
            cmd: 'close-window',
            windowType: 'screen-sharing-indicator',
            winKey: 'id-123', // add this
        };

this unit test is failing: 'should call close correctly'

}

export type LogLevel = 'error' | 'warn' | 'info' | 'verbose' | 'debug' | 'silly';
Copy link

Choose a reason for hiding this comment

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

could you insert a newline at end file ?

* @param window {BrowserWindow}
* @return boolean
*/
export const windowExists = (window: BrowserWindow): boolean => !!window && typeof window.isDestroyed === 'function' && !window.isDestroyed();
Copy link

Choose a reason for hiding this comment

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

could you insert a newline at end file ?

window.postMessage({ method, data }, this.origin);
}

}
Copy link

Choose a reason for hiding this comment

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

could you insert a newline at end file ?

private updateState(_event, data): void {
this.setState(data as IState);
}
}
Copy link

Choose a reason for hiding this comment

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

could you insert a newline at end file ?

this.nextInsertPos.y = this.settings.firstPos.y;
}

}
Copy link

Choose a reason for hiding this comment

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

could you insert a newline at end file ?

opacity: 0.6;
width: 43px;
content: var(--logo-bg);
}
Copy link

Choose a reason for hiding this comment

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

could you insert a newline at end file ?

@KiranNiranjan
Copy link
Member Author

@VishwasShashidhar @vrbsm I've updated PR as per the changes. Please review. Thanks 🙂

…-1022

# Conflicts:
#	gulpfile.js
#	spec/screenSharingIndicator.spec.ts
#	src/app/activity-detection.ts
#	src/app/app-cache-handler.ts
#	src/app/auto-launch-controller.ts
#	src/app/child-window-handler.ts
#	src/app/chrome-flags.ts
#	src/app/config-handler.ts
#	src/app/crypto-handler.ts
#	src/app/dialog-handler.ts
#	src/app/main-api-handler.ts
#	src/app/main.ts
#	src/app/protocol-handler.ts
#	src/app/reports-handler.ts
#	src/app/screen-snippet-handler.ts
#	src/app/spell-check-handler.ts
#	src/app/window-actions.ts
#	src/app/window-handler.ts
#	src/app/window-utils.ts
#	src/common/api-interface.ts
#	src/common/env.ts
#	src/common/i18n-preload.ts
#	src/common/i18n.ts
#	src/common/logger.ts
#	src/common/utils.ts
#	src/renderer/components/about-app.tsx
#	src/renderer/components/download-manager.tsx
#	src/renderer/components/loading-screen.tsx
#	src/renderer/components/more-info.tsx
#	src/renderer/components/screen-picker.tsx
#	src/renderer/components/screen-sharing-indicator.tsx
#	src/renderer/components/snack-bar.tsx
#	src/renderer/desktop-capturer.ts
#	src/renderer/preload-component.ts
#	src/renderer/preload-main.ts
#	src/renderer/ssf-api.ts
#	src/renderer/styles/about-app.less
#	src/renderer/styles/screen-sharing-indicator.less
#	tslint.json
@VishwasShashidhar VishwasShashidhar self-assigned this Mar 19, 2019
@VishwasShashidhar VishwasShashidhar merged commit 4d739a4 into finos:typescript-2 Mar 19, 2019
KiranNiranjan added a commit to KiranNiranjan/SymphonyElectron that referenced this pull request Mar 28, 2019
…s#598)

* Typescript 🎉

* Typescript 🎉 (logger, get-guid, string-format and throttle)

* Refactor typescript code

* consolidate all the utility functions to one file

* refactor protocol handler feature

* Typescript:

Add code documentation
Add pre-commit hooks

* Typescript: Fix logger formatting

* Typescript: Add support for react

* Typescript: Completed about app

* Typescript: Completed about app

* Typescript: Completed about app

* Typescript - Fix issues with about-app and add login to convert less to css

* Typescript - Fix loading screen

* Typescript - Add custom title bar

* Typescript - Add method to get locale

* Typescript - Add logic to clean up old logs

* Typescript - Add set badge count api

* Typescript - Complete application menu

* Typescript - Add logic to translate menu items

* Typescript - freeze window.ssf api

* Typescript - Handle popup menu on alt key press

* Typescript - Completed activity detection

* Typescript - Completed screen snippet

* Typescript - Add login to close screen snippet

* Typescript - Completed window actions & snackbar, Updated i18n module

* Typescript - Completed native crypto implementation & fixed bugs

* Typescript - Completed Desktop capturer & screen picker implementation

* Typescript - Optimize window actions

* Typescript - Add support for child window

* Typescript - fix pop url validation issue & browserify preload

* Typescript - Completed context menu implementation and fixed screen snippet

* Typescript - Completed screen sharing indicator and fixed i18n usage issue

* Typescript - Fix i18n locale setting issue

* Typescript - Completed download manager

* Typescript - Completed Basic auth

* Typescript - Network connectivity dialog

* Typescript - Handle certificate error

* Typescript - Add translation for certificate error dialog buttons

* Typescript - Add gulp tasks to compile less, typescript and copy files

* Typescript - Fix some issues with custom title bar, loading screen & screen snippet

* Typescript - Remove ES2015 lib

* :typescript: - Do not inject custom title bar for mac

* :typescript: - Fix screen sharing indicator text and format string

* Typescript - Fix esc to full screen

* Typescript - handle multiple/single instance of the client and add safety checks

* Typescript - Refactor code base

* Typescript - Optimize window validation and fix screen picker issue

* Typescript - Optimize protocol handler

* typescript: logger unit test

* typescript: activityDetection unit test (finos#560)

* ELECTRON-1022 - Create app bridge that communicates between renderer and preload via postMessage

* ELECTRON-1024 - Add support for screen share and screen sharing indicator

* config unit test (finos#566)

* ELECTRON-1024 - Fix screen sharing indicator close issue

* ELECTRON-1022 - Bump Symphony version to 5.0.0 (1.55)

* fixing jest coverage output report (finos#575)

* protocol handle unit test (finos#576)

* Typescript - Remove unwanted checks in protocol handler and add test cases

* added more tests to increase coverage to 100 for protocol handler

* Typescript download manager unit test (finos#579)

* adding enzyme

* download manager unit test

* Typescript - Completed notification workflow

* about app unit test

* Typescript - Fix notification styles

* fixing Compiler error: Generic type ReactElement<P, T> (finos#583)

* fix app path on windows (finos#580)

* basic auth unit test (finos#582)

* screen picker unit test (finos#587)

* screen picker unit test

* screen sharing indicator unit test

* loading screen unit test (finos#588)

* improving snapshot using snapshotSerializers to remove unnecessary things (finos#596)

* Typescript - Enforce braces for if/for/do/while statements.

* Typescript - Fix Lint issues and Unit test

* Typescript - Enable eofline (Ensure the file ends with a newline.)

* Typescript - Update logger logic and format

* Typescript - Provide option for user to set custom log path

* Typescript - Fix eofline in css files

* Typescript - ignore spec from compiling and remove unwanted rebuild command
KiranNiranjan added a commit that referenced this pull request Apr 2, 2019
* Typescript 🎉

* Typescript 🎉 (logger, get-guid, string-format and throttle)

* Refactor typescript code

* consolidate all the utility functions to one file

* refactor protocol handler feature

* Typescript:

Add code documentation
Add pre-commit hooks

* Typescript: Fix logger formatting

* Typescript: Add support for react

* Typescript: Completed about app

* Typescript: Completed about app

* Typescript: Completed about app

* Typescript - Fix issues with about-app and add login to convert less to css

* Typescript - Fix loading screen

* Typescript - Add custom title bar

* Typescript - Add method to get locale

* Typescript - Add logic to clean up old logs

* Typescript - Add set badge count api

* Typescript - Complete application menu

* Typescript - Add logic to translate menu items

* Typescript - freeze window.ssf api

* Typescript - Handle popup menu on alt key press

* Typescript - Completed activity detection

* Typescript - Completed screen snippet

* Typescript - Add login to close screen snippet

* Typescript - Completed window actions & snackbar, Updated i18n module

* Typescript - Completed native crypto implementation & fixed bugs

* Typescript - Completed Desktop capturer & screen picker implementation

* Typescript - Optimize window actions

* Typescript - Add support for child window

* Typescript - fix pop url validation issue & browserify preload

* Typescript - Completed context menu implementation and fixed screen snippet

* Typescript - Completed screen sharing indicator and fixed i18n usage issue

* Typescript - Fix i18n locale setting issue

* Typescript - Completed download manager

* Typescript - Completed Basic auth

* Typescript - Network connectivity dialog

* Typescript - Handle certificate error

* Typescript - Add translation for certificate error dialog buttons

* Typescript - Add gulp tasks to compile less, typescript and copy files

* Typescript - Fix some issues with custom title bar, loading screen & screen snippet

* Typescript - Remove ES2015 lib

* :typescript: - Do not inject custom title bar for mac

* :typescript: - Fix screen sharing indicator text and format string

* Typescript - Fix esc to full screen

* Typescript - handle multiple/single instance of the client and add safety checks

* Typescript - Refactor code base

* Typescript - Optimize window validation and fix screen picker issue

* Typescript - Optimize protocol handler

* typescript: logger unit test

* typescript: activityDetection unit test (#560)

* ELECTRON-1022 - Create app bridge that communicates between renderer and preload via postMessage

* ELECTRON-1024 - Add support for screen share and screen sharing indicator

* config unit test (#566)

* ELECTRON-1024 - Fix screen sharing indicator close issue

* ELECTRON-1022 - Bump Symphony version to 5.0.0 (1.55)

* fixing jest coverage output report (#575)

* protocol handle unit test (#576)

* Typescript - Remove unwanted checks in protocol handler and add test cases

* added more tests to increase coverage to 100 for protocol handler

* Typescript download manager unit test (#579)

* adding enzyme

* download manager unit test

* Typescript - Completed notification workflow

* about app unit test

* Typescript - Fix notification styles

* fixing Compiler error: Generic type ReactElement<P, T> (#583)

* fix app path on windows (#580)

* basic auth unit test (#582)

* screen picker unit test (#587)

* screen picker unit test

* screen sharing indicator unit test

* loading screen unit test (#588)

* improving snapshot using snapshotSerializers to remove unnecessary things (#596)

* Typescript - Enforce braces for if/for/do/while statements.

* Typescript - Fix Lint issues and Unit test

* Typescript - Enable eofline (Ensure the file ends with a newline.)

* Typescript - Update logger logic and format

* Typescript - Provide option for user to set custom log path

* Typescript - Fix eofline in css files

* Typescript - ignore spec from compiling and remove unwanted rebuild command
@lock
Copy link

lock bot commented Sep 15, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Sep 15, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants