Premium features

This commit is contained in:
Isaac
2024-03-19 14:20:31 +04:00
parent 0fc64aa505
commit bd8514ff20
63 changed files with 47586 additions and 46860 deletions

View File

@@ -97,12 +97,37 @@ func chatHistoryViewForLocation(_ location: ChatHistoryLocationInput, ignoreMess
} else {
signal = account.viewTracker.aroundMessageOfInterestHistoryViewForLocation(context.chatLocationInput(for: chatLocation, contextHolder: chatLocationContextHolder), ignoreMessagesInTimestampRange: ignoreMessagesInTimestampRange, count: count, tag: tag, appendMessagesFromTheSameGroup: appendMessagesFromTheSameGroup, orderStatistics: orderStatistics, additionalData: additionalData, useRootInterfaceStateForThread: useRootInterfaceStateForThread)
}
return signal
|> map { view, updateType, initialData -> ChatHistoryViewUpdate in
let isPossibleIntroLoaded: Signal<Bool, NoError>
if case let .peer(id) = chatLocation, id.namespace == Namespaces.Peer.CloudUser {
isPossibleIntroLoaded = context.engine.data.subscribe(
TelegramEngine.EngineData.Item.Peer.BusinessIntro(id: id)
)
|> map { result -> Bool in
switch result {
case .known:
return true
case .unknown:
return false
}
}
|> distinctUntilChanged
} else {
isPossibleIntroLoaded = .single(true)
}
return combineLatest(signal, isPossibleIntroLoaded)
|> map { viewData, isPossibleIntroLoaded -> ChatHistoryViewUpdate in
let (view, updateType, initialData) = viewData
let (cachedData, cachedDataMessages, readStateData) = extractAdditionalData(view: view, chatLocation: chatLocation)
let combinedInitialData = ChatHistoryCombinedInitialData(initialData: initialData, buttonKeyboardMessage: view.topTaggedMessages.first, cachedData: cachedData, cachedDataMessages: cachedDataMessages, readStateData: readStateData)
if !isPossibleIntroLoaded {
return .Loading(initialData: combinedInitialData, type: .Generic(type: updateType))
}
if preloaded {
return .HistoryView(view: view, type: .Generic(type: updateType), scrollPosition: nil, flashIndicators: false, originalScrollPosition: nil, initialData: combinedInitialData, id: location.id)
} else {