Revert "Use semver library for version checks (#843)"

This reverts commit 380a6acfd1.
This commit is contained in:
Thomas Ricouard 2023-02-14 07:03:49 +01:00
parent af61ff7914
commit df98e0f987
4 changed files with 12 additions and 35 deletions

View file

@ -82,7 +82,6 @@
9FE3DB57296FEFCA00628CB0 /* AppAccount in Frameworks */ = {isa = PBXBuildFile; productRef = 9FE3DB56296FEFCA00628CB0 /* AppAccount */; };
C9B22677297F6C2E001F9EFE /* ContentSettingsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C9B22676297F6C2E001F9EFE /* ContentSettingsView.swift */; };
D08A9C3529956CFA00204A4A /* SwipeActionsSettingsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D08A9C3429956CFA00204A4A /* SwipeActionsSettingsView.swift */; };
D8A16D0B299B4ACD00840104 /* SemVer in Frameworks */ = {isa = PBXBuildFile; productRef = D8A16D0A299B4ACD00840104 /* SemVer */; };
E92817FA298443D600875FD1 /* Models in Frameworks */ = {isa = PBXBuildFile; productRef = E92817F9298443D600875FD1 /* Models */; };
E92817FC298443D600875FD1 /* Network in Frameworks */ = {isa = PBXBuildFile; productRef = E92817FB298443D600875FD1 /* Network */; };
E92817FE29844DB700875FD1 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = E92817FD29844DB700875FD1 /* Assets.xcassets */; };
@ -276,7 +275,6 @@
buildActionMask = 2147483647;
files = (
9F7335EF29674F7100AFF0BA /* QuickLook.framework in Frameworks */,
D8A16D0B299B4ACD00840104 /* SemVer in Frameworks */,
9F7335ED2967463400AFF0BA /* AVKit.framework in Frameworks */,
9F2A540C29699705009B2D7C /* RevenueCat in Frameworks */,
065FA1FE29866CD600012EA0 /* LRUCache in Frameworks */,
@ -593,7 +591,6 @@
9F2A540B29699705009B2D7C /* RevenueCat */,
9FE3DB56296FEFCA00628CB0 /* AppAccount */,
065FA1FD29866CD600012EA0 /* LRUCache */,
D8A16D0A299B4ACD00840104 /* SemVer */,
);
productName = IceCubesApp;
productReference = 9FBFE639292A715500C250E9 /* IceCubesApp.app */;
@ -672,7 +669,6 @@
9FAE4ACC29379A5A00772766 /* XCRemoteSwiftPackageReference "keychain-swift" */,
9F2A540829699705009B2D7C /* XCRemoteSwiftPackageReference "purchases-ios" */,
065FA1FC29866CD600012EA0 /* XCRemoteSwiftPackageReference "LRUCache" */,
D8A16D09299B4ACD00840104 /* XCRemoteSwiftPackageReference "semver" */,
);
productRefGroup = 9FBFE63A292A715500C250E9 /* Products */;
projectDirPath = "";
@ -1359,14 +1355,6 @@
kind = branch;
};
};
D8A16D09299B4ACD00840104 /* XCRemoteSwiftPackageReference "semver" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/sersoft-gmbh/semver";
requirement = {
kind = exactVersion;
version = 3.4.0;
};
};
/* End XCRemoteSwiftPackageReference section */
/* Begin XCSwiftPackageProductDependency section */
@ -1485,11 +1473,6 @@
isa = XCSwiftPackageProductDependency;
productName = AppAccount;
};
D8A16D0A299B4ACD00840104 /* SemVer */ = {
isa = XCSwiftPackageProductDependency;
package = D8A16D09299B4ACD00840104 /* XCRemoteSwiftPackageReference "semver" */;
productName = SemVer;
};
E92817F9298443D600875FD1 /* Models */ = {
isa = XCSwiftPackageProductDependency;
productName = Models;

View file

@ -63,15 +63,6 @@
"version" : "4.16.0"
}
},
{
"identity" : "semver",
"kind" : "remoteSourceControl",
"location" : "https://github.com/sersoft-gmbh/semver",
"state" : {
"revision" : "92c23d5fa4a920b81a34d68594528c327cf599f1",
"version" : "3.4.0"
}
},
{
"identity" : "sqlite.swift",
"kind" : "remoteSourceControl",

View file

@ -18,7 +18,6 @@ let package = Package(
dependencies: [
.package(name: "Models", path: "../Models"),
.package(name: "Network", path: "../Network"),
.package(url: "https://github.com/sersoft-gmbh/semver", from: "3.4.0"),
.package(url: "https://github.com/evgenyneu/keychain-swift", branch: "master"),
],
targets: [
@ -27,7 +26,6 @@ let package = Package(
dependencies: [
.product(name: "Models", package: "Models"),
.product(name: "Network", package: "Network"),
.product(name: "SemVer", package: "semver"),
.product(name: "KeychainSwift", package: "keychain-swift"),
]
),

View file

@ -1,7 +1,6 @@
import Foundation
import Models
import Network
import SemVer
@MainActor
public class CurrentInstance: ObservableObject {
@ -11,21 +10,27 @@ public class CurrentInstance: ObservableObject {
public static let shared = CurrentInstance()
private var version: Version {
let stringVersion = instance?.version ?? "0"
return Version(stringVersion)!
private var version: Float {
if let stringVersion = instance?.version {
if stringVersion.utf8.count > 2 {
return Float(stringVersion.prefix(3)) ?? 0
} else {
return Float(stringVersion.prefix(1)) ?? 0
}
}
return 0
}
public var isFiltersSupported: Bool {
version >= Version("4")!
version >= 4
}
public var isEditSupported: Bool {
version >= Version("4")!
version >= 4
}
public var isEditAltTextSupported: Bool {
version >= Version("4.1")!
version >= 4.1
}
private init() {}