Skip to content
This repository was archived by the owner on Aug 11, 2020. It is now read-only.
This repository was 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

Description

@ptandler

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions