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": { "immediately": {
"message": "Immediately" "message": "Immediately"
}, },
"tenSeconds": {
"message": "10 seconds"
},
"twentySeconds": {
"message": "20 seconds"
},
"thirtySeconds": {
"message": "30 seconds"
},
"oneMinute": { "oneMinute": {
"message": "1 minute" "message": "1 minute"
}, },
"twoMinutes": {
"message": "2 minutes"
},
"fiveMinutes": { "fiveMinutes": {
"message": "5 minutes" "message": "5 minutes"
}, },
@ -511,6 +523,14 @@
"dontShowIdentitiesCurrentTabDesc": { "dontShowIdentitiesCurrentTabDesc": {
"message": "Identity items from your vault are listed on the 'Current Tab' page for easy auto-fill access." "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": { "notificationAddDesc": {
"message": "Should Bitwarden remember this password for you?" "message": "Should Bitwarden remember this password for you?"
}, },

View File

@ -36,6 +36,18 @@
</div> </div>
<div class="box-footer">{{'defaultUriMatchDetectionDesc' | i18n}}</div> <div class="box-footer">{{'defaultUriMatchDetectionDesc' | i18n}}</div>
</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">
<div class="box-content"> <div class="box-content">
<div class="box-content-row box-content-row-checkbox" appBoxRow> <div class="box-content-row box-content-row-checkbox" appBoxRow>

View File

@ -34,6 +34,8 @@ export class OptionsComponent implements OnInit {
themeOptions: any[]; themeOptions: any[];
defaultUriMatch = UriMatchType.Domain; defaultUriMatch = UriMatchType.Domain;
uriMatchOptions: any[]; uriMatchOptions: any[];
clearClipboard: number;
clearClipboardOptions: any[];
constructor(private analytics: Angulartics2, private messagingService: MessagingService, constructor(private analytics: Angulartics2, private messagingService: MessagingService,
private platformUtilsService: PlatformUtilsService, private storageService: StorageService, 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('exact'), value: UriMatchType.Exact },
{ name: i18nService.t('never'), value: UriMatchType.Never }, { 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() { async ngOnInit() {
@ -80,6 +91,8 @@ export class OptionsComponent implements OnInit {
const defaultUriMatch = await this.storageService.get<UriMatchType>(ConstantsService.defaultUriMatch); const defaultUriMatch = await this.storageService.get<UriMatchType>(ConstantsService.defaultUriMatch);
this.defaultUriMatch = defaultUriMatch == null ? UriMatchType.Domain : defaultUriMatch; this.defaultUriMatch = defaultUriMatch == null ? UriMatchType.Domain : defaultUriMatch;
this.clearClipboard = await this.storageService.get<number>(ConstantsService.clearClipboardKey);
} }
async updateAddLoginNotification() { async updateAddLoginNotification() {
@ -140,6 +153,13 @@ export class OptionsComponent implements OnInit {
this.analytics.eventTrack.next({ action: 'Set Default URI Match ' + this.defaultUriMatch }); 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) { private callAnalytics(name: string, enabled: boolean) {
const status = enabled ? 'Enabled' : 'Disabled'; const status = enabled ? 'Enabled' : 'Disabled';
this.analytics.eventTrack.next({ action: `${status} ${name}` }); this.analytics.eventTrack.next({ action: `${status} ${name}` });