Bot previews

This commit is contained in:
Isaac
2024-07-24 01:56:34 +08:00
parent f604bc114f
commit 42a6f6e8bc
52 changed files with 3806 additions and 523 deletions

View File

@@ -287,6 +287,11 @@ public final class AccountStateManager {
return self.storyUpdatesPipe.signal()
}
fileprivate let botPreviewUpdatesPipe = ValuePipe<[InternalBotPreviewUpdate]>()
public var botPreviewUpdates: Signal<[InternalBotPreviewUpdate], NoError> {
return self.botPreviewUpdatesPipe.signal()
}
private var updatedWebpageContexts: [MediaId: UpdatedWebpageSubscriberContext] = [:]
private var updatedPeersNearbyContext = UpdatedPeersNearbySubscriberContext()
private var updatedRevenueBalancesContext = UpdatedRevenueBalancesSubscriberContext()
@@ -1856,6 +1861,18 @@ public final class AccountStateManager {
}
}
var botPreviewUpdates: Signal<[InternalBotPreviewUpdate], NoError> {
return self.impl.signalWith { impl, subscriber in
return impl.botPreviewUpdates.start(next: subscriber.putNext, error: subscriber.putError, completed: subscriber.putCompletion)
}
}
func injectBotPreviewUpdates(updates: [InternalBotPreviewUpdate]) {
self.impl.with { impl in
impl.botPreviewUpdatesPipe.putNext(updates)
}
}
var updateConfigRequested: (() -> Void)?
var isPremiumUpdated: (() -> Void)?