diff --git a/CHANGELOG.md b/CHANGELOG.md
index b05ac06..380b116 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,10 @@
+
+### 1.0.0-rc9
+
+* [BUG] stateGo API change
+* [BUG] Hardware back does not close app
+* [BUG] Pass `backCount` parameter to `$ionicNativeTransitions.goBack()` method
+
### 1.0.0-rc8
diff --git a/README.md b/README.md
index 5011d86..08d8b05 100644
--- a/README.md
+++ b/README.md
@@ -244,7 +244,7 @@ $ionicNativeTransitions.locationUrl('/yourUrl', {
## Using directives
```
-
+
```
## History back button
diff --git a/bower.json b/bower.json
index fbff3b5..72d8987 100644
--- a/bower.json
+++ b/bower.json
@@ -1,6 +1,6 @@
{
"name": "ionic-native-transitions",
- "version": "1.0.0-rc8",
+ "version": "1.0.0-rc9",
"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 4696954..77ddfab 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.0-rc8
+ * @version: v1.0.0-rc9
* @author: shprink
* @link: https://github.com/shprink/ionic-native-transitions
* @license: MIT
@@ -359,7 +359,9 @@ return /******/ (function(modules) { // webpackBootstrap
angular.extend(window.plugins.nativepagetransitions.globalOptions, getDefaultOptions());
}
$rootScope.$ionicGoBack = goBack;
- backButtonUnregister = $ionicPlatform.registerBackButtonAction(goBack, 100);
+ backButtonUnregister = $ionicPlatform.registerBackButtonAction(function (e, count) {
+ return goBack(count);
+ }, 100);
registerToRouteEvents();
} else {
$log.debug('[native transition] disabling plugin');
@@ -601,7 +603,15 @@ return /******/ (function(modules) { // webpackBootstrap
* @param {number} backCount - The number of views to go back to. default will be the previous view
*/
function goBack(backCount) {
- if (!$ionicHistory.backView() || backCount >= 0) {
+
+ if (!$ionicHistory.backView()) {
+ // Close the app when no more history
+ if (navigator.app) {
+ navigator.app.exitApp();
+ }
+ return;
+ }
+ if (backCount >= 0) {
return;
}
var stateName = $ionicHistory.backView().stateName;
@@ -626,6 +636,7 @@ return /******/ (function(modules) { // webpackBootstrap
unregisterToStateChangeStartEvent();
var currentStateTransition = angular.extend({}, $state.current);
var toStateTransition = angular.extend({}, $state.get(stateName));
+ $log.debug('nativepagetransitions goBack', backCount, stateName, currentStateTransition, toStateTransition);
$ionicHistory.goBack(backCount);
transition('back', currentStateTransition, toStateTransition);
}
@@ -651,40 +662,48 @@ return /******/ (function(modules) { // webpackBootstrap
exports['default'] = ["$log", "$ionicNativeTransitions", "$state", function ($log, $ionicNativeTransitions, $state) {
'ngInject';
- link.$inject = ["scope", "element", "attrs"];
+ controller.$inject = ["$scope", "$element", "$attrs", "$state"];
return {
- link: link,
+ controller: controller,
restrict: 'A',
scope: false
};
- function link(scope, element, attrs) {
+ function controller($scope, $element, $attrs, $state) {
'ngInject';
- var state = attrs.nativeUiSref;
- var optionsOverride = scope.$eval(attrs.nativeUiSrefOpts) || {};
- var options = null;
+ var stateOptions = $scope.$eval($attrs.nativeUiSrefOpts) || {};
+ var nativeOptions = null;
- attrs.$observe('nativeOptions', function (newOptions) {
- var evalOptions = scope.$eval(newOptions);
- options = angular.isObject(evalOptions) ? evalOptions : {};
+ $attrs.$observe('nativeOptions', function (newOptions) {
+ var evalOptions = $scope.$eval(newOptions);
+ nativeOptions = angular.isObject(evalOptions) ? evalOptions : {};
});
- if (!state) {
- return;
- }
-
- element.on('click', function (event) {
+ $element.on('click', function (event) {
+ var ref = parseStateRef($attrs.nativeUiSref, $state.current.name);
+ var params = angular.copy($scope.$eval(ref.paramExpr));
if (!$ionicNativeTransitions.isEnabled()) {
- $state.go(state, optionsOverride);
+ $state.go(ref.state, params, stateOptions);
return;
}
- $ionicNativeTransitions.stateGo(state, optionsOverride, options);
+ $ionicNativeTransitions.stateGo(ref.state, params, nativeOptions, stateOptions);
});
}
}];
+ function parseStateRef(ref, current) {
+ var preparsed = ref.match(/^\s*({[^}]*})\s*$/),
+ parsed;
+ if (preparsed) ref = current + '(' + preparsed[1] + ')';
+ parsed = ref.replace(/\n/g, " ").match(/^([^(]+?)\s*(\((.*)\))?$/);
+ if (!parsed || parsed.length !== 4) throw new Error("Invalid state ref '" + ref + "'");
+ return {
+ state: parsed[1],
+ paramExpr: parsed[3] || null
+ };
+ }
module.exports = exports['default'];
/***/ },
diff --git a/dist/ionic-native-transitions.js.map b/dist/ionic-native-transitions.js.map
index f492191..aaab931 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 bc090a965ee659257a7c","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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D,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 bc090a965ee659257a7c\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 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 $location.url(url);\n transition(transitionOptions);\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|null} transitionOptions default:null\n * @param {object} stateOptions default:{}\n */\n function stateGo(state = null, stateParams = {}, transitionOptions = null, stateOptions = {}) {\n if (!state) {\n $log.debug('[native transition] cannot change state without a state...');\n return;\n }\n unregisterToStateChangeStartEvent();\n $state.go(state, stateParams, stateOptions);\n transition(transitionOptions);\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(goBack, 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 = arguments[0];\n } else if (angular.isString(arguments[0])) {\n switch (arguments[0]) {\n case 'back':\n 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 } else if (arguments[2] && getBackStateTransition(arguments[2])) {\n options = getBackStateTransition(arguments[2]);\n } else {\n options = defaultBackTransition;\n }\n break;\n }\n } else {\n options = defaultTransition;\n }\n options = angular.copy(options);\n let type = options.type;\n delete options.type;\n $log.debug('[native transition]', options);\n switch (type) {\n case 'flip':\n window.plugins.nativepagetransitions.flip(options, transitionSuccess, transitionError);\n break;\n case 'fade':\n window.plugins.nativepagetransitions.fade(options, transitionSuccess, transitionError);\n break;\n case 'curl':\n window.plugins.nativepagetransitions.curl(options, transitionSuccess, transitionError);\n break;\n case 'drawer':\n window.plugins.nativepagetransitions.drawer(options, transitionSuccess, transitionError);\n break;\n case 'slide':\n default:\n window.plugins.nativepagetransitions.slide(options, transitionSuccess, transitionError);\n break;\n }\n\n function getTransitionDuration() {\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 transitionSuccess() {\n setTimeout(() => $rootScope.$broadcast('ionicNativeTransitions.success'), getTransitionDuration());\n }\n\n function transitionError() {\n setTimeout(() => $rootScope.$broadcast('ionicNativeTransitions.error'), getTransitionDuration());\n }\n }\n\n function executePendingTransition() {\n window.plugins.nativepagetransitions.executePendingTransition();\n // $rootScope.$broadcast('ionicNativeTransitions.', executePendingTransition);\n registerToStateChangeStartEvent();\n }\n\n function registerToRouteEvents() {\n unregisterToRouteEvents();\n registerToStateChangeStartEvent();\n // $stateChangeSuccess = $rootScope.$on('$stateChangeSuccess', executePendingTransition);\n $stateChangeError = $rootScope.$on('$stateChangeError', executePendingTransition);\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 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('nativepagetransitions is disabled or nativepagetransitions plugin is not present');\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 if (!$ionicHistory.backView() || 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\n unregisterToStateChangeStartEvent();\n let currentStateTransition = angular.extend({}, $state.current);\n let toStateTransition = angular.extend({}, $state.get(stateName));\n $ionicHistory.goBack(backCount);\n transition('back', currentStateTransition, toStateTransition);\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 link: link,\n restrict: 'A',\n scope: false\n };\n\n function link(scope, element, attrs) {\n 'ngInject';\n\n let state = attrs.nativeUiSref;\n let optionsOverride = scope.$eval(attrs.nativeUiSrefOpts) || {};\n let options = null;\n\n attrs.$observe('nativeOptions', (newOptions) => {\n let evalOptions = scope.$eval(newOptions);\n options = angular.isObject(evalOptions) ? evalOptions : {};\n });\n\n if (!state) {\n return;\n }\n\n element.on('click', (event) => {\n if (!$ionicNativeTransitions.isEnabled()) {\n $state.go(state, optionsOverride);\n return;\n }\n\n $ionicNativeTransitions.stateGo(state, optionsOverride, options);\n });\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 7a6c8f98a297fc2d3f30","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,Y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,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 7a6c8f98a297fc2d3f30\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 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 $location.url(url);\n transition(transitionOptions);\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|null} transitionOptions default:null\n * @param {object} stateOptions default:{}\n */\n function stateGo(state = null, stateParams = {}, transitionOptions = null, stateOptions = {}) {\n if (!state) {\n $log.debug('[native transition] cannot change state without a state...');\n return;\n }\n unregisterToStateChangeStartEvent();\n $state.go(state, stateParams, stateOptions);\n transition(transitionOptions);\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 = arguments[0];\n } else if (angular.isString(arguments[0])) {\n switch (arguments[0]) {\n case 'back':\n 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 } else if (arguments[2] && getBackStateTransition(arguments[2])) {\n options = getBackStateTransition(arguments[2]);\n } else {\n options = defaultBackTransition;\n }\n break;\n }\n } else {\n options = defaultTransition;\n }\n options = angular.copy(options);\n let type = options.type;\n delete options.type;\n $log.debug('[native transition]', options);\n switch (type) {\n case 'flip':\n window.plugins.nativepagetransitions.flip(options, transitionSuccess, transitionError);\n break;\n case 'fade':\n window.plugins.nativepagetransitions.fade(options, transitionSuccess, transitionError);\n break;\n case 'curl':\n window.plugins.nativepagetransitions.curl(options, transitionSuccess, transitionError);\n break;\n case 'drawer':\n window.plugins.nativepagetransitions.drawer(options, transitionSuccess, transitionError);\n break;\n case 'slide':\n default:\n window.plugins.nativepagetransitions.slide(options, transitionSuccess, transitionError);\n break;\n }\n\n function getTransitionDuration() {\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 transitionSuccess() {\n setTimeout(() => $rootScope.$broadcast('ionicNativeTransitions.success'), getTransitionDuration());\n }\n\n function transitionError() {\n setTimeout(() => $rootScope.$broadcast('ionicNativeTransitions.error'), getTransitionDuration());\n }\n }\n\n function executePendingTransition() {\n window.plugins.nativepagetransitions.executePendingTransition();\n // $rootScope.$broadcast('ionicNativeTransitions.', executePendingTransition);\n registerToStateChangeStartEvent();\n }\n\n function registerToRouteEvents() {\n unregisterToRouteEvents();\n registerToStateChangeStartEvent();\n // $stateChangeSuccess = $rootScope.$on('$stateChangeSuccess', executePendingTransition);\n $stateChangeError = $rootScope.$on('$stateChangeError', executePendingTransition);\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 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('nativepagetransitions is disabled or nativepagetransitions plugin is not present');\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\n unregisterToStateChangeStartEvent();\n let currentStateTransition = angular.extend({}, $state.current);\n let toStateTransition = angular.extend({}, $state.get(stateName));\n $log.debug('nativepagetransitions goBack', backCount, stateName, currentStateTransition, toStateTransition);\n $ionicHistory.goBack(backCount);\n transition('back', currentStateTransition, toStateTransition);\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, nativeOptions, stateOptions);\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 71aaf29..1666600 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.0-rc8
+ * @version: v1.0.0-rc9
* @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),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";Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=["$log","$ionicNativeTransitions","$state",function(n,t,i){"ngInject";function e(n,e,a){var r=a.nativeUiSref,o=n.$eval(a.nativeUiSrefOpts)||{},s=null;a.$observe("nativeOptions",function(t){var i=n.$eval(t);s=angular.isObject(i)?i:{}}),r&&e.on("click",function(n){return t.isEnabled()?void t.stateGo(r,o,s):void i.go(r,o)})}return e.$inject=["scope","element","attrs"],{link:e,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,w){function b(){var n=arguments.length<=0||void 0===arguments[0]?null:arguments[0],t=arguments.length<=1||void 0===arguments[1]?null:arguments[1];return n?(j(),p.url(n),void $(t)):void i.debug("[native transition] cannot change url without url...")}function h(){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]?null:arguments[2],a=arguments.length<=3||void 0===arguments[3]?{}:arguments[3];return n?(j(),f.go(n,t,a),void $(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,S()),a.$ionicGoBack=N,_=w.registerBackButtonAction(N,100),y()):(i.debug("[native transition] disabling plugin"),"undefined"==typeof arguments[1]&&(r=!1),a.$ionicGoBack=E,angular.isFunction(_)&&_.call(),I()),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 $(){function n(){var n=void 0;return n=o.duration?parseInt(o.duration):parseInt(S().duration),ionic.Platform.isAndroid()?n+=o.androiddelay?parseInt(o.androiddelay):parseInt(S().androiddelay):ionic.Platform.isIOS()?n+=o.iosdelay?parseInt(o.iosdelay):parseInt(S().iosdelay):ionic.Platform.isWindowsPhone()&&(n+=o.winphonedelay?parseInt(o.winphonedelay):parseInt(S().winphonedelay)),n}function e(){setTimeout(function(){return a.$broadcast("ionicNativeTransitions.success")},n())}function r(){setTimeout(function(){return a.$broadcast("ionicNativeTransitions.error")},n())}if(t()){var o={};if(angular.isObject(arguments[0]))o=arguments[0];else if(angular.isString(arguments[0]))switch(arguments[0]){case"back":S().backInOppositeDirection&&arguments[1]&&P(arguments[1])?(o=P(arguments[1]),o.direction&&(o.direction=d[o.direction])):o=arguments[2]&&O(arguments[2])?O(arguments[2]):c}else o=g;o=angular.copy(o);var s=o.type;switch(delete o.type,i.debug("[native transition]",o),s){case"flip":window.plugins.nativepagetransitions.flip(o,e,r);break;case"fade":window.plugins.nativepagetransitions.fade(o,e,r);break;case"curl":window.plugins.nativepagetransitions.curl(o,e,r);break;case"drawer":window.plugins.nativepagetransitions.drawer(o,e,r);break;case"slide":default:window.plugins.nativepagetransitions.slide(o,e,r)}}}function x(){window.plugins.nativepagetransitions.executePendingTransition(),k()}function y(){I(),k(),u=a.$on("$stateChangeError",x),l=a.$on(S().triggerTransitionEvent,x)}function k(){o||(o=a.$on("$stateChangeStart",function(n,t,e,a,r){var o=null;n.defaultPrevented||null!==t.nativeTransitions&&(o=P(t),i.debug("[native transition] $stateChangeStart",t,o),$(o))}))}function O(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 P(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 j(){o&&angular.isFunction(o)&&(o(),o=null)}function I(){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 S(){return v}function B(){return E=a.$ionicGoBack,t()?void T():void i.debug("nativepagetransitions is disabled or nativepagetransitions plugin is not present")}function N(n){if(m.backView()&&!(n>=0)){var t=m.backView().stateName;if(n&&!isNaN(parseInt(n))){var i=m.viewHistory(),e=i.histories[m.currentView().historyId],a=e.cursor+n;(0>a||a>e.stack.length)&&(a=0),t=e.stack[a].stateName}j();var r=angular.extend({},f.current),o=angular.extend({},f.get(t));m.goBack(n),$("back",r,o)}}var E=void 0,_=void 0;return{init:B,getDefaultOptions:S,enable:T,isEnabled:t,transition:$,registerToRouteEvents:y,unregisterToRouteEvents:I,registerToStateChangeStartEvent:k,unregisterToStateChangeStartEvent:j,locationUrl:b,stateGo:h,goBack:N}}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
+!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,s,o):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,w){function b(){var n=arguments.length<=0||void 0===arguments[0]?null:arguments[0],t=arguments.length<=1||void 0===arguments[1]?null:arguments[1];return n?(I(),p.url(n),void T(t)):void i.debug("[native transition] cannot change url without url...")}function h(){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]?null:arguments[2],a=arguments.length<=3||void 0===arguments[3]?{}:arguments[3];return n?(I(),f.go(n,t,a),void T(e)):void i.debug("[native transition] cannot change state without a state...")}function $(){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,S()),a.$ionicGoBack=E,A=w.registerBackButtonAction(function(n,t){return E(t)},100),y()):(i.debug("[native transition] disabling plugin"),"undefined"==typeof arguments[1]&&(r=!1),a.$ionicGoBack=N,angular.isFunction(A)&&A.call(),j()),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 T(){function n(){var n=void 0;return n=o.duration?parseInt(o.duration):parseInt(S().duration),ionic.Platform.isAndroid()?n+=o.androiddelay?parseInt(o.androiddelay):parseInt(S().androiddelay):ionic.Platform.isIOS()?n+=o.iosdelay?parseInt(o.iosdelay):parseInt(S().iosdelay):ionic.Platform.isWindowsPhone()&&(n+=o.winphonedelay?parseInt(o.winphonedelay):parseInt(S().winphonedelay)),n}function e(){setTimeout(function(){return a.$broadcast("ionicNativeTransitions.success")},n())}function r(){setTimeout(function(){return a.$broadcast("ionicNativeTransitions.error")},n())}if(t()){var o={};if(angular.isObject(arguments[0]))o=arguments[0];else if(angular.isString(arguments[0]))switch(arguments[0]){case"back":S().backInOppositeDirection&&arguments[1]&&P(arguments[1])?(o=P(arguments[1]),o.direction&&(o.direction=d[o.direction])):o=arguments[2]&&O(arguments[2])?O(arguments[2]):c}else o=g;o=angular.copy(o);var s=o.type;switch(delete o.type,i.debug("[native transition]",o),s){case"flip":window.plugins.nativepagetransitions.flip(o,e,r);break;case"fade":window.plugins.nativepagetransitions.fade(o,e,r);break;case"curl":window.plugins.nativepagetransitions.curl(o,e,r);break;case"drawer":window.plugins.nativepagetransitions.drawer(o,e,r);break;case"slide":default:window.plugins.nativepagetransitions.slide(o,e,r)}}}function x(){window.plugins.nativepagetransitions.executePendingTransition(),k()}function y(){j(),k(),u=a.$on("$stateChangeError",x),l=a.$on(S().triggerTransitionEvent,x)}function k(){o||(o=a.$on("$stateChangeStart",function(n,t,e,a,r){var o=null;n.defaultPrevented||null!==t.nativeTransitions&&(o=P(t),i.debug("[native transition] $stateChangeStart",t,o),T(o))}))}function O(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 P(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 I(){o&&angular.isFunction(o)&&(o(),o=null)}function j(){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 S(){return v}function B(){return N=a.$ionicGoBack,t()?void $():void i.debug("nativepagetransitions is disabled or nativepagetransitions plugin is not present")}function E(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],r=a.cursor+n;(0>r||r>a.stack.length)&&(r=0),t=a.stack[r].stateName}I();var o=angular.extend({},f.current),s=angular.extend({},f.get(t));i.debug("nativepagetransitions goBack",n,t,o,s),m.goBack(n),T("back",o,s)}}var N=void 0,A=void 0;return{init:B,getDefaultOptions:S,enable:$,isEnabled:t,transition:T,registerToRouteEvents:y,unregisterToRouteEvents:j,registerToStateChangeStartEvent:k,unregisterToStateChangeStartEvent:I,locationUrl:b,stateGo:h,goBack:E}}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/nativeSref.js b/lib/nativeSref.js
index 7d891e4..4b09071 100644
--- a/lib/nativeSref.js
+++ b/lib/nativeSref.js
@@ -2,34 +2,43 @@ export default function($log, $ionicNativeTransitions, $state) {
'ngInject';
return {
- link: link,
+ controller: controller,
restrict: 'A',
scope: false
};
- function link(scope, element, attrs) {
+ function controller($scope, $element, $attrs, $state) {
'ngInject';
- let state = attrs.nativeUiSref;
- let optionsOverride = scope.$eval(attrs.nativeUiSrefOpts) || {};
- let options = null;
+ let stateOptions = $scope.$eval($attrs.nativeUiSrefOpts) || {};
+ let nativeOptions = null;
- attrs.$observe('nativeOptions', (newOptions) => {
- let evalOptions = scope.$eval(newOptions);
- options = angular.isObject(evalOptions) ? evalOptions : {};
+ $attrs.$observe('nativeOptions', (newOptions) => {
+ let evalOptions = $scope.$eval(newOptions);
+ nativeOptions = angular.isObject(evalOptions) ? evalOptions : {};
});
- if (!state) {
- return;
- }
-
- element.on('click', (event) => {
+ $element.on('click', (event) => {
+ let ref = parseStateRef($attrs.nativeUiSref, $state.current.name);
+ let params = angular.copy($scope.$eval(ref.paramExpr));
if (!$ionicNativeTransitions.isEnabled()) {
- $state.go(state, optionsOverride);
+ $state.go(ref.state, params, stateOptions);
return;
}
- $ionicNativeTransitions.stateGo(state, optionsOverride, options);
+ $ionicNativeTransitions.stateGo(ref.state, params, nativeOptions, stateOptions);
});
}
}
+
+function parseStateRef(ref, current) {
+ var preparsed = ref.match(/^\s*({[^}]*})\s*$/),
+ parsed;
+ if (preparsed) ref = current + '(' + preparsed[1] + ')';
+ parsed = ref.replace(/\n/g, " ").match(/^([^(]+?)\s*(\((.*)\))?$/);
+ if (!parsed || parsed.length !== 4) throw new Error("Invalid state ref '" + ref + "'");
+ return {
+ state: parsed[1],
+ paramExpr: parsed[3] || null
+ };
+}
diff --git a/lib/provider.js b/lib/provider.js
index 0345902..9efa7c5 100644
--- a/lib/provider.js
+++ b/lib/provider.js
@@ -227,7 +227,7 @@ export default function() {
angular.extend(window.plugins.nativepagetransitions.globalOptions, getDefaultOptions());
}
$rootScope.$ionicGoBack = goBack;
- backButtonUnregister = $ionicPlatform.registerBackButtonAction(goBack, 100);
+ backButtonUnregister = $ionicPlatform.registerBackButtonAction((e, count) => goBack(count), 100);
registerToRouteEvents();
} else {
$log.debug('[native transition] disabling plugin');
@@ -465,8 +465,16 @@ export default function() {
* @param {number} backCount - The number of views to go back to. default will be the previous view
*/
function goBack(backCount) {
- if (!$ionicHistory.backView() || backCount >= 0) {
- return;
+
+ if (!$ionicHistory.backView()) {
+ // Close the app when no more history
+ if (navigator.app) {
+ navigator.app.exitApp();
+ }
+ return;
+ }
+ if (backCount >= 0) {
+ return;
}
let stateName = $ionicHistory.backView().stateName;
@@ -475,21 +483,22 @@ export default function() {
// Get current history stack and find the cursor for the new view
// Based on the new cursor, find the new state to transition to
if (!!backCount && !isNaN(parseInt(backCount))) {
- let viewHistory = $ionicHistory.viewHistory();
- let currentHistory = viewHistory.histories[$ionicHistory.currentView().historyId];
- let newCursor = currentHistory.cursor + backCount;
+ let viewHistory = $ionicHistory.viewHistory();
+ let currentHistory = viewHistory.histories[$ionicHistory.currentView().historyId];
+ let newCursor = currentHistory.cursor + backCount;
- // If new cursor is more than the max possible or less than zero, default it to first view in history
- if (newCursor < 0 || newCursor > currentHistory.stack.length) {
- newCursor = 0;
- }
+ // If new cursor is more than the max possible or less than zero, default it to first view in history
+ if (newCursor < 0 || newCursor > currentHistory.stack.length) {
+ newCursor = 0;
+ }
- stateName = currentHistory.stack[newCursor].stateName;
+ stateName = currentHistory.stack[newCursor].stateName;
}
unregisterToStateChangeStartEvent();
let currentStateTransition = angular.extend({}, $state.current);
let toStateTransition = angular.extend({}, $state.get(stateName));
+ $log.debug('nativepagetransitions goBack', backCount, stateName, currentStateTransition, toStateTransition);
$ionicHistory.goBack(backCount);
transition('back', currentStateTransition, toStateTransition);
}
diff --git a/package.json b/package.json
index 8da7ab2..6b30a33 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "ionic-native-transitions",
- "version": "1.0.0-rc8",
+ "version": "1.0.0-rc9",
"description": "Native transitions for Ionic applications",
"main": "dist/ionic-native-transitions.js",
"scripts": {
diff --git a/test/config.js b/test/config.js
index d1715db..2aa3810 100644
--- a/test/config.js
+++ b/test/config.js
@@ -85,7 +85,7 @@ export default function($ionicNativeTransitionsProvider, $stateProvider, $urlRou
templateUrl: "templates/three.html"
})
.state('four', {
- url: "/four",
+ url: "/four?testParamUrl",
params: {
test: null
},
diff --git a/test/controller.js b/test/controller.js
index 0e5f999..a994d5f 100644
--- a/test/controller.js
+++ b/test/controller.js
@@ -74,7 +74,8 @@ export default function(
function stateGo() {
$ionicNativeTransitions.stateGo('four', {
- test: 'buyakacha!'
+ test: 'buyakacha!',
+ testParamUrl: 'hihi'
}, {
"type": "slide",
"direction": "up", // 'left|right|up|down', default 'left' (which is like 'next')
diff --git a/test/index.html b/test/index.html
index 8a50859..64c84fc 100644
--- a/test/index.html
+++ b/test/index.html
@@ -63,6 +63,12 @@
Disable plugin
Disable plugin and ionic transitions
StateGo
+
+
LocationUrl