Autofill: Use UserKeyDefinitions for user-scoped data (#8588)
* Do not clear badge settings on user events * Do not clear default uri match strategy * Use explicit clearOn events for autofill settings
This commit is contained in:
parent
ac84b43782
commit
5fe8f9b76a
|
@ -9,40 +9,46 @@ import {
|
||||||
GlobalState,
|
GlobalState,
|
||||||
KeyDefinition,
|
KeyDefinition,
|
||||||
StateProvider,
|
StateProvider,
|
||||||
|
UserKeyDefinition,
|
||||||
} from "../../platform/state";
|
} from "../../platform/state";
|
||||||
import { ClearClipboardDelay, AutofillOverlayVisibility } from "../constants";
|
import { ClearClipboardDelay, AutofillOverlayVisibility } from "../constants";
|
||||||
import { ClearClipboardDelaySetting, InlineMenuVisibilitySetting } from "../types";
|
import { ClearClipboardDelaySetting, InlineMenuVisibilitySetting } from "../types";
|
||||||
|
|
||||||
const AUTOFILL_ON_PAGE_LOAD = new KeyDefinition(AUTOFILL_SETTINGS_DISK, "autofillOnPageLoad", {
|
const AUTOFILL_ON_PAGE_LOAD = new UserKeyDefinition(AUTOFILL_SETTINGS_DISK, "autofillOnPageLoad", {
|
||||||
deserializer: (value: boolean) => value ?? false,
|
deserializer: (value: boolean) => value ?? false,
|
||||||
|
clearOn: [],
|
||||||
});
|
});
|
||||||
|
|
||||||
const AUTOFILL_ON_PAGE_LOAD_DEFAULT = new KeyDefinition(
|
const AUTOFILL_ON_PAGE_LOAD_DEFAULT = new UserKeyDefinition(
|
||||||
AUTOFILL_SETTINGS_DISK,
|
AUTOFILL_SETTINGS_DISK,
|
||||||
"autofillOnPageLoadDefault",
|
"autofillOnPageLoadDefault",
|
||||||
{
|
{
|
||||||
deserializer: (value: boolean) => value ?? false,
|
deserializer: (value: boolean) => value ?? false,
|
||||||
|
clearOn: [],
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
const AUTOFILL_ON_PAGE_LOAD_CALLOUT_DISMISSED = new KeyDefinition(
|
const AUTOFILL_ON_PAGE_LOAD_CALLOUT_DISMISSED = new UserKeyDefinition(
|
||||||
AUTOFILL_SETTINGS_DISK,
|
AUTOFILL_SETTINGS_DISK,
|
||||||
"autofillOnPageLoadCalloutIsDismissed",
|
"autofillOnPageLoadCalloutIsDismissed",
|
||||||
{
|
{
|
||||||
deserializer: (value: boolean) => value ?? false,
|
deserializer: (value: boolean) => value ?? false,
|
||||||
|
clearOn: [],
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
const AUTOFILL_ON_PAGE_LOAD_POLICY_TOAST_HAS_DISPLAYED = new KeyDefinition(
|
const AUTOFILL_ON_PAGE_LOAD_POLICY_TOAST_HAS_DISPLAYED = new UserKeyDefinition(
|
||||||
AUTOFILL_SETTINGS_DISK,
|
AUTOFILL_SETTINGS_DISK,
|
||||||
"autofillOnPageLoadPolicyToastHasDisplayed",
|
"autofillOnPageLoadPolicyToastHasDisplayed",
|
||||||
{
|
{
|
||||||
deserializer: (value: boolean) => value ?? false,
|
deserializer: (value: boolean) => value ?? false,
|
||||||
|
clearOn: [],
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
const AUTO_COPY_TOTP = new KeyDefinition(AUTOFILL_SETTINGS_DISK, "autoCopyTotp", {
|
const AUTO_COPY_TOTP = new UserKeyDefinition(AUTOFILL_SETTINGS_DISK, "autoCopyTotp", {
|
||||||
deserializer: (value: boolean) => value ?? true,
|
deserializer: (value: boolean) => value ?? true,
|
||||||
|
clearOn: [],
|
||||||
});
|
});
|
||||||
|
|
||||||
const INLINE_MENU_VISIBILITY = new KeyDefinition(
|
const INLINE_MENU_VISIBILITY = new KeyDefinition(
|
||||||
|
@ -57,11 +63,12 @@ const ENABLE_CONTEXT_MENU = new KeyDefinition(AUTOFILL_SETTINGS_DISK, "enableCon
|
||||||
deserializer: (value: boolean) => value ?? true,
|
deserializer: (value: boolean) => value ?? true,
|
||||||
});
|
});
|
||||||
|
|
||||||
const CLEAR_CLIPBOARD_DELAY = new KeyDefinition(
|
const CLEAR_CLIPBOARD_DELAY = new UserKeyDefinition(
|
||||||
AUTOFILL_SETTINGS_DISK_LOCAL,
|
AUTOFILL_SETTINGS_DISK_LOCAL,
|
||||||
"clearClipboardDelay",
|
"clearClipboardDelay",
|
||||||
{
|
{
|
||||||
deserializer: (value: ClearClipboardDelaySetting) => value ?? ClearClipboardDelay.Never,
|
deserializer: (value: ClearClipboardDelaySetting) => value ?? ClearClipboardDelay.Never,
|
||||||
|
clearOn: [],
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -3,12 +3,13 @@ import { map, Observable } from "rxjs";
|
||||||
import {
|
import {
|
||||||
BADGE_SETTINGS_DISK,
|
BADGE_SETTINGS_DISK,
|
||||||
ActiveUserState,
|
ActiveUserState,
|
||||||
KeyDefinition,
|
|
||||||
StateProvider,
|
StateProvider,
|
||||||
|
UserKeyDefinition,
|
||||||
} from "../../platform/state";
|
} from "../../platform/state";
|
||||||
|
|
||||||
const ENABLE_BADGE_COUNTER = new KeyDefinition(BADGE_SETTINGS_DISK, "enableBadgeCounter", {
|
const ENABLE_BADGE_COUNTER = new UserKeyDefinition(BADGE_SETTINGS_DISK, "enableBadgeCounter", {
|
||||||
deserializer: (value: boolean) => value ?? true,
|
deserializer: (value: boolean) => value ?? true,
|
||||||
|
clearOn: [],
|
||||||
});
|
});
|
||||||
|
|
||||||
export abstract class BadgeSettingsServiceAbstraction {
|
export abstract class BadgeSettingsServiceAbstraction {
|
||||||
|
|
|
@ -29,11 +29,12 @@ const EQUIVALENT_DOMAINS = new UserKeyDefinition(DOMAIN_SETTINGS_DISK, "equivale
|
||||||
clearOn: ["logout"],
|
clearOn: ["logout"],
|
||||||
});
|
});
|
||||||
|
|
||||||
const DEFAULT_URI_MATCH_STRATEGY = new KeyDefinition(
|
const DEFAULT_URI_MATCH_STRATEGY = new UserKeyDefinition(
|
||||||
DOMAIN_SETTINGS_DISK,
|
DOMAIN_SETTINGS_DISK,
|
||||||
"defaultUriMatchStrategy",
|
"defaultUriMatchStrategy",
|
||||||
{
|
{
|
||||||
deserializer: (value: UriMatchStrategySetting) => value ?? UriMatchStrategy.Domain,
|
deserializer: (value: UriMatchStrategySetting) => value ?? UriMatchStrategy.Domain,
|
||||||
|
clearOn: [],
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue