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

local data #69

Open
jeremiehirsch opened this issue Jan 31, 2016 · 4 comments
Open

local data #69

jeremiehirsch opened this issue Jan 31, 2016 · 4 comments

Comments

@jeremiehirsch
Copy link

Hello,

My app have an offline mode and all of data is saved in cdvfile://localhost/persistent/...
When offline mode is activate the urls of models data change for json local url.
On ios its ok but on android the status of the json files is 'pending' on google dev tools network when the app is starting and the app is blocked.

Any idea?

@cdaringe
Copy link
Member

cdaringe commented Feb 1, 2016

what is offline mode? is that an application defined thing or is it analogous to when the phone enters "airplane mode." if the latter, i wouldn't be surprised if the OS restricts HTTP calls (even local), so &-sync hangs/times out. are you using ampersand-sync (default w/ &-model) or have you used a different sync mechanism?

haven't ever done android dev, so i can't given in depth feedback, though am about to start on my first one :).

@jeremiehirsch
Copy link
Author

Hello,

Offline mode is just the application switch and call all of data in the filesystem. eg: cdvfile://localhost/persistent/uploads/json/bootstrap.json instead of call external REST API.
The rest is same, and effectively i use ampersand-sync like this : this.listenTo(this.model, 'sync', this.ready); to sync data whatever the mode.

My main view seem be blocked and the models are empty.

Thank you!

@cdaringe
Copy link
Member

cdaringe commented Feb 1, 2016

i've never tried to hit an endpoint where information served on the loopback is not explicitly served over http. it's not really a problem with &-model--&-model with REST mixin will make HTTP requests via xhr to the endpoint. if that endpoint doesn't serve JSON back, kaboom.

@AmpersandJS/core-team, has anyone seen a mobile friendly f/s sync published? @jeremiehirsch, my gut is that you need to override some methods in ampersand-sync to make a f/s read call, parse the json, and return that.

not a mobile expert, so take it with a grain of salt

@jeremiehirsch
Copy link
Author

Hello,

It's strange because the json loaded have same architecture as the data returned when the app has the offline mode turned off, and on ios environnement it's alright! :|
That is very strange because if on my 'main view' i load my bootstrap model (the json file that maches) through jQuery.ajax the data has returned correctly in the inspector. It's because I thought that the problem came from ajaxConfig on ampersand-model in the android environment.

Thank you for your answers :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants