Comments (5)
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.
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.
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.
This should be fixed by #20
from jockeyjs.
Awesome, thanks @paulpdaniels. Closing.
from jockeyjs.
Related Issues (20)
- Composite Handlers HOT 1
- Don't send Jockey events on mobile Safari (for debugging) HOT 2
- Unit Tests for Android HOT 1
- Android < 4.4 is not working with iframes HOT 2
- Callback with data HOT 1
- Publish jockyjs's js on npm or bower HOT 4
- WKWebView Support HOT 4
- replace usage of e.printStackTrace() with Log.e(TAG, MESSAGE, e) HOT 1
- Support for Crosswalk Webview
- Undefined callback
- optional `off` argument to off a specific handler
- Can jockeyjs combine with angular2 to work on App,and then return Promise Object?
- 嵌套调用jockey.on,出现函数被覆盖
- HTML dynamic image loading is not working in IOS Webview
- TypeScript definition
- 有没有上传**仓库,gradle打包怎么用
- 有没有android x86的node4.4.4的二进制文件
- 有没有android x86的node4.4.4的二进制文件
- Podspec update - HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jockeyjs.