mirror of
https://github.com/TelegramMessenger/Telegram-iOS.git
synced 2026-07-05 19:28:46 +02:00
Postbox refactor waves 138–276: 168-commit squash
Consolidates 137 wave commits + 31 supporting commits (CLAUDE.md bump, typealias additions, AnyObject→EngineMedia restoration) into one squashed commit. Migrates dozens of consumer-side public APIs, struct fields, protocol methods, and enum payloads from Postbox protocols/structs to TelegramEngine engine wrappers and typealiases. Drops `import Postbox` from many files. Adds new TelegramCore typealiases and one TelegramEngineUnauthorized facade. Notable changes by category: **TelegramCore typealias additions** (rule 2 — narrow utility typealiases): - EngineChatListIndex, EngineTempBoxFile, EngineItemCollectionItemIndex, EngineItemCollectionViewEntryIndex, EngineValueBoxEncryptionParameters, EngineMessageAndThreadId, EnginePeerStoryStats, EngineMessageHistoryAnchorIndex, EngineChatListTotalUnreadStateCategory, EngineChatListTotalUnreadStateStats, EnginePeerSummaryCounterTags, EngineChatListTotalUnreadState, EngineItemCacheEntryId, EngineHashFunctions, EngineCachedMediaResourceRepresentationResult, EngineMediaResourceDataFetchResult, EngineMediaResourceDataFetchError, EngineMediaResourceStatus, EngineCachedPeerData **TelegramCore engine extensions/forwarders**: - EngineMessage.engineMedia, EngineMessage.enginePeers, EngineMessage.adAttribute, EngineMessage.effectivelyIncoming - engineFileSize forwarder - TelegramEngine.Resources.clearCachedMediaResources(mediaResourceIds: Set<EngineMediaResource.Id>) - TelegramEngine.Resources.fetchStatus(id:resourceSize:) - TelegramEngineUnauthorized.UnauthorizedResources facade with storeResourceData **Public API/struct migrations to engine types**: - ChatAvailableMessageActions.banAuthor/banAuthors → EnginePeer?/[EnginePeer] - WebSessionsContextState.peers → [EnginePeer.Id: EnginePeer] - CacheUsageStats.peers → [EnginePeer.Id: EnginePeer] - PeerCommand.peer → EnginePeer - PeerInfoControllerMode.calls(messages:) → [EngineMessage] - CallControllerNodeProtocol.updatePeer → EnginePeer params - ChatHistoryListNode.messageInCurrentHistoryView (and 4 variants) → EngineMessage? - ChatHistorySearchContainerNode.messageForGallery → EngineMessage? - PeerInfoPaneNode.findLoadedMessage / ensureMessageIsVisible / transitionNodeForGallery → engine-typed - GalleryHiddenMediaTarget.getTransitionInfo / GalleryHiddenMediaManager.findTarget → engine-typed - ChatPanelInterfaceInteraction.presentReactionDeletionOptions / presentBan*MessageOptions → EnginePeer - DrawingMessageRenderer.messages → [EngineMessage] - ChatVideoGalleryItemScrubberView.setFetchStatusSignal → EngineMediaResource.FetchStatus - ChannelDiscussionGroupActionSheetItem.peer, VoiceChatPeerEntry.peer, VoiceChatFullscreenParticipantItem.peer, MediaStreamComponent.chatPeer, MediaStreamVideoComponent.callPeer, ChatMessageContactBubbleContentNode.contactPeer, ChatMessageForwardInfoNode.peer, ChatMessageCommentFooterContentNode.replyPeers, ChatReportPeerTitlePanelNode.peer, ChatMessageActionUrlAuthController.bot, PeerMediaCollectionInterfaceState.peer, ChatMessageCallBubbleContentNode.peopleAvatars, ChatLoadingNode.renderedPeer (→ EngineRenderedPeer) — all to engine types **Wave-71-shadow stored-field migrations** (Postbox Peer/Message → Engine wrapper): - LegacyCallControllerNode.peer - CallStatusBarNode.currentPeer **Dead-code / dead-field removals**: - CallController.peer, CallControllerNodeV2.account, ContactMultiselectionController PeerNameIndex fields, preparedChatListNodeViewTransition account: Account param, FetchResource.swift entirely (unused function) **Module-level Postbox import drops**: 30+ files including TelegramRootController, EditStories, GiftViewScreen, AnimatedStickerUtils, FetchPhotoLibraryImageResource, PeerInfoGiftsPaneNode, PeerInfoPaneContainerNode, PresentAddMembers, PeerInfoProfileItems, ChatControllerAdminBanUsers, PresentationData typealiases, DefaultDayPresentationTheme, ChatListViewTransition, GalleryHiddenMediaManager, RecentSessionsController, GifContext, AuthorizationSequenceController, PeerInfoHeaderEditingContentNode, PeerInfoHeaderNode, PeerAllowedReactionListController, CallControllerNodeV2, and 6 PeerInfo pane files. **AnyObject restoration**: rule 8 added (never substitute Postbox protocols with Any/AnyObject) — undid previous AnyObject substitutions in waves 141/143 back to EngineMedia. Doc maintenance: CLAUDE.md updated to reflect new typealiases and forwarders. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
631df15f40
commit
69bfc65da7
226 changed files with 1467 additions and 1519 deletions
27
CLAUDE.md
27
CLAUDE.md
|
|
@ -41,7 +41,7 @@ A gradual migration is underway to eliminate direct `import Postbox` from consum
|
|||
|
||||
**Historical record:** Wave-by-wave outcomes, the running tally of Postbox-free modules, and full verbose forms of the guidance subsections below live in [`docs/superpowers/postbox-refactor-log.md`](docs/superpowers/postbox-refactor-log.md). Read that file when you need wave-specific context, a full worked example of a pattern, or the history of a particular module's migration.
|
||||
|
||||
Waves landed so far (as of 2026-05-02): 137 waves plus standalone cleanups. See the log file for per-wave detail; the list of still-open migration opportunities lives in the `project_postbox_refactor_next_wave.md` memory file.
|
||||
Waves landed so far (as of 2026-05-04): 238 waves plus standalone cleanups. See the log file for per-wave detail; the list of still-open migration opportunities lives in the `project_postbox_refactor_next_wave.md` memory file.
|
||||
|
||||
### Rules that apply to every wave
|
||||
|
||||
|
|
@ -52,6 +52,7 @@ Waves landed so far (as of 2026-05-02): 137 waves plus standalone cleanups. See
|
|||
5. **Abandonment protocol:** if a module can only be refactored by violating rule 2 or by editing a module outside the current wave's list, mark the task Abandoned with a recorded reason. Do NOT substitute a new module mid-wave.
|
||||
6. Full project build per module. No unit tests exist in this project.
|
||||
7. **TelegramCore never imports UIKit/Display.** `TelegramCore` is shared with the Telegram-Mac codebase; its Bazel `deps` and source files must not reference UIKit, Display, or any Apple-UI framework. UIKit-needing helpers (image scaling, rendering, etc.) stay in consumer-side submodules.
|
||||
8. **Never substitute Postbox protocols (`Media`, `Peer`, `Message`) with `Any` / `AnyObject`** in code that previously used them. Type erasure throws away the domain semantics that the next reader expects. Use the matching engine wrapper (`EngineMedia`, `EnginePeer`, `EngineMessage`) — extending it as needed (e.g. add a missing case-init or convenience). If neither typealias nor wrapper covers the use site, restore the original Postbox import + type for now and flag the case for a future facade. Existing `Any`/`AnyObject` parameters predating the refactor are not in scope for this rule.
|
||||
|
||||
### Engine typealias cheat sheet (existing aliases)
|
||||
|
||||
|
|
@ -75,8 +76,31 @@ ItemCollectionId → EngineItemCollectionId (added 2026-04-20)
|
|||
FetchResourceSourceType → EngineFetchResourceSourceType (added 2026-04-20)
|
||||
FetchResourceError → EngineFetchResourceError (added 2026-04-20)
|
||||
StoryId → EngineStoryId (added 2026-05-02)
|
||||
ChatListIndex → EngineChatListIndex (added 2026-05-03)
|
||||
TempBoxFile → EngineTempBoxFile (added 2026-05-03)
|
||||
ItemCollectionItemIndex → EngineItemCollectionItemIndex (added 2026-05-03)
|
||||
ItemCollectionViewEntryIndex → EngineItemCollectionViewEntryIndex (added 2026-05-03)
|
||||
ValueBoxEncryptionParameters → EngineValueBoxEncryptionParameters (added 2026-05-03)
|
||||
MessageAndThreadId → EngineMessageAndThreadId (added 2026-05-03)
|
||||
PeerStoryStats → EnginePeerStoryStats (added 2026-05-03)
|
||||
MessageHistoryAnchorIndex → EngineMessageHistoryAnchorIndex (added 2026-05-03)
|
||||
ChatListTotalUnreadStateCategory → EngineChatListTotalUnreadStateCategory (added 2026-05-03)
|
||||
ChatListTotalUnreadStateStats → EngineChatListTotalUnreadStateStats (added 2026-05-03)
|
||||
PeerSummaryCounterTags → EnginePeerSummaryCounterTags (added 2026-05-03)
|
||||
ChatListTotalUnreadState → EngineChatListTotalUnreadState (added 2026-05-04)
|
||||
ItemCacheEntryId → EngineItemCacheEntryId (added 2026-05-04)
|
||||
HashFunctions → EngineHashFunctions (added 2026-05-04 wave 251)
|
||||
CachedMediaResourceRepresentationResult → EngineCachedMediaResourceRepresentationResult (added 2026-05-04 wave 265)
|
||||
MediaResourceDataFetchResult → EngineMediaResourceDataFetchResult (added 2026-05-04 wave 266)
|
||||
MediaResourceDataFetchError → EngineMediaResourceDataFetchError (added 2026-05-04 wave 266)
|
||||
MediaResourceStatus → EngineMediaResourceStatus (added 2026-05-04 wave 272)
|
||||
```
|
||||
|
||||
**Free-function thin forwarders in TelegramCore** (rule 3 allows):
|
||||
- `engineFileSize(_ path:, useTotalFileAllocatedSize: Bool = false)` — forwards to Postbox's `fileSize(...)` (added 2026-05-04 wave 268)
|
||||
|
||||
**TelegramEngineUnauthorized.resources facade**: `UnauthorizedResources.storeResourceData(id: EngineMediaResource.Id, data:, synchronous:)` — bridges to `account.postbox.mediaBox.storeResourceData` (added 2026-05-04 wave 271)
|
||||
|
||||
For the `MediaResource` Postbox protocol, prefer the TelegramCore subtype `TelegramMediaResource` when the consumer's usage allows (note: `EngineMediaResource` is a wrapper **class**, not a typealias, so it is not interchangeable with the protocol).
|
||||
|
||||
### MediaResource → EngineMediaResource consumer migration
|
||||
|
|
@ -144,6 +168,7 @@ All mediaBox methods with clean signatures (no Postbox-protocol leaks, no comple
|
|||
| `copyResourceData(from:, to:, synchronous:)` | 25 | `MediaBox.copyResourceData(from:, to:, synchronous:)` |
|
||||
| `resourceRangesStatus(resource:)` | 26 | `MediaBox.resourceRangesStatus(_ resource:)` |
|
||||
| `removeCachedResources(ids:, force:, notify:)` | 26 | `MediaBox.removeCachedResources(_ ids:, force:, notify:)` |
|
||||
| `clearCachedMediaResources(mediaResourceIds:)` | 223 | `_internal_clearCachedMediaResources` |
|
||||
|
||||
**Facade-shape convention:** all of these take `EngineMediaResource.Id` or `EngineMediaResource` (never raw `MediaResourceId`/`MediaResource`). Return types either don't leak Postbox (`Void`, `String`, `String?`, `Signal<RangeSet<Int64>, NoError>`, `Signal<Float, NoError>`) or wrap via TelegramCore type (`Signal<EngineMediaResource.ResourceData, NoError>`).
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ import SwiftSignalKit
|
|||
import BuildConfig
|
||||
import BroadcastUploadHelpers
|
||||
import AudioToolbox
|
||||
import Postbox
|
||||
import TelegramCore
|
||||
import CoreMedia
|
||||
import AVFoundation
|
||||
|
||||
|
|
@ -332,7 +332,7 @@ private final class EmbeddedBroadcastUploadImpl: BroadcastUploadImpl {
|
|||
|
||||
let rootPath = rootPathForBasePath(appGroupUrl.path)
|
||||
|
||||
TempBox.initializeShared(basePath: rootPath, processType: "share", launchSpecificId: Int64.random(in: Int64.min ... Int64.max))
|
||||
EngineTempBox.initializeShared(basePath: rootPath, processType: "share", launchSpecificId: Int64.random(in: Int64.min ... Int64.max))
|
||||
|
||||
let logsPath = rootPath + "/logs/broadcast-logs"
|
||||
let _ = try? FileManager.default.createDirectory(atPath: logsPath, withIntermediateDirectories: true, attributes: nil)
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@ import TelegramUI
|
|||
import BuildConfig
|
||||
import ShareExtensionContext
|
||||
import SwiftSignalKit
|
||||
import Postbox
|
||||
import TelegramCore
|
||||
|
||||
@objc(ShareRootController)
|
||||
|
|
@ -56,10 +55,10 @@ class ShareRootController: UIViewController {
|
|||
appGroupPath: appGroupUrl.path,
|
||||
accountManager: accountManager,
|
||||
appLockContext: appLockContext,
|
||||
encryptionParameters: ValueBoxEncryptionParameters(
|
||||
encryptionParameters: EngineValueBoxEncryptionParameters(
|
||||
forceEncryptionIfNoSet: false,
|
||||
key: ValueBoxEncryptionParameters.Key(data: encryptionParameters.0)!,
|
||||
salt: ValueBoxEncryptionParameters.Salt(data: encryptionParameters.1)!
|
||||
key: EngineValueBoxEncryptionParameters.Key(data: encryptionParameters.0)!,
|
||||
salt: EngineValueBoxEncryptionParameters.Salt(data: encryptionParameters.1)!
|
||||
),
|
||||
applicationBindings: applicationBindings,
|
||||
initialPresentationDataAndSettings: InitialPresentationDataAndSettings,
|
||||
|
|
|
|||
|
|
@ -162,14 +162,14 @@ public struct ChatAvailableMessageActionOptions: OptionSet {
|
|||
|
||||
public struct ChatAvailableMessageActions {
|
||||
public var options: ChatAvailableMessageActionOptions
|
||||
public var banAuthor: Peer?
|
||||
public var banAuthors: [Peer]
|
||||
public var banAuthor: EnginePeer?
|
||||
public var banAuthors: [EnginePeer]
|
||||
public var disableDelete: Bool
|
||||
public var isCopyProtected: Bool
|
||||
public var setTag: Bool
|
||||
public var editTags: Set<MessageReaction.Reaction>
|
||||
|
||||
public init(options: ChatAvailableMessageActionOptions, banAuthor: Peer?, banAuthors: [Peer], disableDelete: Bool, isCopyProtected: Bool, setTag: Bool, editTags: Set<MessageReaction.Reaction>) {
|
||||
|
||||
public init(options: ChatAvailableMessageActionOptions, banAuthor: EnginePeer?, banAuthors: [EnginePeer], disableDelete: Bool, isCopyProtected: Bool, setTag: Bool, editTags: Set<MessageReaction.Reaction>) {
|
||||
self.options = options
|
||||
self.banAuthor = banAuthor
|
||||
self.banAuthors = banAuthors
|
||||
|
|
@ -735,7 +735,7 @@ public enum PeerInfoControllerMode {
|
|||
}
|
||||
|
||||
case generic
|
||||
case calls(messages: [Message])
|
||||
case calls(messages: [EngineMessage])
|
||||
case nearbyPeer(distance: Int32)
|
||||
case group(sourceMessageId: MessageId)
|
||||
case reaction(MessageId)
|
||||
|
|
|
|||
|
|
@ -1117,7 +1117,7 @@ public protocol ChatController: ViewController {
|
|||
func activateSearch(domain: ChatSearchDomain, query: String)
|
||||
func activateInput(type: ChatControllerActivateInput)
|
||||
func beginClearHistory(type: InteractiveHistoryClearingType)
|
||||
func presentReactionDeletionOptions(author: Peer, messageId: MessageId)
|
||||
func presentReactionDeletionOptions(author: EnginePeer, messageId: EngineMessage.Id)
|
||||
|
||||
func performScrollToTop() -> Bool
|
||||
func transferScrollingVelocity(_ velocity: CGFloat)
|
||||
|
|
@ -1270,7 +1270,7 @@ public protocol ChatHistoryListNode: ListView {
|
|||
|
||||
func scrollToEndOfHistory()
|
||||
func updateLayout(transition: ContainedViewLayoutTransition, updateSizeAndInsets: ListViewUpdateSizeAndInsets)
|
||||
func messageInCurrentHistoryView(_ id: MessageId) -> Message?
|
||||
func messageInCurrentHistoryView(_ id: EngineMessage.Id) -> EngineMessage?
|
||||
|
||||
var contentPositionChanged: (ListViewVisibleContentOffset) -> Void { get set }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,11 +1,10 @@
|
|||
import Foundation
|
||||
import Postbox
|
||||
import Display
|
||||
import TelegramCore
|
||||
|
||||
public enum ChatHistoryInitialSearchLocation: Equatable {
|
||||
case index(MessageIndex)
|
||||
case id(MessageId)
|
||||
case index(EngineMessage.Index)
|
||||
case id(EngineMessage.Id)
|
||||
}
|
||||
|
||||
public struct MessageHistoryScrollToSubject: Equatable {
|
||||
|
|
@ -19,12 +18,12 @@ public struct MessageHistoryScrollToSubject: Equatable {
|
|||
}
|
||||
}
|
||||
|
||||
public var index: MessageHistoryAnchorIndex
|
||||
public var index: EngineMessageHistoryAnchorIndex
|
||||
public var quote: Quote?
|
||||
public var subject: EngineMessageReplyInnerSubject?
|
||||
public var setupReply: Bool
|
||||
|
||||
public init(index: MessageHistoryAnchorIndex, quote: Quote? = nil, subject: EngineMessageReplyInnerSubject? = nil, setupReply: Bool = false) {
|
||||
public init(index: EngineMessageHistoryAnchorIndex, quote: Quote? = nil, subject: EngineMessageReplyInnerSubject? = nil, setupReply: Bool = false) {
|
||||
self.index = index
|
||||
self.quote = quote
|
||||
self.subject = subject
|
||||
|
|
@ -57,8 +56,8 @@ public struct MessageHistoryInitialSearchSubject: Equatable {
|
|||
public enum ChatHistoryLocation: Equatable {
|
||||
case Initial(count: Int)
|
||||
case InitialSearch(subject: MessageHistoryInitialSearchSubject, count: Int, highlight: Bool, setupReply: Bool)
|
||||
case Navigation(index: MessageHistoryAnchorIndex, anchorIndex: MessageHistoryAnchorIndex, count: Int, highlight: Bool)
|
||||
case Scroll(subject: MessageHistoryScrollToSubject, anchorIndex: MessageHistoryAnchorIndex, sourceIndex: MessageHistoryAnchorIndex, scrollPosition: ListViewScrollPosition, animated: Bool, highlight: Bool, setupReply: Bool)
|
||||
case Navigation(index: EngineMessageHistoryAnchorIndex, anchorIndex: EngineMessageHistoryAnchorIndex, count: Int, highlight: Bool)
|
||||
case Scroll(subject: MessageHistoryScrollToSubject, anchorIndex: EngineMessageHistoryAnchorIndex, sourceIndex: EngineMessageHistoryAnchorIndex, scrollPosition: ListViewScrollPosition, animated: Bool, highlight: Bool, setupReply: Bool)
|
||||
}
|
||||
|
||||
public struct ChatHistoryLocationInput: Equatable {
|
||||
|
|
|
|||
|
|
@ -1,10 +1,9 @@
|
|||
import Foundation
|
||||
import Postbox
|
||||
import TelegramCore
|
||||
|
||||
private let minimalStreamableSize: Int = 384 * 1024
|
||||
|
||||
public func isMediaStreamable(message: Message, media: TelegramMediaFile) -> Bool {
|
||||
public func isMediaStreamable(message: EngineMessage, media: TelegramMediaFile) -> Bool {
|
||||
if message.containsSecretMedia {
|
||||
return false
|
||||
}
|
||||
|
|
@ -51,7 +50,7 @@ public func isMediaStreamable(media: TelegramMediaFile) -> Bool {
|
|||
return false
|
||||
}
|
||||
|
||||
public func isMediaStreamable(resource: MediaResource) -> Bool {
|
||||
public func isMediaStreamable(resource: TelegramMediaResource) -> Bool {
|
||||
if let size = resource.size, size >= minimalStreamableSize {
|
||||
return true
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -254,7 +254,7 @@ public enum GalleryHiddenMediaId: Hashable {
|
|||
}
|
||||
|
||||
public protocol GalleryHiddenMediaTarget: AnyObject {
|
||||
func getTransitionInfo(messageId: MessageId, media: Media) -> ((UIView) -> Void, ASDisplayNode, () -> (UIView?, UIView?))?
|
||||
func getTransitionInfo(messageId: EngineMessage.Id, media: EngineMedia) -> ((UIView) -> Void, ASDisplayNode, () -> (UIView?, UIView?))?
|
||||
}
|
||||
|
||||
public protocol GalleryHiddenMediaManager: AnyObject {
|
||||
|
|
@ -263,7 +263,7 @@ public protocol GalleryHiddenMediaManager: AnyObject {
|
|||
func removeSource(_ index: Int)
|
||||
func addTarget(_ target: GalleryHiddenMediaTarget)
|
||||
func removeTarget(_ target: GalleryHiddenMediaTarget)
|
||||
func findTarget(messageId: MessageId, media: Media) -> ((UIView) -> Void, ASDisplayNode, () -> (UIView?, UIView?))?
|
||||
func findTarget(messageId: EngineMessage.Id, media: EngineMedia) -> ((UIView) -> Void, ASDisplayNode, () -> (UIView?, UIView?))?
|
||||
}
|
||||
|
||||
public protocol UniversalVideoManager: AnyObject {
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@ import Foundation
|
|||
import UIKit
|
||||
import AsyncDisplayKit
|
||||
import Display
|
||||
import Postbox
|
||||
import TelegramCore
|
||||
import SwiftSignalKit
|
||||
import MtProtoKit
|
||||
|
|
@ -209,7 +208,7 @@ public final class AuthorizationSequenceController: NavigationController, ASAuth
|
|||
|> deliverOnMainQueue).startStandalone(next: { [weak self] authorizationPushConfiguration in
|
||||
if let strongSelf = self {
|
||||
strongSelf.actionDisposable.set((sendAuthorizationCode(accountManager: strongSelf.sharedContext.accountManager, account: strongSelf.account, phoneNumber: number, apiId: strongSelf.apiId, apiHash: strongSelf.apiHash, pushNotificationConfiguration: authorizationPushConfiguration, firebaseSecretStream: strongSelf.sharedContext.firebaseSecretStream, syncContacts: syncContacts, disableAuthTokens: disableAuthTokens, forcedPasswordSetupNotice: { value in
|
||||
guard let entry = CodableEntry(ApplicationSpecificCounterNotice(value: value)) else {
|
||||
guard let entry = EngineCodableEntry(ApplicationSpecificCounterNotice(value: value)) else {
|
||||
return nil
|
||||
}
|
||||
return (ApplicationSpecificNotice.forcedPasswordSetupKey(), entry)
|
||||
|
|
@ -327,7 +326,7 @@ public final class AuthorizationSequenceController: NavigationController, ASAuth
|
|||
passkey: passkey,
|
||||
foreignDatacenter: nil,
|
||||
forcedPasswordSetupNotice: { value in
|
||||
guard let entry = CodableEntry(ApplicationSpecificCounterNotice(value: value)) else {
|
||||
guard let entry = EngineCodableEntry(ApplicationSpecificCounterNotice(value: value)) else {
|
||||
return nil
|
||||
}
|
||||
return (ApplicationSpecificNotice.forcedPasswordSetupKey(), entry)
|
||||
|
|
@ -518,7 +517,7 @@ public final class AuthorizationSequenceController: NavigationController, ASAuth
|
|||
}))
|
||||
} else {
|
||||
strongSelf.actionDisposable.set((authorizeWithCode(accountManager: strongSelf.sharedContext.accountManager, account: strongSelf.account, code: authorizationCode, termsOfService: termsOfService?.0, forcedPasswordSetupNotice: { value in
|
||||
guard let entry = CodableEntry(ApplicationSpecificCounterNotice(value: value)) else {
|
||||
guard let entry = EngineCodableEntry(ApplicationSpecificCounterNotice(value: value)) else {
|
||||
return nil
|
||||
}
|
||||
return (ApplicationSpecificNotice.forcedPasswordSetupKey(), entry)
|
||||
|
|
@ -857,7 +856,7 @@ public final class AuthorizationSequenceController: NavigationController, ASAuth
|
|||
} else {
|
||||
self.actionDisposable.set(
|
||||
authorizeWithCode(accountManager: self.sharedContext.accountManager, account: self.account, code: .emailVerification(.appleToken(token)), termsOfService: nil, forcedPasswordSetupNotice: { value in
|
||||
guard let entry = CodableEntry(ApplicationSpecificCounterNotice(value: value)) else {
|
||||
guard let entry = EngineCodableEntry(ApplicationSpecificCounterNotice(value: value)) else {
|
||||
return nil
|
||||
}
|
||||
return (ApplicationSpecificNotice.forcedPasswordSetupKey(), entry)
|
||||
|
|
@ -1177,7 +1176,7 @@ public final class AuthorizationSequenceController: NavigationController, ASAuth
|
|||
if stat(result.fileURL.path, &value) == 0 {
|
||||
if let data = try? Data(contentsOf: result.fileURL) {
|
||||
let resource = LocalFileMediaResource(fileId: Int64.random(in: Int64.min ... Int64.max))
|
||||
engine.account.postbox.mediaBox.storeResourceData(resource.id, data: data, synchronous: true)
|
||||
engine.resources.storeResourceData(id: EngineMediaResource.Id(resource.id), data: data, synchronous: true)
|
||||
subscriber.putNext(EngineMediaResource(resource))
|
||||
|
||||
EngineTempBox.shared.dispose(tempFile)
|
||||
|
|
@ -1208,7 +1207,7 @@ public final class AuthorizationSequenceController: NavigationController, ASAuth
|
|||
}
|
||||
|
||||
strongSelf.actionDisposable.set((signUpWithName(accountManager: strongSelf.sharedContext.accountManager, account: strongSelf.account, firstName: firstName, lastName: lastName, avatarData: avatarData, avatarVideo: avatarVideo, videoStartTimestamp: videoStartTimestamp, disableJoinNotifications: !announceSignUp, forcedPasswordSetupNotice: { value in
|
||||
guard let entry = CodableEntry(ApplicationSpecificCounterNotice(value: value)) else {
|
||||
guard let entry = EngineCodableEntry(ApplicationSpecificCounterNotice(value: value)) else {
|
||||
return nil
|
||||
}
|
||||
return (ApplicationSpecificNotice.forcedPasswordSetupKey(), entry)
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@ import Display
|
|||
import AsyncDisplayKit
|
||||
import ComponentFlow
|
||||
import SwiftSignalKit
|
||||
import Postbox
|
||||
import TelegramCore
|
||||
import AccountContext
|
||||
import TelegramPresentationData
|
||||
|
|
@ -139,7 +138,7 @@ final class BrowserAddressListComponent: Component {
|
|||
struct State {
|
||||
let recent: [TelegramMediaWebpage]
|
||||
let isRecentExpanded: Bool
|
||||
let bookmarks: [Message]
|
||||
let bookmarks: [EngineMessage]
|
||||
}
|
||||
|
||||
private let outerView = UIButton()
|
||||
|
|
@ -367,17 +366,22 @@ final class BrowserAddressListComponent: Component {
|
|||
)
|
||||
} else {
|
||||
var webPage: TelegramMediaWebpage?
|
||||
var itemMessage: Message?
|
||||
|
||||
var itemMessage: EngineMessage?
|
||||
|
||||
if section.id == 0 {
|
||||
webPage = state.recent[i]
|
||||
} else if section.id == 1 {
|
||||
let message = state.bookmarks[i]
|
||||
if let primaryUrl = getPrimaryUrl(message: message) {
|
||||
if let media = message.media.first(where: { $0 is TelegramMediaWebpage }) as? TelegramMediaWebpage {
|
||||
webPage = media
|
||||
if let foundWebpage = message.engineMedia.compactMap({ engineMedia -> TelegramMediaWebpage? in
|
||||
if case let .webpage(webpage) = engineMedia {
|
||||
return webpage
|
||||
}
|
||||
return nil
|
||||
}).first {
|
||||
webPage = foundWebpage
|
||||
} else {
|
||||
webPage = TelegramMediaWebpage(webpageId: MediaId(namespace: 0, id: 0), content: .Loaded(TelegramMediaWebpageLoadedContent(url: primaryUrl, displayUrl: "", hash: 0, type: nil, websiteName: "", title: message.text, text: "", embedUrl: nil, embedType: nil, embedSize: nil, duration: nil, author: nil, isMediaLargeByDefault: nil, imageIsVideoCover: false, image: nil, file: nil, story: nil, attributes: [], instantPage: nil)))
|
||||
webPage = TelegramMediaWebpage(webpageId: EngineMedia.Id(namespace: 0, id: 0), content: .Loaded(TelegramMediaWebpageLoadedContent(url: primaryUrl, displayUrl: "", hash: 0, type: nil, websiteName: "", title: message.text, text: "", embedUrl: nil, embedType: nil, embedSize: nil, duration: nil, author: nil, isMediaLargeByDefault: nil, imageIsVideoCover: false, image: nil, file: nil, story: nil, attributes: [], instantPage: nil)))
|
||||
}
|
||||
itemMessage = message
|
||||
} else {
|
||||
|
|
@ -523,9 +527,9 @@ final class BrowserAddressListComponent: Component {
|
|||
return
|
||||
}
|
||||
|
||||
var bookmarks: [Message] = []
|
||||
var bookmarks: [EngineMessage] = []
|
||||
for entry in view.0.entries.reversed() {
|
||||
bookmarks.append(entry.message)
|
||||
bookmarks.append(EngineMessage(entry.message))
|
||||
}
|
||||
|
||||
let isFirstTime = self.stateValue == nil
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@ import UIKit
|
|||
import Display
|
||||
import ComponentFlow
|
||||
import SwiftSignalKit
|
||||
import Postbox
|
||||
import TelegramCore
|
||||
import MultilineTextComponent
|
||||
import TelegramPresentationData
|
||||
|
|
@ -26,21 +25,21 @@ final class BrowserAddressListItemComponent: Component {
|
|||
let context: AccountContext
|
||||
let theme: PresentationTheme
|
||||
let webPage: TelegramMediaWebpage
|
||||
var message: Message?
|
||||
var message: EngineMessage?
|
||||
let hasNext: Bool
|
||||
let insets: UIEdgeInsets
|
||||
let action: () -> Void
|
||||
let contextAction: ((TelegramMediaWebpage, Message?, ContextExtractedContentContainingView, ContextGesture) -> Void)?
|
||||
|
||||
let contextAction: ((TelegramMediaWebpage, EngineMessage?, ContextExtractedContentContainingView, ContextGesture) -> Void)?
|
||||
|
||||
init(
|
||||
context: AccountContext,
|
||||
theme: PresentationTheme,
|
||||
webPage: TelegramMediaWebpage,
|
||||
message: Message?,
|
||||
message: EngineMessage?,
|
||||
hasNext: Bool,
|
||||
insets: UIEdgeInsets,
|
||||
action: @escaping () -> Void,
|
||||
contextAction: ((TelegramMediaWebpage, Message?, ContextExtractedContentContainingView, ContextGesture) -> Void)?
|
||||
contextAction: ((TelegramMediaWebpage, EngineMessage?, ContextExtractedContentContainingView, ContextGesture) -> Void)?
|
||||
) {
|
||||
self.context = context
|
||||
self.theme = theme
|
||||
|
|
@ -190,7 +189,7 @@ final class BrowserAddressListItemComponent: Component {
|
|||
if let image = content.image {
|
||||
if let representation = imageRepresentationLargerThan(image.representations, size: PixelDimensions(width: 80, height: 80)) {
|
||||
if let message = component.message {
|
||||
iconImageReferenceAndRepresentation = (.message(message: MessageReference(message), media: image), representation)
|
||||
iconImageReferenceAndRepresentation = (.message(message: MessageReference(message._asMessage()), media: image), representation)
|
||||
} else {
|
||||
iconImageReferenceAndRepresentation = (.standalone(media: image), representation)
|
||||
}
|
||||
|
|
@ -198,7 +197,7 @@ final class BrowserAddressListItemComponent: Component {
|
|||
} else if let file = content.file {
|
||||
if let representation = smallestImageRepresentation(file.previewRepresentations) {
|
||||
if let message = component.message {
|
||||
iconImageReferenceAndRepresentation = (.message(message: MessageReference(message), media: file), representation)
|
||||
iconImageReferenceAndRepresentation = (.message(message: MessageReference(message._asMessage()), media: file), representation)
|
||||
} else {
|
||||
iconImageReferenceAndRepresentation = (.standalone(media: file), representation)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@ import AccountContext
|
|||
import AsyncDisplayKit
|
||||
import Display
|
||||
import SwiftSignalKit
|
||||
import Postbox
|
||||
import TelegramCore
|
||||
import TelegramPresentationData
|
||||
import PresentationDataUtils
|
||||
|
|
@ -44,18 +43,18 @@ public final class BrowserBookmarksScreen: ViewController {
|
|||
self.controller = controller
|
||||
self.presentationData = presentationData
|
||||
|
||||
var openMessageImpl: ((Message) -> Bool)?
|
||||
var openContextMenuImpl: ((Message, ASDisplayNode, CGRect, UIGestureRecognizer?) -> Void)?
|
||||
var openMessageImpl: ((EngineMessage) -> Bool)?
|
||||
var openContextMenuImpl: ((EngineMessage, ASDisplayNode, CGRect, UIGestureRecognizer?) -> Void)?
|
||||
self.controllerInteraction = ChatControllerInteraction(openMessage: { message, _ in
|
||||
if let openMessageImpl = openMessageImpl {
|
||||
return openMessageImpl(message)
|
||||
return openMessageImpl(EngineMessage(message))
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
}, openPeer: { _, _, _, _ in
|
||||
}, openPeerMention: { _, _ in
|
||||
}, openMessageContextMenu: { message, _, sourceView, rect, gesture, _ in
|
||||
openContextMenuImpl?(message, sourceView, rect, gesture)
|
||||
openContextMenuImpl?(EngineMessage(message), sourceView, rect, gesture)
|
||||
}, openMessageReactionContextMenu: { _, _, _, _ in
|
||||
}, updateMessageReaction: { _, _, _, _ in
|
||||
}, activateMessagePinch: { _ in
|
||||
|
|
@ -89,7 +88,7 @@ public final class BrowserBookmarksScreen: ViewController {
|
|||
}, sendBotCommand: { _, _ in
|
||||
}, openInstantPage: { message, _ in
|
||||
if let openMessageImpl = openMessageImpl {
|
||||
let _ = openMessageImpl(message)
|
||||
let _ = openMessageImpl(EngineMessage(message))
|
||||
}
|
||||
}, openWallpaper: { _ in
|
||||
}, openTheme: {_ in
|
||||
|
|
@ -197,7 +196,7 @@ public final class BrowserBookmarksScreen: ViewController {
|
|||
}, automaticMediaDownloadSettings: MediaAutoDownloadSettings.defaultSettings, pollActionState: ChatInterfacePollActionState(), stickerSettings: ChatInterfaceStickerSettings(), presentationContext: ChatPresentationContext(context: context, backgroundNode: nil))
|
||||
|
||||
|
||||
let tagMask: MessageTags = .webPage
|
||||
let tagMask: EngineMessage.Tags = .webPage
|
||||
let chatLocationContextHolder = Atomic<ChatLocationContextHolder?>(value: nil)
|
||||
self.historyNode = context.sharedContext.makeChatHistoryListNode(
|
||||
context: context,
|
||||
|
|
@ -261,7 +260,13 @@ public final class BrowserBookmarksScreen: ViewController {
|
|||
let presentationData = self.context.sharedContext.currentPresentationData.with { $0 }
|
||||
|
||||
var itemList: [ContextMenuItem] = []
|
||||
if let webPage = message.media.first(where: { $0 is TelegramMediaWebpage }) as? TelegramMediaWebpage, let url = webPage.content.url {
|
||||
let foundWebpage = message.engineMedia.compactMap { engineMedia -> TelegramMediaWebpage? in
|
||||
if case let .webpage(webpage) = engineMedia {
|
||||
return webpage
|
||||
}
|
||||
return nil
|
||||
}.first
|
||||
if let webPage = foundWebpage, let url = webPage.content.url {
|
||||
itemList.append(.action(ContextMenuActionItem(text: presentationData.strings.WebBrowser_CopyLink, icon: { theme in
|
||||
return generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/Copy"), color: theme.contextMenu.primaryColor)
|
||||
}, action: { [weak self] _, f in
|
||||
|
|
@ -299,7 +304,7 @@ public final class BrowserBookmarksScreen: ViewController {
|
|||
guard let (layout, navigationBarHeight, _) = self.validLayout, let navigationBar = self.controller?.navigationBar else {
|
||||
return
|
||||
}
|
||||
let tagMask: MessageTags = .webPage
|
||||
let tagMask: EngineMessage.Tags = .webPage
|
||||
|
||||
self.searchDisplayController = SearchDisplayController(presentationData: self.presentationData, mode: .navigation, placeholder: self.presentationData.strings.Common_Search, hasBackground: true, contentNode: ChatHistorySearchContainerNode(context: self.context, peerId: self.context.account.peerId, threadId: nil, tagMask: tagMask, interfaceInteraction: self.controllerInteraction), cancel: { [weak self] in
|
||||
self?.controller?.deactivateSearch()
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@ import UIKit
|
|||
import Display
|
||||
import ComponentFlow
|
||||
import TelegramCore
|
||||
import Postbox
|
||||
import SwiftSignalKit
|
||||
import TelegramPresentationData
|
||||
import TelegramUIPreferences
|
||||
|
|
@ -44,7 +43,7 @@ final class BrowserDocumentContent: UIView, BrowserContent, WKNavigationDelegate
|
|||
var presentInGlobalOverlay: (ViewController) -> Void = { _ in }
|
||||
var getNavigationController: () -> NavigationController? = { return nil }
|
||||
|
||||
private var tempFile: TempBoxFile?
|
||||
private var tempFile: EngineTempBoxFile?
|
||||
|
||||
init(context: AccountContext, presentationData: PresentationData, file: FileMediaReference) {
|
||||
self.context = context
|
||||
|
|
@ -65,7 +64,7 @@ final class BrowserDocumentContent: UIView, BrowserContent, WKNavigationDelegate
|
|||
if let path = self.context.engine.resources.completedResourcePath(id: EngineMediaResource.Id(file.media.resource.id)) {
|
||||
var updatedPath = path
|
||||
if let fileName = file.media.fileName {
|
||||
let tempFile = TempBox.shared.file(path: path, fileName: fileName)
|
||||
let tempFile = EngineTempBox.shared.file(path: path, fileName: fileName)
|
||||
updatedPath = tempFile.path
|
||||
self.tempFile = tempFile
|
||||
title = fileName
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@ import UIKit
|
|||
import Display
|
||||
import ComponentFlow
|
||||
import TelegramCore
|
||||
import Postbox
|
||||
import SwiftSignalKit
|
||||
import TelegramPresentationData
|
||||
import TelegramUIPreferences
|
||||
|
|
@ -51,7 +50,7 @@ final class BrowserPdfContent: UIView, BrowserContent, UIScrollViewDelegate, PDF
|
|||
var presentInGlobalOverlay: (ViewController) -> Void = { _ in }
|
||||
var getNavigationController: () -> NavigationController? = { return nil }
|
||||
|
||||
private var tempFile: TempBoxFile?
|
||||
private var tempFile: EngineTempBoxFile?
|
||||
|
||||
init(context: AccountContext, presentationData: PresentationData, file: FileMediaReference) {
|
||||
self.context = context
|
||||
|
|
@ -85,7 +84,7 @@ final class BrowserPdfContent: UIView, BrowserContent, UIScrollViewDelegate, PDF
|
|||
if let path = self.context.engine.resources.completedResourcePath(id: EngineMediaResource.Id(file.media.resource.id)) {
|
||||
var updatedPath = path
|
||||
if let fileName = file.media.fileName {
|
||||
let tempFile = TempBox.shared.file(path: path, fileName: fileName)
|
||||
let tempFile = EngineTempBox.shared.file(path: path, fileName: fileName)
|
||||
updatedPath = tempFile.path
|
||||
self.tempFile = tempFile
|
||||
title = fileName
|
||||
|
|
|
|||
|
|
@ -1,23 +1,22 @@
|
|||
import Foundation
|
||||
import Postbox
|
||||
import TelegramCore
|
||||
import SwiftSignalKit
|
||||
import TelegramUIPreferences
|
||||
|
||||
private struct RecentlyVisitedLinkItemId {
|
||||
public let rawValue: MemoryBuffer
|
||||
public let rawValue: EngineMemoryBuffer
|
||||
|
||||
var value: String {
|
||||
return String(data: self.rawValue.makeData(), encoding: .utf8) ?? ""
|
||||
}
|
||||
|
||||
init(_ rawValue: MemoryBuffer) {
|
||||
init(_ rawValue: EngineMemoryBuffer) {
|
||||
self.rawValue = rawValue
|
||||
}
|
||||
|
||||
init?(_ value: String) {
|
||||
if let data = value.data(using: .utf8) {
|
||||
self.rawValue = MemoryBuffer(data: data)
|
||||
self.rawValue = EngineMemoryBuffer(data: data)
|
||||
} else {
|
||||
return nil
|
||||
}
|
||||
|
|
@ -38,7 +37,7 @@ public final class RecentVisitedLinkItem: Codable {
|
|||
public init(from decoder: Decoder) throws {
|
||||
let container = try decoder.container(keyedBy: CodingKeys.self)
|
||||
if let webPageData = try container.decodeIfPresent(Data.self, forKey: .webPage) {
|
||||
self.webPage = PostboxDecoder(buffer: MemoryBuffer(data: webPageData)).decodeRootObject() as! TelegramMediaWebpage
|
||||
self.webPage = EnginePostboxDecoder(buffer: EngineMemoryBuffer(data: webPageData)).decodeRootObject() as! TelegramMediaWebpage
|
||||
} else {
|
||||
fatalError()
|
||||
}
|
||||
|
|
@ -47,7 +46,7 @@ public final class RecentVisitedLinkItem: Codable {
|
|||
public func encode(to encoder: Encoder) throws {
|
||||
var container = encoder.container(keyedBy: CodingKeys.self)
|
||||
|
||||
let encoder = PostboxEncoder()
|
||||
let encoder = EnginePostboxEncoder()
|
||||
encoder.encodeRootObject(self.webPage)
|
||||
let webPageData = encoder.makeData()
|
||||
try container.encode(webPageData, forKey: .webPage)
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@ import UIKit
|
|||
import Display
|
||||
import ComponentFlow
|
||||
import TelegramCore
|
||||
import Postbox
|
||||
import SwiftSignalKit
|
||||
import TelegramPresentationData
|
||||
import TelegramUIPreferences
|
||||
|
|
@ -236,7 +235,7 @@ final class BrowserWebContent: UIView, BrowserContent, WKNavigationDelegate, WKU
|
|||
var getNavigationController: () -> NavigationController? = { return nil }
|
||||
var cancelInteractiveTransitionGestures: () -> Void = {}
|
||||
|
||||
private var tempFile: TempBoxFile?
|
||||
private var tempFile: EngineTempBoxFile?
|
||||
private var disposeTrustedDomain: (() -> Void)?
|
||||
|
||||
init(context: AccountContext, presentationData: PresentationData, url: String, preferredConfiguration: WKWebViewConfiguration? = nil) {
|
||||
|
|
@ -321,7 +320,7 @@ final class BrowserWebContent: UIView, BrowserContent, WKNavigationDelegate, WKU
|
|||
var request: URLRequest?
|
||||
if url.hasPrefix("file://") {
|
||||
var updatedPath = url
|
||||
let tempFile = TempBox.shared.file(path: url.replacingOccurrences(of: "file://", with: ""), fileName: "file.xlsx")
|
||||
let tempFile = EngineTempBox.shared.file(path: url.replacingOccurrences(of: "file://", with: ""), fileName: "file.xlsx")
|
||||
updatedPath = tempFile.path
|
||||
self.tempFile = tempFile
|
||||
|
||||
|
|
@ -536,7 +535,7 @@ final class BrowserWebContent: UIView, BrowserContent, WKNavigationDelegate, WKU
|
|||
fileName = "default"
|
||||
}
|
||||
|
||||
let tempFile = TempBox.shared.file(path: path, fileName: fileName)
|
||||
let tempFile = EngineTempBox.shared.file(path: path, fileName: fileName)
|
||||
let fileUrl = URL(fileURLWithPath: tempFile.path)
|
||||
|
||||
let controller = legacyICloudFilePicker(theme: self.presentationData.theme, mode: .export, url: fileUrl, documentTypes: [], forceDarkTheme: false, dismissed: {}, completion: { _ in
|
||||
|
|
@ -1042,7 +1041,7 @@ final class BrowserWebContent: UIView, BrowserContent, WKNavigationDelegate, WKU
|
|||
}
|
||||
|
||||
if let (path, fileName) = self.downloadArguments {
|
||||
let tempFile = TempBox.shared.file(path: path, fileName: fileName)
|
||||
let tempFile = EngineTempBox.shared.file(path: path, fileName: fileName)
|
||||
let url = URL(fileURLWithPath: tempFile.path)
|
||||
|
||||
if fileName.hasSuffix(".pkpass") {
|
||||
|
|
@ -1180,7 +1179,7 @@ final class BrowserWebContent: UIView, BrowserContent, WKNavigationDelegate, WKU
|
|||
}
|
||||
self.instantPage = webPage
|
||||
self.instantPageResources = resources
|
||||
let _ = (updatedRemoteWebpage(postbox: self.context.account.postbox, network: self.context.account.network, accountPeerId: self.context.account.peerId, webPage: WebpageReference(TelegramMediaWebpage(webpageId: MediaId(namespace: 0, id: 0), content: .Loaded(TelegramMediaWebpageLoadedContent(url: self._state.url, displayUrl: "", hash: 0, type: nil, websiteName: nil, title: nil, text: nil, embedUrl: nil, embedType: nil, embedSize: nil, duration: nil, author: nil, isMediaLargeByDefault: nil, imageIsVideoCover: false, image: nil, file: nil, story: nil, attributes: [], instantPage: nil)))))
|
||||
let _ = (updatedRemoteWebpage(postbox: self.context.account.postbox, network: self.context.account.network, accountPeerId: self.context.account.peerId, webPage: WebpageReference(TelegramMediaWebpage(webpageId: EngineMedia.Id(namespace: 0, id: 0), content: .Loaded(TelegramMediaWebpageLoadedContent(url: self._state.url, displayUrl: "", hash: 0, type: nil, websiteName: nil, title: nil, text: nil, embedUrl: nil, embedType: nil, embedSize: nil, duration: nil, author: nil, isMediaLargeByDefault: nil, imageIsVideoCover: false, image: nil, file: nil, story: nil, attributes: [], instantPage: nil)))))
|
||||
|> deliverOnMainQueue).start(next: { [weak self] webPage in
|
||||
guard let self, let webPage, case let .Loaded(result) = webPage.content, let _ = result.instantPage else {
|
||||
return
|
||||
|
|
@ -1215,7 +1214,7 @@ final class BrowserWebContent: UIView, BrowserContent, WKNavigationDelegate, WKU
|
|||
let path = NSTemporaryDirectory() + NSUUID().uuidString
|
||||
let _ = try? data.write(to: URL(fileURLWithPath: path), options: .atomic)
|
||||
|
||||
let tempFile = TempBox.shared.file(path: path, fileName: "\(self._state.title).webarchive")
|
||||
let tempFile = EngineTempBox.shared.file(path: path, fileName: "\(self._state.title).webarchive")
|
||||
let url = URL(fileURLWithPath: tempFile.path)
|
||||
|
||||
let controller = legacyICloudFilePicker(theme: self.presentationData.theme, mode: .export, url: url, documentTypes: [], forceDarkTheme: false, dismissed: {}, completion: { _ in
|
||||
|
|
@ -1354,7 +1353,7 @@ final class BrowserWebContent: UIView, BrowserContent, WKNavigationDelegate, WKU
|
|||
fileName = "default"
|
||||
}
|
||||
|
||||
let tempFile = TempBox.shared.file(path: path, fileName: fileName)
|
||||
let tempFile = EngineTempBox.shared.file(path: path, fileName: fileName)
|
||||
let fileUrl = URL(fileURLWithPath: tempFile.path)
|
||||
|
||||
let controller = legacyICloudFilePicker(theme: self.presentationData.theme, mode: .export, url: fileUrl, documentTypes: [], forceDarkTheme: false, dismissed: {}, completion: { _ in
|
||||
|
|
@ -1675,7 +1674,7 @@ final class BrowserWebContent: UIView, BrowserContent, WKNavigationDelegate, WKU
|
|||
let resource = LocalFileMediaResource(fileId: Int64.random(in: Int64.min ... Int64.max))
|
||||
self.context.engine.resources.storeResourceData(id: EngineMediaResource.Id(resource.id), data: imageData)
|
||||
image = TelegramMediaImage(
|
||||
imageId: MediaId(namespace: Namespaces.Media.LocalImage, id: Int64.random(in: Int64.min ... Int64.max)),
|
||||
imageId: EngineMedia.Id(namespace: Namespaces.Media.LocalImage, id: Int64.random(in: Int64.min ... Int64.max)),
|
||||
representations: [
|
||||
TelegramMediaImageRepresentation(
|
||||
dimensions: PixelDimensions(width: Int32(favicon.size.width), height: Int32(favicon.size.height)),
|
||||
|
|
@ -1693,7 +1692,7 @@ final class BrowserWebContent: UIView, BrowserContent, WKNavigationDelegate, WKU
|
|||
)
|
||||
}
|
||||
|
||||
let webPage = TelegramMediaWebpage(webpageId: MediaId(namespace: 0, id: 0), content: .Loaded(TelegramMediaWebpageLoadedContent(
|
||||
let webPage = TelegramMediaWebpage(webpageId: EngineMedia.Id(namespace: 0, id: 0), content: .Loaded(TelegramMediaWebpageLoadedContent(
|
||||
url: self._state.url,
|
||||
displayUrl: self._state.url,
|
||||
hash: 0,
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ func fetchFavicon(context: AccountContext, url: String, size: CGSize) -> Signal<
|
|||
}
|
||||
}
|
||||
|
||||
func getPrimaryUrl(message: Message) -> String? {
|
||||
func getPrimaryUrl(message: EngineMessage) -> String? {
|
||||
var primaryUrl: String?
|
||||
if let webPage = message.media.first(where: { $0 is TelegramMediaWebpage }) as? TelegramMediaWebpage, let url = webPage.content.url {
|
||||
primaryUrl = url
|
||||
|
|
|
|||
|
|
@ -372,7 +372,7 @@ public final class CallListController: TelegramBaseController {
|
|||
TelegramEngine.EngineData.Item.Peer.Peer(id: peerId)
|
||||
)
|
||||
|> deliverOnMainQueue).startStandalone(next: { peer in
|
||||
if let strongSelf = self, let peer = peer, let controller = strongSelf.context.sharedContext.makePeerInfoController(context: strongSelf.context, updatedPresentationData: nil, peer: peer, mode: .calls(messages: messages.map({ $0._asMessage() })), avatarInitiallyExpanded: false, fromChat: false, requestsContext: nil) {
|
||||
if let strongSelf = self, let peer = peer, let controller = strongSelf.context.sharedContext.makePeerInfoController(context: strongSelf.context, updatedPresentationData: nil, peer: peer, mode: .calls(messages: messages), avatarInitiallyExpanded: false, fromChat: false, requestsContext: nil) {
|
||||
(strongSelf.navigationController as? NavigationController)?.pushViewController(controller)
|
||||
}
|
||||
})
|
||||
|
|
|
|||
|
|
@ -130,7 +130,7 @@ private final class VisualMediaItemNode: ASDisplayNode {
|
|||
|
||||
if let media = media {
|
||||
if let file = media as? TelegramMediaFile {
|
||||
if isMediaStreamable(message: message, media: file) {
|
||||
if isMediaStreamable(message: EngineMessage(message), media: file) {
|
||||
self.interaction.openMessage(message)
|
||||
} else {
|
||||
self.progressPressed()
|
||||
|
|
@ -226,7 +226,7 @@ private final class VisualMediaItemNode: ASDisplayNode {
|
|||
if let strongSelf = self, let _ = strongSelf.item {
|
||||
strongSelf.resourceStatus = status
|
||||
|
||||
let isStreamable = isMediaStreamable(message: message, media: file)
|
||||
let isStreamable = isMediaStreamable(message: EngineMessage(message), media: file)
|
||||
|
||||
var statusState: RadialStatusNodeState = .none
|
||||
if isStreamable || file.isAnimated {
|
||||
|
|
|
|||
|
|
@ -2588,7 +2588,7 @@ public final class ChatListNode: ListViewImpl {
|
|||
}
|
||||
let presentationData = state.presentationData
|
||||
|
||||
return preparedChatListNodeViewTransition(from: previousView, to: processedView, reason: reason, previewing: previewing, disableAnimations: disableAnimations, account: context.account, scrollPosition: updatedScrollPosition, searchMode: searchMode, forceAllUpdated: forceAllUpdated)
|
||||
return preparedChatListNodeViewTransition(from: previousView, to: processedView, reason: reason, previewing: previewing, disableAnimations: disableAnimations, scrollPosition: updatedScrollPosition, searchMode: searchMode, forceAllUpdated: forceAllUpdated)
|
||||
|> map({ mappedChatListNodeViewListTransition(context: context, nodeInteraction: nodeInteraction, location: location, isPremium: accountIsPremium, filterData: filterData, chatListFilters: chatListFilters, mode: mode, isPeerEnabled: isPeerEnabled, presentationData: presentationData, transition: $0) })
|
||||
|> runOn(prepareOnMainQueue ? Queue.mainQueue() : viewProcessingQueue)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
import Foundation
|
||||
import UIKit
|
||||
import Postbox
|
||||
import TelegramCore
|
||||
import TelegramPresentationData
|
||||
import MergeLists
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
import Foundation
|
||||
import Postbox
|
||||
import TelegramCore
|
||||
import SwiftSignalKit
|
||||
import Display
|
||||
|
|
@ -48,10 +47,10 @@ struct ChatListNodeViewTransition {
|
|||
}
|
||||
|
||||
public enum ChatListNodeViewScrollPosition {
|
||||
case index(index: ChatListIndex, position: ListViewScrollPosition, directionHint: ListViewScrollToItemDirectionHint, animated: Bool)
|
||||
case index(index: EngineChatListIndex, position: ListViewScrollPosition, directionHint: ListViewScrollToItemDirectionHint, animated: Bool)
|
||||
}
|
||||
|
||||
func preparedChatListNodeViewTransition(from fromView: ChatListNodeView?, to toView: ChatListNodeView, reason: ChatListNodeViewTransitionReason, previewing: Bool, disableAnimations: Bool, account: Account, scrollPosition: ChatListNodeViewScrollPosition?, searchMode: Bool, forceAllUpdated: Bool) -> Signal<ChatListNodeViewTransition, NoError> {
|
||||
func preparedChatListNodeViewTransition(from fromView: ChatListNodeView?, to toView: ChatListNodeView, reason: ChatListNodeViewTransitionReason, previewing: Bool, disableAnimations: Bool, scrollPosition: ChatListNodeViewScrollPosition?, searchMode: Bool, forceAllUpdated: Bool) -> Signal<ChatListNodeViewTransition, NoError> {
|
||||
return Signal<ChatListNodeViewTransition, NoError> { subscriber in
|
||||
let (deleteIndices, indicesAndItems, updateIndices) = mergeListsStableWithUpdates(leftList: fromView?.filteredEntries ?? [], rightList: toView.filteredEntries, allUpdated: forceAllUpdated)
|
||||
|
||||
|
|
|
|||
|
|
@ -12,7 +12,6 @@ swift_library(
|
|||
deps = [
|
||||
"//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit",
|
||||
"//submodules/Display:Display",
|
||||
"//submodules/Postbox:Postbox",
|
||||
"//submodules/TelegramCore:TelegramCore",
|
||||
"//submodules/MtProtoKit:MtProtoKit",
|
||||
"//submodules/TelegramPresentationData:TelegramPresentationData",
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@ import Foundation
|
|||
import UIKit
|
||||
import Display
|
||||
import SwiftSignalKit
|
||||
import Postbox
|
||||
import TelegramCore
|
||||
import MtProtoKit
|
||||
import MessageUI
|
||||
|
|
@ -345,8 +344,8 @@ private enum DebugControllerEntry: ItemListNodeEntry {
|
|||
}
|
||||
}
|
||||
|
||||
let tempSource = TempBox.shared.tempFile(fileName: "Log.txt")
|
||||
let tempZip = TempBox.shared.tempFile(fileName: "destination.zip")
|
||||
let tempSource = EngineTempBox.shared.tempFile(fileName: "Log.txt")
|
||||
let tempZip = EngineTempBox.shared.tempFile(fileName: "destination.zip")
|
||||
|
||||
let _ = try? rawLogData.write(to: URL(fileURLWithPath: tempSource.path))
|
||||
|
||||
|
|
@ -356,14 +355,14 @@ private enum DebugControllerEntry: ItemListNodeEntry {
|
|||
return
|
||||
}
|
||||
|
||||
TempBox.shared.dispose(tempSource)
|
||||
TempBox.shared.dispose(tempZip)
|
||||
EngineTempBox.shared.dispose(tempSource)
|
||||
EngineTempBox.shared.dispose(tempZip)
|
||||
|
||||
let id = Int64.random(in: Int64.min ... Int64.max)
|
||||
let fileResource = LocalFileMediaResource(fileId: id, size: Int64(gzippedData.count), isSecretRelated: false)
|
||||
context.engine.resources.storeResourceData(id: EngineMediaResource.Id(fileResource.id), data: gzippedData)
|
||||
|
||||
let file = TelegramMediaFile(fileId: MediaId(namespace: Namespaces.Media.LocalFile, id: id), partialReference: nil, resource: fileResource, previewRepresentations: [], videoThumbnails: [], immediateThumbnailData: nil, mimeType: "application/text", size: Int64(gzippedData.count), attributes: [.FileName(fileName: "Log-iOS-Full.txt.zip")], alternativeRepresentations: [])
|
||||
let file = TelegramMediaFile(fileId: EngineMedia.Id(namespace: Namespaces.Media.LocalFile, id: id), partialReference: nil, resource: fileResource, previewRepresentations: [], videoThumbnails: [], immediateThumbnailData: nil, mimeType: "application/text", size: Int64(gzippedData.count), attributes: [.FileName(fileName: "Log-iOS-Full.txt.zip")], alternativeRepresentations: [])
|
||||
let message: EnqueueMessage = .message(text: "", attributes: [], inlineStickers: [:], mediaReference: .standalone(media: file), threadId: nil, replyToMessageId: nil, replyToStoryId: nil, localGroupingKey: nil, correlationId: nil, bubbleUpEmojiOrStickersets: [])
|
||||
|
||||
let _ = enqueueMessages(account: context.account, peerId: peerId, messages: [message]).start()
|
||||
|
|
@ -443,7 +442,7 @@ private enum DebugControllerEntry: ItemListNodeEntry {
|
|||
let fileResource = LocalFileMediaResource(fileId: id, size: Int64(logData.count), isSecretRelated: false)
|
||||
context.engine.resources.storeResourceData(id: EngineMediaResource.Id(fileResource.id), data: logData)
|
||||
|
||||
let file = TelegramMediaFile(fileId: MediaId(namespace: Namespaces.Media.LocalFile, id: id), partialReference: nil, resource: fileResource, previewRepresentations: [], videoThumbnails: [], immediateThumbnailData: nil, mimeType: "application/text", size: Int64(logData.count), attributes: [.FileName(fileName: "Log-iOS-Short.txt")], alternativeRepresentations: [])
|
||||
let file = TelegramMediaFile(fileId: EngineMedia.Id(namespace: Namespaces.Media.LocalFile, id: id), partialReference: nil, resource: fileResource, previewRepresentations: [], videoThumbnails: [], immediateThumbnailData: nil, mimeType: "application/text", size: Int64(logData.count), attributes: [.FileName(fileName: "Log-iOS-Short.txt")], alternativeRepresentations: [])
|
||||
let message: EnqueueMessage = .message(text: "", attributes: [], inlineStickers: [:], mediaReference: .standalone(media: file), threadId: nil, replyToMessageId: nil, replyToStoryId: nil, localGroupingKey: nil, correlationId: nil, bubbleUpEmojiOrStickersets: [])
|
||||
|
||||
let _ = enqueueMessages(account: context.account, peerId: peerId, messages: [message]).start()
|
||||
|
|
@ -511,8 +510,8 @@ private enum DebugControllerEntry: ItemListNodeEntry {
|
|||
}
|
||||
}
|
||||
|
||||
let tempSource = TempBox.shared.tempFile(fileName: "Log.txt")
|
||||
let tempZip = TempBox.shared.tempFile(fileName: "destination.zip")
|
||||
let tempSource = EngineTempBox.shared.tempFile(fileName: "Log.txt")
|
||||
let tempZip = EngineTempBox.shared.tempFile(fileName: "destination.zip")
|
||||
|
||||
let _ = try? rawLogData.write(to: URL(fileURLWithPath: tempSource.path))
|
||||
|
||||
|
|
@ -522,14 +521,14 @@ private enum DebugControllerEntry: ItemListNodeEntry {
|
|||
return
|
||||
}
|
||||
|
||||
TempBox.shared.dispose(tempSource)
|
||||
TempBox.shared.dispose(tempZip)
|
||||
EngineTempBox.shared.dispose(tempSource)
|
||||
EngineTempBox.shared.dispose(tempZip)
|
||||
|
||||
let id = Int64.random(in: Int64.min ... Int64.max)
|
||||
let fileResource = LocalFileMediaResource(fileId: id, size: Int64(gzippedData.count), isSecretRelated: false)
|
||||
context.engine.resources.storeResourceData(id: EngineMediaResource.Id(fileResource.id), data: gzippedData)
|
||||
|
||||
let file = TelegramMediaFile(fileId: MediaId(namespace: Namespaces.Media.LocalFile, id: id), partialReference: nil, resource: fileResource, previewRepresentations: [], videoThumbnails: [], immediateThumbnailData: nil, mimeType: "application/text", size: Int64(gzippedData.count), attributes: [.FileName(fileName: "Log-iOS-Full.txt.zip")], alternativeRepresentations: [])
|
||||
let file = TelegramMediaFile(fileId: EngineMedia.Id(namespace: Namespaces.Media.LocalFile, id: id), partialReference: nil, resource: fileResource, previewRepresentations: [], videoThumbnails: [], immediateThumbnailData: nil, mimeType: "application/text", size: Int64(gzippedData.count), attributes: [.FileName(fileName: "Log-iOS-Full.txt.zip")], alternativeRepresentations: [])
|
||||
let message: EnqueueMessage = .message(text: "", attributes: [], inlineStickers: [:], mediaReference: .standalone(media: file), threadId: nil, replyToMessageId: nil, replyToStoryId: nil, localGroupingKey: nil, correlationId: nil, bubbleUpEmojiOrStickersets: [])
|
||||
|
||||
let _ = enqueueMessages(account: context.account, peerId: peerId, messages: [message]).start()
|
||||
|
|
@ -595,8 +594,8 @@ private enum DebugControllerEntry: ItemListNodeEntry {
|
|||
}
|
||||
}
|
||||
|
||||
let tempSource = TempBox.shared.tempFile(fileName: "Log.txt")
|
||||
let tempZip = TempBox.shared.tempFile(fileName: "destination.zip")
|
||||
let tempSource = EngineTempBox.shared.tempFile(fileName: "Log.txt")
|
||||
let tempZip = EngineTempBox.shared.tempFile(fileName: "destination.zip")
|
||||
|
||||
let _ = try? rawLogData.write(to: URL(fileURLWithPath: tempSource.path))
|
||||
|
||||
|
|
@ -606,14 +605,14 @@ private enum DebugControllerEntry: ItemListNodeEntry {
|
|||
return
|
||||
}
|
||||
|
||||
TempBox.shared.dispose(tempSource)
|
||||
TempBox.shared.dispose(tempZip)
|
||||
EngineTempBox.shared.dispose(tempSource)
|
||||
EngineTempBox.shared.dispose(tempZip)
|
||||
|
||||
let id = Int64.random(in: Int64.min ... Int64.max)
|
||||
let fileResource = LocalFileMediaResource(fileId: id, size: Int64(gzippedData.count), isSecretRelated: false)
|
||||
context.engine.resources.storeResourceData(id: EngineMediaResource.Id(fileResource.id), data: gzippedData)
|
||||
|
||||
let file = TelegramMediaFile(fileId: MediaId(namespace: Namespaces.Media.LocalFile, id: id), partialReference: nil, resource: fileResource, previewRepresentations: [], videoThumbnails: [], immediateThumbnailData: nil, mimeType: "application/text", size: Int64(gzippedData.count), attributes: [.FileName(fileName: "Log-iOS-Full.txt.zip")], alternativeRepresentations: [])
|
||||
let file = TelegramMediaFile(fileId: EngineMedia.Id(namespace: Namespaces.Media.LocalFile, id: id), partialReference: nil, resource: fileResource, previewRepresentations: [], videoThumbnails: [], immediateThumbnailData: nil, mimeType: "application/text", size: Int64(gzippedData.count), attributes: [.FileName(fileName: "Log-iOS-Full.txt.zip")], alternativeRepresentations: [])
|
||||
let message: EnqueueMessage = .message(text: "", attributes: [], inlineStickers: [:], mediaReference: .standalone(media: file), threadId: nil, replyToMessageId: nil, replyToStoryId: nil, localGroupingKey: nil, correlationId: nil, bubbleUpEmojiOrStickersets: [])
|
||||
|
||||
let _ = enqueueMessages(account: context.account, peerId: peerId, messages: [message]).start()
|
||||
|
|
@ -680,8 +679,8 @@ private enum DebugControllerEntry: ItemListNodeEntry {
|
|||
}
|
||||
}
|
||||
|
||||
let tempSource = TempBox.shared.tempFile(fileName: "Log.txt")
|
||||
let tempZip = TempBox.shared.tempFile(fileName: "destination.zip")
|
||||
let tempSource = EngineTempBox.shared.tempFile(fileName: "Log.txt")
|
||||
let tempZip = EngineTempBox.shared.tempFile(fileName: "destination.zip")
|
||||
|
||||
let _ = try? rawLogData.write(to: URL(fileURLWithPath: tempSource.path))
|
||||
|
||||
|
|
@ -691,14 +690,14 @@ private enum DebugControllerEntry: ItemListNodeEntry {
|
|||
return
|
||||
}
|
||||
|
||||
TempBox.shared.dispose(tempSource)
|
||||
TempBox.shared.dispose(tempZip)
|
||||
EngineTempBox.shared.dispose(tempSource)
|
||||
EngineTempBox.shared.dispose(tempZip)
|
||||
|
||||
let id = Int64.random(in: Int64.min ... Int64.max)
|
||||
let fileResource = LocalFileMediaResource(fileId: id, size: Int64(gzippedData.count), isSecretRelated: false)
|
||||
context.engine.resources.storeResourceData(id: EngineMediaResource.Id(fileResource.id), data: gzippedData)
|
||||
|
||||
let file = TelegramMediaFile(fileId: MediaId(namespace: Namespaces.Media.LocalFile, id: id), partialReference: nil, resource: fileResource, previewRepresentations: [], videoThumbnails: [], immediateThumbnailData: nil, mimeType: "application/text", size: Int64(gzippedData.count), attributes: [.FileName(fileName: "Log-iOS-Full.txt.zip")], alternativeRepresentations: [])
|
||||
let file = TelegramMediaFile(fileId: EngineMedia.Id(namespace: Namespaces.Media.LocalFile, id: id), partialReference: nil, resource: fileResource, previewRepresentations: [], videoThumbnails: [], immediateThumbnailData: nil, mimeType: "application/text", size: Int64(gzippedData.count), attributes: [.FileName(fileName: "Log-iOS-Full.txt.zip")], alternativeRepresentations: [])
|
||||
let message: EnqueueMessage = .message(text: "", attributes: [], inlineStickers: [:], mediaReference: .standalone(media: file), threadId: nil, replyToMessageId: nil, replyToStoryId: nil, localGroupingKey: nil, correlationId: nil, bubbleUpEmojiOrStickersets: [])
|
||||
|
||||
let _ = enqueueMessages(account: context.account, peerId: peerId, messages: [message]).start()
|
||||
|
|
@ -751,7 +750,7 @@ private enum DebugControllerEntry: ItemListNodeEntry {
|
|||
|
||||
let messages = logs.map { (name, path) -> EnqueueMessage in
|
||||
let id = Int64.random(in: Int64.min ... Int64.max)
|
||||
let file = TelegramMediaFile(fileId: MediaId(namespace: Namespaces.Media.LocalFile, id: id), partialReference: nil, resource: LocalFileReferenceMediaResource(localFilePath: path, randomId: id), previewRepresentations: [], videoThumbnails: [], immediateThumbnailData: nil, mimeType: "application/text", size: nil, attributes: [.FileName(fileName: name)], alternativeRepresentations: [])
|
||||
let file = TelegramMediaFile(fileId: EngineMedia.Id(namespace: Namespaces.Media.LocalFile, id: id), partialReference: nil, resource: LocalFileReferenceMediaResource(localFilePath: path, randomId: id), previewRepresentations: [], videoThumbnails: [], immediateThumbnailData: nil, mimeType: "application/text", size: nil, attributes: [.FileName(fileName: name)], alternativeRepresentations: [])
|
||||
return .message(text: "", attributes: [], inlineStickers: [:], mediaReference: .standalone(media: file), threadId: nil, replyToMessageId: nil, replyToStoryId: nil, localGroupingKey: nil, correlationId: nil, bubbleUpEmojiOrStickersets: [])
|
||||
}
|
||||
let _ = enqueueMessages(account: context.account, peerId: peerId, messages: messages).start()
|
||||
|
|
@ -824,9 +823,9 @@ private enum DebugControllerEntry: ItemListNodeEntry {
|
|||
|
||||
let lineFeed = "\n".data(using: .utf8)!
|
||||
|
||||
var tempSources: [TempBoxFile] = []
|
||||
var tempSources: [EngineTempBox.File] = []
|
||||
for (type, logItems) in allLogs {
|
||||
let tempSource = TempBox.shared.tempFile(fileName: "Log-\(type).txt")
|
||||
let tempSource = EngineTempBox.shared.tempFile(fileName: "Log-\(type).txt")
|
||||
|
||||
var rawLogData: Data = Data()
|
||||
for (name, path) in logItems {
|
||||
|
|
@ -846,21 +845,21 @@ private enum DebugControllerEntry: ItemListNodeEntry {
|
|||
tempSources.append(tempSource)
|
||||
}
|
||||
|
||||
let tempZip = TempBox.shared.tempFile(fileName: "destination.zip")
|
||||
let tempZip = EngineTempBox.shared.tempFile(fileName: "destination.zip")
|
||||
SSZipArchive.createZipFile(atPath: tempZip.path, withFilesAtPaths: tempSources.map(\.path))
|
||||
|
||||
guard let gzippedData = try? Data(contentsOf: URL(fileURLWithPath: tempZip.path)) else {
|
||||
return
|
||||
}
|
||||
|
||||
tempSources.forEach(TempBox.shared.dispose)
|
||||
TempBox.shared.dispose(tempZip)
|
||||
tempSources.forEach(EngineTempBox.shared.dispose)
|
||||
EngineTempBox.shared.dispose(tempZip)
|
||||
|
||||
let id = Int64.random(in: Int64.min ... Int64.max)
|
||||
let fileResource = LocalFileMediaResource(fileId: id, size: Int64(gzippedData.count), isSecretRelated: false)
|
||||
context.engine.resources.storeResourceData(id: EngineMediaResource.Id(fileResource.id), data: gzippedData)
|
||||
|
||||
let file = TelegramMediaFile(fileId: MediaId(namespace: Namespaces.Media.LocalFile, id: id), partialReference: nil, resource: fileResource, previewRepresentations: [], videoThumbnails: [], immediateThumbnailData: nil, mimeType: "application/zip", size: Int64(gzippedData.count), attributes: [.FileName(fileName: "Log-iOS-All.txt.zip")], alternativeRepresentations: [])
|
||||
let file = TelegramMediaFile(fileId: EngineMedia.Id(namespace: Namespaces.Media.LocalFile, id: id), partialReference: nil, resource: fileResource, previewRepresentations: [], videoThumbnails: [], immediateThumbnailData: nil, mimeType: "application/zip", size: Int64(gzippedData.count), attributes: [.FileName(fileName: "Log-iOS-All.txt.zip")], alternativeRepresentations: [])
|
||||
let message: EnqueueMessage = .message(text: "", attributes: [], inlineStickers: [:], mediaReference: .standalone(media: file), threadId: nil, replyToMessageId: nil, replyToStoryId: nil, localGroupingKey: nil, correlationId: nil, bubbleUpEmojiOrStickersets: [])
|
||||
|
||||
let _ = enqueueMessages(account: context.account, peerId: peerId, messages: [message]).start()
|
||||
|
|
@ -915,7 +914,7 @@ private enum DebugControllerEntry: ItemListNodeEntry {
|
|||
let fileResource = LocalFileMediaResource(fileId: id, size: Int64(allStatsData.count), isSecretRelated: false)
|
||||
context.engine.resources.storeResourceData(id: EngineMediaResource.Id(fileResource.id), data: allStatsData)
|
||||
|
||||
let file = TelegramMediaFile(fileId: MediaId(namespace: Namespaces.Media.LocalFile, id: id), partialReference: nil, resource: fileResource, previewRepresentations: [], videoThumbnails: [], immediateThumbnailData: nil, mimeType: "application/zip", size: Int64(allStatsData.count), attributes: [.FileName(fileName: "StorageReport.txt")], alternativeRepresentations: [])
|
||||
let file = TelegramMediaFile(fileId: EngineMedia.Id(namespace: Namespaces.Media.LocalFile, id: id), partialReference: nil, resource: fileResource, previewRepresentations: [], videoThumbnails: [], immediateThumbnailData: nil, mimeType: "application/zip", size: Int64(allStatsData.count), attributes: [.FileName(fileName: "StorageReport.txt")], alternativeRepresentations: [])
|
||||
let message: EnqueueMessage = .message(text: "", attributes: [], inlineStickers: [:], mediaReference: .standalone(media: file), threadId: nil, replyToMessageId: nil, replyToStoryId: nil, localGroupingKey: nil, correlationId: nil, bubbleUpEmojiOrStickersets: [])
|
||||
|
||||
let _ = enqueueMessages(account: context.account, peerId: peerId, messages: [message]).start()
|
||||
|
|
@ -1244,7 +1243,7 @@ private enum DebugControllerEntry: ItemListNodeEntry {
|
|||
transaction.updateSharedData(ApplicationSpecificSharedDataKeys.experimentalUISettings, { settings in
|
||||
var settings = settings?.get(ExperimentalUISettings.self) ?? ExperimentalUISettings.defaultSettings
|
||||
settings.chatListPhotos = value
|
||||
return PreferencesEntry(settings)
|
||||
return EnginePreferencesEntry(settings)
|
||||
})
|
||||
}).start()
|
||||
})
|
||||
|
|
@ -1254,7 +1253,7 @@ private enum DebugControllerEntry: ItemListNodeEntry {
|
|||
transaction.updateSharedData(ApplicationSpecificSharedDataKeys.experimentalUISettings, { settings in
|
||||
var settings = settings?.get(ExperimentalUISettings.self) ?? ExperimentalUISettings.defaultSettings
|
||||
settings.knockoutWallpaper = value
|
||||
return PreferencesEntry(settings)
|
||||
return EnginePreferencesEntry(settings)
|
||||
})
|
||||
}).start()
|
||||
})
|
||||
|
|
@ -1264,7 +1263,7 @@ private enum DebugControllerEntry: ItemListNodeEntry {
|
|||
transaction.updateSharedData(ApplicationSpecificSharedDataKeys.experimentalUISettings, { settings in
|
||||
var settings = settings?.get(ExperimentalUISettings.self) ?? ExperimentalUISettings.defaultSettings
|
||||
settings.experimentalCompatibility = value
|
||||
return PreferencesEntry(settings)
|
||||
return EnginePreferencesEntry(settings)
|
||||
})
|
||||
}).start()
|
||||
})
|
||||
|
|
@ -1274,7 +1273,7 @@ private enum DebugControllerEntry: ItemListNodeEntry {
|
|||
transaction.updateSharedData(ApplicationSpecificSharedDataKeys.experimentalUISettings, { settings in
|
||||
var settings = settings?.get(ExperimentalUISettings.self) ?? ExperimentalUISettings.defaultSettings
|
||||
settings.enableDebugDataDisplay = value
|
||||
return PreferencesEntry(settings)
|
||||
return EnginePreferencesEntry(settings)
|
||||
})
|
||||
}).start()
|
||||
})
|
||||
|
|
@ -1284,7 +1283,7 @@ private enum DebugControllerEntry: ItemListNodeEntry {
|
|||
transaction.updateSharedData(ApplicationSpecificSharedDataKeys.experimentalUISettings, { settings in
|
||||
var settings = settings?.get(ExperimentalUISettings.self) ?? ExperimentalUISettings.defaultSettings
|
||||
settings.fakeGlass = value
|
||||
return PreferencesEntry(settings)
|
||||
return EnginePreferencesEntry(settings)
|
||||
})
|
||||
}).start()
|
||||
})
|
||||
|
|
@ -1294,7 +1293,7 @@ private enum DebugControllerEntry: ItemListNodeEntry {
|
|||
transaction.updateSharedData(ApplicationSpecificSharedDataKeys.experimentalUISettings, { settings in
|
||||
var settings = settings?.get(ExperimentalUISettings.self) ?? ExperimentalUISettings.defaultSettings
|
||||
settings.forceClearGlass = value
|
||||
return PreferencesEntry(settings)
|
||||
return EnginePreferencesEntry(settings)
|
||||
})
|
||||
}).start()
|
||||
})
|
||||
|
|
@ -1304,7 +1303,7 @@ private enum DebugControllerEntry: ItemListNodeEntry {
|
|||
transaction.updateSharedData(ApplicationSpecificSharedDataKeys.experimentalUISettings, { settings in
|
||||
var settings = settings?.get(ExperimentalUISettings.self) ?? ExperimentalUISettings.defaultSettings
|
||||
settings.debugRipple = value
|
||||
return PreferencesEntry(settings)
|
||||
return EnginePreferencesEntry(settings)
|
||||
})
|
||||
}).start()
|
||||
})
|
||||
|
|
@ -1314,7 +1313,7 @@ private enum DebugControllerEntry: ItemListNodeEntry {
|
|||
transaction.updateSharedData(ApplicationSpecificSharedDataKeys.experimentalUISettings, { settings in
|
||||
var settings = settings?.get(ExperimentalUISettings.self) ?? ExperimentalUISettings.defaultSettings
|
||||
settings.debugRichText = value
|
||||
return PreferencesEntry(settings)
|
||||
return EnginePreferencesEntry(settings)
|
||||
})
|
||||
}).start()
|
||||
})
|
||||
|
|
@ -1324,7 +1323,7 @@ private enum DebugControllerEntry: ItemListNodeEntry {
|
|||
transaction.updateSharedData(ApplicationSpecificSharedDataKeys.experimentalUISettings, { settings in
|
||||
var settings = settings?.get(ExperimentalUISettings.self) ?? ExperimentalUISettings.defaultSettings
|
||||
settings.browserExperiment = value
|
||||
return PreferencesEntry(settings)
|
||||
return EnginePreferencesEntry(settings)
|
||||
})
|
||||
}).start()
|
||||
})
|
||||
|
|
@ -1334,7 +1333,7 @@ private enum DebugControllerEntry: ItemListNodeEntry {
|
|||
transaction.updateSharedData(ApplicationSpecificSharedDataKeys.experimentalUISettings, { settings in
|
||||
var settings = settings?.get(ExperimentalUISettings.self) ?? ExperimentalUISettings.defaultSettings
|
||||
settings.allForumsHaveTabs = value
|
||||
return PreferencesEntry(settings)
|
||||
return EnginePreferencesEntry(settings)
|
||||
})
|
||||
}).start()
|
||||
})
|
||||
|
|
@ -1348,7 +1347,7 @@ private enum DebugControllerEntry: ItemListNodeEntry {
|
|||
settings.accountReactionEffectOverrides.removeAll()
|
||||
settings.accountStickerEffectOverrides.removeAll()
|
||||
}
|
||||
return PreferencesEntry(settings)
|
||||
return EnginePreferencesEntry(settings)
|
||||
})
|
||||
}).start()
|
||||
})
|
||||
|
|
@ -1358,7 +1357,7 @@ private enum DebugControllerEntry: ItemListNodeEntry {
|
|||
transaction.updateSharedData(ApplicationSpecificSharedDataKeys.experimentalUISettings, { settings in
|
||||
var settings = settings?.get(ExperimentalUISettings.self) ?? ExperimentalUISettings.defaultSettings
|
||||
settings.compressedEmojiCache = value
|
||||
return PreferencesEntry(settings)
|
||||
return EnginePreferencesEntry(settings)
|
||||
})
|
||||
}).start()
|
||||
})
|
||||
|
|
@ -1368,7 +1367,7 @@ private enum DebugControllerEntry: ItemListNodeEntry {
|
|||
transaction.updateSharedData(ApplicationSpecificSharedDataKeys.experimentalUISettings, { settings in
|
||||
var settings = settings?.get(ExperimentalUISettings.self) ?? ExperimentalUISettings.defaultSettings
|
||||
settings.storiesJpegExperiment = value
|
||||
return PreferencesEntry(settings)
|
||||
return EnginePreferencesEntry(settings)
|
||||
})
|
||||
}).start()
|
||||
})
|
||||
|
|
@ -1378,7 +1377,7 @@ private enum DebugControllerEntry: ItemListNodeEntry {
|
|||
transaction.updateSharedData(ApplicationSpecificSharedDataKeys.experimentalUISettings, { settings in
|
||||
var settings = settings?.get(ExperimentalUISettings.self) ?? ExperimentalUISettings.defaultSettings
|
||||
settings.checkSerializedData = value
|
||||
return PreferencesEntry(settings)
|
||||
return EnginePreferencesEntry(settings)
|
||||
})
|
||||
}).start()
|
||||
})
|
||||
|
|
@ -1388,7 +1387,7 @@ private enum DebugControllerEntry: ItemListNodeEntry {
|
|||
transaction.updateSharedData(ApplicationSpecificSharedDataKeys.experimentalUISettings, { settings in
|
||||
var settings = settings?.get(ExperimentalUISettings.self) ?? ExperimentalUISettings.defaultSettings
|
||||
settings.disableQuickReaction = !value
|
||||
return PreferencesEntry(settings)
|
||||
return EnginePreferencesEntry(settings)
|
||||
})
|
||||
}).start()
|
||||
})
|
||||
|
|
@ -1398,7 +1397,7 @@ private enum DebugControllerEntry: ItemListNodeEntry {
|
|||
transaction.updateSharedData(ApplicationSpecificSharedDataKeys.experimentalUISettings, { settings in
|
||||
var settings = settings?.get(ExperimentalUISettings.self) ?? ExperimentalUISettings.defaultSettings
|
||||
settings.liveStreamV2 = value
|
||||
return PreferencesEntry(settings)
|
||||
return EnginePreferencesEntry(settings)
|
||||
})
|
||||
}).start()
|
||||
})
|
||||
|
|
@ -1408,7 +1407,7 @@ private enum DebugControllerEntry: ItemListNodeEntry {
|
|||
transaction.updateSharedData(ApplicationSpecificSharedDataKeys.experimentalUISettings, { settings in
|
||||
var settings = settings?.get(ExperimentalUISettings.self) ?? ExperimentalUISettings.defaultSettings
|
||||
settings.experimentalCallMute = value
|
||||
return PreferencesEntry(settings)
|
||||
return EnginePreferencesEntry(settings)
|
||||
})
|
||||
}).start()
|
||||
})
|
||||
|
|
@ -1418,7 +1417,7 @@ private enum DebugControllerEntry: ItemListNodeEntry {
|
|||
transaction.updateSharedData(ApplicationSpecificSharedDataKeys.experimentalUISettings, { settings in
|
||||
var settings = settings?.get(ExperimentalUISettings.self) ?? ExperimentalUISettings.defaultSettings
|
||||
settings.playerV2 = value
|
||||
return PreferencesEntry(settings)
|
||||
return EnginePreferencesEntry(settings)
|
||||
})
|
||||
}).start()
|
||||
})
|
||||
|
|
@ -1428,7 +1427,7 @@ private enum DebugControllerEntry: ItemListNodeEntry {
|
|||
transaction.updateSharedData(ApplicationSpecificSharedDataKeys.experimentalUISettings, { settings in
|
||||
var settings = settings?.get(ExperimentalUISettings.self) ?? ExperimentalUISettings.defaultSettings
|
||||
settings.devRequests = value
|
||||
return PreferencesEntry(settings)
|
||||
return EnginePreferencesEntry(settings)
|
||||
})
|
||||
}).start()
|
||||
})
|
||||
|
|
@ -1438,7 +1437,7 @@ private enum DebugControllerEntry: ItemListNodeEntry {
|
|||
transaction.updateSharedData(ApplicationSpecificSharedDataKeys.experimentalUISettings, { settings in
|
||||
var settings = settings?.get(ExperimentalUISettings.self) ?? ExperimentalUISettings.defaultSettings
|
||||
settings.enableUpdates = value
|
||||
return PreferencesEntry(settings)
|
||||
return EnginePreferencesEntry(settings)
|
||||
})
|
||||
}).start()
|
||||
})
|
||||
|
|
@ -1448,7 +1447,7 @@ private enum DebugControllerEntry: ItemListNodeEntry {
|
|||
transaction.updateSharedData(ApplicationSpecificSharedDataKeys.experimentalUISettings, { settings in
|
||||
var settings = settings?.get(ExperimentalUISettings.self) ?? ExperimentalUISettings.defaultSettings
|
||||
settings.enablePWA = value
|
||||
return PreferencesEntry(settings)
|
||||
return EnginePreferencesEntry(settings)
|
||||
})
|
||||
}).start()
|
||||
})
|
||||
|
|
@ -1458,7 +1457,7 @@ private enum DebugControllerEntry: ItemListNodeEntry {
|
|||
transaction.updateSharedData(ApplicationSpecificSharedDataKeys.experimentalUISettings, { settings in
|
||||
var settings = settings?.get(ExperimentalUISettings.self) ?? ExperimentalUISettings.defaultSettings
|
||||
settings.enableLocalTranslation = value
|
||||
return PreferencesEntry(settings)
|
||||
return EnginePreferencesEntry(settings)
|
||||
})
|
||||
}).start()
|
||||
})
|
||||
|
|
@ -1468,7 +1467,7 @@ private enum DebugControllerEntry: ItemListNodeEntry {
|
|||
transaction.updateSharedData(ApplicationSpecificSharedDataKeys.experimentalUISettings, { settings in
|
||||
var settings = settings?.get(ExperimentalUISettings.self) ?? ExperimentalUISettings.defaultSettings
|
||||
settings.preferredVideoCodec = value
|
||||
return PreferencesEntry(settings)
|
||||
return EnginePreferencesEntry(settings)
|
||||
})
|
||||
}).start()
|
||||
})
|
||||
|
|
@ -1478,7 +1477,7 @@ private enum DebugControllerEntry: ItemListNodeEntry {
|
|||
transaction.updateSharedData(ApplicationSpecificSharedDataKeys.experimentalUISettings, { settings in
|
||||
var settings = settings?.get(ExperimentalUISettings.self) ?? ExperimentalUISettings.defaultSettings
|
||||
settings.disableVideoAspectScaling = !value
|
||||
return PreferencesEntry(settings)
|
||||
return EnginePreferencesEntry(settings)
|
||||
})
|
||||
}).start()
|
||||
})
|
||||
|
|
@ -1681,7 +1680,7 @@ public func debugController(sharedContext: SharedAccountContext, context: Accoun
|
|||
hasLegacyAppData = FileManager.default.fileExists(atPath: statusPath)
|
||||
}
|
||||
|
||||
let preferencesSignal: Signal<PreferencesEntry?, NoError>
|
||||
let preferencesSignal: Signal<EnginePreferencesEntry?, NoError>
|
||||
if let context = context {
|
||||
preferencesSignal = context.engine.data.subscribe(TelegramEngine.EngineData.Item.Configuration.ApplicationSpecificPreference(key: PreferencesKeys.networkSettings))
|
||||
} else {
|
||||
|
|
@ -1776,8 +1775,8 @@ public func triggerDebugSendLogsUI(context: AccountContext, additionalInfo: Stri
|
|||
rawLogData.append("\(additionalInfo)".data(using: .utf8)!)
|
||||
}
|
||||
|
||||
let tempSource = TempBox.shared.tempFile(fileName: "Log.txt")
|
||||
let tempZip = TempBox.shared.tempFile(fileName: "destination.zip")
|
||||
let tempSource = EngineTempBox.shared.tempFile(fileName: "Log.txt")
|
||||
let tempZip = EngineTempBox.shared.tempFile(fileName: "destination.zip")
|
||||
|
||||
let _ = try? rawLogData.write(to: URL(fileURLWithPath: tempSource.path))
|
||||
|
||||
|
|
@ -1787,14 +1786,14 @@ public func triggerDebugSendLogsUI(context: AccountContext, additionalInfo: Stri
|
|||
return
|
||||
}
|
||||
|
||||
TempBox.shared.dispose(tempSource)
|
||||
TempBox.shared.dispose(tempZip)
|
||||
EngineTempBox.shared.dispose(tempSource)
|
||||
EngineTempBox.shared.dispose(tempZip)
|
||||
|
||||
let id = Int64.random(in: Int64.min ... Int64.max)
|
||||
let fileResource = LocalFileMediaResource(fileId: id, size: Int64(gzippedData.count), isSecretRelated: false)
|
||||
context.engine.resources.storeResourceData(id: EngineMediaResource.Id(fileResource.id), data: gzippedData)
|
||||
|
||||
let file = TelegramMediaFile(fileId: MediaId(namespace: Namespaces.Media.LocalFile, id: id), partialReference: nil, resource: fileResource, previewRepresentations: [], videoThumbnails: [], immediateThumbnailData: nil, mimeType: "application/text", size: Int64(gzippedData.count), attributes: [.FileName(fileName: "Log-iOS-Full.txt.zip")], alternativeRepresentations: [])
|
||||
let file = TelegramMediaFile(fileId: EngineMedia.Id(namespace: Namespaces.Media.LocalFile, id: id), partialReference: nil, resource: fileResource, previewRepresentations: [], videoThumbnails: [], immediateThumbnailData: nil, mimeType: "application/text", size: Int64(gzippedData.count), attributes: [.FileName(fileName: "Log-iOS-Full.txt.zip")], alternativeRepresentations: [])
|
||||
let message: EnqueueMessage = .message(text: "", attributes: [], inlineStickers: [:], mediaReference: .standalone(media: file), threadId: nil, replyToMessageId: nil, replyToStoryId: nil, localGroupingKey: nil, correlationId: nil, bubbleUpEmojiOrStickersets: [])
|
||||
|
||||
let _ = enqueueMessages(account: context.account, peerId: peerId, messages: [message]).start()
|
||||
|
|
|
|||
|
|
@ -231,7 +231,7 @@ public func chatMessageGalleryControllerData(
|
|||
}
|
||||
}
|
||||
|
||||
let gallery = InstantPageGalleryController(context: context, userLocation: chatLocation?.peerId.flatMap(MediaResourceUserLocation.peer) ?? .other, webPage: webPage, message: message, entries: instantPageMedia, centralIndex: centralIndex, fromPlayingVideo: autoplayingVideo, landscape: landscape, timecode: timecode, replaceRootController: { [weak navigationController] controller, ready in
|
||||
let gallery = InstantPageGalleryController(context: context, userLocation: chatLocation?.peerId.flatMap(MediaResourceUserLocation.peer) ?? .other, webPage: webPage, message: EngineMessage(message), entries: instantPageMedia, centralIndex: centralIndex, fromPlayingVideo: autoplayingVideo, landscape: landscape, timecode: timecode, replaceRootController: { [weak navigationController] controller, ready in
|
||||
if let navigationController = navigationController {
|
||||
navigationController.replaceTopController(controller, animated: false, ready: ready)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@ import UIKit
|
|||
import AsyncDisplayKit
|
||||
import SwiftSignalKit
|
||||
import TelegramCore
|
||||
import Postbox
|
||||
import Display
|
||||
import UniversalMediaPlayer
|
||||
import TelegramPresentationData
|
||||
|
|
@ -304,7 +303,7 @@ final class ChatVideoGalleryItemScrubberView: UIView {
|
|||
self.scrubberNode.bufferingStatus = status
|
||||
}
|
||||
|
||||
func setFetchStatusSignal(_ fetchStatus: Signal<MediaResourceStatus, NoError>?, strings: PresentationStrings, decimalSeparator: String, fileSize: Int64?) {
|
||||
func setFetchStatusSignal(_ fetchStatus: Signal<EngineMediaResource.FetchStatus, NoError>?, strings: PresentationStrings, decimalSeparator: String, fileSize: Int64?) {
|
||||
let formatting = DataSizeStringFormatting(strings: strings, decimalSeparator: decimalSeparator)
|
||||
if let fileSize = fileSize {
|
||||
if let fetchStatus = fetchStatus {
|
||||
|
|
|
|||
|
|
@ -1651,10 +1651,10 @@ final class UniversalVideoGalleryItemNode: ZoomableContentGalleryItemNode {
|
|||
}
|
||||
let status = messageMediaFileStatus(context: item.context, messageId: message.id, file: file)
|
||||
if !isWebpage && message.adAttribute == nil && !NativeVideoContent.isHLSVideo(file: file) {
|
||||
scrubberView.setFetchStatusSignal(status, strings: self.presentationData.strings, decimalSeparator: self.presentationData.dateTimeFormat.decimalSeparator, fileSize: file.size)
|
||||
scrubberView.setFetchStatusSignal(status |> map(EngineMediaResource.FetchStatus.init), strings: self.presentationData.strings, decimalSeparator: self.presentationData.dateTimeFormat.decimalSeparator, fileSize: file.size)
|
||||
}
|
||||
|
||||
self.requiresDownload = !isMediaStreamable(message: message, media: file)
|
||||
self.requiresDownload = !isMediaStreamable(message: EngineMessage(message), media: file)
|
||||
mediaFileStatus = status |> map(Optional.init)
|
||||
self.fetchControls = FetchControls(fetch: { [weak self] in
|
||||
if let strongSelf = self {
|
||||
|
|
@ -2150,7 +2150,7 @@ final class UniversalVideoGalleryItemNode: ZoomableContentGalleryItemNode {
|
|||
}
|
||||
var isStreamable = false
|
||||
if let contentInfo = item.contentInfo, case let .message(message, _) = contentInfo {
|
||||
isStreamable = isMediaStreamable(message: message, media: content.fileReference.media)
|
||||
isStreamable = isMediaStreamable(message: EngineMessage(message), media: content.fileReference.media)
|
||||
} else {
|
||||
isStreamable = isMediaStreamable(media: content.fileReference.media)
|
||||
}
|
||||
|
|
@ -3053,7 +3053,7 @@ final class UniversalVideoGalleryItemNode: ZoomableContentGalleryItemNode {
|
|||
}
|
||||
overlayNode.canAttachContent = false
|
||||
})
|
||||
} else if let info = context.sharedContext.mediaManager.galleryHiddenMediaManager.findTarget(messageId: id, media: media) {
|
||||
} else if let info = context.sharedContext.mediaManager.galleryHiddenMediaManager.findTarget(messageId: id, media: EngineMedia(media)) {
|
||||
return GalleryTransitionArguments(transitionNode: (info.1, info.1.bounds, {
|
||||
return info.2()
|
||||
}), addToTransitionSurface: info.0)
|
||||
|
|
|
|||
|
|
@ -11,7 +11,6 @@ swift_library(
|
|||
],
|
||||
deps = [
|
||||
"//submodules/TelegramCore:TelegramCore",
|
||||
"//submodules/Postbox:Postbox",
|
||||
"//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit",
|
||||
"//submodules/TelegramUIPreferences:TelegramUIPreferences",
|
||||
"//submodules/PersistentStringHash:PersistentStringHash",
|
||||
|
|
|
|||
|
|
@ -2,40 +2,39 @@ import Foundation
|
|||
import UIKit
|
||||
import SwiftSignalKit
|
||||
import TelegramCore
|
||||
import Postbox
|
||||
import TelegramUIPreferences
|
||||
import PersistentStringHash
|
||||
|
||||
public final class CachedInstantPage: Codable {
|
||||
public let webPage: TelegramMediaWebpage
|
||||
public let timestamp: Int32
|
||||
|
||||
|
||||
public init(webPage: TelegramMediaWebpage, timestamp: Int32) {
|
||||
self.webPage = webPage
|
||||
self.timestamp = timestamp
|
||||
}
|
||||
|
||||
|
||||
public init(from decoder: Decoder) throws {
|
||||
let container = try decoder.container(keyedBy: StringCodingKey.self)
|
||||
|
||||
let webPageData = try container.decode(AdaptedPostboxDecoder.RawObjectData.self, forKey: "webpage")
|
||||
self.webPage = TelegramMediaWebpage(decoder: PostboxDecoder(buffer: MemoryBuffer(data: webPageData.data)))
|
||||
let webPageData = try container.decode(EngineAdaptedPostboxDecoder.RawObjectData.self, forKey: "webpage")
|
||||
self.webPage = TelegramMediaWebpage(decoder: EnginePostboxDecoder(buffer: EngineMemoryBuffer(data: webPageData.data)))
|
||||
|
||||
self.timestamp = try container.decode(Int32.self, forKey: "timestamp")
|
||||
}
|
||||
|
||||
|
||||
public func encode(to encoder: Encoder) throws {
|
||||
var container = encoder.container(keyedBy: StringCodingKey.self)
|
||||
|
||||
try container.encode(PostboxEncoder().encodeObjectToRawData(self.webPage), forKey: "webpage")
|
||||
try container.encode(EnginePostboxEncoder().encodeObjectToRawData(self.webPage), forKey: "webpage")
|
||||
try container.encode(self.timestamp, forKey: "timestamp")
|
||||
}
|
||||
}
|
||||
|
||||
public func cachedInstantPage(engine: TelegramEngine, url: String) -> Signal<CachedInstantPage?, NoError> {
|
||||
let key = ValueBoxKey(length: 8)
|
||||
let key = EngineDataBuffer(length: 8)
|
||||
key.setInt64(0, value: Int64(bitPattern: url.persistentHashValue))
|
||||
|
||||
|
||||
return engine.data.get(TelegramEngine.EngineData.Item.ItemCache.Item(collectionId: ApplicationSpecificItemCacheCollectionId.cachedInstantPages, id: key))
|
||||
|> map { entry -> CachedInstantPage? in
|
||||
return entry?.get(CachedInstantPage.self)
|
||||
|
|
@ -43,7 +42,7 @@ public func cachedInstantPage(engine: TelegramEngine, url: String) -> Signal<Cac
|
|||
}
|
||||
|
||||
public func updateCachedInstantPage(engine: TelegramEngine, url: String, webPage: TelegramMediaWebpage?) -> Signal<Never, NoError> {
|
||||
let key = ValueBoxKey(length: 8)
|
||||
let key = EngineDataBuffer(length: 8)
|
||||
key.setInt64(0, value: Int64(bitPattern: url.persistentHashValue))
|
||||
|
||||
if let webPage = webPage {
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ import TelegramPresentationData
|
|||
import TelegramUIPreferences
|
||||
import AccountContext
|
||||
|
||||
public func instantPageAndAnchor(message: Message) -> (TelegramMediaWebpage, String?)? {
|
||||
public func instantPageAndAnchor(message: EngineMessage) -> (TelegramMediaWebpage, String?)? {
|
||||
for media in message.media {
|
||||
if let webpage = media as? TelegramMediaWebpage, case let .Loaded(content) = webpage.content {
|
||||
if let _ = content.instantPage {
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@ import Foundation
|
|||
import UIKit
|
||||
import Display
|
||||
import QuickLook
|
||||
import Postbox
|
||||
import SwiftSignalKit
|
||||
import AsyncDisplayKit
|
||||
import TelegramCore
|
||||
|
|
@ -29,13 +28,13 @@ public struct InstantPageGalleryEntryLocation: Equatable {
|
|||
|
||||
public struct InstantPageGalleryEntry: Equatable {
|
||||
public let index: Int32
|
||||
public let pageId: MediaId
|
||||
public let pageId: EngineMedia.Id
|
||||
public let media: InstantPageMedia
|
||||
public let caption: RichText?
|
||||
public let credit: RichText?
|
||||
public let location: InstantPageGalleryEntryLocation?
|
||||
|
||||
public init(index: Int32, pageId: MediaId, media: InstantPageMedia, caption: RichText?, credit: RichText?, location: InstantPageGalleryEntryLocation?) {
|
||||
public init(index: Int32, pageId: EngineMedia.Id, media: InstantPageMedia, caption: RichText?, credit: RichText?, location: InstantPageGalleryEntryLocation?) {
|
||||
self.index = index
|
||||
self.pageId = pageId
|
||||
self.media = media
|
||||
|
|
@ -48,7 +47,7 @@ public struct InstantPageGalleryEntry: Equatable {
|
|||
return lhs.index == rhs.index && lhs.pageId == rhs.pageId && lhs.media == rhs.media && lhs.caption == rhs.caption && lhs.credit == rhs.credit && lhs.location == rhs.location
|
||||
}
|
||||
|
||||
func item(context: AccountContext, userLocation: MediaResourceUserLocation, webPage: TelegramMediaWebpage, message: Message?, presentationData: PresentationData, fromPlayingVideo: Bool, landscape: Bool, openUrl: @escaping (InstantPageUrlItem) -> Void, openUrlOptions: @escaping (InstantPageUrlItem) -> Void, getPreloadedResource: @escaping (String) -> Data?) -> GalleryItem {
|
||||
func item(context: AccountContext, userLocation: MediaResourceUserLocation, webPage: TelegramMediaWebpage, message: EngineMessage?, presentationData: PresentationData, fromPlayingVideo: Bool, landscape: Bool, openUrl: @escaping (InstantPageUrlItem) -> Void, openUrlOptions: @escaping (InstantPageUrlItem) -> Void, getPreloadedResource: @escaping (String) -> Data?) -> GalleryItem {
|
||||
let caption: NSAttributedString
|
||||
let credit: NSAttributedString
|
||||
|
||||
|
|
@ -119,7 +118,7 @@ public struct InstantPageGalleryEntry: Equatable {
|
|||
if let dimensions = file.dimensions {
|
||||
representations.append(TelegramMediaImageRepresentation(dimensions: dimensions, resource: file.resource, progressiveSizes: [], immediateThumbnailData: nil, hasVideo: false, isPersonal: false))
|
||||
}
|
||||
let image = TelegramMediaImage(imageId: MediaId(namespace: 0, id: 0), representations: representations, immediateThumbnailData: file.immediateThumbnailData, reference: nil, partialReference: nil, flags: [])
|
||||
let image = TelegramMediaImage(imageId: EngineMedia.Id(namespace: 0, id: 0), representations: representations, immediateThumbnailData: file.immediateThumbnailData, reference: nil, partialReference: nil, flags: [])
|
||||
return InstantImageGalleryItem(context: context, presentationData: presentationData, itemId: self.index, userLocation: userLocation, imageReference: .webPage(webPage: WebpageReference(webPage), media: image), caption: caption, credit: credit, location: self.location, openUrl: openUrl, openUrlOptions: openUrlOptions, getPreloadedResource: getPreloadedResource)
|
||||
}
|
||||
} else if case let .webpage(embedWebpage) = self.media.media, case let .Loaded(webpageContent) = embedWebpage.content {
|
||||
|
|
@ -166,7 +165,7 @@ public class InstantPageGalleryController: ViewController, StandalonePresentable
|
|||
private let context: AccountContext
|
||||
private let userLocation: MediaResourceUserLocation
|
||||
private let webPage: TelegramMediaWebpage
|
||||
private let message: Message?
|
||||
private let message: EngineMessage?
|
||||
private var presentationData: PresentationData
|
||||
|
||||
private let _ready = Promise<Bool>()
|
||||
|
|
@ -203,7 +202,7 @@ public class InstantPageGalleryController: ViewController, StandalonePresentable
|
|||
private var openUrlOptions: (InstantPageUrlItem) -> Void
|
||||
private let getPreloadedResource: (String) -> Data?
|
||||
|
||||
public init(context: AccountContext, userLocation: MediaResourceUserLocation, webPage: TelegramMediaWebpage, message: Message? = nil, entries: [InstantPageGalleryEntry], centralIndex: Int, fromPlayingVideo: Bool = false, landscape: Bool = false, timecode: Double? = nil, replaceRootController: @escaping (ViewController, Promise<Bool>?) -> Void, baseNavigationController: NavigationController?, getPreloadedResource: @escaping (String) -> Data? = { _ in return nil }) {
|
||||
public init(context: AccountContext, userLocation: MediaResourceUserLocation, webPage: TelegramMediaWebpage, message: EngineMessage? = nil, entries: [InstantPageGalleryEntry], centralIndex: Int, fromPlayingVideo: Bool = false, landscape: Bool = false, timecode: Double? = nil, replaceRootController: @escaping (ViewController, Promise<Bool>?) -> Void, baseNavigationController: NavigationController?, getPreloadedResource: @escaping (String) -> Data? = { _ in return nil }) {
|
||||
self.context = context
|
||||
self.userLocation = userLocation
|
||||
self.webPage = webPage
|
||||
|
|
|
|||
|
|
@ -14,7 +14,6 @@ swift_library(
|
|||
"//submodules/AsyncDisplayKit:AsyncDisplayKit",
|
||||
"//submodules/Display:Display",
|
||||
"//submodules/TelegramCore:TelegramCore",
|
||||
"//submodules/Postbox:Postbox",
|
||||
"//submodules/AvatarNode:AvatarNode",
|
||||
"//submodules/TelegramPresentationData:TelegramPresentationData",
|
||||
"//submodules/TelegramStringFormatting:TelegramStringFormatting",
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@ import Display
|
|||
import AsyncDisplayKit
|
||||
import SwiftSignalKit
|
||||
import TelegramCore
|
||||
import Postbox
|
||||
import TelegramPresentationData
|
||||
import TelegramUIPreferences
|
||||
import ItemListUI
|
||||
|
|
@ -467,7 +466,7 @@ public final class ItemListPeerItem: ListViewItem, ItemListItem {
|
|||
let displayDecorations: Bool
|
||||
let displayBackground: Bool
|
||||
let disableInteractiveTransitionIfNecessary: Bool
|
||||
let storyStats: PeerStoryStats?
|
||||
let storyStats: EnginePeerStoryStats?
|
||||
let openStories: ((UIView) -> Void)?
|
||||
|
||||
public init(
|
||||
|
|
@ -511,7 +510,7 @@ public final class ItemListPeerItem: ListViewItem, ItemListItem {
|
|||
displayDecorations: Bool = true,
|
||||
displayBackground: Bool = true,
|
||||
disableInteractiveTransitionIfNecessary: Bool = false,
|
||||
storyStats: PeerStoryStats? = nil,
|
||||
storyStats: EnginePeerStoryStats? = nil,
|
||||
openStories: ((UIView) -> Void)? = nil
|
||||
) {
|
||||
self.presentationData = presentationData
|
||||
|
|
@ -599,7 +598,7 @@ public final class ItemListPeerItem: ListViewItem, ItemListItem {
|
|||
displayDecorations: Bool = true,
|
||||
displayBackground: Bool = true,
|
||||
disableInteractiveTransitionIfNecessary: Bool = false,
|
||||
storyStats: PeerStoryStats? = nil,
|
||||
storyStats: EnginePeerStoryStats? = nil,
|
||||
openStories: ((UIView) -> Void)? = nil
|
||||
) {
|
||||
self.presentationData = presentationData
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@ import UIKit
|
|||
import LegacyComponents
|
||||
import Display
|
||||
import SwiftSignalKit
|
||||
import Postbox
|
||||
import TelegramCore
|
||||
import TelegramPresentationData
|
||||
import DeviceAccess
|
||||
|
|
@ -159,7 +158,7 @@ public func legacyStoryMediaEditor(context: AccountContext, item: TGMediaEditabl
|
|||
|
||||
public func legacyMediaEditor(
|
||||
context: AccountContext,
|
||||
peer: Peer,
|
||||
peer: EnginePeer,
|
||||
threadTitle: String?,
|
||||
media: AnyMediaReference,
|
||||
mode: LegacyMediaEditorMode,
|
||||
|
|
@ -201,7 +200,7 @@ public func legacyMediaEditor(
|
|||
if peer.id == context.account.peerId {
|
||||
recipientName = presentationData.strings.DialogList_SavedMessages
|
||||
} else {
|
||||
recipientName = EnginePeer(peer).displayTitle(strings: presentationData.strings, displayOrder: presentationData.nameDisplayOrder)
|
||||
recipientName = peer.displayTitle(strings: presentationData.strings, displayOrder: presentationData.nameDisplayOrder)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -299,7 +298,7 @@ public func legacyMediaEditor(
|
|||
|
||||
public func legacyAttachmentMenu(
|
||||
context: AccountContext,
|
||||
peer: Peer?,
|
||||
peer: EnginePeer?,
|
||||
threadTitle: String?,
|
||||
chatLocation: ChatLocation,
|
||||
editMediaOptions: LegacyAttachmentMenuMediaEditing?,
|
||||
|
|
@ -310,7 +309,7 @@ public func legacyAttachmentMenu(
|
|||
canSendPolls: Bool,
|
||||
updatedPresentationData: (initial: PresentationData, signal: Signal<PresentationData, NoError>),
|
||||
parentController: LegacyController,
|
||||
recentlyUsedInlineBots: [Peer],
|
||||
recentlyUsedInlineBots: [EnginePeer],
|
||||
initialCaption: NSAttributedString,
|
||||
openGallery: @escaping () -> Void,
|
||||
openCamera: @escaping (TGAttachmentCameraView?, TGMenuSheetController?) -> Void,
|
||||
|
|
@ -325,7 +324,7 @@ public func legacyAttachmentMenu(
|
|||
presentSchedulePicker: @escaping (Bool, @escaping (Int32, Bool) -> Void) -> Void,
|
||||
presentTimerPicker: @escaping (@escaping (Int32) -> Void) -> Void,
|
||||
sendMessagesWithSignals: @escaping ([Any]?, Bool, Int32, ((String) -> UIView?)?, @escaping () -> Void) -> Void,
|
||||
selectRecentlyUsedInlineBot: @escaping (Peer) -> Void,
|
||||
selectRecentlyUsedInlineBot: @escaping (EnginePeer) -> Void,
|
||||
getCaptionPanelView: @escaping () -> TGCaptionPanelView?,
|
||||
present: @escaping (ViewController, Any?) -> Void
|
||||
) -> TGMenuSheetController {
|
||||
|
|
@ -340,7 +339,7 @@ public func legacyAttachmentMenu(
|
|||
if peer.id == context.account.peerId {
|
||||
recipientName = presentationData.strings.DialogList_SavedMessages
|
||||
} else {
|
||||
recipientName = EnginePeer(peer).displayTitle(strings: presentationData.strings, displayOrder: presentationData.nameDisplayOrder)
|
||||
recipientName = peer.displayTitle(strings: presentationData.strings, displayOrder: presentationData.nameDisplayOrder)
|
||||
}
|
||||
} else {
|
||||
recipientName = ""
|
||||
|
|
@ -384,7 +383,7 @@ public func legacyAttachmentMenu(
|
|||
|
||||
var selectionLimit: Int32 = 100
|
||||
var slowModeEnabled = false
|
||||
if let channel = peer as? TelegramChannel, channel.isRestrictedBySlowmode {
|
||||
if case let .channel(channel) = peer, channel.isRestrictedBySlowmode {
|
||||
slowModeEnabled = true
|
||||
selectionLimit = 10
|
||||
}
|
||||
|
|
@ -423,7 +422,7 @@ public func legacyAttachmentMenu(
|
|||
presentSelectionLimitExceeded()
|
||||
}
|
||||
if let peer, peer.id != context.account.peerId {
|
||||
if peer is TelegramUser {
|
||||
if case .user = peer {
|
||||
carouselItem.hasTimer = hasSchedule
|
||||
}
|
||||
carouselItem.hasSilentPosting = true
|
||||
|
|
@ -573,7 +572,7 @@ public func legacyAttachmentMenu(
|
|||
|
||||
let recipientName: String
|
||||
if let peer {
|
||||
recipientName = EnginePeer(peer).displayTitle(strings: presentationData.strings, displayOrder: presentationData.nameDisplayOrder)
|
||||
recipientName = peer.displayTitle(strings: presentationData.strings, displayOrder: presentationData.nameDisplayOrder)
|
||||
} else {
|
||||
recipientName = ""
|
||||
}
|
||||
|
|
@ -615,13 +614,16 @@ public func legacyAttachmentMenu(
|
|||
|
||||
var peerSupportsPolls = false
|
||||
if let peer {
|
||||
if peer is TelegramGroup || peer is TelegramChannel {
|
||||
switch peer {
|
||||
case .legacyGroup, .channel:
|
||||
peerSupportsPolls = true
|
||||
} else if let user = peer as? TelegramUser, let _ = user.botInfo {
|
||||
case let .user(user) where user.botInfo != nil:
|
||||
peerSupportsPolls = true
|
||||
default:
|
||||
break
|
||||
}
|
||||
}
|
||||
if let peer, peerSupportsPolls, canSendMessagesToPeer(EnginePeer(peer)) && canSendPolls {
|
||||
if let peer, peerSupportsPolls, canSendMessagesToPeer(peer) && canSendPolls {
|
||||
let pollItem = TGMenuSheetButtonItemView(title: presentationData.strings.AttachmentMenu_Poll, type: TGMenuSheetButtonTypeDefault, fontSize: fontSize, action: { [weak controller] in
|
||||
controller?.dismiss(animated: true)
|
||||
openPoll()
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@ import AsyncDisplayKit
|
|||
import Display
|
||||
import TelegramCore
|
||||
import SwiftSignalKit
|
||||
import Postbox
|
||||
|
||||
final class ListMessageHoleItem: ListViewItem {
|
||||
public init() {
|
||||
|
|
@ -103,7 +102,7 @@ final class ListMessageHoleItemNode: ListViewItemNode {
|
|||
}
|
||||
}
|
||||
|
||||
func transitionNode(id: MessageId, media: Media) -> ASDisplayNode? {
|
||||
func transitionNode(id: EngineMessage.Id, media: EngineMedia) -> ASDisplayNode? {
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
import Foundation
|
||||
import UIKit
|
||||
import Photos
|
||||
import Postbox
|
||||
import SwiftSignalKit
|
||||
import TelegramCore
|
||||
import ImageCompression
|
||||
import Accelerate.vImage
|
||||
import CoreImage
|
||||
|
|
@ -104,7 +104,7 @@ extension UIImage.Orientation {
|
|||
|
||||
private let fetchPhotoWorkers = ThreadPool(threadCount: 3, threadPriority: 0.2)
|
||||
|
||||
public func fetchPhotoLibraryResource(localIdentifier: String, width: Int32?, height: Int32?, format: MediaImageFormat?, quality: Int32?, hd: Bool, useExif: Bool) -> Signal<MediaResourceDataFetchResult, MediaResourceDataFetchError> {
|
||||
public func fetchPhotoLibraryResource(localIdentifier: String, width: Int32?, height: Int32?, format: MediaImageFormat?, quality: Int32?, hd: Bool, useExif: Bool) -> Signal<EngineMediaResourceDataFetchResult, EngineMediaResourceDataFetchError> {
|
||||
return Signal { subscriber in
|
||||
let queue = ThreadPoolQueue(threadPool: fetchPhotoWorkers)
|
||||
|
||||
|
|
@ -178,9 +178,9 @@ public func fetchPhotoLibraryResource(localIdentifier: String, width: Int32?, he
|
|||
|
||||
switch format {
|
||||
case .none, .jpeg:
|
||||
let tempFile = TempBox.shared.tempFile(fileName: "file")
|
||||
let tempFile = EngineTempBox.shared.tempFile(fileName: "file")
|
||||
defer {
|
||||
TempBox.shared.dispose(tempFile)
|
||||
EngineTempBox.shared.dispose(tempFile)
|
||||
}
|
||||
if let scaledImage = scaledImage, let data = compressImageToJPEG(scaledImage, quality: 0.6, tempFilePath: tempFile.path) {
|
||||
#if DEBUG
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@ import Display
|
|||
import TelegramCore
|
||||
import SwiftSignalKit
|
||||
import AsyncDisplayKit
|
||||
import Postbox
|
||||
import AccountContext
|
||||
import TelegramPresentationData
|
||||
import TelegramStringFormatting
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@ import Foundation
|
|||
import UIKit
|
||||
import Display
|
||||
import AsyncDisplayKit
|
||||
import Postbox
|
||||
import TelegramCore
|
||||
import SwiftSignalKit
|
||||
import AccountContext
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
import Foundation
|
||||
import UIKit
|
||||
import SwiftSignalKit
|
||||
import Postbox
|
||||
|
||||
public final class CachedStickerAJpegRepresentation: CachedMediaResourceRepresentation {
|
||||
public let size: CGSize?
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@ import UIKit
|
|||
import SwiftSignalKit
|
||||
import TelegramCore
|
||||
import TelegramUIPreferences
|
||||
import Postbox
|
||||
|
||||
public final class MediaPlaybackStoredState: Codable {
|
||||
public let timestamp: Double
|
||||
|
|
@ -47,7 +46,7 @@ public func mediaPlaybackStoredState(engine: TelegramEngine, messageId: EngineMe
|
|||
public func updateMediaPlaybackStoredStateInteractively(engine: TelegramEngine, messageId: EngineMessage.Id, state: MediaPlaybackStoredState?) -> Signal<Never, NoError> {
|
||||
return engine.messages.updateLocallyDerivedData(messageId: messageId, update: { data in
|
||||
var data = data
|
||||
if let state, let entry = CodableEntry(state) {
|
||||
if let state, let entry = EngineCodableEntry(state) {
|
||||
data["mps"] = entry
|
||||
} else {
|
||||
data.removeValue(forKey: "mps")
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@ import UIKit
|
|||
import AsyncDisplayKit
|
||||
import UIKit
|
||||
import Display
|
||||
import Postbox
|
||||
import TelegramCore
|
||||
import TelegramPresentationData
|
||||
import TelegramUIPreferences
|
||||
|
|
@ -12,12 +11,12 @@ import AccountContext
|
|||
|
||||
final class ChannelDiscussionGroupActionSheetItem: ActionSheetItem {
|
||||
let context: AccountContext
|
||||
let channelPeer: Peer
|
||||
let groupPeer: Peer
|
||||
let channelPeer: EnginePeer
|
||||
let groupPeer: EnginePeer
|
||||
let strings: PresentationStrings
|
||||
let nameDisplayOrder: PresentationPersonNameOrder
|
||||
|
||||
init(context: AccountContext, channelPeer: Peer, groupPeer: Peer, strings: PresentationStrings, nameDisplayOrder: PresentationPersonNameOrder) {
|
||||
|
||||
init(context: AccountContext, channelPeer: EnginePeer, groupPeer: EnginePeer, strings: PresentationStrings, nameDisplayOrder: PresentationPersonNameOrder) {
|
||||
self.context = context
|
||||
self.channelPeer = channelPeer
|
||||
self.groupPeer = groupPeer
|
||||
|
|
@ -43,7 +42,7 @@ private final class ChannelDiscussionGroupActionSheetItemNode: ActionSheetItemNo
|
|||
private let groupAvatarNode: AvatarNode
|
||||
private let textNode: ImmediateTextNode
|
||||
|
||||
init(theme: ActionSheetControllerTheme, context: AccountContext, channelPeer: Peer, groupPeer: Peer, strings: PresentationStrings, nameDisplayOrder: PresentationPersonNameOrder) {
|
||||
init(theme: ActionSheetControllerTheme, context: AccountContext, channelPeer: EnginePeer, groupPeer: EnginePeer, strings: PresentationStrings, nameDisplayOrder: PresentationPersonNameOrder) {
|
||||
self.theme = theme
|
||||
|
||||
self.channelAvatarNode = AvatarNode(font: avatarFont)
|
||||
|
|
@ -65,14 +64,14 @@ private final class ChannelDiscussionGroupActionSheetItemNode: ActionSheetItemNo
|
|||
self.addSubnode(self.channelAvatarNode)
|
||||
self.addSubnode(self.textNode)
|
||||
|
||||
self.channelAvatarNode.setPeer(context: context, theme: (context.sharedContext.currentPresentationData.with { $0 }).theme, peer: EnginePeer(channelPeer))
|
||||
self.groupAvatarNode.setPeer(context: context, theme: (context.sharedContext.currentPresentationData.with { $0 }).theme, peer: EnginePeer(groupPeer))
|
||||
|
||||
self.channelAvatarNode.setPeer(context: context, theme: (context.sharedContext.currentPresentationData.with { $0 }).theme, peer: channelPeer)
|
||||
self.groupAvatarNode.setPeer(context: context, theme: (context.sharedContext.currentPresentationData.with { $0 }).theme, peer: groupPeer)
|
||||
|
||||
let text: PresentationStrings.FormattedString
|
||||
if let channelPeer = channelPeer as? TelegramChannel, let addressName = channelPeer.addressName, !addressName.isEmpty {
|
||||
text = strings.Channel_DiscussionGroup_PublicChannelLink(EnginePeer(groupPeer).displayTitle(strings: strings, displayOrder: nameDisplayOrder), EnginePeer(channelPeer).displayTitle(strings: strings, displayOrder: nameDisplayOrder))
|
||||
if case let .channel(channel) = channelPeer, let addressName = channel.addressName, !addressName.isEmpty {
|
||||
text = strings.Channel_DiscussionGroup_PublicChannelLink(groupPeer.displayTitle(strings: strings, displayOrder: nameDisplayOrder), channelPeer.displayTitle(strings: strings, displayOrder: nameDisplayOrder))
|
||||
} else {
|
||||
text = strings.Channel_DiscussionGroup_PrivateChannelLink(EnginePeer(groupPeer).displayTitle(strings: strings, displayOrder: nameDisplayOrder), EnginePeer(channelPeer).displayTitle(strings: strings, displayOrder: nameDisplayOrder))
|
||||
text = strings.Channel_DiscussionGroup_PrivateChannelLink(groupPeer.displayTitle(strings: strings, displayOrder: nameDisplayOrder), channelPeer.displayTitle(strings: strings, displayOrder: nameDisplayOrder))
|
||||
}
|
||||
|
||||
let textFont = Font.regular(floor(theme.baseFontSize * 14.0 / 17.0))
|
||||
|
|
|
|||
|
|
@ -355,7 +355,7 @@ public func channelDiscussionGroupSetupController(context: AccountContext, updat
|
|||
|
||||
let actionSheet = ActionSheetController(presentationData: presentationData)
|
||||
actionSheet.setItemGroups([ActionSheetItemGroup(items: [
|
||||
ChannelDiscussionGroupActionSheetItem(context: context, channelPeer: channelPeer._asPeer(), groupPeer: groupPeer._asPeer(), strings: presentationData.strings, nameDisplayOrder: presentationData.nameDisplayOrder),
|
||||
ChannelDiscussionGroupActionSheetItem(context: context, channelPeer: channelPeer, groupPeer: groupPeer, strings: presentationData.strings, nameDisplayOrder: presentationData.nameDisplayOrder),
|
||||
ActionSheetButtonItem(title: presentationData.strings.Channel_DiscussionGroup_LinkGroup, color: .accent, action: { [weak actionSheet] in
|
||||
actionSheet?.dismissAnimated()
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@ import UIKit
|
|||
import Display
|
||||
import AsyncDisplayKit
|
||||
import SwiftSignalKit
|
||||
import Postbox
|
||||
import TelegramCore
|
||||
import TelegramPresentationData
|
||||
import ItemListUI
|
||||
|
|
@ -14,12 +13,12 @@ import TextFormat
|
|||
public class ItemListCallListItem: ListViewItem, ItemListItem {
|
||||
let presentationData: ItemListPresentationData
|
||||
let dateTimeFormat: PresentationDateTimeFormat
|
||||
let messages: [Message]
|
||||
let messages: [EngineMessage]
|
||||
public let sectionId: ItemListSectionId
|
||||
let style: ItemListStyle
|
||||
let displayDecorations: Bool
|
||||
|
||||
public init(presentationData: ItemListPresentationData, dateTimeFormat: PresentationDateTimeFormat, messages: [Message], sectionId: ItemListSectionId, style: ItemListStyle, displayDecorations: Bool = true) {
|
||||
|
||||
public init(presentationData: ItemListPresentationData, dateTimeFormat: PresentationDateTimeFormat, messages: [EngineMessage], sectionId: ItemListSectionId, style: ItemListStyle, displayDecorations: Bool = true) {
|
||||
self.presentationData = presentationData
|
||||
self.dateTimeFormat = dateTimeFormat
|
||||
self.messages = messages
|
||||
|
|
@ -62,7 +61,7 @@ public class ItemListCallListItem: ListViewItem, ItemListItem {
|
|||
}
|
||||
}
|
||||
|
||||
private func stringForCallType(message: Message, strings: PresentationStrings) -> String {
|
||||
private func stringForCallType(message: EngineMessage, strings: PresentationStrings) -> String {
|
||||
var string = ""
|
||||
for media in message.media {
|
||||
switch media {
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@ import UIKit
|
|||
import Display
|
||||
import AsyncDisplayKit
|
||||
import SwiftSignalKit
|
||||
import Postbox
|
||||
import TelegramCore
|
||||
import TelegramPresentationData
|
||||
import TelegramUIPreferences
|
||||
|
|
@ -274,14 +273,14 @@ private struct PeerAllowedReactionListControllerState: Equatable {
|
|||
private func peerAllowedReactionListControllerEntries(
|
||||
presentationData: PresentationData,
|
||||
availableReactions: AvailableReactions?,
|
||||
peer: Peer?,
|
||||
cachedData: CachedPeerData?,
|
||||
peer: EnginePeer?,
|
||||
cachedData: EngineCachedPeerData?,
|
||||
state: PeerAllowedReactionListControllerState
|
||||
) -> [PeerAllowedReactionListControllerEntry] {
|
||||
var entries: [PeerAllowedReactionListControllerEntry] = []
|
||||
|
||||
|
||||
if let peer = peer, let availableReactions = availableReactions, let allowedReactions = state.updatedAllowedReactions, let mode = state.updatedMode {
|
||||
if let channel = peer as? TelegramChannel, case .broadcast = channel.info {
|
||||
if case let .channel(channel) = peer, case .broadcast = channel.info {
|
||||
entries.append(.allowSwitch(text: presentationData.strings.PeerInfo_AllowedReactions_AllowAllText, value: mode != .empty))
|
||||
|
||||
entries.append(.itemsHeader(presentationData.strings.PeerInfo_AllowedReactions_ReactionListHeader))
|
||||
|
|
@ -301,7 +300,7 @@ private func peerAllowedReactionListControllerEntries(
|
|||
entries.append(.allowNone(text: presentationData.strings.PeerInfo_AllowedReactions_OptionNoReactions, isEnabled: mode == .empty))
|
||||
|
||||
let allInfoText: String
|
||||
if let peer = peer as? TelegramChannel, case .broadcast = peer.info {
|
||||
if case let .channel(peer) = peer, case .broadcast = peer.info {
|
||||
switch mode {
|
||||
case .all:
|
||||
allInfoText = presentationData.strings.PeerInfo_AllowedReactions_GroupOptionAllInfo
|
||||
|
|
@ -343,7 +342,7 @@ private func peerAllowedReactionListControllerEntries(
|
|||
public func peerAllowedReactionListController(
|
||||
context: AccountContext,
|
||||
updatedPresentationData: (initial: PresentationData, signal: Signal<PresentationData, NoError>)? = nil,
|
||||
peerId: PeerId
|
||||
peerId: EnginePeer.Id
|
||||
) -> ViewController {
|
||||
let statePromise = ValuePromise(PeerAllowedReactionListControllerState(), ignoreRepeated: true)
|
||||
let stateValue = Atomic(value: PeerAllowedReactionListControllerState())
|
||||
|
|
@ -476,7 +475,7 @@ public func peerAllowedReactionListController(
|
|||
let entries = peerAllowedReactionListControllerEntries(
|
||||
presentationData: presentationData,
|
||||
availableReactions: availableReactions,
|
||||
peer: peerView.peers[peerId],
|
||||
peer: peerView.peers[peerId].flatMap(EnginePeer.init),
|
||||
cachedData: peerView.cachedData,
|
||||
state: state
|
||||
)
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
import Foundation
|
||||
import TelegramCore
|
||||
import Postbox
|
||||
|
||||
public extension Message {
|
||||
func isRestricted(platform: String, contentSettings: ContentSettings) -> Bool {
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@ import Foundation
|
|||
import UIKit
|
||||
import Display
|
||||
import SwiftSignalKit
|
||||
import Postbox
|
||||
import TelegramCore
|
||||
import TelegramPresentationData
|
||||
import TelegramUIPreferences
|
||||
|
|
@ -24,7 +23,7 @@ private struct CounterTagSettings: OptionSet {
|
|||
self.rawValue = rawValue
|
||||
}
|
||||
|
||||
init(summaryTags: PeerSummaryCounterTags) {
|
||||
init(summaryTags: EnginePeerSummaryCounterTags) {
|
||||
var result = CounterTagSettings()
|
||||
if summaryTags.contains(.contact) {
|
||||
result.insert(.regularChatsAndGroups)
|
||||
|
|
@ -35,8 +34,8 @@ private struct CounterTagSettings: OptionSet {
|
|||
self = result
|
||||
}
|
||||
|
||||
func toSumaryTags() -> PeerSummaryCounterTags {
|
||||
var result = PeerSummaryCounterTags()
|
||||
func toSumaryTags() -> EnginePeerSummaryCounterTags {
|
||||
var result = EnginePeerSummaryCounterTags()
|
||||
if self.contains(.regularChatsAndGroups) {
|
||||
result.insert(.contact)
|
||||
result.insert(.nonContact)
|
||||
|
|
@ -786,10 +785,10 @@ public func notificationsAndSoundsController(context: AccountContext, exceptions
|
|||
let defaultStorySettings = PeerStoryNotificationSettings.default
|
||||
|
||||
notificationExceptions.set(exceptionsSignal |> map { list -> (NotificationExceptionMode, NotificationExceptionMode, NotificationExceptionMode, NotificationExceptionMode) in
|
||||
var users:[PeerId : NotificationExceptionWrapper] = [:]
|
||||
var groups: [PeerId : NotificationExceptionWrapper] = [:]
|
||||
var channels: [PeerId : NotificationExceptionWrapper] = [:]
|
||||
var stories: [PeerId : NotificationExceptionWrapper] = [:]
|
||||
var users:[EnginePeer.Id : NotificationExceptionWrapper] = [:]
|
||||
var groups: [EnginePeer.Id : NotificationExceptionWrapper] = [:]
|
||||
var channels: [EnginePeer.Id : NotificationExceptionWrapper] = [:]
|
||||
var stories: [EnginePeer.Id : NotificationExceptionWrapper] = [:]
|
||||
if let list = list {
|
||||
for (key, value) in list.settings {
|
||||
if let peer = list.peers[key], !peer.debugDisplayTitle.isEmpty, peer.id != context.account.peerId {
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@ import Foundation
|
|||
import UIKit
|
||||
import Display
|
||||
import SwiftSignalKit
|
||||
import Postbox
|
||||
import TelegramCore
|
||||
import TelegramPresentationData
|
||||
import TelegramUIPreferences
|
||||
|
|
@ -543,7 +542,7 @@ private func recentSessionsControllerEntries(presentationData: PresentationData,
|
|||
return entries
|
||||
}
|
||||
|
||||
private func recentSessionsControllerEntries(presentationData: PresentationData, state: RecentSessionsControllerState, websites: [WebAuthorization]?, peers: [PeerId : Peer]?) -> [RecentSessionsEntry] {
|
||||
private func recentSessionsControllerEntries(presentationData: PresentationData, state: RecentSessionsControllerState, websites: [WebAuthorization]?, peers: [EnginePeer.Id: EnginePeer]?) -> [RecentSessionsEntry] {
|
||||
var entries: [RecentSessionsEntry] = []
|
||||
|
||||
if let websites = websites, let peers = peers {
|
||||
|
|
@ -562,7 +561,7 @@ private func recentSessionsControllerEntries(presentationData: PresentationData,
|
|||
let website = websites[i]
|
||||
if !existingSessionIds.contains(website.hash) {
|
||||
existingSessionIds.insert(website.hash)
|
||||
entries.append(.website(index: Int32(i), sortIndex: SortIndex(section: 1, item: i), strings: presentationData.strings, dateTimeFormat: presentationData.dateTimeFormat, nameDisplayOrder: presentationData.nameDisplayOrder, website: website, peer: peers[website.botId].flatMap(EnginePeer.init), enabled: state.removingSessionId != website.hash && !state.terminatingOtherSessions, editing: state.editing, revealed: state.sessionIdWithRevealedOptions == website.hash))
|
||||
entries.append(.website(index: Int32(i), sortIndex: SortIndex(section: 1, item: i), strings: presentationData.strings, dateTimeFormat: presentationData.dateTimeFormat, nameDisplayOrder: presentationData.nameDisplayOrder, website: website, peer: peers[website.botId], enabled: state.removingSessionId != website.hash && !state.terminatingOtherSessions, editing: state.editing, revealed: state.sessionIdWithRevealedOptions == website.hash))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@ import Foundation
|
|||
import UIKit
|
||||
import Display
|
||||
import SwiftSignalKit
|
||||
import Postbox
|
||||
import TelegramCore
|
||||
import TelegramUIPreferences
|
||||
import TelegramCallsUI
|
||||
|
|
@ -1542,10 +1541,10 @@ private func notificationSearchableItems(context: AccountContext, settings: Glob
|
|||
|
||||
let defaultStorySettings = PeerStoryNotificationSettings.default
|
||||
let exceptions = { () -> (NotificationExceptionMode, NotificationExceptionMode, NotificationExceptionMode, NotificationExceptionMode) in
|
||||
var users:[PeerId : NotificationExceptionWrapper] = [:]
|
||||
var groups: [PeerId : NotificationExceptionWrapper] = [:]
|
||||
var channels: [PeerId : NotificationExceptionWrapper] = [:]
|
||||
var stories: [PeerId : NotificationExceptionWrapper] = [:]
|
||||
var users:[EnginePeer.Id: NotificationExceptionWrapper] = [:]
|
||||
var groups: [EnginePeer.Id: NotificationExceptionWrapper] = [:]
|
||||
var channels: [EnginePeer.Id: NotificationExceptionWrapper] = [:]
|
||||
var stories: [EnginePeer.Id: NotificationExceptionWrapper] = [:]
|
||||
|
||||
if let list = exceptionsList {
|
||||
for (key, value) in list.settings {
|
||||
|
|
@ -4515,20 +4514,20 @@ func settingsSearchableItems(
|
|||
}
|
||||
}
|
||||
|
||||
private func stringTokens(_ string: String) -> [ValueBoxKey] {
|
||||
private func stringTokens(_ string: String) -> [EngineDataBuffer] {
|
||||
let nsString = string.folding(options: .diacriticInsensitive, locale: .current).lowercased() as NSString
|
||||
|
||||
let flag = UInt(kCFStringTokenizerUnitWord)
|
||||
let tokenizer = CFStringTokenizerCreate(kCFAllocatorDefault, nsString, CFRangeMake(0, nsString.length), flag, CFLocaleCopyCurrent())
|
||||
var tokenType = CFStringTokenizerAdvanceToNextToken(tokenizer)
|
||||
var tokens: [ValueBoxKey] = []
|
||||
var tokens: [EngineDataBuffer] = []
|
||||
|
||||
var addedTokens = Set<ValueBoxKey>()
|
||||
var addedTokens = Set<EngineDataBuffer>()
|
||||
while tokenType != [] {
|
||||
let currentTokenRange = CFStringTokenizerGetCurrentTokenRange(tokenizer)
|
||||
|
||||
if currentTokenRange.location >= 0 && currentTokenRange.length != 0 {
|
||||
let token = ValueBoxKey(length: currentTokenRange.length * 2)
|
||||
let token = EngineDataBuffer(length: currentTokenRange.length * 2)
|
||||
nsString.getCharacters(token.memory.assumingMemoryBound(to: unichar.self), range: NSMakeRange(currentTokenRange.location, currentTokenRange.length))
|
||||
if !addedTokens.contains(token) {
|
||||
tokens.append(token)
|
||||
|
|
@ -4541,7 +4540,7 @@ private func stringTokens(_ string: String) -> [ValueBoxKey] {
|
|||
return tokens
|
||||
}
|
||||
|
||||
private func matchStringTokens(_ tokens: [ValueBoxKey], with other: [ValueBoxKey]) -> Bool {
|
||||
private func matchStringTokens(_ tokens: [EngineDataBuffer], with other: [EngineDataBuffer]) -> Bool {
|
||||
if other.isEmpty {
|
||||
return false
|
||||
} else if other.count == 1 {
|
||||
|
|
|
|||
|
|
@ -349,7 +349,7 @@ private final class ThemePickerControllerImpl: ItemListController, ThemePickerCo
|
|||
|
||||
public func themePickerController(context: AccountContext, focusOnItemTag: ThemeSettingsEntryTag? = nil) -> ViewController {
|
||||
#if DEBUG
|
||||
BuiltinWallpaperData.generate(account: context.account)
|
||||
BuiltinWallpaperData.generate(network: context.account.network)
|
||||
#endif
|
||||
|
||||
var pushControllerImpl: ((ViewController) -> Void)?
|
||||
|
|
|
|||
|
|
@ -506,7 +506,7 @@ private final class ThemeSettingsControllerImpl: ItemListController, ThemeSettin
|
|||
|
||||
public func themeSettingsController(context: AccountContext, focusOnItemTag: ThemeSettingsEntryTag? = nil) -> ViewController {
|
||||
#if DEBUG
|
||||
BuiltinWallpaperData.generate(account: context.account)
|
||||
BuiltinWallpaperData.generate(network: context.account.network)
|
||||
#endif
|
||||
|
||||
var pushControllerImpl: ((ViewController) -> Void)?
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@ import Foundation
|
|||
import CoreMedia
|
||||
import UIKit
|
||||
import SwiftSignalKit
|
||||
import Postbox
|
||||
import Display
|
||||
import TelegramCore
|
||||
import Compression
|
||||
|
|
@ -17,7 +16,7 @@ import ManagedFile
|
|||
import UniversalMediaPlayer
|
||||
import SoftwareVideo
|
||||
|
||||
public func fetchCompressedLottieFirstFrameAJpeg(data: Data, size: CGSize, fitzModifier: EmojiFitzModifier? = nil, cacheKey: String) -> Signal<TempBoxFile, NoError> {
|
||||
public func fetchCompressedLottieFirstFrameAJpeg(data: Data, size: CGSize, fitzModifier: EmojiFitzModifier? = nil, cacheKey: String) -> Signal<EngineTempBoxFile, NoError> {
|
||||
return Signal({ subscriber in
|
||||
let queue = Queue()
|
||||
|
||||
|
|
@ -97,7 +96,7 @@ public func fetchCompressedLottieFirstFrameAJpeg(data: Data, size: CGSize, fitzM
|
|||
finalData.append(&alphaSize, length: 4)
|
||||
finalData.append(alphaData as Data)
|
||||
|
||||
let tempFile = TempBox.shared.tempFile(fileName: "image.ajpg")
|
||||
let tempFile = EngineTempBox.shared.tempFile(fileName: "image.ajpg")
|
||||
let _ = try? finalData.write(to: URL(fileURLWithPath: tempFile.path), options: [])
|
||||
subscriber.putNext(tempFile)
|
||||
subscriber.putCompletion()
|
||||
|
|
@ -117,7 +116,7 @@ private let threadPool: ThreadPool = {
|
|||
return ThreadPool(threadCount: 3, threadPriority: 0.5)
|
||||
}()
|
||||
|
||||
public func cacheAnimatedStickerFrames(data: Data, size: CGSize, fitzModifier: EmojiFitzModifier? = nil, cacheKey: String) -> Signal<CachedMediaResourceRepresentationResult, NoError> {
|
||||
public func cacheAnimatedStickerFrames(data: Data, size: CGSize, fitzModifier: EmojiFitzModifier? = nil, cacheKey: String) -> Signal<EngineCachedMediaResourceRepresentationResult, NoError> {
|
||||
return Signal({ subscriber in
|
||||
let cancelled = Atomic<Bool>(value: false)
|
||||
|
||||
|
|
@ -144,7 +143,7 @@ public func cacheAnimatedStickerFrames(data: Data, size: CGSize, fitzModifier: E
|
|||
|
||||
var currentFrame: Int32 = 0
|
||||
|
||||
let tempFile = TempBox.shared.tempFile(fileName: "result.asticker")
|
||||
let tempFile = EngineTempBox.shared.tempFile(fileName: "result.asticker")
|
||||
guard let file = ManagedFile(queue: nil, path: tempFile.path, mode: .readwrite) else {
|
||||
return
|
||||
}
|
||||
|
|
@ -258,7 +257,7 @@ public func cacheAnimatedStickerFrames(data: Data, size: CGSize, fitzModifier: E
|
|||
})
|
||||
}
|
||||
|
||||
public func cacheVideoStickerFrames(path: String, size: CGSize, cacheKey: String) -> Signal<CachedMediaResourceRepresentationResult, NoError> {
|
||||
public func cacheVideoStickerFrames(path: String, size: CGSize, cacheKey: String) -> Signal<EngineCachedMediaResourceRepresentationResult, NoError> {
|
||||
return Signal { subscriber in
|
||||
let cancelled = Atomic<Bool>(value: false)
|
||||
|
||||
|
|
@ -278,7 +277,7 @@ public func cacheVideoStickerFrames(path: String, size: CGSize, cacheKey: String
|
|||
|
||||
var currentFrame: Int32 = 0
|
||||
|
||||
let tempFile = TempBox.shared.tempFile(fileName: "result.vsticker")
|
||||
let tempFile = EngineTempBox.shared.tempFile(fileName: "result.vsticker")
|
||||
guard let file = ManagedFile(queue: nil, path: tempFile.path, mode: .readwrite) else {
|
||||
return
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,7 +11,6 @@ swift_library(
|
|||
],
|
||||
deps = [
|
||||
"//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit",
|
||||
"//submodules/Postbox:Postbox",
|
||||
"//submodules/TelegramCore:TelegramCore",
|
||||
"//submodules/AsyncDisplayKit:AsyncDisplayKit",
|
||||
"//submodules/Display:Display",
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@ import UIKit
|
|||
import AsyncDisplayKit
|
||||
import Display
|
||||
import TelegramCore
|
||||
import Postbox
|
||||
import TelegramPresentationData
|
||||
import AccountContext
|
||||
import LiveLocationTimerNode
|
||||
|
|
@ -11,14 +10,14 @@ import AvatarNode
|
|||
|
||||
public class LocationBroadcastActionSheetItem: ActionSheetItem {
|
||||
public let context: AccountContext
|
||||
public let peer: Peer
|
||||
public let peer: EnginePeer
|
||||
public let title: String
|
||||
public let beginTimestamp: Double
|
||||
public let timeout: Double
|
||||
public let strings: PresentationStrings
|
||||
public let action: () -> Void
|
||||
|
||||
public init(context: AccountContext, peer: Peer, title: String, beginTimestamp: Double, timeout: Double, strings: PresentationStrings, action: @escaping () -> Void) {
|
||||
public init(context: AccountContext, peer: EnginePeer, title: String, beginTimestamp: Double, timeout: Double, strings: PresentationStrings, action: @escaping () -> Void) {
|
||||
self.context = context
|
||||
self.peer = peer
|
||||
self.title = title
|
||||
|
|
@ -105,7 +104,7 @@ public class LocationBroadcastActionSheetItemNode: ActionSheetItemNode {
|
|||
let textColor: UIColor = self.theme.primaryTextColor
|
||||
self.label.attributedText = NSAttributedString(string: item.title, font: defaultFont, textColor: textColor)
|
||||
|
||||
self.avatarNode.setPeer(context: item.context, theme: (item.context.sharedContext.currentPresentationData.with { $0 }).theme, peer: EnginePeer(item.peer))
|
||||
self.avatarNode.setPeer(context: item.context, theme: (item.context.sharedContext.currentPresentationData.with { $0 }).theme, peer: item.peer)
|
||||
|
||||
self.timerNode.update(backgroundColor: self.theme.controlAccentColor.withAlphaComponent(0.4), foregroundColor: self.theme.controlAccentColor, textColor: self.theme.controlAccentColor, beginTimestamp: item.beginTimestamp, timeout: Int32(item.timeout) == liveLocationIndefinitePeriod ? -1.0 : item.timeout, strings: item.strings)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ protocol CallControllerNodeProtocol: AnyObject {
|
|||
|
||||
func updateAudioOutputs(availableOutputs: [AudioSessionOutput], currentOutput: AudioSessionOutput?)
|
||||
func updateCallState(_ callState: PresentationCallState)
|
||||
func updatePeer(accountPeer: Peer, peer: Peer, hasOther: Bool)
|
||||
func updatePeer(accountPeer: EnginePeer, peer: EnginePeer, hasOther: Bool)
|
||||
|
||||
func animateIn()
|
||||
func animateOut(completion: @escaping () -> Void)
|
||||
|
|
@ -63,8 +63,6 @@ public final class CallController: ViewController {
|
|||
private var presentationData: PresentationData
|
||||
private var didPlayPresentationAnimation = false
|
||||
|
||||
private var peer: Peer?
|
||||
|
||||
private var peerDisposable: Disposable?
|
||||
private var disposable: Disposable?
|
||||
|
||||
|
|
@ -164,7 +162,6 @@ public final class CallController: ViewController {
|
|||
override public func loadDisplayNode() {
|
||||
let displayNode = CallControllerNodeV2(
|
||||
sharedContext: self.sharedContext,
|
||||
account: self.account,
|
||||
presentationData: self.presentationData,
|
||||
statusBar: self.statusBar,
|
||||
debugInfo: self.call.debugInfo(),
|
||||
|
|
@ -372,8 +369,7 @@ public final class CallController: ViewController {
|
|||
if let strongSelf = self {
|
||||
if let view {
|
||||
if let accountPeer = accountView.peers[accountView.peerId], let peer = view.peers[view.peerId] {
|
||||
strongSelf.peer = peer
|
||||
strongSelf.controllerNode.updatePeer(accountPeer: accountPeer, peer: peer, hasOther: activeAccountsWithInfo.accounts.count > 1)
|
||||
strongSelf.controllerNode.updatePeer(accountPeer: EnginePeer(accountPeer), peer: EnginePeer(peer), hasOther: activeAccountsWithInfo.accounts.count > 1)
|
||||
strongSelf.isDataReady.set(.single(true))
|
||||
}
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@ import UIKit
|
|||
import AsyncDisplayKit
|
||||
import Display
|
||||
import TelegramCore
|
||||
import Postbox
|
||||
import TelegramAudio
|
||||
import AccountContext
|
||||
import TelegramPresentationData
|
||||
|
|
@ -30,7 +29,6 @@ final class CallControllerNodeV2: ViewControllerTracingNode, CallControllerNodeP
|
|||
}
|
||||
|
||||
private let sharedContext: SharedAccountContext
|
||||
private let account: Account
|
||||
private let presentationData: PresentationData
|
||||
private let statusBar: StatusBar
|
||||
private let call: PresentationCall
|
||||
|
|
@ -88,7 +86,6 @@ final class CallControllerNodeV2: ViewControllerTracingNode, CallControllerNodeP
|
|||
|
||||
init(
|
||||
sharedContext: SharedAccountContext,
|
||||
account: Account,
|
||||
presentationData: PresentationData,
|
||||
statusBar: StatusBar,
|
||||
debugInfo: Signal<(String, String), NoError>,
|
||||
|
|
@ -96,7 +93,6 @@ final class CallControllerNodeV2: ViewControllerTracingNode, CallControllerNodeP
|
|||
call: PresentationCall
|
||||
) {
|
||||
self.sharedContext = sharedContext
|
||||
self.account = account
|
||||
self.presentationData = presentationData
|
||||
self.statusBar = statusBar
|
||||
self.call = call
|
||||
|
|
@ -611,8 +607,8 @@ final class CallControllerNodeV2: ViewControllerTracingNode, CallControllerNodeP
|
|||
}
|
||||
}
|
||||
|
||||
func updatePeer(accountPeer: Peer, peer: Peer, hasOther: Bool) {
|
||||
self.updatePeer(peer: EnginePeer(peer))
|
||||
func updatePeer(accountPeer: EnginePeer, peer: EnginePeer, hasOther: Bool) {
|
||||
self.updatePeer(peer: peer)
|
||||
}
|
||||
|
||||
private func updatePeer(peer: EnginePeer) {
|
||||
|
|
|
|||
|
|
@ -221,7 +221,7 @@ public class CallStatusBarNodeImpl: CallStatusBarNode {
|
|||
private var presentationData: PresentationData?
|
||||
private let presentationDataDisposable = MetaDisposable()
|
||||
|
||||
private var currentPeer: Peer?
|
||||
private var currentPeer: EnginePeer?
|
||||
private var currentCallTimer: SwiftSignalKit.Timer?
|
||||
private var currentCallState: PresentationCallState?
|
||||
private var currentGroupCallState: PresentationGroupCallSummaryState?
|
||||
|
|
@ -335,7 +335,7 @@ public class CallStatusBarNodeImpl: CallStatusBarNode {
|
|||
)
|
||||
|> deliverOnMainQueue).start(next: { [weak self] peer, state, isMuted in
|
||||
if let strongSelf = self {
|
||||
strongSelf.currentPeer = peer._asPeer()
|
||||
strongSelf.currentPeer = peer
|
||||
strongSelf.currentCallState = state
|
||||
strongSelf.currentIsMuted = isMuted
|
||||
|
||||
|
|
@ -384,7 +384,7 @@ public class CallStatusBarNodeImpl: CallStatusBarNode {
|
|||
|> deliverOnMainQueue).start(next: { [weak self] view, state, isMuted, members in
|
||||
if let strongSelf = self {
|
||||
if let view {
|
||||
strongSelf.currentPeer = view.peers[view.peerId]
|
||||
strongSelf.currentPeer = view.peers[view.peerId].flatMap(EnginePeer.init)
|
||||
} else {
|
||||
strongSelf.currentPeer = nil
|
||||
}
|
||||
|
|
@ -470,7 +470,7 @@ public class CallStatusBarNodeImpl: CallStatusBarNode {
|
|||
if let voiceChatTitle = self.currentGroupCallState?.info?.title, !voiceChatTitle.isEmpty {
|
||||
title = voiceChatTitle
|
||||
} else if let currentPeer = self.currentPeer {
|
||||
title = EnginePeer(currentPeer).displayTitle(strings: presentationData.strings, displayOrder: presentationData.nameDisplayOrder)
|
||||
title = currentPeer.displayTitle(strings: presentationData.strings, displayOrder: presentationData.nameDisplayOrder)
|
||||
}
|
||||
var membersCount: Int32?
|
||||
if let groupCallState = self.currentGroupCallState {
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@ import UIKit
|
|||
import AVFoundation
|
||||
import SwiftSignalKit
|
||||
import UniversalMediaPlayer
|
||||
import Postbox
|
||||
import TelegramCore
|
||||
import AccountContext
|
||||
import TelegramAudio
|
||||
|
|
@ -19,7 +18,7 @@ final class LivestreamVideoViewV1: UIView {
|
|||
let part: DirectMediaStreamingContext.Playlist.Part
|
||||
let disposable = MetaDisposable()
|
||||
var resolvedTimeOffset: Double?
|
||||
var data: TempBoxFile?
|
||||
var data: EngineTempBoxFile?
|
||||
var info: FFMpegMediaInfo?
|
||||
|
||||
init(part: DirectMediaStreamingContext.Playlist.Part) {
|
||||
|
|
@ -164,11 +163,11 @@ final class LivestreamVideoViewV1: UIView {
|
|||
if let streamingContext = self.streamingContext {
|
||||
partContext.disposable.set((streamingContext.partData(index: part.index)
|
||||
|> deliverOn(Queue.concurrentDefaultQueue())
|
||||
|> map { data -> (file: TempBoxFile, info: FFMpegMediaInfo)? in
|
||||
|> map { data -> (file: EngineTempBoxFile, info: FFMpegMediaInfo)? in
|
||||
guard let data else {
|
||||
return nil
|
||||
}
|
||||
let tempFile = TempBox.shared.tempFile(fileName: "part.mp4")
|
||||
let tempFile = EngineTempBox.shared.tempFile(fileName: "part.mp4")
|
||||
if let _ = try? data.write(to: URL(fileURLWithPath: tempFile.path), options: .atomic) {
|
||||
if let info = extractFFMpegMediaInfo(path: tempFile.path) {
|
||||
return (tempFile, info)
|
||||
|
|
@ -176,7 +175,7 @@ final class LivestreamVideoViewV1: UIView {
|
|||
return nil
|
||||
}
|
||||
} else {
|
||||
TempBox.shared.dispose(tempFile)
|
||||
EngineTempBox.shared.dispose(tempFile)
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@ import AccountContext
|
|||
import SwiftSignalKit
|
||||
import AVKit
|
||||
import TelegramCore
|
||||
import Postbox
|
||||
|
||||
import UndoUI
|
||||
import TelegramPresentationData
|
||||
|
|
@ -66,7 +65,7 @@ public final class MediaStreamComponent: CombinedComponent {
|
|||
private(set) var recordingStartTimestamp: Int32?
|
||||
|
||||
private(set) var peerTitle: String = ""
|
||||
private(set) var chatPeer: Peer?
|
||||
private(set) var chatPeer: EnginePeer?
|
||||
|
||||
private(set) var isVisibleInHierarchy: Bool = false
|
||||
private var isVisibleInHierarchyDisposable: Disposable?
|
||||
|
|
@ -152,7 +151,7 @@ public final class MediaStreamComponent: CombinedComponent {
|
|||
strongSelf.peerTitle = callPeer.debugDisplayTitle
|
||||
updated = true
|
||||
}
|
||||
strongSelf.chatPeer = callPeer._asPeer()
|
||||
strongSelf.chatPeer = callPeer
|
||||
|
||||
if strongSelf.callTitle != state.title {
|
||||
strongSelf.callTitle = state.title
|
||||
|
|
@ -508,7 +507,7 @@ public final class MediaStreamComponent: CombinedComponent {
|
|||
let title: String = presentationData.strings.LiveStream_EditTitle
|
||||
let text: String = presentationData.strings.LiveStream_EditTitleText
|
||||
|
||||
let editController = voiceChatTitleEditController(context: call.accountContext, forceTheme: defaultDarkPresentationTheme, title: title, text: text, placeholder: EnginePeer(chatPeer).displayTitle(strings: presentationData.strings, displayOrder: presentationData.nameDisplayOrder), value: initialTitle, maxLength: 40, apply: { [weak call] title in
|
||||
let editController = voiceChatTitleEditController(context: call.accountContext, forceTheme: defaultDarkPresentationTheme, title: title, text: text, placeholder: chatPeer.displayTitle(strings: presentationData.strings, displayOrder: presentationData.nameDisplayOrder), value: initialTitle, maxLength: 40, apply: { [weak call] title in
|
||||
guard let call = call else {
|
||||
return
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,7 +9,6 @@ import ShimmerEffect
|
|||
import TelegramCore
|
||||
import SwiftSignalKit
|
||||
import AvatarNode
|
||||
import Postbox
|
||||
import TelegramVoip
|
||||
import ComponentDisplayAdapters
|
||||
|
||||
|
|
@ -28,7 +27,7 @@ public final class MediaStreamVideoComponent: Component {
|
|||
let isFullscreen: Bool
|
||||
let onVideoSizeRetrieved: (CGSize) -> Void
|
||||
let videoLoading: Bool
|
||||
let callPeer: Peer?
|
||||
let callPeer: EnginePeer?
|
||||
let onVideoPlaybackLiveChange: (Bool) -> Void
|
||||
|
||||
public init(
|
||||
|
|
@ -40,7 +39,7 @@ public final class MediaStreamVideoComponent: Component {
|
|||
addInset: Bool,
|
||||
isFullscreen: Bool,
|
||||
videoLoading: Bool,
|
||||
callPeer: Peer?,
|
||||
callPeer: EnginePeer?,
|
||||
enablePictureInPicture: Bool,
|
||||
activatePictureInPicture: ActionSlot<Action<Void>>,
|
||||
deactivatePictureInPicture: ActionSlot<Void>,
|
||||
|
|
@ -306,7 +305,7 @@ public final class MediaStreamVideoComponent: Component {
|
|||
if let peer = component.callPeer, !didBeginLoadingAvatar {
|
||||
didBeginLoadingAvatar = true
|
||||
|
||||
avatarDisposable = peerAvatarCompleteImage(account: component.call.account, peer: EnginePeer(peer), size: CGSize(width: 250.0, height: 250.0), round: false, font: Font.regular(16.0), drawLetters: false, fullSize: false, blurred: true).start(next: { [weak self] image in
|
||||
avatarDisposable = peerAvatarCompleteImage(account: component.call.account, peer: peer, size: CGSize(width: 250.0, height: 250.0), round: false, font: Font.regular(16.0), drawLetters: false, fullSize: false, blurred: true).start(next: { [weak self] image in
|
||||
DispatchQueue.main.async {
|
||||
self?.placeholderView.contentMode = .scaleAspectFill
|
||||
self?.placeholderView.image = image
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ final class LegacyCallControllerNode: ASDisplayNode, CallControllerNodeProtocol
|
|||
private let statusBar: StatusBar
|
||||
|
||||
private var presentationData: PresentationData
|
||||
private var peer: Peer?
|
||||
private var peer: EnginePeer?
|
||||
private let debugInfo: Signal<(String, String), NoError>
|
||||
private var forceReportRating = false
|
||||
private let easyDebugAccess: Bool
|
||||
|
|
@ -167,10 +167,10 @@ final class LegacyCallControllerNode: ASDisplayNode, CallControllerNodeProtocol
|
|||
self.view.addGestureRecognizer(tapRecognizer)
|
||||
}
|
||||
|
||||
func updatePeer(accountPeer: Peer, peer: Peer, hasOther: Bool) {
|
||||
if !arePeersEqual(self.peer, peer) {
|
||||
func updatePeer(accountPeer: EnginePeer, peer: EnginePeer, hasOther: Bool) {
|
||||
if self.peer != peer {
|
||||
self.peer = peer
|
||||
if let peerReference = PeerReference(peer), !peer.profileImageRepresentations.isEmpty {
|
||||
if let peerReference = PeerReference(peer._asPeer()), !peer.profileImageRepresentations.isEmpty {
|
||||
let representations: [ImageRepresentationWithReference] = peer.profileImageRepresentations.map({ ImageRepresentationWithReference(representation: $0, reference: .avatar(peer: peerReference, resource: $0.resource)) })
|
||||
self.imageNode.setSignal(chatAvatarGalleryPhoto(account: self.account, representations: representations, immediateThumbnailData: nil, autoFetchFullSize: true))
|
||||
self.dimNode.isHidden = false
|
||||
|
|
@ -178,10 +178,10 @@ final class LegacyCallControllerNode: ASDisplayNode, CallControllerNodeProtocol
|
|||
self.imageNode.setSignal(callDefaultBackground())
|
||||
self.dimNode.isHidden = true
|
||||
}
|
||||
|
||||
self.statusNode.title = EnginePeer(peer).displayTitle(strings: self.presentationData.strings, displayOrder: self.presentationData.nameDisplayOrder)
|
||||
|
||||
self.statusNode.title = peer.displayTitle(strings: self.presentationData.strings, displayOrder: self.presentationData.nameDisplayOrder)
|
||||
if hasOther {
|
||||
self.statusNode.subtitle = self.presentationData.strings.Call_AnsweringWithAccount(EnginePeer(accountPeer).displayTitle(strings: self.presentationData.strings, displayOrder: self.presentationData.nameDisplayOrder)).string
|
||||
self.statusNode.subtitle = self.presentationData.strings.Call_AnsweringWithAccount(accountPeer.displayTitle(strings: self.presentationData.strings, displayOrder: self.presentationData.nameDisplayOrder)).string
|
||||
|
||||
if let callState = callState {
|
||||
self.updateCallState(callState)
|
||||
|
|
@ -444,7 +444,7 @@ final class LegacyCallControllerNode: ASDisplayNode, CallControllerNodeProtocol
|
|||
|
||||
@objc func keyPressed() {
|
||||
if self.keyPreviewNode == nil, let keyText = self.keyTextData?.1, let peer = self.peer {
|
||||
let keyPreviewNode = CallControllerKeyPreviewNode(keyText: keyText, infoText: self.presentationData.strings.Call_EmojiDescription(EnginePeer(peer).compactDisplayTitle).string.replacingOccurrences(of: "%%", with: "%"), dismiss: { [weak self] in
|
||||
let keyPreviewNode = CallControllerKeyPreviewNode(keyText: keyText, infoText: self.presentationData.strings.Call_EmojiDescription(peer.compactDisplayTitle).string.replacingOccurrences(of: "%%", with: "%"), dismiss: { [weak self] in
|
||||
if let _ = self?.keyPreviewNode {
|
||||
self?.backPressed()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,7 +9,6 @@ import TelegramStringFormatting
|
|||
import TelegramVoip
|
||||
import TelegramAudio
|
||||
import AccountContext
|
||||
import Postbox
|
||||
import TelegramCore
|
||||
import MergeLists
|
||||
import ItemListUI
|
||||
|
|
@ -124,7 +123,7 @@ struct VoiceChatPeerEntry: Identifiable {
|
|||
case raisedHand
|
||||
}
|
||||
|
||||
var peer: Peer
|
||||
var peer: EnginePeer
|
||||
var about: String?
|
||||
var isMyPeer: Bool
|
||||
var videoEndpointId: String?
|
||||
|
|
@ -146,7 +145,7 @@ struct VoiceChatPeerEntry: Identifiable {
|
|||
}
|
||||
|
||||
init(
|
||||
peer: Peer,
|
||||
peer: EnginePeer,
|
||||
about: String?,
|
||||
isMyPeer: Bool,
|
||||
videoEndpointId: String?,
|
||||
|
|
@ -181,12 +180,12 @@ struct VoiceChatPeerEntry: Identifiable {
|
|||
self.isLandscape = isLandscape
|
||||
}
|
||||
|
||||
var stableId: PeerId {
|
||||
var stableId: EnginePeer.Id {
|
||||
return self.peer.id
|
||||
}
|
||||
|
||||
|
||||
static func ==(lhs: VoiceChatPeerEntry, rhs: VoiceChatPeerEntry) -> Bool {
|
||||
if !lhs.peer.isEqual(rhs.peer) {
|
||||
if lhs.peer != rhs.peer {
|
||||
return false
|
||||
}
|
||||
if lhs.about != rhs.about {
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@ import UIKit
|
|||
import Display
|
||||
import AsyncDisplayKit
|
||||
import SwiftSignalKit
|
||||
import Postbox
|
||||
import TelegramCore
|
||||
import TelegramPresentationData
|
||||
import TelegramUIPreferences
|
||||
|
|
@ -73,7 +72,7 @@ final class VoiceChatFullscreenParticipantItem: ListViewItem {
|
|||
let presentationData: ItemListPresentationData
|
||||
let nameDisplayOrder: PresentationPersonNameOrder
|
||||
let context: AccountContext
|
||||
let peer: Peer
|
||||
let peer: EnginePeer
|
||||
let videoEndpointId: String?
|
||||
let isPaused: Bool
|
||||
let icon: Icon
|
||||
|
|
@ -91,7 +90,7 @@ final class VoiceChatFullscreenParticipantItem: ListViewItem {
|
|||
|
||||
public let selectable: Bool = true
|
||||
|
||||
public init(presentationData: ItemListPresentationData, nameDisplayOrder: PresentationPersonNameOrder, context: AccountContext, peer: Peer, videoEndpointId: String?, isPaused: Bool, icon: Icon, text: VoiceChatParticipantItem.ParticipantText, textColor: Color, color: Color, isLandscape: Bool, active: Bool, showVideoWhenActive: Bool, getAudioLevel: (() -> Signal<Float, NoError>)?, getVideo: @escaping () -> GroupVideoNode?, action: ((ASDisplayNode?) -> Void)?, contextAction: ((ASDisplayNode, ContextGesture?) -> Void)? = nil, getUpdatingAvatar: @escaping () -> Signal<(TelegramMediaImageRepresentation, Float)?, NoError>) {
|
||||
public init(presentationData: ItemListPresentationData, nameDisplayOrder: PresentationPersonNameOrder, context: AccountContext, peer: EnginePeer, videoEndpointId: String?, isPaused: Bool, icon: Icon, text: VoiceChatParticipantItem.ParticipantText, textColor: Color, color: Color, isLandscape: Bool, active: Bool, showVideoWhenActive: Bool, getAudioLevel: (() -> Signal<Float, NoError>)?, getVideo: @escaping () -> GroupVideoNode?, action: ((ASDisplayNode?) -> Void)?, contextAction: ((ASDisplayNode, ContextGesture?) -> Void)? = nil, getUpdatingAvatar: @escaping () -> Signal<(TelegramMediaImageRepresentation, Float)?, NoError>) {
|
||||
self.presentationData = presentationData
|
||||
self.nameDisplayOrder = nameDisplayOrder
|
||||
self.context = context
|
||||
|
|
@ -384,7 +383,7 @@ class VoiceChatFullscreenParticipantItemNode: ItemListRevealOptionsItemNode {
|
|||
if let videoNode = self.videoNode, videoNode.supernode == self.videoContainerNode, !videoNode.alpha.isZero {
|
||||
hasVideo = true
|
||||
}
|
||||
let profileNode = VoiceChatPeerProfileNode(context: item.context, size: extractedRect.size, sourceSize: nonExtractedRect.size, peer: EnginePeer(item.peer), text: item.text, customNode: hasVideo ? self.videoContainerNode : nil, additionalEntry: .single(nil), requestDismiss: { [weak self] in
|
||||
let profileNode = VoiceChatPeerProfileNode(context: item.context, size: extractedRect.size, sourceSize: nonExtractedRect.size, peer: item.peer, text: item.text, customNode: hasVideo ? self.videoContainerNode : nil, additionalEntry: .single(nil), requestDismiss: { [weak self] in
|
||||
self?.contextSourceNode.requestDismiss?()
|
||||
})
|
||||
profileNode.frame = CGRect(origin: CGPoint(), size: extractedRect.size)
|
||||
|
|
@ -457,7 +456,7 @@ class VoiceChatFullscreenParticipantItemNode: ItemListRevealOptionsItemNode {
|
|||
}
|
||||
let currentBoldFont: UIFont = titleFont
|
||||
|
||||
if let user = item.peer as? TelegramUser {
|
||||
if case let .user(user) = item.peer {
|
||||
if let firstName = user.firstName, let lastName = user.lastName, !firstName.isEmpty, !lastName.isEmpty {
|
||||
titleAttributedString = NSAttributedString(string: firstName, font: titleFont, textColor: titleColor)
|
||||
} else if let firstName = user.firstName, !firstName.isEmpty {
|
||||
|
|
@ -467,9 +466,9 @@ class VoiceChatFullscreenParticipantItemNode: ItemListRevealOptionsItemNode {
|
|||
} else {
|
||||
titleAttributedString = NSAttributedString(string: item.presentationData.strings.User_DeletedAccount, font: currentBoldFont, textColor: titleColor)
|
||||
}
|
||||
} else if let group = item.peer as? TelegramGroup {
|
||||
} else if case let .legacyGroup(group) = item.peer {
|
||||
titleAttributedString = NSAttributedString(string: group.title, font: currentBoldFont, textColor: titleColor)
|
||||
} else if let channel = item.peer as? TelegramChannel {
|
||||
} else if case let .channel(channel) = item.peer {
|
||||
titleAttributedString = NSAttributedString(string: channel.title, font: currentBoldFont, textColor: titleColor)
|
||||
}
|
||||
|
||||
|
|
@ -763,7 +762,7 @@ class VoiceChatFullscreenParticipantItemNode: ItemListRevealOptionsItemNode {
|
|||
if item.peer.isDeleted {
|
||||
overrideImage = .deletedIcon
|
||||
}
|
||||
strongSelf.avatarNode.setPeer(context: item.context, theme: item.presentationData.theme, peer: EnginePeer(item.peer), overrideImage: overrideImage, emptyColor: item.presentationData.theme.list.mediaPlaceholderColor, synchronousLoad: synchronousLoad, storeUnrounded: true)
|
||||
strongSelf.avatarNode.setPeer(context: item.context, theme: item.presentationData.theme, peer: item.peer, overrideImage: overrideImage, emptyColor: item.presentationData.theme.list.mediaPlaceholderColor, synchronousLoad: synchronousLoad, storeUnrounded: true)
|
||||
|
||||
var hadMicrophoneNode = false
|
||||
var hadRaiseHandNode = false
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@ import Foundation
|
|||
import UIKit
|
||||
import AsyncDisplayKit
|
||||
import Display
|
||||
import Postbox
|
||||
import TelegramCore
|
||||
import AccountContext
|
||||
import TelegramPresentationData
|
||||
|
|
@ -69,7 +68,7 @@ final class VoiceChatHeaderButton: HighlightableButtonNode {
|
|||
enum Content {
|
||||
case image(UIImage?)
|
||||
case more(UIImage?)
|
||||
case avatar(Peer)
|
||||
case avatar(EnginePeer)
|
||||
}
|
||||
|
||||
private let context: AccountContext
|
||||
|
|
@ -155,7 +154,7 @@ final class VoiceChatHeaderButton: HighlightableButtonNode {
|
|||
self.iconNode.isHidden = false
|
||||
self.avatarNode.isHidden = true
|
||||
case let .avatar(peer):
|
||||
self.avatarNode.setPeer(context: self.context, theme: self.theme, peer: EnginePeer(peer))
|
||||
self.avatarNode.setPeer(context: self.context, theme: self.theme, peer: peer)
|
||||
self.iconNode.isHidden = true
|
||||
self.avatarNode.isHidden = false
|
||||
self.animationNode?.isHidden = true
|
||||
|
|
@ -173,7 +172,7 @@ final class VoiceChatHeaderButton: HighlightableButtonNode {
|
|||
self.iconNode.isHidden = false
|
||||
self.avatarNode.isHidden = true
|
||||
case let .avatar(peer):
|
||||
self.avatarNode.setPeer(context: self.context, theme: self.theme, peer: EnginePeer(peer))
|
||||
self.avatarNode.setPeer(context: self.context, theme: self.theme, peer: peer)
|
||||
self.iconNode.isHidden = true
|
||||
self.avatarNode.isHidden = false
|
||||
self.animationNode?.isHidden = true
|
||||
|
|
|
|||
|
|
@ -9,7 +9,6 @@ import TelegramStringFormatting
|
|||
import TelegramVoip
|
||||
import TelegramAudio
|
||||
import AccountContext
|
||||
import Postbox
|
||||
import TelegramCore
|
||||
import AppBundle
|
||||
import PresentationDataUtils
|
||||
|
|
@ -95,7 +94,7 @@ class VoiceChatPinButtonNode: HighlightTrackingButtonNode {
|
|||
final class VoiceChatMainStageNode: ASDisplayNode {
|
||||
private let context: AccountContext
|
||||
private let call: PresentationGroupCall
|
||||
private(set) var currentPeer: (PeerId, String?, Bool, Bool, Bool)?
|
||||
private(set) var currentPeer: (EnginePeer.Id, String?, Bool, Bool, Bool)?
|
||||
private var currentPeerEntry: VoiceChatPeerEntry?
|
||||
|
||||
var callState: PresentationGroupCallState?
|
||||
|
|
@ -137,12 +136,12 @@ final class VoiceChatMainStageNode: ASDisplayNode {
|
|||
var tapped: (() -> Void)?
|
||||
var back: (() -> Void)?
|
||||
var togglePin: (() -> Void)?
|
||||
var switchTo: ((PeerId) -> Void)?
|
||||
var switchTo: ((EnginePeer.Id) -> Void)?
|
||||
var stopScreencast: (() -> Void)?
|
||||
|
||||
var controlsHidden: ((Bool) -> Void)?
|
||||
|
||||
var getAudioLevel: ((PeerId) -> Signal<Float, NoError>)?
|
||||
var getAudioLevel: ((EnginePeer.Id) -> Signal<Float, NoError>)?
|
||||
var getVideo: ((String, Bool, @escaping (GroupVideoNode?) -> Void) -> Void)?
|
||||
private let videoReadyDisposable = MetaDisposable()
|
||||
private var silenceTimer: SwiftSignalKit.Timer?
|
||||
|
|
@ -610,7 +609,7 @@ final class VoiceChatMainStageNode: ASDisplayNode {
|
|||
self.update(speakingPeerId: nil)
|
||||
}
|
||||
|
||||
private var effectiveSpeakingPeerId: PeerId?
|
||||
private var effectiveSpeakingPeerId: EnginePeer.Id?
|
||||
private func updateSpeakingPeer() {
|
||||
guard let (_, _, _, _, isTablet) = self.validLayout else {
|
||||
return
|
||||
|
|
@ -720,14 +719,14 @@ final class VoiceChatMainStageNode: ASDisplayNode {
|
|||
}
|
||||
}
|
||||
|
||||
private var visiblePeerIds = Set<PeerId>()
|
||||
func update(visiblePeerIds: Set<PeerId>) {
|
||||
private var visiblePeerIds = Set<EnginePeer.Id>()
|
||||
func update(visiblePeerIds: Set<EnginePeer.Id>) {
|
||||
self.visiblePeerIds = visiblePeerIds
|
||||
self.updateSpeakingPeer()
|
||||
}
|
||||
|
||||
private var speakingPeerId: PeerId?
|
||||
func update(speakingPeerId: PeerId?) {
|
||||
private var speakingPeerId: EnginePeer.Id?
|
||||
func update(speakingPeerId: EnginePeer.Id?) {
|
||||
self.speakingPeerId = speakingPeerId
|
||||
self.updateSpeakingPeer()
|
||||
}
|
||||
|
|
@ -738,9 +737,9 @@ final class VoiceChatMainStageNode: ASDisplayNode {
|
|||
|
||||
let peer = peerEntry.peer
|
||||
let presentationData = self.context.sharedContext.currentPresentationData.with { $0 }
|
||||
if !arePeersEqual(previousPeerEntry?.peer, peerEntry.peer) {
|
||||
self.backdropAvatarNode.setSignal(peerAvatarCompleteImage(account: self.context.account, peer: EnginePeer(peer), size: CGSize(width: 240.0, height: 240.0), round: false, font: avatarPlaceholderFont(size: 78.0), drawLetters: false, blurred: true))
|
||||
self.avatarNode.setSignal(peerAvatarCompleteImage(account: self.context.account, peer: EnginePeer(peer), size: CGSize(width: 180.0, height: 180.0), font: avatarPlaceholderFont(size: 78.0), fullSize: true))
|
||||
if previousPeerEntry?.peer != peerEntry.peer {
|
||||
self.backdropAvatarNode.setSignal(peerAvatarCompleteImage(account: self.context.account, peer: peer, size: CGSize(width: 240.0, height: 240.0), round: false, font: avatarPlaceholderFont(size: 78.0), drawLetters: false, blurred: true))
|
||||
self.avatarNode.setSignal(peerAvatarCompleteImage(account: self.context.account, peer: peer, size: CGSize(width: 180.0, height: 180.0), font: avatarPlaceholderFont(size: 78.0), fullSize: true))
|
||||
}
|
||||
|
||||
var gradient: VoiceChatBlobNode.Gradient = .active
|
||||
|
|
@ -778,7 +777,7 @@ final class VoiceChatMainStageNode: ASDisplayNode {
|
|||
}
|
||||
|
||||
var microphoneColor = UIColor.white
|
||||
var titleAttributedString = NSAttributedString(string: EnginePeer(peer).displayTitle(strings: presentationData.strings, displayOrder: presentationData.nameDisplayOrder), font: Font.semibold(15.0), textColor: .white)
|
||||
var titleAttributedString = NSAttributedString(string: peer.displayTitle(strings: presentationData.strings, displayOrder: presentationData.nameDisplayOrder), font: Font.semibold(15.0), textColor: .white)
|
||||
if mutedForYou {
|
||||
microphoneColor = destructiveColor
|
||||
|
||||
|
|
@ -836,7 +835,7 @@ final class VoiceChatMainStageNode: ASDisplayNode {
|
|||
self.audioLevelNode.isHidden = hidden
|
||||
}
|
||||
|
||||
func update(peer: (peer: PeerId, endpointId: String?, isMyPeer: Bool, isPresentation: Bool, isPaused: Bool)?, isReady: Bool = true, waitForFullSize: Bool, completion: (() -> Void)? = nil) {
|
||||
func update(peer: (peer: EnginePeer.Id, endpointId: String?, isMyPeer: Bool, isPresentation: Bool, isPaused: Bool)?, isReady: Bool = true, waitForFullSize: Bool, completion: (() -> Void)? = nil) {
|
||||
let previousPeer = self.currentPeer
|
||||
if previousPeer?.0 == peer?.0 && previousPeer?.1 == peer?.1 && previousPeer?.2 == peer?.2 && previousPeer?.3 == peer?.3 && previousPeer?.4 == peer?.4 {
|
||||
completion?()
|
||||
|
|
|
|||
|
|
@ -78,9 +78,19 @@ public final class EngineMessage: Equatable {
|
|||
public var media: [Media] {
|
||||
return self.impl.media
|
||||
}
|
||||
public var engineMedia: [EngineMedia] {
|
||||
return self.impl.media.map(EngineMedia.init)
|
||||
}
|
||||
public var peers: SimpleDictionary<EnginePeer.Id, Peer> {
|
||||
return self.impl.peers
|
||||
}
|
||||
public var enginePeers: [EnginePeer.Id: EnginePeer] {
|
||||
var result: [EnginePeer.Id: EnginePeer] = [:]
|
||||
for (id, peer) in self.impl.peers {
|
||||
result[id] = EnginePeer(peer)
|
||||
}
|
||||
return result
|
||||
}
|
||||
public var associatedMessages: SimpleDictionary<EngineMessage.Id, Message> {
|
||||
return self.impl.associatedMessages
|
||||
}
|
||||
|
|
@ -228,3 +238,45 @@ public final class EngineMessage: Equatable {
|
|||
return true
|
||||
}
|
||||
}
|
||||
|
||||
public extension EngineMessage {
|
||||
var containsSecretMedia: Bool {
|
||||
return self._asMessage().containsSecretMedia
|
||||
}
|
||||
|
||||
func effectiveReactions(isTags: Bool) -> [MessageReaction]? {
|
||||
return self._asMessage().effectiveReactions(isTags: isTags)
|
||||
}
|
||||
|
||||
func areReactionsTags(accountPeerId: EnginePeer.Id) -> Bool {
|
||||
return self._asMessage().areReactionsTags(accountPeerId: accountPeerId)
|
||||
}
|
||||
|
||||
var textEntitiesAttribute: TextEntitiesMessageAttribute? {
|
||||
return self._asMessage().textEntitiesAttribute
|
||||
}
|
||||
|
||||
var adAttribute: AdMessageAttribute? {
|
||||
return self._asMessage().adAttribute
|
||||
}
|
||||
|
||||
func effectivelyIncoming(_ accountPeerId: EnginePeer.Id) -> Bool {
|
||||
return self._asMessage().effectivelyIncoming(accountPeerId)
|
||||
}
|
||||
|
||||
var pendingProcessingAttribute: PendingProcessingMessageAttribute? {
|
||||
return self._asMessage().pendingProcessingAttribute
|
||||
}
|
||||
|
||||
var scheduleTime: Int32? {
|
||||
return self._asMessage().scheduleTime
|
||||
}
|
||||
|
||||
var scheduleRepeatPeriod: Int32? {
|
||||
return self._asMessage().scheduleRepeatPeriod
|
||||
}
|
||||
|
||||
var sourceAuthorInfo: SourceAuthorInfoMessageAttribute? {
|
||||
return self._asMessage().sourceAuthorInfo
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,13 +4,13 @@ import SwiftSignalKit
|
|||
|
||||
|
||||
public struct PeerCommand: Hashable {
|
||||
public let peer: Peer
|
||||
public let peer: EnginePeer
|
||||
public let command: BotCommand
|
||||
|
||||
|
||||
public static func ==(lhs: PeerCommand, rhs: PeerCommand) -> Bool {
|
||||
return lhs.peer.isEqual(rhs.peer) && lhs.command == rhs.command
|
||||
return lhs.peer == rhs.peer && lhs.command == rhs.command
|
||||
}
|
||||
|
||||
|
||||
public func hash(into hasher: inout Hasher) {
|
||||
hasher.combine(self.peer.id)
|
||||
hasher.combine(self.command)
|
||||
|
|
@ -32,7 +32,7 @@ func _internal_peerCommands(account: Account, id: PeerId) -> Signal<PeerCommands
|
|||
if let botPeer = view.peers[id] {
|
||||
var commands: [PeerCommand] = []
|
||||
for command in botInfo.commands {
|
||||
commands.append(PeerCommand(peer: botPeer, command: command))
|
||||
commands.append(PeerCommand(peer: EnginePeer(botPeer), command: command))
|
||||
}
|
||||
return PeerCommands(commands: commands)
|
||||
}
|
||||
|
|
@ -43,7 +43,7 @@ func _internal_peerCommands(account: Account, id: PeerId) -> Signal<PeerCommands
|
|||
for cachedBotInfo in cachedGroupData.botInfos {
|
||||
if let botPeer = view.peers[cachedBotInfo.peerId] {
|
||||
for command in cachedBotInfo.botInfo.commands {
|
||||
commands.append(PeerCommand(peer: botPeer, command: command))
|
||||
commands.append(PeerCommand(peer: EnginePeer(botPeer), command: command))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -53,7 +53,7 @@ func _internal_peerCommands(account: Account, id: PeerId) -> Signal<PeerCommands
|
|||
for cachedBotInfo in cachedChannelData.botInfos {
|
||||
if let botPeer = view.peers[cachedBotInfo.peerId] {
|
||||
for command in cachedBotInfo.botInfo.commands {
|
||||
commands.append(PeerCommand(peer: botPeer, command: command))
|
||||
commands.append(PeerCommand(peer: EnginePeer(botPeer), command: command))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1513,6 +1513,10 @@ public extension TelegramEngine {
|
|||
public func tokenizeSearchString(string: String, transliteration: EngineStringIndexTokenTransliteration) -> [EngineDataBuffer] {
|
||||
return stringIndexTokens(string, transliteration: transliteration)
|
||||
}
|
||||
|
||||
public func matchSearchTokens(_ tokens: [EngineDataBuffer], with other: [EngineDataBuffer]) -> Bool {
|
||||
return matchStringIndexTokens(tokens, with: other)
|
||||
}
|
||||
|
||||
public func updatePeerStoriesHidden(id: PeerId, isHidden: Bool) {
|
||||
let _ = _internal_updatePeerStoriesHidden(account: self.account, id: id, isHidden: isHidden).start()
|
||||
|
|
|
|||
|
|
@ -287,8 +287,8 @@ public final class ActiveSessionsContext {
|
|||
public struct WebSessionsContextState: Equatable {
|
||||
public var isLoadingMore: Bool
|
||||
public var sessions: [WebAuthorization]
|
||||
public var peers: [PeerId: Peer]
|
||||
|
||||
public var peers: [EnginePeer.Id: EnginePeer]
|
||||
|
||||
public static func ==(lhs: WebSessionsContextState, rhs: WebSessionsContextState) -> Bool {
|
||||
if lhs.isLoadingMore != rhs.isLoadingMore {
|
||||
return false
|
||||
|
|
@ -296,7 +296,7 @@ public struct WebSessionsContextState: Equatable {
|
|||
if lhs.sessions != rhs.sessions {
|
||||
return false
|
||||
}
|
||||
if !arePeerDictionariesEqual(lhs.peers, rhs.peers) {
|
||||
if lhs.peers != rhs.peers {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
|
|
@ -342,14 +342,14 @@ public final class WebSessionsContext {
|
|||
}
|
||||
self._state = WebSessionsContextState(isLoadingMore: true, sessions: self._state.sessions, peers: self._state.peers)
|
||||
self.disposable.set((webSessions(network: account.network)
|
||||
|> map { result -> (sessions: [WebAuthorization], peers: [PeerId: Peer], canLoadMore: Bool) in
|
||||
return (result.0, result.1, false)
|
||||
|> map { result -> (sessions: [WebAuthorization], peers: [EnginePeer.Id: EnginePeer], canLoadMore: Bool) in
|
||||
return (result.0, result.1.mapValues(EnginePeer.init), false)
|
||||
}
|
||||
|> deliverOnMainQueue).start(next: { [weak self] (sessions, peers, canLoadMore) in
|
||||
guard let strongSelf = self else {
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
strongSelf._state = WebSessionsContextState(isLoadingMore: false, sessions: sessions, peers: peers)
|
||||
}))
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,15 +14,15 @@ public enum PeerCacheUsageCategory: Int32 {
|
|||
public struct CacheUsageStats {
|
||||
public let media: [PeerId: [PeerCacheUsageCategory: [MediaId: Int64]]]
|
||||
public let mediaResourceIds: [MediaId: [MediaResourceId]]
|
||||
public let peers: [PeerId: Peer]
|
||||
public let peers: [EnginePeer.Id: EnginePeer]
|
||||
public let otherSize: Int64
|
||||
public let otherPaths: [String]
|
||||
public let cacheSize: Int64
|
||||
public let tempPaths: [String]
|
||||
public let tempSize: Int64
|
||||
public let immutableSize: Int64
|
||||
|
||||
public init(media: [PeerId: [PeerCacheUsageCategory: [MediaId: Int64]]], mediaResourceIds: [MediaId: [MediaResourceId]], peers: [PeerId: Peer], otherSize: Int64, otherPaths: [String], cacheSize: Int64, tempPaths: [String], tempSize: Int64, immutableSize: Int64) {
|
||||
|
||||
public init(media: [PeerId: [PeerCacheUsageCategory: [MediaId: Int64]]], mediaResourceIds: [MediaId: [MediaResourceId]], peers: [EnginePeer.Id: EnginePeer], otherSize: Int64, otherPaths: [String], cacheSize: Int64, tempPaths: [String], tempSize: Int64, immutableSize: Int64) {
|
||||
self.media = media
|
||||
self.mediaResourceIds = mediaResourceIds
|
||||
self.peers = peers
|
||||
|
|
@ -894,7 +894,7 @@ func _internal_collectCacheUsageStats(account: Account, peerId: PeerId? = nil, a
|
|||
subscriber.putNext(.result(CacheUsageStats(
|
||||
media: state.media,
|
||||
mediaResourceIds: state.mediaResourceIds,
|
||||
peers: state.peers,
|
||||
peers: state.peers.mapValues(EnginePeer.init),
|
||||
otherSize: state.otherSize,
|
||||
otherPaths: state.otherPaths,
|
||||
cacheSize: cacheSize,
|
||||
|
|
|
|||
|
|
@ -274,8 +274,8 @@ public extension TelegramEngine {
|
|||
_internal_clearStorage(account: self.account, messages: messages.map { $0._asMessage() })
|
||||
}
|
||||
|
||||
public func clearCachedMediaResources(mediaResourceIds: Set<MediaResourceId>) -> Signal<Float, NoError> {
|
||||
return _internal_clearCachedMediaResources(account: self.account, mediaResourceIds: mediaResourceIds)
|
||||
public func clearCachedMediaResources(mediaResourceIds: Set<EngineMediaResource.Id>) -> Signal<Float, NoError> {
|
||||
return _internal_clearCachedMediaResources(account: self.account, mediaResourceIds: Set(mediaResourceIds.map { MediaResourceId($0.stringRepresentation) }))
|
||||
}
|
||||
|
||||
public func reindexCacheInBackground(lowImpact: Bool) -> Signal<Never, NoError> {
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
import Foundation
|
||||
import SwiftSignalKit
|
||||
import Postbox
|
||||
|
||||
|
|
@ -107,16 +108,34 @@ public final class TelegramEngineUnauthorized {
|
|||
public lazy var localization: Localization = {
|
||||
return Localization(account: self.account)
|
||||
}()
|
||||
|
||||
|
||||
public lazy var payments: Payments = {
|
||||
return Payments(account: self.account)
|
||||
}()
|
||||
|
||||
public lazy var resources: UnauthorizedResources = {
|
||||
return UnauthorizedResources(account: self.account)
|
||||
}()
|
||||
|
||||
public lazy var itemCache: ItemCache = {
|
||||
return ItemCache(account: self.account)
|
||||
}()
|
||||
}
|
||||
|
||||
public extension TelegramEngineUnauthorized {
|
||||
final class UnauthorizedResources {
|
||||
private let account: UnauthorizedAccount
|
||||
|
||||
init(account: UnauthorizedAccount) {
|
||||
self.account = account
|
||||
}
|
||||
|
||||
public func storeResourceData(id: EngineMediaResource.Id, data: Data, synchronous: Bool = false) {
|
||||
self.account.postbox.mediaBox.storeResourceData(MediaResourceId(id.stringRepresentation), data: data, synchronous: synchronous)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public enum SomeTelegramEngine {
|
||||
case unauthorized(TelegramEngineUnauthorized)
|
||||
case authorized(TelegramEngine)
|
||||
|
|
|
|||
|
|
@ -8,3 +8,28 @@ public typealias EngineItemCollectionId = ItemCollectionId
|
|||
public typealias EngineStoryId = StoryId
|
||||
public typealias EngineFetchResourceSourceType = FetchResourceSourceType
|
||||
public typealias EngineFetchResourceError = FetchResourceError
|
||||
public typealias EngineCodableEntry = CodableEntry
|
||||
public typealias EngineNoticeEntryKey = NoticeEntryKey
|
||||
public typealias EngineChatListIndex = ChatListIndex
|
||||
public typealias EngineTempBoxFile = TempBoxFile
|
||||
public typealias EngineItemCollectionItemIndex = ItemCollectionItemIndex
|
||||
public typealias EngineItemCollectionViewEntryIndex = ItemCollectionViewEntryIndex
|
||||
public typealias EngineValueBoxEncryptionParameters = ValueBoxEncryptionParameters
|
||||
public typealias EngineMessageAndThreadId = MessageAndThreadId
|
||||
public typealias EnginePeerStoryStats = PeerStoryStats
|
||||
public typealias EngineMessageHistoryAnchorIndex = MessageHistoryAnchorIndex
|
||||
public typealias EngineChatListTotalUnreadStateCategory = ChatListTotalUnreadStateCategory
|
||||
public typealias EngineChatListTotalUnreadStateStats = ChatListTotalUnreadStateStats
|
||||
public typealias EngineChatListTotalUnreadState = ChatListTotalUnreadState
|
||||
public typealias EngineItemCacheEntryId = ItemCacheEntryId
|
||||
public typealias EnginePeerSummaryCounterTags = PeerSummaryCounterTags
|
||||
public typealias EngineHashFunctions = HashFunctions
|
||||
public typealias EngineCachedMediaResourceRepresentationResult = CachedMediaResourceRepresentationResult
|
||||
public typealias EngineMediaResourceDataFetchResult = MediaResourceDataFetchResult
|
||||
public typealias EngineMediaResourceDataFetchError = MediaResourceDataFetchError
|
||||
public typealias EngineMediaResourceStatus = MediaResourceStatus
|
||||
public typealias EngineCachedPeerData = CachedPeerData
|
||||
|
||||
public func engineFileSize(_ path: String, useTotalFileAllocatedSize: Bool = false) -> Int64? {
|
||||
return fileSize(path, useTotalFileAllocatedSize: useTotalFileAllocatedSize)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,7 +10,6 @@ swift_library(
|
|||
"-warnings-as-errors",
|
||||
],
|
||||
deps = [
|
||||
"//submodules/Postbox:Postbox",
|
||||
"//submodules/TelegramCore:TelegramCore",
|
||||
"//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit",
|
||||
"//submodules/TelegramPermissions:TelegramPermissions",
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -3,7 +3,6 @@ import UIKit
|
|||
import Display
|
||||
import TelegramCore
|
||||
import TelegramUIPreferences
|
||||
import Postbox
|
||||
import SwiftSignalKit
|
||||
|
||||
public func selectDateFillStaticColor(theme: PresentationTheme, wallpaper: TelegramWallpaper) -> UIColor {
|
||||
|
|
@ -1270,7 +1269,7 @@ public extension BuiltinWallpaperData {
|
|||
fileSize: 122246
|
||||
)
|
||||
|
||||
static func generate(account: Account) {
|
||||
static func generate(network: Network) {
|
||||
let slugToName: [(String, String)] = [
|
||||
("fqv01SQemVIBAAAApND8LDRUhRU", "`default`"),
|
||||
("Ye7DfT2kCVIKAAAAhzXfrkdOjxs", "legacy"),
|
||||
|
|
@ -1292,7 +1291,7 @@ public extension BuiltinWallpaperData {
|
|||
|
||||
var signals: [Signal<String?, GetWallpaperError>] = []
|
||||
for (slug, name) in slugToName {
|
||||
signals.append(getWallpaper(network: account.network, slug: slug)
|
||||
signals.append(getWallpaper(network: network, slug: slug)
|
||||
|> map { wallpaper -> String? in
|
||||
switch wallpaper {
|
||||
case let .file(file):
|
||||
|
|
@ -1346,7 +1345,7 @@ public func defaultBuiltinWallpaper(data: BuiltinWallpaperData, colors: [UInt32]
|
|||
isDark: false,
|
||||
slug: data.slug,
|
||||
file: TelegramMediaFile(
|
||||
fileId: MediaId(namespace: Namespaces.Media.CloudFile, id: data.fileId),
|
||||
fileId: EngineMedia.Id(namespace: Namespaces.Media.CloudFile, id: data.fileId),
|
||||
partialReference: nil,
|
||||
resource: CloudDocumentMediaResource(
|
||||
datacenterId: data.datacenterId,
|
||||
|
|
|
|||
|
|
@ -12,7 +12,6 @@ swift_library(
|
|||
deps = [
|
||||
"//submodules/AsyncDisplayKit",
|
||||
"//submodules/Display",
|
||||
"//submodules/Postbox",
|
||||
"//submodules/TelegramCore",
|
||||
"//submodules/SSignalKit/SwiftSignalKit",
|
||||
"//submodules/ComponentFlow",
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@ import Display
|
|||
import AsyncDisplayKit
|
||||
import ComponentFlow
|
||||
import SwiftSignalKit
|
||||
import Postbox
|
||||
import TelegramCore
|
||||
import Markdown
|
||||
import TextFormat
|
||||
|
|
@ -1378,7 +1377,7 @@ public class AdsInfoScreen: ViewController {
|
|||
|
||||
private let context: AccountContext
|
||||
private let mode: Mode
|
||||
private let message: Message?
|
||||
private let message: EngineMessage?
|
||||
private let forceDark: Bool
|
||||
|
||||
private var currentLayout: ContainerViewLayout?
|
||||
|
|
@ -1388,7 +1387,7 @@ public class AdsInfoScreen: ViewController {
|
|||
public init(
|
||||
context: AccountContext,
|
||||
mode: Mode,
|
||||
message: Message? = nil,
|
||||
message: EngineMessage? = nil,
|
||||
forceDark: Bool = false
|
||||
) {
|
||||
self.context = context
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@ import Foundation
|
|||
import UIKit
|
||||
import Display
|
||||
import AsyncDisplayKit
|
||||
import Postbox
|
||||
import TelegramCore
|
||||
import SwiftSignalKit
|
||||
import TelegramPresentationData
|
||||
|
|
@ -149,7 +148,7 @@ private final class ChatButtonKeyboardInputButtonNode: HighlightTrackingButtonNo
|
|||
maxTextWidth -= iconSize.width + iconSpacing
|
||||
|
||||
var animationContent: EmojiStatusComponent.AnimationContent = .customEmoji(fileId: iconFileId)
|
||||
if let file = message.associatedMedia[MediaId(namespace: Namespaces.Media.CloudFile, id: iconFileId)] as? TelegramMediaFile {
|
||||
if let file = message.associatedMedia[EngineMedia.Id(namespace: Namespaces.Media.CloudFile, id: iconFileId)] as? TelegramMediaFile {
|
||||
animationContent = .file(file: file)
|
||||
}
|
||||
|
||||
|
|
@ -208,7 +207,7 @@ public final class ChatButtonKeyboardInputNode: ChatInputNode, UIScrollViewDeleg
|
|||
private let scrollNode: ASScrollNode
|
||||
|
||||
private var buttonNodes: [ChatButtonKeyboardInputButtonNode] = []
|
||||
private var message: Message?
|
||||
private var message: EngineMessage?
|
||||
|
||||
private var theme: PresentationTheme?
|
||||
|
||||
|
|
@ -286,7 +285,7 @@ public final class ChatButtonKeyboardInputNode: ChatInputNode, UIScrollViewDeleg
|
|||
}
|
||||
}
|
||||
|
||||
self.message = interfaceState.keyboardButtonsMessage
|
||||
self.message = interfaceState.keyboardButtonsMessage.flatMap(EngineMessage.init)
|
||||
|
||||
if let markup = validatedMarkup, let message = self.message {
|
||||
let verticalInset: CGFloat = 18.0
|
||||
|
|
@ -325,7 +324,7 @@ public final class ChatButtonKeyboardInputNode: ChatInputNode, UIScrollViewDeleg
|
|||
let buttonFrame = CGRect(origin: CGPoint(x: sideInset + CGFloat(columnIndex) * (buttonWidth + columnSpacing), y: verticalOffset), size: CGSize(width: buttonWidth, height: buttonHeight))
|
||||
buttonNode.frame = buttonFrame
|
||||
buttonNode.tintMaskView.frame = buttonFrame
|
||||
buttonNode.update(context: self.context, size: buttonFrame.size, theme: interfaceState.theme, wallpaperBackgroundNode: self.controllerInteraction.presentationContext.backgroundNode, button: button, message: EngineMessage(message))
|
||||
buttonNode.update(context: self.context, size: buttonFrame.size, theme: interfaceState.theme, wallpaperBackgroundNode: self.controllerInteraction.presentationContext.backgroundNode, button: button, message: message)
|
||||
columnIndex += 1
|
||||
}
|
||||
verticalOffset += buttonHeight + rowSpacing
|
||||
|
|
@ -391,35 +390,35 @@ public final class ChatButtonKeyboardInputNode: ChatInputNode, UIScrollViewDeleg
|
|||
self.controllerInteraction.shareAccountContact()
|
||||
case .openWebApp:
|
||||
if let message = self.message {
|
||||
self.controllerInteraction.requestMessageActionCallback(message, nil, true, false, nil)
|
||||
self.controllerInteraction.requestMessageActionCallback(message._asMessage(), nil, true, false, nil)
|
||||
}
|
||||
case let .callback(requiresPassword, data):
|
||||
if let message = self.message {
|
||||
self.controllerInteraction.requestMessageActionCallback(message, data, false, requiresPassword, nil)
|
||||
self.controllerInteraction.requestMessageActionCallback(message._asMessage(), data, false, requiresPassword, nil)
|
||||
}
|
||||
case let .switchInline(samePeer, query, _):
|
||||
if let message = message {
|
||||
var botPeer: Peer?
|
||||
|
||||
var botPeer: EnginePeer?
|
||||
|
||||
var found = false
|
||||
for attribute in message.attributes {
|
||||
if let attribute = attribute as? InlineBotMessageAttribute, let peerId = attribute.peerId {
|
||||
botPeer = message.peers[peerId]
|
||||
botPeer = message.enginePeers[peerId]
|
||||
found = true
|
||||
}
|
||||
}
|
||||
if !found {
|
||||
botPeer = message.author
|
||||
}
|
||||
|
||||
var peer: Peer?
|
||||
|
||||
var peer: EnginePeer?
|
||||
if samePeer {
|
||||
peer = message.peers[message.id.peerId]
|
||||
peer = message.enginePeers[message.id.peerId]
|
||||
} else {
|
||||
peer = botPeer
|
||||
}
|
||||
if let peer = peer, let botPeer = botPeer, let addressName = botPeer.addressName {
|
||||
self.controllerInteraction.openPeer(EnginePeer(peer), .chat(textInputState: ChatTextInputState(inputText: NSAttributedString(string: "@\(addressName) \(query)")), subject: nil, peekData: nil), nil, .default)
|
||||
self.controllerInteraction.openPeer(peer, .chat(textInputState: ChatTextInputState(inputText: NSAttributedString(string: "@\(addressName) \(query)")), subject: nil, peekData: nil), nil, .default)
|
||||
}
|
||||
}
|
||||
case .payment:
|
||||
|
|
@ -452,7 +451,7 @@ public final class ChatButtonKeyboardInputNode: ChatInputNode, UIScrollViewDeleg
|
|||
for attribute in message.attributes {
|
||||
if let attribute = attribute as? ReplyMarkupMessageAttribute {
|
||||
if attribute.flags.contains(.once) {
|
||||
self.controllerInteraction.dismissReplyMarkupMessage(message)
|
||||
self.controllerInteraction.dismissReplyMarkupMessage(message._asMessage())
|
||||
}
|
||||
break
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,7 +13,6 @@ swift_library(
|
|||
"//submodules/AsyncDisplayKit",
|
||||
"//submodules/Display",
|
||||
"//submodules/TelegramCore",
|
||||
"//submodules/Postbox",
|
||||
"//submodules/SSignalKit/SwiftSignalKit",
|
||||
"//submodules/TelegramPresentationData",
|
||||
"//submodules/AlertUI",
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@ import UIKit
|
|||
import AsyncDisplayKit
|
||||
import Display
|
||||
import TelegramCore
|
||||
import Postbox
|
||||
import SwiftSignalKit
|
||||
import TelegramPresentationData
|
||||
import AlertUI
|
||||
|
|
@ -63,7 +62,7 @@ private func titleAndColorForAction(_ action: SubscriberAction, theme: Presentat
|
|||
}
|
||||
}
|
||||
|
||||
private func actionForPeer(context: AccountContext, peer: Peer, interfaceState: ChatPresentationInterfaceState, isJoining: Bool, isMuted: Bool) -> SubscriberAction? {
|
||||
private func actionForPeer(context: AccountContext, peer: EnginePeer, interfaceState: ChatPresentationInterfaceState, isJoining: Bool, isMuted: Bool) -> SubscriberAction? {
|
||||
if case let .replyThread(message) = interfaceState.chatLocation, message.peerId == context.account.peerId {
|
||||
if let peer = interfaceState.savedMessagesTopicPeer {
|
||||
if case let .channel(channel) = peer {
|
||||
|
|
@ -79,9 +78,9 @@ private func actionForPeer(context: AccountContext, peer: Peer, interfaceState:
|
|||
return .openChat
|
||||
} else if case .pinnedMessages = interfaceState.subject {
|
||||
var canManagePin = false
|
||||
if let channel = peer as? TelegramChannel {
|
||||
if case let .channel(channel) = peer {
|
||||
canManagePin = channel.hasPermission(.pinMessages)
|
||||
} else if let group = peer as? TelegramGroup {
|
||||
} else if case let .legacyGroup(group) = peer {
|
||||
switch group.role {
|
||||
case .creator, .admin:
|
||||
canManagePin = true
|
||||
|
|
@ -92,7 +91,7 @@ private func actionForPeer(context: AccountContext, peer: Peer, interfaceState:
|
|||
canManagePin = true
|
||||
}
|
||||
}
|
||||
} else if let _ = peer as? TelegramUser, interfaceState.explicitelyCanPinMessages {
|
||||
} else if case .user = peer, interfaceState.explicitelyCanPinMessages {
|
||||
canManagePin = true
|
||||
}
|
||||
if canManagePin {
|
||||
|
|
@ -101,7 +100,7 @@ private func actionForPeer(context: AccountContext, peer: Peer, interfaceState:
|
|||
return .hidePinnedMessages
|
||||
}
|
||||
} else {
|
||||
if let channel = peer as? TelegramChannel {
|
||||
if case let .channel(channel) = peer {
|
||||
if case .broadcast = channel.info, isJoining {
|
||||
if isMuted {
|
||||
return .unmuteNotifications
|
||||
|
|
@ -401,7 +400,7 @@ public final class ChatChannelSubscriberInputPanelNode: ChatInputPanelNode {
|
|||
self.presentationInterfaceState = interfaceState
|
||||
|
||||
var centerAction: (title: String, isAccent: Bool)?
|
||||
if let context = self.context, let peer = interfaceState.renderedPeer?.peer, let action = actionForPeer(context: context, peer: peer, interfaceState: interfaceState, isJoining: self.isJoining, isMuted: interfaceState.peerIsMuted) {
|
||||
if let context = self.context, let peer = interfaceState.renderedPeer?.peer, let action = actionForPeer(context: context, peer: EnginePeer(peer), interfaceState: interfaceState, isJoining: self.isJoining, isMuted: interfaceState.peerIsMuted) {
|
||||
self.action = action
|
||||
let (title, _) = titleAndColorForAction(action, theme: interfaceState.theme, strings: interfaceState.strings)
|
||||
|
||||
|
|
|
|||
|
|
@ -13,7 +13,6 @@ swift_library(
|
|||
"//submodules/AsyncDisplayKit",
|
||||
"//submodules/Display",
|
||||
"//submodules/SSignalKit/SwiftSignalKit",
|
||||
"//submodules/Postbox",
|
||||
"//submodules/TelegramCore",
|
||||
"//submodules/TelegramPresentationData",
|
||||
"//submodules/AppBundle",
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@ import UIKit
|
|||
import AsyncDisplayKit
|
||||
import Display
|
||||
import SwiftSignalKit
|
||||
import Postbox
|
||||
import TelegramCore
|
||||
import TelegramPresentationData
|
||||
import AppBundle
|
||||
|
|
@ -252,10 +251,10 @@ public final class ChatEmptyNodeGreetingChatContent: ASDisplayNode, ChatEmptyNod
|
|||
)
|
||||
inputNodeInteraction.displayStickerPlaceholder = false
|
||||
|
||||
let index = ItemCollectionItemIndex(index: 0, id: 0)
|
||||
let collectionId = ItemCollectionId(namespace: 0, id: 0)
|
||||
let index = EngineItemCollectionItemIndex(index: 0, id: 0)
|
||||
let collectionId = EngineItemCollectionId(namespace: 0, id: 0)
|
||||
let stickerPackItem = StickerPackItem(index: index, file: sticker, indexKeys: [])
|
||||
let item = ChatMediaInputStickerGridItem(context: strongSelf.context, collectionId: collectionId, stickerPackInfo: nil, index: ItemCollectionViewEntryIndex(collectionIndex: 0, collectionId: collectionId, itemIndex: index), stickerItem: stickerPackItem, canManagePeerSpecificPack: nil, interfaceInteraction: nil, inputNodeInteraction: inputNodeInteraction, hasAccessory: false, theme: interfaceState.theme, large: true, selected: {})
|
||||
let item = ChatMediaInputStickerGridItem(context: strongSelf.context, collectionId: collectionId, stickerPackInfo: nil, index: EngineItemCollectionViewEntryIndex(collectionIndex: 0, collectionId: collectionId, itemIndex: index), stickerItem: stickerPackItem, canManagePeerSpecificPack: nil, interfaceInteraction: nil, inputNodeInteraction: inputNodeInteraction, hasAccessory: false, theme: interfaceState.theme, large: true, selected: {})
|
||||
strongSelf.stickerItem = item
|
||||
|
||||
if isFirstTime {
|
||||
|
|
|
|||
|
|
@ -353,13 +353,13 @@ public final class ChatHistorySearchContainerNode: SearchDisplayControllerConten
|
|||
}
|
||||
}
|
||||
|
||||
public func messageForGallery(_ id: MessageId) -> Message? {
|
||||
public func messageForGallery(_ id: EngineMessage.Id) -> EngineMessage? {
|
||||
if let currentEntries = self.currentEntries {
|
||||
for entry in currentEntries {
|
||||
switch entry {
|
||||
case let .message(message, _, _, _, _):
|
||||
if message.id == id {
|
||||
return message
|
||||
return EngineMessage(message)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@ import UIKit
|
|||
import AsyncDisplayKit
|
||||
import SwiftSignalKit
|
||||
import Display
|
||||
import Postbox
|
||||
import TelegramCore
|
||||
import TelegramPresentationData
|
||||
import ActivityIndicator
|
||||
|
|
@ -421,16 +420,16 @@ public final class ChatLoadingPlaceholderNode: ASDisplayNode {
|
|||
case channel
|
||||
}
|
||||
private var chatType: ChatType = .channel
|
||||
public func updatePresentationInterfaceState(renderedPeer: RenderedPeer?, chatLocation: ChatLocation) {
|
||||
public func updatePresentationInterfaceState(renderedPeer: EngineRenderedPeer?, chatLocation: ChatLocation) {
|
||||
var chatType: ChatType = .channel
|
||||
if let peer = renderedPeer?.peer {
|
||||
if peer is TelegramUser {
|
||||
if case .user = peer {
|
||||
chatType = .user
|
||||
} else if peer is TelegramGroup {
|
||||
} else if case .legacyGroup = peer {
|
||||
chatType = .group
|
||||
} else if let channel = peer as? TelegramChannel {
|
||||
} else if case let .channel(channel) = peer {
|
||||
if channel.isMonoForum {
|
||||
if let mainChannel = renderedPeer?.chatOrMonoforumMainPeer as? TelegramChannel, mainChannel.hasPermission(.manageDirect) {
|
||||
if case let .channel(mainChannel) = renderedPeer?.chatOrMonoforumMainPeer, mainChannel.hasPermission(.manageDirect) {
|
||||
if chatLocation.threadId == nil {
|
||||
chatType = .group
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -13,7 +13,6 @@ swift_library(
|
|||
"//submodules/SSignalKit/SwiftSignalKit",
|
||||
"//submodules/AsyncDisplayKit",
|
||||
"//submodules/TelegramCore",
|
||||
"//submodules/Postbox",
|
||||
"//submodules/Display",
|
||||
"//submodules/TelegramPresentationData",
|
||||
"//submodules/AccountContext",
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@ import Foundation
|
|||
import UIKit
|
||||
import AsyncDisplayKit
|
||||
import TelegramCore
|
||||
import Postbox
|
||||
import Display
|
||||
import TelegramPresentationData
|
||||
import AccountContext
|
||||
|
|
@ -221,7 +220,7 @@ private final class ChatMessageActionButtonNode: ASDisplayNode {
|
|||
}
|
||||
}
|
||||
|
||||
class func asyncLayout(_ maybeNode: ChatMessageActionButtonNode?) -> (_ context: AccountContext, _ theme: ChatPresentationThemeData, _ bubbleCorners: PresentationChatBubbleCorners, _ strings: PresentationStrings, _ backgroundNode: WallpaperBackgroundNode?, _ message: Message, _ button: ReplyMarkupButton, _ customInfo: ChatMessageActionButtonsNode.CustomInfo?, _ constrainedWidth: CGFloat, _ position: MessageBubbleActionButtonPosition) -> (minimumWidth: CGFloat, layout: ((CGFloat) -> (CGSize, (ListViewItemUpdateAnimation) -> ChatMessageActionButtonNode))) {
|
||||
class func asyncLayout(_ maybeNode: ChatMessageActionButtonNode?) -> (_ context: AccountContext, _ theme: ChatPresentationThemeData, _ bubbleCorners: PresentationChatBubbleCorners, _ strings: PresentationStrings, _ backgroundNode: WallpaperBackgroundNode?, _ message: EngineMessage, _ button: ReplyMarkupButton, _ customInfo: ChatMessageActionButtonsNode.CustomInfo?, _ constrainedWidth: CGFloat, _ position: MessageBubbleActionButtonPosition) -> (minimumWidth: CGFloat, layout: ((CGFloat) -> (CGSize, (ListViewItemUpdateAnimation) -> ChatMessageActionButtonNode))) {
|
||||
let titleLayout = TextNode.asyncLayout(maybeNode?.titleNode)
|
||||
|
||||
return { context, theme, bubbleCorners, strings, backgroundNode, message, button, customInfo, constrainedWidth, position in
|
||||
|
|
@ -543,7 +542,7 @@ private final class ChatMessageActionButtonNode: ASDisplayNode {
|
|||
}
|
||||
|
||||
var animationContent: EmojiStatusComponent.AnimationContent = .customEmoji(fileId: iconFileId)
|
||||
if let file = message.associatedMedia[MediaId(namespace: Namespaces.Media.CloudFile, id: iconFileId)] as? TelegramMediaFile {
|
||||
if let file = message.associatedMedia[EngineMedia.Id(namespace: Namespaces.Media.CloudFile, id: iconFileId)] as? TelegramMediaFile {
|
||||
animationContent = .file(file: file)
|
||||
}
|
||||
|
||||
|
|
@ -661,7 +660,7 @@ public final class ChatMessageActionButtonsNode: ASDisplayNode {
|
|||
}
|
||||
}
|
||||
|
||||
public class func asyncLayout(_ maybeNode: ChatMessageActionButtonsNode?) -> (_ context: AccountContext, _ theme: ChatPresentationThemeData, _ chatBubbleCorners: PresentationChatBubbleCorners, _ strings: PresentationStrings, _ backgroundNode: WallpaperBackgroundNode?, _ replyMarkup: ReplyMarkupMessageAttribute, _ customInfos: [MemoryBuffer: CustomInfo], _ message: Message, _ constrainedWidth: CGFloat) -> (minWidth: CGFloat, layout: (CGFloat) -> (CGSize, (_ animation: ListViewItemUpdateAnimation) -> ChatMessageActionButtonsNode)) {
|
||||
public class func asyncLayout(_ maybeNode: ChatMessageActionButtonsNode?) -> (_ context: AccountContext, _ theme: ChatPresentationThemeData, _ chatBubbleCorners: PresentationChatBubbleCorners, _ strings: PresentationStrings, _ backgroundNode: WallpaperBackgroundNode?, _ replyMarkup: ReplyMarkupMessageAttribute, _ customInfos: [EngineMemoryBuffer: CustomInfo], _ message: EngineMessage, _ constrainedWidth: CGFloat) -> (minWidth: CGFloat, layout: (CGFloat) -> (CGSize, (_ animation: ListViewItemUpdateAnimation) -> ChatMessageActionButtonsNode)) {
|
||||
let currentButtonLayouts = maybeNode?.buttonNodes.map { ChatMessageActionButtonNode.asyncLayout($0) } ?? []
|
||||
|
||||
return { context, theme, chatBubbleCorners, strings, backgroundNode, replyMarkup, customInfos, message, constrainedWidth in
|
||||
|
|
|
|||
|
|
@ -505,7 +505,7 @@ public class ChatMessageAnimatedStickerItemNode: ChatMessageItemView {
|
|||
|
||||
var emojiFile: TelegramMediaFile?
|
||||
var emojiString: String?
|
||||
if messageIsEligibleForLargeCustomEmoji(item.message) || messageIsEligibleForLargeEmoji(item.message) {
|
||||
if messageIsEligibleForLargeCustomEmoji(EngineMessage(item.message)) || messageIsEligibleForLargeEmoji(EngineMessage(item.message)) {
|
||||
emojiString = item.message.text
|
||||
}
|
||||
|
||||
|
|
@ -1152,7 +1152,7 @@ public class ChatMessageAnimatedStickerItemNode: ChatMessageItemView {
|
|||
tonAmount = stakeTonAmount
|
||||
}
|
||||
|
||||
let dateText = stringForMessageTimestampStatus(accountPeerId: item.context.account.peerId, message: item.message, dateTimeFormat: item.presentationData.dateTimeFormat, nameDisplayOrder: item.presentationData.nameDisplayOrder, strings: item.presentationData.strings, format: .regular, associatedData: item.associatedData)
|
||||
let dateText = stringForMessageTimestampStatus(accountPeerId: item.context.account.peerId, message: EngineMessage(item.message), dateTimeFormat: item.presentationData.dateTimeFormat, nameDisplayOrder: item.presentationData.nameDisplayOrder, strings: item.presentationData.strings, format: .regular, associatedData: item.associatedData)
|
||||
|
||||
var isReplyThread = false
|
||||
if case .replyThread = item.chatLocation {
|
||||
|
|
@ -1168,7 +1168,7 @@ public class ChatMessageAnimatedStickerItemNode: ChatMessageItemView {
|
|||
impressionCount: viewCount,
|
||||
dateText: dateText,
|
||||
type: statusType,
|
||||
layoutInput: .standalone(reactionSettings: shouldDisplayInlineDateReactions(message: item.message, isPremium: item.associatedData.isPremium, forceInline: item.associatedData.forceInlineReactions) ? ChatMessageDateAndStatusNode.StandaloneReactionSettings() : nil),
|
||||
layoutInput: .standalone(reactionSettings: shouldDisplayInlineDateReactions(message: EngineMessage(item.message), isPremium: item.associatedData.isPremium, forceInline: item.associatedData.forceInlineReactions) ? ChatMessageDateAndStatusNode.StandaloneReactionSettings() : nil),
|
||||
constrainedSize: CGSize(width: params.width, height: CGFloat.greatestFiniteMagnitude),
|
||||
availableReactions: item.associatedData.availableReactions,
|
||||
savedMessageTags: item.associatedData.savedMessageTags,
|
||||
|
|
@ -1183,7 +1183,7 @@ public class ChatMessageAnimatedStickerItemNode: ChatMessageItemView {
|
|||
tonAmount: tonAmount,
|
||||
isPinned: item.message.tags.contains(.pinned) && !item.associatedData.isInPinnedListMode && !isReplyThread,
|
||||
hasAutoremove: item.message.isSelfExpiring,
|
||||
canViewReactionList: canViewMessageReactionList(message: item.message),
|
||||
canViewReactionList: canViewMessageReactionList(message: EngineMessage(item.message)),
|
||||
animationCache: item.controllerInteraction.presentationContext.animationCache,
|
||||
animationRenderer: item.controllerInteraction.presentationContext.animationRenderer
|
||||
))
|
||||
|
|
@ -1352,7 +1352,7 @@ public class ChatMessageAnimatedStickerItemNode: ChatMessageItemView {
|
|||
}
|
||||
}
|
||||
let availableWidth = max(60.0, availableContentWidth + 6.0)
|
||||
forwardInfoSizeApply = makeForwardInfoLayout(item.context, item.presentationData, item.presentationData.strings, .standalone, forwardSource, forwardAuthorSignature, forwardPsaType, nil, CGSize(width: availableWidth, height: CGFloat.greatestFiniteMagnitude))
|
||||
forwardInfoSizeApply = makeForwardInfoLayout(item.context, item.presentationData, item.presentationData.strings, .standalone, forwardSource.flatMap(EnginePeer.init), forwardAuthorSignature, forwardPsaType, nil, CGSize(width: availableWidth, height: CGFloat.greatestFiniteMagnitude))
|
||||
}
|
||||
|
||||
var needsReplyBackground = false
|
||||
|
|
@ -1370,7 +1370,7 @@ public class ChatMessageAnimatedStickerItemNode: ChatMessageItemView {
|
|||
var maxContentWidth = imageSize.width
|
||||
var actionButtonsFinalize: ((CGFloat) -> (CGSize, (_ animation: ListViewItemUpdateAnimation) -> ChatMessageActionButtonsNode))?
|
||||
if let replyMarkup = replyMarkup {
|
||||
let (minWidth, buttonsLayout) = actionButtonsLayout(item.context, item.presentationData.theme, item.presentationData.chatBubbleCorners, item.presentationData.strings, item.controllerInteraction.presentationContext.backgroundNode, replyMarkup, [:], item.message, baseWidth)
|
||||
let (minWidth, buttonsLayout) = actionButtonsLayout(item.context, item.presentationData.theme, item.presentationData.chatBubbleCorners, item.presentationData.strings, item.controllerInteraction.presentationContext.backgroundNode, replyMarkup, [:], EngineMessage(item.message), baseWidth)
|
||||
maxContentWidth = max(maxContentWidth, minWidth)
|
||||
actionButtonsFinalize = buttonsLayout
|
||||
} else if incoming, let attribute = item.message.attributes.first(where: { $0 is SuggestedPostMessageAttribute }) as? SuggestedPostMessageAttribute, attribute.state == nil {
|
||||
|
|
@ -1419,7 +1419,7 @@ public class ChatMessageAnimatedStickerItemNode: ChatMessageItemView {
|
|||
],
|
||||
flags: [],
|
||||
placeholder: nil
|
||||
), customInfos, item.message, baseWidth)
|
||||
), customInfos, EngineMessage(item.message), baseWidth)
|
||||
maxContentWidth = max(maxContentWidth, minWidth)
|
||||
actionButtonsFinalize = buttonsLayout
|
||||
}
|
||||
|
|
@ -1430,7 +1430,7 @@ public class ChatMessageAnimatedStickerItemNode: ChatMessageItemView {
|
|||
}
|
||||
|
||||
let reactions: ReactionsMessageAttribute
|
||||
if shouldDisplayInlineDateReactions(message: item.message, isPremium: item.associatedData.isPremium, forceInline: item.associatedData.forceInlineReactions) {
|
||||
if shouldDisplayInlineDateReactions(message: EngineMessage(item.message), isPremium: item.associatedData.isPremium, forceInline: item.associatedData.forceInlineReactions) {
|
||||
reactions = ReactionsMessageAttribute(canViewList: false, isTags: false, reactions: [], recentPeers: [], topPeers: [])
|
||||
} else {
|
||||
reactions = mergedMessageReactions(attributes: item.message.attributes, isTags: item.message.areReactionsTags(accountPeerId: item.context.account.peerId)) ?? ReactionsMessageAttribute(canViewList: false, isTags: false, reactions: [], recentPeers: [], topPeers: [])
|
||||
|
|
@ -1447,7 +1447,7 @@ public class ChatMessageAnimatedStickerItemNode: ChatMessageItemView {
|
|||
availableReactions: item.associatedData.availableReactions,
|
||||
savedMessageTags: item.associatedData.savedMessageTags,
|
||||
reactions: reactions,
|
||||
message: item.message,
|
||||
message: EngineMessage(item.message),
|
||||
associatedData: item.associatedData,
|
||||
accountPeer: item.associatedData.accountPeer,
|
||||
isIncoming: item.message.effectivelyIncoming(item.context.account.peerId),
|
||||
|
|
@ -1712,7 +1712,7 @@ public class ChatMessageAnimatedStickerItemNode: ChatMessageItemView {
|
|||
strongSelf?.openQuickShare(node: node, gesture: gesture)
|
||||
}
|
||||
}
|
||||
let buttonSize = updatedShareButtonNode.update(presentationData: item.presentationData, controllerInteraction: item.controllerInteraction, chatLocation: item.chatLocation, subject: item.associatedData.subject, message: item.message, account: item.context.account)
|
||||
let buttonSize = updatedShareButtonNode.update(presentationData: item.presentationData, controllerInteraction: item.controllerInteraction, chatLocation: item.chatLocation, subject: item.associatedData.subject, message: EngineMessage(item.message), accountPeerId: item.context.account.peerId)
|
||||
animation.animator.updateFrame(layer: updatedShareButtonNode.layer, frame: CGRect(origin: CGPoint(x: !incoming ? updatedImageFrame.minX - buttonSize.width - 6.0 : updatedImageFrame.maxX + 8.0, y: updatedImageFrame.maxY - buttonSize.height - 4.0 + imageBottomPadding), size: buttonSize), completion: nil)
|
||||
} else if let shareButtonNode = strongSelf.shareButtonNode {
|
||||
shareButtonNode.removeFromSupernode()
|
||||
|
|
@ -2076,7 +2076,7 @@ public class ChatMessageAnimatedStickerItemNode: ChatMessageItemView {
|
|||
case let .optionalAction(f):
|
||||
f()
|
||||
case let .openContextMenu(openContextMenu):
|
||||
if canAddMessageReactions(message: item.message) {
|
||||
if canAddMessageReactions(message: EngineMessage(item.message)) {
|
||||
item.controllerInteraction.updateMessageReaction(item.message, .default, false, nil)
|
||||
} else {
|
||||
item.controllerInteraction.openMessageContextMenu(openContextMenu.tapMessage, openContextMenu.selectAll, self, openContextMenu.subFrame, nil, nil)
|
||||
|
|
@ -2085,7 +2085,7 @@ public class ChatMessageAnimatedStickerItemNode: ChatMessageItemView {
|
|||
} else if case .tap = gesture {
|
||||
item.controllerInteraction.clickThroughMessage(self.view, location)
|
||||
} else if case .doubleTap = gesture {
|
||||
if canAddMessageReactions(message: item.message) {
|
||||
if canAddMessageReactions(message: EngineMessage(item.message)) {
|
||||
item.controllerInteraction.updateMessageReaction(item.message, .default, false, nil)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -714,7 +714,7 @@ public final class ChatMessageAttachedContentNode: ASDisplayNode {
|
|||
} else {
|
||||
dateFormat = .regular
|
||||
}
|
||||
let dateText = stringForMessageTimestampStatus(accountPeerId: context.account.peerId, message: message, dateTimeFormat: presentationData.dateTimeFormat, nameDisplayOrder: presentationData.nameDisplayOrder, strings: presentationData.strings, format: dateFormat, associatedData: associatedData)
|
||||
let dateText = stringForMessageTimestampStatus(accountPeerId: context.account.peerId, message: EngineMessage(message), dateTimeFormat: presentationData.dateTimeFormat, nameDisplayOrder: presentationData.nameDisplayOrder, strings: presentationData.strings, format: dateFormat, associatedData: associatedData)
|
||||
|
||||
let statusType: ChatMessageDateAndStatusType
|
||||
if incoming {
|
||||
|
|
@ -753,7 +753,7 @@ public final class ChatMessageAttachedContentNode: ASDisplayNode {
|
|||
type: statusType,
|
||||
layoutInput: .trailingContent(
|
||||
contentWidth: trailingContentWidth,
|
||||
reactionSettings: ChatMessageDateAndStatusNode.TrailingReactionSettings(displayInline: shouldDisplayInlineDateReactions(message: message, isPremium: associatedData.isPremium, forceInline: associatedData.forceInlineReactions), preferAdditionalInset: false)
|
||||
reactionSettings: ChatMessageDateAndStatusNode.TrailingReactionSettings(displayInline: shouldDisplayInlineDateReactions(message: EngineMessage(message), isPremium: associatedData.isPremium, forceInline: associatedData.forceInlineReactions), preferAdditionalInset: false)
|
||||
),
|
||||
constrainedSize: CGSize(width: maxStatusContentWidth, height: CGFloat.greatestFiniteMagnitude),
|
||||
availableReactions: associatedData.availableReactions,
|
||||
|
|
@ -768,7 +768,7 @@ public final class ChatMessageAttachedContentNode: ASDisplayNode {
|
|||
starsCount: starsCount,
|
||||
isPinned: message.tags.contains(.pinned) && !associatedData.isInPinnedListMode && !isReplyThread,
|
||||
hasAutoremove: message.isSelfExpiring,
|
||||
canViewReactionList: canViewMessageReactionList(message: message),
|
||||
canViewReactionList: canViewMessageReactionList(message: EngineMessage(message)),
|
||||
animationCache: controllerInteraction.presentationContext.animationCache,
|
||||
animationRenderer: controllerInteraction.presentationContext.animationRenderer
|
||||
))
|
||||
|
|
|
|||
|
|
@ -258,7 +258,7 @@ private func contentNodeMessagesAndClassesForItem(_ item: ChatMessageItem) -> ([
|
|||
} else if case .copyProtectionRequest = action.action {
|
||||
result.append((message, ChatMessageDisableCopyProtectionBubbleContentNode.self, itemAttributes, BubbleItemAttributes(isAttachment: false, neighborType: .text, neighborSpacing: .default)))
|
||||
} else {
|
||||
if !canAddMessageReactions(message: message) {
|
||||
if !canAddMessageReactions(message: EngineMessage(message)) {
|
||||
needReactions = false
|
||||
}
|
||||
result.append((message, ChatMessageActionBubbleContentNode.self, itemAttributes, BubbleItemAttributes(isAttachment: false, neighborType: .text, neighborSpacing: .default)))
|
||||
|
|
@ -451,7 +451,7 @@ private func contentNodeMessagesAndClassesForItem(_ item: ChatMessageItem) -> ([
|
|||
let firstMessage = item.content.firstMessage
|
||||
|
||||
let reactionsAreInline: Bool
|
||||
reactionsAreInline = shouldDisplayInlineDateReactions(message: firstMessage, isPremium: item.associatedData.isPremium, forceInline: item.associatedData.forceInlineReactions)
|
||||
reactionsAreInline = shouldDisplayInlineDateReactions(message: EngineMessage(firstMessage), isPremium: item.associatedData.isPremium, forceInline: item.associatedData.forceInlineReactions)
|
||||
if reactionsAreInline {
|
||||
needReactions = false
|
||||
}
|
||||
|
|
@ -1566,9 +1566,9 @@ public class ChatMessageBubbleItemNode: ChatMessageItemView, ChatMessagePreviewI
|
|||
rankBadgeLayout: (TextNodeLayoutArguments) -> (TextNodeLayout, () -> TextNode),
|
||||
boostBadgeLayout: (TextNodeLayoutArguments) -> (TextNodeLayout, () -> TextNode),
|
||||
threadInfoLayout: (ChatMessageThreadInfoNode.Arguments) -> (CGSize, (Bool) -> ChatMessageThreadInfoNode),
|
||||
forwardInfoLayout: (AccountContext, ChatPresentationData, PresentationStrings, ChatMessageForwardInfoType, Peer?, String?, String?, ChatMessageForwardInfoNode.StoryData?, CGSize) -> (CGSize, (CGFloat) -> ChatMessageForwardInfoNode),
|
||||
forwardInfoLayout: (AccountContext, ChatPresentationData, PresentationStrings, ChatMessageForwardInfoType, EnginePeer?, String?, String?, ChatMessageForwardInfoNode.StoryData?, CGSize) -> (CGSize, (CGFloat) -> ChatMessageForwardInfoNode),
|
||||
replyInfoLayout: (ChatMessageReplyInfoNode.Arguments) -> (CGSize, (CGSize, Bool, ListViewItemUpdateAnimation) -> ChatMessageReplyInfoNode),
|
||||
actionButtonsLayout: (AccountContext, ChatPresentationThemeData, PresentationChatBubbleCorners, PresentationStrings, WallpaperBackgroundNode?, ReplyMarkupMessageAttribute, [MemoryBuffer: ChatMessageActionButtonsNode.CustomInfo], Message, CGFloat) -> (minWidth: CGFloat, layout: (CGFloat) -> (CGSize, (ListViewItemUpdateAnimation) -> ChatMessageActionButtonsNode)),
|
||||
actionButtonsLayout: (AccountContext, ChatPresentationThemeData, PresentationChatBubbleCorners, PresentationStrings, WallpaperBackgroundNode?, ReplyMarkupMessageAttribute, [EngineMemoryBuffer: ChatMessageActionButtonsNode.CustomInfo], EngineMessage, CGFloat) -> (minWidth: CGFloat, layout: (CGFloat) -> (CGSize, (ListViewItemUpdateAnimation) -> ChatMessageActionButtonsNode)),
|
||||
reactionButtonsLayout: (ChatMessageReactionButtonsNode.Arguments) -> (minWidth: CGFloat, layout: (CGFloat) -> (size: CGSize, apply: (ListViewItemUpdateAnimation) -> ChatMessageReactionButtonsNode)),
|
||||
unlockButtonLayout: (ChatMessageUnlockMediaNode.Arguments) -> (CGSize, (Bool) -> ChatMessageUnlockMediaNode),
|
||||
mediaInfoLayout: (ChatMessageStarsMediaInfoNode.Arguments) -> (CGSize, (Bool) -> ChatMessageStarsMediaInfoNode),
|
||||
|
|
@ -2531,7 +2531,7 @@ public class ChatMessageBubbleItemNode: ChatMessageItemView, ChatMessagePreviewI
|
|||
} else {
|
||||
dateFormat = .regular
|
||||
}
|
||||
let dateText = stringForMessageTimestampStatus(accountPeerId: item.context.account.peerId, message: message, dateTimeFormat: item.presentationData.dateTimeFormat, nameDisplayOrder: item.presentationData.nameDisplayOrder, strings: item.presentationData.strings, format: dateFormat, associatedData: item.associatedData)
|
||||
let dateText = stringForMessageTimestampStatus(accountPeerId: item.context.account.peerId, message: EngineMessage(message), dateTimeFormat: item.presentationData.dateTimeFormat, nameDisplayOrder: item.presentationData.nameDisplayOrder, strings: item.presentationData.strings, format: dateFormat, associatedData: item.associatedData)
|
||||
|
||||
let statusType: ChatMessageDateAndStatusType
|
||||
if incoming {
|
||||
|
|
@ -2558,7 +2558,7 @@ public class ChatMessageBubbleItemNode: ChatMessageItemView, ChatMessagePreviewI
|
|||
impressionCount: !item.presentationData.isPreview ? viewCount : nil,
|
||||
dateText: dateText,
|
||||
type: statusType,
|
||||
layoutInput: .standalone(reactionSettings: shouldDisplayInlineDateReactions(message: item.message, isPremium: item.associatedData.isPremium, forceInline: item.associatedData.forceInlineReactions) ? ChatMessageDateAndStatusNode.StandaloneReactionSettings() : nil),
|
||||
layoutInput: .standalone(reactionSettings: shouldDisplayInlineDateReactions(message: EngineMessage(item.message), isPremium: item.associatedData.isPremium, forceInline: item.associatedData.forceInlineReactions) ? ChatMessageDateAndStatusNode.StandaloneReactionSettings() : nil),
|
||||
constrainedSize: CGSize(width: 200.0, height: CGFloat.greatestFiniteMagnitude),
|
||||
availableReactions: item.associatedData.availableReactions,
|
||||
savedMessageTags: item.associatedData.savedMessageTags,
|
||||
|
|
@ -2572,7 +2572,7 @@ public class ChatMessageBubbleItemNode: ChatMessageItemView, ChatMessagePreviewI
|
|||
starsCount: starsCount,
|
||||
isPinned: message.tags.contains(.pinned) && !item.associatedData.isInPinnedListMode && !isReplyThread,
|
||||
hasAutoremove: message.isSelfExpiring,
|
||||
canViewReactionList: canViewMessageReactionList(message: message),
|
||||
canViewReactionList: canViewMessageReactionList(message: EngineMessage(message)),
|
||||
animationCache: item.controllerInteraction.presentationContext.animationCache,
|
||||
animationRenderer: item.controllerInteraction.presentationContext.animationRenderer
|
||||
))
|
||||
|
|
@ -2801,7 +2801,7 @@ public class ChatMessageBubbleItemNode: ChatMessageItemView, ChatMessagePreviewI
|
|||
forwardAuthorSignature = forwardInfo.authorSignature
|
||||
}
|
||||
}
|
||||
let sizeAndApply = forwardInfoLayout(item.context, item.presentationData, item.presentationData.strings, .bubble(incoming: incoming), forwardSource, forwardAuthorSignature, forwardPsaType, nil, CGSize(width: maximumNodeWidth - layoutConstants.text.bubbleInsets.left - layoutConstants.text.bubbleInsets.right, height: CGFloat.greatestFiniteMagnitude))
|
||||
let sizeAndApply = forwardInfoLayout(item.context, item.presentationData, item.presentationData.strings, .bubble(incoming: incoming), forwardSource.flatMap(EnginePeer.init), forwardAuthorSignature, forwardPsaType, nil, CGSize(width: maximumNodeWidth - layoutConstants.text.bubbleInsets.left - layoutConstants.text.bubbleInsets.right, height: CGFloat.greatestFiniteMagnitude))
|
||||
forwardInfoSizeApply = (sizeAndApply.0, { width in sizeAndApply.1(width) })
|
||||
|
||||
headerSize.height += 2.0
|
||||
|
|
@ -2829,7 +2829,7 @@ public class ChatMessageBubbleItemNode: ChatMessageItemView, ChatMessagePreviewI
|
|||
}
|
||||
}
|
||||
|
||||
let sizeAndApply = forwardInfoLayout(item.context, item.presentationData, item.presentationData.strings, .bubble(incoming: incoming), forwardSource, nil, nil, ChatMessageForwardInfoNode.StoryData(storyType: storyType), CGSize(width: maximumNodeWidth - layoutConstants.text.bubbleInsets.left - layoutConstants.text.bubbleInsets.right, height: CGFloat.greatestFiniteMagnitude))
|
||||
let sizeAndApply = forwardInfoLayout(item.context, item.presentationData, item.presentationData.strings, .bubble(incoming: incoming), forwardSource.flatMap(EnginePeer.init), nil, nil, ChatMessageForwardInfoNode.StoryData(storyType: storyType), CGSize(width: maximumNodeWidth - layoutConstants.text.bubbleInsets.left - layoutConstants.text.bubbleInsets.right, height: CGFloat.greatestFiniteMagnitude))
|
||||
forwardInfoSizeApply = (sizeAndApply.0, { width in sizeAndApply.1(width) })
|
||||
|
||||
if storyType != .regular {
|
||||
|
|
@ -2968,7 +2968,7 @@ public class ChatMessageBubbleItemNode: ChatMessageItemView, ChatMessagePreviewI
|
|||
],
|
||||
flags: [],
|
||||
placeholder: nil
|
||||
), [:], item.message, maximumNodeWidth)
|
||||
), [:], EngineMessage(item.message), maximumNodeWidth)
|
||||
maxContentWidth = max(maxContentWidth, minWidth)
|
||||
actionButtonsFinalize = buttonsLayout
|
||||
|
||||
|
|
@ -3013,7 +3013,7 @@ public class ChatMessageBubbleItemNode: ChatMessageItemView, ChatMessagePreviewI
|
|||
],
|
||||
flags: [],
|
||||
placeholder: nil
|
||||
), customInfos, item.message, baseWidth)
|
||||
), customInfos, EngineMessage(item.message), baseWidth)
|
||||
maxContentWidth = max(maxContentWidth, minWidth)
|
||||
actionButtonsFinalize = buttonsLayout
|
||||
|
||||
|
|
@ -3054,7 +3054,7 @@ public class ChatMessageBubbleItemNode: ChatMessageItemView, ChatMessagePreviewI
|
|||
],
|
||||
flags: [],
|
||||
placeholder: nil
|
||||
), customInfos, item.message, baseWidth)
|
||||
), customInfos, EngineMessage(item.message), baseWidth)
|
||||
maxContentWidth = max(maxContentWidth, minWidth)
|
||||
actionButtonsFinalize = buttonsLayout
|
||||
|
||||
|
|
@ -3106,13 +3106,13 @@ public class ChatMessageBubbleItemNode: ChatMessageItemView, ChatMessagePreviewI
|
|||
],
|
||||
flags: [],
|
||||
placeholder: nil
|
||||
), customInfos, item.message, baseWidth)
|
||||
), customInfos, EngineMessage(item.message), baseWidth)
|
||||
maxContentWidth = max(maxContentWidth, minWidth)
|
||||
actionButtonsFinalize = buttonsLayout
|
||||
|
||||
lastNodeTopPosition = .None(.Both)
|
||||
} else if let replyMarkup = replyMarkup, !item.presentationData.isPreview {
|
||||
let (minWidth, buttonsLayout) = actionButtonsLayout(item.context, item.presentationData.theme, item.presentationData.chatBubbleCorners, item.presentationData.strings, item.controllerInteraction.presentationContext.backgroundNode, replyMarkup, [:], item.message, maximumNodeWidth)
|
||||
let (minWidth, buttonsLayout) = actionButtonsLayout(item.context, item.presentationData.theme, item.presentationData.chatBubbleCorners, item.presentationData.strings, item.controllerInteraction.presentationContext.backgroundNode, replyMarkup, [:], EngineMessage(item.message), maximumNodeWidth)
|
||||
maxContentWidth = max(maxContentWidth, minWidth)
|
||||
actionButtonsFinalize = buttonsLayout
|
||||
} else if item.content.firstMessageAttributes.displayContinueThreadFooter {
|
||||
|
|
@ -3140,7 +3140,7 @@ public class ChatMessageBubbleItemNode: ChatMessageItemView, ChatMessagePreviewI
|
|||
],
|
||||
flags: [],
|
||||
placeholder: nil
|
||||
), customInfos, item.message, baseWidth)
|
||||
), customInfos, EngineMessage(item.message), baseWidth)
|
||||
maxContentWidth = max(maxContentWidth, minWidth)
|
||||
actionButtonsFinalize = buttonsLayout
|
||||
|
||||
|
|
@ -3177,7 +3177,7 @@ public class ChatMessageBubbleItemNode: ChatMessageItemView, ChatMessagePreviewI
|
|||
availableReactions: item.associatedData.availableReactions,
|
||||
savedMessageTags: item.associatedData.savedMessageTags,
|
||||
reactions: bubbleReactions,
|
||||
message: item.message,
|
||||
message: EngineMessage(item.message),
|
||||
associatedData: item.associatedData,
|
||||
accountPeer: item.associatedData.accountPeer,
|
||||
isIncoming: incoming,
|
||||
|
|
@ -3503,7 +3503,7 @@ public class ChatMessageBubbleItemNode: ChatMessageItemView, ChatMessagePreviewI
|
|||
strings: item.presentationData.strings,
|
||||
context: item.context,
|
||||
controllerInteraction: item.controllerInteraction,
|
||||
message: item.message,
|
||||
message: EngineMessage(item.message),
|
||||
media: paidContent,
|
||||
constrainedSize: CGSize(width: maximumNodeWidth - layoutConstants.text.bubbleInsets.left - layoutConstants.text.bubbleInsets.right, height: CGFloat.greatestFiniteMagnitude),
|
||||
animationCache: item.controllerInteraction.presentationContext.animationCache,
|
||||
|
|
@ -3514,7 +3514,7 @@ public class ChatMessageBubbleItemNode: ChatMessageItemView, ChatMessagePreviewI
|
|||
let sizeAndApply = mediaInfoLayout(ChatMessageStarsMediaInfoNode.Arguments(
|
||||
presentationData: item.presentationData,
|
||||
context: item.context,
|
||||
message: item.message,
|
||||
message: EngineMessage(item.message),
|
||||
media: paidContent,
|
||||
constrainedSize: CGSize(width: maximumNodeWidth - layoutConstants.text.bubbleInsets.left - layoutConstants.text.bubbleInsets.right, height: CGFloat.greatestFiniteMagnitude),
|
||||
animationCache: item.controllerInteraction.presentationContext.animationCache,
|
||||
|
|
@ -5254,7 +5254,7 @@ public class ChatMessageBubbleItemNode: ChatMessageItemView, ChatMessagePreviewI
|
|||
strongSelf.messageAccessibilityArea.frame = backgroundFrame
|
||||
}
|
||||
if let summarizeButtonNode = strongSelf.summarizeButtonNode {
|
||||
let buttonSize = summarizeButtonNode.update(presentationData: item.presentationData, controllerInteraction: item.controllerInteraction, chatLocation: item.chatLocation, subject: item.associatedData.subject, message: item.message, account: item.context.account, disableComments: disablesComments, isSummarize: true)
|
||||
let buttonSize = summarizeButtonNode.update(presentationData: item.presentationData, controllerInteraction: item.controllerInteraction, chatLocation: item.chatLocation, subject: item.associatedData.subject, message: EngineMessage(item.message), accountPeerId: item.context.account.peerId, disableComments: disablesComments, isSummarize: true)
|
||||
|
||||
var buttonFrame = CGRect(origin: CGPoint(x: !incoming ? backgroundFrame.minX - buttonSize.width - 8.0 : backgroundFrame.maxX + 8.0, y: backgroundFrame.minY + 1.0), size: buttonSize)
|
||||
|
||||
|
|
@ -5278,7 +5278,7 @@ public class ChatMessageBubbleItemNode: ChatMessageItemView, ChatMessagePreviewI
|
|||
animation.animator.updateScale(layer: summarizeButtonNode.layer, scale: (isCurrentlyPlayingMedia || isSidePanelOpen) ? 0.001 : 1.0, completion: nil)
|
||||
}
|
||||
if let shareButtonNode = strongSelf.shareButtonNode {
|
||||
let buttonSize = shareButtonNode.update(presentationData: item.presentationData, controllerInteraction: item.controllerInteraction, chatLocation: item.chatLocation, subject: item.associatedData.subject, message: item.message, account: item.context.account, disableComments: disablesComments)
|
||||
let buttonSize = shareButtonNode.update(presentationData: item.presentationData, controllerInteraction: item.controllerInteraction, chatLocation: item.chatLocation, subject: item.associatedData.subject, message: EngineMessage(item.message), accountPeerId: item.context.account.peerId, disableComments: disablesComments)
|
||||
|
||||
var buttonFrame = CGRect(origin: CGPoint(x: !incoming ? backgroundFrame.minX - buttonSize.width - 8.0 : backgroundFrame.maxX + 8.0, y: backgroundFrame.maxY - buttonSize.width - 1.0), size: buttonSize)
|
||||
|
||||
|
|
@ -5312,7 +5312,7 @@ public class ChatMessageBubbleItemNode: ChatMessageItemView, ChatMessagePreviewI
|
|||
}*/
|
||||
strongSelf.messageAccessibilityArea.frame = backgroundFrame
|
||||
if let summarizeButtonNode = strongSelf.summarizeButtonNode {
|
||||
let buttonSize = summarizeButtonNode.update(presentationData: item.presentationData, controllerInteraction: item.controllerInteraction, chatLocation: item.chatLocation, subject: item.associatedData.subject, message: item.message, account: item.context.account, disableComments: disablesComments, isSummarize: true)
|
||||
let buttonSize = summarizeButtonNode.update(presentationData: item.presentationData, controllerInteraction: item.controllerInteraction, chatLocation: item.chatLocation, subject: item.associatedData.subject, message: EngineMessage(item.message), accountPeerId: item.context.account.peerId, disableComments: disablesComments, isSummarize: true)
|
||||
|
||||
var buttonFrame = CGRect(origin: CGPoint(x: !incoming ? backgroundFrame.minX - buttonSize.width - 8.0 : backgroundFrame.maxX + 8.0, y: backgroundFrame.minY + 1.0), size: buttonSize)
|
||||
|
||||
|
|
@ -5336,7 +5336,7 @@ public class ChatMessageBubbleItemNode: ChatMessageItemView, ChatMessagePreviewI
|
|||
animation.animator.updateScale(layer: summarizeButtonNode.layer, scale: (isCurrentlyPlayingMedia || isSidePanelOpen) ? 0.001 : 1.0, completion: nil)
|
||||
}
|
||||
if let shareButtonNode = strongSelf.shareButtonNode {
|
||||
let buttonSize = shareButtonNode.update(presentationData: item.presentationData, controllerInteraction: item.controllerInteraction, chatLocation: item.chatLocation, subject: item.associatedData.subject, message: item.message, account: item.context.account, disableComments: disablesComments)
|
||||
let buttonSize = shareButtonNode.update(presentationData: item.presentationData, controllerInteraction: item.controllerInteraction, chatLocation: item.chatLocation, subject: item.associatedData.subject, message: EngineMessage(item.message), accountPeerId: item.context.account.peerId, disableComments: disablesComments)
|
||||
|
||||
var buttonFrame = CGRect(origin: CGPoint(x: !incoming ? backgroundFrame.minX - buttonSize.width - 8.0 : backgroundFrame.maxX + 8.0, y: backgroundFrame.maxY - buttonSize.width - 1.0), size: buttonSize)
|
||||
|
||||
|
|
@ -5501,7 +5501,7 @@ public class ChatMessageBubbleItemNode: ChatMessageItemView, ChatMessagePreviewI
|
|||
case let .optionalAction(f):
|
||||
f()
|
||||
case let .openContextMenu(openContextMenu):
|
||||
if canAddMessageReactions(message: openContextMenu.tapMessage) {
|
||||
if canAddMessageReactions(message: EngineMessage(openContextMenu.tapMessage)) {
|
||||
item.controllerInteraction.updateMessageReaction(openContextMenu.tapMessage, .default, false, nil)
|
||||
} else {
|
||||
item.controllerInteraction.openMessageContextMenu(openContextMenu.tapMessage, openContextMenu.selectAll, self, openContextMenu.subFrame, nil, nil)
|
||||
|
|
@ -5510,7 +5510,7 @@ public class ChatMessageBubbleItemNode: ChatMessageItemView, ChatMessagePreviewI
|
|||
} else if case .tap = gesture {
|
||||
item.controllerInteraction.clickThroughMessage(self.view, location)
|
||||
} else if case .doubleTap = gesture {
|
||||
if canAddMessageReactions(message: item.message) {
|
||||
if canAddMessageReactions(message: EngineMessage(item.message)) {
|
||||
item.controllerInteraction.updateMessageReaction(item.message, .default, false, nil)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,7 +14,6 @@ swift_library(
|
|||
"//submodules/AsyncDisplayKit",
|
||||
"//submodules/Display",
|
||||
"//submodules/TelegramCore",
|
||||
"//submodules/Postbox",
|
||||
"//submodules/TelegramPresentationData",
|
||||
"//submodules/AppBundle",
|
||||
"//submodules/TelegramUI/Components/Chat/ChatMessageBubbleContentNode",
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@ import UIKit
|
|||
import AsyncDisplayKit
|
||||
import Display
|
||||
import TelegramCore
|
||||
import Postbox
|
||||
import TelegramPresentationData
|
||||
import AppBundle
|
||||
import ChatMessageBubbleContentNode
|
||||
|
|
@ -108,7 +107,7 @@ public class ChatMessageCallBubbleContentNode: ChatMessageBubbleContentNode {
|
|||
let messageTheme = incoming ? item.presentationData.theme.theme.chat.message.incoming : item.presentationData.theme.theme.chat.message.outgoing
|
||||
|
||||
var peopleTextString: String?
|
||||
var peopleAvatars: [Peer] = []
|
||||
var peopleAvatars: [EnginePeer] = []
|
||||
|
||||
var titleString: String?
|
||||
var callDuration: Int32?
|
||||
|
|
@ -155,11 +154,11 @@ public class ChatMessageCallBubbleContentNode: ChatMessageBubbleContentNode {
|
|||
if conferenceCall.otherParticipants.count > 0 {
|
||||
peopleTextString = item.presentationData.strings.Chat_CallMessage_GroupCallParticipantCount(Int32(conferenceCall.otherParticipants.count + 1))
|
||||
if let peer = item.message.author {
|
||||
peopleAvatars.append(peer)
|
||||
peopleAvatars.append(EnginePeer(peer))
|
||||
}
|
||||
for id in conferenceCall.otherParticipants {
|
||||
if let peer = item.message.peers[id] {
|
||||
peopleAvatars.append(peer)
|
||||
peopleAvatars.append(EnginePeer(peer))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -239,7 +238,7 @@ public class ChatMessageCallBubbleContentNode: ChatMessageBubbleContentNode {
|
|||
}
|
||||
}
|
||||
|
||||
let dateText = stringForMessageTimestampStatus(accountPeerId: item.context.account.peerId, message: item.message, dateTimeFormat: item.presentationData.dateTimeFormat, nameDisplayOrder: item.presentationData.nameDisplayOrder, strings: item.presentationData.strings, associatedData: item.associatedData)
|
||||
let dateText = stringForMessageTimestampStatus(accountPeerId: item.context.account.peerId, message: EngineMessage(item.message), dateTimeFormat: item.presentationData.dateTimeFormat, nameDisplayOrder: item.presentationData.nameDisplayOrder, strings: item.presentationData.strings, associatedData: item.associatedData)
|
||||
|
||||
var statusText: String
|
||||
if let callDuration = callDuration, callDuration > 1 {
|
||||
|
|
@ -319,7 +318,7 @@ public class ChatMessageCallBubbleContentNode: ChatMessageBubbleContentNode {
|
|||
strongSelf.addSubnode(peopleAvatarsNode)
|
||||
}
|
||||
|
||||
let peopleAvatarsContent = peopleAvatarsContext.update(peers: peopleAvatars.prefix(3).map(EnginePeer.init), animated: false)
|
||||
let peopleAvatarsContent = peopleAvatarsContext.update(peers: Array(peopleAvatars.prefix(3)), animated: false)
|
||||
let peopleAvatarsSize = peopleAvatarsNode.update(context: item.context, content: peopleAvatarsContent, itemSize: CGSize(width: peopleAvatarSize, height: peopleAvatarSize), customSpacing: peopleAvatarSize - peopleAvatarSpacing, font: avatarFont, animated: false, synchronousLoad: false)
|
||||
peopleAvatarsNode.frame = CGRect(origin: CGPoint(x: labelFrame.maxX + avatarsLeftInset, y: labelFrame.minY - 1.0), size: peopleAvatarsSize)
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
import Foundation
|
||||
import UIKit
|
||||
import Postbox
|
||||
import Display
|
||||
import AsyncDisplayKit
|
||||
import SwiftSignalKit
|
||||
|
|
@ -126,13 +125,13 @@ public final class ChatMessageCommentFooterContentNode: ChatMessageBubbleContent
|
|||
let horizontalInset = layoutConstants.text.bubbleInsets.left + layoutConstants.text.bubbleInsets.right
|
||||
|
||||
var dateReplies = 0
|
||||
var replyPeers: [Peer] = []
|
||||
var replyPeers: [EnginePeer] = []
|
||||
var hasUnseenReplies = false
|
||||
for attribute in item.message.attributes {
|
||||
if let attribute = attribute as? ReplyThreadMessageAttribute {
|
||||
dateReplies = Int(attribute.count)
|
||||
replyPeers = attribute.latestUsers.compactMap { peerId -> Peer? in
|
||||
return item.message.peers[peerId]
|
||||
replyPeers = attribute.latestUsers.compactMap { peerId -> EnginePeer? in
|
||||
return item.message.peers[peerId].flatMap(EnginePeer.init)
|
||||
}
|
||||
if let maxMessageId = attribute.maxMessageId, let maxReadMessageId = attribute.maxReadMessageId {
|
||||
hasUnseenReplies = maxMessageId > maxReadMessageId
|
||||
|
|
@ -358,7 +357,7 @@ public final class ChatMessageCommentFooterContentNode: ChatMessageBubbleContent
|
|||
}
|
||||
}
|
||||
|
||||
let avatarContent = strongSelf.avatarsContext.update(peers: replyPeers.map(EnginePeer.init), animated: animation.isAnimated)
|
||||
let avatarContent = strongSelf.avatarsContext.update(peers: replyPeers, animated: animation.isAnimated)
|
||||
let avatarsSize = strongSelf.avatarsNode.update(context: item.context, content: avatarContent, animated: animation.isAnimated, synchronousLoad: synchronousLoad)
|
||||
|
||||
let iconAlpha: CGFloat = avatarsSize.width.isZero ? 1.0 : 0.0
|
||||
|
|
|
|||
|
|
@ -13,7 +13,6 @@ swift_library(
|
|||
"//submodules/AsyncDisplayKit",
|
||||
"//submodules/Display",
|
||||
"//submodules/SSignalKit/SwiftSignalKit",
|
||||
"//submodules/Postbox",
|
||||
"//submodules/TelegramCore",
|
||||
"//submodules/TelegramPresentationData",
|
||||
"//submodules/AvatarNode",
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@ import UIKit
|
|||
import AsyncDisplayKit
|
||||
import Display
|
||||
import SwiftSignalKit
|
||||
import Postbox
|
||||
import TelegramCore
|
||||
import TelegramPresentationData
|
||||
import AvatarNode
|
||||
|
|
@ -112,9 +111,9 @@ public class ChatMessageContactBubbleContentNode: ChatMessageBubbleContentNode {
|
|||
}
|
||||
|
||||
|
||||
var contactPeer: Peer?
|
||||
var contactPeer: EnginePeer?
|
||||
if let peerId = selectedContact?.peerId, let peer = item.message.peers[peerId] {
|
||||
contactPeer = peer
|
||||
contactPeer = EnginePeer(peer)
|
||||
}
|
||||
|
||||
let nameColors: PeerNameColors.Colors?
|
||||
|
|
@ -260,7 +259,7 @@ public class ChatMessageContactBubbleContentNode: ChatMessageBubbleContentNode {
|
|||
}
|
||||
}
|
||||
|
||||
let dateText = stringForMessageTimestampStatus(accountPeerId: item.context.account.peerId, message: item.message, dateTimeFormat: item.presentationData.dateTimeFormat, nameDisplayOrder: item.presentationData.nameDisplayOrder, strings: item.presentationData.strings, associatedData: item.associatedData)
|
||||
let dateText = stringForMessageTimestampStatus(accountPeerId: item.context.account.peerId, message: EngineMessage(item.message), dateTimeFormat: item.presentationData.dateTimeFormat, nameDisplayOrder: item.presentationData.nameDisplayOrder, strings: item.presentationData.strings, associatedData: item.associatedData)
|
||||
|
||||
let statusType: ChatMessageDateAndStatusType?
|
||||
if case .customChatContents = item.associatedData.subject {
|
||||
|
|
@ -301,7 +300,7 @@ public class ChatMessageContactBubbleContentNode: ChatMessageBubbleContentNode {
|
|||
impressionCount: viewCount,
|
||||
dateText: dateText,
|
||||
type: statusType,
|
||||
layoutInput: .trailingContent(contentWidth: 1000.0, reactionSettings: shouldDisplayInlineDateReactions(message: item.message, isPremium: item.associatedData.isPremium, forceInline: item.associatedData.forceInlineReactions) ? ChatMessageDateAndStatusNode.TrailingReactionSettings(displayInline: true, preferAdditionalInset: false) : nil),
|
||||
layoutInput: .trailingContent(contentWidth: 1000.0, reactionSettings: shouldDisplayInlineDateReactions(message: EngineMessage(item.message), isPremium: item.associatedData.isPremium, forceInline: item.associatedData.forceInlineReactions) ? ChatMessageDateAndStatusNode.TrailingReactionSettings(displayInline: true, preferAdditionalInset: false) : nil),
|
||||
constrainedSize: CGSize(width: constrainedSize.width - sideInsets, height: .greatestFiniteMagnitude),
|
||||
availableReactions: item.associatedData.availableReactions,
|
||||
savedMessageTags: item.associatedData.savedMessageTags,
|
||||
|
|
@ -315,7 +314,7 @@ public class ChatMessageContactBubbleContentNode: ChatMessageBubbleContentNode {
|
|||
starsCount: starsCount,
|
||||
isPinned: item.message.tags.contains(.pinned) && !item.associatedData.isInPinnedListMode && isReplyThread,
|
||||
hasAutoremove: item.message.isSelfExpiring,
|
||||
canViewReactionList: canViewMessageReactionList(message: item.topMessage),
|
||||
canViewReactionList: canViewMessageReactionList(message: EngineMessage(item.topMessage)),
|
||||
animationCache: item.controllerInteraction.presentationContext.animationCache,
|
||||
animationRenderer: item.controllerInteraction.presentationContext.animationRenderer
|
||||
))
|
||||
|
|
@ -484,7 +483,7 @@ public class ChatMessageContactBubbleContentNode: ChatMessageBubbleContentNode {
|
|||
pattern = MessageInlineBlockBackgroundView.Pattern(
|
||||
context: item.context,
|
||||
fileId: backgroundEmojiId,
|
||||
file: item.message.associatedMedia[MediaId(
|
||||
file: item.message.associatedMedia[EngineMedia.Id(
|
||||
namespace: Namespaces.Media.CloudFile,
|
||||
id: backgroundEmojiId
|
||||
)] as? TelegramMediaFile
|
||||
|
|
|
|||
|
|
@ -11,7 +11,6 @@ swift_library(
|
|||
],
|
||||
deps = [
|
||||
"//submodules/AsyncDisplayKit",
|
||||
"//submodules/Postbox",
|
||||
"//submodules/TelegramCore",
|
||||
"//submodules/Display",
|
||||
"//submodules/SSignalKit/SwiftSignalKit",
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
import Foundation
|
||||
import UIKit
|
||||
import AsyncDisplayKit
|
||||
import Postbox
|
||||
import TelegramCore
|
||||
import Display
|
||||
import SwiftSignalKit
|
||||
|
|
@ -1471,6 +1470,6 @@ public class ChatMessageDateAndStatusNode: ASDisplayNode {
|
|||
}
|
||||
}
|
||||
|
||||
public func shouldDisplayInlineDateReactions(message: Message, isPremium: Bool, forceInline: Bool) -> Bool {
|
||||
public func shouldDisplayInlineDateReactions(message: EngineMessage, isPremium: Bool, forceInline: Bool) -> Bool {
|
||||
return false
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
import Foundation
|
||||
import Postbox
|
||||
import TelegramCore
|
||||
import TelegramPresentationData
|
||||
import TelegramUIPreferences
|
||||
|
|
@ -62,7 +61,7 @@ private func monthAtIndex(_ index: Int, strings: PresentationStrings) -> String
|
|||
}
|
||||
}
|
||||
|
||||
public func stringForMessageTimestampStatus(accountPeerId: PeerId, message: Message, dateTimeFormat: PresentationDateTimeFormat, nameDisplayOrder: PresentationPersonNameOrder, strings: PresentationStrings, format: MessageTimestampStatusFormat = .regular, associatedData: ChatMessageItemAssociatedData, ignoreAuthor: Bool = false) -> String {
|
||||
public func stringForMessageTimestampStatus(accountPeerId: EnginePeer.Id, message: EngineMessage, dateTimeFormat: PresentationDateTimeFormat, nameDisplayOrder: PresentationPersonNameOrder, strings: PresentationStrings, format: MessageTimestampStatusFormat = .regular, associatedData: ChatMessageItemAssociatedData, ignoreAuthor: Bool = false) -> String {
|
||||
if let adAttribute = message.adAttribute {
|
||||
switch adAttribute.messageType {
|
||||
case .sponsored:
|
||||
|
|
@ -155,11 +154,11 @@ public func stringForMessageTimestampStatus(accountPeerId: PeerId, message: Mess
|
|||
}
|
||||
|
||||
var authorTitle: String?
|
||||
if let author = message.author as? TelegramUser {
|
||||
if let author = message.author, case .user = author {
|
||||
if let peer = message.peers[message.id.peerId] as? TelegramChannel, case .broadcast = peer.info {
|
||||
if let channel = message.peers[message.id.peerId] as? TelegramChannel, case let .broadcast(info) = channel.info, message.author?.id != channel.id, info.flags.contains(.messagesShouldHaveProfiles) {
|
||||
} else {
|
||||
authorTitle = EnginePeer(author).displayTitle(strings: strings, displayOrder: nameDisplayOrder)
|
||||
authorTitle = author.displayTitle(strings: strings, displayOrder: nameDisplayOrder)
|
||||
}
|
||||
} else if let forwardInfo = message.forwardInfo, forwardInfo.sourceMessageId?.peerId.namespace == Namespaces.Peer.CloudChannel {
|
||||
authorTitle = forwardInfo.authorSignature
|
||||
|
|
|
|||
|
|
@ -325,7 +325,7 @@ public class ChatMessageFactCheckBubbleContentNode: ChatMessageBubbleContentNode
|
|||
} else {
|
||||
dateFormat = .regular
|
||||
}
|
||||
let dateText = stringForMessageTimestampStatus(accountPeerId: item.context.account.peerId, message: item.message, dateTimeFormat: item.presentationData.dateTimeFormat, nameDisplayOrder: item.presentationData.nameDisplayOrder, strings: item.presentationData.strings, format: dateFormat, associatedData: item.associatedData)
|
||||
let dateText = stringForMessageTimestampStatus(accountPeerId: item.context.account.peerId, message: EngineMessage(item.message), dateTimeFormat: item.presentationData.dateTimeFormat, nameDisplayOrder: item.presentationData.nameDisplayOrder, strings: item.presentationData.strings, format: dateFormat, associatedData: item.associatedData)
|
||||
|
||||
let statusType: ChatMessageDateAndStatusType?
|
||||
if case .customChatContents = item.associatedData.subject {
|
||||
|
|
@ -440,7 +440,7 @@ public class ChatMessageFactCheckBubbleContentNode: ChatMessageBubbleContentNode
|
|||
impressionCount: !item.presentationData.isPreview ? viewCount : nil,
|
||||
dateText: dateText,
|
||||
type: statusType,
|
||||
layoutInput: .trailingContent(contentWidth: nil, reactionSettings: item.presentationData.isPreview ? nil : ChatMessageDateAndStatusNode.TrailingReactionSettings(displayInline: shouldDisplayInlineDateReactions(message: message, isPremium: item.associatedData.isPremium, forceInline: item.associatedData.forceInlineReactions), preferAdditionalInset: false)),
|
||||
layoutInput: .trailingContent(contentWidth: nil, reactionSettings: item.presentationData.isPreview ? nil : ChatMessageDateAndStatusNode.TrailingReactionSettings(displayInline: shouldDisplayInlineDateReactions(message: EngineMessage(message), isPremium: item.associatedData.isPremium, forceInline: item.associatedData.forceInlineReactions), preferAdditionalInset: false)),
|
||||
constrainedSize: textConstrainedSize,
|
||||
availableReactions: item.associatedData.availableReactions,
|
||||
savedMessageTags: item.associatedData.savedMessageTags,
|
||||
|
|
@ -454,7 +454,7 @@ public class ChatMessageFactCheckBubbleContentNode: ChatMessageBubbleContentNode
|
|||
starsCount: starsCount,
|
||||
isPinned: item.message.tags.contains(.pinned) && !item.associatedData.isInPinnedListMode && isReplyThread,
|
||||
hasAutoremove: item.message.isSelfExpiring,
|
||||
canViewReactionList: canViewMessageReactionList(message: item.topMessage),
|
||||
canViewReactionList: canViewMessageReactionList(message: EngineMessage(item.topMessage)),
|
||||
animationCache: item.controllerInteraction.presentationContext.animationCache,
|
||||
animationRenderer: item.controllerInteraction.presentationContext.animationRenderer
|
||||
))
|
||||
|
|
|
|||
|
|
@ -11,7 +11,6 @@ swift_library(
|
|||
],
|
||||
deps = [
|
||||
"//submodules/AsyncDisplayKit",
|
||||
"//submodules/Postbox",
|
||||
"//submodules/Display",
|
||||
"//submodules/TelegramCore",
|
||||
"//submodules/SSignalKit/SwiftSignalKit",
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@ import Foundation
|
|||
import UIKit
|
||||
import AsyncDisplayKit
|
||||
import Display
|
||||
import Postbox
|
||||
import TelegramCore
|
||||
import TelegramPresentationData
|
||||
import LocalizedPeerData
|
||||
|
|
@ -91,7 +90,7 @@ public class ChatMessageForwardInfoNode: ASDisplayNode {
|
|||
private var linkProgressView: TextLoadingEffectView?
|
||||
private var linkProgressDisposable: Disposable?
|
||||
|
||||
private var previousPeer: Peer?
|
||||
private var previousPeer: EnginePeer?
|
||||
|
||||
public var openPsa: ((String, ASDisplayNode) -> Void)?
|
||||
|
||||
|
|
@ -279,7 +278,7 @@ public class ChatMessageForwardInfoNode: ASDisplayNode {
|
|||
}
|
||||
}
|
||||
|
||||
public static func asyncLayout(_ maybeNode: ChatMessageForwardInfoNode?) -> (_ context: AccountContext, _ presentationData: ChatPresentationData, _ strings: PresentationStrings, _ type: ChatMessageForwardInfoType, _ peer: Peer?, _ authorName: String?, _ psaType: String?, _ storyData: StoryData?, _ constrainedSize: CGSize) -> (CGSize, (CGFloat) -> ChatMessageForwardInfoNode) {
|
||||
public static func asyncLayout(_ maybeNode: ChatMessageForwardInfoNode?) -> (_ context: AccountContext, _ presentationData: ChatPresentationData, _ strings: PresentationStrings, _ type: ChatMessageForwardInfoType, _ peer: EnginePeer?, _ authorName: String?, _ psaType: String?, _ storyData: StoryData?, _ constrainedSize: CGSize) -> (CGSize, (CGFloat) -> ChatMessageForwardInfoNode) {
|
||||
let titleNodeLayout = TextNode.asyncLayout(maybeNode?.titleNode)
|
||||
let nameNodeLayout = TextNode.asyncLayout(maybeNode?.nameNode)
|
||||
|
||||
|
|
@ -295,10 +294,10 @@ public class ChatMessageForwardInfoNode: ASDisplayNode {
|
|||
|
||||
let peerString: String
|
||||
if let peer = peer {
|
||||
if let authorName = authorName, originalPeer === peer {
|
||||
peerString = "\(EnginePeer(peer).displayTitle(strings: strings, displayOrder: presentationData.nameDisplayOrder)) (\(authorName))"
|
||||
if let authorName = authorName, originalPeer == peer {
|
||||
peerString = "\(peer.displayTitle(strings: strings, displayOrder: presentationData.nameDisplayOrder)) (\(authorName))"
|
||||
} else {
|
||||
peerString = EnginePeer(peer).displayTitle(strings: strings, displayOrder: presentationData.nameDisplayOrder)
|
||||
peerString = peer.displayTitle(strings: strings, displayOrder: presentationData.nameDisplayOrder)
|
||||
}
|
||||
} else if let authorName = authorName {
|
||||
peerString = authorName
|
||||
|
|
@ -409,7 +408,7 @@ public class ChatMessageForwardInfoNode: ASDisplayNode {
|
|||
var currentCredibilityIconImage: UIImage?
|
||||
var highlight = true
|
||||
if let peer = peer {
|
||||
if let channel = peer as? TelegramChannel, channel.addressName == nil {
|
||||
if case let .channel(channel) = peer, channel.addressName == nil {
|
||||
if case let .broadcast(info) = channel.info, info.flags.contains(.hasDiscussionGroup) {
|
||||
} else if case .member = channel.participationStatus {
|
||||
} else {
|
||||
|
|
@ -539,9 +538,9 @@ public class ChatMessageForwardInfoNode: ASDisplayNode {
|
|||
avatarNode.updateSize(size: avatarSize)
|
||||
if let peer {
|
||||
if peer.smallProfileImage != nil {
|
||||
avatarNode.setPeerV2(context: context, theme: presentationData.theme.theme, peer: EnginePeer(peer), displayDimensions: avatarSize)
|
||||
avatarNode.setPeerV2(context: context, theme: presentationData.theme.theme, peer: peer, displayDimensions: avatarSize)
|
||||
} else {
|
||||
avatarNode.setPeer(context: context, theme: presentationData.theme.theme, peer: EnginePeer(peer), displayDimensions: avatarSize)
|
||||
avatarNode.setPeer(context: context, theme: presentationData.theme.theme, peer: peer, displayDimensions: avatarSize)
|
||||
}
|
||||
} else if let authorName, !authorName.isEmpty {
|
||||
avatarNode.setCustomLetters([String(authorName[authorName.startIndex])])
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue