1
0
mirror of https://github.com/bitwarden/desktop.git synced 2024-11-08 09:32:07 +01: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:
Oscar Hinton 2017-11-02 00:38:30 +01:00 committed by Kyle Spearrin
parent 7f45fd02c0
commit c18f5a8076
4 changed files with 19 additions and 11 deletions

View File

@ -14,7 +14,6 @@
"angular-animate": "1.6.6",
"angular-sweetalert": "1.1.2",
"angular-toastr": "2.1.1",
"angular-ui-router": "0.4.2",
"angulartics": "1.4.0",
"angulartics-google-analytics": "0.4.0",
"bootstrap": "3.3.7",
@ -66,6 +65,7 @@
"dependencies": {
"@types/angular": "^1.6.34",
"@types/chrome": "0.0.51",
"@types/jquery": "^3.2.16"
"@types/jquery": "^3.2.16",
"@uirouter/angularjs": "^1.0.10"
}
}

View File

@ -6,7 +6,7 @@ require('clipboard');
require('angular');
require('angular-animate');
require('angular-ui-router');
const uiRouter = require('@uirouter/angularjs').default;
require('angular-toastr');
require('ngclipboard');
@ -65,7 +65,7 @@ import { SyncResponse } from '../../models/response/syncResponse';
angular
.module('bit', [
'ui.router',
uiRouter,
'ngAnimate',
'toastr',
'angulartics',

View File

@ -265,20 +265,27 @@
params: { animation: null }
});
})
.run(function ($rootScope, userService, $state, constantsService, stateService) {
.run(function ($trace, $transitions, userService, $state, constantsService, stateService) {
$trace.enable('TRANSITION');
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) {
stateService.removeState('vault');
stateService.removeState('viewFolder');
}
const userService = trans.injector().get('userService');
if (!userService) {
return;
}
userService.isAuthenticated(function (isAuthenticated) {
userService.isAuthenticated((isAuthenticated) => {
if (isAuthenticated) {
var obj = {};
obj[constantsService.lastActiveKey] = (new Date()).getTime();

View File

@ -1,7 +1,7 @@
angular
.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) {
var self = this;
self.currentYear = new Date().getFullYear();
@ -11,12 +11,13 @@ angular
self.disableSearch = utilsService && utilsService.isEdge();
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) {
self.animation = toParams.animation;
return;
}
else {
} else {
self.animation = '';
}
});