mirror of
https://github.com/bitwarden/browser
synced 2025-12-15 07:43:35 +00:00
[PM-12345] Add cipher type settings for inline autofill menu (#11260)
* add inline menu identity and card visibility settings state to autofill settings service * add inline menu identity and card visibility settings to autofill settings view component * add inline menu identity and card visibility settings to legacy autofill settings view component * do not show inline menu card and identity visibility settings if inline-menu-positioning-improvements feature flag is off * show card and identity inline menus based on their visibility settings * do not show identities in account creation username/email fields if user setting disallows it * reload local tab settings for inline menu visibility when an inline visibility setting value changes * take out tabSendMessageData call for inline menu visibility sub-settings --------- Co-authored-by: Cesar Gonzalez <cesar.a.gonzalezcs@gmail.com>
This commit is contained in:
@@ -59,6 +59,24 @@ const INLINE_MENU_VISIBILITY = new KeyDefinition(
|
||||
},
|
||||
);
|
||||
|
||||
const SHOW_INLINE_MENU_IDENTITIES = new UserKeyDefinition(
|
||||
AUTOFILL_SETTINGS_DISK,
|
||||
"showInlineMenuIdentities",
|
||||
{
|
||||
deserializer: (value: boolean) => value ?? true,
|
||||
clearOn: [],
|
||||
},
|
||||
);
|
||||
|
||||
const SHOW_INLINE_MENU_CARDS = new UserKeyDefinition(
|
||||
AUTOFILL_SETTINGS_DISK,
|
||||
"showInlineMenuCards",
|
||||
{
|
||||
deserializer: (value: boolean) => value ?? true,
|
||||
clearOn: [],
|
||||
},
|
||||
);
|
||||
|
||||
const ENABLE_CONTEXT_MENU = new KeyDefinition(AUTOFILL_SETTINGS_DISK, "enableContextMenu", {
|
||||
deserializer: (value: boolean) => value ?? true,
|
||||
});
|
||||
@@ -86,6 +104,10 @@ export abstract class AutofillSettingsServiceAbstraction {
|
||||
setAutoCopyTotp: (newValue: boolean) => Promise<void>;
|
||||
inlineMenuVisibility$: Observable<InlineMenuVisibilitySetting>;
|
||||
setInlineMenuVisibility: (newValue: InlineMenuVisibilitySetting) => Promise<void>;
|
||||
showInlineMenuIdentities$: Observable<boolean>;
|
||||
setShowInlineMenuIdentities: (newValue: boolean) => Promise<void>;
|
||||
showInlineMenuCards$: Observable<boolean>;
|
||||
setShowInlineMenuCards: (newValue: boolean) => Promise<void>;
|
||||
enableContextMenu$: Observable<boolean>;
|
||||
setEnableContextMenu: (newValue: boolean) => Promise<void>;
|
||||
clearClipboardDelay$: Observable<ClearClipboardDelaySetting>;
|
||||
@@ -113,6 +135,12 @@ export class AutofillSettingsService implements AutofillSettingsServiceAbstracti
|
||||
private inlineMenuVisibilityState: GlobalState<InlineMenuVisibilitySetting>;
|
||||
readonly inlineMenuVisibility$: Observable<InlineMenuVisibilitySetting>;
|
||||
|
||||
private showInlineMenuIdentitiesState: ActiveUserState<boolean>;
|
||||
readonly showInlineMenuIdentities$: Observable<boolean>;
|
||||
|
||||
private showInlineMenuCardsState: ActiveUserState<boolean>;
|
||||
readonly showInlineMenuCards$: Observable<boolean>;
|
||||
|
||||
private enableContextMenuState: GlobalState<boolean>;
|
||||
readonly enableContextMenu$: Observable<boolean>;
|
||||
|
||||
@@ -157,6 +185,14 @@ export class AutofillSettingsService implements AutofillSettingsServiceAbstracti
|
||||
map((x) => x ?? AutofillOverlayVisibility.Off),
|
||||
);
|
||||
|
||||
this.showInlineMenuIdentitiesState = this.stateProvider.getActive(SHOW_INLINE_MENU_IDENTITIES);
|
||||
this.showInlineMenuIdentities$ = this.showInlineMenuIdentitiesState.state$.pipe(
|
||||
map((x) => x ?? true),
|
||||
);
|
||||
|
||||
this.showInlineMenuCardsState = this.stateProvider.getActive(SHOW_INLINE_MENU_CARDS);
|
||||
this.showInlineMenuCards$ = this.showInlineMenuCardsState.state$.pipe(map((x) => x ?? true));
|
||||
|
||||
this.enableContextMenuState = this.stateProvider.getGlobal(ENABLE_CONTEXT_MENU);
|
||||
this.enableContextMenu$ = this.enableContextMenuState.state$.pipe(map((x) => x ?? true));
|
||||
|
||||
@@ -190,6 +226,14 @@ export class AutofillSettingsService implements AutofillSettingsServiceAbstracti
|
||||
await this.inlineMenuVisibilityState.update(() => newValue);
|
||||
}
|
||||
|
||||
async setShowInlineMenuIdentities(newValue: boolean): Promise<void> {
|
||||
await this.showInlineMenuIdentitiesState.update(() => newValue);
|
||||
}
|
||||
|
||||
async setShowInlineMenuCards(newValue: boolean): Promise<void> {
|
||||
await this.showInlineMenuCardsState.update(() => newValue);
|
||||
}
|
||||
|
||||
async setEnableContextMenu(newValue: boolean): Promise<void> {
|
||||
await this.enableContextMenuState.update(() => newValue);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user