mirror of
https://github.com/bitwarden/browser
synced 2025-12-12 06:13:38 +00:00
[PM-23306] "Show cards in autofill" is defaulting to on when the setting is enabled (#15534)
* disable card autofill * Fixed dependency issues
This commit is contained in:
@@ -752,11 +752,6 @@ export default class MainBackground {
|
|||||||
this.stateProvider,
|
this.stateProvider,
|
||||||
);
|
);
|
||||||
|
|
||||||
this.autofillSettingsService = new AutofillSettingsService(
|
|
||||||
this.stateProvider,
|
|
||||||
this.policyService,
|
|
||||||
this.accountService,
|
|
||||||
);
|
|
||||||
this.badgeSettingsService = new BadgeSettingsService(this.stateProvider);
|
this.badgeSettingsService = new BadgeSettingsService(this.stateProvider);
|
||||||
this.policyApiService = new PolicyApiService(
|
this.policyApiService = new PolicyApiService(
|
||||||
this.policyService,
|
this.policyService,
|
||||||
@@ -844,16 +839,6 @@ export default class MainBackground {
|
|||||||
this.tokenService,
|
this.tokenService,
|
||||||
);
|
);
|
||||||
|
|
||||||
this.billingAccountProfileStateService = new DefaultBillingAccountProfileStateService(
|
|
||||||
this.stateProvider,
|
|
||||||
this.platformUtilsService,
|
|
||||||
this.apiService,
|
|
||||||
);
|
|
||||||
|
|
||||||
this.ssoLoginService = new SsoLoginService(this.stateProvider, this.logService);
|
|
||||||
|
|
||||||
this.userVerificationApiService = new UserVerificationApiService(this.apiService);
|
|
||||||
|
|
||||||
this.configApiService = new ConfigApiService(this.apiService, this.tokenService);
|
this.configApiService = new ConfigApiService(this.apiService, this.tokenService);
|
||||||
|
|
||||||
this.configService = new DefaultConfigService(
|
this.configService = new DefaultConfigService(
|
||||||
@@ -864,6 +849,30 @@ export default class MainBackground {
|
|||||||
this.authService,
|
this.authService,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
this.billingAccountProfileStateService = new DefaultBillingAccountProfileStateService(
|
||||||
|
this.stateProvider,
|
||||||
|
this.platformUtilsService,
|
||||||
|
this.apiService,
|
||||||
|
);
|
||||||
|
|
||||||
|
this.restrictedItemTypesService = new RestrictedItemTypesService(
|
||||||
|
this.configService,
|
||||||
|
this.accountService,
|
||||||
|
this.organizationService,
|
||||||
|
this.policyService,
|
||||||
|
);
|
||||||
|
|
||||||
|
this.autofillSettingsService = new AutofillSettingsService(
|
||||||
|
this.stateProvider,
|
||||||
|
this.policyService,
|
||||||
|
this.accountService,
|
||||||
|
this.restrictedItemTypesService,
|
||||||
|
);
|
||||||
|
|
||||||
|
this.ssoLoginService = new SsoLoginService(this.stateProvider, this.logService);
|
||||||
|
|
||||||
|
this.userVerificationApiService = new UserVerificationApiService(this.apiService);
|
||||||
|
|
||||||
this.domainSettingsService = new DefaultDomainSettingsService(
|
this.domainSettingsService = new DefaultDomainSettingsService(
|
||||||
this.stateProvider,
|
this.stateProvider,
|
||||||
this.configService,
|
this.configService,
|
||||||
@@ -928,7 +937,10 @@ export default class MainBackground {
|
|||||||
this.i18nService,
|
this.i18nService,
|
||||||
);
|
);
|
||||||
|
|
||||||
this.vaultSettingsService = new VaultSettingsService(this.stateProvider);
|
this.vaultSettingsService = new VaultSettingsService(
|
||||||
|
this.stateProvider,
|
||||||
|
this.restrictedItemTypesService,
|
||||||
|
);
|
||||||
|
|
||||||
this.vaultTimeoutService = new VaultTimeoutService(
|
this.vaultTimeoutService = new VaultTimeoutService(
|
||||||
this.accountService,
|
this.accountService,
|
||||||
@@ -1315,13 +1327,6 @@ export default class MainBackground {
|
|||||||
this.stateProvider,
|
this.stateProvider,
|
||||||
);
|
);
|
||||||
|
|
||||||
this.restrictedItemTypesService = new RestrictedItemTypesService(
|
|
||||||
this.configService,
|
|
||||||
this.accountService,
|
|
||||||
this.organizationService,
|
|
||||||
this.policyService,
|
|
||||||
);
|
|
||||||
|
|
||||||
this.mainContextMenuHandler = new MainContextMenuHandler(
|
this.mainContextMenuHandler = new MainContextMenuHandler(
|
||||||
this.stateService,
|
this.stateService,
|
||||||
this.autofillSettingsService,
|
this.autofillSettingsService,
|
||||||
|
|||||||
@@ -118,6 +118,7 @@ import {
|
|||||||
InternalFolderService,
|
InternalFolderService,
|
||||||
} from "@bitwarden/common/vault/abstractions/folder/folder.service.abstraction";
|
} from "@bitwarden/common/vault/abstractions/folder/folder.service.abstraction";
|
||||||
import { TotpService as TotpServiceAbstraction } from "@bitwarden/common/vault/abstractions/totp.service";
|
import { TotpService as TotpServiceAbstraction } from "@bitwarden/common/vault/abstractions/totp.service";
|
||||||
|
import { RestrictedItemTypesService } from "@bitwarden/common/vault/services/restricted-item-types.service";
|
||||||
import { TotpService } from "@bitwarden/common/vault/services/totp.service";
|
import { TotpService } from "@bitwarden/common/vault/services/totp.service";
|
||||||
import {
|
import {
|
||||||
AnonLayoutWrapperDataService,
|
AnonLayoutWrapperDataService,
|
||||||
@@ -486,7 +487,7 @@ const safeProviders: SafeProvider[] = [
|
|||||||
safeProvider({
|
safeProvider({
|
||||||
provide: AutofillSettingsServiceAbstraction,
|
provide: AutofillSettingsServiceAbstraction,
|
||||||
useClass: AutofillSettingsService,
|
useClass: AutofillSettingsService,
|
||||||
deps: [StateProvider, PolicyService, AccountService],
|
deps: [StateProvider, PolicyService, AccountService, RestrictedItemTypesService],
|
||||||
}),
|
}),
|
||||||
safeProvider({
|
safeProvider({
|
||||||
provide: UserNotificationSettingsServiceAbstraction,
|
provide: UserNotificationSettingsServiceAbstraction,
|
||||||
|
|||||||
@@ -685,11 +685,23 @@ export class ServiceContainer {
|
|||||||
this.configService,
|
this.configService,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
this.restrictedItemTypesService = new RestrictedItemTypesService(
|
||||||
|
this.configService,
|
||||||
|
this.accountService,
|
||||||
|
this.organizationService,
|
||||||
|
this.policyService,
|
||||||
|
);
|
||||||
|
|
||||||
|
this.cliRestrictedItemTypesService = new CliRestrictedItemTypesService(
|
||||||
|
this.restrictedItemTypesService,
|
||||||
|
);
|
||||||
|
|
||||||
// FIXME: CLI does not support autofill
|
// FIXME: CLI does not support autofill
|
||||||
this.autofillSettingsService = new AutofillSettingsService(
|
this.autofillSettingsService = new AutofillSettingsService(
|
||||||
this.stateProvider,
|
this.stateProvider,
|
||||||
this.policyService,
|
this.policyService,
|
||||||
this.accountService,
|
this.accountService,
|
||||||
|
this.restrictedItemTypesService,
|
||||||
);
|
);
|
||||||
|
|
||||||
this.cipherEncryptionService = new DefaultCipherEncryptionService(
|
this.cipherEncryptionService = new DefaultCipherEncryptionService(
|
||||||
@@ -796,17 +808,6 @@ export class ServiceContainer {
|
|||||||
|
|
||||||
this.totpService = new TotpService(this.sdkService);
|
this.totpService = new TotpService(this.sdkService);
|
||||||
|
|
||||||
this.restrictedItemTypesService = new RestrictedItemTypesService(
|
|
||||||
this.configService,
|
|
||||||
this.accountService,
|
|
||||||
this.organizationService,
|
|
||||||
this.policyService,
|
|
||||||
);
|
|
||||||
|
|
||||||
this.cliRestrictedItemTypesService = new CliRestrictedItemTypesService(
|
|
||||||
this.restrictedItemTypesService,
|
|
||||||
);
|
|
||||||
|
|
||||||
this.importApiService = new ImportApiService(this.apiService);
|
this.importApiService = new ImportApiService(this.apiService);
|
||||||
|
|
||||||
this.importService = new ImportService(
|
this.importService = new ImportService(
|
||||||
|
|||||||
@@ -1319,7 +1319,7 @@ const safeProviders: SafeProvider[] = [
|
|||||||
safeProvider({
|
safeProvider({
|
||||||
provide: AutofillSettingsServiceAbstraction,
|
provide: AutofillSettingsServiceAbstraction,
|
||||||
useClass: AutofillSettingsService,
|
useClass: AutofillSettingsService,
|
||||||
deps: [StateProvider, PolicyServiceAbstraction, AccountService],
|
deps: [StateProvider, PolicyServiceAbstraction, AccountService, RestrictedItemTypesService],
|
||||||
}),
|
}),
|
||||||
safeProvider({
|
safeProvider({
|
||||||
provide: BadgeSettingsServiceAbstraction,
|
provide: BadgeSettingsServiceAbstraction,
|
||||||
@@ -1334,7 +1334,7 @@ const safeProviders: SafeProvider[] = [
|
|||||||
safeProvider({
|
safeProvider({
|
||||||
provide: VaultSettingsServiceAbstraction,
|
provide: VaultSettingsServiceAbstraction,
|
||||||
useClass: VaultSettingsService,
|
useClass: VaultSettingsService,
|
||||||
deps: [StateProvider],
|
deps: [StateProvider, RestrictedItemTypesService],
|
||||||
}),
|
}),
|
||||||
safeProvider({
|
safeProvider({
|
||||||
provide: MigrationRunner,
|
provide: MigrationRunner,
|
||||||
|
|||||||
@@ -1,6 +1,9 @@
|
|||||||
// FIXME: Update this file to be type safe and remove this and next line
|
// FIXME: Update this file to be type safe and remove this and next line
|
||||||
// @ts-strict-ignore
|
// @ts-strict-ignore
|
||||||
import { map, Observable, switchMap } from "rxjs";
|
import { combineLatest, map, Observable, startWith, switchMap } from "rxjs";
|
||||||
|
|
||||||
|
import { CipherType } from "@bitwarden/common/vault/enums";
|
||||||
|
import { RestrictedItemTypesService } from "@bitwarden/common/vault/services/restricted-item-types.service";
|
||||||
|
|
||||||
import { PolicyService } from "../../admin-console/abstractions/policy/policy.service.abstraction";
|
import { PolicyService } from "../../admin-console/abstractions/policy/policy.service.abstraction";
|
||||||
import { PolicyType } from "../../admin-console/enums";
|
import { PolicyType } from "../../admin-console/enums";
|
||||||
@@ -155,6 +158,7 @@ export class AutofillSettingsService implements AutofillSettingsServiceAbstracti
|
|||||||
private stateProvider: StateProvider,
|
private stateProvider: StateProvider,
|
||||||
private policyService: PolicyService,
|
private policyService: PolicyService,
|
||||||
private accountService: AccountService,
|
private accountService: AccountService,
|
||||||
|
private restrictedItemTypesService: RestrictedItemTypesService,
|
||||||
) {
|
) {
|
||||||
this.autofillOnPageLoadState = this.stateProvider.getActive(AUTOFILL_ON_PAGE_LOAD);
|
this.autofillOnPageLoadState = this.stateProvider.getActive(AUTOFILL_ON_PAGE_LOAD);
|
||||||
this.autofillOnPageLoad$ = this.autofillOnPageLoadState.state$.pipe(map((x) => x ?? false));
|
this.autofillOnPageLoad$ = this.autofillOnPageLoadState.state$.pipe(map((x) => x ?? false));
|
||||||
@@ -199,7 +203,16 @@ export class AutofillSettingsService implements AutofillSettingsServiceAbstracti
|
|||||||
);
|
);
|
||||||
|
|
||||||
this.showInlineMenuCardsState = this.stateProvider.getActive(SHOW_INLINE_MENU_CARDS);
|
this.showInlineMenuCardsState = this.stateProvider.getActive(SHOW_INLINE_MENU_CARDS);
|
||||||
this.showInlineMenuCards$ = this.showInlineMenuCardsState.state$.pipe(map((x) => x ?? true));
|
this.showInlineMenuCards$ = combineLatest([
|
||||||
|
this.showInlineMenuCardsState.state$.pipe(map((x) => x ?? true)),
|
||||||
|
this.restrictedItemTypesService.restricted$.pipe(startWith([])),
|
||||||
|
]).pipe(
|
||||||
|
map(
|
||||||
|
([enabled, restrictions]) =>
|
||||||
|
// If enabled, show cards inline menu unless card type is restricted
|
||||||
|
enabled && !restrictions.some((r) => r.cipherType === CipherType.Card),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
this.enableContextMenuState = this.stateProvider.getGlobal(ENABLE_CONTEXT_MENU);
|
this.enableContextMenuState = this.stateProvider.getGlobal(ENABLE_CONTEXT_MENU);
|
||||||
this.enableContextMenu$ = this.enableContextMenuState.state$.pipe(map((x) => x ?? true));
|
this.enableContextMenu$ = this.enableContextMenuState.state$.pipe(map((x) => x ?? true));
|
||||||
|
|||||||
@@ -1,13 +1,15 @@
|
|||||||
import { Observable, map, shareReplay } from "rxjs";
|
import { Observable, combineLatest, map, shareReplay, startWith } from "rxjs";
|
||||||
|
|
||||||
import { ActiveUserState, GlobalState, StateProvider } from "../../../platform/state";
|
import { ActiveUserState, GlobalState, StateProvider } from "../../../platform/state";
|
||||||
import { VaultSettingsService as VaultSettingsServiceAbstraction } from "../../abstractions/vault-settings/vault-settings.service";
|
import { VaultSettingsService as VaultSettingsServiceAbstraction } from "../../abstractions/vault-settings/vault-settings.service";
|
||||||
|
import { CipherType } from "../../enums";
|
||||||
import {
|
import {
|
||||||
SHOW_CARDS_CURRENT_TAB,
|
SHOW_CARDS_CURRENT_TAB,
|
||||||
SHOW_IDENTITIES_CURRENT_TAB,
|
SHOW_IDENTITIES_CURRENT_TAB,
|
||||||
USER_ENABLE_PASSKEYS,
|
USER_ENABLE_PASSKEYS,
|
||||||
CLICK_ITEMS_AUTOFILL_VAULT_VIEW,
|
CLICK_ITEMS_AUTOFILL_VAULT_VIEW,
|
||||||
} from "../key-state/vault-settings.state";
|
} from "../key-state/vault-settings.state";
|
||||||
|
import { RestrictedItemTypesService } from "../restricted-item-types.service";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@link VaultSettingsServiceAbstraction}
|
* {@link VaultSettingsServiceAbstraction}
|
||||||
@@ -27,8 +29,15 @@ export class VaultSettingsService implements VaultSettingsServiceAbstraction {
|
|||||||
/**
|
/**
|
||||||
* {@link VaultSettingsServiceAbstraction.showCardsCurrentTab$}
|
* {@link VaultSettingsServiceAbstraction.showCardsCurrentTab$}
|
||||||
*/
|
*/
|
||||||
readonly showCardsCurrentTab$: Observable<boolean> = this.showCardsCurrentTabState.state$.pipe(
|
readonly showCardsCurrentTab$: Observable<boolean> = combineLatest([
|
||||||
map((x) => x ?? true),
|
this.showCardsCurrentTabState.state$.pipe(map((x) => x ?? true)),
|
||||||
|
this.restrictedItemTypesService.restricted$.pipe(startWith([])),
|
||||||
|
]).pipe(
|
||||||
|
map(
|
||||||
|
([enabled, restrictions]) =>
|
||||||
|
// If enabled, show cards tab unless card type is restricted
|
||||||
|
enabled && !restrictions.some((r) => r.cipherType === CipherType.Card),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
private showIdentitiesCurrentTabState: ActiveUserState<boolean> = this.stateProvider.getActive(
|
private showIdentitiesCurrentTabState: ActiveUserState<boolean> = this.stateProvider.getActive(
|
||||||
@@ -51,7 +60,10 @@ export class VaultSettingsService implements VaultSettingsServiceAbstraction {
|
|||||||
shareReplay({ bufferSize: 1, refCount: false }),
|
shareReplay({ bufferSize: 1, refCount: false }),
|
||||||
);
|
);
|
||||||
|
|
||||||
constructor(private stateProvider: StateProvider) {}
|
constructor(
|
||||||
|
private stateProvider: StateProvider,
|
||||||
|
private restrictedItemTypesService: RestrictedItemTypesService,
|
||||||
|
) {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@link VaultSettingsServiceAbstraction.setShowCardsCurrentTab}
|
* {@link VaultSettingsServiceAbstraction.setShowCardsCurrentTab}
|
||||||
|
|||||||
Reference in New Issue
Block a user