diff --git a/www/js/controllers/home-controllers.js b/www/js/controllers/home-controllers.js index 9fd0266563150b700507568cbbdfd32451d3c6a9..a2362a37a3905a861e77842cf52f465affecda29 100644 --- a/www/js/controllers/home-controllers.js +++ b/www/js/controllers/home-controllers.js @@ -26,8 +26,8 @@ angular.module('cesium.home.controllers', ['cesium.platform', 'cesium.services'] .controller('HomeCtrl', HomeController) ; -function HomeController($scope, $state, $timeout, $ionicHistory, $translate, $http, $q, UIUtils, BMA, - csConfig, csCache, csPlatform, csCurrency, csSettings, csHttp) { +function HomeController($scope, $state, $timeout, $ionicHistory, $translate, $http, $q, $location, + UIUtils, BMA, csConfig, csCache, csPlatform, csCurrency, csSettings) { 'ngInject'; $scope.loading = true; @@ -179,6 +179,8 @@ function HomeController($scope, $state, $timeout, $ionicHistory, $translate, $ht delete stateParams.uri; delete stateParams.error; + $location.search(stateParams).replace(); + // Update location href $ionicHistory.nextViewOptions({ disableAnimate: true, diff --git a/www/js/platform.js b/www/js/platform.js index 24be8e508242f71aa48bc2f450f00096d46a4113..0ef30a900e2448c9f1eb6f5dcf168e0119bb6a3a 100644 --- a/www/js/platform.js +++ b/www/js/platform.js @@ -275,15 +275,20 @@ angular.module('cesium.platform', ['ngIdle', 'cesium.config', 'cesium.services'] } if (state) { + + var fromHomeState = $state.current && $state.current.name === 'app.home'; + // Open the state, after cleaning current location URI return $state.go(state, stateParams, { reload: true }) .then(function () { - // This is need to make back button working again - return $timeout(function () { - if ($ionicHistory.backView()) $ionicHistory.removeBackView(); - }, 400); + if (fromHomeState) { + // This is need to make back button working again + return $timeout(function () { + if ($ionicHistory.backView()) $ionicHistory.removeBackView(); + }, 400); + } }); } else { console.error("[home] Unknown URI format: " + uri); @@ -311,7 +316,7 @@ angular.module('cesium.platform', ['ngIdle', 'cesium.config', 'cesium.services'] BMA.api.node.on.restart($rootScope, restart, this), // Listen for new intent - Device.api.intent.on.new($rootScope, handleOpenUri, this) + Device.api.intent.on.new($rootScope, openUri, this) ]; }