mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-08-02 00:17:02 +00:00
Merge commit '4fa93eae2213e047cf0abf1dc48d795a1e612dd7'
This commit is contained in:
commit
56c32e930f
@ -382,19 +382,19 @@ public enum GetGroupCallParticipantsError {
|
||||
}
|
||||
|
||||
public func getGroupCallParticipants(account: Account, callId: Int64, accessHash: Int64, offset: String, ssrcs: [UInt32], limit: Int32, sortAscending: Bool?) -> Signal<GroupCallParticipantsContext.State, GetGroupCallParticipantsError> {
|
||||
let sortAscendingValue: Signal<(Bool, Int32?, Bool, GroupCallParticipantsContext.State.DefaultParticipantsAreMuted?), GetGroupCallParticipantsError>
|
||||
let sortAscendingValue: Signal<(Bool, Int32?, Bool, GroupCallParticipantsContext.State.DefaultParticipantsAreMuted?, Bool), GetGroupCallParticipantsError>
|
||||
if let sortAscending = sortAscending {
|
||||
sortAscendingValue = .single((sortAscending, nil, false, nil))
|
||||
sortAscendingValue = .single((sortAscending, nil, false, nil, false))
|
||||
} else {
|
||||
sortAscendingValue = getCurrentGroupCall(account: account, callId: callId, accessHash: accessHash)
|
||||
|> mapError { _ -> GetGroupCallParticipantsError in
|
||||
return .generic
|
||||
}
|
||||
|> mapToSignal { result -> Signal<(Bool, Int32?, Bool, GroupCallParticipantsContext.State.DefaultParticipantsAreMuted?), GetGroupCallParticipantsError> in
|
||||
|> mapToSignal { result -> Signal<(Bool, Int32?, Bool, GroupCallParticipantsContext.State.DefaultParticipantsAreMuted?, Bool), GetGroupCallParticipantsError> in
|
||||
guard let result = result else {
|
||||
return .fail(.generic)
|
||||
}
|
||||
return .single((result.info.sortAscending, result.info.scheduleTimestamp, result.info.subscribedToScheduled, result.info.defaultParticipantsAreMuted))
|
||||
return .single((result.info.sortAscending, result.info.scheduleTimestamp, result.info.subscribedToScheduled, result.info.defaultParticipantsAreMuted, result.info.isVideoEnabled))
|
||||
}
|
||||
}
|
||||
|
||||
@ -412,7 +412,8 @@ public func getGroupCallParticipants(account: Account, callId: Int64, accessHash
|
||||
let version: Int32
|
||||
let nextParticipantsFetchOffset: String?
|
||||
|
||||
let (sortAscendingValue, scheduleTimestamp, subscribedToScheduled, defaultParticipantsAreMuted) = sortAscendingAndScheduleTimestamp
|
||||
let (sortAscendingValue, scheduleTimestamp, subscribedToScheduled, defaultParticipantsAreMuted, isVideoEnabled) = sortAscendingAndScheduleTimestamp
|
||||
|
||||
|
||||
switch result {
|
||||
case let .groupParticipants(count, participants, nextOffset, chats, users, apiVersion):
|
||||
@ -510,7 +511,7 @@ public func getGroupCallParticipants(account: Account, callId: Int64, accessHash
|
||||
scheduleTimestamp: scheduleTimestamp,
|
||||
subscribedToScheduled: subscribedToScheduled,
|
||||
totalCount: totalCount,
|
||||
isVideoEnabled: false,
|
||||
isVideoEnabled: isVideoEnabled,
|
||||
version: version
|
||||
)
|
||||
}
|
||||
|
@ -59,14 +59,24 @@ public struct SearchStickersScope: OptionSet {
|
||||
}
|
||||
|
||||
func _internal_randomGreetingSticker(account: Account) -> Signal<FoundStickerItem?, NoError> {
|
||||
return account.postbox.transaction { transaction -> FoundStickerItem? in
|
||||
var stickerItems: [FoundStickerItem] = []
|
||||
for entry in transaction.getOrderedListItems(collectionId: Namespaces.OrderedItemList.CloudGreetingStickers) {
|
||||
if let item = entry.contents as? RecentMediaItem, let file = item.media as? TelegramMediaFile {
|
||||
stickerItems.append(FoundStickerItem(file: file, stringRepresentations: []))
|
||||
}
|
||||
let key: PostboxViewKey = .orderedItemList(id: Namespaces.OrderedItemList.CloudGreetingStickers)
|
||||
return account.postbox.combinedView(keys: [key])
|
||||
|> map { views -> [OrderedItemListEntry]? in
|
||||
if let view = views.views[key] as? OrderedItemListView, !view.items.isEmpty {
|
||||
return view.items
|
||||
} else {
|
||||
return nil
|
||||
}
|
||||
return stickerItems.randomElement()
|
||||
}
|
||||
|> filter { items in
|
||||
return items != nil
|
||||
}
|
||||
|> take(1)
|
||||
|> map { items -> FoundStickerItem? in
|
||||
if let randomItem = items?.randomElement(), let item = randomItem.contents as? RecentMediaItem, let file = item.media as? TelegramMediaFile {
|
||||
return FoundStickerItem(file: file, stringRepresentations: [])
|
||||
}
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -853,6 +853,7 @@ final class ChatEmptyNode: ASDisplayNode {
|
||||
contentType = .regular
|
||||
}
|
||||
|
||||
var updateGreetingSticker = false
|
||||
var contentTransition = transition
|
||||
if self.content?.0 != contentType {
|
||||
var animateContentIn = false
|
||||
@ -876,7 +877,7 @@ final class ChatEmptyNode: ASDisplayNode {
|
||||
node = ChatEmptyNodeNearbyChatContent(context: self.context, interaction: self.interaction)
|
||||
case .greeting:
|
||||
node = ChatEmptyNodeGreetingChatContent(context: self.context, interaction: self.interaction)
|
||||
self.context.prefetchManager?.prepareNextGreetingSticker()
|
||||
updateGreetingSticker = true
|
||||
}
|
||||
self.content = (contentType, node)
|
||||
self.addSubnode(node)
|
||||
@ -894,6 +895,10 @@ final class ChatEmptyNode: ASDisplayNode {
|
||||
var contentSize = CGSize()
|
||||
if let contentNode = self.content?.1 {
|
||||
contentSize = contentNode.updateLayout(interfaceState: interfaceState, size: displayRect.size, transition: contentTransition)
|
||||
|
||||
if updateGreetingSticker {
|
||||
self.context.prefetchManager?.prepareNextGreetingSticker()
|
||||
}
|
||||
}
|
||||
|
||||
let contentFrame = CGRect(origin: CGPoint(x: displayRect.minX + floor((displayRect.width - contentSize.width) / 2.0), y: displayRect.minY + floor((displayRect.height - contentSize.height) / 2.0)), size: contentSize)
|
||||
|
Loading…
x
Reference in New Issue
Block a user