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
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)
Platform and Version (eg. Android 5.0 or iOS 9.2.1)
iOS
Cordova CLI version and cordova platform version
Plugin version
But as far as I saw this code didn't change in the current 1.4.2