Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drupalgap for Windows Phone 8 #291

Open
arielestigarribia opened this issue Jun 27, 2014 · 23 comments

Comments

@arielestigarribia
Copy link

commented Jun 27, 2014

Hi Tyler
I have successfully developed an app for android & iOs using drupalgap.
I try to go one more step and launch for windows phone too.
But when i open the app i get the messages below:
(1) ==========================================
drupalgap_theme_load - Failed to load theme!
The theme's JS file does not exist: ...

(2) ==========================================
Failed to load module! (my_module)

When i try with a demo of drupalgap, on a clean installation, i get message (1) again. I'm using latest stable releases of drupalgap and cordova 3.4.0.
I will appreciate any help.

Best regards.
Ariel

@signalpoint

This comment has been minimized.

Copy link
Owner

commented Jun 27, 2014

@arielestigarribia - I don't have any Windows hardware, so unfortunately I am unable to debug or work with this set of technologies.

Since it seems to fail the loading of a custom module (and potentially a custom theme), I am guessing it has to do with file/directory permissions within the Windows environment. Either that, or there is a JavaScript syntax error in one or both of the JS files associated with the module/theme.

I'd also recommend stepping through the bin/drupalgap.js file (or utilizing the developer guide with a makefile, preferred) and add some console.log() messages during the drupalgap bootstrap, to debug what is going on, and where problems are crashing.

Please report any progress back here, thanks!

@arielestigarribia

This comment has been minimized.

Copy link
Author

commented Jun 28, 2014

Apparently, it's a problem in cordova with ajax support, resolved in version 3.5.0
But, I did the upgrade from 3.4.0 to 3.5.0 cordova, and this function drupalgap_file_exists () is still returning false.

http://community.phonegap.com/nitobi/topics/does_windows_phone_8_support_jquery_mobile_ajax_call
jquery/jquery-mobile#6574
https://issues.apache.org/jira/browse/CB-6299
https://issues.apache.org/jira/browse/CB-5391

@signalpoint

This comment has been minimized.

Copy link
Owner

commented Jun 30, 2014

@arielestigarribia Thanks for the debug info. Perhaps you could try to implement a different version of the drupalgap_file_exists() function. Instead of using jQuery, maybe just a pure JavaScript implementation using an xml http request would fix the problem.

Let's try that, then if it works, we can replace the drupalgap_file_exists() function. Let me know if you have any questions, thanks!

@JPustkuchen

This comment has been minimized.

Copy link

commented Apr 10, 2015

Okay, let's collect all related information here for WP8.1 compatibility.

(My) Current status: My App is

  • NOT working under WP8.1
  • iOS: WORKS
  • Android: WORKS

The problem is (like described above) that the module javascript file is not being loaded successfully. The first error message is: Failed to load module! (...) [ajax call drupalgap_load_modules() function] and the errorThrown.message is: "the filename directory name or volume label syntax is incorrect"

DrupalGap Module version: 7.x-1.9
DrupalGap version: 7.x-1.0-rc4
jQuery version: jquery-1.9.1
jQuery Mobile version: jquery.mobile-1.4.2
jDrupal version: jdrupal-7.x-1.0
Used Cordova Version(s): 3.5.0, 3.7.0 (Both without any success or differences)

I'm using the following plugins:

<gap:plugin name="org.apache.cordova.dialogs" />
<gap:plugin name="org.apache.cordova.globalization" />
<gap:plugin name="org.apache.cordova.inappbrowser" />
<gap:plugin name="org.apache.cordova.network-information" />

What I've tried (current status):

  1. Setting <feature name="http://api.phonegap.com/1.0/network" /> and <access origin="*" /> in config.xml
    (I needed this feature also for other functionality. Without it other platforms also did not work. It did not make a change for WP8.1 but you should definitely add it!)
  2. Setting jQuery.support.cors = true; before all jQuery.ajax()-Calls (or in device ready). To ensure that it is being applied I wrote the line before every jQuery.ajax() call in drupalgap.js (bin and src) without any success or change.
  3. Set isLocal: true in every jquery.ajax() Call. I did that everywhere in drupalgap.js without any success.
  4. Adding a "./" Prefix to all pathes in drupalgap.js - did not make anything better.
  5. Building local using "cordova build wp8" OR building via build.phonegap.com. Both with the same results / errors.

@signalpoint: It would be very cool if we could perhaps set up a wp8 test application to work on together and find out what's the deeper reason and how to finally fix it. I really think we're not that far away from a solution and it would be cool if we could also provide Drupalgap support for WP8. Wouldn't it? :)

So far please let us collect all information here what to do to solve it.

IF ANYONE WAS ABLE TO RUN DRUPALGAP UNDER WP8, PLEASE HELP US!

Thanks a lot!

@signalpoint

This comment has been minimized.

Copy link
Owner

commented Apr 10, 2015

@JPustkuchen thank you for the detailed update. To discuss in detail please stop by #drupal-drupalgap on IRC.

I do not have any Windows hardware to test this out, so with that being said...

Have you tried setting $.mobile.allowCrossDomainPages to true? (http://stackoverflow.com/a/11868502/763010)

And yes, it would be awesome if the SDK could work with Windows phones. DrupalGap needs a Windows ambassador, that seat is currently vacant ;)

@signalpoint

This comment has been minimized.

Copy link
Owner

commented Apr 10, 2015

@JPustkuchen

This comment has been minimized.

Copy link

commented Apr 10, 2015

I gave the last one a try ~ 2 weeks ago... nothing got better for my case :(

@signalpoint

This comment has been minimized.

Copy link
Owner

commented Apr 10, 2015

@JPustkuchen please come to IRC to chat: http://drupalgap.org/irc

It may take us a few hours/days to coordinate, but let's solve this issue!

@signalpoint

This comment has been minimized.

Copy link
Owner

commented Apr 13, 2015

@JPustkuchen Try changing the implementation drupalgap_file_exists() to these four lines:

var http = new XMLHttpRequest();
http.open('HEAD', path, false);
http.send();
return http.status!=404;

Does that fix it?

@JPustkuchen

This comment has been minimized.

Copy link

commented Apr 14, 2015

I'll try that, thanks! We'll definitely have to change all jQuery.ajax calls if it works, but first let's see.
Much work currently, but I'll have a look asap!

@signalpoint

This comment has been minimized.

Copy link
Owner

commented Apr 14, 2015

@JPustkuchen great, thank you, I'm curious to see if it works. This is the only non-async call in DrupalGap core (I think), so hopefully regular synchronous calls will work in Windows.

@FaberfoX

This comment has been minimized.

Copy link

commented Jul 16, 2015

Ok, I've almost got my app working on windows phone, here is what I did so far:
I'm using latest cordova, plugins and drupalgap from here, I had to add this at the top of the index file, and also these 3 lines at the top of drupalgap_onload:

$.support.cors = true;
$.mobile.allowCrossDomainPages = true;
$.mobile.phonegapNavigationEnabled = true;

Then, replace type: 'HEAD' with type: 'GET' at drupalgap_file_exists (don't ask me why, HEAD fails with a permission error)

I'm building with cordova for platform wp8, so far I've been unable to create a working build for platform windows. I've tried retargetting the resulting app to WP8.1 in visual studio, but then it also fails.

My app has quite a few extra dependencies (JayData, Modernizr, a custom jQuery Mobile theme) so I'm guessing something closer to stock should work with these changes.

If someone else can reproduce this, it'd be great to get these minor changes committed, I'm seeing lots of lumias around here (Argentina) as they're practically giving them away.

@JPustkuchen

This comment has been minimized.

Copy link

commented Jul 17, 2015

Hello @FaberfoX, thanks a lot for your feedback.
Let me know, do you still get any errors or what are your final problems? I did not have time to test these changes but I'll definitely try them out!

I can confirm that drupalgap_file_exists is one of the major problems.

If you get your app running please also tell us, if the GET works on iOS an Android without problems.

@FaberfoX

This comment has been minimized.

Copy link

commented Jul 17, 2015

@JPustkuchen I have a few layout issues I haven't yet been able to sort, maybe due to some overrides I made, I'll update once I solve them. Also some contacts access and persistent storage, but nothing major. I could submit to the win store today disabling those features and probably get accepted. Another one that I haven't dug into yet is geolocation failing 4 out of 5 times.

I don't see an issue using GET instead of HEAD in that function, besides a few extra ms cpu, else you can override just on wp8 for now with if (device.platform == 'Win32NT')

The working app for android is this, same name on itunes. I hope to close my remaining issues to submit during the weekend.
Please try on your app, also ping @arielestigarribia, it'd great to get at least wp8 as a supported platform.

@FaberfoX

This comment has been minimized.

Copy link

commented Jul 23, 2015

Ok, so I've got my app listed at the windows phone store!
Basically, what's needed is on my previous post. Still haven't found a way to build for platform windows, app starts, first screen shows but can't navigate from it. Happens both on my app and on a clean DG install, so I went with a wp8 build. If someone else wants to try to get it working, I'd start with later versions of jquery and jquery mobile, I've seen some reports of trouble on wp8.1.
WP is much more sensitive to css errors, I had to catch a few of them that caused no issue on both android and ios, like a background-size: 100% 100$;, they created weird, hard to track issues on WP.
Debugging is a pita, besides console output I used weinre but it didn't show the proper css attributes for the injected/generated pages, and the html elements weren't in the proper order. I don't know enough (and don't really care to learn much) about the quirks of IE10 on WP8, but it was still somewhat useful.
Don't disable the splash screen on index.html, it would break the app in my case.
Finally, disable the 'do you want to exit' dialog, as one of the WP design guidelines says an app should exit when pressing back from the initial screen, it was a blocker for release in my case.
I'll try to put together a patch and do a pull request, I'll hit you on irc tomorrow @signalpoint to check the proper way to do it.
@JPustkuchen, @arielestigarribia would be great to get one of you to confirm it working on your end.

Cheers!

@arielestigarribia

This comment has been minimized.

Copy link
Author

commented Jul 23, 2015

Hi
I'll try to update my app with all the tips collected here and see whats happen.
Also, right now i haven't any windows phone. But after get one, i'll work again on this task and lets you know if it works.

Thanks for the feedback.
Best Regards.

@mkinnan

This comment has been minimized.

Copy link
Contributor

commented Sep 18, 2015

Any updates on getting drupalgap apps deployed on Windows Phone? I have tried some of the fixes above with no luck. I am compiling using Adobe Phonegap Build service.

@JPustkuchen

This comment has been minimized.

Copy link

commented Sep 19, 2015

Not yet. I did not have the time to have a look, but I think one day I'll have to get into this again.

@FaberfoX

This comment has been minimized.

Copy link

commented Sep 19, 2015

I'm sorry I haven't had the time to put a patch together. Right now, my app is in the windows store, with about 200 users and so far no bug reports. I built using Visual Studio, targeting WP8 (not 8.1). Command line cordova also worked, but I've never used phonegap build, so I'm not sure how much work would it take to get it running there. My post from July 16 stands, those are the only changes I had to make. The layout issues I had turned out to be errors in the css, looks like webkit is a lot more forgiving with them. I'll have to work a bit on the app soon, to consolidate the code base as there are tweaks on the 3 platforms and some more for the web app, so once I do that I'll try to get the patch up.

@xHomerOx

This comment has been minimized.

Copy link

commented Sep 21, 2015

Haven't tried in Windows 8.1, but i tried in Windows 7 with a cracked version of the SDK 8.1 and it seems that wouldn't work, it shows me with an exit code 1 and 2 in red letters. The same thing happens if you try to compile with older and latest Visual Studio. no wp8 or windows in command console works, but we had no money to spend in a an application for windows or ios yet. It will depend of the success on the android platform. Anyway I will check at home if the problem is from the OS and/or SDK of Windows Phone.

@ivan-grozni

This comment has been minimized.

Copy link

commented Sep 29, 2015

I have had the same issue with no luck using the described changes.

But one thing I did notice is that I was able to get DrupalGap to work on Windows 8.10.14. Before I was using Windows 8.10.12, once I updated the phone to 8.10.14, it started to work - in case that helps anyone else.

@mkinnan

This comment has been minimized.

Copy link
Contributor

commented Oct 4, 2015

I have been using the 2015 Visual Studio Community, and can get my app to work in the Windows 10 emulator. But it doesn't work in the Windows Phone 8.1 emulator.

@FaberfoX

This comment has been minimized.

Copy link

commented Oct 4, 2015

@mkinnan that's the VS I'm using, but building for windows 8, not 8.1. In my case it launched on windows 10 but none of the buttons I placed / menus worked. It could be my theme and customizations, but as for now targeting wp8 works, I didn't push it further. My cpu doesn't support EPT so I can't run the emulator. I bought a really cheap Lumia 530 to test. As I'll be moving the app to my client's server, I'll be able to test on the emulator and report back.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
7 participants
You can’t perform that action at this time.