1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-06-26 10:35:48 +02:00

clear clipboard setting

This commit is contained in:
Kyle Spearrin 2019-02-27 11:07:54 -05:00
parent 5b088b2b3c
commit 5ae81b197a
4 changed files with 53 additions and 1 deletions

2
jslib

@ -1 +1 @@
Subproject commit 8aa2f0fb183ad8f30a9fb5396b63e6fff5b87e12
Subproject commit d4fab1c6976f6b47fff89ef89404d6fcc7583021

View File

@ -319,9 +319,21 @@
"immediately": {
"message": "Immediately"
},
"tenSeconds": {
"message": "10 seconds"
},
"twentySeconds": {
"message": "20 seconds"
},
"thirtySeconds": {
"message": "30 seconds"
},
"oneMinute": {
"message": "1 minute"
},
"twoMinutes": {
"message": "2 minutes"
},
"fiveMinutes": {
"message": "5 minutes"
},
@ -511,6 +523,14 @@
"dontShowIdentitiesCurrentTabDesc": {
"message": "Identity items from your vault are listed on the 'Current Tab' page for easy auto-fill access."
},
"clearClipboard": {
"message": "Clear Clipboard",
"description": "Clipboard is the operating system thing where you copy/paste data to on your device."
},
"clearClipboardDesc": {
"message": "Automatically clear copied values from your clipboard.",
"description": "Clipboard is the operating system thing where you copy/paste data to on your device."
},
"notificationAddDesc": {
"message": "Should Bitwarden remember this password for you?"
},

View File

@ -36,6 +36,18 @@
</div>
<div class="box-footer">{{'defaultUriMatchDetectionDesc' | i18n}}</div>
</div>
<div class="box">
<div class="box-content">
<div class="box-content-row" appBoxRow>
<label for="clearClipboard">{{'clearClipboard' | i18n}}</label>
<select id="clearClipboard" name="ClearClipboard" [(ngModel)]="clearClipboard"
(change)="saveClearClipboard()">
<option *ngFor="let o of clearClipboardOptions" [ngValue]="o.value">{{o.name}}</option>
</select>
</div>
</div>
<div class="box-footer">{{'clearClipboardDesc' | i18n}}</div>
</div>
<div class="box">
<div class="box-content">
<div class="box-content-row box-content-row-checkbox" appBoxRow>

View File

@ -34,6 +34,8 @@ export class OptionsComponent implements OnInit {
themeOptions: any[];
defaultUriMatch = UriMatchType.Domain;
uriMatchOptions: any[];
clearClipboard: number;
clearClipboardOptions: any[];
constructor(private analytics: Angulartics2, private messagingService: MessagingService,
private platformUtilsService: PlatformUtilsService, private storageService: StorageService,
@ -52,6 +54,15 @@ export class OptionsComponent implements OnInit {
{ name: i18nService.t('exact'), value: UriMatchType.Exact },
{ name: i18nService.t('never'), value: UriMatchType.Never },
];
this.clearClipboardOptions = [
{ name: i18nService.t('never'), value: null },
{ name: i18nService.t('tenSeconds'), value: 10 },
{ name: i18nService.t('twentySeconds'), value: 20 },
{ name: i18nService.t('thirtySeconds'), value: 30 },
{ name: i18nService.t('oneMinute'), value: 60 },
{ name: i18nService.t('twoMinutes'), value: 120 },
{ name: i18nService.t('fiveMinutes'), value: 300 },
];
}
async ngOnInit() {
@ -80,6 +91,8 @@ export class OptionsComponent implements OnInit {
const defaultUriMatch = await this.storageService.get<UriMatchType>(ConstantsService.defaultUriMatch);
this.defaultUriMatch = defaultUriMatch == null ? UriMatchType.Domain : defaultUriMatch;
this.clearClipboard = await this.storageService.get<number>(ConstantsService.clearClipboardKey);
}
async updateAddLoginNotification() {
@ -140,6 +153,13 @@ export class OptionsComponent implements OnInit {
this.analytics.eventTrack.next({ action: 'Set Default URI Match ' + this.defaultUriMatch });
}
async saveClearClipboard() {
await this.storageService.save(ConstantsService.clearClipboardKey, this.clearClipboard);
this.analytics.eventTrack.next({
action: 'Set Clear Clipboard ' + (this.clearClipboard == null ? 'disabled' : this.clearClipboard),
});
}
private callAnalytics(name: string, enabled: boolean) {
const status = enabled ? 'Enabled' : 'Disabled';
this.analytics.eventTrack.next({ action: `${status} ${name}` });