diff --git a/submodules/StatisticsUI/Sources/ChannelStatsController.swift b/submodules/StatisticsUI/Sources/ChannelStatsController.swift index ab8484d752..6a24992805 100644 --- a/submodules/StatisticsUI/Sources/ChannelStatsController.swift +++ b/submodules/StatisticsUI/Sources/ChannelStatsController.swift @@ -1210,7 +1210,7 @@ public func channelStatsController(context: AccountContext, updatedPresentationD updateState { $0.withUpdatedGiftsSelected(selected).withUpdatedBoostersExpanded(false) } }) - let messageView = context.account.viewTracker.aroundMessageHistoryViewForLocation(.peer(peerId: peerId, threadId: nil), index: .upperBound, anchorIndex: .upperBound, count: 100, fixedCombinedReadStates: nil) + let messageView = context.account.viewTracker.aroundMessageHistoryViewForLocation(.peer(peerId: peerId, threadId: nil), index: .upperBound, anchorIndex: .upperBound, count: 200, fixedCombinedReadStates: nil) |> map { messageHistoryView, _, _ -> MessageHistoryView? in return messageHistoryView } @@ -1262,7 +1262,19 @@ public func channelStatsController(context: AccountContext, updatedPresentationD } } - let messages = messageView?.entries.map { $0.message }.sorted(by: { (lhsMessage, rhsMessage) -> Bool in + var existingGroupingKeys = Set() + var idsToFilter = Set() + var messages = messageView?.entries.map { $0.message } ?? [] + for message in messages { + if let groupingKey = message.groupingKey { + if existingGroupingKeys.contains(groupingKey) { + idsToFilter.insert(message.id) + } else { + existingGroupingKeys.insert(groupingKey) + } + } + } + messages = messages.filter { !idsToFilter.contains($0.id) }.sorted(by: { (lhsMessage, rhsMessage) -> Bool in return lhsMessage.timestamp > rhsMessage.timestamp }) let interactions = data?.postInteractions.reduce([ChannelStatsPostInteractions.PostId : ChannelStatsPostInteractions]()) { (map, interactions) -> [ChannelStatsPostInteractions.PostId : ChannelStatsPostInteractions] in diff --git a/submodules/TelegramUI/Components/MediaEditorScreen/Sources/MediaEditorScreen.swift b/submodules/TelegramUI/Components/MediaEditorScreen/Sources/MediaEditorScreen.swift index 916fe83ac4..4473f1b2d4 100644 --- a/submodules/TelegramUI/Components/MediaEditorScreen/Sources/MediaEditorScreen.swift +++ b/submodules/TelegramUI/Components/MediaEditorScreen/Sources/MediaEditorScreen.swift @@ -1054,9 +1054,12 @@ final class MediaEditorScreenComponent: Component { if case let .video(_, _, _, additionalPath, _, _, _, _, _) = subject, additionalPath != nil { canRecordVideo = false } - } - if "".isEmpty { - canRecordVideo = false + if case let .asset(asset) = subject, asset.mediaType == .image { + canRecordVideo = false + } + if case .image = subject { + canRecordVideo = false + } } self.inputPanel.parentState = state