thaliproject / postcardapp

A sample app to demonstrate how to build Thali applications
MIT License
22 stars 5 forks source link

Take a photo! #62

Closed yaronyg closed 8 years ago

yaronyg commented 8 years ago

We need to take and store photos

deadlyfingers commented 8 years ago

How it might look - postcardapp2-photos

yaronyg commented 8 years ago

That is cool! Although I was more excited when I thought you had already implemented it. Took me a second to realize it was a mock. :)

deadlyfingers commented 8 years ago

Cordova returns base64 encoded imageData which we can store as a PouchDB attachment - http://pouchdb.com/guides/attachments.html or as a Blob. Does anyone have a preference?

yaronyg commented 8 years ago

There is no Cordova API that will return a buffer? I suppose that makes sense as the Cordova bridge requires everything to be a string. Sigh.. oh well. From a "helping Thali" perspective it would be best if we stored it as an attachment. This would force us to finally exercise those APIs.

deadlyfingers commented 8 years ago

I have small images being saved as an attachment in PouchDB using base64. But having trouble with saving large images on PouchDB 413 (Request Entity Too Large)

deadlyfingers commented 8 years ago

iframe issues: So I want to call Cordova commands from web app client on the mobile but I reckon I need to do some additional wiring to get working it with JXCore / Express app running inside an iframe... Tried to get 'parent' of iframe to get access to Cordova functions but this failed due to different origins 'file://' and 'localhost://'.

OPTIONS :

  1. Cross Domain Messaging - post message event using parent.postMessage('data','*'); to trigger Cordova function in main window - "index.js" then post message back to iframe to trigger callback. https://developer.mozilla.org/en-US/docs/Web/API/Window/postMessage
  2. Or do we really need to run everything inside an iframe? Potentially we can drop ejs requirement.
    • UPDATE: tried removing iframe but ran into various problems - mostly broken file links so going with option 1 which works