diff options
author | Claudio Cambra <claudio.cambra@gmail.com> | 2022-06-10 16:22:48 +0300 |
---|---|---|
committer | Claudio Cambra <claudio.cambra@gmail.com> | 2022-06-13 14:11:20 +0300 |
commit | c5effcf247df72f0c42449660d5e19d3a37e0023 (patch) | |
tree | 02dce2fd31d91a7513bbf8337f7fe3df22aeb552 | |
parent | 2c9ede37dabd8342311e197a7c7d04bee783f27a (diff) |
Always provide Sparkle update data, fixing no valid update error
Signed-off-by: Claudio Cambra <claudio.cambra@gmail.com>
-rw-r--r-- | src/Response.php | 4 | ||||
-rw-r--r-- | tests/unit/ResponseTest.php | 18 |
2 files changed, 16 insertions, 6 deletions
diff --git a/src/Response.php b/src/Response.php index fe9fe42..30d35a4 100644 --- a/src/Response.php +++ b/src/Response.php @@ -86,11 +86,11 @@ class Response { $stable = $this->config[$this->oem]['stable'][$this->platform]; $beta = $this->config[$this->oem]['beta'][$this->platform]; - if ($this->channel == 'beta' && version_compare($stable['version'], $beta['version']) == -1) { + if ($this->channel == 'beta' && (version_compare($stable['version'], $beta['version']) == -1 || ($this->platform === 'macos' && $this->isSparkle === true))) { return $beta; } - if (version_compare($this->version, $stable['version']) == -1) { + if (version_compare($this->version, $stable['version']) == -1 || ($this->platform === 'macos' && $this->isSparkle === true)) { return $stable; } diff --git a/tests/unit/ResponseTest.php b/tests/unit/ResponseTest.php index e59f00d..2aaa457 100644 --- a/tests/unit/ResponseTest.php +++ b/tests/unit/ResponseTest.php @@ -270,7 +270,7 @@ class ResponseTest extends TestCase { <owncloudclient/> ' ], - // #16 + // #16 Except for Sparkle, which always needs to know what the latest version is [ 'nextcloud', 'macos', @@ -283,7 +283,12 @@ class ResponseTest extends TestCase { <channel> <title>Download Channel</title> <description>Most recent changes with links to updates.</description> - <language>en</language></channel> + <language>en</language><item> + <title>Nextcloud Client 2.2.2 (build 3472)</title> + <pubDate>Wed, 13 July 16 21:07:31 +0200</pubDate> + <enclosure url="https://download.owncloud.com/desktop/stable/ownCloud-2.2.2.3472.pkg.tbz" sparkle:version="2.2.2.3472" type="application/octet-stream" sparkle:edSignature="MC0CFQDmXR6biDmNVW7TvMh0bfPPTzCvtwIUCzASgpzYdi4lltOnwbFCeQwgDjY=" length="62738920"/> + <sparkle:minimumSystemVersion>10.13.0</sparkle:minimumSystemVersion> + </item></channel> </rss>' ], // #17 No updates if the version is higher @@ -334,7 +339,7 @@ class ResponseTest extends TestCase { <owncloudclient/> ' ], - // #21 + // #21 Again, Sparkle needs to know about the latest version [ 'nextcloud', 'macos', @@ -347,7 +352,12 @@ class ResponseTest extends TestCase { <channel> <title>Download Channel</title> <description>Most recent changes with links to updates.</description> - <language>en</language></channel> + <language>en</language><item> + <title>Nextcloud Client 2.2.2 (build 3472)</title> + <pubDate>Wed, 13 July 16 21:07:31 +0200</pubDate> + <enclosure url="https://download.owncloud.com/desktop/stable/ownCloud-2.2.2.3472.pkg.tbz" sparkle:version="2.2.2.3472" type="application/octet-stream" sparkle:edSignature="MC0CFQDmXR6biDmNVW7TvMh0bfPPTzCvtwIUCzASgpzYdi4lltOnwbFCeQwgDjY=" length="62738920"/> + <sparkle:minimumSystemVersion>10.13.0</sparkle:minimumSystemVersion> + </item></channel> </rss>' ], ]; |