diff --git a/src/popup/settings/options.component.ts b/src/popup/settings/options.component.ts
index 8631792321..c53cc8b7f6 100644
--- a/src/popup/settings/options.component.ts
+++ b/src/popup/settings/options.component.ts
@@ -5,6 +5,8 @@ import {
import { Angulartics2 } from 'angulartics2';
+import { UriMatchType } from 'jslib/enums/uriMatchType';
+
import { I18nService } from 'jslib/abstractions/i18n.service';
import { MessagingService } from 'jslib/abstractions/messaging.service';
import { PlatformUtilsService } from 'jslib/abstractions/platformUtils.service';
@@ -31,16 +33,26 @@ export class OptionsComponent implements OnInit {
disableGa = false;
theme: string;
themeOptions: any[];
+ defaultUriMatch = UriMatchType.Domain;
+ uriMatchOptions: any[];
constructor(private analytics: Angulartics2, private messagingService: MessagingService,
private platformUtilsService: PlatformUtilsService, private storageService: StorageService,
private stateService: StateService, private totpService: TotpService,
- private i18nService: I18nService) {
+ i18nService: I18nService) {
this.themeOptions = [
{ name: i18nService.t('default'), value: null },
{ name: i18nService.t('light'), value: 'light' },
{ name: i18nService.t('dark'), value: 'dark' },
];
+ this.uriMatchOptions = [
+ { name: i18nService.t('baseDomain'), value: UriMatchType.Domain },
+ { name: i18nService.t('host'), value: UriMatchType.Host },
+ { name: i18nService.t('startsWith'), value: UriMatchType.StartsWith },
+ { name: i18nService.t('regEx'), value: UriMatchType.RegularExpression },
+ { name: i18nService.t('exact'), value: UriMatchType.Exact },
+ { name: i18nService.t('never'), value: UriMatchType.Never },
+ ];
}
async ngOnInit() {
@@ -70,6 +82,9 @@ export class OptionsComponent implements OnInit {
this.disableFavicon = await this.storageService.get(ConstantsService.disableFaviconKey);
this.theme = await this.storageService.get(ConstantsService.themeKey);
+
+ const defaultUriMatch = await this.storageService.get(ConstantsService.defaultUriMatch);
+ this.defaultUriMatch = defaultUriMatch == null ? UriMatchType.Domain : defaultUriMatch;
}
async saveGa() {
@@ -135,6 +150,11 @@ export class OptionsComponent implements OnInit {
window.setTimeout(() => window.location.reload(), 200);
}
+ async saveDefaultUriMatch() {
+ await this.storageService.save(ConstantsService.defaultUriMatch, this.defaultUriMatch);
+ this.analytics.eventTrack.next({ action: 'Set Default URI Match ' + this.defaultUriMatch });
+ }
+
private callAnalytics(name: string, enabled: boolean) {
const status = enabled ? 'Enabled' : 'Disabled';
this.analytics.eventTrack.next({ action: `${status} ${name}` });