phonegap / phonegap-plugin-contentsync

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

Merge not working on iOS and wp8 #46

Closed timkim closed 9 years ago

timkim commented 9 years ago

Trying to get the delta updates working on the phonegap developer app but it appears that the merge isn't quite working on iOS and wp8.

So the initial content sync:

uri = encodeURI(options.address + '/__api__/appzip');
sync = ContentSync.sync({ src: uri, id: 'phonegapdevapp', type: 'replace', copyCordovaAssets: true });
sync.on('complete', function(data) {
    window.location.href = data.localPath + '/www/index.html';
});

And then the merge code:

uri = encodeURI(options.address + '/__api__/update');
sync = ContentSync.sync({ src: uri, id: 'phonegapdevapp', type: 'merge', copyCordovaAssets: false });
sync.on('complete', function(data) {
    window.location.reload();
});

On iOS, it receives the new zip, successfully unzips but never displays the new content. I have to look further into wp8 but I suspect it might not be playing nice with the server.

timkim commented 9 years ago

I can confirm that this works on ios although it does throw a lot of warnings: eg:

2015-07-16 14:51:32.484 PhoneGap[547:7a03] NSURLProtocolNoCache request was cancelled.
2015-07-16 14:51:32.489 PhoneGap[547:7a03] NSURLProtocolNoCache request was cancelled.
2015-07-16 14:51:32.492 PhoneGap[547:7a03] NSURLProtocolNoCache request was cancelled.

On wp8, it appears the problem is with connect-phonegap and not preserving sessionIDs. ie, wp8 likes to have two (maybe more?) session IDs which really messes up which files it needs to update.