[PM-7562] Add DuckDuckGo back to State Service (#8791)

* Add ddg back to state service

* Remove getters
This commit is contained in:
Robyn MacCallum 2024-04-19 09:45:09 -04:00 committed by GitHub
parent 2916fc7404
commit c1c6afb0f4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 27 additions and 0 deletions

View File

@ -660,6 +660,11 @@ export class SettingsComponent implements OnInit {
this.form.value.enableDuckDuckGoBrowserIntegration,
);
// Adding to cover users on a previous version of DDG
await this.stateService.setEnableDuckDuckGoBrowserIntegration(
this.form.value.enableDuckDuckGoBrowserIntegration,
);
if (!this.form.value.enableBrowserIntegration) {
await this.stateService.setDuckDuckGoSharedKey(null);
}

View File

@ -74,6 +74,13 @@ export abstract class StateService<T extends Account = Account> {
* Used when Lock with MP on Restart is enabled
*/
setPinKeyEncryptedUserKeyEphemeral: (value: EncString, options?: StorageOptions) => Promise<void>;
/**
* @deprecated For backwards compatible purposes only, use DesktopAutofillSettingsService
*/
setEnableDuckDuckGoBrowserIntegration: (
value: boolean,
options?: StorageOptions,
) => Promise<void>;
/**
* @deprecated For migration purposes only, use getUserKeyMasterKey instead
*/

View File

@ -4,4 +4,5 @@ export class GlobalState {
vaultTimeoutAction?: string;
enableBrowserIntegration?: boolean;
enableBrowserIntegrationFingerprint?: boolean;
enableDuckDuckGoBrowserIntegration?: boolean;
}

View File

@ -571,6 +571,20 @@ export class StateService<
);
}
async setEnableDuckDuckGoBrowserIntegration(
value: boolean,
options?: StorageOptions,
): Promise<void> {
const globals = await this.getGlobals(
this.reconcileOptions(options, await this.defaultOnDiskOptions()),
);
globals.enableDuckDuckGoBrowserIntegration = value;
await this.saveGlobals(
globals,
this.reconcileOptions(options, await this.defaultOnDiskOptions()),
);
}
/**
* @deprecated Use UserKey instead
*/