diff --git a/CHANGELOG.md b/CHANGELOG.md index 6dc18d7..27c6add 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ + +### 1.0.2 + +* [BUG] Allow transitions to same state with different parameters + ### 1.0.1 diff --git a/README.md b/README.md index 2f86f25..119e3d6 100644 --- a/README.md +++ b/README.md @@ -229,7 +229,7 @@ Disable native transition for one state (for instance on tabs) # * @param {object} stateOptions default:{} # * @param {object|null} transitionOptions default:null -$ionicNativeTransitions.stateGo('yourState', {}, { +$ionicNativeTransitions.stateGo('yourState', {}, {}, { "type": "slide", "direction": "up", // 'left|right|up|down', default 'left' (which is like 'next') "duration": 1500, // in milliseconds (ms), default 400 diff --git a/bower.json b/bower.json index 122c32f..790db17 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "ionic-native-transitions", - "version": "1.0.1", + "version": "1.0.2", "description": "Native transitions for Ionic applications", "main": [ "dist/ionic-native-transitions.js" diff --git a/dist/ionic-native-transitions.js b/dist/ionic-native-transitions.js index 6a68983..b7d2135 100644 --- a/dist/ionic-native-transitions.js +++ b/dist/ionic-native-transitions.js @@ -2,7 +2,7 @@ * ionic-native-transitions * --- * Native transitions for Ionic applications - * @version: v1.0.1 + * @version: v1.0.2 * @author: shprink * @link: https://github.com/shprink/ionic-native-transitions * @license: MIT @@ -328,10 +328,12 @@ return /******/ (function(modules) { // webpackBootstrap $log.debug('[native transition] cannot change state without a state...'); return; } - if ($state.current.name === state && !stateOptions.reload) { + + if ($state.is(state, stateParams) && !stateOptions.reload) { $log.debug('[native transition] same state transition are not possible'); return; } + unregisterToStateChangeStartEvent(); transition(transitionOptions); return $timeout(function () { diff --git a/dist/ionic-native-transitions.js.map b/dist/ionic-native-transitions.js.map index 02b6d30..6d8d42c 100644 --- a/dist/ionic-native-transitions.js.map +++ b/dist/ionic-native-transitions.js.map @@ -1 +1 @@ -{"version":3,"sources":["webpack:///webpack/universalModuleDefinition","webpack:///webpack/bootstrap 3f7184e5f0f08666e759","webpack:///./lib/index.js","webpack:///./lib/provider.js","webpack:///./lib/nativeSref.js","webpack:///./lib/run.js"],"names":[],"mappings":";;;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD,O;ACVA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,uBAAe;AACf;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;;;;;;;;;ACtCA;;AAEA,QAAO,eAAe,SAAS,cAAc;KACzC,OAAO;;;AAGX,UAAS,uBAAuB,KAAK,EAAE,OAAO,OAAO,IAAI,aAAa,MAAM,EAAE,WAAW;;AAEzF,KAAI,cAAc,oBARG;;AAUrB,KAAI,eAAe,uBAAuB;;AAE1C,KAAI,gBAAgB,oBAXG;;AAavB,KAAI,iBAAiB,uBAAuB;;AAE5C,KAAI,SAAS,oBAdG;;AAgBhB,KAAI,UAAU,uBAAuB;;AAdrC,KAAI,MAAM,QAAQ,OAAO,4BAA4B,CACjD,SACA;;AAGJ,KAAI,UAAU,gBAAc;AAC5B,KAAI,SAAS,2BAAyB;AACtC,KAAI,IAAG;;AAeP,SAAQ,aAbO,MAAM,IAAI;AAczB,QAAO,UAAU,QAAQ,W;;;;;;;;;AC3BzB;;;;;;;;;;;;AAYA;;AAEA,QAAO,eAAe,SAAS,cAAc;KACzC,OAAO;;;AAGX,SAAQ,aANO,YAAY;KACvB;;KAEA,IAAI,UAAU;SACV,oBAAoB;SACpB,sBAAsB;SACtB,oBAAoB;SACpB,mBAAmB;SACnB,qBAAqB;SACjB,IAAI;SACJ,MAAM;SACN,MAAM;SACN,OAAO;;SAEX,oBAAoB;SAChB,MAAM;SACN,WAAW;;SAEf,wBAAwB;SACpB,MAAM;SACN,WAAW;;SAEf,iBAAiB;SACb,UAAU;SACV,gBAAgB;SAChB,UAAU,CAAC;SACX,cAAc,CAA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SAAS;KACjC,IAAI,YAAY,IAAI,MAAM;SACtB;KACJ,IAAI,WAAW,MAAM,UAAU,MAAM,UAAU,KAAK;KACpD,SAAS,IAAI,QAAQ,OAAO,KAAK,MAAM;KACvC,IAAI,CAAC,UAAU,OAAO,WAAW,GAAG,MAAM,IAAI,MAAM,wBAAwB,MAAM;KAClF,OAAO;SACH,OAAO,OAAO;SACd,WAAW,OAAO,MAAM;;;AAShC,QAAO,UAAU,QAAQ,W;;;;;;;;;AClDzB;;;;;;AAMA;;AAEA,QAAO,eAAe,SAAS,cAAc;GAC3C,OAAO;;;AAGT,SAAQ,0FAAO,UAAS,yBAAyB,gBAAgB,eAAe,YAAY;GACxF;;GAEA,eAAe,MAAM,YAAM;KACvB,wBAAwB;;;;AAE/B;AAGD,QAAO,UAAU,QAAQ","file":"ionic-native-transitions.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine(factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"ionicNativeTransitions\"] = factory();\n\telse\n\t\troot[\"ionicNativeTransitions\"] = factory();\n})(this, function() {\nreturn \n\n\n/** WEBPACK FOOTER **\n ** webpack/universalModuleDefinition\n **/"," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId])\n \t\t\treturn installedModules[moduleId].exports;\n\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\texports: {},\n \t\t\tid: moduleId,\n \t\t\tloaded: false\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.loaded = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(0);\n\n\n\n/** WEBPACK FOOTER **\n ** webpack/bootstrap 3f7184e5f0f08666e759\n **/","import Provider from './provider.js';\nimport nativeSref from './nativeSref.js';\nimport Run from './run.js';\n\nlet mod = angular.module('ionic-native-transitions', [\n 'ionic',\n 'ui.router'\n]);\n\nmod.directive('nativeUiSref', nativeSref);\nmod.provider('$ionicNativeTransitions', Provider);\nmod.run(Run);\n\nexport default mod = mod.name;\n\n\n\n/** WEBPACK FOOTER **\n ** ./lib/index.js\n **/","/**\n * @ngdoc service\n * @name ionic-native-transitions.$ionicNativeTransitions\n * @description\n * ionic-native-transitions service\n */\n/**\n * @ngdoc service\n * @name ionic-native-transitions.$ionicNativeTransitionsProvider\n * @description\n * ionic-native-transitions provider\n */\nexport default function () {\n 'ngInject';\n\n let enabled = true,\n $stateChangeStart = null,\n $stateChangeSuccess = null,\n $stateChangeError = null,\n $stateAfterEnter = null,\n oppositeDirections = {\n up: 'down',\n down: 'up',\n left: 'right',\n right: 'left'\n },\n defaultTransition = {\n type: 'slide',\n direction: 'left'\n },\n defaultBackTransition = {\n type: 'slide',\n direction: 'right'\n },\n defaultOptions = {\n duration: 400, // in milliseconds (ms), default 400,\n slowdownfactor: 4, // overlap views (higher number is more) or no overlap (1), default 4\n iosdelay: -1, // ms to wait for the iOS webview to update before animation kicks in, default -1\n androiddelay: -1, // same as above but for Android, default -1\n winphonedelay: -1, // same as above but for Windows Phone, default -1,\n fixedPixelsTop: 0, // the number of pixels of your fixed header, default 0 (iOS and Android)\n fixedPixelsBottom: 0, // the number of pixels of your fixed footer (f.i. a tab bar), default 0 (iOS and Android),\n triggerTransitionEvent: '$ionicView.afterEnter', // internal ionic-native-transitions option\n backInOppositeDirection: false // Disable default back transition and uses the opposite transition to go back\n };\n\n return {\n $get,\n enable,\n setDefaultTransition,\n setDefaultBackTransition,\n setDefaultOptions\n };\n\n /**\n * @ngdoc function\n * @name ionic-native-transitions.$ionicNativeTransitionsProvider#enable\n * @access public\n * @methodOf ionic-native-transitions.$ionicNativeTransitionsProvider\n *\n * @description\n * Overwrite default nativepagetransitions plugin options\n * @param {object} injectedOptions options that will overwrite defaults\n */\n function enable(enabled = true) {\n enable = enabled;\n return this;\n }\n\n /**\n * @ngdoc function\n * @name ionic-native-transitions.$ionicNativeTransitionsProvider#isEnabled\n * @access public\n * @methodOf ionic-native-transitions.$ionicNativeTransitionsProvider\n *\n * @description\n * Is ionic-native-transitions enabled or not?\n */\n /**\n * @ngdoc function\n * @name ionic-native-transitions.$ionicNativeTransitions#isEnabled\n * @access public\n * @methodOf ionic-native-transitions.$ionicNativeTransitions\n *\n * @description\n * Is ionic-native-transitions enabled or not?\n */\n function isEnabled() {\n if (window.cordova && window.plugins && window.plugins.nativepagetransitions) {\n return enable;\n }\n return false;\n }\n\n /**\n * @ngdoc function\n * @name ionic-native-transitions.$ionicNativeTransitionsProvider#setDefaultOptions\n * @access public\n * @methodOf ionic-native-transitions.$ionicNativeTransitionsProvider\n *\n * @description\n * Overwrite default nativepagetransitions plugin options\n * @param {object} injectedOptions options that will overwrite defaults\n */\n function setDefaultOptions(injectedOptions = {}) {\n angular.extend(defaultOptions, injectedOptions);\n return this;\n }\n\n /**\n * @ngdoc function\n * @name ionic-native-transitions.$ionicNativeTransitionsProvider#setDefaultTransition\n * @access public\n * @methodOf ionic-native-transitions.$ionicNativeTransitionsProvider\n *\n * @description\n * Overwrite default transitions\n * @param {object} transitionOptions options that will overwrite defaults\n */\n function setDefaultTransition(transition = {}) {\n angular.extend(defaultTransition, transition);\n return this;\n }\n\n /**\n * @ngdoc function\n * @name ionic-native-transitions.$ionicNativeTransitionsProvider#setDefaultBackTransition\n * @access public\n * @methodOf ionic-native-transitions.$ionicNativeTransitionsProvider\n *\n * @description\n * Overwrite default back transitions\n * @param {object} transitionOptions options that will overwrite defaults\n */\n function setDefaultBackTransition(transition = {}) {\n angular.extend(defaultBackTransition, transition);\n return this;\n }\n\n function $get($log, $ionicConfig, $rootScope, $timeout, $state, $location, $ionicHistory, $ionicPlatform) {\n 'ngInject';\n\n let legacyGoBack, backButtonUnregister;\n\n return {\n init,\n getDefaultOptions,\n enable: enableFromService,\n isEnabled,\n transition,\n registerToRouteEvents,\n unregisterToRouteEvents,\n registerToStateChangeStartEvent,\n unregisterToStateChangeStartEvent,\n disablePendingTransition,\n locationUrl,\n stateGo,\n goBack\n };\n\n\n /**\n * @ngdoc function\n * @name ionic-native-transitions.$ionicNativeTransitions#locationUrl\n * @access public\n * @methodOf ionic-native-transitions.$ionicNativeTransitions\n *\n * @description\n * Call location url and apply a native transition\n * @param {string|null} url default:null\n * @param {object|null} transitionOptions default:null\n */\n function locationUrl(url = null, transitionOptions = null) {\n if (!url) {\n $log.debug('[native transition] cannot change url without url...');\n return;\n }\n unregisterToStateChangeStartEvent();\n var locationPromise = $location.url(url);\n transition(transitionOptions);\n\n return locationPromise;\n }\n\n /**\n * @ngdoc function\n * @name ionic-native-transitions.$ionicNativeTransitions#stateGo\n * @access public\n * @methodOf ionic-native-transitions.$ionicNativeTransitions\n *\n * @description\n * Call state go and apply a native transition\n * @param {string|null} state default:null\n * @param {object} stateParams default:{}\n * @param {object} stateOptions default:{}\n * @param {object|null} transitionOptions default:null\n */\n function stateGo(state = null, stateParams = {}, stateOptions = {}, transitionOptions = null) {\n if (!state) {\n $log.debug('[native transition] cannot change state without a state...');\n return;\n }\n if ($state.current.name === state && !stateOptions.reload) {\n $log.debug('[native transition] same state transition are not possible');\n return;\n }\n unregisterToStateChangeStartEvent();\n transition(transitionOptions);\n return $timeout(() => $state.go(state, stateParams, stateOptions));\n }\n\n /**\n * @ngdoc function\n * @name ionic-native-transitions.$ionicNativeTransitions#enable\n * @access public\n * @methodOf ionic-native-transitions.$ionicNativeTransitions\n *\n * @description\n * enable/disable plugin\n * @param {boolean} enabled\n * @param {boolean} disableIonicTransitions\n * @param {string} ionicTransitionType\n */\n function enableFromService(enabled = true, disableIonicTransitions = true, ionicTransitionType = 'platform') {\n if (enabled && !(window.cordova && window.plugins && window.plugins.nativepagetransitions)) {\n $log.debug('[native transition] is disabled or nativepagetransitions plugin is not present');\n return;\n }\n enable = enabled;\n\n if (enabled) {\n $log.debug('[native transition] enabling plugin');\n if (window.plugins && window.plugins.nativepagetransitions) {\n angular.extend(window.plugins.nativepagetransitions.globalOptions, getDefaultOptions());\n }\n $rootScope.$ionicGoBack = goBack;\n backButtonUnregister = $ionicPlatform.registerBackButtonAction((e, count) => goBack(count), 100);\n registerToRouteEvents();\n } else {\n $log.debug('[native transition] disabling plugin');\n if (typeof arguments[1] === 'undefined') {\n disableIonicTransitions = false;\n }\n $rootScope.$ionicGoBack = legacyGoBack;\n if (angular.isFunction(backButtonUnregister)) {\n backButtonUnregister.call();\n }\n unregisterToRouteEvents();\n }\n\n if (disableIonicTransitions) {\n $log.debug('[native transition] disabling ionic transitions');\n $ionicConfig.views.transition('none');\n } else {\n $log.debug('[native transition] enabling ionic transitions');\n $ionicConfig.views.transition(ionicTransitionType);\n }\n\n return this;\n }\n\n function transition() {\n if (!isEnabled()) {\n return;\n }\n let options = {}\n if (angular.isObject(arguments[0])) {\n options = angular.extend({}, defaultBackTransition, arguments[0])\n } else if (angular.isString(arguments[0])) {\n switch (arguments[0]) {\n case 'back':\n // First we check for state back transition\n if (arguments[2] && getBackStateTransition(arguments[2])) {\n options = getBackStateTransition(arguments[2]);\n console.log('back first', options)\n } // Then we check if the backInOppositeDirection option is enabled\n else if (getDefaultOptions().backInOppositeDirection && arguments[1] && getStateTransition(arguments[1])) {\n options = getStateTransition(arguments[1]);\n if (options.direction) {\n options.direction = oppositeDirections[options.direction];\n }\n console.log('back second', options)\n\n } // otherwise we just use the default transition\n else {\n options = defaultBackTransition;\n console.log('back default', options)\n }\n break;\n }\n } else {\n options = defaultTransition;\n }\n options = angular.copy(options);\n $log.debug('[native transition]', options);\n let type = options.type;\n delete options.type;\n $rootScope.$broadcast('ionicNativeTransitions.beforeTransition');\n window.plugins.nativepagetransitions[type](\n options,\n transitionSuccess.bind(this, getTransitionDuration(options)),\n transitionError.bind(this, getTransitionDuration(options))\n )\n }\n\n function transitionSuccess(duration) {\n setTimeout(() => $rootScope.$broadcast('ionicNativeTransitions.success'), duration);\n }\n\n function transitionError(duration) {\n setTimeout(() => $rootScope.$broadcast('ionicNativeTransitions.error'), duration);\n }\n\n function getTransitionDuration(options) {\n let duration;\n if (options.duration) {\n duration = parseInt(options.duration);\n } else {\n duration = parseInt(getDefaultOptions().duration);\n }\n if (ionic.Platform.isAndroid()) {\n if (options.androiddelay) {\n duration += parseInt(options.androiddelay);\n } else {\n duration += parseInt(getDefaultOptions().androiddelay);\n }\n } else if (ionic.Platform.isIOS()) {\n if (options.iosdelay) {\n duration += parseInt(options.iosdelay);\n } else {\n duration += parseInt(getDefaultOptions().iosdelay);\n }\n } else if (ionic.Platform.isWindowsPhone()) {\n if (options.winphonedelay) {\n duration += parseInt(options.winphonedelay);\n } else {\n duration += parseInt(getDefaultOptions().winphonedelay);\n }\n }\n return duration;\n }\n\n function executePendingTransition() {\n window.plugins.nativepagetransitions.executePendingTransition();\n // $rootScope.$broadcast('ionicNativeTransitions.', executePendingTransition);\n registerToStateChangeStartEvent();\n }\n\n function disablePendingTransition() {\n // If native transition support cancelling transition (> 0.6.4), cancel pending transition\n if (window.plugins && window.plugins.nativepagetransitions && angular.isFunction(window.plugins.nativepagetransitions.cancelPendingTransition)) {\n window.plugins.nativepagetransitions.cancelPendingTransition();\n registerToStateChangeStartEvent();\n } else {\n executePendingTransition();\n }\n }\n\n function registerToRouteEvents() {\n unregisterToRouteEvents();\n registerToStateChangeStartEvent();\n // $stateChangeSuccess = $rootScope.$on('$stateChangeSuccess', executePendingTransition);\n $stateChangeError = $rootScope.$on('$stateChangeError', disablePendingTransition);\n $stateAfterEnter = $rootScope.$on(getDefaultOptions().triggerTransitionEvent, executePendingTransition);\n }\n\n function registerToStateChangeStartEvent() {\n if ($stateChangeStart) {\n return;\n }\n $stateChangeStart = $rootScope.$on('$stateChangeStart', (event, toState, toParams, fromState, fromParams) => {\n let options = null;\n // Abort if event was preventDefault'ed\n if (event.defaultPrevented) {\n return;\n }\n // Disable native transition for this state\n if (toState.nativeTransitions === null) {\n $log.debug('[native transition] transition disabled for this state', toState);\n return;\n }\n options = getStateTransition(toState);\n $log.debug('[native transition] $stateChangeStart', toState, options);\n transition(options);\n });\n }\n\n function getBackStateTransition(state) {\n if (angular.isObject(state.nativeTransitionsBackIOS) && ionic.Platform.isIOS()) {\n return angular.extend({}, state.nativeTransitionsBackIOS);\n } else if (angular.isObject(state.nativeTransitionsBackAndroid) && ionic.Platform.isAndroid()) {\n return angular.extend({}, state.nativeTransitionsBackAndroid);\n } else if (angular.isObject(state.nativeTransitionsBackWindowsPhone) && ionic.Platform.isWindowsPhone()) {\n return angular.extend({}, state.nativeTransitionsBackWindowsPhone);\n } else if (angular.isObject(state.nativeTransitionsBack)) {\n return angular.extend({}, state.nativeTransitionsBack);\n }\n return null;\n }\n\n function getStateTransition(state) {\n if (angular.isObject(state.nativeTransitionsIOS) && ionic.Platform.isIOS()) {\n return angular.extend({}, state.nativeTransitionsIOS);\n } else if (angular.isObject(state.nativeTransitionsAndroid) && ionic.Platform.isAndroid()) {\n return angular.extend({}, state.nativeTransitionsAndroid);\n } else if (angular.isObject(state.nativeTransitionsWindowsPhone) && ionic.Platform.isWindowsPhone()) {\n return angular.extend({}, state.nativeTransitionsWindowsPhone);\n } else if (angular.isObject(state.nativeTransitions)) {\n return angular.extend({}, state.nativeTransitions);\n }\n return null;\n }\n\n function unregisterToStateChangeStartEvent() {\n if ($stateChangeStart && angular.isFunction($stateChangeStart)) {\n $stateChangeStart();\n $stateChangeStart = null;\n }\n }\n\n function unregisterToRouteEvents() {\n if ($stateChangeStart && angular.isFunction($stateChangeStart)) {\n $stateChangeStart();\n $stateChangeStart = null;\n }\n if ($stateChangeSuccess && angular.isFunction($stateChangeSuccess)) {\n $stateChangeSuccess();\n $stateChangeSuccess = null;\n }\n if ($stateChangeError && angular.isFunction($stateChangeError)) {\n $stateChangeError();\n $stateChangeError = null;\n }\n if ($stateAfterEnter && angular.isFunction($stateAfterEnter)) {\n $stateAfterEnter();\n $stateAfterEnter = null;\n }\n }\n\n /**\n * @ngdoc function\n * @name ionic-native-transitions.$ionicNativeTransitions#getDefaultOptions\n * @access public\n * @methodOf ionic-native-transitions.$ionicNativeTransitions\n *\n * @description\n * Get default options\n */\n function getDefaultOptions() {\n return defaultOptions;\n }\n\n /**\n * @ngdoc function\n * @name ionic-native-transitions.$ionicNativeTransitions#init\n * @access public\n * @methodOf ionic-native-transitions.$ionicNativeTransitions\n *\n * @description\n * Init nativepagetransitions plugin\n */\n function init() {\n legacyGoBack = $rootScope.$ionicGoBack;\n if (!isEnabled()) {\n $log.debug('[native transition] The plugin is either disabled or nativepagetransitions plugin by telerik is not present. If you are getting this message in a browser, this is normal behavior, native transitions only work on device.');\n return;\n } else {\n enableFromService();\n }\n }\n\n /**\n * @ngdoc function\n * @name ionic-native-transitions.$ionicNativeTransitions#goBack\n * @access public\n * @methodOf ionic-native-transitions.$ionicNativeTransitions\n * @description Navigate back in the current history stack with a back navigation transition\n * @param {number} backCount - The number of views to go back to. default will be the previous view\n */\n function goBack(backCount) {\n\n if (!$ionicHistory.backView()) {\n // Close the app when no more history\n if (navigator.app) {\n navigator.app.exitApp();\n }\n return;\n }\n if (backCount >= 0) {\n return;\n }\n let stateName = $ionicHistory.backView().stateName;\n\n // Use backCount to find next state only if its defined, else pass as it is to $ionicHistory.goBack\n // which defaults to previous view transition\n // Get current history stack and find the cursor for the new view\n // Based on the new cursor, find the new state to transition to\n if (!!backCount && !isNaN(parseInt(backCount))) {\n let viewHistory = $ionicHistory.viewHistory();\n let currentHistory = viewHistory.histories[$ionicHistory.currentView().historyId];\n let newCursor = currentHistory.cursor + backCount;\n\n // If new cursor is more than the max possible or less than zero, default it to first view in history\n if (newCursor < 0 || newCursor > currentHistory.stack.length) {\n newCursor = 0;\n }\n\n stateName = currentHistory.stack[newCursor].stateName;\n }\n let currentStateTransition = angular.extend({}, $state.current);\n let toStateTransition = angular.extend({}, $state.get(stateName));\n\n unregisterToStateChangeStartEvent();\n if (toStateTransition.nativeTransitionsBack === null) {\n $log.debug('[native transition] transition disabled for this state', toStateTransition);\n return $timeout(() => $ionicHistory.goBack(backCount)).then(() => registerToStateChangeStartEvent());\n }\n $log.debug('nativepagetransitions goBack', backCount, stateName, currentStateTransition, toStateTransition);\n transition('back', currentStateTransition, toStateTransition);\n return $timeout(() => $ionicHistory.goBack(backCount));\n }\n }\n};\n\n\n\n/** WEBPACK FOOTER **\n ** ./lib/provider.js\n **/","export default function($log, $ionicNativeTransitions, $state) {\n 'ngInject';\n\n return {\n controller: controller,\n restrict: 'A',\n scope: false\n };\n\n function controller($scope, $element, $attrs, $state) {\n 'ngInject';\n\n let stateOptions = $scope.$eval($attrs.nativeUiSrefOpts) || {};\n let nativeOptions = null;\n\n $attrs.$observe('nativeOptions', (newOptions) => {\n let evalOptions = $scope.$eval(newOptions);\n nativeOptions = angular.isObject(evalOptions) ? evalOptions : {};\n });\n\n $element.on('click', (event) => {\n let ref = parseStateRef($attrs.nativeUiSref, $state.current.name);\n let params = angular.copy($scope.$eval(ref.paramExpr));\n if (!$ionicNativeTransitions.isEnabled()) {\n $state.go(ref.state, params, stateOptions);\n return;\n }\n\n $ionicNativeTransitions.stateGo(ref.state, params, stateOptions, nativeOptions);\n });\n }\n}\n\nfunction parseStateRef(ref, current) {\n var preparsed = ref.match(/^\\s*({[^}]*})\\s*$/),\n parsed;\n if (preparsed) ref = current + '(' + preparsed[1] + ')';\n parsed = ref.replace(/\\n/g, \" \").match(/^([^(]+?)\\s*(\\((.*)\\))?$/);\n if (!parsed || parsed.length !== 4) throw new Error(\"Invalid state ref '\" + ref + \"'\");\n return {\n state: parsed[1],\n paramExpr: parsed[3] || null\n };\n}\n\n\n\n/** WEBPACK FOOTER **\n ** ./lib/nativeSref.js\n **/","/**\n * @ngdoc service\n * @name ionic-native-transitions.$ionicNativeTransitions\n * @description\n * ionic-native-transitions service\n */\n/**\n * @ngdoc service\n * @name ionic-native-transitions.$ionicNativeTransitionsProvider\n * @description\n * ionic-native-transitions provider\n */\nexport default function($ionicNativeTransitions, $ionicPlatform, $ionicHistory, $rootScope) {\n 'ngInject';\n\n $ionicPlatform.ready(() => {\n $ionicNativeTransitions.init();\n });\n};\n\n\n\n/** WEBPACK FOOTER **\n ** ./lib/run.js\n **/"],"sourceRoot":""} \ No newline at end of file +{"version":3,"sources":["webpack:///webpack/universalModuleDefinition","webpack:///webpack/bootstrap 981b479f64db45a7424b","webpack:///./lib/index.js","webpack:///./lib/provider.js","webpack:///./lib/nativeSref.js","webpack:///./lib/run.js"],"names":[],"mappings":";;;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD,O;ACVA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,uBAAe;AACf;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;;;;;;;;;ACtCA;;AAEA,QAAO,eAAe,SAAS,cAAc;KACzC,OAAO;;;AAGX,UAAS,uBAAuB,KAAK,EAAE,OAAO,OAAO,IAAI,aAAa,MAAM,EAAE,WAAW;;AAEzF,KAAI,cAAc,oBARG;;AAUrB,KAAI,eAAe,uBAAuB;;AAE1C,KAAI,gBAAgB,oBAXG;;AAavB,KAAI,iBAAiB,uBAAuB;;AAE5C,KAAI,SAAS,oBAdG;;AAgBhB,KAAI,UAAU,uBAAuB;;AAdrC,KAAI,MAAM,QAAQ,OAAO,4BAA4B,CACjD,SACA;;AAGJ,KAAI,UAAU,gBAAc;AAC5B,KAAI,SAAS,2BAAyB;AACtC,KAAI,IAA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,OAAO,MAAM,OAAO,qBAAqB;SAC5D,IAAI,gBAAgB;;SAEpB,OAAO,SAAS,iBAAiB,UAAC,YAAe;aAC7C,IAAI,cAAc,OAAO,MAAM;aAC/B,gBAAgB,QAAQ,SAAS,eAAe,cAAc;;;SAGlE,SAAS,GAAG,SAAS,UAAC,OAAU;aAC5B,IAAI,MAAM,cAAc,OAAO,cAAc,OAAO,QAAQ;aAC5D,IAAI,SAAS,QAAQ,KAAK,OAAO,MAAM,IAAI;aAC3C,IAAI,CAAC,wBAAwB,aAAa;iBACtC,OAAO,GAAG,IAAI,OAAO,QAAQ;iBAC7B;;;aAGJ,wBAAwB,QAAQ,IAAI,OAAO,QAAQ,cAAc;;;;;AAK7E,UAAS,cAAc,KAAK,SAAS;KACjC,IAAI,YAAY,IAAI,MAAM;SACtB;KACJ,IAAI,WAAW,MAAM,UAAU,MAAM,UAAU,KAAK;KACpD,SAAS,IAAI,QAAQ,OAAO,KAAK,MAAM;KACvC,IAAI,CAAC,UAAU,OAAO,WAAW,GAAG,MAAM,IAAI,MAAM,wBAAwB,MAAM;KAClF,OAAO;SACH,OAAO,OAAO;SACd,WAAW,OAAO,MAAM;;;AAShC,QAAO,UAAU,QAAQ,W;;;;;;;;;AClDzB;;;;;;AAMA;;AAEA,QAAO,eAAe,SAAS,cAAc;GAC3C,OAAO;;;AAGT,SAAQ,0FAAO,UAAS,yBAAyB,gBAAgB,eAAe,YAAY;GACxF;;GAEA,eAAe,MAAM,YAAM;KACvB,wBAAwB;;;;AAE/B;AAGD,QAAO,UAAU,QAAQ","file":"ionic-native-transitions.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine(factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"ionicNativeTransitions\"] = factory();\n\telse\n\t\troot[\"ionicNativeTransitions\"] = factory();\n})(this, function() {\nreturn \n\n\n/** WEBPACK FOOTER **\n ** webpack/universalModuleDefinition\n **/"," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId])\n \t\t\treturn installedModules[moduleId].exports;\n\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\texports: {},\n \t\t\tid: moduleId,\n \t\t\tloaded: false\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.loaded = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(0);\n\n\n\n/** WEBPACK FOOTER **\n ** webpack/bootstrap 981b479f64db45a7424b\n **/","import Provider from './provider.js';\nimport nativeSref from './nativeSref.js';\nimport Run from './run.js';\n\nlet mod = angular.module('ionic-native-transitions', [\n 'ionic',\n 'ui.router'\n]);\n\nmod.directive('nativeUiSref', nativeSref);\nmod.provider('$ionicNativeTransitions', Provider);\nmod.run(Run);\n\nexport default mod = mod.name;\n\n\n\n/** WEBPACK FOOTER **\n ** ./lib/index.js\n **/","/**\n * @ngdoc service\n * @name ionic-native-transitions.$ionicNativeTransitions\n * @description\n * ionic-native-transitions service\n */\n/**\n * @ngdoc service\n * @name ionic-native-transitions.$ionicNativeTransitionsProvider\n * @description\n * ionic-native-transitions provider\n */\nexport default function () {\n 'ngInject';\n\n let enabled = true,\n $stateChangeStart = null,\n $stateChangeSuccess = null,\n $stateChangeError = null,\n $stateAfterEnter = null,\n oppositeDirections = {\n up: 'down',\n down: 'up',\n left: 'right',\n right: 'left'\n },\n defaultTransition = {\n type: 'slide',\n direction: 'left'\n },\n defaultBackTransition = {\n type: 'slide',\n direction: 'right'\n },\n defaultOptions = {\n duration: 400, // in milliseconds (ms), default 400,\n slowdownfactor: 4, // overlap views (higher number is more) or no overlap (1), default 4\n iosdelay: -1, // ms to wait for the iOS webview to update before animation kicks in, default -1\n androiddelay: -1, // same as above but for Android, default -1\n winphonedelay: -1, // same as above but for Windows Phone, default -1,\n fixedPixelsTop: 0, // the number of pixels of your fixed header, default 0 (iOS and Android)\n fixedPixelsBottom: 0, // the number of pixels of your fixed footer (f.i. a tab bar), default 0 (iOS and Android),\n triggerTransitionEvent: '$ionicView.afterEnter', // internal ionic-native-transitions option\n backInOppositeDirection: false // Disable default back transition and uses the opposite transition to go back\n };\n\n return {\n $get,\n enable,\n setDefaultTransition,\n setDefaultBackTransition,\n setDefaultOptions\n };\n\n /**\n * @ngdoc function\n * @name ionic-native-transitions.$ionicNativeTransitionsProvider#enable\n * @access public\n * @methodOf ionic-native-transitions.$ionicNativeTransitionsProvider\n *\n * @description\n * Overwrite default nativepagetransitions plugin options\n * @param {object} injectedOptions options that will overwrite defaults\n */\n function enable(enabled = true) {\n enable = enabled;\n return this;\n }\n\n /**\n * @ngdoc function\n * @name ionic-native-transitions.$ionicNativeTransitionsProvider#isEnabled\n * @access public\n * @methodOf ionic-native-transitions.$ionicNativeTransitionsProvider\n *\n * @description\n * Is ionic-native-transitions enabled or not?\n */\n /**\n * @ngdoc function\n * @name ionic-native-transitions.$ionicNativeTransitions#isEnabled\n * @access public\n * @methodOf ionic-native-transitions.$ionicNativeTransitions\n *\n * @description\n * Is ionic-native-transitions enabled or not?\n */\n function isEnabled() {\n if (window.cordova && window.plugins && window.plugins.nativepagetransitions) {\n return enable;\n }\n return false;\n }\n\n /**\n * @ngdoc function\n * @name ionic-native-transitions.$ionicNativeTransitionsProvider#setDefaultOptions\n * @access public\n * @methodOf ionic-native-transitions.$ionicNativeTransitionsProvider\n *\n * @description\n * Overwrite default nativepagetransitions plugin options\n * @param {object} injectedOptions options that will overwrite defaults\n */\n function setDefaultOptions(injectedOptions = {}) {\n angular.extend(defaultOptions, injectedOptions);\n return this;\n }\n\n /**\n * @ngdoc function\n * @name ionic-native-transitions.$ionicNativeTransitionsProvider#setDefaultTransition\n * @access public\n * @methodOf ionic-native-transitions.$ionicNativeTransitionsProvider\n *\n * @description\n * Overwrite default transitions\n * @param {object} transitionOptions options that will overwrite defaults\n */\n function setDefaultTransition(transition = {}) {\n angular.extend(defaultTransition, transition);\n return this;\n }\n\n /**\n * @ngdoc function\n * @name ionic-native-transitions.$ionicNativeTransitionsProvider#setDefaultBackTransition\n * @access public\n * @methodOf ionic-native-transitions.$ionicNativeTransitionsProvider\n *\n * @description\n * Overwrite default back transitions\n * @param {object} transitionOptions options that will overwrite defaults\n */\n function setDefaultBackTransition(transition = {}) {\n angular.extend(defaultBackTransition, transition);\n return this;\n }\n\n function $get($log, $ionicConfig, $rootScope, $timeout, $state, $location, $ionicHistory, $ionicPlatform) {\n 'ngInject';\n\n let legacyGoBack, backButtonUnregister;\n\n return {\n init,\n getDefaultOptions,\n enable: enableFromService,\n isEnabled,\n transition,\n registerToRouteEvents,\n unregisterToRouteEvents,\n registerToStateChangeStartEvent,\n unregisterToStateChangeStartEvent,\n disablePendingTransition,\n locationUrl,\n stateGo,\n goBack\n };\n\n\n /**\n * @ngdoc function\n * @name ionic-native-transitions.$ionicNativeTransitions#locationUrl\n * @access public\n * @methodOf ionic-native-transitions.$ionicNativeTransitions\n *\n * @description\n * Call location url and apply a native transition\n * @param {string|null} url default:null\n * @param {object|null} transitionOptions default:null\n */\n function locationUrl(url = null, transitionOptions = null) {\n if (!url) {\n $log.debug('[native transition] cannot change url without url...');\n return;\n }\n unregisterToStateChangeStartEvent();\n var locationPromise = $location.url(url);\n transition(transitionOptions);\n\n return locationPromise;\n }\n\n /**\n * @ngdoc function\n * @name ionic-native-transitions.$ionicNativeTransitions#stateGo\n * @access public\n * @methodOf ionic-native-transitions.$ionicNativeTransitions\n *\n * @description\n * Call state go and apply a native transition\n * @param {string|null} state default:null\n * @param {object} stateParams default:{}\n * @param {object} stateOptions default:{}\n * @param {object|null} transitionOptions default:null\n */\n function stateGo(state = null, stateParams = {}, stateOptions = {}, transitionOptions = null) {\n if (!state) {\n $log.debug('[native transition] cannot change state without a state...');\n return;\n }\n\n if ($state.is(state, stateParams) && !stateOptions.reload) {\n $log.debug('[native transition] same state transition are not possible');\n return;\n }\n\n unregisterToStateChangeStartEvent();\n transition(transitionOptions);\n return $timeout(() => $state.go(state, stateParams, stateOptions));\n }\n\n /**\n * @ngdoc function\n * @name ionic-native-transitions.$ionicNativeTransitions#enable\n * @access public\n * @methodOf ionic-native-transitions.$ionicNativeTransitions\n *\n * @description\n * enable/disable plugin\n * @param {boolean} enabled\n * @param {boolean} disableIonicTransitions\n * @param {string} ionicTransitionType\n */\n function enableFromService(enabled = true, disableIonicTransitions = true, ionicTransitionType = 'platform') {\n if (enabled && !(window.cordova && window.plugins && window.plugins.nativepagetransitions)) {\n $log.debug('[native transition] is disabled or nativepagetransitions plugin is not present');\n return;\n }\n enable = enabled;\n\n if (enabled) {\n $log.debug('[native transition] enabling plugin');\n if (window.plugins && window.plugins.nativepagetransitions) {\n angular.extend(window.plugins.nativepagetransitions.globalOptions, getDefaultOptions());\n }\n $rootScope.$ionicGoBack = goBack;\n backButtonUnregister = $ionicPlatform.registerBackButtonAction((e, count) => goBack(count), 100);\n registerToRouteEvents();\n } else {\n $log.debug('[native transition] disabling plugin');\n if (typeof arguments[1] === 'undefined') {\n disableIonicTransitions = false;\n }\n $rootScope.$ionicGoBack = legacyGoBack;\n if (angular.isFunction(backButtonUnregister)) {\n backButtonUnregister.call();\n }\n unregisterToRouteEvents();\n }\n\n if (disableIonicTransitions) {\n $log.debug('[native transition] disabling ionic transitions');\n $ionicConfig.views.transition('none');\n } else {\n $log.debug('[native transition] enabling ionic transitions');\n $ionicConfig.views.transition(ionicTransitionType);\n }\n\n return this;\n }\n\n function transition() {\n if (!isEnabled()) {\n return;\n }\n let options = {}\n if (angular.isObject(arguments[0])) {\n options = angular.extend({}, defaultBackTransition, arguments[0])\n } else if (angular.isString(arguments[0])) {\n switch (arguments[0]) {\n case 'back':\n // First we check for state back transition\n if (arguments[2] && getBackStateTransition(arguments[2])) {\n options = getBackStateTransition(arguments[2]);\n console.log('back first', options)\n } // Then we check if the backInOppositeDirection option is enabled\n else if (getDefaultOptions().backInOppositeDirection && arguments[1] && getStateTransition(arguments[1])) {\n options = getStateTransition(arguments[1]);\n if (options.direction) {\n options.direction = oppositeDirections[options.direction];\n }\n console.log('back second', options)\n\n } // otherwise we just use the default transition\n else {\n options = defaultBackTransition;\n console.log('back default', options)\n }\n break;\n }\n } else {\n options = defaultTransition;\n }\n options = angular.copy(options);\n $log.debug('[native transition]', options);\n let type = options.type;\n delete options.type;\n $rootScope.$broadcast('ionicNativeTransitions.beforeTransition');\n window.plugins.nativepagetransitions[type](\n options,\n transitionSuccess.bind(this, getTransitionDuration(options)),\n transitionError.bind(this, getTransitionDuration(options))\n )\n }\n\n function transitionSuccess(duration) {\n setTimeout(() => $rootScope.$broadcast('ionicNativeTransitions.success'), duration);\n }\n\n function transitionError(duration) {\n setTimeout(() => $rootScope.$broadcast('ionicNativeTransitions.error'), duration);\n }\n\n function getTransitionDuration(options) {\n let duration;\n if (options.duration) {\n duration = parseInt(options.duration);\n } else {\n duration = parseInt(getDefaultOptions().duration);\n }\n if (ionic.Platform.isAndroid()) {\n if (options.androiddelay) {\n duration += parseInt(options.androiddelay);\n } else {\n duration += parseInt(getDefaultOptions().androiddelay);\n }\n } else if (ionic.Platform.isIOS()) {\n if (options.iosdelay) {\n duration += parseInt(options.iosdelay);\n } else {\n duration += parseInt(getDefaultOptions().iosdelay);\n }\n } else if (ionic.Platform.isWindowsPhone()) {\n if (options.winphonedelay) {\n duration += parseInt(options.winphonedelay);\n } else {\n duration += parseInt(getDefaultOptions().winphonedelay);\n }\n }\n return duration;\n }\n\n function executePendingTransition() {\n window.plugins.nativepagetransitions.executePendingTransition();\n // $rootScope.$broadcast('ionicNativeTransitions.', executePendingTransition);\n registerToStateChangeStartEvent();\n }\n\n function disablePendingTransition() {\n // If native transition support cancelling transition (> 0.6.4), cancel pending transition\n if (window.plugins && window.plugins.nativepagetransitions && angular.isFunction(window.plugins.nativepagetransitions.cancelPendingTransition)) {\n window.plugins.nativepagetransitions.cancelPendingTransition();\n registerToStateChangeStartEvent();\n } else {\n executePendingTransition();\n }\n }\n\n function registerToRouteEvents() {\n unregisterToRouteEvents();\n registerToStateChangeStartEvent();\n // $stateChangeSuccess = $rootScope.$on('$stateChangeSuccess', executePendingTransition);\n $stateChangeError = $rootScope.$on('$stateChangeError', disablePendingTransition);\n $stateAfterEnter = $rootScope.$on(getDefaultOptions().triggerTransitionEvent, executePendingTransition);\n }\n\n function registerToStateChangeStartEvent() {\n if ($stateChangeStart) {\n return;\n }\n $stateChangeStart = $rootScope.$on('$stateChangeStart', (event, toState, toParams, fromState, fromParams) => {\n let options = null;\n // Abort if event was preventDefault'ed\n if (event.defaultPrevented) {\n return;\n }\n // Disable native transition for this state\n if (toState.nativeTransitions === null) {\n $log.debug('[native transition] transition disabled for this state', toState);\n return;\n }\n options = getStateTransition(toState);\n $log.debug('[native transition] $stateChangeStart', toState, options);\n transition(options);\n });\n }\n\n function getBackStateTransition(state) {\n if (angular.isObject(state.nativeTransitionsBackIOS) && ionic.Platform.isIOS()) {\n return angular.extend({}, state.nativeTransitionsBackIOS);\n } else if (angular.isObject(state.nativeTransitionsBackAndroid) && ionic.Platform.isAndroid()) {\n return angular.extend({}, state.nativeTransitionsBackAndroid);\n } else if (angular.isObject(state.nativeTransitionsBackWindowsPhone) && ionic.Platform.isWindowsPhone()) {\n return angular.extend({}, state.nativeTransitionsBackWindowsPhone);\n } else if (angular.isObject(state.nativeTransitionsBack)) {\n return angular.extend({}, state.nativeTransitionsBack);\n }\n return null;\n }\n\n function getStateTransition(state) {\n if (angular.isObject(state.nativeTransitionsIOS) && ionic.Platform.isIOS()) {\n return angular.extend({}, state.nativeTransitionsIOS);\n } else if (angular.isObject(state.nativeTransitionsAndroid) && ionic.Platform.isAndroid()) {\n return angular.extend({}, state.nativeTransitionsAndroid);\n } else if (angular.isObject(state.nativeTransitionsWindowsPhone) && ionic.Platform.isWindowsPhone()) {\n return angular.extend({}, state.nativeTransitionsWindowsPhone);\n } else if (angular.isObject(state.nativeTransitions)) {\n return angular.extend({}, state.nativeTransitions);\n }\n return null;\n }\n\n function unregisterToStateChangeStartEvent() {\n if ($stateChangeStart && angular.isFunction($stateChangeStart)) {\n $stateChangeStart();\n $stateChangeStart = null;\n }\n }\n\n function unregisterToRouteEvents() {\n if ($stateChangeStart && angular.isFunction($stateChangeStart)) {\n $stateChangeStart();\n $stateChangeStart = null;\n }\n if ($stateChangeSuccess && angular.isFunction($stateChangeSuccess)) {\n $stateChangeSuccess();\n $stateChangeSuccess = null;\n }\n if ($stateChangeError && angular.isFunction($stateChangeError)) {\n $stateChangeError();\n $stateChangeError = null;\n }\n if ($stateAfterEnter && angular.isFunction($stateAfterEnter)) {\n $stateAfterEnter();\n $stateAfterEnter = null;\n }\n }\n\n /**\n * @ngdoc function\n * @name ionic-native-transitions.$ionicNativeTransitions#getDefaultOptions\n * @access public\n * @methodOf ionic-native-transitions.$ionicNativeTransitions\n *\n * @description\n * Get default options\n */\n function getDefaultOptions() {\n return defaultOptions;\n }\n\n /**\n * @ngdoc function\n * @name ionic-native-transitions.$ionicNativeTransitions#init\n * @access public\n * @methodOf ionic-native-transitions.$ionicNativeTransitions\n *\n * @description\n * Init nativepagetransitions plugin\n */\n function init() {\n legacyGoBack = $rootScope.$ionicGoBack;\n if (!isEnabled()) {\n $log.debug('[native transition] The plugin is either disabled or nativepagetransitions plugin by telerik is not present. If you are getting this message in a browser, this is normal behavior, native transitions only work on device.');\n return;\n } else {\n enableFromService();\n }\n }\n\n /**\n * @ngdoc function\n * @name ionic-native-transitions.$ionicNativeTransitions#goBack\n * @access public\n * @methodOf ionic-native-transitions.$ionicNativeTransitions\n * @description Navigate back in the current history stack with a back navigation transition\n * @param {number} backCount - The number of views to go back to. default will be the previous view\n */\n function goBack(backCount) {\n\n if (!$ionicHistory.backView()) {\n // Close the app when no more history\n if (navigator.app) {\n navigator.app.exitApp();\n }\n return;\n }\n if (backCount >= 0) {\n return;\n }\n let stateName = $ionicHistory.backView().stateName;\n\n // Use backCount to find next state only if its defined, else pass as it is to $ionicHistory.goBack\n // which defaults to previous view transition\n // Get current history stack and find the cursor for the new view\n // Based on the new cursor, find the new state to transition to\n if (!!backCount && !isNaN(parseInt(backCount))) {\n let viewHistory = $ionicHistory.viewHistory();\n let currentHistory = viewHistory.histories[$ionicHistory.currentView().historyId];\n let newCursor = currentHistory.cursor + backCount;\n\n // If new cursor is more than the max possible or less than zero, default it to first view in history\n if (newCursor < 0 || newCursor > currentHistory.stack.length) {\n newCursor = 0;\n }\n\n stateName = currentHistory.stack[newCursor].stateName;\n }\n let currentStateTransition = angular.extend({}, $state.current);\n let toStateTransition = angular.extend({}, $state.get(stateName));\n\n unregisterToStateChangeStartEvent();\n if (toStateTransition.nativeTransitionsBack === null) {\n $log.debug('[native transition] transition disabled for this state', toStateTransition);\n return $timeout(() => $ionicHistory.goBack(backCount)).then(() => registerToStateChangeStartEvent());\n }\n $log.debug('nativepagetransitions goBack', backCount, stateName, currentStateTransition, toStateTransition);\n transition('back', currentStateTransition, toStateTransition);\n return $timeout(() => $ionicHistory.goBack(backCount));\n }\n }\n};\n\n\n\n/** WEBPACK FOOTER **\n ** ./lib/provider.js\n **/","export default function($log, $ionicNativeTransitions, $state) {\n 'ngInject';\n\n return {\n controller: controller,\n restrict: 'A',\n scope: false\n };\n\n function controller($scope, $element, $attrs, $state) {\n 'ngInject';\n\n let stateOptions = $scope.$eval($attrs.nativeUiSrefOpts) || {};\n let nativeOptions = null;\n\n $attrs.$observe('nativeOptions', (newOptions) => {\n let evalOptions = $scope.$eval(newOptions);\n nativeOptions = angular.isObject(evalOptions) ? evalOptions : {};\n });\n\n $element.on('click', (event) => {\n let ref = parseStateRef($attrs.nativeUiSref, $state.current.name);\n let params = angular.copy($scope.$eval(ref.paramExpr));\n if (!$ionicNativeTransitions.isEnabled()) {\n $state.go(ref.state, params, stateOptions);\n return;\n }\n\n $ionicNativeTransitions.stateGo(ref.state, params, stateOptions, nativeOptions);\n });\n }\n}\n\nfunction parseStateRef(ref, current) {\n var preparsed = ref.match(/^\\s*({[^}]*})\\s*$/),\n parsed;\n if (preparsed) ref = current + '(' + preparsed[1] + ')';\n parsed = ref.replace(/\\n/g, \" \").match(/^([^(]+?)\\s*(\\((.*)\\))?$/);\n if (!parsed || parsed.length !== 4) throw new Error(\"Invalid state ref '\" + ref + \"'\");\n return {\n state: parsed[1],\n paramExpr: parsed[3] || null\n };\n}\n\n\n\n/** WEBPACK FOOTER **\n ** ./lib/nativeSref.js\n **/","/**\n * @ngdoc service\n * @name ionic-native-transitions.$ionicNativeTransitions\n * @description\n * ionic-native-transitions service\n */\n/**\n * @ngdoc service\n * @name ionic-native-transitions.$ionicNativeTransitionsProvider\n * @description\n * ionic-native-transitions provider\n */\nexport default function($ionicNativeTransitions, $ionicPlatform, $ionicHistory, $rootScope) {\n 'ngInject';\n\n $ionicPlatform.ready(() => {\n $ionicNativeTransitions.init();\n });\n};\n\n\n\n/** WEBPACK FOOTER **\n ** ./lib/run.js\n **/"],"sourceRoot":""} \ No newline at end of file diff --git a/dist/ionic-native-transitions.min.js b/dist/ionic-native-transitions.min.js index 69f1db9..505226c 100644 --- a/dist/ionic-native-transitions.min.js +++ b/dist/ionic-native-transitions.min.js @@ -2,10 +2,10 @@ * ionic-native-transitions * --- * Native transitions for Ionic applications - * @version: v1.0.1 + * @version: v1.0.2 * @author: shprink * @link: https://github.com/shprink/ionic-native-transitions * @license: MIT * */ -!function(n,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):"object"==typeof exports?exports.ionicNativeTransitions=t():n.ionicNativeTransitions=t()}(this,function(){return function(n){function t(e){if(i[e])return i[e].exports;var a=i[e]={exports:{},id:e,loaded:!1};return n[e].call(a.exports,a,a.exports,t),a.loaded=!0,a.exports}var i={};return t.m=n,t.c=i,t.p="",t(0)}([function(n,t,i){"use strict";function e(n){return n&&n.__esModule?n:{"default":n}}Object.defineProperty(t,"__esModule",{value:!0});var a=i(2),r=e(a),o=i(1),s=e(o),u=i(3),l=e(u),c=angular.module("ionic-native-transitions",["ionic","ui.router"]);c.directive("nativeUiSref",s["default"]),c.provider("$ionicNativeTransitions",r["default"]),c.run(l["default"]),t["default"]=c=c.name,n.exports=t["default"]},function(n,t){"use strict";function i(n,t){var i,e=n.match(/^\s*({[^}]*})\s*$/);if(e&&(n=t+"("+e[1]+")"),i=n.replace(/\n/g," ").match(/^([^(]+?)\s*(\((.*)\))?$/),!i||4!==i.length)throw new Error("Invalid state ref '"+n+"'");return{state:i[1],paramExpr:i[3]||null}}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=["$log","$ionicNativeTransitions","$state",function(n,t,e){"ngInject";function a(n,e,a,r){var o=n.$eval(a.nativeUiSrefOpts)||{},s=null;a.$observe("nativeOptions",function(t){var i=n.$eval(t);s=angular.isObject(i)?i:{}}),e.on("click",function(e){var u=i(a.nativeUiSref,r.current.name),l=angular.copy(n.$eval(u.paramExpr));return t.isEnabled()?void t.stateGo(u.state,l,o,s):void r.go(u.state,l,o)})}return a.$inject=["$scope","$element","$attrs","$state"],{controller:a,restrict:"A",scope:!1}}],n.exports=t["default"]},function(n,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=function(){"ngInject";function n(){var t=arguments.length<=0||void 0===arguments[0]?!0:arguments[0];return n=t,this}function t(){return window.cordova&&window.plugins&&window.plugins.nativepagetransitions?n:!1}function i(){var n=arguments.length<=0||void 0===arguments[0]?{}:arguments[0];return angular.extend(v,n),this}function e(){var n=arguments.length<=0||void 0===arguments[0]?{}:arguments[0];return angular.extend(d,n),this}function a(){var n=arguments.length<=0||void 0===arguments[0]?{}:arguments[0];return angular.extend(g,n),this}function r(i,e,a,r,f,p,m,b){function h(){var n=arguments.length<=0||void 0===arguments[0]?null:arguments[0],t=arguments.length<=1||void 0===arguments[1]?null:arguments[1];if(!n)return void i.debug("[native transition] cannot change url without url...");E();var e=p.url(n);return $(t),e}function w(){var n=arguments.length<=0||void 0===arguments[0]?null:arguments[0],t=arguments.length<=1||void 0===arguments[1]?{}:arguments[1],e=arguments.length<=2||void 0===arguments[2]?{}:arguments[2],a=arguments.length<=3||void 0===arguments[3]?null:arguments[3];return n?f.current.name!==n||e.reload?(E(),$(a),r(function(){return f.go(n,t,e)})):void i.debug("[native transition] same state transition are not possible"):void i.debug("[native transition] cannot change state without a state...")}function T(){var t=arguments.length<=0||void 0===arguments[0]?!0:arguments[0],r=arguments.length<=1||void 0===arguments[1]?!0:arguments[1],o=arguments.length<=2||void 0===arguments[2]?"platform":arguments[2];return!t||window.cordova&&window.plugins&&window.plugins.nativepagetransitions?(n=t,t?(i.debug("[native transition] enabling plugin"),window.plugins&&window.plugins.nativepagetransitions&&angular.extend(window.plugins.nativepagetransitions.globalOptions,A()),a.$ionicGoBack=F,C=b.registerBackButtonAction(function(n,t){return F(t)},100),I()):(i.debug("[native transition] disabling plugin"),"undefined"==typeof arguments[1]&&(r=!1),a.$ionicGoBack=W,angular.isFunction(C)&&C.call(),N()),r?(i.debug("[native transition] disabling ionic transitions"),e.views.transition("none")):(i.debug("[native transition] enabling ionic transitions"),e.views.transition(o)),this):void i.debug("[native transition] is disabled or nativepagetransitions plugin is not present")}function $(){if(t()){var n={};if(angular.isObject(arguments[0]))n=angular.extend({},g,arguments[0]);else if(angular.isString(arguments[0]))switch(arguments[0]){case"back":arguments[2]&&B(arguments[2])?(n=B(arguments[2]),console.log("back first",n)):A().backInOppositeDirection&&arguments[1]&&S(arguments[1])?(n=S(arguments[1]),n.direction&&(n.direction=c[n.direction]),console.log("back second",n)):(n=g,console.log("back default",n))}else n=d;n=angular.copy(n),i.debug("[native transition]",n);var e=n.type;delete n.type,a.$broadcast("ionicNativeTransitions.beforeTransition"),window.plugins.nativepagetransitions[e](n,x.bind(this,k(n)),y.bind(this,k(n)))}}function x(n){setTimeout(function(){return a.$broadcast("ionicNativeTransitions.success")},n)}function y(n){setTimeout(function(){return a.$broadcast("ionicNativeTransitions.error")},n)}function k(n){var t=void 0;return t=n.duration?parseInt(n.duration):parseInt(A().duration),ionic.Platform.isAndroid()?t+=n.androiddelay?parseInt(n.androiddelay):parseInt(A().androiddelay):ionic.Platform.isIOS()?t+=n.iosdelay?parseInt(n.iosdelay):parseInt(A().iosdelay):ionic.Platform.isWindowsPhone()&&(t+=n.winphonedelay?parseInt(n.winphonedelay):parseInt(A().winphonedelay)),t}function P(){window.plugins.nativepagetransitions.executePendingTransition(),j()}function O(){window.plugins&&window.plugins.nativepagetransitions&&angular.isFunction(window.plugins.nativepagetransitions.cancelPendingTransition)?(window.plugins.nativepagetransitions.cancelPendingTransition(),j()):P()}function I(){N(),j(),u=a.$on("$stateChangeError",O),l=a.$on(A().triggerTransitionEvent,P)}function j(){o||(o=a.$on("$stateChangeStart",function(n,t,e,a,r){var o=null;if(!n.defaultPrevented){if(null===t.nativeTransitions)return void i.debug("[native transition] transition disabled for this state",t);o=S(t),i.debug("[native transition] $stateChangeStart",t,o),$(o)}}))}function B(n){return angular.isObject(n.nativeTransitionsBackIOS)&&ionic.Platform.isIOS()?angular.extend({},n.nativeTransitionsBackIOS):angular.isObject(n.nativeTransitionsBackAndroid)&&ionic.Platform.isAndroid()?angular.extend({},n.nativeTransitionsBackAndroid):angular.isObject(n.nativeTransitionsBackWindowsPhone)&&ionic.Platform.isWindowsPhone()?angular.extend({},n.nativeTransitionsBackWindowsPhone):angular.isObject(n.nativeTransitionsBack)?angular.extend({},n.nativeTransitionsBack):null}function S(n){return angular.isObject(n.nativeTransitionsIOS)&&ionic.Platform.isIOS()?angular.extend({},n.nativeTransitionsIOS):angular.isObject(n.nativeTransitionsAndroid)&&ionic.Platform.isAndroid()?angular.extend({},n.nativeTransitionsAndroid):angular.isObject(n.nativeTransitionsWindowsPhone)&&ionic.Platform.isWindowsPhone()?angular.extend({},n.nativeTransitionsWindowsPhone):angular.isObject(n.nativeTransitions)?angular.extend({},n.nativeTransitions):null}function E(){o&&angular.isFunction(o)&&(o(),o=null)}function N(){o&&angular.isFunction(o)&&(o(),o=null),s&&angular.isFunction(s)&&(s(),s=null),u&&angular.isFunction(u)&&(u(),u=null),l&&angular.isFunction(l)&&(l(),l=null)}function A(){return v}function _(){return W=a.$ionicGoBack,t()?void T():void i.debug("[native transition] The plugin is either disabled or nativepagetransitions plugin by telerik is not present. If you are getting this message in a browser, this is normal behavior, native transitions only work on device.")}function F(n){if(!m.backView())return void(navigator.app&&navigator.app.exitApp());if(!(n>=0)){var t=m.backView().stateName;if(n&&!isNaN(parseInt(n))){var e=m.viewHistory(),a=e.histories[m.currentView().historyId],o=a.cursor+n;(0>o||o>a.stack.length)&&(o=0),t=a.stack[o].stateName}var s=angular.extend({},f.current),u=angular.extend({},f.get(t));return E(),null===u.nativeTransitionsBack?(i.debug("[native transition] transition disabled for this state",u),r(function(){return m.goBack(n)}).then(function(){return j()})):(i.debug("nativepagetransitions goBack",n,t,s,u),$("back",s,u),r(function(){return m.goBack(n)}))}}var W=void 0,C=void 0;return{init:_,getDefaultOptions:A,enable:T,isEnabled:t,transition:$,registerToRouteEvents:I,unregisterToRouteEvents:N,registerToStateChangeStartEvent:j,unregisterToStateChangeStartEvent:E,disablePendingTransition:O,locationUrl:h,stateGo:w,goBack:F}}var o=null,s=null,u=null,l=null,c={up:"down",down:"up",left:"right",right:"left"},d={type:"slide",direction:"left"},g={type:"slide",direction:"right"},v={duration:400,slowdownfactor:4,iosdelay:-1,androiddelay:-1,winphonedelay:-1,fixedPixelsTop:0,fixedPixelsBottom:0,triggerTransitionEvent:"$ionicView.afterEnter",backInOppositeDirection:!1};return r.$inject=["$log","$ionicConfig","$rootScope","$timeout","$state","$location","$ionicHistory","$ionicPlatform"],{$get:r,enable:n,setDefaultTransition:e,setDefaultBackTransition:a,setDefaultOptions:i}},n.exports=t["default"]},function(n,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=["$ionicNativeTransitions","$ionicPlatform","$ionicHistory","$rootScope",function(n,t,i,e){"ngInject";t.ready(function(){n.init()})}],n.exports=t["default"]}])}); \ No newline at end of file +!function(n,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):"object"==typeof exports?exports.ionicNativeTransitions=t():n.ionicNativeTransitions=t()}(this,function(){return function(n){function t(e){if(i[e])return i[e].exports;var a=i[e]={exports:{},id:e,loaded:!1};return n[e].call(a.exports,a,a.exports,t),a.loaded=!0,a.exports}var i={};return t.m=n,t.c=i,t.p="",t(0)}([function(n,t,i){"use strict";function e(n){return n&&n.__esModule?n:{"default":n}}Object.defineProperty(t,"__esModule",{value:!0});var a=i(2),r=e(a),o=i(1),s=e(o),u=i(3),l=e(u),d=angular.module("ionic-native-transitions",["ionic","ui.router"]);d.directive("nativeUiSref",s["default"]),d.provider("$ionicNativeTransitions",r["default"]),d.run(l["default"]),t["default"]=d=d.name,n.exports=t["default"]},function(n,t){"use strict";function i(n,t){var i,e=n.match(/^\s*({[^}]*})\s*$/);if(e&&(n=t+"("+e[1]+")"),i=n.replace(/\n/g," ").match(/^([^(]+?)\s*(\((.*)\))?$/),!i||4!==i.length)throw new Error("Invalid state ref '"+n+"'");return{state:i[1],paramExpr:i[3]||null}}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=["$log","$ionicNativeTransitions","$state",function(n,t,e){"ngInject";function a(n,e,a,r){var o=n.$eval(a.nativeUiSrefOpts)||{},s=null;a.$observe("nativeOptions",function(t){var i=n.$eval(t);s=angular.isObject(i)?i:{}}),e.on("click",function(e){var u=i(a.nativeUiSref,r.current.name),l=angular.copy(n.$eval(u.paramExpr));return t.isEnabled()?void t.stateGo(u.state,l,o,s):void r.go(u.state,l,o)})}return a.$inject=["$scope","$element","$attrs","$state"],{controller:a,restrict:"A",scope:!1}}],n.exports=t["default"]},function(n,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=function(){"ngInject";function n(){var t=arguments.length<=0||void 0===arguments[0]?!0:arguments[0];return n=t,this}function t(){return window.cordova&&window.plugins&&window.plugins.nativepagetransitions?n:!1}function i(){var n=arguments.length<=0||void 0===arguments[0]?{}:arguments[0];return angular.extend(v,n),this}function e(){var n=arguments.length<=0||void 0===arguments[0]?{}:arguments[0];return angular.extend(g,n),this}function a(){var n=arguments.length<=0||void 0===arguments[0]?{}:arguments[0];return angular.extend(c,n),this}function r(i,e,a,r,f,p,m,b){function h(){var n=arguments.length<=0||void 0===arguments[0]?null:arguments[0],t=arguments.length<=1||void 0===arguments[1]?null:arguments[1];if(!n)return void i.debug("[native transition] cannot change url without url...");E();var e=p.url(n);return $(t),e}function w(){var n=arguments.length<=0||void 0===arguments[0]?null:arguments[0],t=arguments.length<=1||void 0===arguments[1]?{}:arguments[1],e=arguments.length<=2||void 0===arguments[2]?{}:arguments[2],a=arguments.length<=3||void 0===arguments[3]?null:arguments[3];return n?f.is(n,t)&&!e.reload?void i.debug("[native transition] same state transition are not possible"):(E(),$(a),r(function(){return f.go(n,t,e)})):void i.debug("[native transition] cannot change state without a state...")}function T(){var t=arguments.length<=0||void 0===arguments[0]?!0:arguments[0],r=arguments.length<=1||void 0===arguments[1]?!0:arguments[1],o=arguments.length<=2||void 0===arguments[2]?"platform":arguments[2];return!t||window.cordova&&window.plugins&&window.plugins.nativepagetransitions?(n=t,t?(i.debug("[native transition] enabling plugin"),window.plugins&&window.plugins.nativepagetransitions&&angular.extend(window.plugins.nativepagetransitions.globalOptions,A()),a.$ionicGoBack=F,C=b.registerBackButtonAction(function(n,t){return F(t)},100),I()):(i.debug("[native transition] disabling plugin"),"undefined"==typeof arguments[1]&&(r=!1),a.$ionicGoBack=W,angular.isFunction(C)&&C.call(),N()),r?(i.debug("[native transition] disabling ionic transitions"),e.views.transition("none")):(i.debug("[native transition] enabling ionic transitions"),e.views.transition(o)),this):void i.debug("[native transition] is disabled or nativepagetransitions plugin is not present")}function $(){if(t()){var n={};if(angular.isObject(arguments[0]))n=angular.extend({},c,arguments[0]);else if(angular.isString(arguments[0]))switch(arguments[0]){case"back":arguments[2]&&B(arguments[2])?(n=B(arguments[2]),console.log("back first",n)):A().backInOppositeDirection&&arguments[1]&&S(arguments[1])?(n=S(arguments[1]),n.direction&&(n.direction=d[n.direction]),console.log("back second",n)):(n=c,console.log("back default",n))}else n=g;n=angular.copy(n),i.debug("[native transition]",n);var e=n.type;delete n.type,a.$broadcast("ionicNativeTransitions.beforeTransition"),window.plugins.nativepagetransitions[e](n,x.bind(this,k(n)),y.bind(this,k(n)))}}function x(n){setTimeout(function(){return a.$broadcast("ionicNativeTransitions.success")},n)}function y(n){setTimeout(function(){return a.$broadcast("ionicNativeTransitions.error")},n)}function k(n){var t=void 0;return t=n.duration?parseInt(n.duration):parseInt(A().duration),ionic.Platform.isAndroid()?t+=n.androiddelay?parseInt(n.androiddelay):parseInt(A().androiddelay):ionic.Platform.isIOS()?t+=n.iosdelay?parseInt(n.iosdelay):parseInt(A().iosdelay):ionic.Platform.isWindowsPhone()&&(t+=n.winphonedelay?parseInt(n.winphonedelay):parseInt(A().winphonedelay)),t}function P(){window.plugins.nativepagetransitions.executePendingTransition(),j()}function O(){window.plugins&&window.plugins.nativepagetransitions&&angular.isFunction(window.plugins.nativepagetransitions.cancelPendingTransition)?(window.plugins.nativepagetransitions.cancelPendingTransition(),j()):P()}function I(){N(),j(),u=a.$on("$stateChangeError",O),l=a.$on(A().triggerTransitionEvent,P)}function j(){o||(o=a.$on("$stateChangeStart",function(n,t,e,a,r){var o=null;if(!n.defaultPrevented){if(null===t.nativeTransitions)return void i.debug("[native transition] transition disabled for this state",t);o=S(t),i.debug("[native transition] $stateChangeStart",t,o),$(o)}}))}function B(n){return angular.isObject(n.nativeTransitionsBackIOS)&&ionic.Platform.isIOS()?angular.extend({},n.nativeTransitionsBackIOS):angular.isObject(n.nativeTransitionsBackAndroid)&&ionic.Platform.isAndroid()?angular.extend({},n.nativeTransitionsBackAndroid):angular.isObject(n.nativeTransitionsBackWindowsPhone)&&ionic.Platform.isWindowsPhone()?angular.extend({},n.nativeTransitionsBackWindowsPhone):angular.isObject(n.nativeTransitionsBack)?angular.extend({},n.nativeTransitionsBack):null}function S(n){return angular.isObject(n.nativeTransitionsIOS)&&ionic.Platform.isIOS()?angular.extend({},n.nativeTransitionsIOS):angular.isObject(n.nativeTransitionsAndroid)&&ionic.Platform.isAndroid()?angular.extend({},n.nativeTransitionsAndroid):angular.isObject(n.nativeTransitionsWindowsPhone)&&ionic.Platform.isWindowsPhone()?angular.extend({},n.nativeTransitionsWindowsPhone):angular.isObject(n.nativeTransitions)?angular.extend({},n.nativeTransitions):null}function E(){o&&angular.isFunction(o)&&(o(),o=null)}function N(){o&&angular.isFunction(o)&&(o(),o=null),s&&angular.isFunction(s)&&(s(),s=null),u&&angular.isFunction(u)&&(u(),u=null),l&&angular.isFunction(l)&&(l(),l=null)}function A(){return v}function _(){return W=a.$ionicGoBack,t()?void T():void i.debug("[native transition] The plugin is either disabled or nativepagetransitions plugin by telerik is not present. If you are getting this message in a browser, this is normal behavior, native transitions only work on device.")}function F(n){if(!m.backView())return void(navigator.app&&navigator.app.exitApp());if(!(n>=0)){var t=m.backView().stateName;if(n&&!isNaN(parseInt(n))){var e=m.viewHistory(),a=e.histories[m.currentView().historyId],o=a.cursor+n;(0>o||o>a.stack.length)&&(o=0),t=a.stack[o].stateName}var s=angular.extend({},f.current),u=angular.extend({},f.get(t));return E(),null===u.nativeTransitionsBack?(i.debug("[native transition] transition disabled for this state",u),r(function(){return m.goBack(n)}).then(function(){return j()})):(i.debug("nativepagetransitions goBack",n,t,s,u),$("back",s,u),r(function(){return m.goBack(n)}))}}var W=void 0,C=void 0;return{init:_,getDefaultOptions:A,enable:T,isEnabled:t,transition:$,registerToRouteEvents:I,unregisterToRouteEvents:N,registerToStateChangeStartEvent:j,unregisterToStateChangeStartEvent:E,disablePendingTransition:O,locationUrl:h,stateGo:w,goBack:F}}var o=null,s=null,u=null,l=null,d={up:"down",down:"up",left:"right",right:"left"},g={type:"slide",direction:"left"},c={type:"slide",direction:"right"},v={duration:400,slowdownfactor:4,iosdelay:-1,androiddelay:-1,winphonedelay:-1,fixedPixelsTop:0,fixedPixelsBottom:0,triggerTransitionEvent:"$ionicView.afterEnter",backInOppositeDirection:!1};return r.$inject=["$log","$ionicConfig","$rootScope","$timeout","$state","$location","$ionicHistory","$ionicPlatform"],{$get:r,enable:n,setDefaultTransition:e,setDefaultBackTransition:a,setDefaultOptions:i}},n.exports=t["default"]},function(n,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=["$ionicNativeTransitions","$ionicPlatform","$ionicHistory","$rootScope",function(n,t,i,e){"ngInject";t.ready(function(){n.init()})}],n.exports=t["default"]}])}); \ No newline at end of file diff --git a/lib/provider.js b/lib/provider.js index 9026082..a528c89 100644 --- a/lib/provider.js +++ b/lib/provider.js @@ -200,10 +200,12 @@ export default function () { $log.debug('[native transition] cannot change state without a state...'); return; } - if ($state.current.name === state && !stateOptions.reload) { + + if ($state.is(state, stateParams) && !stateOptions.reload) { $log.debug('[native transition] same state transition are not possible'); return; } + unregisterToStateChangeStartEvent(); transition(transitionOptions); return $timeout(() => $state.go(state, stateParams, stateOptions)); diff --git a/package.json b/package.json index 70fc6b6..7cc17d2 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ionic-native-transitions", - "version": "1.0.1", + "version": "1.0.2", "description": "Native transitions for Ionic applications", "main": "dist/ionic-native-transitions.js", "scripts": {