mirror of
https://github.com/bitwarden/browser
synced 2025-12-16 16:23:44 +00:00
Upgrade ui-router to 1.0.10 (#345)
* Start upgrading to ui-router 1.0.0 * Remove ui-router event polyfill.
This commit is contained in:
committed by
Kyle Spearrin
parent
7f45fd02c0
commit
c18f5a8076
@@ -14,7 +14,6 @@
|
|||||||
"angular-animate": "1.6.6",
|
"angular-animate": "1.6.6",
|
||||||
"angular-sweetalert": "1.1.2",
|
"angular-sweetalert": "1.1.2",
|
||||||
"angular-toastr": "2.1.1",
|
"angular-toastr": "2.1.1",
|
||||||
"angular-ui-router": "0.4.2",
|
|
||||||
"angulartics": "1.4.0",
|
"angulartics": "1.4.0",
|
||||||
"angulartics-google-analytics": "0.4.0",
|
"angulartics-google-analytics": "0.4.0",
|
||||||
"bootstrap": "3.3.7",
|
"bootstrap": "3.3.7",
|
||||||
@@ -66,6 +65,7 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@types/angular": "^1.6.34",
|
"@types/angular": "^1.6.34",
|
||||||
"@types/chrome": "0.0.51",
|
"@types/chrome": "0.0.51",
|
||||||
"@types/jquery": "^3.2.16"
|
"@types/jquery": "^3.2.16",
|
||||||
|
"@uirouter/angularjs": "^1.0.10"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ require('clipboard');
|
|||||||
require('angular');
|
require('angular');
|
||||||
|
|
||||||
require('angular-animate');
|
require('angular-animate');
|
||||||
require('angular-ui-router');
|
const uiRouter = require('@uirouter/angularjs').default;
|
||||||
require('angular-toastr');
|
require('angular-toastr');
|
||||||
|
|
||||||
require('ngclipboard');
|
require('ngclipboard');
|
||||||
@@ -65,7 +65,7 @@ import { SyncResponse } from '../../models/response/syncResponse';
|
|||||||
|
|
||||||
angular
|
angular
|
||||||
.module('bit', [
|
.module('bit', [
|
||||||
'ui.router',
|
uiRouter,
|
||||||
'ngAnimate',
|
'ngAnimate',
|
||||||
'toastr',
|
'toastr',
|
||||||
'angulartics',
|
'angulartics',
|
||||||
|
|||||||
@@ -265,20 +265,27 @@
|
|||||||
params: { animation: null }
|
params: { animation: null }
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
.run(function ($rootScope, userService, $state, constantsService, stateService) {
|
.run(function ($trace, $transitions, userService, $state, constantsService, stateService) {
|
||||||
|
$trace.enable('TRANSITION');
|
||||||
|
|
||||||
stateService.init();
|
stateService.init();
|
||||||
|
|
||||||
$rootScope.$on('$stateChangeStart', function (event, toState, toParams) {
|
$transitions.onStart({}, function(trans) {
|
||||||
|
const $state = trans.router.stateService;
|
||||||
|
const toState = trans.to();
|
||||||
|
|
||||||
if ($state.current.name.indexOf('tabs.') > -1 && toState.name.indexOf('tabs.') > -1) {
|
if ($state.current.name.indexOf('tabs.') > -1 && toState.name.indexOf('tabs.') > -1) {
|
||||||
stateService.removeState('vault');
|
stateService.removeState('vault');
|
||||||
stateService.removeState('viewFolder');
|
stateService.removeState('viewFolder');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const userService = trans.injector().get('userService');
|
||||||
|
|
||||||
if (!userService) {
|
if (!userService) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
userService.isAuthenticated(function (isAuthenticated) {
|
userService.isAuthenticated((isAuthenticated) => {
|
||||||
if (isAuthenticated) {
|
if (isAuthenticated) {
|
||||||
var obj = {};
|
var obj = {};
|
||||||
obj[constantsService.lastActiveKey] = (new Date()).getTime();
|
obj[constantsService.lastActiveKey] = (new Date()).getTime();
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
angular
|
angular
|
||||||
.module('bit.global')
|
.module('bit.global')
|
||||||
|
|
||||||
.controller('mainController', function ($scope, $state, authService, toastr, i18nService, $analytics, utilsService,
|
.controller('mainController', function ($scope, $transitions, $state, authService, toastr, i18nService, $analytics, utilsService,
|
||||||
$window) {
|
$window) {
|
||||||
var self = this;
|
var self = this;
|
||||||
self.currentYear = new Date().getFullYear();
|
self.currentYear = new Date().getFullYear();
|
||||||
@@ -11,12 +11,13 @@ angular
|
|||||||
self.disableSearch = utilsService && utilsService.isEdge();
|
self.disableSearch = utilsService && utilsService.isEdge();
|
||||||
self.inSidebar = utilsService && utilsService.inSidebar($window);
|
self.inSidebar = utilsService && utilsService.inSidebar($window);
|
||||||
|
|
||||||
$scope.$on('$stateChangeSuccess', function (event, toState, toParams, fromState, fromParams) {
|
$transitions.onSuccess({}, function(transition) {
|
||||||
|
const toParams = transition.params("to");
|
||||||
|
|
||||||
if (toParams.animation) {
|
if (toParams.animation) {
|
||||||
self.animation = toParams.animation;
|
self.animation = toParams.animation;
|
||||||
return;
|
return;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
self.animation = '';
|
self.animation = '';
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user