1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-18 09:13:33 +00:00

avoid chrome refs

This commit is contained in:
Kyle Spearrin
2018-01-11 22:36:22 -05:00
parent 625ae961c4
commit 6b507c9071
2 changed files with 20 additions and 20 deletions

View File

@@ -15,7 +15,7 @@ angular
$urlRouterProvider.otherwise(function ($injector, $location) {
var $state = $injector.get('$state');
if (!chrome.extension.getBackgroundPage()) {
if ((typeof chrome !== 'undefined') && !chrome.extension.getBackgroundPage()) {
$state.go('privateMode');
return;
}
@@ -250,9 +250,8 @@ angular
params: { animation: null }
});
})
.run(function ($trace, $transitions, userService, $state, constantsService, stateService) {
//$trace.enable('TRANSITION');
.run(function ($trace, $transitions, userService, $state, constantsService, stateService,
storageService, messagingService) {
stateService.init();
$transitions.onStart({}, function (trans) {
@@ -265,17 +264,14 @@ angular
}
const userService = trans.injector().get('userService');
const messagingService = trans.injector().get('messagingService');
if (!userService || !messagingService) {
if (!userService) {
return;
}
userService.isAuthenticated().then((isAuthenticated) => {
if (isAuthenticated) {
var obj = {};
obj[constantsService.lastActiveKey] = (new Date()).getTime();
chrome.storage.local.set(obj, function () { });
storageService.save(constantsService.lastActiveKey, (new Date()).getTime());
}
else if (toState.data && toState.data.authorize) {
event.preventDefault();