1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-23 19:53:43 +00:00

settings and lock options

This commit is contained in:
Kyle Spearrin
2018-02-10 23:24:22 -05:00
parent 692e5b7dbc
commit 132c59f8fc
14 changed files with 278 additions and 77 deletions

View File

@@ -1,13 +1,46 @@
<div class="modal fade">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-body">
<div class="modal-body form">
<div class="box">
<div class="box-header">
{{'settings' | i18n}}
{{'security' | i18n}}
</div>
<div class="box-content">
Something.
<div class="box-content box-content-padded">
<div class="form-group">
<label for="lockOption">{{'lockOptions' | i18n}}</label>
<select id="lockOption" name="LockOption" [(ngModel)]="lockOption" (change)="save()">
<option *ngFor="let o of lockOptions" [ngValue]="o.value">{{o.name}}</option>
</select>
<small class="help-block">{{'lockOptionsDesc' | i18n}}</small>
</div>
</div>
</div>
<div class="box">
<div class="box-header">
{{'options' | i18n}}
</div>
<div class="box-content box-content-padded">
<div class="form-group">
<div class="checkbox">
<label for="disableGa">
<input id="disableGa" type="checkbox" name="DisableAnalytics"
[(ngModel)]="disableGa" (change)="save()">
{{'disableGa' | i18n}}
</label>
</div>
<small class="help-block">{{'gaDesc' | i18n}}</small>
</div>
<div class="form-group">
<div class="checkbox">
<label for="disableFavicon">
<input id="disableFavicon" type="checkbox" name="DisableFavicon"
[(ngModel)]="disableFavicons" (change)="save()">
{{'disableFavicon' | i18n}}
</label>
</div>
<small class="help-block">{{'disableFaviconDesc' | i18n}}</small>
</div>
</div>
</div>
</div>

View File

@@ -9,21 +9,50 @@ import { ToasterService } from 'angular2-toaster';
import { Angulartics2 } from 'angulartics2';
import { I18nService } from 'jslib/abstractions/i18n.service';
import { LockService } from 'jslib/abstractions/lock.service';
import { PlatformUtilsService } from 'jslib/abstractions/platformUtils.service';
import { StorageService } from 'jslib/abstractions/storage.service';
import { ConstantsService } from 'jslib/services/constants.service';
@Component({
selector: 'app-settings',
template: template,
})
export class SettingsComponent implements OnInit {
lockOptions: any[];
lockOption: number = null;
disableGa: boolean = false;
disableFavicons: boolean = false;
constructor(private analytics: Angulartics2, private toasterService: ToasterService,
private i18nService: I18nService, private platformUtilsService: PlatformUtilsService) { }
ngOnInit() {
private i18nService: I18nService, private platformUtilsService: PlatformUtilsService,
private storageService: StorageService, private lockService: LockService) {
this.lockOptions = [
// { name: i18nService.t('immediately'), value: 0 },
{ name: i18nService.t('oneMinute'), value: 1 },
{ name: i18nService.t('fiveMinutes'), value: 5 },
{ name: i18nService.t('fifteenMinutes'), value: 15 },
{ name: i18nService.t('thirtyMinutes'), value: 30 },
{ name: i18nService.t('oneHour'), value: 60 },
{ name: i18nService.t('fourHours'), value: 240 },
// { name: i18nService.t('onIdle'), value: -4 },
{ name: i18nService.t('onSleep'), value: -3 },
// { name: i18nService.t('onLocked'), value: -2 },
{ name: i18nService.t('onRestart'), value: -1 },
{ name: i18nService.t('never'), value: null },
];
}
submit() {
async ngOnInit() {
this.lockOption = await this.storageService.get<number>(ConstantsService.lockOptionKey);
this.disableGa = await this.storageService.get<boolean>(ConstantsService.disableGaKey);
this.disableFavicons = await this.storageService.get<boolean>(ConstantsService.disableFaviconKey);
}
async save() {
await this.lockService.setLockOption(this.lockOption != null ? this.lockOption : null);
await this.storageService.save(ConstantsService.disableGaKey, this.disableGa);
await this.storageService.save(ConstantsService.disableFaviconKey, this.disableFavicons);
}
}

View File

@@ -7,8 +7,8 @@ import {
import { ToasterModule } from 'angular2-toaster';
import { DesktopMessagingService } from '../../services/desktopMessaging.service';
import { DesktopPlatformUtilsService } from '../../services/desktopPlatformUtils.service';
import { DesktopRendererMessagingService } from '../../services/desktopRendererMessaging.service';
import { DesktopSecureStorageService } from '../../services/desktopSecureStorage.service';
import { DesktopStorageService } from '../../services/desktopStorage.service';
import { I18nService } from '../../services/i18n.service';
@@ -69,7 +69,7 @@ const i18nService = new I18nService(window.navigator.language, './locales');
const utilsService = new UtilsService();
const platformUtilsService = new DesktopPlatformUtilsService(i18nService);
const broadcasterService = new BroadcasterService();
const messagingService = new DesktopMessagingService(broadcasterService);
const messagingService = new DesktopRendererMessagingService(broadcasterService);
const storageService: StorageServiceAbstraction = new DesktopStorageService();
const secureStorageService: StorageServiceAbstraction = new DesktopSecureStorageService();
const constantsService = new ConstantsService({}, 0);