Skip to content
Snippets Groups Projects
Commit 3fe0b473 authored by Benoit Lavenier's avatar Benoit Lavenier
Browse files

[fix] When open page by URI, remove the back view only when = app.home

parent 9a5b5e2e
No related branches found
No related tags found
No related merge requests found
Pipeline #9499 failed
...@@ -26,8 +26,8 @@ angular.module('cesium.home.controllers', ['cesium.platform', 'cesium.services'] ...@@ -26,8 +26,8 @@ angular.module('cesium.home.controllers', ['cesium.platform', 'cesium.services']
.controller('HomeCtrl', HomeController) .controller('HomeCtrl', HomeController)
; ;
function HomeController($scope, $state, $timeout, $ionicHistory, $translate, $http, $q, UIUtils, BMA, function HomeController($scope, $state, $timeout, $ionicHistory, $translate, $http, $q, $location,
csConfig, csCache, csPlatform, csCurrency, csSettings, csHttp) { UIUtils, BMA, csConfig, csCache, csPlatform, csCurrency, csSettings) {
'ngInject'; 'ngInject';
$scope.loading = true; $scope.loading = true;
...@@ -179,6 +179,8 @@ function HomeController($scope, $state, $timeout, $ionicHistory, $translate, $ht ...@@ -179,6 +179,8 @@ function HomeController($scope, $state, $timeout, $ionicHistory, $translate, $ht
delete stateParams.uri; delete stateParams.uri;
delete stateParams.error; delete stateParams.error;
$location.search(stateParams).replace();
// Update location href // Update location href
$ionicHistory.nextViewOptions({ $ionicHistory.nextViewOptions({
disableAnimate: true, disableAnimate: true,
......
...@@ -275,15 +275,20 @@ angular.module('cesium.platform', ['ngIdle', 'cesium.config', 'cesium.services'] ...@@ -275,15 +275,20 @@ angular.module('cesium.platform', ['ngIdle', 'cesium.config', 'cesium.services']
} }
if (state) { if (state) {
var fromHomeState = $state.current && $state.current.name === 'app.home';
// Open the state, after cleaning current location URI // Open the state, after cleaning current location URI
return $state.go(state, stateParams, { return $state.go(state, stateParams, {
reload: true reload: true
}) })
.then(function () { .then(function () {
// This is need to make back button working again if (fromHomeState) {
return $timeout(function () { // This is need to make back button working again
if ($ionicHistory.backView()) $ionicHistory.removeBackView(); return $timeout(function () {
}, 400); if ($ionicHistory.backView()) $ionicHistory.removeBackView();
}, 400);
}
}); });
} else { } else {
console.error("[home] Unknown URI format: " + uri); console.error("[home] Unknown URI format: " + uri);
...@@ -311,7 +316,7 @@ angular.module('cesium.platform', ['ngIdle', 'cesium.config', 'cesium.services'] ...@@ -311,7 +316,7 @@ angular.module('cesium.platform', ['ngIdle', 'cesium.config', 'cesium.services']
BMA.api.node.on.restart($rootScope, restart, this), BMA.api.node.on.restart($rootScope, restart, this),
// Listen for new intent // Listen for new intent
Device.api.intent.on.new($rootScope, handleOpenUri, this) Device.api.intent.on.new($rootScope, openUri, this)
]; ];
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment