Avoid setting duplicate breadcrumbs
This commit is contained in:
parent
ef00c0e2df
commit
2b5b749dc8
|
@ -8,11 +8,11 @@
|
||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
public struct NodeInfo: Decodable, Sendable {
|
public struct NodeInfo: Decodable, Sendable, Equatable {
|
||||||
public let version: String
|
public let version: String
|
||||||
public let software: Software
|
public let software: Software
|
||||||
|
|
||||||
public struct Software: Decodable, Sendable {
|
public struct Software: Decodable, Sendable, Equatable {
|
||||||
public let name: String
|
public let name: String
|
||||||
public let version: String
|
public let version: String
|
||||||
}
|
}
|
||||||
|
|
|
@ -89,6 +89,14 @@ class MastodonController: ObservableObject {
|
||||||
.combineLatest($nodeInfo)
|
.combineLatest($nodeInfo)
|
||||||
.sink { [unowned self] (instance, nodeInfo) in
|
.sink { [unowned self] (instance, nodeInfo) in
|
||||||
self.instanceFeatures.update(instance: instance, nodeInfo: nodeInfo)
|
self.instanceFeatures.update(instance: instance, nodeInfo: nodeInfo)
|
||||||
|
}
|
||||||
|
.store(in: &cancellables)
|
||||||
|
|
||||||
|
$instanceInfo
|
||||||
|
.compactMap { $0 }
|
||||||
|
.removeDuplicates(by: { $0.version == $1.version })
|
||||||
|
.combineLatest($nodeInfo.removeDuplicates())
|
||||||
|
.sink { (instance, nodeInfo) in
|
||||||
setInstanceBreadcrumb(instance: instance, nodeInfo: nodeInfo)
|
setInstanceBreadcrumb(instance: instance, nodeInfo: nodeInfo)
|
||||||
}
|
}
|
||||||
.store(in: &cancellables)
|
.store(in: &cancellables)
|
||||||
|
|
Loading…
Reference in New Issue