mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-08-08 08:31:13 +00:00
Update API
This commit is contained in:
parent
b1f40bf0aa
commit
a281d15444
@ -546,6 +546,33 @@ func _internal_adminedPublicChannels(account: Account, scope: AdminedPublicChann
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func _internal_channelsForStories(account: Account) -> Signal<[Peer], NoError> {
|
||||||
|
let accountPeerId = account.peerId
|
||||||
|
return account.network.request(Api.functions.stories.getChatsToSend())
|
||||||
|
|> retryRequest
|
||||||
|
|> mapToSignal { result -> Signal<[Peer], NoError> in
|
||||||
|
return account.postbox.transaction { transaction -> [Peer] in
|
||||||
|
let chats: [Api.Chat]
|
||||||
|
let parsedPeers: AccumulatedPeers
|
||||||
|
switch result {
|
||||||
|
case let .chats(apiChats):
|
||||||
|
chats = apiChats
|
||||||
|
case let .chatsSlice(_, apiChats):
|
||||||
|
chats = apiChats
|
||||||
|
}
|
||||||
|
parsedPeers = AccumulatedPeers(transaction: transaction, chats: chats, users: [])
|
||||||
|
updatePeers(transaction: transaction, accountPeerId: accountPeerId, peers: parsedPeers)
|
||||||
|
var peers: [Peer] = []
|
||||||
|
for chat in chats {
|
||||||
|
if let peer = transaction.getPeer(chat.peerId) {
|
||||||
|
peers.append(peer)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return peers
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public enum ChannelAddressNameAssignmentAvailability {
|
public enum ChannelAddressNameAssignmentAvailability {
|
||||||
case available
|
case available
|
||||||
case unknown
|
case unknown
|
||||||
|
@ -73,6 +73,13 @@ public extension TelegramEngine {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public func channelsForStories() -> Signal<[EnginePeer], NoError> {
|
||||||
|
return _internal_channelsForStories(account: self.account)
|
||||||
|
|> map { peers -> [EnginePeer] in
|
||||||
|
return peers.map(EnginePeer.init)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public func channelAddressNameAssignmentAvailability(peerId: PeerId?) -> Signal<ChannelAddressNameAssignmentAvailability, NoError> {
|
public func channelAddressNameAssignmentAvailability(peerId: PeerId?) -> Signal<ChannelAddressNameAssignmentAvailability, NoError> {
|
||||||
return _internal_channelAddressNameAssignmentAvailability(account: self.account, peerId: peerId)
|
return _internal_channelAddressNameAssignmentAvailability(account: self.account, peerId: peerId)
|
||||||
}
|
}
|
||||||
|
@ -3712,7 +3712,7 @@ public final class MediaEditorScreen: ViewController, UIDropInteractionDelegate
|
|||||||
self.displayNode.view.addInteraction(dropInteraction)
|
self.displayNode.view.addInteraction(dropInteraction)
|
||||||
|
|
||||||
Queue.mainQueue().after(1.0) {
|
Queue.mainQueue().after(1.0) {
|
||||||
self.adminedChannels.set(.single([]) |> then(self.context.engine.peers.adminedPublicChannels(scope: .all)))
|
self.adminedChannels.set(.single([]) |> then(self.context.engine.peers.channelsForStories()))
|
||||||
self.closeFriends.set(self.context.engine.data.get(TelegramEngine.EngineData.Item.Contacts.CloseFriends()))
|
self.closeFriends.set(self.context.engine.data.get(TelegramEngine.EngineData.Item.Contacts.CloseFriends()))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user