mirror of
https://github.com/bitwarden/browser
synced 2025-12-17 16:53:34 +00:00
auto clear clipboard
This commit is contained in:
@@ -42,6 +42,8 @@ export class SettingsComponent implements OnInit {
|
||||
localeOptions: any[];
|
||||
theme: string;
|
||||
themeOptions: any[];
|
||||
clearClipboard: number;
|
||||
clearClipboardOptions: any[];
|
||||
|
||||
constructor(private analytics: Angulartics2, private toasterService: ToasterService,
|
||||
private i18nService: I18nService, private platformUtilsService: PlatformUtilsService,
|
||||
@@ -77,6 +79,16 @@ export class SettingsComponent implements OnInit {
|
||||
{ name: i18nService.t('dark'), value: 'dark' },
|
||||
{ name: 'Nord', value: 'nord' },
|
||||
];
|
||||
|
||||
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() {
|
||||
@@ -91,6 +103,7 @@ export class SettingsComponent implements OnInit {
|
||||
this.startToTray = await this.storageService.get<boolean>(ElectronConstants.enableStartToTrayKey);
|
||||
this.locale = await this.storageService.get<string>(ConstantsService.localeKey);
|
||||
this.theme = await this.storageService.get<string>(ConstantsService.themeKey);
|
||||
this.clearClipboard = await this.storageService.get<number>(ConstantsService.clearClipboardKey);
|
||||
}
|
||||
|
||||
async saveLockOption() {
|
||||
@@ -184,6 +197,13 @@ export class SettingsComponent implements OnInit {
|
||||
window.setTimeout(() => window.location.reload(), 200);
|
||||
}
|
||||
|
||||
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}` });
|
||||
|
||||
Reference in New Issue
Block a user