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

@ -622,5 +622,29 @@
"noneFolder": {
"message": "(none)",
"description": "(none) - this is the folder for uncategorized sites"
},
"features": {
"message": "Features",
"description": "Features"
},
"gaDesc": {
"message": "We use Google Analytics to better learn how the extension is being used so that we can make it better. All data collection is completely anonymous.",
"description": "We use Google Analytics to better learn how the extension is being used so that we can make it better. All data collection is completely anonymous."
},
"disableAddSiteNotification": {
"message": "Disable Add Site Notification",
"description": "Disable Add Site Notification"
},
"addSiteNotificationDesc": {
"message": "The \"Add Site Notification\" automatically prompts you to save new sites to your vault whenever you log into them for the first time.",
"description": "The \"Add Site Notification\" automatically prompts you to save new sites to your vault whenever you log into them for the first time."
},
"notificationAddDesc": {
"message": "Should bitwarden remember this password for you?",
"description": "Should bitwarden remember this password for you?"
},
"notificationAddSave": {
"message": "Yes, Save Now",
"description": "Yes, Save Now"
}
}

View File

@ -3,8 +3,12 @@
formData = [],
barType = null;
chrome.runtime.sendMessage({
command: 'bgCollectPageDetails'
chrome.storage.local.get('disableAddSiteNotification', function (obj) {
if (!obj || !obj['disableAddSiteNotification']) {
chrome.runtime.sendMessage({
command: 'bgCollectPageDetails'
});
}
});
chrome.runtime.onMessage.addListener(function (msg, sender, sendResponse) {

View File

@ -10,13 +10,13 @@
<tbody>
<tr>
<td width="24">
<a href="https://vault.bitwarden.com" target="_blank" title="bitwarden">
<a href="https://vault.bitwarden.com" target="_blank" id="logo-link">
<img id="logo" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAMAAADXqc3KAAAAclBMVEUAAAAzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzOkbymMAAAAJXRSTlMAAQIICQsMGBkaKkJYWWl0dXeMjpWXm6WmtcXM0dPr7fH3+fv9KIjKuwAAAIRJREFUKM/dzUkCgkAMBdHfCArOIypBW4S6/xVdNCqDJ7BWSd4iknKG5ZIkMW4AdzMzs+cI1mG3f4N6ADfqMJR9cFAG2PVhDtsAWQ8igyyAzl3Yw6W9K/YfcAfw8RuUVS1MrlCl+pZ6gM3iAX6mbknR/ikS9XOrBmiWTqOmR05T/SzqLi/Z3CbrA3nnNwAAAABJRU5ErkJggg==" />
</a>
</td>
<td id="content"></td>
<td align="right" width="15">
<a href="#" title="Close" id="close-button">
<a href="#" id="close-button">
<img id="close" alt="X" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA8AAAAPCAMAAAAMCGV4AAAAilBMVEUAAAAzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzORiUCaAAAALXRSTlMAAQMHCCMkJicsLjQ6PEJFUFVYW11fYWlscXR7fIOFi4yOkZSVmqDAw9Pc+/0n8J+EAAAAdElEQVQIHQXBhyLDAABAwUuJVVtqU0Wt9P3/77kzfFwDjD97bGoCxrnfhdtqgnGur4FVNTHOtR3gppoO5vocgKuqegdwWbUG4LDqDsDxrqoHwLJ6vaiewFn1zGn1gvPqEZbVG9u6B052/S0MmxXA0fc+AIB/vAoPdfukIW0AAAAASUVORK5CYII=" />
</a>
</td>
@ -27,9 +27,9 @@
<table class="inner-table" cellpadding="0" cellspacing="0" id="template-add">
<tbody>
<tr>
<td>Should bitwarden remember this password for you?</td>
<td class="add-text"></td>
<td align="right" width="150">
<button class="add-save">Yes, Save Now</button>
<button class="add-save"></button>
</td>
</tr>
</tbody>

View File

@ -1,10 +1,15 @@
$(function () {
var content = document.getElementById('content'),
template_add = document.getElementById('template-add'),
template_alert = document.getElementById('template-alert');
closeButton = $('#close-button');
// i18n
$('#logo-link').attr('title', chrome.i18n.getMessage('appName'));
closeButton.attr('title', chrome.i18n.getMessage('close'));
$('#template-add .add-save').text(chrome.i18n.getMessage('notificationAddSave'));
$('#template-add .add-text').text(chrome.i18n.getMessage('notificationAddDesc'));
if (getQueryVariable('add')) {
setContent(template_add);
setContent(document.getElementById('template-add'));
var add = $('#template-add-clone'),
addButton = $('#template-add-clone .add-save');
@ -17,11 +22,11 @@
});
}
else if (getQueryVariable('info')) {
setContent(template_alert);
setContent(document.getElementById('template-alert'));
$('#template-alert-clone').text(getQueryVariable('info'));
}
$('#close-button').click(function (e) {
closeButton.click(function (e) {
e.preventDefault();
chrome.runtime.sendMessage({
command: 'bgCloseNotificationBar'

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>

View File

@ -1,6 +1,7 @@
function ConstantsService() {
return {
disableGaKey: 'disableGa',
disableAddSiteNotificationKey: 'disableAddSiteNotification',
lockOptionKey: 'lockOption',
lastActiveKey: 'lastActive'
};