1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-16 16:23:44 +00:00

utils service. added browser detection method to utils

This commit is contained in:
Kyle Spearrin
2016-09-21 01:17:46 -04:00
parent 9a19acef22
commit 5b1172b8d0
5 changed files with 45 additions and 4 deletions

View File

@@ -30,4 +30,7 @@
})
.factory('passwordGenerationService', function () {
return chrome.extension.getBackgroundPage().passwordGenerationService;
})
.factory('utilsService', function () {
return chrome.extension.getBackgroundPage().utilsService;
});

View File

@@ -1,7 +1,7 @@
angular
.module('bit.settings')
.controller('settingsController', function ($scope, loginService, $state, syncService, SweetAlert) {
.controller('settingsController', function ($scope, loginService, $state, syncService, SweetAlert, utilsService) {
$scope.sync = function () {
syncService.fullSync(function () {
alert('Sync done!');
@@ -65,7 +65,22 @@
}
$scope.rate = function () {
// TODO: detect which extension store to send them to
chrome.tabs.create({ url: 'https://google.com' });
switch (utilsService.getBrowser()) {
case 'chrome':
chrome.tabs.create({ url: 'https://chrome.com' });
break;
case 'firefox':
chrome.tabs.create({ url: 'https://firefox.com' });
break;
case 'edge':
chrome.tabs.create({ url: 'https://microsoft.com' });
break;
case 'opera':
chrome.tabs.create({ url: 'https://opera.com' });
break;
default:
return;
}
};
});