1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-16 08:13:42 +00:00

Feature settings. i18n of notification bar.

This commit is contained in:
Kyle Spearrin
2016-12-30 20:55:59 -05:00
parent 77aca102e6
commit 53cd3d7848
11 changed files with 158 additions and 46 deletions

View File

@@ -139,6 +139,13 @@
data: { authorize: true },
params: { animation: null }
})
.state('features', {
url: '/features',
templateUrl: 'app/settings/views/settingsFeatures.html',
controller: 'settingsFeaturesController',
data: { authorize: true },
params: { animation: null }
})
.state('help', {
url: '/help',
templateUrl: 'app/settings/views/settingsHelp.html',

View File

@@ -4,19 +4,9 @@
.controller('settingsController', function ($scope, loginService, $state, SweetAlert, utilsService, $analytics,
i18nService, constantsService, cryptoService) {
utilsService.initListSectionItemListeners($(document), angular);
$scope.disableGa = false;
$scope.lockOption = '';
$scope.i18n = i18nService;
chrome.storage.local.get(constantsService.disableGaKey, function (obj) {
if (obj && obj[constantsService.disableGaKey]) {
$scope.disableGa = true;
}
else {
$scope.disableGa = false;
}
});
chrome.storage.local.get(constantsService.lockOptionKey, function (obj) {
if (obj && (obj[constantsService.lockOptionKey] || obj[constantsService.lockOptionKey] === 0)) {
$scope.lockOption = obj[constantsService.lockOptionKey].toString();
@@ -121,27 +111,6 @@
}
}
$scope.updateGa = function () {
chrome.storage.local.get(constantsService.disableGaKey, function (obj) {
if (obj[constantsService.disableGaKey]) {
// enable
obj[constantsService.disableGaKey] = false;
}
else {
// disable
$analytics.eventTrack('Disabled Google Analytics');
obj[constantsService.disableGaKey] = true;
}
chrome.storage.local.set(obj, function () {
$scope.disableGa = obj[constantsService.disableGaKey];
if (!obj[constantsService.disableGaKey]) {
$analytics.eventTrack('Enabled Google Analytics');
}
});
});
};
$scope.rate = function () {
$analytics.eventTrack('Rate Extension');

View File

@@ -0,0 +1,68 @@
angular
.module('bit.settings')
.controller('settingsFeaturesController', function ($scope, i18nService, $analytics, constantsService) {
$scope.i18n = i18nService;
$scope.disableGa = false;
$scope.disableAddSiteNotification = false;
chrome.storage.local.get(constantsService.disableGaKey, function (obj) {
if (obj && obj[constantsService.disableGaKey]) {
$scope.disableGa = true;
}
else {
$scope.disableGa = false;
}
});
chrome.storage.local.get(constantsService.disableAddSiteNotificationKey, function (obj) {
if (obj && obj[constantsService.disableAddSiteNotificationKey]) {
$scope.disableAddSiteNotification = true;
}
else {
$scope.disableAddSiteNotification = false;
}
});
$scope.updateGa = function () {
chrome.storage.local.get(constantsService.disableGaKey, function (obj) {
if (obj[constantsService.disableGaKey]) {
// enable
obj[constantsService.disableGaKey] = false;
}
else {
// disable
$analytics.eventTrack('Disabled Google Analytics');
obj[constantsService.disableGaKey] = true;
}
chrome.storage.local.set(obj, function () {
$scope.disableGa = obj[constantsService.disableGaKey];
if (!obj[constantsService.disableGaKey]) {
$analytics.eventTrack('Enabled Google Analytics');
}
});
});
};
$scope.updateAddSiteNotification = function () {
chrome.storage.local.get(constantsService.disableAddSiteNotificationKey, function (obj) {
if (obj[constantsService.disableAddSiteNotificationKey]) {
// enable
obj[constantsService.disableAddSiteNotificationKey] = false;
}
else {
// disable
$analytics.eventTrack('Disabled Add Site Notification');
obj[constantsService.disableAddSiteNotificationKey] = true;
}
chrome.storage.local.set(obj, function () {
$scope.disableAddSiteNotification = obj[constantsService.disableAddSiteNotificationKey];
if (!obj[constantsService.disableAddSiteNotificationKey]) {
$analytics.eventTrack('Enabled Add Site Notification');
}
});
});
};
});

View File

@@ -66,10 +66,10 @@
{{i18n.other}}
</div>
<div class="list-section-items">
<div class="list-section-item list-section-item-checkbox">
<label for="ga">{{i18n.disableGa}}</label>
<input id="ga" type="checkbox" ng-model="disableGa" ng-change="updateGa()">
</div>
<a class="list-section-item" ui-sref="features({animation: 'in-slide-left'})">
{{i18n.features}}
<i class="fa fa-chevron-right fa-lg"></i>
</a>
<a class="list-section-item" ui-sref="about({animation: 'in-slide-left'})">
{{i18n.about}}
<i class="fa fa-chevron-right fa-lg"></i>

View File

@@ -0,0 +1,33 @@
<div class="header">
<div class="left">
<a ui-sref="tabs.settings({animation: 'out-slide-right'})"><i class="fa fa-chevron-left"></i> {{i18n.settings}}</a>
</div>
<div class="title">{{i18n.features}}</div>
</div>
<div class="content">
<div class="list">
<div class="list-section">
<div class="list-section-items">
<div class="list-section-item list-section-item-checkbox">
<label for="ga">{{i18n.disableGa}}</label>
<input id="ga" type="checkbox" ng-model="disableGa" ng-change="updateGa()">
</div>
</div>
<div class="list-section-footer">
{{i18n.gaDesc}}
</div>
</div>
<div class="list-section">
<div class="list-section-items">
<div class="list-section-item list-section-item-checkbox">
<label for="notification-bar">{{i18n.disableAddSiteNotification}}</label>
<input id="notification-bar" type="checkbox" ng-model="disableAddSiteNotification"
ng-change="updateAddSiteNotification()">
</div>
</div>
<div class="list-section-footer">
{{i18n.addSiteNotificationDesc}}
</div>
</div>
</div>
</div>

View File

@@ -73,6 +73,7 @@
<script src="app/settings/settingsHelpController.js"></script>
<script src="app/settings/settingsAboutController.js"></script>
<script src="app/settings/settingsCreditsController.js"></script>
<script src="app/settings/settingsFeaturesController.js"></script>
<script src="app/settings/settingsSyncController.js"></script>
<script src="app/settings/settingsFoldersController.js"></script>
<script src="app/settings/settingsAddFolderController.js"></script>