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

option to not show cards/identities on current tab list

This commit is contained in:
Kyle Spearrin 2018-11-21 14:31:34 -05:00
parent 100f9589bb
commit f043010067
5 changed files with 66 additions and 6 deletions

2
jslib

@ -1 +1 @@
Subproject commit 464bca8c4d745eb86bdb0b36e6e4a983caa3c891
Subproject commit 1536f161f783c5972de1a375aed887710ee39eb8

View File

@ -490,6 +490,18 @@
"addLoginNotificationDesc": {
"message": "The \"Add Login Notification\" automatically prompts you to save new logins to your vault whenever you log into them for the first time."
},
"dontShowCardsCurrentTab": {
"message": "Don't Show Cards on Tab Page"
},
"dontShowCardsCurrentTabDesc": {
"message": "Card items from your vault are listed on the 'Current Tab' page for easy auto-fill access."
},
"dontShowIdentitiesCurrentTab": {
"message": "Don't Show Identities on Tab Page"
},
"dontShowIdentitiesCurrentTabDesc": {
"message": "Identity items from your vault are listed on the 'Current Tab' page for easy auto-fill access."
},
"notificationAddDesc": {
"message": "Should Bitwarden remember this password for you?"
},

View File

@ -33,6 +33,25 @@
</div>
<div class="box-footer">{{'disableAutoTotpCopyDesc' | i18n}}</div>
</div>
<div class="box">
<div class="box-content">
<div class="box-content-row box-content-row-checkbox" appBoxRow>
<label for="dontShowCards">{{'dontShowCardsCurrentTab' | i18n}}</label>
<input id="dontShowCards" type="checkbox" (change)="updateShowCards()" [(ngModel)]="dontShowCards">
</div>
</div>
<div class="box-footer">{{'dontShowCardsCurrentTabDesc' | i18n}}</div>
</div>
<div class="box">
<div class="box-content">
<div class="box-content-row box-content-row-checkbox" appBoxRow>
<label for="dontShowIdentities">{{'dontShowIdentitiesCurrentTab' | i18n}}</label>
<input id="dontShowIdentities" type="checkbox" (change)="updateShowIdentities()"
[(ngModel)]="dontShowIdentities">
</div>
</div>
<div class="box-footer">{{'dontShowIdentitiesCurrentTabDesc' | i18n}}</div>
</div>
<div class="box">
<div class="box-content">
<div class="box-content-row box-content-row-checkbox" appBoxRow>

View File

@ -25,6 +25,8 @@ export class OptionsComponent implements OnInit {
disableContextMenuItem = false;
disableAddLoginNotification = false;
disableChangedPasswordNotification = false;
dontShowCards = false;
dontShowIdentities = false;
showDisableContextMenu = true;
disableGa = false;
theme: string;
@ -60,6 +62,9 @@ export class OptionsComponent implements OnInit {
this.disableContextMenuItem = await this.storageService.get<boolean>(
ConstantsService.disableContextMenuItemKey);
this.dontShowCards = await this.storageService.get<boolean>(ConstantsService.dontShowCardsCurrentTab);
this.dontShowIdentities = await this.storageService.get<boolean>(ConstantsService.dontShowIdentitiesCurrentTab);
this.disableAutoTotpCopy = !await this.totpService.isAutoCopyEnabled();
this.disableFavicon = await this.storageService.get<boolean>(ConstantsService.disableFaviconKey);
@ -112,6 +117,18 @@ export class OptionsComponent implements OnInit {
this.callAnalytics('Favicon', !this.disableFavicon);
}
async updateShowCards() {
await this.storageService.save(ConstantsService.dontShowCardsCurrentTab, this.dontShowCards);
await this.stateService.save(ConstantsService.dontShowCardsCurrentTab, this.dontShowCards);
this.callAnalytics('Show Cards on Current Tab', !this.dontShowCards);
}
async updateShowIdentities() {
await this.storageService.save(ConstantsService.dontShowIdentitiesCurrentTab, this.dontShowIdentities);
await this.stateService.save(ConstantsService.dontShowIdentitiesCurrentTab, this.dontShowIdentities);
this.callAnalytics('Show Identities on Current Tab', !this.dontShowIdentities);
}
async saveTheme() {
await this.storageService.save(ConstantsService.themeKey, this.theme);
this.analytics.eventTrack.next({ action: 'Set Theme ' + this.theme });

View File

@ -22,8 +22,11 @@ import { CipherService } from 'jslib/abstractions/cipher.service';
import { I18nService } from 'jslib/abstractions/i18n.service';
import { PlatformUtilsService } from 'jslib/abstractions/platformUtils.service';
import { SearchService } from 'jslib/abstractions/search.service';
import { StorageService } from 'jslib/abstractions/storage.service';
import { SyncService } from 'jslib/abstractions/sync.service';
import { ConstantsService } from 'jslib/services/constants.service';
import { AutofillService } from '../../services/abstractions/autofill.service';
import { PopupUtilsService } from '../services/popup-utils.service';
@ -59,7 +62,7 @@ export class CurrentTabComponent implements OnInit, OnDestroy {
private i18nService: I18nService, private router: Router,
private ngZone: NgZone, private broadcasterService: BroadcasterService,
private changeDetectorRef: ChangeDetectorRef, private syncService: SyncService,
private searchService: SearchService) { }
private searchService: SearchService, private storageService: StorageService) { }
async ngOnInit() {
this.showLeftHeader = !this.platformUtilsService.isSafari();
@ -203,10 +206,19 @@ export class CurrentTabComponent implements OnInit, OnDestroy {
sender: BroadcasterSubscriptionId,
});
const ciphers = await this.cipherService.getAllDecryptedForUrl(this.url, [
CipherType.Card,
CipherType.Identity,
]);
const otherTypes: CipherType[] = [];
const dontShowCards = await this.storageService.get<boolean>(ConstantsService.dontShowCardsCurrentTab);
const dontShowIdentities = await this.storageService.get<boolean>(
ConstantsService.dontShowIdentitiesCurrentTab);
if (!dontShowCards) {
otherTypes.push(CipherType.Card);
}
if (!dontShowIdentities) {
otherTypes.push(CipherType.Identity);
}
const ciphers = await this.cipherService.getAllDecryptedForUrl(this.url,
otherTypes.length > 0 ? otherTypes : null);
this.loginCiphers = [];
this.cardCiphers = [];