default match detection setting

This commit is contained in:
Kyle Spearrin 2019-01-09 11:59:14 -05:00
parent 62cd97688e
commit 2a3beacbe0
4 changed files with 41 additions and 2 deletions

2
jslib

@ -1 +1 @@
Subproject commit 65bd33d860f3af71968a15e78491221091c4369e
Subproject commit 2e9ce1571514e2b4ae9ed61a1368b2db03a0ca5d

View File

@ -544,6 +544,13 @@
"disableContextMenuItemDesc": {
"message": "Context menu options provide quick access to password generation and logins for the website in your current tab."
},
"defaultUriMatchDetection": {
"message": "Default URI Match Detection",
"description": "Default URI match detection for auto-fill."
},
"defaultUriMatchDetectionDesc": {
"message": "Choose the default way that URI match detection is handled for logins when performing actions such as auto-fill."
},
"theme": {
"message": "Theme"
},

View File

@ -24,6 +24,18 @@
<b>{{'warning' | i18n}}</b>: {{'experimentalFeature' | i18n}}
</div>
</div>
<div class="box">
<div class="box-content">
<div class="box-content-row" appBoxRow>
<label for="defaultUriMatch">{{'defaultUriMatchDetection' | i18n}}</label>
<select id="defaultUriMatch" name="DefaultUriMatch" [(ngModel)]="defaultUriMatch"
(change)="saveDefaultUriMatch()">
<option *ngFor="let o of uriMatchOptions" [ngValue]="o.value">{{o.name}}</option>
</select>
</div>
</div>
<div class="box-footer">{{'defaultUriMatchDetectionDesc' | i18n}}</div>
</div>
<div class="box">
<div class="box-content">
<div class="box-content-row box-content-row-checkbox" appBoxRow>

View File

@ -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<boolean>(ConstantsService.disableFaviconKey);
this.theme = await this.storageService.get<string>(ConstantsService.themeKey);
const defaultUriMatch = await this.storageService.get<UriMatchType>(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}` });