From 975b3a6e2bc4535836967f39cfa7675efbdbcf59 Mon Sep 17 00:00:00 2001 From: Nicolas Constant Date: Wed, 1 Jan 2020 18:35:15 +0100 Subject: [PATCH] fix electron registration --- .../add-new-account/add-new-account.component.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/app/components/floating-column/add-new-account/add-new-account.component.ts b/src/app/components/floating-column/add-new-account/add-new-account.component.ts index c0142885..1e43dba3 100644 --- a/src/app/components/floating-column/add-new-account/add-new-account.component.ts +++ b/src/app/components/floating-column/add-new-account/add-new-account.component.ts @@ -102,14 +102,20 @@ export class AddNewAccountComponent implements OnInit { return Promise.resolve(instanceApps[0].app); } else { let redirect_uri = this.getLocalHostname(); - if (process && process.versions && typeof((process.versions).electron) === 'string') { + + let userAgent = navigator.userAgent.toLowerCase(); + console.log(`userAgent ${userAgent}`); + + if (userAgent.includes(' electron/')) { redirect_uri += '/register'; } return this.authService.createNewApplication(instance, 'Sengi', redirect_uri, 'read write follow', 'https://nicolasconstant.github.io/sengi/') .then((appData: AppData) => { return this.saveNewApp(instance, appData) - .then(() => { return appData; }); + .then(() => { + return new Promise(resolve => setTimeout(resolve, 1000, appData)); + }); }) .catch((err: HttpErrorResponse) => { if (err.status === 0) {