Paulo Fraga
Posts: 0
Joined: Sun Nov 08, 2015 9:26 pm

Apperyio.navigateTo doesn't work at the first moment

I have an ionic and angularjs app with two pages. The first one is a login page, and the second one is a loginSucess page. In the login page i put a button that runs the code below on the ng-click:

This function runs a facebook login routine.

// Function code
var ref = new Firebase("https://pet-wise.firebaseio.com/users");
ref.authWithOAuthPopup("facebook", function(error, authData) {
if (error) {
console.log("Login Failed!", error);
} else {
Apperyio.navigateTo("loginSucess", {});
console.log("Authenticated successfully with payload:", authData);

}
});

When I click on the facebook login button for the first time, the app performs the function and returns the authData object sucessfully, but the app remains on the login page. On the console I can see the authData object. The expected behavior would be that the app was directed to the loginSucess page.
Just when I click the button for the second time the app redirects to the loginSucess page.

What am I doing wrong?

Serhii Kulibaba
Posts: 150
Joined: Tue Aug 27, 2013 1:47 pm

Apperyio.navigateTo doesn't work at the first moment

Hello Paulo,

Please add a timeout before navigation to other page:

setTimeout(function(){
Apperyio.navigateTo("loginSucess", {});
}, 100);

Paulo Fraga
Posts: 0
Joined: Sun Nov 08, 2015 9:26 pm

Apperyio.navigateTo doesn't work at the first moment

Sergiy, unfortunately it doesn't work.

Please see the images of the app runing in test mode, and the console response.

First screen when the test starts...
Image

Screen and console after the first click...
Image

Screen and console after the second click...
Image

The code of the button is below:

// Function code
var ref = new Firebase("https://pet-wise.firebaseio.com/users");
ref.authWithOAuthPopup("facebook", function(error, authData) {
if (error) {
console.log("Login Failed!", error);
} else {
console.log("Authenticated successfully with payload:", authData);
setTimeout(function(){
Apperyio.navigateTo("loginSucess", {});
var sucess = true;
console.log('Login:'+sucess);
}, 100);
}
});

Paulo Fraga
Posts: 0
Joined: Sun Nov 08, 2015 9:26 pm

Apperyio.navigateTo doesn't work at the first moment

Please, does anybody can help me?

Serhii Kulibaba
Posts: 150
Joined: Tue Aug 27, 2013 1:47 pm

Apperyio.navigateTo doesn't work at the first moment

Please share (http://devcenter.appery.io/documentat...) your app with a href="mailto:support@appery.io" rel="nofollow"support@appery.io/a and provide us with the following information:

1) App name
2) Test credentials if login functionality is implemented in your app
3) Detailed steps to reproduce the issue

Paulo Fraga
Posts: 0
Joined: Sun Nov 08, 2015 9:26 pm

Apperyio.navigateTo doesn't work at the first moment

The App name is: IonicApp
To test the app just click in "Login com Facebook" button

Step by Step:

Start test on the App.
On the Start Screen click on "Login com Facebook" button
The facebook login screen will start
Insert any facebook valid credential
After the login process the app still remains in the start screen, this is the problem.
If you click one more time on the button "Login com Facebook", the app will be redirect to the Register page.

The expected result is that after the first click and the sucess on the login process the app navigates to the result page.

Regards,
Paulo Fraga.

Andrew Peacock
Posts: 0
Joined: Thu Jan 09, 2014 10:03 pm

Apperyio.navigateTo doesn't work at the first moment

Hi Sergiy,
There's definitely an issue.

I've just created a new project:

Screen1 - just has a text component with "screen 1" on it. In the init() function I added this:

setTimeout(function(){
Apperyio.navigateTo("screen2");
}, 100);

Screen 2 - just has a text component with "screen 2" on it.

The app never shows screen 1 and stops. Never gets to screen 2.

I've shared the app with support:
https://appery.io/app/projects/39eccd...

Regards,
Andy

Serhii Kulibaba
Posts: 150
Joined: Tue Aug 27, 2013 1:47 pm

Apperyio.navigateTo doesn't work at the first moment

Andrew,

JS is case-sensitive language.
You have page "Screen2", but use JS code with "screen2".
Please use JS below for that:
preApperyio.navigateTo("Screen2");/pre

Return to “Issues”