Enable editing on Pleroma 2.5+
This commit is contained in:
parent
b00170c3f9
commit
c94e60d49b
|
@ -88,7 +88,7 @@ public class InstanceFeatures: ObservableObject {
|
||||||
}
|
}
|
||||||
|
|
||||||
public var needsWideColorGamutHack: Bool {
|
public var needsWideColorGamutHack: Bool {
|
||||||
if case .mastodon(_, .some(let version)) = instanceType {
|
if case .mastodon(_, let version) = instanceType {
|
||||||
return version < Version(4, 0, 0)
|
return version < Version(4, 0, 0)
|
||||||
} else {
|
} else {
|
||||||
return true
|
return true
|
||||||
|
@ -116,8 +116,16 @@ public class InstanceFeatures: ObservableObject {
|
||||||
}
|
}
|
||||||
|
|
||||||
public var editStatuses: Bool {
|
public var editStatuses: Bool {
|
||||||
// todo: does this require a particular akkoma version?
|
switch instanceType {
|
||||||
hasMastodonVersion(3, 5, 0) || instanceType.isPleroma(.akkoma(nil))
|
case .mastodon(_, let v) where v >= Version(3, 5, 0):
|
||||||
|
return true
|
||||||
|
case .pleroma(.vanilla(let v)) where v >= Version(2, 5, 0):
|
||||||
|
return true
|
||||||
|
case .pleroma(.akkoma(nil)):
|
||||||
|
return true
|
||||||
|
default:
|
||||||
|
return false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public var needsEditAttachmentsInSeparateRequest: Bool {
|
public var needsEditAttachmentsInSeparateRequest: Bool {
|
||||||
|
@ -188,7 +196,7 @@ public class InstanceFeatures: ObservableObject {
|
||||||
}
|
}
|
||||||
|
|
||||||
public func hasMastodonVersion(_ major: Int, _ minor: Int, _ patch: Int) -> Bool {
|
public func hasMastodonVersion(_ major: Int, _ minor: Int, _ patch: Int) -> Bool {
|
||||||
if case .mastodon(_, .some(let version)) = instanceType {
|
if case .mastodon(_, let version) = instanceType {
|
||||||
return version >= Version(major, minor, patch)
|
return version >= Version(major, minor, patch)
|
||||||
} else {
|
} else {
|
||||||
return false
|
return false
|
||||||
|
@ -197,7 +205,7 @@ public class InstanceFeatures: ObservableObject {
|
||||||
|
|
||||||
func hasPleromaVersion(_ major: Int, _ minor: Int, _ patch: Int) -> Bool {
|
func hasPleromaVersion(_ major: Int, _ minor: Int, _ patch: Int) -> Bool {
|
||||||
switch instanceType {
|
switch instanceType {
|
||||||
case .pleroma(.vanilla(.some(let version))), .pleroma(.akkoma(.some(let version))):
|
case .pleroma(.vanilla(let version)), .pleroma(.akkoma(let version)):
|
||||||
return version >= Version(major, minor, patch)
|
return version >= Version(major, minor, patch)
|
||||||
default:
|
default:
|
||||||
return false
|
return false
|
||||||
|
|
|
@ -62,3 +62,19 @@ import Foundation
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func <(lhs: Version?, rhs: Version) -> Bool {
|
||||||
|
guard let lhs else {
|
||||||
|
// nil is less than or equal to everything
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
return lhs < rhs
|
||||||
|
}
|
||||||
|
|
||||||
|
func >=(lhs: Version?, rhs: Version) -> Bool {
|
||||||
|
guard let lhs else {
|
||||||
|
// nil is less than or equal to everything
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
return lhs >= rhs
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue