phonegap / phonegap-plugin-contentsync

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

include phonegap.js in copyCordovaAssets #175

Closed wildabeast closed 7 years ago

wildabeast commented 7 years ago

On Phonegap Build we support both phonegap.js and cordova.js. Would be great if contentsync's copyCordovaAssets also copied phonegap.js.

macdonst commented 7 years ago

@wildabeast I haven't had a chance to test this but what happens if phonegap.js is not in the app? Does it just get silently skipped on all three platforms?

wildabeast commented 7 years ago

Good question I'll test that scenario.

wildabeast commented 7 years ago

Gah yeah looks like it breaks on iOS when its not there. Before I go forward @macdonst is this a reasonable addition? Or should I consider another strategy, like possibly a new option on the sync method, maybe additionalAssets, which is an array of additional assets to copy over?

wildabeast commented 7 years ago

Actually alternatively I could probably use the File plugin and copy it over after the sync completes. Maybe that's a better option.

imhotep commented 7 years ago

@wildabeast I would check for existence:

if([fileManager fileExistsAtPath:path]) {
  [fileManager copyItemAtURL:sourceURL toURL:destinationURL error:&errorCopy];
}
wildabeast commented 7 years ago

I'm actually thinking it makes more sense to do what I need with the file plugin from JS rather than tweaking the contentsync plugin to meet my specific needs. Going forward with that, will close this soon.

macdonst commented 7 years ago

@wildabeast I wouldn't be opposed to the conditional copy like @imhotep mentioned, please don't add another option to this crazy plugin. However, if you want to just do it with file plug in, go for it.

wildabeast commented 7 years ago

already done with File plugin :beers: