mirror of
https://github.com/bitwarden/browser
synced 2025-12-16 00:03:56 +00:00
convert copying to platform utils service
This commit is contained in:
@@ -12,7 +12,7 @@ import {
|
|||||||
} from '@angular/core';
|
} from '@angular/core';
|
||||||
|
|
||||||
import { PasswordGenerationService } from 'jslib/abstractions/passwordGeneration.service';
|
import { PasswordGenerationService } from 'jslib/abstractions/passwordGeneration.service';
|
||||||
import { UtilsService } from 'jslib/abstractions/utils.service';
|
import { PlatformUtilsService } from 'jslib/abstractions/platformUtils.service';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'password-generator',
|
selector: 'password-generator',
|
||||||
@@ -28,7 +28,7 @@ export class PasswordGeneratorComponent implements OnInit {
|
|||||||
avoidAmbiguous = false;
|
avoidAmbiguous = false;
|
||||||
|
|
||||||
constructor(private passwordGenerationService: PasswordGenerationService, private analytics: Angulartics2,
|
constructor(private passwordGenerationService: PasswordGenerationService, private analytics: Angulartics2,
|
||||||
private utilsService: UtilsService) { }
|
private platformUtilsService: PlatformUtilsService) { }
|
||||||
|
|
||||||
async ngOnInit() {
|
async ngOnInit() {
|
||||||
this.options = await this.passwordGenerationService.getOptions();
|
this.options = await this.passwordGenerationService.getOptions();
|
||||||
@@ -73,7 +73,7 @@ export class PasswordGeneratorComponent implements OnInit {
|
|||||||
|
|
||||||
copy() {
|
copy() {
|
||||||
this.analytics.eventTrack.next({ action: 'Copied Generated Password' });
|
this.analytics.eventTrack.next({ action: 'Copied Generated Password' });
|
||||||
this.utilsService.copyToClipboard(this.password, window.document);
|
this.platformUtilsService.copyToClipboard(this.password);
|
||||||
}
|
}
|
||||||
|
|
||||||
select() {
|
select() {
|
||||||
|
|||||||
@@ -21,7 +21,6 @@ import { I18nService } from 'jslib/abstractions/i18n.service';
|
|||||||
import { PlatformUtilsService } from 'jslib/abstractions/platformUtils.service';
|
import { PlatformUtilsService } from 'jslib/abstractions/platformUtils.service';
|
||||||
import { TokenService } from 'jslib/abstractions/token.service';
|
import { TokenService } from 'jslib/abstractions/token.service';
|
||||||
import { TotpService } from 'jslib/abstractions/totp.service';
|
import { TotpService } from 'jslib/abstractions/totp.service';
|
||||||
import { UtilsService } from 'jslib/abstractions/utils.service';
|
|
||||||
|
|
||||||
import { AttachmentView } from 'jslib/models/view/attachmentView';
|
import { AttachmentView } from 'jslib/models/view/attachmentView';
|
||||||
import { CipherView } from 'jslib/models/view/cipherView';
|
import { CipherView } from 'jslib/models/view/cipherView';
|
||||||
@@ -47,10 +46,9 @@ export class ViewComponent implements OnChanges, OnDestroy {
|
|||||||
private totpInterval: any;
|
private totpInterval: any;
|
||||||
|
|
||||||
constructor(private cipherService: CipherService, private totpService: TotpService,
|
constructor(private cipherService: CipherService, private totpService: TotpService,
|
||||||
private tokenService: TokenService, private utilsService: UtilsService,
|
private tokenService: TokenService, private toasterService: ToasterService,
|
||||||
private cryptoService: CryptoService, private platformUtilsService: PlatformUtilsService,
|
private cryptoService: CryptoService, private platformUtilsService: PlatformUtilsService,
|
||||||
private i18nService: I18nService, private analytics: Angulartics2, private toasterService: ToasterService) {
|
private i18nService: I18nService, private analytics: Angulartics2) { }
|
||||||
}
|
|
||||||
|
|
||||||
async ngOnChanges() {
|
async ngOnChanges() {
|
||||||
this.cleanUp();
|
this.cleanUp();
|
||||||
@@ -104,7 +102,7 @@ export class ViewComponent implements OnChanges, OnDestroy {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.analytics.eventTrack.next({ action: 'Copied ' + aType });
|
this.analytics.eventTrack.next({ action: 'Copied ' + aType });
|
||||||
this.utilsService.copyToClipboard(value, window.document);
|
this.platformUtilsService.copyToClipboard(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
async downloadAttachment(attachment: AttachmentView) {
|
async downloadAttachment(attachment: AttachmentView) {
|
||||||
|
|||||||
Reference in New Issue
Block a user