Skip to content
This repository has been archived by the owner on Aug 11, 2020. It is now read-only.

When calling ContentSync.sync({type: "local", ...}) the "PREVIOUS_VERSION" is not set if local content does not exists yet #194

Open
ptandler opened this issue Apr 11, 2018 · 0 comments

Comments

@ptandler
Copy link

Expected Behaviour

The NSUserDefaults @ "PREVIOUS_VERSION" should also be set when the option type is not "local".
In fact, it should be set when s.th. is downloaded.

Actual Behaviour

Currently, the "PREVIOUS_VERSION" is set in hasAppBeenUpdated, which is only called if type==="local" && [fileManager fileExistsAtPath:[appPath path]].

So, if the path doesn't exist yet, the "PREVIOUS_VERSION" remains null.

Reproduce Scenario (including but not limited to)

var sync = ContentSync.sync({type: 'merge', id: 'app-1', src: "http://some.zip"});
// some time later
var sync = ContentSync.sync({type: 'local', id: 'app-1'});
// will fail as hasAppBeenUpdated returns false, because the "PREVIOUS_VERSION" has not yet been set

Platform and Version (eg. Android 5.0 or iOS 9.2.1)

iOS

Cordova CLI version and cordova platform version

cordova --version                                    # 8.0.0
cordova platform version ios                   # 4.5.4

Plugin version

cordova plugin version | grep phonegap-plugin-contentsync   # 1.3.6

But as far as I saw this code didn't change in the current 1.4.2

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

No branches or pull requests

1 participant