mirror of
https://github.com/Dimillian/IceCubesApp.git
synced 2024-11-10 11:19:30 +00:00
Fix instance version check
This commit is contained in:
parent
a32e4f98bb
commit
e6c5f2a9ca
1 changed files with 15 additions and 3 deletions
|
@ -9,17 +9,29 @@ public class CurrentInstance: ObservableObject {
|
|||
private var client: Client?
|
||||
|
||||
public static let shared = CurrentInstance()
|
||||
|
||||
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 {
|
||||
instance?.version.hasPrefix("4") == true
|
||||
version >= 4
|
||||
}
|
||||
|
||||
public var isEditSupported: Bool {
|
||||
instance?.version.hasPrefix("4") == true
|
||||
version >= 4
|
||||
}
|
||||
|
||||
public var isEditAltTextSupported: Bool {
|
||||
instance?.version.hasPrefix("4.1") == true
|
||||
version >= 4.1
|
||||
}
|
||||
|
||||
private init() {}
|
||||
|
|
Loading…
Reference in a new issue