From 70bcb723efe7a5e98f859039668d7623d97cf86f Mon Sep 17 00:00:00 2001 From: Victor Woeltjen Date: Fri, 18 Sep 2015 12:13:05 -0700 Subject: [PATCH] [Mobile] Small tweaks/bug fixes Small tweaks/fixes (use appropriate variable names etc) for refactoring mobile support classes. --- platform/commonUI/mobile/src/AgentService.js | 4 ++-- platform/commonUI/mobile/src/MobileBrowseTreeController.js | 5 ++++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/platform/commonUI/mobile/src/AgentService.js b/platform/commonUI/mobile/src/AgentService.js index 1f6fcb63e3..26bb173ee7 100644 --- a/platform/commonUI/mobile/src/AgentService.js +++ b/platform/commonUI/mobile/src/AgentService.js @@ -41,7 +41,7 @@ define( */ function AgentService($window) { var userAgent = $window.navigator.userAgent, - matches = ua.match(/iPad|iPhone|Android/i) || []; + matches = userAgent.match(/iPad|iPhone|Android/i) || []; this.mobileName = matches[0]; this.$window = $window; @@ -79,7 +79,7 @@ define( * @returns {boolean} true in portrait mode */ AgentService.prototype.isPortrait = function () { - return $window.innerWidth < $window.innerHeight; + return this.$window.innerWidth < this.$window.innerHeight; }; /** diff --git a/platform/commonUI/mobile/src/MobileBrowseTreeController.js b/platform/commonUI/mobile/src/MobileBrowseTreeController.js index ca1abeb50a..a88aa63088 100644 --- a/platform/commonUI/mobile/src/MobileBrowseTreeController.js +++ b/platform/commonUI/mobile/src/MobileBrowseTreeController.js @@ -43,7 +43,10 @@ define( } if (agentService.isMobile()) { - navigationService.listen(changeObject); + navigationService.addListener(changeObject); + $scope.$on("$destroy", function () { + navigationService.removeListener(changeObject); + }); } this.state = true;