'use strict';
angular.module('Trendicity')

.controller('IntroCtrl', function($scope, $state, $ionicSlideBoxDelegate, $ionicSideMenuDelegate, $ionicHistory, localStorageService, GeolocationService) {

    //** Settings some default scope variables.
    $scope.fetchingPosition = false;
    $scope.noPosition = false;

  // Clear history since this might have been a forced redirect
  $ionicHistory.clearHistory();

  // Mark intro as seen
  //localStorageService.set('seenIntro', true);

  // Called to navigate to the main app
  $scope.startApp = function() {
    $state.go('app.home.map');
  };

  $scope.next = function() {
    $ionicSlideBoxDelegate.next();
  };

  $scope.previous = function() {
    $ionicSlideBoxDelegate.previous();
  };

    $scope.getCurrentPosition = function () {
        $scope.fetchingPosition = true;
        GeolocationService.getCurrentPosition()
            .then(
                function (position) {
                    $scope.next();
                },
                function (fallbackPosition) {
                    // Show error message
                    $scope.noPosition = true;
                }
            )
            ['finally'](function () {
                $scope.fetchingPosition = false;
            });
    };

  // Called each time the slide changes
  $scope.slideChanged = function(index) {
    $scope.slideIndex = index;
  };
});

'use strict';
angular.module('Trendicity')

.controller('IntroCtrl', function($scope, $state, $ionicSlideBoxDelegate, $ionicSideMenuDelegate, $ionicHistory, localStorageService, GeolocationService) {

    //** Settings some default scope variables.
    $scope.fetchingPosition = false;
    $scope.noPosition = false;

  // Clear history since this might have been a forced redirect
  $ionicHistory.clearHistory();

  $scope.$on('$ionicView.beforeEnter', function() {
    $ionicSlideBoxDelegate.refresh();
  });

  // Mark intro as seen
  localStorageService.set('seenIntro', true);

  // Called to navigate to the main app
  $scope.startApp = function() {
    $state.go('app.home.map');
  };

  $scope.next = function() {
    $ionicSlideBoxDelegate.next();
  };

  $scope.previous = function() {
    $ionicSlideBoxDelegate.previous();
  };

    $scope.getCurrentPosition = function () {
        $scope.fetchingPosition = true;
        GeolocationService.getCurrentPosition()
            .then(
                function (position) {
                    $scope.next();
                },
                function (fallbackPosition) {
                    // Show error message
                    $scope.noPosition = true;
                }
            )
            ['finally'](function () {
                $scope.fetchingPosition = false;
            });
    };

  // Called each time the slide changes
  $scope.slideChanged = function(index) {
    $scope.slideIndex = index;
  };
});

Fix issue with About slidebox view needing to be refreshed when coming from map view
Fix issue with About slidebox view needing to be refreshed when coming from map view
