mirror of
https://github.com/mas-cli/mas
synced 2024-11-28 14:30:29 +00:00
🍏 Ignore min OS for iOS apps
This commit is contained in:
parent
75d6d39bd3
commit
1fe4b5b3e2
2 changed files with 9 additions and 5 deletions
|
@ -28,8 +28,8 @@ extension SoftwareProduct {
|
||||||
/// - Parameter storeApp: App from search result.
|
/// - Parameter storeApp: App from search result.
|
||||||
/// - Returns: true if the app is outdated; false otherwise.
|
/// - Returns: true if the app is outdated; false otherwise.
|
||||||
func isOutdatedWhenComparedTo(_ storeApp: SearchResult) -> Bool {
|
func isOutdatedWhenComparedTo(_ storeApp: SearchResult) -> Bool {
|
||||||
// Only look at min OS version if we have one
|
// Only look at min OS version if we have one, also only consider macOS apps
|
||||||
if let osVersion = Version(storeApp.minimumOsVersion) {
|
if let osVersion = Version(storeApp.minimumOsVersion), storeApp.kind == "mac-software" {
|
||||||
let requiredVersion = OperatingSystemVersion(majorVersion: osVersion.major, minorVersion: osVersion.minor,
|
let requiredVersion = OperatingSystemVersion(majorVersion: osVersion.major, minorVersion: osVersion.minor,
|
||||||
patchVersion: osVersion.patch)
|
patchVersion: osVersion.patch)
|
||||||
// Don't consider an app outdated if the version in the app store requires a higher OS version.
|
// Don't consider an app outdated if the version in the app store requires a higher OS version.
|
||||||
|
|
|
@ -20,9 +20,10 @@ public class SoftwareProductSpec: QuickSpec {
|
||||||
describe("software product") {
|
describe("software product") {
|
||||||
let app = SoftwareProductMock(appName: "App", bundleIdentifier: "", bundlePath: "", bundleVersion: "1.0.0", itemIdentifier: 111)
|
let app = SoftwareProductMock(appName: "App", bundleIdentifier: "", bundlePath: "", bundleVersion: "1.0.0", itemIdentifier: 111)
|
||||||
|
|
||||||
let currentApp = SearchResult(version: "1.0.0")
|
let currentApp = SearchResult(kind: "mac-software", version: "1.0.0")
|
||||||
let appUpdate = SearchResult(version: "2.0.0")
|
let appUpdate = SearchResult(kind: "mac-software", version: "2.0.0")
|
||||||
let higherOs = SearchResult(minimumOsVersion: "99.0.0", version: "3.0.0")
|
let higherOs = SearchResult(kind: "mac-software", minimumOsVersion: "99.0.0", version: "3.0.0")
|
||||||
|
let updateIos = SearchResult(kind: "software", minimumOsVersion: "99.0.0", version: "3.0.0")
|
||||||
|
|
||||||
it("is not outdated there is no new version available") {
|
it("is not outdated there is no new version available") {
|
||||||
expect(app.isOutdatedWhenComparedTo(currentApp)) == false
|
expect(app.isOutdatedWhenComparedTo(currentApp)) == false
|
||||||
|
@ -33,6 +34,9 @@ public class SoftwareProductSpec: QuickSpec {
|
||||||
it("is not outdated when the new version requires a higher OS version") {
|
it("is not outdated when the new version requires a higher OS version") {
|
||||||
expect(app.isOutdatedWhenComparedTo(higherOs)) == false
|
expect(app.isOutdatedWhenComparedTo(higherOs)) == false
|
||||||
}
|
}
|
||||||
|
it("ignores minimum iOS version") {
|
||||||
|
expect(app.isOutdatedWhenComparedTo(updateIos)) == true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue