From f043010067f17f6449f01312d7af0af377d961d3 Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Wed, 21 Nov 2018 14:31:34 -0500 Subject: [PATCH] option to not show cards/identities on current tab list --- jslib | 2 +- src/_locales/en/messages.json | 12 ++++++++++++ src/popup/settings/options.component.html | 19 +++++++++++++++++++ src/popup/settings/options.component.ts | 17 +++++++++++++++++ src/popup/vault/current-tab.component.ts | 22 +++++++++++++++++----- 5 files changed, 66 insertions(+), 6 deletions(-) diff --git a/jslib b/jslib index 464bca8c4d7..1536f161f78 160000 --- a/jslib +++ b/jslib @@ -1 +1 @@ -Subproject commit 464bca8c4d745eb86bdb0b36e6e4a983caa3c891 +Subproject commit 1536f161f783c5972de1a375aed887710ee39eb8 diff --git a/src/_locales/en/messages.json b/src/_locales/en/messages.json index 0434eb056e1..964d9d8e058 100644 --- a/src/_locales/en/messages.json +++ b/src/_locales/en/messages.json @@ -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?" }, diff --git a/src/popup/settings/options.component.html b/src/popup/settings/options.component.html index f4f7ff94130..7b3c17296d4 100644 --- a/src/popup/settings/options.component.html +++ b/src/popup/settings/options.component.html @@ -33,6 +33,25 @@ +
+
+
+ + +
+
+ +
+
+
+
+ + +
+
+ +
diff --git a/src/popup/settings/options.component.ts b/src/popup/settings/options.component.ts index 17772a32bd5..86317923212 100644 --- a/src/popup/settings/options.component.ts +++ b/src/popup/settings/options.component.ts @@ -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( ConstantsService.disableContextMenuItemKey); + this.dontShowCards = await this.storageService.get(ConstantsService.dontShowCardsCurrentTab); + this.dontShowIdentities = await this.storageService.get(ConstantsService.dontShowIdentitiesCurrentTab); + this.disableAutoTotpCopy = !await this.totpService.isAutoCopyEnabled(); this.disableFavicon = await this.storageService.get(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 }); diff --git a/src/popup/vault/current-tab.component.ts b/src/popup/vault/current-tab.component.ts index eb917992232..1260b3c2c55 100644 --- a/src/popup/vault/current-tab.component.ts +++ b/src/popup/vault/current-tab.component.ts @@ -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(ConstantsService.dontShowCardsCurrentTab); + const dontShowIdentities = await this.storageService.get( + 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 = [];