1
0
mirror of https://github.com/bitwarden/desktop synced 2026-01-03 00:53:56 +00:00

Refactor copy method and add minimizeOnCopyToClipboardKey constant to electronConstants.ts

This commit is contained in:
Elias Papavasileiou
2020-03-15 02:41:54 +02:00
parent b8383ad5d9
commit 566e0c084a
2 changed files with 2 additions and 18 deletions

2
jslib

Submodule jslib updated: 98ae9b0629...2192d071bd

View File

@@ -57,24 +57,8 @@ export class ViewComponent extends BaseViewComponent implements OnChanges {
}
copy(value: string, typeI18nKey: string, aType: string) {
if (value == null) {
return;
}
this.platformUtilsService.eventTrack('Copied ' + aType);
const copyOptions = this.win != null ? { window: this.win } : null;
this.platformUtilsService.copyToClipboard(value, copyOptions);
this.platformUtilsService.showToast('info', null,
this.i18nService.t('valueCopied', this.i18nService.t(typeI18nKey)));
super.copy(value, typeI18nKey, aType);
this.minimizeIfNeeded();
if (typeI18nKey === 'password') {
this.eventService.collect(EventType.Cipher_ClientToggledHiddenFieldVisible, this.cipherId);
} else if (typeI18nKey === 'securityCode') {
this.eventService.collect(EventType.Cipher_ClientCopiedCardCode, this.cipherId);
} else if (aType === 'H_Field') {
this.eventService.collect(EventType.Cipher_ClientCopiedHiddenField, this.cipherId);
}
}
public async minimizeIfNeeded(): Promise<void> {