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

View file

@ -63,15 +63,6 @@
"version" : "4.16.0" "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", "identity" : "sqlite.swift",
"kind" : "remoteSourceControl", "kind" : "remoteSourceControl",

View file

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

View file

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