phonegap / phonegap-plugin-contentsync

Download and cache remotely hosted content
Apache License 2.0
206 stars 98 forks source link

Sync on complete always returns TRUE cached flag. #147

Closed kleeb closed 7 years ago

kleeb commented 7 years ago

On the first run of the app I am running

var sync = ContentSync.sync({id: 'app', type: 'local'}); sync.on('complete', function(data) {...

just to check if the app has cached data, and it properly responds with error

on the second and next runs however I am always getting data.cached=true, even though no data has been cached, which ends up with fatal error ERR_FILE_NOT_FOUND.

timkim commented 7 years ago

Hi @kleeb

What version of the plugin are you using and on which platform?

kleeb commented 7 years ago

I am checking the latest version on Android 6.

And this looks weird for Android:

result.put(PROP_CACHED, type.equals(TYPE_LOCAL))

isn't it always true when we choose local sync?

Shouldn't it be more something like:

result.put(PROP_CACHED, new File(outputDirectory + "/www/").exists()) ?