marklogic-community / marklogic-samplestack

A sample implementation of the MarkLogic Reference Architecture
Apache License 2.0
82 stars 56 forks source link

Phonegapping the browser tier with Cordova #234

Open dcerisano opened 9 years ago

dcerisano commented 9 years ago

Had some issues with the android APK generated by Cordova on the browser tier gulp build. I am using the terms Cordova and Phonegap interchangeably, but referring to the tool, not the cloud service.

I noticed small things like trailing slashes in the state-hierarchy file, that Cordova takes issue with.

Just wondering if anyone has ever tried this. AFAIK, this build should be phonegap-able to mobile apps, since it is bootstrapped angular.

If so, could a recipe be provided? I know it is an extra constraint to be Phonegap compliant, but it should not interfere with your progress on the stack, and certainly is of interest.

Again, keep up the great work. Eager to see EA3, even if I have to download nightly engine builds.

laurelnaiad commented 9 years ago

We'd like to establish/maintain compatibility with Phonegap/Cordova. I have some experience with its finickiness, but at present, we don't have resources allocated to Cordova.

That said, if you can fill out the MarkLogic contributor license agreement (instructions at the bottom of the form) and contribute fixes via pull requests, then we'd be very happy to consider them.

Thanks, @dcerisano.

P.S. Are you using PhoneGap Build cloud service or building locally?

dcerisano commented 9 years ago

Thanks Stu, I will PM you about this.

From what I have experienced, the use of angular-ui-router states require some special syntax constraints for Cordova. Perhaps these could be expressed as jshint rules.

I am using Cordova, the local build tool, not the cloud service.

laurelnaiad commented 9 years ago

I've done Cordova with angular-ui-router and I don't remember any particular issues with the combination, but it was a while ago, so something may have changed or it may have escaped my memory.

dcerisano commented 9 years ago

My efforts thus far have indicated special Cordova restrictions around URL syntax (like no trailing slashes in the ui-router hierarchy file and possibly elsewhere). There are other constraints, I shall knock them down as I go.

My target is a fairly small device (Nexus 7).

laurelnaiad commented 9 years ago

ui-router considers slashes to be significant, and I don't quite understand how this could be a problem for Cordova. I think it's possible there might be something else going on.

Size of device may also be a challenge for the layout that's in the codebase right now, but lets tackle basic functionality first.

Are you familiar with debugging on the phone such that you can see the phone's JS engine log?

dcerisano commented 9 years ago

yes. i am filtering on app events in logcat via adb.

dcerisano commented 9 years ago

not seeing the angular ready event. think this might be a library version issue.Cordova may be using an older angular lib.

laurelnaiad commented 9 years ago

Ok, if you can post the log that might be helpful. I was actually meaning to refer to something in the weinre space, e.g. http://stackoverflow.com/questions/21332853/is-there-a-real-solution-to-debug-cordova-apps

laurelnaiad commented 9 years ago

Cordova shouldn't be supplying the angular lib, it's in the app.

laurelnaiad commented 9 years ago

Can you tell me what angular ready event you're expecting? The app is only waiting for the app requirejs module to finish loading before it attempts to bootstrap angular, after which angular is "allowed to take over" with its digest cycle.

https://github.com/marklogic/marklogic-samplestack/blob/master/browser/src/index.html#L79

laurelnaiad commented 9 years ago

How much of the app are you bundling into your app vs. getting from a web server?

You might want to try disabling HTML5 mode on this line:

https://github.com/marklogic/marklogic-samplestack/blob/master/browser/buildParams.js#L69

dcerisano commented 9 years ago

You lost me at "weinre space".

Somethings have come up that I need to focus on in the near future. Let's put a pin in this and let the product managers escalate it as they see fit. I shall try to get back to it soon.

Thanks again. I am extremely impressed with this project and very grateful for the professional and instantaneous support around it.

laurelnaiad commented 9 years ago

Haha, ok. This is weinre: http://people.apache.org/~pmuellr/weinre/docs/latest/.

The link above was to a stackoverflow question where running it against a Cordova app was discussed.

I'll look forward to moving on this when one or both of us has the bandwidth.

dcerisano commented 9 years ago

Great. Maybe give a nudge to the PMs to maintain a responsive design layout.

laurelnaiad commented 9 years ago

Layout changes are-a-comin'... :)