Skip to content

Commit

Permalink
Merge branch 'release/1.0.0-rc10'
Browse files Browse the repository at this point in the history
  • Loading branch information
shprink committed Mar 6, 2016
2 parents eed9892 + eaec5be commit 1ed0e54
Show file tree
Hide file tree
Showing 10 changed files with 72 additions and 32 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
<a name="1.0.0-rc10"></a>
### 1.0.0-rc10

* [FEATURE] Add onBefore transition event <https://github.com/shprink/ionic-native-transitions/issues/74>
* [BUG] Prevent same state transition when using stateGo function <https://github.com/shprink/ionic-native-transitions/issues/75>

<a name="1.0.0-rc9"></a>
### 1.0.0-rc9

Expand Down
62 changes: 38 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@ Native transitions for Ionic. Turn it on and enjoy native transitions.

![gif](http://examples.julienrenaux.fr/native-transitions/native-transitions.gif)

## Chat

[![Join the chat at https://gitter.im/shprink/ionic-native-transitions](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/shprink/ionic-native-transitions)

# Installation
## npm
[https://www.npmjs.com/package/ionic-native-transitions](https://www.npmjs.com/package/ionic-native-transitions)
Expand All @@ -12,7 +16,7 @@ npm install ionic-native-transitions --save

Then require the library

```
```js
# ES5
require('ionic-native-transitions');

Expand All @@ -26,15 +30,21 @@ import 'ionic-native-transitions';
bower install shprink/ionic-native-transitions
```

Then insert the dist file

```
<script src="./PathToBowerLib/dist/ionic-native-transitions.min.js"></script>
```

## Cordova/Ionic
The recommended version for the Transition plugin is 0.5.5 or higher.
The recommended version for the Transition plugin is 0.6.2 or higher.

```
# Using Cordova
cordova plugin add https://github.com/Telerik-Verified-Plugins/NativePageTransitions#0.5.5
cordova plugin add https://github.com/Telerik-Verified-Plugins/NativePageTransitions#0.6.2
# Using Ionic CLI
ionic plugin add https://github.com/Telerik-Verified-Plugins/NativePageTransitions#0.5.5
ionic plugin add https://github.com/Telerik-Verified-Plugins/NativePageTransitions#0.6.2
```

### iOS
Expand All @@ -57,7 +67,7 @@ if you are using Crosswalk > 1.3 please add the following to your `config.xml`

# Configuration

```
```js
angular.module('yourApp', [
'ionic-native-transitions'
]);
Expand All @@ -66,7 +76,7 @@ angular.module('yourApp', [
## Set default options (optional)
**_Beware_**: Only use `setDefaultOptions` if you know what you are doing.

```
```js
.config(function($ionicNativeTransitionsProvider){
$ionicNativeTransitionsProvider.setDefaultOptions({
duration: 400, // in milliseconds (ms), default 400,
Expand All @@ -75,7 +85,7 @@ angular.module('yourApp', [
androiddelay: -1, // same as above but for Android, default -1
winphonedelay: -1, // same as above but for Windows Phone, default -1,
fixedPixelsTop: 0, // the number of pixels of your fixed header, default 0 (iOS and Android)
fixedPixelsBottom: 0 // the number of pixels of your fixed footer (f.i. a tab bar), default 0 (iOS and Android)
fixedPixelsBottom: 0, // the number of pixels of your fixed footer (f.i. a tab bar), default 0 (iOS and Android)
triggerTransitionEvent: '$ionicView.afterEnter', // internal ionic-native-transitions option
backInOppositeDirection: false // Takes over default back transition and state back transition to use the opposite direction transition to go back
});
Expand All @@ -85,7 +95,7 @@ angular.module('yourApp', [
## Set default transition (optional)
[See the list of possible transitions](#transitions)

```
```js
.config(function($ionicNativeTransitionsProvider){
$ionicNativeTransitionsProvider.setDefaultTransition({
type: 'slide',
Expand All @@ -97,7 +107,7 @@ angular.module('yourApp', [
## Set default back transition (optional)
[See the list of possible transitions](#transitions)

```
```js
.config(function($ionicNativeTransitionsProvider){
$ionicNativeTransitionsProvider.setDefaultBackTransition({
type: 'slide',
Expand All @@ -109,7 +119,7 @@ angular.module('yourApp', [
## Enable/Disable (optional)
You can programatically disable the plugin for any reason:

```
```js
# Within the config phase
# * @param {boolean} enabled
$ionicNativeTransitionsProvider.enable(false);
Expand All @@ -136,7 +146,7 @@ $ionicNativeTransitions.enable(true, false);
# Usage
By default any state transition will use the default transition (Defined in the configuration phase) but you can specify a different transition per state if you want using the UI router state definition:

```
```js
.state('home', {
url: '/home',
nativeTransitions: {
Expand All @@ -149,7 +159,7 @@ By default any state transition will use the default transition (Defined in the

You can also define a different transition (backward and forward) per device like this:

```
```js
.state('home', {
url: '/home',
nativeTransitionsAndroid: {
Expand Down Expand Up @@ -182,7 +192,7 @@ You can also define a different transition (backward and forward) per device lik

Overwrite just one device (here only android will be different)

```
```js
.state('home', {
url: '/home',
nativeTransitions: {
Expand All @@ -199,7 +209,7 @@ Overwrite just one device (here only android will be different)

Disable native transition for one state (for instance on tabs)

```
```js
.state('home', {
url: '/home',
nativeTransitions: null,
Expand All @@ -211,7 +221,7 @@ Disable native transition for one state (for instance on tabs)

### State

```
```js
# * @description
# * Call state go and apply a native transition
# * @param {string|null} state default:null
Expand All @@ -228,7 +238,7 @@ $ionicNativeTransitions.stateGo('yourState', {}, {

### Location.url

```
```js
# * @description
# * Call location url and apply a native transition
# * @param {string|null} url default:null
Expand All @@ -243,7 +253,7 @@ $ionicNativeTransitions.locationUrl('/yourUrl', {

## Using directives

```
```html
<button native-ui-sref="tabs.home({param1: 'param1', param2: 'param2'})" native-ui-sref-opts="{reload: true}" native-options="{type: 'slide', direction:'down'}"></button>
```

Expand All @@ -261,7 +271,7 @@ For now swipe back will trigger the state native transition (or the default). It

You can disable swipe back like this:

```
```js
$ionicConfigProvider.views.swipeBackEnabled(false);
```

Expand All @@ -270,7 +280,11 @@ $ionicConfigProvider.views.swipeBackEnabled(false);
## Events
You can listen to success or error events

```
```js
$rootScope.$on('ionicNativeTransitions.beforeTransition', function(){
// Transition is about to happen
});

$rootScope.$on('ionicNativeTransitions.success', function(){
// Transition success
});
Expand All @@ -283,7 +297,7 @@ $rootScope.$on('ionicNativeTransitions.error', function(){
# Possible transitions
## Slide (default animation)

```
```js
{
"type" : "slide",
"direction" : "left", // 'left|right|up|down', default 'left' (which is like 'next')
Expand All @@ -293,7 +307,7 @@ $rootScope.$on('ionicNativeTransitions.error', function(){

## Flip

```
```js
{
"type" : "flip",
"direction" : "up", // 'left|right|up|down', default 'right' (Android currently only supports left and right)
Expand All @@ -303,7 +317,7 @@ $rootScope.$on('ionicNativeTransitions.error', function(){

## Fade (iOS and Android only)

```
```js
{
"type" : "fade",
"duration" : 500, // in milliseconds (ms), default 400
Expand All @@ -312,7 +326,7 @@ $rootScope.$on('ionicNativeTransitions.error', function(){

## Drawer (iOS and Android only)

```
```js
{
"type" : "drawer",
"origin" : "left", // 'left|right', open the drawer from this side of the view, default 'left'
Expand All @@ -322,7 +336,7 @@ $rootScope.$on('ionicNativeTransitions.error', function(){

## Curl (iOS only, direction up and down only)

```
```js
{
"type" : "curl",
"direction" : "up", // 'up|down', default 'up'
Expand Down
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ionic-native-transitions",
"version": "1.0.0-rc9",
"version": "1.0.0-rc10",
"description": "Native transitions for Ionic applications",
"main": [
"dist/ionic-native-transitions.js"
Expand Down
9 changes: 7 additions & 2 deletions dist/ionic-native-transitions.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/ionic-native-transitions.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/ionic-native-transitions.min.js

Large diffs are not rendered by default.

7 changes: 6 additions & 1 deletion lib/provider.js
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,10 @@ export default function() {
$log.debug('[native transition] cannot change state without a state...');
return;
}
if ($state.current.name === state){
$log.debug('[native transition] same state transition are not possible');
return;
}
unregisterToStateChangeStartEvent();
$state.go(state, stateParams, stateOptions);
transition(transitionOptions);
Expand Down Expand Up @@ -281,6 +285,7 @@ export default function() {
let type = options.type;
delete options.type;
$log.debug('[native transition]', options);
$rootScope.$broadcast('ionicNativeTransitions.beforeTransition');
switch (type) {
case 'flip':
window.plugins.nativepagetransitions.flip(options, transitionSuccess, transitionError);
Expand Down Expand Up @@ -449,7 +454,7 @@ export default function() {
function init() {
legacyGoBack = $rootScope.$ionicGoBack;
if (!isEnabled()) {
$log.debug('nativepagetransitions is disabled or nativepagetransitions plugin is not present');
$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.');
return;
} else {
enableFromService();
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ionic-native-transitions",
"version": "1.0.0-rc9",
"version": "1.0.0-rc10",
"description": "Native transitions for Ionic applications",
"main": "dist/ionic-native-transitions.js",
"scripts": {
Expand Down
9 changes: 9 additions & 0 deletions test/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export default function(
vm.enable = enable;
vm.disable = disable;
vm.stateGo = stateGo;
vm.sameStateGo = sameStateGo;
vm.locationUrl = locationUrl;
vm.disableWithoutDisablingIonicTransitions = disableWithoutDisablingIonicTransitions;
vm.openModal = openModal;
Expand All @@ -29,6 +30,10 @@ export default function(
$log.info(':(');
});

$rootScope.$on('ionicNativeTransitions.beforeTransition', function(){
$log.info('Transition is about to happen');
});

function openModal() {
if (vm.modal) {
vm.modal.show();
Expand Down Expand Up @@ -72,6 +77,10 @@ export default function(
vm.isEnable = $ionicNativeTransitions.isEnabled();
}

function sameStateGo() {
$ionicNativeTransitions.stateGo('tabs.home');
}

function stateGo() {
$ionicNativeTransitions.stateGo('four', {
test: 'buyakacha!',
Expand Down
1 change: 1 addition & 0 deletions test/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@
StateGo via directive without native-options
</button>
<a class="button button-full button-large icon icon-right ion-chevron-right" ng-click="main.locationUrl()">LocationUrl</a>
<a class="button button-full button-large icon icon-right ion-chevron-right" ng-click="main.sameStateGo()">sameStateGo</a>
</ion-content>
</ion-view>
</script>
Expand Down

0 comments on commit 1ed0e54

Please sign in to comment.