cleanup and formatting
This commit is contained in:
parent
78c4ea7ecb
commit
8332e52a7b
|
@ -53,7 +53,7 @@ angular
|
|||
.state('privateMode', {
|
||||
url: '/private-mode',
|
||||
controller: 'privateModeController',
|
||||
template: require('./global/privateMode.html'),
|
||||
template: require('./global/private-mode.html'),
|
||||
data: { authorize: false },
|
||||
params: { animation: null }
|
||||
})
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
export class PrivateModeController implements ng.IController {
|
||||
export class PrivateModeController implements ng.IController {
|
||||
constructor($scope: any) {
|
||||
$scope.privateModeMessage = chrome.i18n.getMessage('privateModeMessage');
|
||||
$scope.learnMoreMessage = chrome.i18n.getMessage('learnMore');
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
export class TabsController implements ng.IController {
|
||||
export class TabsController implements ng.IController {
|
||||
constructor($scope: any, $state: any, i18nService: any) {
|
||||
$scope.$state = $state;
|
||||
$scope.i18n = i18nService;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import * as template from './about.component.html';
|
||||
import * as template from './about.component.html';
|
||||
|
||||
class AboutController {
|
||||
version: string;
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
</div>
|
||||
</div>
|
||||
<div class="list-section-footer">
|
||||
{{$ctrl.i18n.contribute}} <a href="" ng-click="learnMore()">{{$ctrl.i18n.learnMore}}</a>
|
||||
{{$ctrl.i18n.contribute}} <a href="" ng-click="$ctrl.learnMore()">{{$ctrl.i18n.learnMore}}</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import * as template from './credits.component.html';
|
||||
import * as template from './credits.component.html';
|
||||
|
||||
class CreditsController {
|
||||
i18n: any;
|
||||
|
|
|
@ -26,15 +26,13 @@ class EnvironmentController {
|
|||
}
|
||||
|
||||
save() {
|
||||
this.environmentService
|
||||
.setUrls({
|
||||
this.environmentService.setUrls({
|
||||
base: this.baseUrl,
|
||||
api: this.apiUrl,
|
||||
identity: this.identityUrl,
|
||||
webVault: this.webVaultUrl,
|
||||
icons: this.iconsUrl,
|
||||
})
|
||||
.then((resUrls: any) => {
|
||||
}).then((resUrls: any) => {
|
||||
this.$timeout(() => {
|
||||
// re-set urls since service can change them, ex: prefixing https://
|
||||
this.baseUrl = resUrls.base;
|
||||
|
|
|
@ -25,22 +25,23 @@ class FeaturesController {
|
|||
}
|
||||
|
||||
async loadSettings() {
|
||||
this.enableAutoFillOnPageLoad = await this.utilsService
|
||||
.getObjFromStorage<boolean>(this.constantsService.enableAutoFillOnPageLoadKey);
|
||||
this.enableAutoFillOnPageLoad = await this.utilsService.getObjFromStorage<boolean>(
|
||||
this.constantsService.enableAutoFillOnPageLoadKey);
|
||||
|
||||
const disableGa = await this.utilsService.getObjFromStorage<boolean>(this.constantsService.disableGaKey);
|
||||
const disableGa = await this.utilsService.getObjFromStorage<boolean>(
|
||||
this.constantsService.disableGaKey);
|
||||
this.disableGa = disableGa || (this.utilsService.isFirefox() && disableGa === undefined);
|
||||
|
||||
this.disableAddLoginNotification = await this.utilsService
|
||||
.getObjFromStorage<boolean>(this.constantsService.disableAddLoginNotificationKey);
|
||||
this.disableAddLoginNotification = await this.utilsService.getObjFromStorage<boolean>(
|
||||
this.constantsService.disableAddLoginNotificationKey);
|
||||
|
||||
this.disableContextMenuItem = await this.utilsService
|
||||
.getObjFromStorage<boolean>(this.constantsService.disableContextMenuItemKey);
|
||||
this.disableContextMenuItem = await this.utilsService.getObjFromStorage<boolean>(
|
||||
this.constantsService.disableContextMenuItemKey);
|
||||
|
||||
this.disableAutoTotpCopy = !await this.totpService.isAutoCopyEnabled();
|
||||
|
||||
this.disableFavicon = await this.utilsService
|
||||
.getObjFromStorage<boolean>(this.constantsService.disableFaviconKey);
|
||||
this.disableFavicon = await this.utilsService.getObjFromStorage<boolean>(
|
||||
this.constantsService.disableFaviconKey);
|
||||
}
|
||||
|
||||
callAnalytics(name: string, enabled: boolean) {
|
||||
|
@ -49,28 +50,19 @@ class FeaturesController {
|
|||
}
|
||||
|
||||
updateGa() {
|
||||
this.utilsService.saveObjToStorage(
|
||||
this.constantsService.disableGaKey,
|
||||
this.disableGa,
|
||||
);
|
||||
this.utilsService.saveObjToStorage(this.constantsService.disableGaKey, this.disableGa);
|
||||
this.callAnalytics('Analytics', !this.disableGa);
|
||||
}
|
||||
|
||||
updateAddLoginNotification() {
|
||||
this.utilsService.saveObjToStorage(
|
||||
this.constantsService.disableAddLoginNotificationKey,
|
||||
this.disableAddLoginNotification,
|
||||
);
|
||||
this.utilsService.saveObjToStorage(this.constantsService.disableAddLoginNotificationKey,
|
||||
this.disableAddLoginNotification);
|
||||
this.callAnalytics('Add Login Notification', !this.disableAddLoginNotification);
|
||||
}
|
||||
|
||||
updateDisableContextMenuItem() {
|
||||
this.utilsService
|
||||
.saveObjToStorage(
|
||||
this.constantsService.disableContextMenuItemKey,
|
||||
this.disableContextMenuItem,
|
||||
)
|
||||
.then(() => {
|
||||
this.utilsService.saveObjToStorage(this.constantsService.disableContextMenuItemKey,
|
||||
this.disableContextMenuItem).then(() => {
|
||||
chrome.runtime.sendMessage({
|
||||
command: 'bgUpdateContextMenu',
|
||||
});
|
||||
|
@ -79,26 +71,18 @@ class FeaturesController {
|
|||
}
|
||||
|
||||
updateAutoTotpCopy() {
|
||||
this.utilsService.saveObjToStorage(
|
||||
this.constantsService.disableAutoTotpCopyKey,
|
||||
this.disableAutoTotpCopy,
|
||||
);
|
||||
this.utilsService.saveObjToStorage(this.constantsService.disableAutoTotpCopyKey, this.disableAutoTotpCopy);
|
||||
this.callAnalytics('Auto Copy TOTP', !this.disableAutoTotpCopy);
|
||||
}
|
||||
|
||||
updateAutoFillOnPageLoad() {
|
||||
this.utilsService.saveObjToStorage(
|
||||
this.constantsService.enableAutoFillOnPageLoadKey,
|
||||
this.enableAutoFillOnPageLoad,
|
||||
);
|
||||
this.utilsService.saveObjToStorage(this.constantsService.enableAutoFillOnPageLoadKey,
|
||||
this.enableAutoFillOnPageLoad);
|
||||
this.callAnalytics('Auto-fill Page Load', this.enableAutoFillOnPageLoad);
|
||||
}
|
||||
|
||||
updateDisableFavicon() {
|
||||
this.utilsService.saveObjToStorage(
|
||||
this.constantsService.disableFaviconKey,
|
||||
this.disableFavicon,
|
||||
);
|
||||
this.utilsService.saveObjToStorage(this.constantsService.disableFaviconKey, this.disableFavicon);
|
||||
this.stateService.saveState('faviconEnabled', !this.disableFavicon);
|
||||
this.callAnalytics('Favicon', !this.disableFavicon);
|
||||
}
|
||||
|
|
|
@ -26,13 +26,10 @@ class AddFolderController {
|
|||
return;
|
||||
}
|
||||
|
||||
this.savePromise = this.folderService
|
||||
.encrypt(model)
|
||||
.then((folderModel: any) => {
|
||||
this.savePromise = this.folderService.encrypt(model).then((folderModel: any) => {
|
||||
const folder = new Folder(folderModel, true);
|
||||
return this.folderService.saveWithServer(folder);
|
||||
})
|
||||
.then((folder: any) => {
|
||||
}).then((folder: any) => {
|
||||
this.$analytics.eventTrack('Added Folder');
|
||||
this.toastr.success(this.i18nService.addedFolder);
|
||||
this.$state.go('^.list', { animation: 'out-slide-down' });
|
||||
|
|
|
@ -25,10 +25,7 @@ class EditFolderController {
|
|||
|
||||
$onInit() {
|
||||
this.folderId = this.$transition$.params('to').folderId;
|
||||
|
||||
this.folderService
|
||||
.get(this.folderId)
|
||||
.then((folder: any) => {
|
||||
this.folderService.get(this.folderId).then((folder: any) => {
|
||||
return folder.decrypt();
|
||||
}).then((model: Folder) => {
|
||||
this.folder = model;
|
||||
|
@ -41,13 +38,10 @@ class EditFolderController {
|
|||
return;
|
||||
}
|
||||
|
||||
this.savePromise = this.folderService
|
||||
.encrypt(model)
|
||||
.then((folderModel: any) => {
|
||||
this.savePromise = this.folderService.encrypt(model).then((folderModel: any) => {
|
||||
const folder = new Folder(folderModel, true);
|
||||
return this.folderService.saveWithServer(folder);
|
||||
})
|
||||
.then((folder: any) => {
|
||||
}).then((folder: any) => {
|
||||
this.$analytics.eventTrack('Edited Folder');
|
||||
this.toastr.success(this.i18nService.editedFolder);
|
||||
this.$state.go('^.list', { animation: 'out-slide-down' });
|
||||
|
@ -63,9 +57,7 @@ class EditFolderController {
|
|||
cancelButtonText: this.i18nService.no,
|
||||
}, (confirmed: boolean) => {
|
||||
if (confirmed) {
|
||||
this.folderService
|
||||
.deleteWithServer(this.folderId)
|
||||
.then(() => {
|
||||
this.folderService.deleteWithServer(this.folderId).then(() => {
|
||||
this.$analytics.eventTrack('Deleted Folder');
|
||||
this.toastr.success(this.i18nService.deletedFolder);
|
||||
this.$state.go('^.list', {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { Folder } from '../../../../models/domain/folder';
|
||||
import { Folder } from '../../../../models/domain/folder';
|
||||
import * as template from './folders.component.html';
|
||||
|
||||
class FoldersController {
|
||||
|
@ -8,14 +8,11 @@ class FoldersController {
|
|||
|
||||
constructor(private folderService: any, private $state: any, i18nService: any) {
|
||||
this.i18n = i18nService;
|
||||
|
||||
this.load();
|
||||
}
|
||||
|
||||
load() {
|
||||
this.folderService
|
||||
.getAllDecrypted()
|
||||
.then((folders: any) => {
|
||||
this.folderService.getAllDecrypted().then((folders: any) => {
|
||||
if (folders.length > 0 && folders[0].id === null) {
|
||||
// remove the "none" folder
|
||||
this.folders = folders.slice(1);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import * as template from './help.component.html';
|
||||
import * as template from './help.component.html';
|
||||
|
||||
class HelpController {
|
||||
i18n: any;
|
||||
|
|
|
@ -41,7 +41,7 @@
|
|||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<div ng-if="isPremium">
|
||||
<div ng-if="$ctrl.isPremium">
|
||||
<p class="text-center lead">{{$ctrl.i18n.premiumCurrentMember}}</p>
|
||||
<p class="text-center">{{$ctrl.i18n.premiumCurrentMemberThanks}}</p>
|
||||
<div class="bottom-buttons">
|
||||
|
|
|
@ -12,9 +12,7 @@ class PremiumController {
|
|||
}
|
||||
|
||||
refresh() {
|
||||
this.apiService
|
||||
.refreshIdentityToken()
|
||||
.then(() => {
|
||||
this.apiService.refreshIdentityToken().then(() => {
|
||||
this.toastr.success(this.i18nService.refreshComplete);
|
||||
this.$timeout(() => {
|
||||
this.isPremium = this.tokenService.getPremium();
|
||||
|
|
|
@ -77,9 +77,7 @@ class SettingsController {
|
|||
|
||||
lock() {
|
||||
this.$analytics.eventTrack('Lock Now');
|
||||
this.lockService
|
||||
.lock()
|
||||
.then(() => {
|
||||
this.lockService.lock().then(() => {
|
||||
return this.$state.go('lock', {
|
||||
animation: 'in-slide-down',
|
||||
});
|
||||
|
@ -147,7 +145,6 @@ class SettingsController {
|
|||
|
||||
rate() {
|
||||
this.$analytics.eventTrack('Rate Extension');
|
||||
|
||||
chrome.tabs.create({
|
||||
url: RateUrls[this.utilsService.getBrowser()],
|
||||
});
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import * as angular from 'angular';
|
||||
import * as angular from 'angular';
|
||||
import { AboutComponent } from './about.component';
|
||||
import { CreditsComponent } from './credits.component';
|
||||
import { EnvironmentComponent } from './environment.component';
|
||||
|
|
|
@ -7,15 +7,12 @@ class SyncController {
|
|||
|
||||
constructor(private syncService: any, private toastr: any, private $analytics: any, private i18nService: any) {
|
||||
this.i18n = i18nService;
|
||||
|
||||
this.setLastSync();
|
||||
}
|
||||
|
||||
sync() {
|
||||
this.loading = true;
|
||||
this.syncService
|
||||
.fullSync(true)
|
||||
.then((success: boolean) => {
|
||||
this.syncService.fullSync(true).then((success: boolean) => {
|
||||
this.loading = false;
|
||||
if (success) {
|
||||
this.setLastSync();
|
||||
|
@ -28,9 +25,7 @@ class SyncController {
|
|||
}
|
||||
|
||||
setLastSync() {
|
||||
this.syncService
|
||||
.getLastSync()
|
||||
.then((lastSync: any) => {
|
||||
this.syncService.getLastSync().then((lastSync: any) => {
|
||||
if (lastSync) {
|
||||
this.lastSync = lastSync.toLocaleDateString() + ' ' + lastSync.toLocaleTimeString();
|
||||
} else {
|
||||
|
|
Loading…
Reference in New Issue