'use strict';

var angular = require('angular');
require('../modules');

var module = angular.module('initializeset.services');

module.factory('IntroPageService', function($state, localforage) {
  var _nextAction;
  var services = {
    guidePage: function(nextAction, state) {
      _nextAction = nextAction;
      if (window.localStorage.passIntroPage === 'true') {
        nextAction();
      } else {
        $state.go('initializeset-intro');
        window.localStorage.passIntroPage = 'true';
      }
    },

    firstIntoAppWhenClick: function() {
      _nextAction();
    }
  };

  return services;
});
