phonegap / phonegap-plugin-contentsync

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

Need to redo copy root app when app is updated #88

Open macdonst opened 8 years ago

macdonst commented 8 years ago

From a user:

"Another problem we're facing is, that the local content copy does not happen, if the directory already exists. so once the bundled content is copied to the sync directory - that's it. even if you update the original binary, you still have the old content in the synced directory.

So either it should be possible to specify a 'forceReplace' flag, or the local sync should also do a proper merge and update the files that are newer or we need to add some logic to the initial startup to determine if we need to delete the synced directory via the file-plugin."

Basically, you have app version 1 and you do a local sync with copyRootApp/copyCordovaAssets and everything is find. Then you upgrade your app to version 2 and include new app content or a new plugin. The call to do a local copy returns immediately and does not copy over the new content to the sync directory location.

tripodsan commented 8 years ago

I'm the 'user' :-) That was my finding on Android. I didn't have time to validate on iOS.

macdonst commented 8 years ago

@tripodsan I'm pretty sure it will be the same behaviour on iOS. We'll make sure to test.

imhotep commented 8 years ago

If you use option type: 'local' you don't want to update anything. You're requesting an existing version if it exists and optionally copying assets/root app if there weren't any. Not sure what the problem is ?

tripodsan commented 8 years ago
  1. install the app binary the first time
  2. call content sync, type: 'local' to initialise the local copy. creates .../work
  3. use content sync to get the latest update from a server. updates .../work
  4. make fundamental changes to the app that require updating the binary
  5. update the binary (does not remove the dataDirectory)
  6. next start does not copy the new, bundled data into the .../work

Workaround: detect binary update, remove the .../work directory before calling content sync

expected: even type=local would a at least update the modified files.

imhotep commented 8 years ago

@tripodsan Oh I see! I believe this could be fixed by copying root app before doing anything else (checking if app exists etc..). iOS currently checks if app exists before copying root app when type is set to local but we could reverse that. I believe Android does the same thing.

aramando commented 8 years ago

Be great to see a fix for this. We have an Android app that can only be updated by publishing an AEM shell update; app store updates have no effect because the updated files aren't being copied to the app's local storage where they are run from.

byronigoe commented 5 years ago

This appears to have been fixed, so this issue should be Closed.