mirror of
https://github.com/bitwarden/clients.git
synced 2026-07-04 21:05:54 +08:00
[PM-29526]Remove ts strict ignore in settings autofill component (#19012)
* remove ts strict * explicit null check on handleAdvanceMatch * handle null appropriately in uriMatchOptions * add explicit null checks * clean up code * Update autofill.component.ts
This commit is contained in:
parent
34a4970527
commit
cd2b708982
@ -1,5 +1,3 @@
|
||||
// FIXME: Update this file to be type safe and remove this and next line
|
||||
// @ts-strict-ignore
|
||||
import { CommonModule } from "@angular/common";
|
||||
import { Component, DestroyRef, OnInit } from "@angular/core";
|
||||
import { takeUntilDestroyed } from "@angular/core/rxjs-interop";
|
||||
@ -159,7 +157,7 @@ export class AutofillComponent implements OnInit {
|
||||
clearClipboard!: ClearClipboardDelaySetting;
|
||||
clearClipboardOptions: { name: string; value: ClearClipboardDelaySetting }[];
|
||||
defaultUriMatch: UriMatchStrategySetting = UriMatchStrategy.Domain;
|
||||
uriMatchOptions: { name: string; value: UriMatchStrategySetting; disabled?: boolean }[];
|
||||
uriMatchOptions: { name: string; value: UriMatchStrategySetting | null; disabled?: boolean }[];
|
||||
showCardsCurrentTab: boolean = true;
|
||||
showIdentitiesCurrentTab: boolean = true;
|
||||
/** Non-null asserted. */
|
||||
@ -556,17 +554,26 @@ export class AutofillComponent implements OnInit {
|
||||
const isAdvanced =
|
||||
current === UriMatchStrategy.StartsWith || current === UriMatchStrategy.RegularExpression;
|
||||
if (!valueChange || !isAdvanced) {
|
||||
return await this.domainSettingsService.setDefaultUriMatchStrategy(current);
|
||||
if (current !== null) {
|
||||
await this.domainSettingsService.setDefaultUriMatchStrategy(current);
|
||||
}
|
||||
return;
|
||||
}
|
||||
const contentKey = this.advancedOptionWarningMap[current];
|
||||
if (!contentKey) {
|
||||
return;
|
||||
}
|
||||
AdvancedUriOptionDialogComponent.open(this.dialogService, {
|
||||
contentKey: this.advancedOptionWarningMap[current],
|
||||
contentKey,
|
||||
onContinue: async () => {
|
||||
this.additionalOptionsForm.controls.defaultUriMatch.setValue(current);
|
||||
await this.domainSettingsService.setDefaultUriMatchStrategy(current);
|
||||
},
|
||||
onCancel: async () => {
|
||||
this.additionalOptionsForm.controls.defaultUriMatch.setValue(previous);
|
||||
await this.domainSettingsService.setDefaultUriMatchStrategy(previous);
|
||||
if (previous !== null) {
|
||||
await this.domainSettingsService.setDefaultUriMatchStrategy(previous);
|
||||
}
|
||||
},
|
||||
});
|
||||
}
|
||||
@ -599,7 +606,10 @@ export class AutofillComponent implements OnInit {
|
||||
strategy === UriMatchStrategy.StartsWith ||
|
||||
strategy === UriMatchStrategy.RegularExpression
|
||||
) {
|
||||
hints.push(this.advancedOptionWarningMap[strategy]);
|
||||
const hint = this.advancedOptionWarningMap[strategy];
|
||||
if (hint) {
|
||||
hints.push(hint);
|
||||
}
|
||||
}
|
||||
return hints;
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user