mirror of
https://github.com/bitwarden/browser.git
synced 2025-03-12 13:39:14 +01:00
tweaks to minimize on copy feature (#432)
This commit is contained in:
parent
a84af15c93
commit
848dff7863
2
jslib
2
jslib
@ -1 +1 @@
|
||||
Subproject commit 8438cafbd08c1c9b1440e0c5385e15e8fb5ac524
|
||||
Subproject commit 2de8c5ed165f00e5d3a2b1dd92763176d6150782
|
@ -62,8 +62,9 @@
|
||||
<div class="form-group">
|
||||
<div class="checkbox">
|
||||
<label for="minimizeOnCopyToClipboard">
|
||||
<input id="minimizeOnCopyToClipboard" type="checkbox" name="MinimizeOnCopyToClipboard"
|
||||
[(ngModel)]="minimizeOnCopyToClipboard" (change)="saveMinOnCopyToClipboard()">
|
||||
<input id="minimizeOnCopyToClipboard" type="checkbox"
|
||||
name="MinimizeOnCopyToClipboard" [(ngModel)]="minimizeOnCopyToClipboard"
|
||||
(change)="saveMinOnCopyToClipboard()">
|
||||
{{'minimizeOnCopyToClipboard' | i18n}}
|
||||
</label>
|
||||
</div>
|
||||
|
@ -660,8 +660,8 @@ export class VaultComponent implements OnInit, OnDestroy {
|
||||
this.platformUtilsService.copyToClipboard(value);
|
||||
this.toasterService.popAsync('info', null,
|
||||
this.i18nService.t('valueCopied', this.i18nService.t(labelI18nKey)));
|
||||
if (this.viewComponent != null && this.action === 'view') {
|
||||
this.viewComponent.minimizeIfNeeded();
|
||||
if (this.action === 'view') {
|
||||
this.messagingService.send('minimizeOnCopy');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -25,8 +25,6 @@ import { ViewComponent as BaseViewComponent } from 'jslib/angular/components/vie
|
||||
|
||||
import { CipherView } from 'jslib/models/view/cipherView';
|
||||
|
||||
import { ElectronConstants } from 'jslib/electron/electronConstants';
|
||||
|
||||
@Component({
|
||||
selector: 'app-vault-view',
|
||||
templateUrl: 'view.component.html',
|
||||
@ -56,14 +54,6 @@ export class ViewComponent extends BaseViewComponent implements OnChanges {
|
||||
|
||||
copy(value: string, typeI18nKey: string, aType: string) {
|
||||
super.copy(value, typeI18nKey, aType);
|
||||
this.minimizeIfNeeded();
|
||||
}
|
||||
|
||||
async minimizeIfNeeded(): Promise<void> {
|
||||
const shouldMinimize = await this.storageService.get<boolean>(
|
||||
ElectronConstants.minimizeOnCopyToClipboardKey);
|
||||
if (shouldMinimize) {
|
||||
this.messagingService.send('minimize');
|
||||
}
|
||||
this.messagingService.send('minimizeOnCopy');
|
||||
}
|
||||
}
|
||||
|
@ -116,7 +116,7 @@
|
||||
"message": "Minimize when copying to clipboard"
|
||||
},
|
||||
"minimizeOnCopyToClipboardDesc": {
|
||||
"message": "Bitwarden will minimize when credentials are copied to clipboard."
|
||||
"message": "Minimize when copying an item's data to the clipboard."
|
||||
},
|
||||
"toggleVisibility": {
|
||||
"message": "Toggle Visibility"
|
||||
|
@ -88,7 +88,7 @@ export class Main {
|
||||
this.storageService = new ElectronStorageService(app.getPath('userData'), storageDefaults);
|
||||
|
||||
this.windowMain = new WindowMain(this.storageService, true);
|
||||
this.messagingMain = new MessagingMain(this);
|
||||
this.messagingMain = new MessagingMain(this, this.storageService);
|
||||
this.updaterMain = new UpdaterMain(this.i18nService, this.windowMain, 'desktop', () => {
|
||||
this.menuMain.updateMenuItem.enabled = false;
|
||||
}, () => {
|
||||
|
@ -2,12 +2,16 @@ import { ipcMain } from 'electron';
|
||||
|
||||
import { Main } from '../main';
|
||||
|
||||
import { ElectronConstants } from 'jslib/electron/electronConstants';
|
||||
|
||||
import { StorageService } from 'jslib/abstractions/storage.service';
|
||||
|
||||
const SyncInterval = 5 * 60 * 1000; // 5 minutes
|
||||
|
||||
export class MessagingMain {
|
||||
private syncTimeout: NodeJS.Timer;
|
||||
|
||||
constructor(private main: Main) { }
|
||||
constructor(private main: Main, private storageService: StorageService) { }
|
||||
|
||||
init() {
|
||||
this.scheduleNextSync();
|
||||
@ -23,10 +27,13 @@ export class MessagingMain {
|
||||
this.main.menuMain.updateApplicationMenuState(message.isAuthenticated, message.isLocked);
|
||||
this.updateTrayMenu(message.isAuthenticated, message.isLocked);
|
||||
break;
|
||||
case 'minimize':
|
||||
if (this.main.windowMain.win != null) {
|
||||
this.main.windowMain.win.minimize();
|
||||
}
|
||||
case 'minimizeOnCopy':
|
||||
this.storageService.get<boolean>(ElectronConstants.minimizeOnCopyToClipboardKey).then(
|
||||
(shouldMinimize) => {
|
||||
if (shouldMinimize && this.main.windowMain.win != null) {
|
||||
this.main.windowMain.win.minimize();
|
||||
}
|
||||
});
|
||||
break;
|
||||
case 'showTray':
|
||||
this.main.trayMain.showTray();
|
||||
|
Loading…
Reference in New Issue
Block a user