Fix totp copy not working in Chrome (#2067)

* Fix totp copy not working in Chrome

* Only use fix for Chromium-based browsers
This commit is contained in:
Thomas Rittson 2021-09-22 07:36:28 +10:00 committed by GitHub
parent f4fc458542
commit 2449534e9e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 1 deletions

View File

@ -156,7 +156,12 @@ export class CurrentTabComponent implements OnInit, OnDestroy {
this.platformUtilsService.copyToClipboard(this.totpCode, { window: window }); this.platformUtilsService.copyToClipboard(this.totpCode, { window: window });
} }
if (this.popupUtilsService.inPopup(window)) { if (this.popupUtilsService.inPopup(window)) {
if (this.platformUtilsService.isFirefox() || this.platformUtilsService.isSafari()) {
BrowserApi.closePopup(window); BrowserApi.closePopup(window);
} else {
// Slight delay to fix bug in Chromium browsers where popup closes without copying totp to clipboard
setTimeout(() => BrowserApi.closePopup(window), 50);
}
} }
} catch { } catch {
this.ngZone.run(() => { this.ngZone.run(() => {