Skip to content

Commit

Permalink
IOS-3186 Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
mgolovko committed Jul 19, 2024
1 parent ce71e4d commit 4a927f5
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,17 @@ actor TreeSubscriptionManager: TreeSubscriptionManagerProtocol {

private var objectIds: [String] = []
private var subscriptionStarted: Bool = false
private let detailsSubject = PassthroughSubject<[ObjectDetails], Never>()

nonisolated let detailsPublisher: AnyPublisher<[ObjectDetails], Never>

init() {
subscriptionStorage = subscriptionStorageProvider.createSubscriptionStorage(subId: subscriptionDataBuilder.subscriptionId)
detailsPublisher = subscriptionStorage.statePublisher.map { $0.items.filter(\.isNotDeletedAndSupportedForEdit) }.eraseToAnyPublisher()
detailsPublisher = subscriptionStorage.statePublisher
.map { $0.items }
.merge(with: detailsSubject)
.map { $0.filter(\.isNotDeletedAndSupportedForEdit) }
.eraseToAnyPublisher()
}

// MARK: - TreeSubscriptionDataBuilderProtocol
Expand All @@ -36,7 +41,7 @@ actor TreeSubscriptionManager: TreeSubscriptionManagerProtocol {

if newObjectIds.isEmpty {
try? await subscriptionStorage.stopSubscription()

detailsSubject.send([])
return true
}

Expand Down

0 comments on commit 4a927f5

Please sign in to comment.