mirror of
https://github.com/bitwarden/browser.git
synced 2025-01-06 18:57:56 +01:00
clear clipboard setting
This commit is contained in:
parent
8aa2f0fb18
commit
d4fab1c697
@ -20,6 +20,7 @@ export class ConstantsService {
|
||||
static readonly defaultUriMatch: string = 'defaultUriMatch';
|
||||
static readonly pinProtectedKey: string = 'pinProtectedKey';
|
||||
static readonly protectedPin: string = 'protectedPin';
|
||||
static readonly clearClipboardKey: string = 'clearClipboardKey';
|
||||
|
||||
readonly environmentUrlsKey: string = ConstantsService.environmentUrlsKey;
|
||||
readonly disableGaKey: string = ConstantsService.disableGaKey;
|
||||
@ -41,4 +42,5 @@ export class ConstantsService {
|
||||
readonly defaultUriMatch: string = ConstantsService.defaultUriMatch;
|
||||
readonly pinProtectedKey: string = ConstantsService.pinProtectedKey;
|
||||
readonly protectedPin: string = ConstantsService.protectedPin;
|
||||
readonly clearClipboardKey: string = ConstantsService.clearClipboardKey;
|
||||
}
|
||||
|
@ -48,7 +48,7 @@ export class SystemService implements SystemServiceAbstraction {
|
||||
}
|
||||
}
|
||||
|
||||
clearClipboard(clipboardValue: string, timeoutMs = 30000): void {
|
||||
clearClipboard(clipboardValue: string, timeoutMs: number = null): void {
|
||||
if (this.clearClipboardTimeout != null) {
|
||||
clearTimeout(this.clearClipboardTimeout);
|
||||
this.clearClipboardTimeout = null;
|
||||
@ -56,11 +56,19 @@ export class SystemService implements SystemServiceAbstraction {
|
||||
if (Utils.isNullOrWhitespace(clipboardValue)) {
|
||||
return;
|
||||
}
|
||||
this.clearClipboardTimeout = setTimeout(async () => {
|
||||
const clipboardValueNow = await this.platformUtilsService.readFromClipboard();
|
||||
if (clipboardValue === clipboardValueNow) {
|
||||
this.platformUtilsService.copyToClipboard('');
|
||||
this.storageService.get<number>(ConstantsService.clearClipboardKey).then((clearSeconds) => {
|
||||
if (clearSeconds == null) {
|
||||
return;
|
||||
}
|
||||
}, timeoutMs);
|
||||
if (timeoutMs == null) {
|
||||
timeoutMs = clearSeconds * 1000;
|
||||
}
|
||||
this.clearClipboardTimeout = setTimeout(async () => {
|
||||
const clipboardValueNow = await this.platformUtilsService.readFromClipboard();
|
||||
if (clipboardValue === clipboardValueNow) {
|
||||
this.platformUtilsService.copyToClipboard('');
|
||||
}
|
||||
}, timeoutMs);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user