mirror of
https://github.com/bitwarden/desktop
synced 2025-12-31 23:53:23 +00:00
Extend feature to context menus and view component
This commit is contained in:
@@ -163,7 +163,6 @@ export class VaultComponent implements OnInit, OnDestroy {
|
||||
if (this.cipherId != null && uCipher != null && uCipher.id === this.cipherId &&
|
||||
uCipher.login != null && uCipher.login.username != null) {
|
||||
this.copyValue(uCipher.login.username, 'username');
|
||||
this.minimizeIfNeeded();
|
||||
}
|
||||
break;
|
||||
case 'copyPassword':
|
||||
@@ -172,7 +171,6 @@ export class VaultComponent implements OnInit, OnDestroy {
|
||||
if (this.cipherId != null && pCipher != null && pCipher.id === this.cipherId &&
|
||||
pCipher.login != null && pCipher.login.password != null) {
|
||||
this.copyValue(pCipher.login.password, 'password');
|
||||
this.minimizeIfNeeded();
|
||||
}
|
||||
break;
|
||||
default:
|
||||
@@ -666,17 +664,10 @@ export class VaultComponent implements OnInit, OnDestroy {
|
||||
this.platformUtilsService.copyToClipboard(value);
|
||||
this.toasterService.popAsync('info', null,
|
||||
this.i18nService.t('valueCopied', this.i18nService.t(labelI18nKey)));
|
||||
this.viewComponent.minimizeIfNeeded();
|
||||
});
|
||||
}
|
||||
|
||||
private async minimizeIfNeeded(): Promise<void> {
|
||||
const shouldMinimize =
|
||||
await this.storageService.get<boolean>(ElectronConstants.minimizeOnCopyToClipboardKey);
|
||||
if (shouldMinimize) {
|
||||
this.messagingService.send('minimize');
|
||||
}
|
||||
}
|
||||
|
||||
private functionWithChangeDetection(func: Function) {
|
||||
this.ngZone.run(() => {
|
||||
func();
|
||||
|
||||
@@ -12,7 +12,9 @@ import { CipherService } from 'jslib/abstractions/cipher.service';
|
||||
import { CryptoService } from 'jslib/abstractions/crypto.service';
|
||||
import { EventService } from 'jslib/abstractions/event.service';
|
||||
import { I18nService } from 'jslib/abstractions/i18n.service';
|
||||
import { MessagingService } from 'jslib/abstractions/messaging.service';
|
||||
import { PlatformUtilsService } from 'jslib/abstractions/platformUtils.service';
|
||||
import { StorageService } from 'jslib/abstractions/storage.service';
|
||||
import { TokenService } from 'jslib/abstractions/token.service';
|
||||
import { TotpService } from 'jslib/abstractions/totp.service';
|
||||
import { UserService } from 'jslib/abstractions/user.service';
|
||||
@@ -35,9 +37,11 @@ export class ViewComponent extends BaseViewComponent implements OnChanges {
|
||||
cryptoService: CryptoService, platformUtilsService: PlatformUtilsService,
|
||||
auditService: AuditService, broadcasterService: BroadcasterService,
|
||||
ngZone: NgZone, changeDetectorRef: ChangeDetectorRef,
|
||||
userService: UserService, eventService: EventService) {
|
||||
userService: UserService, eventService: EventService,
|
||||
messagingService: MessagingService, storageService: StorageService) {
|
||||
super(cipherService, totpService, tokenService, i18nService, cryptoService, platformUtilsService,
|
||||
auditService, window, broadcasterService, ngZone, changeDetectorRef, userService, eventService);
|
||||
auditService, window, broadcasterService, ngZone, changeDetectorRef, userService, eventService,
|
||||
messagingService, storageService);
|
||||
}
|
||||
|
||||
async ngOnChanges() {
|
||||
|
||||
Reference in New Issue
Block a user