no message

This commit is contained in:
Peter
2018-05-31 16:22:57 +03:00
parent 075d965857
commit 8a6bfd44ea
17 changed files with 969 additions and 703 deletions

View File

@@ -21,8 +21,8 @@ public enum ChannelMembersCategory {
case banned(ChannelMembersCategoryFilter)
}
public func channelMembers(postbox: Postbox, network: Network, peerId: PeerId, category: ChannelMembersCategory = .recent(.all), offset: Int32 = 0, limit: Int32 = 64) -> Signal<[RenderedChannelParticipant], NoError> {
return postbox.modify { modifier -> Signal<[RenderedChannelParticipant], NoError> in
public func channelMembers(postbox: Postbox, network: Network, peerId: PeerId, category: ChannelMembersCategory = .recent(.all), offset: Int32 = 0, limit: Int32 = 64, hash: Int32 = 0) -> Signal<[RenderedChannelParticipant]?, NoError> {
return postbox.modify { modifier -> Signal<[RenderedChannelParticipant]?, NoError> in
if let peer = modifier.getPeer(peerId), let inputChannel = apiInputChannel(peer) {
let apiFilter: Api.ChannelParticipantsFilter
switch category {
@@ -50,10 +50,10 @@ public func channelMembers(postbox: Postbox, network: Network, peerId: PeerId, c
apiFilter = .channelParticipantsKicked(q: query)
}
}
return network.request(Api.functions.channels.getParticipants(channel: inputChannel, filter: apiFilter, offset: offset, limit: limit, hash: 0))
return network.request(Api.functions.channels.getParticipants(channel: inputChannel, filter: apiFilter, offset: offset, limit: limit, hash: hash))
|> retryRequest
|> mapToSignal { result -> Signal<[RenderedChannelParticipant], NoError> in
return postbox.modify { modifier -> [RenderedChannelParticipant] in
|> mapToSignal { result -> Signal<[RenderedChannelParticipant]?, NoError> in
return postbox.modify { modifier -> [RenderedChannelParticipant]? in
var items: [RenderedChannelParticipant] = []
switch result {
case let .channelParticipants(_, participants, users):
@@ -78,7 +78,7 @@ public func channelMembers(postbox: Postbox, network: Network, peerId: PeerId, c
}
case .channelParticipantsNotModified:
break
return nil
}
return items
}