Browse Source

callbacks for argv from window main (#141)

PS-589-2fa-device-verification-settings
Kyle Spearrin 5 years ago committed by GitHub
parent
commit
1513b25a35
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      src/angular/components/sso.component.ts
  2. 13
      src/electron/window.main.ts

2
src/angular/components/sso.component.ts

@ -82,10 +82,10 @@ export class SsoComponent { @@ -82,10 +82,10 @@ export class SsoComponent {
const codeVerifierHash = await this.cryptoFunctionService.hash(codeVerifier, 'sha256');
codeChallenge = Utils.fromBufferToUrlB64(codeVerifierHash);
await this.storageService.save(ConstantsService.ssoCodeVerifierKey, codeVerifier);
await this.storageService.save(ConstantsService.ssoStateKey, state);
}
if (state == null) {
state = await this.passwordGenerationService.generatePassword(passwordOptions);
await this.storageService.save(ConstantsService.ssoStateKey, state);
}
const authorizeUrl = this.apiService.identityBaseUrl + '/connect/authorize?' +

13
src/electron/window.main.ts

@ -22,7 +22,8 @@ export class WindowMain { @@ -22,7 +22,8 @@ export class WindowMain {
private enableAlwaysOnTop: boolean = false;
constructor(private storageService: StorageService, private hideTitleBar = false,
private defaultWidth = 950, private defaultHeight = 600) { }
private defaultWidth = 950, private defaultHeight = 600,
private argvCallback: (argv: string[]) => void = null) { }
init(): Promise<any> {
return new Promise((resolve, reject) => {
@ -33,7 +34,7 @@ export class WindowMain { @@ -33,7 +34,7 @@ export class WindowMain {
app.quit();
return;
} else {
app.on('second-instance', (event, commandLine, workingDirectory) => {
app.on('second-instance', (event, argv, workingDirectory) => {
// Someone tried to run a second instance, we should focus our window.
if (this.win != null) {
if (this.win.isMinimized() || !this.win.isVisible()) {
@ -41,6 +42,11 @@ export class WindowMain { @@ -41,6 +42,11 @@ export class WindowMain {
}
this.win.focus();
}
if (process.platform === 'win32' || process.platform === 'linux') {
if (this.argvCallback != null) {
this.argvCallback(argv);
}
}
});
}
}
@ -57,6 +63,9 @@ export class WindowMain { @@ -57,6 +63,9 @@ export class WindowMain {
app.on('ready', async () => {
await this.createWindow();
resolve();
if (this.argvCallback != null) {
this.argvCallback(process.argv);
}
});
// Quit when all windows are closed.

Loading…
Cancel
Save