1
0
mirror of https://github.com/bitwarden/browser synced 2026-02-02 17:53:41 +00:00

Desktop Autotype remove MVP FF

This commit is contained in:
neuronull
2025-12-08 14:09:34 -07:00
parent 32ee9b3c6d
commit 3b5123a985
5 changed files with 28 additions and 56 deletions

View File

@@ -301,12 +301,7 @@ export class SettingsComponent implements OnInit, OnDestroy {
// Autotype is for Windows initially
const isWindows = this.platformUtilsService.getDevice() === DeviceType.WindowsDesktop;
if (isWindows) {
this.configService
.getFeatureFlag$(FeatureFlag.WindowsDesktopAutotype)
.pipe(takeUntil(this.destroy$))
.subscribe((enabled) => {
this.showEnableAutotype = enabled;
});
this.showEnableAutotype = true;
}
this.userHasMasterPassword = await this.userVerificationService.hasMasterPassword();

View File

@@ -8,8 +8,6 @@ import { AccountService } from "@bitwarden/common/auth/abstractions/account.serv
import { AuthService } from "@bitwarden/common/auth/abstractions/auth.service";
import { AuthenticationStatus } from "@bitwarden/common/auth/enums/authentication-status";
import { getUserId } from "@bitwarden/common/auth/services/account.service";
import { FeatureFlag } from "@bitwarden/common/enums/feature-flag.enum";
import { ConfigService } from "@bitwarden/common/platform/abstractions/config/config.service";
@Injectable({ providedIn: "root" })
export class DesktopAutotypeDefaultSettingPolicy {
@@ -17,47 +15,36 @@ export class DesktopAutotypeDefaultSettingPolicy {
private readonly accountService: AccountService,
private readonly authService: AuthService,
private readonly policyService: InternalPolicyService,
private readonly configService: ConfigService,
) {}
/**
* Emits the autotype policy enabled status when account is unlocked and WindowsDesktopAutotype is enabled.
* Emits the autotype policy enabled status when account is unlocked.
* - true: autotype policy exists and is enabled
* - null: no autotype policy exists for the user's organization
*/
readonly autotypeDefaultSetting$: Observable<boolean | null> = this.configService
.getFeatureFlag$(FeatureFlag.WindowsDesktopAutotype)
.pipe(
switchMap((autotypeFeatureEnabled) => {
if (!autotypeFeatureEnabled) {
return of(null);
}
return this.accountService.activeAccount$.pipe(
filter((account) => account != null && account.id != null),
getUserId,
readonly autotypeDefaultSetting$: Observable<boolean | null> =
this.accountService.activeAccount$.pipe(
filter((account) => account != null && account.id != null),
getUserId,
distinctUntilChanged(),
switchMap((userId) => {
const isUnlocked$ = this.authService.authStatusFor$(userId).pipe(
map((status) => status === AuthenticationStatus.Unlocked),
distinctUntilChanged(),
switchMap((userId) => {
const isUnlocked$ = this.authService.authStatusFor$(userId).pipe(
map((status) => status === AuthenticationStatus.Unlocked),
distinctUntilChanged(),
);
const policy$ = this.policyService.policies$(userId).pipe(
map((policies) => {
const autotypePolicy = policies.find(
(policy) => policy.type === PolicyType.AutotypeDefaultSetting && policy.enabled,
);
return autotypePolicy ? true : null;
}),
distinctUntilChanged(),
shareReplay({ bufferSize: 1, refCount: true }),
);
return isUnlocked$.pipe(switchMap((unlocked) => (unlocked ? policy$ : of(null))));
}),
);
const policy$ = this.policyService.policies$(userId).pipe(
map((policies) => {
const autotypePolicy = policies.find(
(policy) => policy.type === PolicyType.AutotypeDefaultSetting && policy.enabled,
);
return autotypePolicy ? true : null;
}),
distinctUntilChanged(),
shareReplay({ bufferSize: 1, refCount: true }),
);
return isUnlocked$.pipe(switchMap((unlocked) => (unlocked ? policy$ : of(null))));
}),
shareReplay({ bufferSize: 1, refCount: true }),
);
}

View File

@@ -5,8 +5,6 @@ import { AuthService } from "@bitwarden/common/auth/abstractions/auth.service";
import { AuthenticationStatus } from "@bitwarden/common/auth/enums/authentication-status";
import { BillingAccountProfileStateService } from "@bitwarden/common/billing/abstractions";
import { DeviceType } from "@bitwarden/common/enums";
import { FeatureFlag } from "@bitwarden/common/enums/feature-flag.enum";
import { ConfigService } from "@bitwarden/common/platform/abstractions/config/config.service";
import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service";
import {
GlobalStateProvider,
@@ -58,7 +56,6 @@ export class DesktopAutotypeService {
private accountService: AccountService,
private authService: AuthService,
private cipherService: CipherService,
private configService: ConfigService,
private globalStateProvider: GlobalStateProvider,
private platformUtilsService: PlatformUtilsService,
private billingAccountProfileStateService: BillingAccountProfileStateService,
@@ -106,7 +103,6 @@ export class DesktopAutotypeService {
// feature should be on or off.
this.resolvedAutotypeEnabled$ = combineLatest([
this.autotypeEnabledState.state$,
this.configService.getFeatureFlag$(FeatureFlag.WindowsDesktopAutotype),
this.accountService.activeAccount$.pipe(
map((activeAccount) => activeAccount?.id),
switchMap((userId) => this.authService.authStatusFor$(userId)),
@@ -119,11 +115,8 @@ export class DesktopAutotypeService {
),
]).pipe(
map(
([autotypeEnabled, windowsDesktopAutotypeFeatureFlag, authStatus, hasPremium]) =>
autotypeEnabled &&
windowsDesktopAutotypeFeatureFlag &&
authStatus == AuthenticationStatus.Unlocked &&
hasPremium,
([autotypeEnabled, authStatus, hasPremium]) =>
autotypeEnabled && authStatus == AuthenticationStatus.Unlocked && hasPremium,
),
);

View File

@@ -1,9 +1,8 @@
import { ChangeDetectionStrategy, Component } from "@angular/core";
import { of } from "rxjs";
import { PolicyType } from "@bitwarden/common/admin-console/enums";
import { Organization } from "@bitwarden/common/admin-console/models/domain/organization";
import { FeatureFlag } from "@bitwarden/common/enums/feature-flag.enum";
import { ConfigService } from "@bitwarden/common/platform/abstractions/config/config.service";
import { SharedModule } from "../../../../shared";
import { BasePolicyEditDefinition, BasePolicyEditComponent } from "../base-policy-edit.component";
@@ -14,8 +13,8 @@ export class DesktopAutotypeDefaultSettingPolicy extends BasePolicyEditDefinitio
type = PolicyType.AutotypeDefaultSetting;
component = DesktopAutotypeDefaultSettingPolicyComponent;
display$(organization: Organization, configService: ConfigService) {
return configService.getFeatureFlag$(FeatureFlag.WindowsDesktopAutotype);
display$(organization: Organization) {
return of(true);
}
}
@Component({

View File

@@ -21,7 +21,6 @@ export enum FeatureFlag {
/* Autofill */
MacOsNativeCredentialSync = "macos-native-credential-sync",
WindowsDesktopAutotype = "windows-desktop-autotype",
/* Billing */
TrialPaymentOptional = "PM-8163-trial-payment",
@@ -102,7 +101,6 @@ export const DefaultFeatureFlagValue = {
/* Autofill */
[FeatureFlag.MacOsNativeCredentialSync]: FALSE,
[FeatureFlag.WindowsDesktopAutotype]: FALSE,
/* Tools */
[FeatureFlag.DesktopSendUIRefresh]: FALSE,