thaliproject / postcardapp

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

Need to fix file location for postcard app db #49

Closed yaronyg closed 8 years ago

yaronyg commented 8 years ago

Right now we put leveldown into temp directory on iOS so it gets randomly deleted. We need to instead use Mobile.getDocumentsPath

deadlyfingers commented 8 years ago

Can't seem to call 'Mobile.getDocumentsPath' within jxcore/app.js getting Mobile is undefined As you can see from the console log below jxcore engine is started so it should be available?

JXcore Cordova bridge is ready!
JXcore engine is started
starting app.js
Error!: Mobile is undefined
yaronyg commented 8 years ago

Um.... AHHHHH!!! How is this even theoretically possible? Can you point me at what branch you are using? This one is just weird.

deadlyfingers commented 8 years ago

Story_0 / Story_0_dadougla Ok -- got it working. L#19 var Mobile = require('thali/mockmobile.js'); within the conditional statement for desktop development env was causing the problem. It shouldn't be getting triggered in native land!

deadlyfingers commented 8 years ago

Now database is being saved after app shutdown - as you can see the app container shows the pouchdb being saved in Documents folder.

ios-documents

Android documents location path:

pkg: /data/local/tmp/org.thaliproject.postcardapp
I/jxcore-log﹕ Mobile Documents dbPath location:  /data/data/org.thaliproject.postcardapp/files/dbPath
yaronyg commented 8 years ago

If we are good then let's close this issue.

deadlyfingers commented 8 years ago

Ok, I'll check in the change which works great on iOS. But as a side effect I've had to comment out the require line to mockmobile for desktop until I figure out what is going on with that exactly.

deadlyfingers commented 8 years ago

Moved to done. Pushed to branch story_0_dadougla

deadlyfingers commented 8 years ago

Could do with logout / delete db button now? Re-installs preserve the app data so you have to manually delete the apps if you want a clean install for testing.

yaronyg commented 8 years ago

I'm confused. I assumed that we actually need this because otherwise there is no way to start a test clean without uninstalling and re-installing the app?