-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[PM-5560] Implement Autofill Settings state provider (#7767)
* Begin migration of autofill settings Co-authored-by: Cesar Gonzalez <[email protected]> Co-authored-by: Thomas Avery <[email protected]> Co-authored-by: Jonathan Prusik <[email protected]> Co-authored-by: Colton Hurst <[email protected]> * add browser dependency for AutofillSettingsService Co-authored-by: Matt Gibson <[email protected]> * update autofill settings service * replace usages of stateService get/set autofillOnPageLoad with autofillSettingsService * replace usages of stateService get/set autofillOnPageLoadDefault with autofillSettingsService * replace usages of stateService get/set autoCopyTotp with autofillSettingsService * replace usages of stateService get/set autoFillOnPageLoadCalloutIsDismissed with autofillSettingsService * replace usages of stateService get/set activateAutoFillOnPageLoadFromPolicy with autofillSettingsService * replace usages of get/set autoFillOverlayVisibility with autofillSettingsService * inlineMenuVisibility should use global state * add the AutofillSettingsService to background scripts * fix typing * replace additional usages of get/set autoFillOverlayVisibility and disableAutoTotpCopy with autofillSettingsService equivalents * replace additional usages of get/set autofillOnPageLoadDefault with autofillSettingsService equivalent * replace additional usages of get/set activateAutoFillOnPageLoadFromPolicy with autofillSettingsService equivalent * remove additional deprecated and unused state service calls * improve naming conventions and consistency * fix missing mock for policy service test * replace missing overlay background tests * cleanup * fix double inversion * fix reference to wrong setter * move handleActivateAutofillPolicy out of BrowserPolicyService * create state migration script * resolve linting issues * remove migrated setting properties * add AutofillSettingsSErvice to jslib-services * handle conditional content script loading via autofillOnPageLoad check * add deprecated note to getFromLocalStorage * add jsdoc decorators to new autofill service methods * handle undefined globalState * move autofill settings out of BrowserPolicyService * Move autofill settings code out of policyService * fix tests * fix typo in state definition --------- Co-authored-by: Matt Gibson <[email protected]> Co-authored-by: Cesar Gonzalez <[email protected]> Co-authored-by: Thomas Avery <[email protected]> Co-authored-by: Colton Hurst <[email protected]> Co-authored-by: Thomas Rittson <[email protected]>
- Loading branch information
1 parent
bf16682
commit c65e92f
Showing
34 changed files
with
975 additions
and
306 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
apps/browser/src/autofill/background/service_factories/autofill-settings-service.factory.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import { AutofillSettingsService } from "@bitwarden/common/autofill/services/autofill-settings.service"; | ||
|
||
import { | ||
policyServiceFactory, | ||
PolicyServiceInitOptions, | ||
} from "../../../admin-console/background/service-factories/policy-service.factory"; | ||
import { | ||
CachedServices, | ||
factory, | ||
FactoryOptions, | ||
} from "../../../platform/background/service-factories/factory-options"; | ||
import { | ||
stateProviderFactory, | ||
StateProviderInitOptions, | ||
} from "../../../platform/background/service-factories/state-provider.factory"; | ||
|
||
export type AutofillSettingsServiceInitOptions = FactoryOptions & | ||
StateProviderInitOptions & | ||
PolicyServiceInitOptions; | ||
|
||
export function autofillSettingsServiceFactory( | ||
cache: { autofillSettingsService?: AutofillSettingsService } & CachedServices, | ||
opts: AutofillSettingsServiceInitOptions, | ||
): Promise<AutofillSettingsService> { | ||
return factory( | ||
cache, | ||
"autofillSettingsService", | ||
opts, | ||
async () => | ||
new AutofillSettingsService( | ||
await stateProviderFactory(cache, opts), | ||
await policyServiceFactory(cache, opts), | ||
), | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.