2 DR. GLEARNING FOR FIREFOX OS Juan Luis Suárez, Javier de la Rosa @suarez_juanluis, @versae The CulturePlex Lab Western University, London, ON FirefoxOS App Day – Toronto 2012
9 WHAT IS DR. GLEARNING? • An educational app to do your homework and test yourself by playing for the next level • Teachers prepare their question according to six types of activities (so far) • Activities are automatically graded
19 WHY? • Sencha Touch relies heavily on WebKit • Sencha Touch is designed for mobile phones • Until a week ago, there was only WebKit compliant native browser components for mobile phones
20 WHAT COULD WE DO? • Hack Sencha Touch – SenchaFox: https://github.com/Martin1982/SenchaFox • Translate specific Webkit CSS rules to Gecko – Nightmare • Port the whole application to a different technology – Gecko compliant, of course
21 OUR STACK • jQuery Mobile for interface and interaction – WebKit and Gecko compatible – http://jquerymobile.com/ • lawnchair for storage – Tiny and framework agnostic – http://brian.io/lawnchair/
23 FIREFOX OS DR. GLEARNING • All Firefox OS apps are HTML5 apps • Not all HTML5 apps are Firefox OS apps • Two types FirefoxOS apps: – Hosted – Packaged
25 FIREFOX OS DR. GLEARNING • Problems of Packaged Apps – POST, PUT and DELETE HTTP verbs (REST) • Workaround 1: Enable Cross Origin Resource Sharing (CORS) server-side for any origin
26 FIREFOX OS DR. GLEARNING • Problems of Packaged Apps – POST, PUT and DELETE HTTP verbs (REST) • Workaround 1: Enable Cross Origin Resource Sharing (CORS) server-side for any origin Not a good idea! ←
27 FIREFOX OS DR. GLEARNING • Problems of Packaged Apps – POST, PUT and DELETE REST verbs • Workaround 1: Enable Cross Origin Resource Sharing (CORS) server-side for any origin Not a good idea! ← • Workaround 2: Add parameters to XHR objects (MozAnon, MozSystem, etc)
28 FIREFOX OS DR. GLEARNING • Problems of Packaged Apps – POST, PUT and DELETE REST verbs • Workaround 1: Enable Cross Origin Resource Sharing (CORS) server-side for any origin Not a good idea! ← • Workaround 2: Add parameters to XHR objects (MozAnon, MozSystem, etc) Hard to test, bad support in simulator ←
29 FIREFOX OS DR. GLEARNING • Problems of Packaged Apps – POST, PUT and DELETE REST verbs • Workaround 1: Enable Cross Origin Resource Sharing (CORS) server-side for any origin Not a good idea! ← • Workaround 2: Add parameters to XHR objects (MozAnon, MozSystem, etc) Hard to test, bad support in simulator ← • Workaround 3: Use JSONP and emulate everything through a GET request Not very RESTful, but works ←
31 FIREFOX OS DR. GLEARNING • Problems of Packaged Apps – Third party APIs (e.g., Google APIs) • Workaround: Content Security Policy Couldn't make it work ←
33 FIREFOX OS DR. GLEARNING • App served at app.drglearning.com by Nginx • webapp.manifest file served with Content-Type: application/x-web-app-manifest+json { "name": "Dr Glearning", "description": "The Mobile Game Learning Platform.", "launch_path": "/index.html", "icons": { "128": "/resources/images/ic_launcher.png" }, "developer": { "name": "CulturePlex Lab.", "url": "http://www.cultureplex.ca" } }
38 THANKS! Questions? Juan Luis Suárez, Javier de la Rosa @suarez_juanluis, @versae The CulturePlex Lab Western University, London, ON FirefoxOS App Day – Toronto 2012