From 39fb94a4feee6543adc7e29f0ffe644f31272d66 Mon Sep 17 00:00:00 2001 From: neuronull <9162534+neuronull@users.noreply.github.com> Date: Wed, 29 Oct 2025 15:22:23 -0600 Subject: [PATCH] claude: helper function --- .../services/desktop-autotype.service.ts | 39 +++++++++++-------- 1 file changed, 22 insertions(+), 17 deletions(-) diff --git a/apps/desktop/src/autofill/services/desktop-autotype.service.ts b/apps/desktop/src/autofill/services/desktop-autotype.service.ts index 5de03ac4eb4..0fd38071892 100644 --- a/apps/desktop/src/autofill/services/desktop-autotype.service.ts +++ b/apps/desktop/src/autofill/services/desktop-autotype.service.ts @@ -142,8 +142,19 @@ export class DesktopAutotypeService { ) .subscribe(); + this.autotypeFeatureEnabled$ + .pipe( + concatMap(async (enabled) => { + ipc.autofill.toggleAutotype(enabled); + }), + takeUntilDestroyed(), + ) + .subscribe(); + } + + private get autotypeFeatureEnabled$(): Observable { // 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 {