1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-16 00:03:56 +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

@@ -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');
}
});
});
};
});