Git Product home page Git Product logo

Comments (5)

 avatar commented on August 24, 2024

I found the root of the problem as well as the solution. In the latest js of the library you included the following code:

if (iOS && UIWebView) {
Jockey.dispatcher = iOSDispatcher;
} else {
Jockey.dispatcher = nullDispatcher;
}

Unfortunately in Android the dispatcher used was the nullDispatcher so nothing was been send to the app. After almost going nuts why your sample application was working was due to the fact that actually in the library included in the sample project the code looked like this.

// if (iOS && UIWebView) {
Jockey.dispatcher = iOSDispatcher;
// } else {
// Jockey.dispatcher = nullDispatcher;
// }

So the iOSDispatcher was always been used. After looking at the code I am not sure why do you even need to distinguish between iOS and Android. The dispatch method inside the iOSDispatcher has the following line of code:

window.location.href = "jockey://" + type + "/" + envelope.id + "?" + encodeURIComponent(JSON.stringify(envelope));

This might cause issues but actually you already solved it in the Android library with this:
public boolean isJockeyScheme(URI uri) {
return uri.getScheme().equals("jockey") && !uri.getQuery().equals("");
}

So yo actually detect the redirection in the Android JockeyWebViewClient() so it is handled correctly. So I would recommend updating the JS library code as it is really confusing and it seems to be working correctly by using always the iOSDispatcher.

Again thanks for the work done.

from jockeyjs.

tcoulter avatar tcoulter commented on August 24, 2024

Wow @jatago, thanks for finding this. The original JS was written by me when I assumed there would need to be a different dispatcher for Android. Another fine coder came along and filled out the android work not needing a new dispatcher, and I guess the JS never got updated.

Would you mind submitting a PR? I'd love to have this change in there.

from jockeyjs.

 avatar commented on August 24, 2024

Hi Tim!

Sure no problem ;) thanks to you guys for writing this library. Super
simple to use and extremely helpful!
On Jan 23, 2014 5:38 PM, "Tim Coulter" [email protected] wrote:

Wow @jatago https://github.com/jatago, thanks for finding this. The
original JS was written by when I assumed there would need to be a
different dispatcher for Android. Another fine coder came along and filled
out the android not needing a new dispatcher, and I guess the JS never got
updated.

Would you mind submitting a PR? I'd love to have this change in there.


Reply to this email directly or view it on GitHubhttps://github.com//issues/18#issuecomment-33141548
.

from jockeyjs.

paulpdaniels avatar paulpdaniels commented on August 24, 2024

This should be fixed by #20

from jockeyjs.

tcoulter avatar tcoulter commented on August 24, 2024

Awesome, thanks @paulpdaniels. Closing.

from jockeyjs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.