1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-29 22:53:44 +00:00

claude: helper function

This commit is contained in:
neuronull
2025-10-29 15:22:23 -06:00
parent 18456c0ff3
commit 39fb94a4fe

View File

@@ -142,8 +142,19 @@ export class DesktopAutotypeService {
)
.subscribe();
this.autotypeFeatureEnabled$
.pipe(
concatMap(async (enabled) => {
ipc.autofill.toggleAutotype(enabled);
}),
takeUntilDestroyed(),
)
.subscribe();
}
private get autotypeFeatureEnabled$(): Observable<boolean> {
// listen for changes in factors that are required for enablement of the feature
combineLatest([
return combineLatest([
// if the user has enabled the setting
this.autotypeEnabledUserSetting$,
// if the feature flag is set
@@ -157,22 +168,16 @@ export class DesktopAutotypeService {
this.billingAccountProfileStateService.hasPremiumFromAnySource$(account.id),
),
),
])
.pipe(
map(
([settingsEnabled, ffEnabled, authStatus, hasPremium]) =>
settingsEnabled &&
ffEnabled &&
authStatus === AuthenticationStatus.Unlocked &&
hasPremium,
),
distinctUntilChanged(), // Only emit when the boolean result changes
concatMap(async (enabled) => {
ipc.autofill.toggleAutotype(enabled);
}),
takeUntilDestroyed(),
)
.subscribe();
]).pipe(
map(
([settingsEnabled, ffEnabled, authStatus, hasPremium]) =>
settingsEnabled &&
ffEnabled &&
authStatus === AuthenticationStatus.Unlocked &&
hasPremium,
),
distinctUntilChanged(), // Only emit when the boolean result changes
);
}
async setAutotypeEnabledState(enabled: boolean): Promise<void> {