mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-10-09 03:20:48 +00:00
Merge commit '555453844400a5d023c33074e004ccbe80cb148f'
This commit is contained in:
commit
415d4d2d71
@ -243,13 +243,30 @@ private final class StoryStatsPublicForwardsContextImpl {
|
||||
let storyId = self.storyId
|
||||
let lastOffset = self.lastOffset
|
||||
|
||||
self.disposable.set((self.account.postbox.transaction { transaction -> Api.InputPeer? in
|
||||
return transaction.getPeer(peerId).flatMap(apiInputPeer)
|
||||
self.disposable.set((self.account.postbox.transaction { transaction -> (Api.InputPeer, Int32?)? in
|
||||
let statsDatacenterId = (transaction.getPeerCachedData(peerId: peerId) as? CachedChannelData)?.statsDatacenterId
|
||||
guard let inputPeer = transaction.getPeer(peerId).flatMap(apiInputPeer) else {
|
||||
return nil
|
||||
}
|
||||
return (inputPeer, statsDatacenterId)
|
||||
}
|
||||
|> mapToSignal { inputPeer -> Signal<([StoryStatsPublicForwardsContext.State.Forward], Int32, String?), NoError> in
|
||||
if let inputPeer = inputPeer {
|
||||
|> mapToSignal { data -> Signal<([StoryStatsPublicForwardsContext.State.Forward], Int32, String?), NoError> in
|
||||
if let (inputPeer, statsDatacenterId) = data {
|
||||
let offset = lastOffset ?? ""
|
||||
let signal = account.network.request(Api.functions.stats.getStoryPublicForwards(peer: inputPeer, id: storyId, offset: offset, limit: 50))
|
||||
|
||||
let request = Api.functions.stats.getStoryPublicForwards(peer: inputPeer, id: storyId, offset: offset, limit: 50)
|
||||
let signal: Signal<Api.stats.PublicForwards, MTRpcError>
|
||||
if let statsDatacenterId = statsDatacenterId, account.network.datacenterId != statsDatacenterId {
|
||||
signal = account.network.download(datacenterId: Int(statsDatacenterId), isMedia: false, tag: nil)
|
||||
|> castError(MTRpcError.self)
|
||||
|> mapToSignal { worker in
|
||||
return worker.request(request)
|
||||
}
|
||||
} else {
|
||||
signal = account.network.request(request, automaticFloodWait: false)
|
||||
}
|
||||
|
||||
return signal
|
||||
|> map(Optional.init)
|
||||
|> `catch` { _ -> Signal<Api.stats.PublicForwards?, NoError> in
|
||||
return .single(nil)
|
||||
@ -325,7 +342,6 @@ private final class StoryStatsPublicForwardsContextImpl {
|
||||
}
|
||||
}
|
||||
}
|
||||
return signal
|
||||
} else {
|
||||
return .single(([], 0, nil))
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user