mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-15 21:45:19 +00:00
Refactoring
This commit is contained in:
parent
afe568c41f
commit
6e3cc4a6e9
@ -7,7 +7,6 @@ import Display
|
||||
import SwiftSignalKit
|
||||
import TelegramPresentationData
|
||||
import TelegramUIPreferences
|
||||
import Postbox
|
||||
|
||||
public final class ChatMessageItemAssociatedData: Equatable {
|
||||
public enum ChannelDiscussionGroupStatus: Equatable {
|
||||
@ -197,11 +196,11 @@ public struct ChatControllerInitialBotStart {
|
||||
}
|
||||
|
||||
public struct ChatControllerInitialAttachBotStart {
|
||||
public let botId: PeerId
|
||||
public let botId: EnginePeer.Id
|
||||
public let payload: String?
|
||||
public let justInstalled: Bool
|
||||
|
||||
public init(botId: PeerId, payload: String?, justInstalled: Bool) {
|
||||
public init(botId: EnginePeer.Id, payload: String?, justInstalled: Bool) {
|
||||
self.botId = botId
|
||||
self.payload = payload
|
||||
self.justInstalled = justInstalled
|
||||
@ -472,7 +471,7 @@ public struct ChatTextInputStateText: Codable, Equatable {
|
||||
|
||||
public enum ChatControllerSubject: Equatable {
|
||||
public enum MessageSubject: Equatable {
|
||||
case id(MessageId)
|
||||
case id(EngineMessage.Id)
|
||||
case timestamp(Int32)
|
||||
}
|
||||
|
||||
@ -652,16 +651,16 @@ public enum FileMediaResourcePlaybackStatus: Equatable {
|
||||
|
||||
public struct FileMediaResourceStatus: Equatable {
|
||||
public var mediaStatus: FileMediaResourceMediaStatus
|
||||
public var fetchStatus: MediaResourceStatus
|
||||
public var fetchStatus: EngineMediaResource.FetchStatus
|
||||
|
||||
public init(mediaStatus: FileMediaResourceMediaStatus, fetchStatus: MediaResourceStatus) {
|
||||
public init(mediaStatus: FileMediaResourceMediaStatus, fetchStatus: EngineMediaResource.FetchStatus) {
|
||||
self.mediaStatus = mediaStatus
|
||||
self.fetchStatus = fetchStatus
|
||||
}
|
||||
}
|
||||
|
||||
public enum FileMediaResourceMediaStatus: Equatable {
|
||||
case fetchStatus(MediaResourceStatus)
|
||||
case fetchStatus(EngineMediaResource.FetchStatus)
|
||||
case playbackStatus(FileMediaResourcePlaybackStatus)
|
||||
}
|
||||
|
||||
|
@ -1,12 +1,11 @@
|
||||
import Foundation
|
||||
import UIKit
|
||||
import Postbox
|
||||
import Display
|
||||
import TelegramCore
|
||||
|
||||
public enum ChatListControllerLocation: Equatable {
|
||||
case chatList(groupId: EngineChatList.Group)
|
||||
case forum(peerId: PeerId)
|
||||
case forum(peerId: EnginePeer.Id)
|
||||
}
|
||||
|
||||
public protocol ChatListController: ViewController {
|
||||
|
@ -2,7 +2,6 @@ import Foundation
|
||||
import UIKit
|
||||
import Display
|
||||
import SwiftSignalKit
|
||||
import Postbox
|
||||
import TelegramCore
|
||||
import TelegramPresentationData
|
||||
|
||||
@ -41,7 +40,7 @@ public enum ContactMultiselectionControllerMode {
|
||||
public struct ChatSelection {
|
||||
public var title: String
|
||||
public var searchPlaceholder: String
|
||||
public var selectedChats: Set<PeerId>
|
||||
public var selectedChats: Set<EnginePeer.Id>
|
||||
public var additionalCategories: ContactMultiselectionControllerAdditionalCategories?
|
||||
public var chatListFilters: [ChatListFilter]?
|
||||
public var displayAutoremoveTimeout: Bool
|
||||
@ -49,7 +48,7 @@ public enum ContactMultiselectionControllerMode {
|
||||
public init(
|
||||
title: String,
|
||||
searchPlaceholder: String,
|
||||
selectedChats: Set<PeerId>,
|
||||
selectedChats: Set<EnginePeer.Id>,
|
||||
additionalCategories: ContactMultiselectionControllerAdditionalCategories?,
|
||||
chatListFilters: [ChatListFilter]?,
|
||||
displayAutoremoveTimeout: Bool = false
|
||||
@ -71,8 +70,8 @@ public enum ContactMultiselectionControllerMode {
|
||||
|
||||
public enum ContactListFilter {
|
||||
case excludeSelf
|
||||
case exclude([PeerId])
|
||||
case disable([PeerId])
|
||||
case exclude([EnginePeer.Id])
|
||||
case disable([EnginePeer.Id])
|
||||
}
|
||||
|
||||
public final class ContactMultiselectionControllerParams {
|
||||
|
@ -1,6 +1,5 @@
|
||||
import Foundation
|
||||
import Contacts
|
||||
import Postbox
|
||||
import TelegramCore
|
||||
|
||||
public final class DeviceContactPhoneNumberData: Equatable {
|
||||
@ -190,18 +189,18 @@ public let phonebookUsernamePathPrefix = "@id"
|
||||
private let phonebookUsernamePrefix = "https://t.me/" + phonebookUsernamePathPrefix
|
||||
|
||||
public extension DeviceContactUrlData {
|
||||
convenience init(appProfile: PeerId) {
|
||||
convenience init(appProfile: EnginePeer.Id) {
|
||||
self.init(label: "Telegram", value: "\(phonebookUsernamePrefix)\(appProfile.id._internalGetInt64Value())")
|
||||
}
|
||||
}
|
||||
|
||||
public func parseAppSpecificContactReference(_ value: String) -> PeerId? {
|
||||
public func parseAppSpecificContactReference(_ value: String) -> EnginePeer.Id? {
|
||||
if !value.hasPrefix(phonebookUsernamePrefix) {
|
||||
return nil
|
||||
}
|
||||
let idString = String(value[value.index(value.startIndex, offsetBy: phonebookUsernamePrefix.count)...])
|
||||
if let id = Int64(idString) {
|
||||
return PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(id))
|
||||
return EnginePeer.Id(namespace: Namespaces.Peer.CloudUser, id: EnginePeer.Id.Id._internalFromInt64Value(id))
|
||||
}
|
||||
return nil
|
||||
}
|
||||
@ -466,8 +465,8 @@ public extension DeviceContactExtendedData {
|
||||
}
|
||||
|
||||
public extension DeviceContactExtendedData {
|
||||
convenience init?(peer: Peer) {
|
||||
guard let user = peer as? TelegramUser else {
|
||||
convenience init?(peer: EnginePeer) {
|
||||
guard case let .user(user) = peer else {
|
||||
return nil
|
||||
}
|
||||
var phoneNumbers: [DeviceContactPhoneNumberData] = []
|
||||
|
@ -1,5 +1,4 @@
|
||||
import Foundation
|
||||
import Postbox
|
||||
import TelegramCore
|
||||
import TelegramUIPreferences
|
||||
import SwiftSignalKit
|
||||
@ -12,10 +11,10 @@ public protocol DeviceContactDataManager: AnyObject {
|
||||
func basicDataForNormalizedPhoneNumber(_ normalizedNumber: DeviceContactNormalizedPhoneNumber) -> Signal<[(DeviceContactStableId, DeviceContactBasicData)], NoError>
|
||||
func extendedData(stableId: DeviceContactStableId) -> Signal<DeviceContactExtendedData?, NoError>
|
||||
func importable() -> Signal<[DeviceContactNormalizedPhoneNumber: ImportableDeviceContactData], NoError>
|
||||
func appSpecificReferences() -> Signal<[PeerId: DeviceContactBasicDataWithReference], NoError>
|
||||
func search(query: String) -> Signal<[DeviceContactStableId: (DeviceContactBasicData, PeerId?)], NoError>
|
||||
func appSpecificReferences() -> Signal<[EnginePeer.Id: DeviceContactBasicDataWithReference], NoError>
|
||||
func search(query: String) -> Signal<[DeviceContactStableId: (DeviceContactBasicData, EnginePeer.Id?)], NoError>
|
||||
func appendContactData(_ contactData: DeviceContactExtendedData, to stableId: DeviceContactStableId) -> Signal<DeviceContactExtendedData?, NoError>
|
||||
func appendPhoneNumber(_ phoneNumber: DeviceContactPhoneNumberData, to stableId: DeviceContactStableId) -> Signal<DeviceContactExtendedData?, NoError>
|
||||
func createContactWithData(_ contactData: DeviceContactExtendedData) -> Signal<(DeviceContactStableId, DeviceContactExtendedData)?, NoError>
|
||||
func deleteContactWithAppSpecificReference(peerId: PeerId) -> Signal<Never, NoError>
|
||||
func deleteContactWithAppSpecificReference(peerId: EnginePeer.Id) -> Signal<Never, NoError>
|
||||
}
|
||||
|
@ -1,6 +1,5 @@
|
||||
import Foundation
|
||||
import TelegramCore
|
||||
import Postbox
|
||||
import TelegramUIPreferences
|
||||
import SwiftSignalKit
|
||||
|
||||
|
@ -1,7 +1,6 @@
|
||||
import Foundation
|
||||
import Display
|
||||
import SwiftSignalKit
|
||||
import Postbox
|
||||
import TelegramCore
|
||||
import TelegramPresentationData
|
||||
|
||||
@ -48,7 +47,7 @@ public final class PeerSelectionControllerParams {
|
||||
public let hasContactSelector: Bool
|
||||
public let hasGlobalSearch: Bool
|
||||
public let title: String?
|
||||
public let attemptSelection: ((Peer, Int64?) -> Void)?
|
||||
public let attemptSelection: ((EnginePeer, Int64?) -> Void)?
|
||||
public let createNewGroup: (() -> Void)?
|
||||
public let pretendPresentedInModal: Bool
|
||||
public let multipleSelection: Bool
|
||||
@ -57,7 +56,7 @@ public final class PeerSelectionControllerParams {
|
||||
public let selectForumThreads: Bool
|
||||
public let hasCreation: Bool
|
||||
|
||||
public init(context: AccountContext, updatedPresentationData: (initial: PresentationData, signal: Signal<PresentationData, NoError>)? = nil, filter: ChatListNodePeersFilter = [.onlyWriteable], requestPeerType: [ReplyMarkupButtonRequestPeerType]? = nil, forumPeerId: EnginePeer.Id? = nil, hasFilters: Bool = false, hasChatListSelector: Bool = true, hasContactSelector: Bool = true, hasGlobalSearch: Bool = true, title: String? = nil, attemptSelection: ((Peer, Int64?) -> Void)? = nil, createNewGroup: (() -> Void)? = nil, pretendPresentedInModal: Bool = false, multipleSelection: Bool = false, forwardedMessageIds: [EngineMessage.Id] = [], hasTypeHeaders: Bool = false, selectForumThreads: Bool = false, hasCreation: Bool = false) {
|
||||
public init(context: AccountContext, updatedPresentationData: (initial: PresentationData, signal: Signal<PresentationData, NoError>)? = nil, filter: ChatListNodePeersFilter = [.onlyWriteable], requestPeerType: [ReplyMarkupButtonRequestPeerType]? = nil, forumPeerId: EnginePeer.Id? = nil, hasFilters: Bool = false, hasChatListSelector: Bool = true, hasContactSelector: Bool = true, hasGlobalSearch: Bool = true, title: String? = nil, attemptSelection: ((EnginePeer, Int64?) -> Void)? = nil, createNewGroup: (() -> Void)? = nil, pretendPresentedInModal: Bool = false, multipleSelection: Bool = false, forwardedMessageIds: [EngineMessage.Id] = [], hasTypeHeaders: Bool = false, selectForumThreads: Bool = false, hasCreation: Bool = false) {
|
||||
self.context = context
|
||||
self.updatedPresentationData = updatedPresentationData
|
||||
self.filter = filter
|
||||
@ -87,8 +86,8 @@ public enum AttachmentTextInputPanelSendMode {
|
||||
}
|
||||
|
||||
public protocol PeerSelectionController: ViewController {
|
||||
var peerSelected: ((Peer, Int64?) -> Void)? { get set }
|
||||
var multiplePeersSelected: (([Peer], [PeerId: Peer], NSAttributedString, AttachmentTextInputPanelSendMode, ChatInterfaceForwardOptionsState?) -> Void)? { get set }
|
||||
var peerSelected: ((EnginePeer, Int64?) -> Void)? { get set }
|
||||
var multiplePeersSelected: (([EnginePeer], [EnginePeer.Id: EnginePeer], NSAttributedString, AttachmentTextInputPanelSendMode, ChatInterfaceForwardOptionsState?) -> Void)? { get set }
|
||||
var inProgress: Bool { get set }
|
||||
var customDismiss: (() -> Void)? { get set }
|
||||
}
|
||||
|
@ -1,24 +1,23 @@
|
||||
import Foundation
|
||||
import UIKit
|
||||
import AsyncDisplayKit
|
||||
import Postbox
|
||||
import TelegramCore
|
||||
import SwiftSignalKit
|
||||
import TelegramAudio
|
||||
|
||||
public enum RequestCallResult {
|
||||
case requested
|
||||
case alreadyInProgress(PeerId?)
|
||||
case alreadyInProgress(EnginePeer.Id?)
|
||||
}
|
||||
|
||||
public enum JoinGroupCallManagerResult {
|
||||
case joined
|
||||
case alreadyInProgress(PeerId?)
|
||||
case alreadyInProgress(EnginePeer.Id?)
|
||||
}
|
||||
|
||||
public enum RequestScheduleGroupCallResult {
|
||||
case success
|
||||
case alreadyInProgress(PeerId?)
|
||||
case alreadyInProgress(EnginePeer.Id?)
|
||||
}
|
||||
|
||||
public struct CallAuxiliaryServer {
|
||||
@ -135,11 +134,11 @@ public protocol PresentationCall: AnyObject {
|
||||
var context: AccountContext { get }
|
||||
var isIntegratedWithCallKit: Bool { get }
|
||||
var internalId: CallSessionInternalId { get }
|
||||
var peerId: PeerId { get }
|
||||
var peerId: EnginePeer.Id { get }
|
||||
var isOutgoing: Bool { get }
|
||||
var isVideo: Bool { get }
|
||||
var isVideoPossible: Bool { get }
|
||||
var peer: Peer? { get }
|
||||
var peer: EnginePeer? { get }
|
||||
|
||||
var state: Signal<PresentationCallState, NoError> { get }
|
||||
var audioLevel: Signal<Float, NoError> { get }
|
||||
@ -199,10 +198,10 @@ public struct PresentationGroupCallState: Equatable {
|
||||
case muted
|
||||
}
|
||||
|
||||
public var myPeerId: PeerId
|
||||
public var myPeerId: EnginePeer.Id
|
||||
public var networkState: NetworkState
|
||||
public var canManageCall: Bool
|
||||
public var adminIds: Set<PeerId>
|
||||
public var adminIds: Set<EnginePeer.Id>
|
||||
public var muteState: GroupCallParticipantsContext.Participant.MuteState?
|
||||
public var defaultParticipantMuteState: DefaultParticipantMuteState?
|
||||
public var recordingStartTimestamp: Int32?
|
||||
@ -214,10 +213,10 @@ public struct PresentationGroupCallState: Equatable {
|
||||
public var isVideoWatchersLimitReached: Bool
|
||||
|
||||
public init(
|
||||
myPeerId: PeerId,
|
||||
myPeerId: EnginePeer.Id,
|
||||
networkState: NetworkState,
|
||||
canManageCall: Bool,
|
||||
adminIds: Set<PeerId>,
|
||||
adminIds: Set<EnginePeer.Id>,
|
||||
muteState: GroupCallParticipantsContext.Participant.MuteState?,
|
||||
defaultParticipantMuteState: DefaultParticipantMuteState?,
|
||||
recordingStartTimestamp: Int32?,
|
||||
@ -249,14 +248,14 @@ public struct PresentationGroupCallSummaryState: Equatable {
|
||||
public var participantCount: Int
|
||||
public var callState: PresentationGroupCallState
|
||||
public var topParticipants: [GroupCallParticipantsContext.Participant]
|
||||
public var activeSpeakers: Set<PeerId>
|
||||
public var activeSpeakers: Set<EnginePeer.Id>
|
||||
|
||||
public init(
|
||||
info: GroupCallInfo?,
|
||||
participantCount: Int,
|
||||
callState: PresentationGroupCallState,
|
||||
topParticipants: [GroupCallParticipantsContext.Participant],
|
||||
activeSpeakers: Set<PeerId>
|
||||
activeSpeakers: Set<EnginePeer.Id>
|
||||
) {
|
||||
self.info = info
|
||||
self.participantCount = participantCount
|
||||
@ -298,13 +297,13 @@ public enum PresentationGroupCallMuteAction: Equatable {
|
||||
|
||||
public struct PresentationGroupCallMembers: Equatable {
|
||||
public var participants: [GroupCallParticipantsContext.Participant]
|
||||
public var speakingParticipants: Set<PeerId>
|
||||
public var speakingParticipants: Set<EnginePeer.Id>
|
||||
public var totalCount: Int
|
||||
public var loadMoreToken: String?
|
||||
|
||||
public init(
|
||||
participants: [GroupCallParticipantsContext.Participant],
|
||||
speakingParticipants: Set<PeerId>,
|
||||
speakingParticipants: Set<EnginePeer.Id>,
|
||||
totalCount: Int,
|
||||
loadMoreToken: String?
|
||||
) {
|
||||
@ -316,13 +315,13 @@ public struct PresentationGroupCallMembers: Equatable {
|
||||
}
|
||||
|
||||
public final class PresentationGroupCallMemberEvent {
|
||||
public let peer: Peer
|
||||
public let peer: EnginePeer
|
||||
public let isContact: Bool
|
||||
public let isInChatList: Bool
|
||||
public let canUnmute: Bool
|
||||
public let joined: Bool
|
||||
|
||||
public init(peer: Peer, isContact: Bool, isInChatList: Bool, canUnmute: Bool, joined: Bool) {
|
||||
public init(peer: EnginePeer, isContact: Bool, isInChatList: Bool, canUnmute: Bool, joined: Bool) {
|
||||
self.peer = peer
|
||||
self.isContact = isContact
|
||||
self.isInChatList = isInChatList
|
||||
@ -395,7 +394,7 @@ public protocol PresentationGroupCall: AnyObject {
|
||||
var account: Account { get }
|
||||
var accountContext: AccountContext { get }
|
||||
var internalId: CallSessionInternalId { get }
|
||||
var peerId: PeerId { get }
|
||||
var peerId: EnginePeer.Id { get }
|
||||
|
||||
var hasVideo: Bool { get }
|
||||
var hasScreencast: Bool { get }
|
||||
@ -412,20 +411,20 @@ public protocol PresentationGroupCall: AnyObject {
|
||||
var stateVersion: Signal<Int, NoError> { get }
|
||||
var summaryState: Signal<PresentationGroupCallSummaryState?, NoError> { get }
|
||||
var members: Signal<PresentationGroupCallMembers?, NoError> { get }
|
||||
var audioLevels: Signal<[(PeerId, UInt32, Float, Bool)], NoError> { get }
|
||||
var audioLevels: Signal<[(EnginePeer.Id, UInt32, Float, Bool)], NoError> { get }
|
||||
var myAudioLevel: Signal<Float, NoError> { get }
|
||||
var isMuted: Signal<Bool, NoError> { get }
|
||||
var isNoiseSuppressionEnabled: Signal<Bool, NoError> { get }
|
||||
|
||||
var memberEvents: Signal<PresentationGroupCallMemberEvent, NoError> { get }
|
||||
var reconnectedAsEvents: Signal<Peer, NoError> { get }
|
||||
var reconnectedAsEvents: Signal<EnginePeer, NoError> { get }
|
||||
|
||||
func toggleScheduledSubscription(_ subscribe: Bool)
|
||||
func schedule(timestamp: Int32)
|
||||
func startScheduled()
|
||||
|
||||
func reconnect(with invite: String)
|
||||
func reconnect(as peerId: PeerId)
|
||||
func reconnect(as peerId: EnginePeer.Id)
|
||||
func leave(terminateIfPossible: Bool) -> Signal<Bool, NoError>
|
||||
|
||||
func toggleIsMuted()
|
||||
@ -438,20 +437,20 @@ public protocol PresentationGroupCall: AnyObject {
|
||||
func disableScreencast()
|
||||
func switchVideoCamera()
|
||||
func updateDefaultParticipantsAreMuted(isMuted: Bool)
|
||||
func setVolume(peerId: PeerId, volume: Int32, sync: Bool)
|
||||
func setVolume(peerId: EnginePeer.Id, volume: Int32, sync: Bool)
|
||||
func setRequestedVideoList(items: [PresentationGroupCallRequestedVideo])
|
||||
func setCurrentAudioOutput(_ output: AudioSessionOutput)
|
||||
|
||||
func playTone(_ tone: PresentationGroupCallTone)
|
||||
|
||||
func updateMuteState(peerId: PeerId, isMuted: Bool) -> GroupCallParticipantsContext.Participant.MuteState?
|
||||
func updateMuteState(peerId: EnginePeer.Id, isMuted: Bool) -> GroupCallParticipantsContext.Participant.MuteState?
|
||||
func setShouldBeRecording(_ shouldBeRecording: Bool, title: String?, videoOrientation: Bool?)
|
||||
|
||||
func updateTitle(_ title: String)
|
||||
|
||||
func invitePeer(_ peerId: PeerId) -> Bool
|
||||
func removedPeer(_ peerId: PeerId)
|
||||
var invitedPeers: Signal<[PeerId], NoError> { get }
|
||||
func invitePeer(_ peerId: EnginePeer.Id) -> Bool
|
||||
func removedPeer(_ peerId: EnginePeer.Id)
|
||||
var invitedPeers: Signal<[EnginePeer.Id], NoError> { get }
|
||||
|
||||
var inviteLinks: Signal<GroupCallInviteLinks?, NoError> { get }
|
||||
|
||||
@ -465,7 +464,7 @@ public protocol PresentationCallManager: AnyObject {
|
||||
var currentCallSignal: Signal<PresentationCall?, NoError> { get }
|
||||
var currentGroupCallSignal: Signal<PresentationGroupCall?, NoError> { get }
|
||||
|
||||
func requestCall(context: AccountContext, peerId: PeerId, isVideo: Bool, endCurrentIfAny: Bool) -> RequestCallResult
|
||||
func joinGroupCall(context: AccountContext, peerId: PeerId, invite: String?, requestJoinAsPeerId: ((@escaping (PeerId?) -> Void) -> Void)?, initialCall: EngineGroupCallDescription, endCurrentIfAny: Bool) -> JoinGroupCallManagerResult
|
||||
func scheduleGroupCall(context: AccountContext, peerId: PeerId, endCurrentIfAny: Bool) -> RequestScheduleGroupCallResult
|
||||
func requestCall(context: AccountContext, peerId: EnginePeer.Id, isVideo: Bool, endCurrentIfAny: Bool) -> RequestCallResult
|
||||
func joinGroupCall(context: AccountContext, peerId: EnginePeer.Id, invite: String?, requestJoinAsPeerId: ((@escaping (EnginePeer.Id?) -> Void) -> Void)?, initialCall: EngineGroupCallDescription, endCurrentIfAny: Bool) -> JoinGroupCallManagerResult
|
||||
func scheduleGroupCall(context: AccountContext, peerId: EnginePeer.Id, endCurrentIfAny: Bool) -> RequestScheduleGroupCallResult
|
||||
}
|
||||
|
@ -1,6 +1,5 @@
|
||||
import Foundation
|
||||
import TelegramCore
|
||||
import Postbox
|
||||
import TelegramUIPreferences
|
||||
import SwiftSignalKit
|
||||
import UniversalMediaPlayer
|
||||
@ -59,8 +58,8 @@ public struct SharedMediaPlaybackAlbumArt: Equatable {
|
||||
|
||||
public enum SharedMediaPlaybackDisplayData: Equatable {
|
||||
case music(title: String?, performer: String?, albumArt: SharedMediaPlaybackAlbumArt?, long: Bool, caption: NSAttributedString?)
|
||||
case voice(author: Peer?, peer: Peer?)
|
||||
case instantVideo(author: Peer?, peer: Peer?, timestamp: Int32)
|
||||
case voice(author: EnginePeer?, peer: EnginePeer?)
|
||||
case instantVideo(author: EnginePeer?, peer: EnginePeer?, timestamp: Int32)
|
||||
|
||||
public static func ==(lhs: SharedMediaPlaybackDisplayData, rhs: SharedMediaPlaybackDisplayData) -> Bool {
|
||||
switch lhs {
|
||||
@ -71,13 +70,13 @@ public enum SharedMediaPlaybackDisplayData: Equatable {
|
||||
return false
|
||||
}
|
||||
case let .voice(lhsAuthor, lhsPeer):
|
||||
if case let .voice(rhsAuthor, rhsPeer) = rhs, arePeersEqual(lhsAuthor, rhsAuthor), arePeersEqual(lhsPeer, rhsPeer) {
|
||||
if case let .voice(rhsAuthor, rhsPeer) = rhs, lhsAuthor == rhsAuthor, lhsPeer == rhsPeer {
|
||||
return true
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
case let .instantVideo(lhsAuthor, lhsPeer, lhsTimestamp):
|
||||
if case let .instantVideo(rhsAuthor, rhsPeer, rhsTimestamp) = rhs, arePeersEqual(lhsAuthor, rhsAuthor), arePeersEqual(lhsPeer, rhsPeer), lhsTimestamp == rhsTimestamp {
|
||||
if case let .instantVideo(rhsAuthor, rhsPeer, rhsTimestamp) = rhs, lhsAuthor == rhsAuthor, lhsPeer == rhsPeer, lhsTimestamp == rhsTimestamp {
|
||||
return true
|
||||
} else {
|
||||
return false
|
||||
@ -125,10 +124,10 @@ public func areSharedMediaPlaylistItemIdsEqual(_ lhs: SharedMediaPlaylistItemId?
|
||||
}
|
||||
|
||||
public struct PeerMessagesMediaPlaylistItemId: SharedMediaPlaylistItemId {
|
||||
public let messageId: MessageId
|
||||
public let messageIndex: MessageIndex
|
||||
public let messageId: EngineMessage.Id
|
||||
public let messageIndex: EngineMessage.Index
|
||||
|
||||
public init(messageId: MessageId, messageIndex: MessageIndex) {
|
||||
public init(messageId: EngineMessage.Id, messageIndex: EngineMessage.Index) {
|
||||
self.messageId = messageId
|
||||
self.messageIndex = messageIndex
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
import Foundation
|
||||
import SwiftSignalKit
|
||||
import Postbox
|
||||
import TelegramCore
|
||||
|
||||
public struct WatchRunningTasks: Equatable {
|
||||
public let running: Bool
|
||||
@ -18,6 +18,6 @@ public struct WatchRunningTasks: Equatable {
|
||||
|
||||
public protocol WatchManager: AnyObject {
|
||||
var watchAppInstalled: Signal<Bool, NoError> { get }
|
||||
var navigateToMessageRequested: Signal<MessageId, NoError> { get }
|
||||
var navigateToMessageRequested: Signal<EngineMessage.Id, NoError> { get }
|
||||
var runningTasks: Signal<WatchRunningTasks?, NoError> { get }
|
||||
}
|
||||
|
@ -3,7 +3,6 @@ import UIKit
|
||||
import Display
|
||||
import AsyncDisplayKit
|
||||
import SwiftSignalKit
|
||||
import Postbox
|
||||
import TelegramCore
|
||||
import MobileCoreServices
|
||||
import TelegramPresentationData
|
||||
|
@ -5,7 +5,6 @@ import Display
|
||||
import SwiftSignalKit
|
||||
import UniversalMediaPlayer
|
||||
import TelegramUniversalVideoContent
|
||||
import Postbox
|
||||
import TelegramCore
|
||||
import AccountContext
|
||||
import ComponentFlow
|
||||
@ -207,7 +206,7 @@ public final class AvatarVideoNode: ASDisplayNode {
|
||||
self.backgroundNode.image = nil
|
||||
|
||||
let videoId = photo.id?.id ?? peer.id.id._internalGetInt64Value()
|
||||
let videoFileReference = FileMediaReference.avatarList(peer: peerReference, media: TelegramMediaFile(fileId: MediaId(namespace: Namespaces.Media.LocalFile, id: 0), partialReference: nil, resource: video.resource, previewRepresentations: photo.representations, videoThumbnails: [], immediateThumbnailData: photo.immediateThumbnailData, mimeType: "video/mp4", size: nil, attributes: [.Animated, .Video(duration: 0, size: video.dimensions, flags: [])]))
|
||||
let videoFileReference = FileMediaReference.avatarList(peer: peerReference, media: TelegramMediaFile(fileId: EngineMedia.Id(namespace: Namespaces.Media.LocalFile, id: 0), partialReference: nil, resource: video.resource, previewRepresentations: photo.representations, videoThumbnails: [], immediateThumbnailData: photo.immediateThumbnailData, mimeType: "video/mp4", size: nil, attributes: [.Animated, .Video(duration: 0, size: video.dimensions, flags: [])]))
|
||||
let videoContent = NativeVideoContent(id: .profileVideo(videoId, nil), userLocation: .other, fileReference: videoFileReference, streamVideo: isMediaStreamable(resource: video.resource) ? .conservative : .none, loopVideo: true, enableSound: false, fetchAutomatically: true, onlyFullSizeThumbnail: false, useLargeThumbnail: true, autoFetchFullSizeThumbnail: true, startTimestamp: video.startTimestamp, continuePlayingWithoutSoundOnLostAudioSession: false, placeholderColor: .clear, captureProtected: false, storeAfterDownload: nil)
|
||||
if videoContent.id != self.videoContent?.id {
|
||||
self.videoNode?.removeFromSupernode()
|
||||
|
@ -8,7 +8,6 @@ import TelegramPresentationData
|
||||
import ItemListUI
|
||||
import PresentationDataUtils
|
||||
import PhotoResources
|
||||
import Postbox
|
||||
|
||||
class BotCheckoutHeaderItem: ListViewItem, ItemListItem {
|
||||
let account: Account
|
||||
@ -168,7 +167,7 @@ class BotCheckoutHeaderItemNode: ListViewItemNode {
|
||||
|
||||
var imageApply: (() -> Void)?
|
||||
var updatedImageSignal: Signal<(TransformImageArguments) -> DrawingContext?, NoError>?
|
||||
var updatedFetchSignal: Signal<FetchResourceSourceType, FetchResourceError>?
|
||||
var updatedFetchSignal: Signal<Never, NoError>?
|
||||
if let photo = item.invoice.photo, let dimensions = photo.dimensions {
|
||||
let arguments = TransformImageArguments(corners: ImageCorners(radius: 4.0), imageSize: dimensions.cgSize.aspectFilled(imageSize), boundingSize: imageSize, intrinsicInsets: UIEdgeInsets(), emptyColor: item.theme.list.mediaPlaceholderColor)
|
||||
imageApply = makeImageLayout(arguments)
|
||||
@ -184,6 +183,10 @@ class BotCheckoutHeaderItemNode: ListViewItemNode {
|
||||
break
|
||||
}
|
||||
updatedFetchSignal = fetchedMediaResource(mediaBox: item.account.postbox.mediaBox, userLocation: userLocation, userContentType: .image, reference: .standalone(resource: photo.resource))
|
||||
|> ignoreValues
|
||||
|> `catch` { _ -> Signal<Never, NoError> in
|
||||
return .complete()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -191,7 +194,9 @@ class BotCheckoutHeaderItemNode: ListViewItemNode {
|
||||
|
||||
let (botNameLayout, botNameApply) = makeBotNameLayout(TextNodeLayoutArguments(attributedString: NSAttributedString(string: item.botName, font: textFont, textColor: item.theme.list.itemSecondaryTextColor), backgroundColor: nil, maximumNumberOfLines: 1, truncationType: .end, constrainedSize: CGSize(width: maxTextWidth, height: CGFloat.greatestFiniteMagnitude), alignment: .natural, cutout: nil, insets: UIEdgeInsets()))
|
||||
|
||||
let (textLayout, textApply) = makeTextLayout(TextNodeLayoutArguments(attributedString: NSAttributedString(string: item.invoice.description, font: textFont, textColor: textColor), backgroundColor: nil, maximumNumberOfLines: 0, truncationType: .end, constrainedSize: CGSize(width: maxTextWidth, height: maxTextHeight - titleLayout.size.height - titleTextSpacing - botNameLayout.size.height - textBotNameSpacing), alignment: .natural, cutout: nil, insets: UIEdgeInsets()))
|
||||
let textLayoutMaxHeight: CGFloat = maxTextHeight - titleLayout.size.height - titleTextSpacing - botNameLayout.size.height - textBotNameSpacing
|
||||
let textArguments = TextNodeLayoutArguments(attributedString: NSAttributedString(string: item.invoice.description, font: textFont, textColor: textColor), backgroundColor: nil, maximumNumberOfLines: 0, truncationType: .end, constrainedSize: CGSize(width: maxTextWidth, height: textLayoutMaxHeight), alignment: .natural, cutout: nil, insets: UIEdgeInsets())
|
||||
let (textLayout, textApply) = makeTextLayout(textArguments)
|
||||
|
||||
let contentHeight: CGFloat
|
||||
if let _ = imageApply {
|
||||
|
@ -3,7 +3,6 @@ import UIKit
|
||||
import SwiftSignalKit
|
||||
import AsyncDisplayKit
|
||||
import Display
|
||||
import Postbox
|
||||
import TelegramCore
|
||||
import TelegramPresentationData
|
||||
import AccountContext
|
||||
|
@ -10,7 +10,6 @@ import HorizontalPeerItem
|
||||
import ListSectionHeaderNode
|
||||
import ContextUI
|
||||
import AccountContext
|
||||
import Postbox
|
||||
|
||||
private func calculateItemCustomWidth(width: CGFloat) -> CGFloat {
|
||||
let itemInsets = UIEdgeInsets(top: 0.0, left: 6.0, bottom: 0.0, right: 6.0)
|
||||
@ -160,17 +159,19 @@ public final class ChatListSearchRecentPeersNode: ASDisplayNode {
|
||||
return .single(([], [:], [:]))
|
||||
case let .peers(peers):
|
||||
return combineLatest(queue: .mainQueue(),
|
||||
peers.filter {
|
||||
!$0.isDeleted
|
||||
}.map {
|
||||
context.account.postbox.peerView(id: $0.id)
|
||||
}
|
||||
peers.filter {
|
||||
!$0.isDeleted
|
||||
}.map {
|
||||
context.account.postbox.peerView(id: $0.id)
|
||||
}
|
||||
)
|
||||
|> mapToSignal { peerViews -> Signal<([EnginePeer], [EnginePeer.Id: (Int32, Bool)], [EnginePeer.Id: EnginePeer.Presence]), NoError> in
|
||||
return context.account.postbox.unreadMessageCountsView(items: peerViews.map { item -> UnreadMessageCountsItem in
|
||||
return UnreadMessageCountsItem.peer(id: item.peerId, handleThreads: true)
|
||||
})
|
||||
|> map { values in
|
||||
return context.engine.data.subscribe(
|
||||
EngineDataMap(peerViews.map { item in
|
||||
return TelegramEngine.EngineData.Item.Messages.PeerUnreadCount(id: item.peerId)
|
||||
})
|
||||
)
|
||||
|> map { unreadCounts in
|
||||
var peers: [EnginePeer] = []
|
||||
var unread: [EnginePeer.Id: (Int32, Bool)] = [:]
|
||||
var presences: [EnginePeer.Id: EnginePeer.Presence] = [:]
|
||||
@ -186,9 +187,9 @@ public final class ChatListSearchRecentPeersNode: ASDisplayNode {
|
||||
}
|
||||
}
|
||||
|
||||
let unreadCount = values.count(for: .peer(id: peerView.peerId, handleThreads: true))
|
||||
if let unreadCount = unreadCount, unreadCount > 0 {
|
||||
unread[peerView.peerId] = (unreadCount, isMuted)
|
||||
let unreadCount = unreadCounts[peerView.peerId]
|
||||
if let unreadCount, unreadCount > 0 {
|
||||
unread[peerView.peerId] = (Int32(unreadCount), isMuted)
|
||||
}
|
||||
|
||||
if let presence = peerView.peerPresences[peer.id] {
|
||||
|
@ -1364,12 +1364,12 @@ public final class ChatListSearchContainerNode: SearchDisplayControllerContentNo
|
||||
|> deliverOnMainQueue).start())
|
||||
}
|
||||
})
|
||||
if let secretPeer = peer as? TelegramSecretChat {
|
||||
if case let .secretChat(secretPeer) = peer {
|
||||
if let peer = peerMap[secretPeer.regularPeerId] {
|
||||
displayPeers.append(EnginePeer(peer))
|
||||
displayPeers.append(peer)
|
||||
}
|
||||
} else {
|
||||
displayPeers.append(EnginePeer(peer))
|
||||
displayPeers.append(peer)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,6 @@
|
||||
import Foundation
|
||||
import UIKit
|
||||
import SwiftSignalKit
|
||||
import Postbox
|
||||
import TelegramCore
|
||||
import AccountContext
|
||||
|
||||
@ -15,7 +14,7 @@ struct ChatListSelectionOptions: Equatable {
|
||||
let delete: Bool
|
||||
}
|
||||
|
||||
func chatListSelectionOptions(context: AccountContext, peerIds: Set<PeerId>, filterId: Int32?) -> Signal<ChatListSelectionOptions, NoError> {
|
||||
func chatListSelectionOptions(context: AccountContext, peerIds: Set<EnginePeer.Id>, filterId: Int32?) -> Signal<ChatListSelectionOptions, NoError> {
|
||||
if peerIds.isEmpty {
|
||||
if let filterId = filterId {
|
||||
return chatListFilterItems(context: context)
|
||||
@ -58,7 +57,7 @@ func chatListSelectionOptions(context: AccountContext, peerIds: Set<PeerId>, fil
|
||||
}
|
||||
|
||||
|
||||
func forumSelectionOptions(context: AccountContext, peerId: PeerId, threadIds: Set<Int64>) -> Signal<ChatListSelectionOptions, NoError> {
|
||||
func forumSelectionOptions(context: AccountContext, peerId: EnginePeer.Id, threadIds: Set<Int64>) -> Signal<ChatListSelectionOptions, NoError> {
|
||||
return context.engine.data.get(
|
||||
TelegramEngine.EngineData.Item.Peer.Peer(id: peerId),
|
||||
EngineDataList(threadIds.map { TelegramEngine.EngineData.Item.Peer.ThreadData(id: peerId, threadId: $0) })
|
||||
|
@ -1,7 +1,6 @@
|
||||
import Foundation
|
||||
import UIKit
|
||||
import AsyncDisplayKit
|
||||
import Postbox
|
||||
import Display
|
||||
import SwiftSignalKit
|
||||
import TelegramPresentationData
|
||||
|
@ -1,7 +1,6 @@
|
||||
import Foundation
|
||||
import UIKit
|
||||
import AsyncDisplayKit
|
||||
import Postbox
|
||||
import Display
|
||||
import SwiftSignalKit
|
||||
import TelegramPresentationData
|
||||
|
@ -1,7 +1,6 @@
|
||||
import Foundation
|
||||
import UIKit
|
||||
import AsyncDisplayKit
|
||||
import Postbox
|
||||
import Display
|
||||
import SwiftSignalKit
|
||||
import TelegramPresentationData
|
||||
|
@ -1,7 +1,6 @@
|
||||
import Foundation
|
||||
import UIKit
|
||||
import AsyncDisplayKit
|
||||
import Postbox
|
||||
import Display
|
||||
import SwiftSignalKit
|
||||
import TelegramPresentationData
|
||||
|
@ -1,7 +1,6 @@
|
||||
import Foundation
|
||||
import UIKit
|
||||
import AsyncDisplayKit
|
||||
import Postbox
|
||||
import Display
|
||||
import SwiftSignalKit
|
||||
import TelegramPresentationData
|
||||
|
@ -2,7 +2,6 @@ import Foundation
|
||||
import UIKit
|
||||
import AsyncDisplayKit
|
||||
import Display
|
||||
import Postbox
|
||||
import TelegramPresentationData
|
||||
import WallpaperBackgroundNode
|
||||
|
||||
@ -523,7 +522,7 @@ public final class ChatMessageBubbleBackdrop: ASDisplayNode {
|
||||
self.clipsToBounds = true
|
||||
}
|
||||
|
||||
public func setMaskMode(_ maskMode: Bool, mediaBox: MediaBox) {
|
||||
public func setMaskMode(_ maskMode: Bool) {
|
||||
if let currentType = self.currentType, let theme = self.theme, let essentialGraphics = self.essentialGraphics, let backgroundNode = self.backgroundNode {
|
||||
self.setType(type: currentType, theme: theme, essentialGraphics: essentialGraphics, maskMode: maskMode, backgroundNode: backgroundNode)
|
||||
}
|
||||
@ -685,7 +684,7 @@ public final class ChatMessageBubbleBackdrop: ASDisplayNode {
|
||||
})
|
||||
}
|
||||
|
||||
public func animateFrom(sourceView: UIView, mediaBox: MediaBox, transition: CombinedTransition) {
|
||||
public func animateFrom(sourceView: UIView, transition: CombinedTransition) {
|
||||
if transition.isAnimated {
|
||||
let previousFrame = self.frame
|
||||
self.updateFrame(CGRect(origin: CGPoint(x: previousFrame.minX, y: sourceView.frame.minY), size: sourceView.frame.size), transition: .immediate)
|
||||
|
@ -1,6 +1,5 @@
|
||||
import Foundation
|
||||
import UIKit
|
||||
import Postbox
|
||||
import TelegramCore
|
||||
|
||||
public struct MessageMediaEditingOptions: OptionSet {
|
||||
|
@ -1,6 +1,5 @@
|
||||
import Foundation
|
||||
import TextFormat
|
||||
import Postbox
|
||||
import TelegramCore
|
||||
import AccountContext
|
||||
|
||||
@ -78,7 +77,7 @@ public func chatTextInputAddLinkAttribute(_ state: ChatTextInputState, selection
|
||||
}
|
||||
}
|
||||
|
||||
public func chatTextInputAddMentionAttribute(_ state: ChatTextInputState, peer: Peer) -> ChatTextInputState {
|
||||
public func chatTextInputAddMentionAttribute(_ state: ChatTextInputState, peer: EnginePeer) -> ChatTextInputState {
|
||||
let inputText = NSMutableAttributedString(attributedString: state.inputText)
|
||||
|
||||
let range = NSMakeRange(state.selectionRange.startIndex, state.selectionRange.endIndex - state.selectionRange.startIndex)
|
||||
@ -91,9 +90,9 @@ public func chatTextInputAddMentionAttribute(_ state: ChatTextInputState, peer:
|
||||
let selectionPosition = range.lowerBound + (replacementText as NSString).length
|
||||
|
||||
return ChatTextInputState(inputText: inputText, selectionRange: selectionPosition ..< selectionPosition)
|
||||
} else if !EnginePeer(peer).compactDisplayTitle.isEmpty {
|
||||
} else if !peer.compactDisplayTitle.isEmpty {
|
||||
let replacementText = NSMutableAttributedString()
|
||||
replacementText.append(NSAttributedString(string: EnginePeer(peer).compactDisplayTitle, attributes: [ChatTextInputAttributes.textMention: ChatTextInputTextMentionAttribute(peerId: peer.id)]))
|
||||
replacementText.append(NSAttributedString(string: peer.compactDisplayTitle, attributes: [ChatTextInputAttributes.textMention: ChatTextInputTextMentionAttribute(peerId: peer.id)]))
|
||||
replacementText.append(NSAttributedString(string: " "))
|
||||
|
||||
let updatedRange = NSRange(location: range.location , length: range.length)
|
||||
|
@ -3,7 +3,6 @@ import UIKit
|
||||
import AsyncDisplayKit
|
||||
import SwiftSignalKit
|
||||
import Display
|
||||
import Postbox
|
||||
import TelegramCore
|
||||
import TelegramPresentationData
|
||||
import AccountContext
|
||||
|
@ -3,7 +3,6 @@ import UIKit
|
||||
import SwiftSignalKit
|
||||
import AsyncDisplayKit
|
||||
import Display
|
||||
import Postbox
|
||||
import TelegramCore
|
||||
import TelegramPresentationData
|
||||
import AccountContext
|
||||
|
@ -3,7 +3,6 @@ import AsyncDisplayKit
|
||||
import Display
|
||||
import ComponentFlow
|
||||
import SwiftSignalKit
|
||||
import Postbox
|
||||
import TelegramCore
|
||||
import AccountContext
|
||||
import TelegramPresentationData
|
||||
|
@ -13,7 +13,6 @@ swift_library(
|
||||
"//submodules/Display:Display",
|
||||
"//submodules/ComponentFlow:ComponentFlow",
|
||||
"//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit",
|
||||
"//submodules/Postbox:Postbox",
|
||||
"//submodules/TelegramCore:TelegramCore",
|
||||
"//submodules/AccountContext:AccountContext",
|
||||
"//submodules/WebPBinding:WebPBinding",
|
||||
|
@ -3,7 +3,6 @@ import AsyncDisplayKit
|
||||
import Display
|
||||
import ComponentFlow
|
||||
import SwiftSignalKit
|
||||
import Postbox
|
||||
import TelegramCore
|
||||
import AccountContext
|
||||
import TelegramPresentationData
|
||||
@ -64,7 +63,7 @@ public func reactionStaticImage(context: AccountContext, animation: TelegramMedi
|
||||
return
|
||||
}
|
||||
|
||||
let tempFile = TempBox.shared.tempFile(fileName: "image.png")
|
||||
let tempFile = EngineTempBox.shared.tempFile(fileName: "image.png")
|
||||
guard let _ = try? pngData.write(to: URL(fileURLWithPath: tempFile.path)) else {
|
||||
return
|
||||
}
|
||||
|
@ -3,7 +3,6 @@ import AsyncDisplayKit
|
||||
import Display
|
||||
import ComponentFlow
|
||||
import SwiftSignalKit
|
||||
import Postbox
|
||||
import TelegramCore
|
||||
import AccountContext
|
||||
import TelegramPresentationData
|
||||
|
@ -5,7 +5,6 @@ import SwiftSignalKit
|
||||
import ComponentFlow
|
||||
import LegacyComponents
|
||||
import TelegramCore
|
||||
import Postbox
|
||||
import AccountContext
|
||||
import TelegramPresentationData
|
||||
import SheetComponent
|
||||
|
@ -4,7 +4,6 @@ import Display
|
||||
import ComponentFlow
|
||||
import LegacyComponents
|
||||
import TelegramCore
|
||||
import Postbox
|
||||
import SegmentedControlNode
|
||||
|
||||
private func generateMaskPath(size: CGSize, leftRadius: CGFloat, rightRadius: CGFloat) -> UIBezierPath {
|
||||
|
@ -4,7 +4,6 @@ import Display
|
||||
import ComponentFlow
|
||||
import LegacyComponents
|
||||
import TelegramCore
|
||||
import Postbox
|
||||
import LottieAnimationComponent
|
||||
|
||||
enum DrawingTextStyle: Equatable {
|
||||
|
@ -5,7 +5,6 @@ import ComponentFlow
|
||||
import SwiftSignalKit
|
||||
import LegacyComponents
|
||||
import TelegramCore
|
||||
import Postbox
|
||||
|
||||
private let toolSize = CGSize(width: 40.0, height: 176.0)
|
||||
|
||||
|
@ -2,7 +2,6 @@ import Foundation
|
||||
import Postbox
|
||||
import TelegramCore
|
||||
import SwiftSignalKit
|
||||
import Postbox
|
||||
import TelegramUIPreferences
|
||||
import AccountContext
|
||||
import UniversalMediaPlayer
|
||||
|
@ -70,9 +70,9 @@ public func messageFileMediaResourceStatus(context: AccountContext, file: Telegr
|
||||
} else if let pendingStatus = pendingStatus {
|
||||
mediaStatus = .fetchStatus(.Fetching(isActive: pendingStatus.isRunning, progress: pendingStatus.progress))
|
||||
} else {
|
||||
mediaStatus = .fetchStatus(resourceStatus)
|
||||
mediaStatus = .fetchStatus(EngineMediaResource.FetchStatus(resourceStatus))
|
||||
}
|
||||
return FileMediaResourceStatus(mediaStatus: mediaStatus, fetchStatus: resourceStatus)
|
||||
return FileMediaResourceStatus(mediaStatus: mediaStatus, fetchStatus: EngineMediaResource.FetchStatus(resourceStatus))
|
||||
}
|
||||
} else {
|
||||
return combineLatest(messageMediaFileStatus(context: context, messageId: message.id, file: file), playbackStatus)
|
||||
@ -92,9 +92,9 @@ public func messageFileMediaResourceStatus(context: AccountContext, file: Telegr
|
||||
}
|
||||
}
|
||||
} else {
|
||||
mediaStatus = .fetchStatus(resourceStatus)
|
||||
mediaStatus = .fetchStatus(EngineMediaResource.FetchStatus(resourceStatus))
|
||||
}
|
||||
return FileMediaResourceStatus(mediaStatus: mediaStatus, fetchStatus: resourceStatus)
|
||||
return FileMediaResourceStatus(mediaStatus: mediaStatus, fetchStatus: EngineMediaResource.FetchStatus(resourceStatus))
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -107,16 +107,16 @@ public func messageImageMediaResourceStatus(context: AccountContext, image: Tele
|
||||
if let pendingStatus = pendingStatus {
|
||||
mediaStatus = .fetchStatus(.Fetching(isActive: pendingStatus.isRunning, progress: pendingStatus.progress))
|
||||
} else {
|
||||
mediaStatus = .fetchStatus(resourceStatus)
|
||||
mediaStatus = .fetchStatus(EngineMediaResource.FetchStatus(resourceStatus))
|
||||
}
|
||||
return FileMediaResourceStatus(mediaStatus: mediaStatus, fetchStatus: resourceStatus)
|
||||
return FileMediaResourceStatus(mediaStatus: mediaStatus, fetchStatus: EngineMediaResource.FetchStatus(resourceStatus))
|
||||
}
|
||||
} else {
|
||||
return messageMediaImageStatus(context: context, messageId: message.id, image: image)
|
||||
|> map { resourceStatus -> FileMediaResourceStatus in
|
||||
let mediaStatus: FileMediaResourceMediaStatus
|
||||
mediaStatus = .fetchStatus(resourceStatus)
|
||||
return FileMediaResourceStatus(mediaStatus: mediaStatus, fetchStatus: resourceStatus)
|
||||
mediaStatus = .fetchStatus(EngineMediaResource.FetchStatus(resourceStatus))
|
||||
return FileMediaResourceStatus(mediaStatus: mediaStatus, fetchStatus: EngineMediaResource.FetchStatus(resourceStatus))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2,7 +2,6 @@ import Foundation
|
||||
import CoreLocation
|
||||
import SwiftSignalKit
|
||||
import StoreKit
|
||||
import Postbox
|
||||
import TelegramCore
|
||||
import TelegramStringFormatting
|
||||
import TelegramUIPreferences
|
||||
@ -155,10 +154,10 @@ public final class InAppPurchaseManager: NSObject {
|
||||
private final class PaymentTransactionContext {
|
||||
var state: SKPaymentTransactionState?
|
||||
var isUpgrade: Bool
|
||||
var targetPeerId: PeerId?
|
||||
var targetPeerId: EnginePeer.Id?
|
||||
let subscriber: (TransactionState) -> Void
|
||||
|
||||
init(isUpgrade: Bool, targetPeerId: PeerId?, subscriber: @escaping (TransactionState) -> Void) {
|
||||
init(isUpgrade: Bool, targetPeerId: EnginePeer.Id?, subscriber: @escaping (TransactionState) -> Void) {
|
||||
self.isUpgrade = isUpgrade
|
||||
self.targetPeerId = targetPeerId
|
||||
self.subscriber = subscriber
|
||||
@ -238,7 +237,7 @@ public final class InAppPurchaseManager: NSObject {
|
||||
}
|
||||
}
|
||||
|
||||
public func buyProduct(_ product: Product, isUpgrade: Bool = false, targetPeerId: PeerId? = nil) -> Signal<PurchaseState, PurchaseError> {
|
||||
public func buyProduct(_ product: Product, isUpgrade: Bool = false, targetPeerId: EnginePeer.Id? = nil) -> Signal<PurchaseState, PurchaseError> {
|
||||
if !self.canMakePayments {
|
||||
return .fail(.cantMakePayments)
|
||||
}
|
||||
@ -415,12 +414,12 @@ extension InAppPurchaseManager: SKPaymentTransactionObserver {
|
||||
|
||||
let purpose: Signal<AppStoreTransactionPurpose, NoError>
|
||||
if !isSubscriptionProductId(productIdentifier) {
|
||||
let peerId: Signal<PeerId, NoError>
|
||||
let peerId: Signal<EnginePeer.Id, NoError>
|
||||
if let targetPeerId = paymentContexts[productIdentifier]?.targetPeerId {
|
||||
peerId = .single(targetPeerId)
|
||||
} else {
|
||||
peerId = pendingInAppPurchaseState(engine: self.engine, productId: productIdentifier)
|
||||
|> mapToSignal { state -> Signal<PeerId, NoError> in
|
||||
|> mapToSignal { state -> Signal<EnginePeer.Id, NoError> in
|
||||
if let state = state, let peerId = state.targetPeerId {
|
||||
return .single(peerId)
|
||||
} else {
|
||||
@ -540,9 +539,9 @@ extension InAppPurchaseManager: SKPaymentTransactionObserver {
|
||||
private final class PendingInAppPurchaseState: Codable {
|
||||
public let productId: String
|
||||
public let isUpgrade: Bool
|
||||
public let targetPeerId: PeerId?
|
||||
public let targetPeerId: EnginePeer.Id?
|
||||
|
||||
public init(productId: String, isUpgrade: Bool, targetPeerId: PeerId?) {
|
||||
public init(productId: String, isUpgrade: Bool, targetPeerId: EnginePeer.Id?) {
|
||||
self.productId = productId
|
||||
self.isUpgrade = isUpgrade
|
||||
self.targetPeerId = targetPeerId
|
||||
@ -553,7 +552,7 @@ private final class PendingInAppPurchaseState: Codable {
|
||||
|
||||
self.productId = try container.decode(String.self, forKey: "productId")
|
||||
self.isUpgrade = try container.decodeIfPresent(Bool.self, forKey: "isUpgrade") ?? false
|
||||
self.targetPeerId = (try container.decodeIfPresent(Int64.self, forKey: "targetPeerId")).flatMap { PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value($0)) }
|
||||
self.targetPeerId = (try container.decodeIfPresent(Int64.self, forKey: "targetPeerId")).flatMap { EnginePeer.Id(namespace: Namespaces.Peer.CloudUser, id: EnginePeer.Id.Id._internalFromInt64Value($0)) }
|
||||
}
|
||||
|
||||
public func encode(to encoder: Encoder) throws {
|
||||
@ -568,7 +567,7 @@ private final class PendingInAppPurchaseState: Codable {
|
||||
}
|
||||
|
||||
private func pendingInAppPurchaseState(engine: TelegramEngine, productId: String) -> Signal<PendingInAppPurchaseState?, NoError> {
|
||||
let key = ValueBoxKey(length: 8)
|
||||
let key = EngineDataBuffer(length: 8)
|
||||
key.setInt64(0, value: Int64(bitPattern: productId.persistentHashValue))
|
||||
|
||||
return engine.data.get(TelegramEngine.EngineData.Item.ItemCache.Item(collectionId: ApplicationSpecificItemCacheCollectionId.pendingInAppPurchaseState, id: key))
|
||||
@ -578,7 +577,7 @@ private func pendingInAppPurchaseState(engine: TelegramEngine, productId: String
|
||||
}
|
||||
|
||||
private func updatePendingInAppPurchaseState(engine: TelegramEngine, productId: String, content: PendingInAppPurchaseState?) -> Signal<Never, NoError> {
|
||||
let key = ValueBoxKey(length: 8)
|
||||
let key = EngineDataBuffer(length: 8)
|
||||
key.setInt64(0, value: Int64(bitPattern: productId.persistentHashValue))
|
||||
|
||||
if let content = content {
|
||||
|
@ -1231,7 +1231,7 @@ public final class ListMessageFileItemNode: ListMessageNode {
|
||||
strongSelf.statusDisposable.set((updatedStatusSignal
|
||||
|> deliverOnMainQueue).start(next: { [weak strongSelf] fileStatus in
|
||||
if let strongSelf = strongSelf {
|
||||
strongSelf.fetchStatus = fileStatus.fetchStatus
|
||||
strongSelf.fetchStatus = fileStatus.fetchStatus._asStatus()
|
||||
strongSelf.resourceStatus = fileStatus.mediaStatus
|
||||
strongSelf.updateStatus(transition: .immediate)
|
||||
}
|
||||
@ -1436,7 +1436,7 @@ public final class ListMessageFileItemNode: ListMessageNode {
|
||||
case .playbackStatus:
|
||||
break
|
||||
case let .fetchStatus(fetchStatus):
|
||||
maybeFetchStatus = fetchStatus
|
||||
maybeFetchStatus = fetchStatus._asStatus()
|
||||
}
|
||||
|
||||
if item.isDownloadList, let fetchStatus = self.fetchStatus {
|
||||
|
@ -3,7 +3,6 @@ import UIKit
|
||||
import SwiftSignalKit
|
||||
import Display
|
||||
import AsyncDisplayKit
|
||||
import Postbox
|
||||
import TelegramCore
|
||||
import TelegramPresentationData
|
||||
import TelegramUIPreferences
|
||||
|
@ -51,7 +51,7 @@ private func getUserPeer(engine: TelegramEngine, peerId: EnginePeer.Id) -> Signa
|
||||
public func openAddPersonContactImpl(context: AccountContext, updatedPresentationData: (initial: PresentationData, signal: Signal<PresentationData, NoError>)? = nil, peerId: EnginePeer.Id, pushController: @escaping (ViewController) -> Void, present: @escaping (ViewController, Any?) -> Void) {
|
||||
let _ = (getUserPeer(engine: context.engine, peerId: peerId)
|
||||
|> deliverOnMainQueue).start(next: { peer, statusSettings in
|
||||
guard case let .user(user) = peer, let contactData = DeviceContactExtendedData(peer: user) else {
|
||||
guard let peer, case let .user(user) = peer, let contactData = DeviceContactExtendedData(peer: peer) else {
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -57,13 +57,15 @@ private class MediaHeaderItemNode: ASDisplayNode {
|
||||
subtitleString = NSAttributedString(string: subtitleText, font: subtitleFont, textColor: theme.rootController.navigationBar.secondaryTextColor)
|
||||
case let .voice(author, peer):
|
||||
rateButtonHidden = false
|
||||
let titleText: String = author.flatMap(EnginePeer.init)?.displayTitle(strings: strings, displayOrder: nameDisplayOrder) ?? ""
|
||||
let titleText: String = author?.displayTitle(strings: strings, displayOrder: nameDisplayOrder) ?? ""
|
||||
let subtitleText: String
|
||||
if let peer = peer {
|
||||
if let peer = peer as? TelegramChannel, case .broadcast = peer.info {
|
||||
if case let .channel(peer) = peer, case .broadcast = peer.info {
|
||||
subtitleText = strings.MusicPlayer_VoiceNote
|
||||
} else if peer is TelegramGroup || peer is TelegramChannel {
|
||||
subtitleText = EnginePeer(peer).displayTitle(strings: strings, displayOrder: nameDisplayOrder)
|
||||
} else if case .legacyGroup = peer {
|
||||
subtitleText = peer.displayTitle(strings: strings, displayOrder: nameDisplayOrder)
|
||||
} else if case .channel = peer {
|
||||
subtitleText = peer.displayTitle(strings: strings, displayOrder: nameDisplayOrder)
|
||||
} else {
|
||||
subtitleText = strings.MusicPlayer_VoiceNote
|
||||
}
|
||||
@ -75,13 +77,14 @@ private class MediaHeaderItemNode: ASDisplayNode {
|
||||
subtitleString = NSAttributedString(string: subtitleText, font: subtitleFont, textColor: theme.rootController.navigationBar.secondaryTextColor)
|
||||
case let .instantVideo(author, peer, timestamp):
|
||||
rateButtonHidden = false
|
||||
let titleText: String = author.flatMap(EnginePeer.init)?.displayTitle(strings: strings, displayOrder: nameDisplayOrder) ?? ""
|
||||
let titleText: String = author?.displayTitle(strings: strings, displayOrder: nameDisplayOrder) ?? ""
|
||||
var subtitleText: String
|
||||
|
||||
if let peer = peer {
|
||||
if peer is TelegramGroup || peer is TelegramChannel {
|
||||
subtitleText = EnginePeer(peer).displayTitle(strings: strings, displayOrder: nameDisplayOrder)
|
||||
} else {
|
||||
switch peer {
|
||||
case .legacyGroup, .channel:
|
||||
subtitleText = peer.displayTitle(strings: strings, displayOrder: nameDisplayOrder)
|
||||
default:
|
||||
subtitleText = strings.Message_VideoMessage
|
||||
}
|
||||
} else {
|
||||
|
@ -27,14 +27,14 @@ public final class PresentationCallImpl: PresentationCall {
|
||||
private let getDeviceAccessData: () -> (presentationData: PresentationData, present: (ViewController, Any?) -> Void, openSettings: () -> Void)
|
||||
|
||||
public let internalId: CallSessionInternalId
|
||||
public let peerId: PeerId
|
||||
public let peerId: EnginePeer.Id
|
||||
public let isOutgoing: Bool
|
||||
public var isVideo: Bool
|
||||
public var isVideoPossible: Bool
|
||||
private let enableStunMarking: Bool
|
||||
private let enableTCP: Bool
|
||||
public let preferredVideoCodec: String?
|
||||
public let peer: Peer?
|
||||
public let peer: EnginePeer?
|
||||
|
||||
private let serializedData: String?
|
||||
private let dataSaving: VoiceCallDataSaving
|
||||
@ -138,9 +138,9 @@ public final class PresentationCallImpl: PresentationCall {
|
||||
getDeviceAccessData: @escaping () -> (presentationData: PresentationData, present: (ViewController, Any?) -> Void, openSettings: () -> Void),
|
||||
initialState: CallSession?,
|
||||
internalId: CallSessionInternalId,
|
||||
peerId: PeerId,
|
||||
peerId: EnginePeer.Id,
|
||||
isOutgoing: Bool,
|
||||
peer: Peer?,
|
||||
peer: EnginePeer?,
|
||||
proxyServer: ProxyServerSettings?,
|
||||
auxiliaryServers: [CallAuxiliaryServer],
|
||||
currentNetworkType: NetworkType,
|
||||
@ -453,7 +453,7 @@ public final class PresentationCallImpl: PresentationCall {
|
||||
if !self.reportedIncomingCall, let stableId = sessionState.stableId {
|
||||
self.reportedIncomingCall = true
|
||||
var phoneNumber: String?
|
||||
if let peer = self.peer as? TelegramUser, let phone = peer.phone {
|
||||
if case let .user(peer) = self.peer, let phone = peer.phone {
|
||||
phoneNumber = formatPhoneNumber(context: self.context, number: phone)
|
||||
}
|
||||
self.callKitIntegration?.reportIncomingCall(
|
||||
|
@ -321,7 +321,7 @@ public final class PresentationCallManagerImpl: PresentationCallManager {
|
||||
internalId: firstState.2.id,
|
||||
peerId: firstState.2.peerId,
|
||||
isOutgoing: false,
|
||||
peer: firstState.1,
|
||||
peer: EnginePeer(firstState.1),
|
||||
proxyServer: strongSelf.proxyServer,
|
||||
auxiliaryServers: [],
|
||||
currentNetworkType: firstState.4,
|
||||
|
@ -518,12 +518,12 @@ public final class PresentationGroupCallImpl: PresentationGroupCall {
|
||||
private struct SummaryParticipantsState: Equatable {
|
||||
public var participantCount: Int
|
||||
public var topParticipants: [GroupCallParticipantsContext.Participant]
|
||||
public var activeSpeakers: Set<PeerId>
|
||||
public var activeSpeakers: Set<EnginePeer.Id>
|
||||
|
||||
public init(
|
||||
participantCount: Int,
|
||||
topParticipants: [GroupCallParticipantsContext.Participant],
|
||||
activeSpeakers: Set<PeerId>
|
||||
activeSpeakers: Set<EnginePeer.Id>
|
||||
) {
|
||||
self.participantCount = participantCount
|
||||
self.topParticipants = topParticipants
|
||||
@ -542,26 +542,26 @@ public final class PresentationGroupCallImpl: PresentationGroupCall {
|
||||
let level: Float
|
||||
}
|
||||
|
||||
private var participants: [PeerId: Participant] = [:]
|
||||
private var participants: [EnginePeer.Id: Participant] = [:]
|
||||
private let speakingParticipantsPromise = ValuePromise<[PeerId: UInt32]>()
|
||||
private var speakingParticipants = [PeerId: UInt32]() {
|
||||
private var speakingParticipants = [EnginePeer.Id: UInt32]() {
|
||||
didSet {
|
||||
self.speakingParticipantsPromise.set(self.speakingParticipants)
|
||||
}
|
||||
}
|
||||
|
||||
private let audioLevelsPromise = Promise<[(PeerId, UInt32, Float, Bool)]>()
|
||||
private let audioLevelsPromise = Promise<[(EnginePeer.Id, UInt32, Float, Bool)]>()
|
||||
|
||||
init() {
|
||||
}
|
||||
|
||||
func update(levels: [(PeerId, UInt32, Float, Bool)]) {
|
||||
func update(levels: [(EnginePeer.Id, UInt32, Float, Bool)]) {
|
||||
let timestamp = Int32(CFAbsoluteTimeGetCurrent())
|
||||
let currentParticipants: [PeerId: Participant] = self.participants
|
||||
|
||||
var validSpeakers: [PeerId: Participant] = [:]
|
||||
var silentParticipants = Set<PeerId>()
|
||||
var speakingParticipants = [PeerId: UInt32]()
|
||||
var validSpeakers: [EnginePeer.Id: Participant] = [:]
|
||||
var silentParticipants = Set<EnginePeer.Id>()
|
||||
var speakingParticipants = [EnginePeer.Id: UInt32]()
|
||||
for (peerId, ssrc, level, hasVoice) in levels {
|
||||
if level > speakingLevelThreshold && hasVoice {
|
||||
validSpeakers[peerId] = Participant(ssrc: ssrc, timestamp: timestamp, level: level)
|
||||
@ -587,7 +587,7 @@ public final class PresentationGroupCallImpl: PresentationGroupCall {
|
||||
}
|
||||
}
|
||||
|
||||
var audioLevels: [(PeerId, UInt32, Float, Bool)] = []
|
||||
var audioLevels: [(EnginePeer.Id, UInt32, Float, Bool)] = []
|
||||
for (peerId, source, level, hasVoice) in levels {
|
||||
if level > 0.001 {
|
||||
audioLevels.append((peerId, source, level, hasVoice))
|
||||
@ -599,11 +599,11 @@ public final class PresentationGroupCallImpl: PresentationGroupCall {
|
||||
self.audioLevelsPromise.set(.single(audioLevels))
|
||||
}
|
||||
|
||||
func get() -> Signal<[PeerId: UInt32], NoError> {
|
||||
func get() -> Signal<[EnginePeer.Id: UInt32], NoError> {
|
||||
return self.speakingParticipantsPromise.get()
|
||||
}
|
||||
|
||||
func getAudioLevels() -> Signal<[(PeerId, UInt32, Float, Bool)], NoError> {
|
||||
func getAudioLevels() -> Signal<[(EnginePeer.Id, UInt32, Float, Bool)], NoError> {
|
||||
return self.audioLevelsPromise.get()
|
||||
}
|
||||
}
|
||||
@ -620,12 +620,12 @@ public final class PresentationGroupCallImpl: PresentationGroupCall {
|
||||
|
||||
private(set) var initialCall: EngineGroupCallDescription?
|
||||
public let internalId: CallSessionInternalId
|
||||
public let peerId: PeerId
|
||||
public let peerId: EnginePeer.Id
|
||||
private let isChannel: Bool
|
||||
private var invite: String?
|
||||
private var joinAsPeerId: PeerId
|
||||
private var joinAsPeerId: EnginePeer.Id
|
||||
private var ignorePreviousJoinAsPeerId: (PeerId, UInt32)?
|
||||
private var reconnectingAsPeer: Peer?
|
||||
private var reconnectingAsPeer: EnginePeer?
|
||||
|
||||
public private(set) var hasVideo: Bool
|
||||
public private(set) var hasScreencast: Bool
|
||||
@ -653,7 +653,7 @@ public final class PresentationGroupCallImpl: PresentationGroupCall {
|
||||
private var screencastCapturer: OngoingCallVideoCapturer?
|
||||
|
||||
private struct SsrcMapping {
|
||||
var peerId: PeerId
|
||||
var peerId: EnginePeer.Id
|
||||
var isPresentation: Bool
|
||||
}
|
||||
private var ssrcMapping: [UInt32: SsrcMapping] = [:]
|
||||
@ -708,8 +708,8 @@ public final class PresentationGroupCallImpl: PresentationGroupCall {
|
||||
private var audioLevelsDisposable = MetaDisposable()
|
||||
|
||||
private let speakingParticipantsContext = SpeakingParticipantsContext()
|
||||
private var speakingParticipantsReportTimestamp: [PeerId: Double] = [:]
|
||||
public var audioLevels: Signal<[(PeerId, UInt32, Float, Bool)], NoError> {
|
||||
private var speakingParticipantsReportTimestamp: [EnginePeer.Id: Double] = [:]
|
||||
public var audioLevels: Signal<[(EnginePeer.Id, UInt32, Float, Bool)], NoError> {
|
||||
return self.speakingParticipantsContext.getAudioLevels()
|
||||
}
|
||||
|
||||
@ -778,15 +778,15 @@ public final class PresentationGroupCallImpl: PresentationGroupCall {
|
||||
return self.membersPromise.get()
|
||||
}
|
||||
|
||||
private var invitedPeersValue: [PeerId] = [] {
|
||||
private var invitedPeersValue: [EnginePeer.Id] = [] {
|
||||
didSet {
|
||||
if self.invitedPeersValue != oldValue {
|
||||
self.inivitedPeersPromise.set(self.invitedPeersValue)
|
||||
}
|
||||
}
|
||||
}
|
||||
private let inivitedPeersPromise = ValuePromise<[PeerId]>([])
|
||||
public var invitedPeers: Signal<[PeerId], NoError> {
|
||||
private let inivitedPeersPromise = ValuePromise<[EnginePeer.Id]>([])
|
||||
public var invitedPeers: Signal<[EnginePeer.Id], NoError> {
|
||||
return self.inivitedPeersPromise.get()
|
||||
}
|
||||
|
||||
@ -796,8 +796,8 @@ public final class PresentationGroupCallImpl: PresentationGroupCall {
|
||||
}
|
||||
private let memberEventsPipeDisposable = MetaDisposable()
|
||||
|
||||
private let reconnectedAsEventsPipe = ValuePipe<Peer>()
|
||||
public var reconnectedAsEvents: Signal<Peer, NoError> {
|
||||
private let reconnectedAsEventsPipe = ValuePipe<EnginePeer>()
|
||||
public var reconnectedAsEvents: Signal<EnginePeer, NoError> {
|
||||
return self.reconnectedAsEventsPipe.signal()
|
||||
}
|
||||
|
||||
@ -860,10 +860,10 @@ public final class PresentationGroupCallImpl: PresentationGroupCall {
|
||||
getDeviceAccessData: @escaping () -> (presentationData: PresentationData, present: (ViewController, Any?) -> Void, openSettings: () -> Void),
|
||||
initialCall: EngineGroupCallDescription?,
|
||||
internalId: CallSessionInternalId,
|
||||
peerId: PeerId,
|
||||
peerId: EnginePeer.Id,
|
||||
isChannel: Bool,
|
||||
invite: String?,
|
||||
joinAsPeerId: PeerId?,
|
||||
joinAsPeerId: EnginePeer.Id?,
|
||||
isStream: Bool
|
||||
) {
|
||||
self.account = accountContext.account
|
||||
@ -2354,7 +2354,7 @@ public final class PresentationGroupCallImpl: PresentationGroupCall {
|
||||
|> mapToSignal { peer, isContact, chatListIndex -> Signal<PresentationGroupCallMemberEvent, NoError> in
|
||||
if let peer = peer {
|
||||
let isInChatList = chatListIndex != nil
|
||||
return .single(PresentationGroupCallMemberEvent(peer: peer._asPeer(), isContact: isContact, isInChatList: isInChatList, canUnmute: event.canUnmute, joined: event.joined))
|
||||
return .single(PresentationGroupCallMemberEvent(peer: peer, isContact: isContact, isInChatList: isInChatList, canUnmute: event.canUnmute, joined: event.joined))
|
||||
} else {
|
||||
return .complete()
|
||||
}
|
||||
@ -2554,7 +2554,7 @@ public final class PresentationGroupCallImpl: PresentationGroupCall {
|
||||
self.requestCall(movingFromBroadcastToRtc: false)
|
||||
}
|
||||
|
||||
public func reconnect(as peerId: PeerId) {
|
||||
public func reconnect(as peerId: EnginePeer.Id) {
|
||||
if peerId == self.joinAsPeerId {
|
||||
return
|
||||
}
|
||||
@ -2572,14 +2572,14 @@ public final class PresentationGroupCallImpl: PresentationGroupCall {
|
||||
|
||||
if strongSelf.stateValue.scheduleTimestamp != nil {
|
||||
strongSelf.stateValue.myPeerId = peerId
|
||||
strongSelf.reconnectedAsEventsPipe.putNext(myPeer._asPeer())
|
||||
strongSelf.reconnectedAsEventsPipe.putNext(myPeer)
|
||||
strongSelf.switchToTemporaryScheduledParticipantsContext()
|
||||
} else {
|
||||
strongSelf.disableVideo()
|
||||
strongSelf.isMutedValue = .muted(isPushToTalkActive: false)
|
||||
strongSelf.isMutedPromise.set(strongSelf.isMutedValue)
|
||||
|
||||
strongSelf.reconnectingAsPeer = myPeer._asPeer()
|
||||
strongSelf.reconnectingAsPeer = myPeer
|
||||
|
||||
if let participantsContext = strongSelf.participantsContext, let immediateState = participantsContext.immediateState {
|
||||
for participant in immediateState.participants {
|
||||
|
@ -2262,8 +2262,8 @@ public final class VoiceChatControllerImpl: ViewController, VoiceChatController
|
||||
if let channel = strongSelf.peer as? TelegramChannel, case .broadcast = channel.info {
|
||||
return
|
||||
}
|
||||
let text = strongSelf.presentationData.strings.VoiceChat_PeerJoinedText(EnginePeer(event.peer).displayTitle(strings: strongSelf.presentationData.strings, displayOrder: strongSelf.presentationData.nameDisplayOrder)).string
|
||||
strongSelf.presentUndoOverlay(content: .invitedToVoiceChat(context: strongSelf.context, peer: EnginePeer(event.peer), text: text, action: nil, duration: 3), action: { _ in return false })
|
||||
let text = strongSelf.presentationData.strings.VoiceChat_PeerJoinedText(event.peer.displayTitle(strings: strongSelf.presentationData.strings, displayOrder: strongSelf.presentationData.nameDisplayOrder)).string
|
||||
strongSelf.presentUndoOverlay(content: .invitedToVoiceChat(context: strongSelf.context, peer: event.peer, text: text, action: nil, duration: 3), action: { _ in return false })
|
||||
}
|
||||
}))
|
||||
|
||||
@ -2274,11 +2274,11 @@ public final class VoiceChatControllerImpl: ViewController, VoiceChatController
|
||||
}
|
||||
let text: String
|
||||
if let channel = strongSelf.peer as? TelegramChannel, case .broadcast = channel.info {
|
||||
text = strongSelf.presentationData.strings.LiveStream_DisplayAsSuccess(EnginePeer(peer).displayTitle(strings: strongSelf.presentationData.strings, displayOrder: strongSelf.presentationData.nameDisplayOrder)).string
|
||||
text = strongSelf.presentationData.strings.LiveStream_DisplayAsSuccess(peer.displayTitle(strings: strongSelf.presentationData.strings, displayOrder: strongSelf.presentationData.nameDisplayOrder)).string
|
||||
} else {
|
||||
text = strongSelf.presentationData.strings.VoiceChat_DisplayAsSuccess(EnginePeer(peer).displayTitle(strings: strongSelf.presentationData.strings, displayOrder: strongSelf.presentationData.nameDisplayOrder)).string
|
||||
text = strongSelf.presentationData.strings.VoiceChat_DisplayAsSuccess(peer.displayTitle(strings: strongSelf.presentationData.strings, displayOrder: strongSelf.presentationData.nameDisplayOrder)).string
|
||||
}
|
||||
strongSelf.presentUndoOverlay(content: .invitedToVoiceChat(context: strongSelf.context, peer: EnginePeer(peer), text: text, action: nil, duration: 3), action: { _ in return false })
|
||||
strongSelf.presentUndoOverlay(content: .invitedToVoiceChat(context: strongSelf.context, peer: peer, text: text, action: nil, duration: 3), action: { _ in return false })
|
||||
}))
|
||||
|
||||
self.stateVersionDisposable.set((self.call.stateVersion
|
||||
|
@ -2,6 +2,8 @@ import Foundation
|
||||
import SwiftSignalKit
|
||||
import Postbox
|
||||
|
||||
public typealias EngineDataBuffer = ValueBoxKey
|
||||
|
||||
public extension TelegramEngine {
|
||||
final class ItemCache {
|
||||
private let account: Account
|
||||
@ -10,7 +12,7 @@ public extension TelegramEngine {
|
||||
self.account = account
|
||||
}
|
||||
|
||||
public func put<T: Codable>(collectionId: Int8, id: ValueBoxKey, item: T) -> Signal<Never, NoError> {
|
||||
public func put<T: Codable>(collectionId: Int8, id: EngineDataBuffer, item: T) -> Signal<Never, NoError> {
|
||||
return self.account.postbox.transaction { transaction -> Void in
|
||||
if let entry = CodableEntry(item) {
|
||||
transaction.putItemCacheEntry(id: ItemCacheEntryId(collectionId: collectionId, key: id), entry: entry)
|
||||
@ -19,7 +21,7 @@ public extension TelegramEngine {
|
||||
|> ignoreValues
|
||||
}
|
||||
|
||||
public func remove(collectionId: Int8, id: ValueBoxKey) -> Signal<Never, NoError> {
|
||||
public func remove(collectionId: Int8, id: EngineDataBuffer) -> Signal<Never, NoError> {
|
||||
return self.account.postbox.transaction { transaction -> Void in
|
||||
transaction.removeItemCacheEntry(id: ItemCacheEntryId(collectionId: collectionId, key: id))
|
||||
}
|
||||
|
@ -3,9 +3,6 @@ import SwiftSignalKit
|
||||
import Postbox
|
||||
import TelegramApi
|
||||
|
||||
public typealias EngineTempBox = TempBox
|
||||
public typealias EngineTempBoxFile = TempBoxFile
|
||||
|
||||
public extension MediaResourceUserContentType {
|
||||
init(file: TelegramMediaFile) {
|
||||
if file.isInstantVideo || file.isVoice {
|
||||
|
@ -0,0 +1,8 @@
|
||||
import Foundation
|
||||
import Postbox
|
||||
|
||||
public typealias EngineTempBox = TempBox
|
||||
|
||||
public extension EngineTempBox {
|
||||
typealias File = TempBoxFile
|
||||
}
|
@ -1,6 +1,5 @@
|
||||
import Foundation
|
||||
import UIKit
|
||||
import Postbox
|
||||
import TelegramCore
|
||||
import TelegramUIPreferences
|
||||
|
||||
@ -123,7 +122,7 @@ struct TelegramWallpaperStandardizedCodable: Codable {
|
||||
}
|
||||
|
||||
if let slug = slug {
|
||||
self.value = .file(TelegramWallpaper.File(id: 0, accessHash: 0, isCreator: false, isDefault: false, isPattern: !colors.isEmpty, isDark: false, slug: slug, file: TelegramMediaFile(fileId: MediaId(namespace: 0, id: 0), partialReference: nil, resource: WallpaperDataResource(slug: slug), previewRepresentations: [], videoThumbnails: [], immediateThumbnailData: nil, mimeType: "", size: nil, attributes: []), settings: WallpaperSettings(blur: blur, motion: motion, colors: colors.map { $0.argb }, intensity: intensity, rotation: rotation)))
|
||||
self.value = .file(TelegramWallpaper.File(id: 0, accessHash: 0, isCreator: false, isDefault: false, isPattern: !colors.isEmpty, isDark: false, slug: slug, file: TelegramMediaFile(fileId: EngineMedia.Id(namespace: 0, id: 0), partialReference: nil, resource: WallpaperDataResource(slug: slug), previewRepresentations: [], videoThumbnails: [], immediateThumbnailData: nil, mimeType: "", size: nil, attributes: []), settings: WallpaperSettings(blur: blur, motion: motion, colors: colors.map { $0.argb }, intensity: intensity, rotation: rotation)))
|
||||
} else if colors.count > 1 {
|
||||
self.value = .gradient(TelegramWallpaper.Gradient(id: nil, colors: colors.map { $0.argb }, settings: WallpaperSettings(blur: blur, motion: motion, rotation: rotation)))
|
||||
} else {
|
||||
|
@ -4,7 +4,6 @@ import Postbox
|
||||
import SwiftSignalKit
|
||||
import AsyncDisplayKit
|
||||
import TelegramCore
|
||||
import Postbox
|
||||
import Display
|
||||
import TelegramUIPreferences
|
||||
import AccountContext
|
||||
|
@ -7,7 +7,6 @@ import SwiftSignalKit
|
||||
import AccountContext
|
||||
import TelegramCore
|
||||
import MultilineTextComponent
|
||||
import Postbox
|
||||
import AvatarNode
|
||||
import TelegramPresentationData
|
||||
import CheckNode
|
||||
|
@ -11,7 +11,6 @@ import AccountContext
|
||||
import TelegramCore
|
||||
import MultilineTextComponent
|
||||
import EmojiStatusComponent
|
||||
import Postbox
|
||||
import TelegramStringFormatting
|
||||
import CheckNode
|
||||
|
||||
|
@ -3897,7 +3897,7 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
|
||||
if inputMode == .none {
|
||||
inputMode = .text
|
||||
}
|
||||
return (chatTextInputAddMentionAttribute(current, peer: peer._asPeer()), inputMode)
|
||||
return (chatTextInputAddMentionAttribute(current, peer: peer), inputMode)
|
||||
}
|
||||
}, delay: true)
|
||||
})))
|
||||
@ -4425,10 +4425,10 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
|
||||
controller?.dismiss()
|
||||
} else {
|
||||
var isChannel = false
|
||||
if let channel = peer as? TelegramChannel, case .broadcast = channel.info {
|
||||
if case let .channel(channel) = peer, case .broadcast = channel.info {
|
||||
isChannel = true
|
||||
}
|
||||
let peerName = EnginePeer(peer).displayTitle(strings: strongSelf.presentationData.strings, displayOrder: strongSelf.presentationData.nameDisplayOrder)
|
||||
let peerName = peer.displayTitle(strings: strongSelf.presentationData.strings, displayOrder: strongSelf.presentationData.nameDisplayOrder)
|
||||
presentConfirmation(peerName, isChannel, {
|
||||
let _ = context.engine.peers.sendBotRequestedPeer(messageId: messageId, buttonId: buttonId, requestedPeerId: peer.id).start()
|
||||
controller?.dismiss()
|
||||
@ -16489,7 +16489,7 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
|
||||
}
|
||||
}
|
||||
}
|
||||
var attemptSelectionImpl: ((Peer) -> Void)?
|
||||
var attemptSelectionImpl: ((EnginePeer) -> Void)?
|
||||
let controller = self.context.sharedContext.makePeerSelectionController(PeerSelectionControllerParams(context: self.context, updatedPresentationData: self.updatedPresentationData, filter: filter, hasFilters: true, attemptSelection: { peer, _ in
|
||||
attemptSelectionImpl?(peer)
|
||||
}, multipleSelection: true, forwardedMessageIds: messages.map { $0.id }, selectForumThreads: true))
|
||||
@ -16500,7 +16500,7 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
|
||||
}
|
||||
let presentationData = context.sharedContext.currentPresentationData.with { $0 }
|
||||
if hasPublicPolls {
|
||||
if let channel = peer as? TelegramChannel, case .broadcast = channel.info {
|
||||
if case let .channel(channel) = peer, case .broadcast = channel.info {
|
||||
controller.present(textAlertController(context: context, title: nil, text: hasPublicQuiz ? presentationData.strings.Forward_ErrorPublicQuizDisabledInChannels : presentationData.strings.Forward_ErrorPublicPollDisabledInChannels, actions: [TextAlertAction(type: .defaultAction, title: presentationData.strings.Common_OK, action: {})]), in: .window(.root))
|
||||
return
|
||||
}
|
||||
@ -16538,7 +16538,7 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
|
||||
let commit: ([EnqueueMessage]) -> Void = { result in
|
||||
strongSelf.updateChatPresentationInterfaceState(animated: false, interactive: true, { $0.updatedInterfaceState({ $0.withoutSelectionState() }).updatedSearch(nil) })
|
||||
|
||||
var displayPeers: [Peer] = []
|
||||
var displayPeers: [EnginePeer] = []
|
||||
for peer in peers {
|
||||
let _ = (enqueueMessages(account: strongSelf.context.account, peerId: peer.id, messages: result)
|
||||
|> deliverOnMainQueue).start(next: { messageIds in
|
||||
@ -16565,7 +16565,7 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
|
||||
}
|
||||
})
|
||||
|
||||
if let secretPeer = peer as? TelegramSecretChat {
|
||||
if case let .secretChat(secretPeer) = peer {
|
||||
if let peer = peerMap[secretPeer.regularPeerId] {
|
||||
displayPeers.append(peer)
|
||||
}
|
||||
@ -16582,17 +16582,17 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
|
||||
savedMessages = true
|
||||
} else {
|
||||
if displayPeers.count == 1, let peer = displayPeers.first {
|
||||
var peerName = peer.id == strongSelf.context.account.peerId ? presentationData.strings.DialogList_SavedMessages : EnginePeer(peer).displayTitle(strings: presentationData.strings, displayOrder: presentationData.nameDisplayOrder)
|
||||
var peerName = peer.id == strongSelf.context.account.peerId ? presentationData.strings.DialogList_SavedMessages : peer.displayTitle(strings: presentationData.strings, displayOrder: presentationData.nameDisplayOrder)
|
||||
peerName = peerName.replacingOccurrences(of: "**", with: "")
|
||||
text = messages.count == 1 ? presentationData.strings.Conversation_ForwardTooltip_Chat_One(peerName).string : presentationData.strings.Conversation_ForwardTooltip_Chat_Many(peerName).string
|
||||
} else if displayPeers.count == 2, let firstPeer = displayPeers.first, let secondPeer = displayPeers.last {
|
||||
var firstPeerName = firstPeer.id == strongSelf.context.account.peerId ? presentationData.strings.DialogList_SavedMessages : EnginePeer(firstPeer).displayTitle(strings: presentationData.strings, displayOrder: presentationData.nameDisplayOrder)
|
||||
var firstPeerName = firstPeer.id == strongSelf.context.account.peerId ? presentationData.strings.DialogList_SavedMessages : firstPeer.displayTitle(strings: presentationData.strings, displayOrder: presentationData.nameDisplayOrder)
|
||||
firstPeerName = firstPeerName.replacingOccurrences(of: "**", with: "")
|
||||
var secondPeerName = secondPeer.id == strongSelf.context.account.peerId ? presentationData.strings.DialogList_SavedMessages : EnginePeer(secondPeer).displayTitle(strings: presentationData.strings, displayOrder: presentationData.nameDisplayOrder)
|
||||
var secondPeerName = secondPeer.id == strongSelf.context.account.peerId ? presentationData.strings.DialogList_SavedMessages : secondPeer.displayTitle(strings: presentationData.strings, displayOrder: presentationData.nameDisplayOrder)
|
||||
secondPeerName = secondPeerName.replacingOccurrences(of: "**", with: "")
|
||||
text = messages.count == 1 ? presentationData.strings.Conversation_ForwardTooltip_TwoChats_One(firstPeerName, secondPeerName).string : presentationData.strings.Conversation_ForwardTooltip_TwoChats_Many(firstPeerName, secondPeerName).string
|
||||
} else if let peer = displayPeers.first {
|
||||
var peerName = EnginePeer(peer).displayTitle(strings: presentationData.strings, displayOrder: presentationData.nameDisplayOrder)
|
||||
var peerName = peer.displayTitle(strings: presentationData.strings, displayOrder: presentationData.nameDisplayOrder)
|
||||
peerName = peerName.replacingOccurrences(of: "**", with: "")
|
||||
text = messages.count == 1 ? presentationData.strings.Conversation_ForwardTooltip_ManyChats_One(peerName, "\(displayPeers.count - 1)").string : presentationData.strings.Conversation_ForwardTooltip_ManyChats_Many(peerName, "\(displayPeers.count - 1)").string
|
||||
} else {
|
||||
@ -17223,7 +17223,7 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
|
||||
}
|
||||
|
||||
private func addPeerContact() {
|
||||
if let peer = self.presentationInterfaceState.renderedPeer?.chatMainPeer as? TelegramUser, let peerStatusSettings = self.presentationInterfaceState.contactStatus?.peerStatusSettings, let contactData = DeviceContactExtendedData(peer: peer) {
|
||||
if let peer = self.presentationInterfaceState.renderedPeer?.chatMainPeer as? TelegramUser, let peerStatusSettings = self.presentationInterfaceState.contactStatus?.peerStatusSettings, let contactData = DeviceContactExtendedData(peer: EnginePeer(peer)) {
|
||||
self.present(context.sharedContext.makeDeviceContactInfoController(context: context, subject: .create(peer: peer, contactData: contactData, isSharing: true, shareViaException: peerStatusSettings.contains(.addExceptionWhenAddingContact), completion: { [weak self] peer, stableId, contactData in
|
||||
guard let strongSelf = self else {
|
||||
return
|
||||
|
@ -692,10 +692,10 @@ class ChatMessageBubbleItemNode: ChatMessageItemView, ChatMessagePreviewItemNode
|
||||
}
|
||||
}
|
||||
self.mainContextSourceNode.isExtractedToContextPreviewUpdated = { [weak self] isExtractedToContextPreview in
|
||||
guard let strongSelf = self, let item = strongSelf.item else {
|
||||
guard let strongSelf = self else {
|
||||
return
|
||||
}
|
||||
strongSelf.backgroundWallpaperNode.setMaskMode(strongSelf.backgroundMaskMode, mediaBox: item.context.account.postbox.mediaBox)
|
||||
strongSelf.backgroundWallpaperNode.setMaskMode(strongSelf.backgroundMaskMode)
|
||||
strongSelf.backgroundNode.setMaskMode(strongSelf.backgroundMaskMode)
|
||||
if !isExtractedToContextPreview, let (rect, size) = strongSelf.absoluteRect {
|
||||
strongSelf.updateAbsoluteRect(rect, within: size)
|
||||
@ -836,9 +836,6 @@ class ChatMessageBubbleItemNode: ChatMessageItemView, ChatMessagePreviewItemNode
|
||||
}
|
||||
|
||||
func animateContentFromTextInputField(textInput: ChatMessageTransitionNode.Source.TextInput, transition: CombinedTransition) {
|
||||
guard let item = self.item else {
|
||||
return
|
||||
}
|
||||
let widthDifference = self.backgroundNode.frame.width - textInput.backgroundView.frame.width
|
||||
let heightDifference = self.backgroundNode.frame.height - textInput.backgroundView.frame.height
|
||||
|
||||
@ -857,7 +854,7 @@ class ChatMessageBubbleItemNode: ChatMessageItemView, ChatMessagePreviewItemNode
|
||||
|
||||
transition.vertical.animateOffsetAdditive(layer: self.clippingNode.layer, offset: textInput.backgroundView.frame.minY - self.clippingNode.frame.minY)
|
||||
|
||||
self.backgroundWallpaperNode.animateFrom(sourceView: textInput.backgroundView, mediaBox: item.context.account.postbox.mediaBox, transition: transition)
|
||||
self.backgroundWallpaperNode.animateFrom(sourceView: textInput.backgroundView, transition: transition)
|
||||
self.backgroundNode.animateFrom(sourceView: textInput.backgroundView, transition: transition)
|
||||
|
||||
for contentNode in self.contentNodes {
|
||||
|
@ -1462,7 +1462,7 @@ final class ChatMessageInteractiveFileNode: ASDisplayNode {
|
||||
if let actualFetchStatus = self.actualFetchStatus, message.forwardInfo != nil {
|
||||
fetchStatus = actualFetchStatus
|
||||
} else if case let .fetchStatus(status) = resourceStatus.mediaStatus {
|
||||
fetchStatus = status
|
||||
fetchStatus = status._asStatus()
|
||||
}
|
||||
|
||||
if let fetchStatus = fetchStatus {
|
||||
|
@ -25,91 +25,6 @@ private final class DocumentPreviewItem: NSObject, QLPreviewItem {
|
||||
}
|
||||
}
|
||||
|
||||
final class DocumentPreviewController: UINavigationController, QLPreviewControllerDelegate, QLPreviewControllerDataSource {
|
||||
private let postbox: Postbox
|
||||
private let file: TelegramMediaFile
|
||||
|
||||
private var item: DocumentPreviewItem?
|
||||
|
||||
private var tempFile: TempBoxFile?
|
||||
|
||||
init(theme: PresentationTheme, strings: PresentationStrings, postbox: Postbox, file: TelegramMediaFile) {
|
||||
self.postbox = postbox
|
||||
self.file = file
|
||||
|
||||
super.init(nibName: nil, bundle: nil)
|
||||
|
||||
self.navigationBar.barTintColor = theme.rootController.navigationBar.opaqueBackgroundColor
|
||||
self.navigationBar.tintColor = theme.rootController.navigationBar.accentTextColor
|
||||
self.navigationBar.shadowImage = generateImage(CGSize(width: 1.0, height: 1.0), rotatedContext: { size, context in
|
||||
context.clear(CGRect(origin: CGPoint(), size: size))
|
||||
context.setFillColor(theme.rootController.navigationBar.separatorColor.cgColor)
|
||||
context.fill(CGRect(origin: CGPoint(), size: CGSize(width: 1.0, height: UIScreenPixel)))
|
||||
})
|
||||
self.navigationBar.isTranslucent = false
|
||||
self.navigationBar.titleTextAttributes = [NSAttributedString.Key.font: Font.semibold(17.0), NSAttributedString.Key.foregroundColor: theme.rootController.navigationBar.primaryTextColor]
|
||||
|
||||
let controller = QLPreviewController(nibName: nil, bundle: nil)
|
||||
controller.navigation_setDismiss({
|
||||
}, rootController: self)
|
||||
controller.delegate = self
|
||||
controller.dataSource = self
|
||||
if #available(iOS 16.0, *) {
|
||||
controller.navigationItem.setLeftBarButton(UIBarButtonItem(title: strings.Common_Cancel, style: .plain, target: self, action: #selector(self.cancelPressed)), animated: false)
|
||||
}
|
||||
self.setViewControllers([controller], animated: false)
|
||||
|
||||
if let path = self.postbox.mediaBox.completedResourcePath(self.file.resource) {
|
||||
var updatedPath = path
|
||||
if let fileName = self.file.fileName {
|
||||
let tempFile = TempBox.shared.file(path: path, fileName: fileName)
|
||||
updatedPath = tempFile.path
|
||||
self.tempFile = tempFile
|
||||
}
|
||||
self.item = DocumentPreviewItem(url: URL(fileURLWithPath: updatedPath), title: self.file.fileName ?? strings.Message_File)
|
||||
}
|
||||
}
|
||||
|
||||
required init?(coder aDecoder: NSCoder) {
|
||||
fatalError("init(coder:) has not been implemented")
|
||||
}
|
||||
|
||||
deinit {
|
||||
if let tempFile = self.tempFile {
|
||||
TempBox.shared.dispose(tempFile)
|
||||
}
|
||||
}
|
||||
|
||||
@objc private func cancelPressed() {
|
||||
self.presentingViewController?.dismiss(animated: true, completion: nil)
|
||||
}
|
||||
|
||||
func numberOfPreviewItems(in controller: QLPreviewController) -> Int {
|
||||
if self.item != nil {
|
||||
return 1
|
||||
} else {
|
||||
return 0
|
||||
}
|
||||
}
|
||||
|
||||
func previewController(_ controller: QLPreviewController, previewItemAt index: Int) -> QLPreviewItem {
|
||||
if let item = self.item {
|
||||
return item
|
||||
} else {
|
||||
assertionFailure()
|
||||
return DocumentPreviewItem(url: URL(fileURLWithPath: ""), title: "")
|
||||
}
|
||||
}
|
||||
|
||||
func previewControllerWillDismiss(_ controller: QLPreviewController) {
|
||||
self.cancelPressed()
|
||||
}
|
||||
|
||||
func previewControllerDidDismiss(_ controller: QLPreviewController) {
|
||||
//self.cancelPressed()
|
||||
}
|
||||
}
|
||||
|
||||
final class CompactDocumentPreviewController: QLPreviewController, QLPreviewControllerDelegate, QLPreviewControllerDataSource {
|
||||
private let postbox: Postbox
|
||||
private let file: TelegramMediaFile
|
||||
@ -271,22 +186,20 @@ final class CompactDocumentPreviewController: QLPreviewController, QLPreviewCont
|
||||
}
|
||||
|
||||
func presentDocumentPreviewController(rootController: UIViewController, theme: PresentationTheme, strings: PresentationStrings, postbox: Postbox, file: TelegramMediaFile, canShare: Bool) {
|
||||
if #available(iOSApplicationExtension 9.0, iOS 9.0, *) {
|
||||
let navigationBar = UINavigationBar.appearance(whenContainedInInstancesOf: [QLPreviewController.self])
|
||||
navigationBar.barTintColor = theme.rootController.navigationBar.opaqueBackgroundColor
|
||||
navigationBar.setBackgroundImage(generateImage(CGSize(width: 1.0, height: 1.0), rotatedContext: { size, context in
|
||||
context.setFillColor(theme.rootController.navigationBar.opaqueBackgroundColor.cgColor)
|
||||
context.fill(CGRect(origin: CGPoint(), size: size))
|
||||
}), for: .default)
|
||||
navigationBar.isTranslucent = true
|
||||
navigationBar.tintColor = theme.rootController.navigationBar.accentTextColor
|
||||
navigationBar.shadowImage = generateImage(CGSize(width: 1.0, height: 1.0), rotatedContext: { size, context in
|
||||
context.clear(CGRect(origin: CGPoint(), size: size))
|
||||
context.setFillColor(theme.rootController.navigationBar.separatorColor.cgColor)
|
||||
context.fill(CGRect(origin: CGPoint(), size: CGSize(width: 1.0, height: UIScreenPixel)))
|
||||
})
|
||||
navigationBar.titleTextAttributes = [NSAttributedString.Key.font: Font.semibold(17.0), NSAttributedString.Key.foregroundColor: theme.rootController.navigationBar.primaryTextColor]
|
||||
}
|
||||
let navigationBar = UINavigationBar.appearance(whenContainedInInstancesOf: [QLPreviewController.self])
|
||||
navigationBar.barTintColor = theme.rootController.navigationBar.opaqueBackgroundColor
|
||||
navigationBar.setBackgroundImage(generateImage(CGSize(width: 1.0, height: 1.0), rotatedContext: { size, context in
|
||||
context.setFillColor(theme.rootController.navigationBar.opaqueBackgroundColor.cgColor)
|
||||
context.fill(CGRect(origin: CGPoint(), size: size))
|
||||
}), for: .default)
|
||||
navigationBar.isTranslucent = true
|
||||
navigationBar.tintColor = theme.rootController.navigationBar.accentTextColor
|
||||
navigationBar.shadowImage = generateImage(CGSize(width: 1.0, height: 1.0), rotatedContext: { size, context in
|
||||
context.clear(CGRect(origin: CGPoint(), size: size))
|
||||
context.setFillColor(theme.rootController.navigationBar.separatorColor.cgColor)
|
||||
context.fill(CGRect(origin: CGPoint(), size: CGSize(width: 1.0, height: UIScreenPixel)))
|
||||
})
|
||||
navigationBar.titleTextAttributes = [NSAttributedString.Key.font: Font.semibold(17.0), NSAttributedString.Key.foregroundColor: theme.rootController.navigationBar.primaryTextColor]
|
||||
|
||||
rootController.present(CompactDocumentPreviewController(theme: theme, strings: strings, postbox: postbox, file: file, canShare: canShare), animated: true, completion: nil)
|
||||
}
|
||||
|
@ -84,10 +84,10 @@ func openResolvedUrlImpl(_ resolvedUrl: ResolvedUrl, context: AccountContext, ur
|
||||
|
||||
var isGroup: Bool = false
|
||||
var peerTitle: String = ""
|
||||
if let peer = peer as? TelegramGroup {
|
||||
if case let .legacyGroup(peer) = peer {
|
||||
isGroup = true
|
||||
peerTitle = peer.title
|
||||
} else if let peer = peer as? TelegramChannel {
|
||||
} else if case let .channel(peer) = peer {
|
||||
if case .group = peer.info {
|
||||
isGroup = true
|
||||
}
|
||||
@ -141,7 +141,7 @@ func openResolvedUrlImpl(_ resolvedUrl: ResolvedUrl, context: AccountContext, ur
|
||||
present(controller, nil)
|
||||
}
|
||||
|
||||
if let peer = peer as? TelegramChannel {
|
||||
if case let .channel(peer) = peer {
|
||||
if peer.flags.contains(.isCreator) || peer.adminRights?.rights.contains(.canAddAdmins) == true {
|
||||
let controller = channelAdminController(context: context, peerId: peerId, adminId: botPeerId, initialParticipant: nil, invite: true, initialAdminRights: adminRights?.chatAdminRights, updated: { _ in
|
||||
controller?.dismiss()
|
||||
@ -150,7 +150,7 @@ func openResolvedUrlImpl(_ resolvedUrl: ResolvedUrl, context: AccountContext, ur
|
||||
} else {
|
||||
addMemberImpl()
|
||||
}
|
||||
} else if let peer = peer as? TelegramGroup {
|
||||
} else if case let .legacyGroup(peer) = peer {
|
||||
if case .member = peer.role {
|
||||
addMemberImpl()
|
||||
} else {
|
||||
@ -171,10 +171,10 @@ func openResolvedUrlImpl(_ resolvedUrl: ResolvedUrl, context: AccountContext, ur
|
||||
let _ = game
|
||||
let presentationData = context.sharedContext.currentPresentationData.with { $0 }
|
||||
let text: String
|
||||
if let peer = peer as? TelegramUser {
|
||||
text = presentationData.strings.Target_ShareGameConfirmationPrivate(EnginePeer(peer).displayTitle(strings: presentationData.strings, displayOrder: presentationData.nameDisplayOrder)).string
|
||||
if case .user = peer {
|
||||
text = presentationData.strings.Target_ShareGameConfirmationPrivate(peer.displayTitle(strings: presentationData.strings, displayOrder: presentationData.nameDisplayOrder)).string
|
||||
} else {
|
||||
text = presentationData.strings.Target_ShareGameConfirmationGroup(EnginePeer(peer).displayTitle(strings: presentationData.strings, displayOrder: presentationData.nameDisplayOrder)).string
|
||||
text = presentationData.strings.Target_ShareGameConfirmationGroup(peer.displayTitle(strings: presentationData.strings, displayOrder: presentationData.nameDisplayOrder)).string
|
||||
}
|
||||
|
||||
let alertController = textAlertController(context: context, title: nil, text: text, actions: [TextAlertAction(type: .defaultAction, title: presentationData.strings.RequestPeer_SelectionConfirmationSend, action: {
|
||||
@ -652,7 +652,7 @@ func openResolvedUrlImpl(_ resolvedUrl: ResolvedUrl, context: AccountContext, ur
|
||||
guard let navigationController else {
|
||||
return
|
||||
}
|
||||
let _ = context.sharedContext.navigateToChatController(NavigateToChatControllerParams(navigationController: navigationController, context: context, chatLocation: .peer(EnginePeer(peer)), attachBotStart: ChatControllerInitialAttachBotStart(botId: bot.peer.id, payload: payload, justInstalled: false), keepStack: .never, useExisting: true))
|
||||
let _ = context.sharedContext.navigateToChatController(NavigateToChatControllerParams(navigationController: navigationController, context: context, chatLocation: .peer(peer), attachBotStart: ChatControllerInitialAttachBotStart(botId: bot.peer.id, payload: payload, justInstalled: false), keepStack: .never, useExisting: true))
|
||||
}
|
||||
navigationController.pushViewController(controller)
|
||||
}
|
||||
@ -704,7 +704,7 @@ func openResolvedUrlImpl(_ resolvedUrl: ResolvedUrl, context: AccountContext, ur
|
||||
guard let navigationController else {
|
||||
return
|
||||
}
|
||||
let _ = context.sharedContext.navigateToChatController(NavigateToChatControllerParams(navigationController: navigationController, context: context, chatLocation: .peer(EnginePeer(peer)), attachBotStart: ChatControllerInitialAttachBotStart(botId: botPeer.id, payload: payload, justInstalled: true), useExisting: true))
|
||||
let _ = context.sharedContext.navigateToChatController(NavigateToChatControllerParams(navigationController: navigationController, context: context, chatLocation: .peer(peer), attachBotStart: ChatControllerInitialAttachBotStart(botId: botPeer.id, payload: payload, justInstalled: true), useExisting: true))
|
||||
}
|
||||
navigationController.pushViewController(controller)
|
||||
}
|
||||
|
@ -8222,7 +8222,7 @@ final class PeerInfoScreenNode: ViewControllerTracingNode, UIScrollViewDelegate
|
||||
return .forward(source: messageId, threadId: nil, grouping: .auto, attributes: attributes, correlationId: nil)
|
||||
})
|
||||
|
||||
var displayPeers: [Peer] = []
|
||||
var displayPeers: [EnginePeer] = []
|
||||
for peer in peers {
|
||||
let _ = (enqueueMessages(account: strongSelf.context.account, peerId: peer.id, messages: result)
|
||||
|> deliverOnMainQueue).start(next: { messageIds in
|
||||
@ -8249,7 +8249,7 @@ final class PeerInfoScreenNode: ViewControllerTracingNode, UIScrollViewDelegate
|
||||
}
|
||||
})
|
||||
|
||||
if let secretPeer = peer as? TelegramSecretChat {
|
||||
if case let .secretChat(secretPeer) = peer {
|
||||
if let peer = peerMap[secretPeer.regularPeerId] {
|
||||
displayPeers.append(peer)
|
||||
}
|
||||
@ -8266,17 +8266,17 @@ final class PeerInfoScreenNode: ViewControllerTracingNode, UIScrollViewDelegate
|
||||
savedMessages = true
|
||||
} else {
|
||||
if displayPeers.count == 1, let peer = displayPeers.first {
|
||||
var peerName = peer.id == strongSelf.context.account.peerId ? presentationData.strings.DialogList_SavedMessages : EnginePeer(peer).displayTitle(strings: presentationData.strings, displayOrder: presentationData.nameDisplayOrder)
|
||||
var peerName = peer.id == strongSelf.context.account.peerId ? presentationData.strings.DialogList_SavedMessages : peer.displayTitle(strings: presentationData.strings, displayOrder: presentationData.nameDisplayOrder)
|
||||
peerName = peerName.replacingOccurrences(of: "**", with: "")
|
||||
text = messageIds.count == 1 ? presentationData.strings.Conversation_ForwardTooltip_Chat_One(peerName).string : presentationData.strings.Conversation_ForwardTooltip_Chat_Many(peerName).string
|
||||
} else if displayPeers.count == 2, let firstPeer = displayPeers.first, let secondPeer = displayPeers.last {
|
||||
var firstPeerName = firstPeer.id == strongSelf.context.account.peerId ? presentationData.strings.DialogList_SavedMessages : EnginePeer(firstPeer).displayTitle(strings: presentationData.strings, displayOrder: presentationData.nameDisplayOrder)
|
||||
var firstPeerName = firstPeer.id == strongSelf.context.account.peerId ? presentationData.strings.DialogList_SavedMessages : firstPeer.displayTitle(strings: presentationData.strings, displayOrder: presentationData.nameDisplayOrder)
|
||||
firstPeerName = firstPeerName.replacingOccurrences(of: "**", with: "")
|
||||
var secondPeerName = secondPeer.id == strongSelf.context.account.peerId ? presentationData.strings.DialogList_SavedMessages : EnginePeer(secondPeer).displayTitle(strings: presentationData.strings, displayOrder: presentationData.nameDisplayOrder)
|
||||
var secondPeerName = secondPeer.id == strongSelf.context.account.peerId ? presentationData.strings.DialogList_SavedMessages : secondPeer.displayTitle(strings: presentationData.strings, displayOrder: presentationData.nameDisplayOrder)
|
||||
secondPeerName = secondPeerName.replacingOccurrences(of: "**", with: "")
|
||||
text = messageIds.count == 1 ? presentationData.strings.Conversation_ForwardTooltip_TwoChats_One(firstPeerName, secondPeerName).string : presentationData.strings.Conversation_ForwardTooltip_TwoChats_Many(firstPeerName, secondPeerName).string
|
||||
} else if let peer = displayPeers.first {
|
||||
var peerName = EnginePeer(peer).displayTitle(strings: presentationData.strings, displayOrder: presentationData.nameDisplayOrder)
|
||||
var peerName = peer.displayTitle(strings: presentationData.strings, displayOrder: presentationData.nameDisplayOrder)
|
||||
peerName = peerName.replacingOccurrences(of: "**", with: "")
|
||||
text = messageIds.count == 1 ? presentationData.strings.Conversation_ForwardTooltip_ManyChats_One(peerName, "\(displayPeers.count - 1)").string : presentationData.strings.Conversation_ForwardTooltip_ManyChats_Many(peerName, "\(displayPeers.count - 1)").string
|
||||
} else {
|
||||
|
@ -111,7 +111,7 @@ final class MessageMediaPlaylistItem: SharedMediaPlaylistItem {
|
||||
case let .Audio(isVoice, duration, title, performer, _):
|
||||
let displayData: SharedMediaPlaybackDisplayData
|
||||
if isVoice {
|
||||
displayData = SharedMediaPlaybackDisplayData.voice(author: self.message.effectiveAuthor, peer: self.message.peers[self.message.id.peerId])
|
||||
displayData = SharedMediaPlaybackDisplayData.voice(author: self.message.effectiveAuthor.flatMap(EnginePeer.init), peer: self.message.peers[self.message.id.peerId].flatMap(EnginePeer.init))
|
||||
} else {
|
||||
var updatedTitle = title
|
||||
let updatedPerformer = performer
|
||||
@ -131,7 +131,7 @@ final class MessageMediaPlaylistItem: SharedMediaPlaylistItem {
|
||||
return displayData
|
||||
case let .Video(_, _, flags):
|
||||
if flags.contains(.instantRoundVideo) {
|
||||
return SharedMediaPlaybackDisplayData.instantVideo(author: self.message.effectiveAuthor, peer: self.message.peers[self.message.id.peerId], timestamp: self.message.timestamp)
|
||||
return SharedMediaPlaybackDisplayData.instantVideo(author: self.message.effectiveAuthor.flatMap(EnginePeer.init), peer: self.message.peers[self.message.id.peerId].flatMap(EnginePeer.init), timestamp: self.message.timestamp)
|
||||
} else {
|
||||
return nil
|
||||
}
|
||||
|
@ -18,13 +18,13 @@ public final class PeerSelectionControllerImpl: ViewController, PeerSelectionCon
|
||||
|
||||
private var customTitle: String?
|
||||
|
||||
public var peerSelected: ((Peer, Int64?) -> Void)?
|
||||
public var multiplePeersSelected: (([Peer], [PeerId: Peer], NSAttributedString, AttachmentTextInputPanelSendMode, ChatInterfaceForwardOptionsState?) -> Void)?
|
||||
public var peerSelected: ((EnginePeer, Int64?) -> Void)?
|
||||
public var multiplePeersSelected: (([EnginePeer], [EnginePeer.Id: EnginePeer], NSAttributedString, AttachmentTextInputPanelSendMode, ChatInterfaceForwardOptionsState?) -> Void)?
|
||||
private let filter: ChatListNodePeersFilter
|
||||
private let forumPeerId: EnginePeer.Id?
|
||||
private let selectForumThreads: Bool
|
||||
|
||||
private let attemptSelection: ((Peer, Int64?) -> Void)?
|
||||
private let attemptSelection: ((EnginePeer, Int64?) -> Void)?
|
||||
private let createNewGroup: (() -> Void)?
|
||||
|
||||
public var inProgress: Bool = false {
|
||||
@ -259,7 +259,7 @@ public final class PeerSelectionControllerImpl: ViewController, PeerSelectionCon
|
||||
|
||||
self.peerSelectionNode.requestOpenPeer = { [weak self] peer, threadId in
|
||||
if let strongSelf = self, let peerSelected = strongSelf.peerSelected {
|
||||
if let peer = peer as? TelegramChannel, peer.flags.contains(.isForum), threadId == nil, strongSelf.selectForumThreads {
|
||||
if case let .channel(peer) = peer, peer.flags.contains(.isForum), threadId == nil, strongSelf.selectForumThreads {
|
||||
let controller = PeerSelectionControllerImpl(
|
||||
PeerSelectionControllerParams(
|
||||
context: strongSelf.context,
|
||||
@ -296,10 +296,10 @@ public final class PeerSelectionControllerImpl: ViewController, PeerSelectionCon
|
||||
|
||||
self.peerSelectionNode.requestOpenPeerFromSearch = { [weak self] peer, threadId in
|
||||
if let strongSelf = self {
|
||||
strongSelf.openMessageFromSearchDisposable.set((strongSelf.context.engine.peers.ensurePeerIsLocallyAvailable(peer: EnginePeer(peer))
|
||||
strongSelf.openMessageFromSearchDisposable.set((strongSelf.context.engine.peers.ensurePeerIsLocallyAvailable(peer: peer)
|
||||
|> deliverOnMainQueue).start(completed: { [weak strongSelf] in
|
||||
if let strongSelf = strongSelf, let peerSelected = strongSelf.peerSelected {
|
||||
if let peer = peer as? TelegramChannel, peer.flags.contains(.isForum), threadId == nil, strongSelf.selectForumThreads {
|
||||
if case let .channel(peer) = peer, peer.flags.contains(.isForum), threadId == nil, strongSelf.selectForumThreads {
|
||||
let controller = PeerSelectionControllerImpl(
|
||||
PeerSelectionControllerParams(
|
||||
context: strongSelf.context,
|
||||
|
@ -78,11 +78,11 @@ final class PeerSelectionControllerNode: ASDisplayNode {
|
||||
|
||||
var requestActivateSearch: (() -> Void)?
|
||||
var requestDeactivateSearch: (() -> Void)?
|
||||
var requestOpenPeer: ((Peer, Int64?) -> Void)?
|
||||
var requestOpenDisabledPeer: ((Peer, Int64?) -> Void)?
|
||||
var requestOpenPeerFromSearch: ((Peer, Int64?) -> Void)?
|
||||
var requestOpenMessageFromSearch: ((Peer, Int64?, MessageId) -> Void)?
|
||||
var requestSend: (([Peer], [PeerId: Peer], NSAttributedString, AttachmentTextInputPanelSendMode, ChatInterfaceForwardOptionsState?) -> Void)?
|
||||
var requestOpenPeer: ((EnginePeer, Int64?) -> Void)?
|
||||
var requestOpenDisabledPeer: ((EnginePeer, Int64?) -> Void)?
|
||||
var requestOpenPeerFromSearch: ((EnginePeer, Int64?) -> Void)?
|
||||
var requestOpenMessageFromSearch: ((EnginePeer, Int64?, EngineMessage.Id) -> Void)?
|
||||
var requestSend: (([EnginePeer], [EnginePeer.Id: EnginePeer], NSAttributedString, AttachmentTextInputPanelSendMode, ChatInterfaceForwardOptionsState?) -> Void)?
|
||||
|
||||
private var presentationData: PresentationData {
|
||||
didSet {
|
||||
@ -241,15 +241,15 @@ final class PeerSelectionControllerNode: ASDisplayNode {
|
||||
|
||||
self.chatListNode?.peerSelected = { [weak self] peer, threadId, _, _, _ in
|
||||
self?.chatListNode?.clearHighlightAnimated(true)
|
||||
self?.requestOpenPeer?(peer._asPeer(), threadId)
|
||||
self?.requestOpenPeer?(peer, threadId)
|
||||
}
|
||||
self.mainContainerNode?.peerSelected = { [weak self] peer, threadId, _, _, _ in
|
||||
self?.chatListNode?.clearHighlightAnimated(true)
|
||||
self?.requestOpenPeer?(peer._asPeer(), threadId)
|
||||
self?.requestOpenPeer?(peer, threadId)
|
||||
}
|
||||
|
||||
self.chatListNode?.disabledPeerSelected = { [weak self] peer, threadId in
|
||||
self?.requestOpenDisabledPeer?(peer._asPeer(), threadId)
|
||||
self?.requestOpenDisabledPeer?(peer, threadId)
|
||||
}
|
||||
|
||||
self.chatListNode?.contentOffsetChanged = { [weak self] offset in
|
||||
@ -748,37 +748,37 @@ final class PeerSelectionControllerNode: ASDisplayNode {
|
||||
}
|
||||
}
|
||||
|
||||
private var selectedPeers: ([Peer], [PeerId: Peer]) {
|
||||
private var selectedPeers: ([EnginePeer], [EnginePeer.Id: EnginePeer]) {
|
||||
if self.contactListActive {
|
||||
let selectedContactPeers = self.contactListNode?.selectedPeers ?? []
|
||||
|
||||
var selectedPeers: [Peer] = []
|
||||
var selectedPeerMap: [PeerId: Peer] = [:]
|
||||
var selectedPeers: [EnginePeer] = []
|
||||
var selectedPeerMap: [EnginePeer.Id: EnginePeer] = [:]
|
||||
for contactPeer in selectedContactPeers {
|
||||
if case let .peer(peer, _, _) = contactPeer {
|
||||
selectedPeers.append(peer)
|
||||
selectedPeerMap[peer.id] = peer
|
||||
selectedPeers.append(EnginePeer(peer))
|
||||
selectedPeerMap[peer.id] = EnginePeer(peer)
|
||||
}
|
||||
}
|
||||
return (selectedPeers, selectedPeerMap)
|
||||
} else {
|
||||
var selectedPeerIds: [PeerId] = []
|
||||
var selectedPeerMap: [PeerId: Peer] = [:]
|
||||
var selectedPeerIds: [EnginePeer.Id] = []
|
||||
var selectedPeerMap: [EnginePeer.Id: EnginePeer] = [:]
|
||||
if let mainContainerNode = self.mainContainerNode {
|
||||
mainContainerNode.currentItemNode.updateState { state in
|
||||
selectedPeerIds = Array(state.selectedPeerIds)
|
||||
selectedPeerMap = state.selectedPeerMap.mapValues({ $0._asPeer() })
|
||||
selectedPeerMap = state.selectedPeerMap
|
||||
return state
|
||||
}
|
||||
}
|
||||
if let chatListNode = self.chatListNode {
|
||||
chatListNode.updateState { state in
|
||||
selectedPeerIds = Array(state.selectedPeerIds)
|
||||
selectedPeerMap = state.selectedPeerMap.mapValues({ $0._asPeer() })
|
||||
selectedPeerMap = state.selectedPeerMap
|
||||
return state
|
||||
}
|
||||
}
|
||||
var selectedPeers: [Peer] = []
|
||||
var selectedPeers: [EnginePeer] = []
|
||||
for peerId in selectedPeerIds {
|
||||
if let peer = selectedPeerMap[peerId] {
|
||||
selectedPeers.append(peer)
|
||||
@ -1158,17 +1158,17 @@ final class PeerSelectionControllerNode: ASDisplayNode {
|
||||
strongSelf.textInputPanelNode?.updateSendButtonEnabled(count > 0, animated: true)
|
||||
strongSelf.requestDeactivateSearch?()
|
||||
} else if let requestOpenPeerFromSearch = strongSelf.requestOpenPeerFromSearch {
|
||||
requestOpenPeerFromSearch(peer._asPeer(), threadId)
|
||||
requestOpenPeerFromSearch(peer, threadId)
|
||||
}
|
||||
},
|
||||
openDisabledPeer: { [weak self] peer, threadId in
|
||||
self?.requestOpenDisabledPeer?(peer._asPeer(), threadId)
|
||||
self?.requestOpenDisabledPeer?(peer, threadId)
|
||||
},
|
||||
openRecentPeerOptions: { _ in
|
||||
},
|
||||
openMessage: { [weak self] peer, threadId, messageId, _ in
|
||||
if let requestOpenMessageFromSearch = self?.requestOpenMessageFromSearch {
|
||||
requestOpenMessageFromSearch(peer._asPeer(), threadId, messageId)
|
||||
requestOpenMessageFromSearch(peer, threadId, messageId)
|
||||
}
|
||||
},
|
||||
addContact: nil,
|
||||
@ -1241,7 +1241,7 @@ final class PeerSelectionControllerNode: ASDisplayNode {
|
||||
let _ = (strongSelf.context.engine.data.get(TelegramEngine.EngineData.Item.Peer.Peer(id: peer.id))
|
||||
|> deliverOnMainQueue).start(next: { peer in
|
||||
if let strongSelf = self, let peer = peer {
|
||||
strongSelf.requestOpenPeerFromSearch?(peer._asPeer(), nil)
|
||||
strongSelf.requestOpenPeerFromSearch?(peer, nil)
|
||||
}
|
||||
})
|
||||
case .deviceContact:
|
||||
@ -1334,7 +1334,7 @@ final class PeerSelectionControllerNode: ASDisplayNode {
|
||||
contactListNode.openPeer = { [weak self] peer, _ in
|
||||
if case let .peer(peer, _, _) = peer {
|
||||
self?.contactListNode?.listNode.clearHighlightAnimated(true)
|
||||
self?.requestOpenPeer?(peer, nil)
|
||||
self?.requestOpenPeer?(EnginePeer(peer), nil)
|
||||
}
|
||||
}
|
||||
contactListNode.suppressPermissionWarning = { [weak self] in
|
||||
|
@ -661,7 +661,7 @@ public class ShareRootControllerImpl {
|
||||
|> deliverOnMainQueue).start(next: { parseInfo in
|
||||
switch parseInfo {
|
||||
case let .group(groupTitle):
|
||||
var attemptSelectionImpl: ((Peer) -> Void)?
|
||||
var attemptSelectionImpl: ((EnginePeer) -> Void)?
|
||||
var createNewGroupImpl: (() -> Void)?
|
||||
let controller = context.sharedContext.makePeerSelectionController(PeerSelectionControllerParams(context: context, filter: [.onlyGroups, .onlyManageable, .excludeDisabled, .doNotSearchMessages], hasContactSelector: false, hasGlobalSearch: false, title: presentationData.strings.ChatImport_Title, attemptSelection: { peer, _ in
|
||||
attemptSelectionImpl?(peer)
|
||||
@ -688,12 +688,12 @@ public class ShareRootControllerImpl {
|
||||
|
||||
attemptSelectionImpl = { peer in
|
||||
var errorText: String?
|
||||
if let channel = peer as? TelegramChannel {
|
||||
if case let .channel(channel) = peer {
|
||||
if channel.hasPermission(.changeInfo), (channel.flags.contains(.isCreator) || channel.adminRights != nil) {
|
||||
} else {
|
||||
errorText = presentationData.strings.ChatImport_SelectionErrorNotAdmin
|
||||
}
|
||||
} else if let group = peer as? TelegramGroup {
|
||||
} else if case let .legacyGroup(group) = peer {
|
||||
switch group.role {
|
||||
case .creator:
|
||||
break
|
||||
@ -718,19 +718,19 @@ public class ShareRootControllerImpl {
|
||||
let presentationData = internalContext.sharedContext.currentPresentationData.with { $0 }
|
||||
|
||||
var errorText: String?
|
||||
if let channel = peer as? TelegramChannel {
|
||||
if case let .channel(channel) = peer {
|
||||
if channel.hasPermission(.changeInfo), (channel.flags.contains(.isCreator) || channel.adminRights != nil) {
|
||||
} else {
|
||||
errorText = presentationData.strings.ChatImport_SelectionErrorNotAdmin
|
||||
}
|
||||
} else if let group = peer as? TelegramGroup {
|
||||
} else if case let .legacyGroup(group) = peer {
|
||||
switch group.role {
|
||||
case .creator:
|
||||
break
|
||||
default:
|
||||
errorText = presentationData.strings.ChatImport_SelectionErrorNotAdmin
|
||||
}
|
||||
} else if let _ = peer as? TelegramUser {
|
||||
} else if case .user = peer {
|
||||
} else {
|
||||
errorText = presentationData.strings.ChatImport_SelectionErrorGroupGeneric
|
||||
}
|
||||
@ -838,7 +838,7 @@ public class ShareRootControllerImpl {
|
||||
case let .privateChat(title):
|
||||
let presentationData = internalContext.sharedContext.currentPresentationData.with { $0 }
|
||||
|
||||
var attemptSelectionImpl: ((Peer) -> Void)?
|
||||
var attemptSelectionImpl: ((EnginePeer) -> Void)?
|
||||
let controller = context.sharedContext.makePeerSelectionController(PeerSelectionControllerParams(context: context, filter: [.onlyPrivateChats, .excludeDisabled, .doNotSearchMessages, .excludeSecretChats], hasChatListSelector: false, hasContactSelector: true, hasGlobalSearch: false, title: presentationData.strings.ChatImport_Title, attemptSelection: { peer, _ in
|
||||
attemptSelectionImpl?(peer)
|
||||
}, pretendPresentedInModal: true, selectForumThreads: true))
|
||||
@ -871,9 +871,9 @@ public class ShareRootControllerImpl {
|
||||
switch result {
|
||||
case .allowed:
|
||||
if let title = title {
|
||||
text = presentationData.strings.ChatImport_SelectionConfirmationUserWithTitle(title, EnginePeer(peer).displayTitle(strings: presentationData.strings, displayOrder: presentationData.nameDisplayOrder)).string
|
||||
text = presentationData.strings.ChatImport_SelectionConfirmationUserWithTitle(title, peer.displayTitle(strings: presentationData.strings, displayOrder: presentationData.nameDisplayOrder)).string
|
||||
} else {
|
||||
text = presentationData.strings.ChatImport_SelectionConfirmationUserWithoutTitle(EnginePeer(peer).displayTitle(strings: presentationData.strings, displayOrder: presentationData.nameDisplayOrder)).string
|
||||
text = presentationData.strings.ChatImport_SelectionConfirmationUserWithoutTitle(peer.displayTitle(strings: presentationData.strings, displayOrder: presentationData.nameDisplayOrder)).string
|
||||
}
|
||||
case let .alert(textValue):
|
||||
text = textValue
|
||||
@ -910,7 +910,7 @@ public class ShareRootControllerImpl {
|
||||
|
||||
navigationController.viewControllers = [controller]
|
||||
case let .unknown(peerTitle):
|
||||
var attemptSelectionImpl: ((Peer) -> Void)?
|
||||
var attemptSelectionImpl: ((EnginePeer) -> Void)?
|
||||
var createNewGroupImpl: (() -> Void)?
|
||||
let controller = context.sharedContext.makePeerSelectionController(PeerSelectionControllerParams(context: context, filter: [.excludeDisabled, .doNotSearchMessages], hasContactSelector: true, hasGlobalSearch: false, title: presentationData.strings.ChatImport_Title, attemptSelection: { peer, _ in
|
||||
attemptSelectionImpl?(peer)
|
||||
@ -928,7 +928,7 @@ public class ShareRootControllerImpl {
|
||||
|
||||
controller.navigationPresentation = .default
|
||||
|
||||
let beginWithPeer: (PeerId) -> Void = { peerId in
|
||||
let beginWithPeer: (EnginePeer.Id) -> Void = { peerId in
|
||||
navigationController.view.endEditing(true)
|
||||
navigationController.pushViewController(ChatImportActivityScreen(context: context, cancel: {
|
||||
self?.getExtensionContext()?.completeRequest(returningItems: nil, completionHandler: nil)
|
||||
@ -944,19 +944,19 @@ public class ShareRootControllerImpl {
|
||||
let presentationData = internalContext.sharedContext.currentPresentationData.with { $0 }
|
||||
|
||||
var errorText: String?
|
||||
if let channel = peer as? TelegramChannel {
|
||||
if case let .channel(channel) = peer {
|
||||
if channel.hasPermission(.changeInfo), (channel.flags.contains(.isCreator) || channel.adminRights != nil) {
|
||||
} else {
|
||||
errorText = presentationData.strings.ChatImport_SelectionErrorNotAdmin
|
||||
}
|
||||
} else if let group = peer as? TelegramGroup {
|
||||
} else if case let .legacyGroup(group) = peer {
|
||||
switch group.role {
|
||||
case .creator:
|
||||
break
|
||||
default:
|
||||
errorText = presentationData.strings.ChatImport_SelectionErrorNotAdmin
|
||||
}
|
||||
} else if let _ = peer as? TelegramUser {
|
||||
} else if case .user = peer {
|
||||
} else {
|
||||
errorText = presentationData.strings.ChatImport_SelectionErrorGroupGeneric
|
||||
}
|
||||
@ -968,14 +968,14 @@ public class ShareRootControllerImpl {
|
||||
strongSelf.mainWindow?.present(controller, on: .root)
|
||||
} else {
|
||||
let presentationData = internalContext.sharedContext.currentPresentationData.with { $0 }
|
||||
if let _ = peer as? TelegramUser {
|
||||
if case .user = peer {
|
||||
let text: String
|
||||
switch result {
|
||||
case .allowed:
|
||||
if let title = peerTitle {
|
||||
text = presentationData.strings.ChatImport_SelectionConfirmationUserWithTitle(title, EnginePeer(peer).displayTitle(strings: presentationData.strings, displayOrder: presentationData.nameDisplayOrder)).string
|
||||
text = presentationData.strings.ChatImport_SelectionConfirmationUserWithTitle(title, peer.displayTitle(strings: presentationData.strings, displayOrder: presentationData.nameDisplayOrder)).string
|
||||
} else {
|
||||
text = presentationData.strings.ChatImport_SelectionConfirmationUserWithoutTitle(EnginePeer(peer).displayTitle(strings: presentationData.strings, displayOrder: presentationData.nameDisplayOrder)).string
|
||||
text = presentationData.strings.ChatImport_SelectionConfirmationUserWithoutTitle(peer.displayTitle(strings: presentationData.strings, displayOrder: presentationData.nameDisplayOrder)).string
|
||||
}
|
||||
case let .alert(textValue):
|
||||
text = textValue
|
||||
|
@ -412,8 +412,8 @@ public final class SharedNotificationManager {
|
||||
}
|
||||
}
|
||||
|
||||
private var currentNotificationCall: (peer: Peer?, internalId: CallSessionInternalId)?
|
||||
private func updateNotificationCall(call: (peer: Peer?, internalId: CallSessionInternalId)?, strings: PresentationStrings, nameOrder: PresentationPersonNameOrder) {
|
||||
private var currentNotificationCall: (peer: EnginePeer?, internalId: CallSessionInternalId)?
|
||||
private func updateNotificationCall(call: (peer: EnginePeer?, internalId: CallSessionInternalId)?, strings: PresentationStrings, nameOrder: PresentationPersonNameOrder) {
|
||||
if let previousCall = currentNotificationCall {
|
||||
if #available(iOS 10.0, *) {
|
||||
let center = UNUserNotificationCenter.current()
|
||||
@ -431,7 +431,7 @@ public final class SharedNotificationManager {
|
||||
self.currentNotificationCall = call
|
||||
|
||||
if let notificationCall = call {
|
||||
let rawText = strings.PUSH_PHONE_CALL_REQUEST(notificationCall.peer.flatMap(EnginePeer.init)?.displayTitle(strings: strings, displayOrder: nameOrder) ?? "").string
|
||||
let rawText = strings.PUSH_PHONE_CALL_REQUEST(notificationCall.peer?.displayTitle(strings: strings, displayOrder: nameOrder) ?? "").string
|
||||
let title: String?
|
||||
let body: String
|
||||
if let index = rawText.firstIndex(of: "|") {
|
||||
@ -487,7 +487,7 @@ public final class SharedNotificationManager {
|
||||
let internalId = notificationCall.internalId
|
||||
let isIntegratedWithCallKit = notificationCall.isIntegratedWithCallKit
|
||||
self.notificationCallStateDisposable.set((notificationCall.state
|
||||
|> map { state -> (Peer?, CallSessionInternalId)? in
|
||||
|> map { state -> (EnginePeer?, CallSessionInternalId)? in
|
||||
if isIntegratedWithCallKit {
|
||||
return nil
|
||||
}
|
||||
|
@ -1,10 +1,8 @@
|
||||
import Foundation
|
||||
import UIKit
|
||||
import SwiftSignalKit
|
||||
import Postbox
|
||||
import TelegramCore
|
||||
import Display
|
||||
|
||||
import CoreSpotlight
|
||||
import MobileCoreServices
|
||||
|
||||
@ -31,7 +29,7 @@ private struct SpotlightIndexStorageItem: Codable, Equatable {
|
||||
private final class SpotlightIndexStorage {
|
||||
private let appBasePath: String
|
||||
private let basePath: String
|
||||
private var items: [PeerId: SpotlightIndexStorageItem] = [:]
|
||||
private var items: [EnginePeer.Id: SpotlightIndexStorageItem] = [:]
|
||||
|
||||
init(appBasePath: String, basePath: String) {
|
||||
self.appBasePath = appBasePath
|
||||
@ -46,7 +44,7 @@ private final class SpotlightIndexStorage {
|
||||
}
|
||||
}
|
||||
|
||||
private func path(peerId: PeerId) -> String {
|
||||
private func path(peerId: EnginePeer.Id) -> String {
|
||||
return self.basePath + "/p:\(UInt64(bitPattern: peerId.toInt64()))"
|
||||
}
|
||||
|
||||
@ -70,7 +68,7 @@ private final class SpotlightIndexStorage {
|
||||
if let path = url.path, let directoryName = url.lastPathComponent, directoryName.hasPrefix("p:") {
|
||||
let peerIdString = directoryName[directoryName.index(directoryName.startIndex, offsetBy: 2)...]
|
||||
if let peerIdValue = UInt64(peerIdString) {
|
||||
let peerId = PeerId(Int64(bitPattern: peerIdValue))
|
||||
let peerId = EnginePeer.Id(Int64(bitPattern: peerIdValue))
|
||||
|
||||
let item: SpotlightIndexStorageItem
|
||||
if let itemData = try? Data(contentsOf: URL(fileURLWithPath: path + "/data.json")), let decodedItem = try? JSONDecoder().decode(SpotlightIndexStorageItem.self, from: itemData) {
|
||||
@ -87,9 +85,9 @@ private final class SpotlightIndexStorage {
|
||||
}
|
||||
}
|
||||
|
||||
func update(items: [PeerId: SpotlightIndexStorageItem]) {
|
||||
func update(items: [EnginePeer.Id: SpotlightIndexStorageItem]) {
|
||||
let validPeerIds = Set(items.keys)
|
||||
var removePeerIds: [PeerId] = []
|
||||
var removePeerIds: [EnginePeer.Id] = []
|
||||
for (peerId, _) in self.items {
|
||||
if !validPeerIds.contains(peerId) {
|
||||
removePeerIds.append(peerId)
|
||||
@ -112,7 +110,7 @@ private final class SpotlightIndexStorage {
|
||||
let previousItem = self.items[peerId]
|
||||
if previousItem != item {
|
||||
var updatedAvatarSourcePath: String?
|
||||
if let avatarSourcePath = item.avatarSourcePath, let _ = fileSize(self.appBasePath + "/" + avatarSourcePath) {
|
||||
if let avatarSourcePath = item.avatarSourcePath, FileManager.default.fileExists(atPath: self.appBasePath + "/" + avatarSourcePath) {
|
||||
updatedAvatarSourcePath = avatarSourcePath
|
||||
}
|
||||
|
||||
@ -183,11 +181,11 @@ private final class SpotlightIndexStorage {
|
||||
}
|
||||
}
|
||||
|
||||
private func manageableSpotlightContacts(appBasePath: String, accounts: Signal<[Account], NoError>) -> Signal<[PeerId: SpotlightIndexStorageItem], NoError> {
|
||||
private func manageableSpotlightContacts(appBasePath: String, accounts: Signal<[Account], NoError>) -> Signal<[EnginePeer.Id: SpotlightIndexStorageItem], NoError> {
|
||||
let queue = Queue()
|
||||
return accounts
|
||||
|> mapToSignal { accounts -> Signal<[[PeerId: SpotlightIndexStorageItem]], NoError> in
|
||||
return combineLatest(queue: queue, accounts.map { account -> Signal<[PeerId: SpotlightIndexStorageItem], NoError> in
|
||||
|> mapToSignal { accounts -> Signal<[[EnginePeer.Id: SpotlightIndexStorageItem]], NoError> in
|
||||
return combineLatest(queue: queue, accounts.map { account -> Signal<[EnginePeer.Id: SpotlightIndexStorageItem], NoError> in
|
||||
return TelegramEngine(account: account).data.subscribe(
|
||||
TelegramEngine.EngineData.Item.Contacts.List(includePresences: false)
|
||||
)
|
||||
@ -261,7 +259,7 @@ private final class SpotlightDataContextImpl {
|
||||
})
|
||||
}
|
||||
|
||||
private func updateContacts(items: [PeerId: SpotlightIndexStorageItem]) {
|
||||
private func updateContacts(items: [EnginePeer.Id: SpotlightIndexStorageItem]) {
|
||||
self.indexStorage.update(items: items)
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,6 @@
|
||||
import Foundation
|
||||
import UIKit
|
||||
import TelegramCore
|
||||
import Postbox
|
||||
import Display
|
||||
import SwiftSignalKit
|
||||
import TelegramUIPreferences
|
||||
@ -17,7 +16,7 @@ import PresentationDataUtils
|
||||
import UrlWhitelist
|
||||
import UndoUI
|
||||
|
||||
func handleTextLinkActionImpl(context: AccountContext, peerId: PeerId?, navigateDisposable: MetaDisposable, controller: ViewController, action: TextLinkItemActionType, itemLink: TextLinkItem) {
|
||||
func handleTextLinkActionImpl(context: AccountContext, peerId: EnginePeer.Id?, navigateDisposable: MetaDisposable, controller: ViewController, action: TextLinkItemActionType, itemLink: TextLinkItem) {
|
||||
let presentImpl: (ViewController, Any?) -> Void = { controllerToPresent, _ in
|
||||
controller.present(controllerToPresent, in: .window(.root))
|
||||
}
|
||||
@ -33,11 +32,13 @@ func handleTextLinkActionImpl(context: AccountContext, peerId: PeerId?, navigate
|
||||
context.sharedContext.navigateToChatController(NavigateToChatControllerParams(navigationController: navigationController, context: context, chatLocation: .peer(peer), subject: subject, keepStack: .always, peekData: peekData))
|
||||
}
|
||||
case .info:
|
||||
let peerSignal: Signal<Peer?, NoError>
|
||||
peerSignal = context.account.postbox.loadedPeerWithId(peer.id) |> map(Optional.init)
|
||||
let peerSignal: Signal<EnginePeer?, NoError>
|
||||
peerSignal = context.engine.data.get(
|
||||
TelegramEngine.EngineData.Item.Peer.Peer(id: peer.id)
|
||||
)
|
||||
navigateDisposable.set((peerSignal |> take(1) |> deliverOnMainQueue).start(next: { peer in
|
||||
if let controller = controller, let peer = peer {
|
||||
if let infoController = context.sharedContext.makePeerInfoController(context: context, updatedPresentationData: nil, peer: peer, mode: .generic, avatarInitiallyExpanded: false, fromChat: false, requestsContext: nil) {
|
||||
if let infoController = context.sharedContext.makePeerInfoController(context: context, updatedPresentationData: nil, peer: peer._asPeer(), mode: .generic, avatarInitiallyExpanded: false, fromChat: false, requestsContext: nil) {
|
||||
(controller.navigationController as? NavigationController)?.pushViewController(infoController)
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,6 @@
|
||||
import Foundation
|
||||
import UIKit
|
||||
import AsyncDisplayKit
|
||||
import Postbox
|
||||
import TelegramCore
|
||||
import Display
|
||||
import TelegramPresentationData
|
||||
|
@ -4,7 +4,6 @@ import AsyncDisplayKit
|
||||
import Display
|
||||
import TelegramCore
|
||||
import SwiftSignalKit
|
||||
import Postbox
|
||||
import TelegramPresentationData
|
||||
|
||||
final class VerticalListContextResultsChatInputPanelButtonItem: ListViewItem {
|
||||
|
@ -4,7 +4,6 @@ import AsyncDisplayKit
|
||||
import Display
|
||||
import TelegramCore
|
||||
import SwiftSignalKit
|
||||
import Postbox
|
||||
import TelegramPresentationData
|
||||
import RadialStatusNode
|
||||
import PhotoResources
|
||||
@ -91,7 +90,7 @@ final class VerticalListContextResultsChatInputPanelItemNode: ListViewItemNode {
|
||||
private let highlightedBackgroundNode: ASDisplayNode
|
||||
private var statusDisposable = MetaDisposable()
|
||||
private let statusNode: RadialStatusNode = RadialStatusNode(backgroundNodeColor: UIColor(white: 0.0, alpha: 0.5))
|
||||
private var resourceStatus: MediaResourceStatus?
|
||||
private var resourceStatus: EngineMediaResource.FetchStatus?
|
||||
|
||||
private var currentIconImageResource: TelegramMediaResource?
|
||||
|
||||
@ -167,7 +166,7 @@ final class VerticalListContextResultsChatInputPanelItemNode: ListViewItemNode {
|
||||
var iconText: NSAttributedString?
|
||||
|
||||
var updateIconImageSignal: Signal<(TransformImageArguments) -> DrawingContext?, NoError>?
|
||||
var updatedStatusSignal: Signal<MediaResourceStatus, NoError>?
|
||||
var updatedStatusSignal: Signal<EngineMediaResource.FetchStatus, NoError>?
|
||||
|
||||
if let title = item.result.title {
|
||||
titleString = NSAttributedString(string: title, font: titleFont, textColor: item.theme.list.itemPrimaryTextColor)
|
||||
@ -233,7 +232,7 @@ final class VerticalListContextResultsChatInputPanelItemNode: ListViewItemNode {
|
||||
iconImageApply = iconImageLayout(arguments)
|
||||
|
||||
updatedStatusSignal = item.account.postbox.mediaBox.resourceStatus(imageResource)
|
||||
|
||||
|> map(EngineMediaResource.FetchStatus.init)
|
||||
}
|
||||
|
||||
var updatedIconImageResource = false
|
||||
@ -251,7 +250,7 @@ final class VerticalListContextResultsChatInputPanelItemNode: ListViewItemNode {
|
||||
updateIconImageSignal = chatMessageSticker(account: item.account, userLocation: .other, file: stickerFile, small: false, fetched: true)
|
||||
} else {
|
||||
let tmpRepresentation = TelegramMediaImageRepresentation(dimensions: PixelDimensions(width: 55, height: 55), resource: imageResource, progressiveSizes: [], immediateThumbnailData: nil, hasVideo: false, isPersonal: false)
|
||||
let tmpImage = TelegramMediaImage(imageId: MediaId(namespace: 0, id: 0), representations: [tmpRepresentation], immediateThumbnailData: nil, reference: nil, partialReference: nil, flags: [])
|
||||
let tmpImage = TelegramMediaImage(imageId: EngineMedia.Id(namespace: 0, id: 0), representations: [tmpRepresentation], immediateThumbnailData: nil, reference: nil, partialReference: nil, flags: [])
|
||||
updateIconImageSignal = chatWebpageSnippetPhoto(account: item.account, userLocation: .other, photoReference: .standalone(media: tmpImage))
|
||||
}
|
||||
} else {
|
||||
|
@ -1,6 +1,5 @@
|
||||
import Foundation
|
||||
import SwiftSignalKit
|
||||
import Postbox
|
||||
import TelegramCore
|
||||
import AccountContext
|
||||
import WatchBridge
|
||||
@ -16,7 +15,7 @@ public final class WatchManagerImpl: WatchManager {
|
||||
return self.arguments?.appInstalled ?? .single(false)
|
||||
}
|
||||
|
||||
public var navigateToMessageRequested: Signal<MessageId, NoError> {
|
||||
public var navigateToMessageRequested: Signal<EngineMessage.Id, NoError> {
|
||||
return self.arguments?.navigateToMessageRequested ?? .never()
|
||||
}
|
||||
|
||||
|
@ -2,7 +2,6 @@ import Foundation
|
||||
import UIKit
|
||||
import AsyncDisplayKit
|
||||
import TelegramCore
|
||||
import Postbox
|
||||
import SwiftSignalKit
|
||||
import Display
|
||||
import TelegramPresentationData
|
||||
|
@ -1,7 +1,7 @@
|
||||
import Foundation
|
||||
import Postbox
|
||||
import TelegramCore
|
||||
import SwiftSignalKit
|
||||
import Postbox
|
||||
|
||||
public struct CallListSettings: Codable, Equatable {
|
||||
public var _showTab: Bool?
|
||||
|
@ -1,17 +1,17 @@
|
||||
import Foundation
|
||||
import Postbox
|
||||
import SwiftSignalKit
|
||||
import TelegramCore
|
||||
import Postbox
|
||||
|
||||
public struct ChatArchiveSettings: Equatable, Codable {
|
||||
public var isHiddenByDefault: Bool
|
||||
public var hiddenPsaPeerId: PeerId?
|
||||
public var hiddenPsaPeerId: EnginePeer.Id?
|
||||
|
||||
public static var `default`: ChatArchiveSettings {
|
||||
return ChatArchiveSettings(isHiddenByDefault: false, hiddenPsaPeerId: nil)
|
||||
}
|
||||
|
||||
public init(isHiddenByDefault: Bool, hiddenPsaPeerId: PeerId?) {
|
||||
public init(isHiddenByDefault: Bool, hiddenPsaPeerId: EnginePeer.Id?) {
|
||||
self.isHiddenByDefault = isHiddenByDefault
|
||||
self.hiddenPsaPeerId = hiddenPsaPeerId
|
||||
}
|
||||
@ -20,7 +20,7 @@ public struct ChatArchiveSettings: Equatable, Codable {
|
||||
let container = try decoder.container(keyedBy: StringCodingKey.self)
|
||||
|
||||
self.isHiddenByDefault = (try container.decode(Int32.self, forKey: "isHiddenByDefault")) != 0
|
||||
self.hiddenPsaPeerId = (try container.decodeIfPresent(Int64.self, forKey: "hiddenPsaPeerId")).flatMap(PeerId.init)
|
||||
self.hiddenPsaPeerId = (try container.decodeIfPresent(Int64.self, forKey: "hiddenPsaPeerId")).flatMap(EnginePeer.Id.init)
|
||||
}
|
||||
|
||||
public func encode(to encoder: Encoder) throws {
|
||||
|
@ -2,7 +2,6 @@ import Foundation
|
||||
import SwiftSignalKit
|
||||
import TgVoipWebrtc
|
||||
import TelegramCore
|
||||
import Postbox
|
||||
|
||||
final class ContextQueueImpl: NSObject, OngoingCallThreadLocalContextQueueWebrtc {
|
||||
private let queue: Queue
|
||||
@ -47,7 +46,7 @@ final class NetworkBroadcastPartSource: BroadcastPartSource {
|
||||
private var dataSource: AudioBroadcastDataSource?
|
||||
|
||||
#if DEBUG
|
||||
private let debugDumpDirectory = TempBox.shared.tempDirectory()
|
||||
private let debugDumpDirectory = EngineTempBox.shared.tempDirectory()
|
||||
#endif
|
||||
|
||||
init(queue: Queue, engine: TelegramEngine, callId: Int64, accessHash: Int64, isExternalStream: Bool) {
|
||||
|
@ -791,7 +791,7 @@ public final class OngoingCallContext {
|
||||
return OngoingCallThreadLocalContext.maxLayer()
|
||||
}
|
||||
|
||||
private let tempStatsLogFile: EngineTempBoxFile
|
||||
private let tempStatsLogFile: EngineTempBox.File
|
||||
|
||||
private var signalingConnectionManager: QueueLocalObject<CallSignalingConnectionManager>?
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
import Foundation
|
||||
import Postbox
|
||||
import TelegramCore
|
||||
|
||||
public final class TelegramHashtag {
|
||||
public let peerName: String?
|
||||
@ -12,10 +12,10 @@ public final class TelegramHashtag {
|
||||
}
|
||||
|
||||
public final class TelegramPeerMention {
|
||||
public let peerId: PeerId
|
||||
public let peerId: EnginePeer.Id
|
||||
public let mention: String
|
||||
|
||||
public init(peerId: PeerId, mention: String) {
|
||||
public init(peerId: EnginePeer.Id, mention: String) {
|
||||
self.peerId = peerId
|
||||
self.mention = mention
|
||||
}
|
||||
|
@ -9,7 +9,6 @@ import TelegramAnimatedStickerNode
|
||||
import AppBundle
|
||||
import TelegramCore
|
||||
import TextFormat
|
||||
import Postbox
|
||||
import UrlEscaping
|
||||
import AccountContext
|
||||
|
||||
@ -20,7 +19,7 @@ public protocol TooltipCustomContentNode: ASDisplayNode {
|
||||
|
||||
public enum TooltipActiveTextItem {
|
||||
case url(String, Bool)
|
||||
case mention(PeerId, String)
|
||||
case mention(EnginePeer.Id, String)
|
||||
case textMention(String)
|
||||
case botCommand(String)
|
||||
case hashtag(String)
|
||||
|
@ -2,7 +2,6 @@ import Foundation
|
||||
import NaturalLanguage
|
||||
import SwiftSignalKit
|
||||
import TelegramCore
|
||||
import Postbox
|
||||
import AccountContext
|
||||
import TelegramUIPreferences
|
||||
|
||||
@ -69,7 +68,7 @@ public struct ChatTranslationState: Codable {
|
||||
}
|
||||
|
||||
private func cachedChatTranslationState(engine: TelegramEngine, peerId: EnginePeer.Id) -> Signal<ChatTranslationState?, NoError> {
|
||||
let key = ValueBoxKey(length: 8)
|
||||
let key = EngineDataBuffer(length: 8)
|
||||
key.setInt64(0, value: peerId.id._internalGetInt64Value())
|
||||
|
||||
return engine.data.subscribe(TelegramEngine.EngineData.Item.ItemCache.Item(collectionId: ApplicationSpecificItemCacheCollectionId.translationState, id: key))
|
||||
@ -79,7 +78,7 @@ private func cachedChatTranslationState(engine: TelegramEngine, peerId: EnginePe
|
||||
}
|
||||
|
||||
private func updateChatTranslationState(engine: TelegramEngine, peerId: EnginePeer.Id, state: ChatTranslationState?) -> Signal<Never, NoError> {
|
||||
let key = ValueBoxKey(length: 8)
|
||||
let key = EngineDataBuffer(length: 8)
|
||||
key.setInt64(0, value: peerId.id._internalGetInt64Value())
|
||||
|
||||
if let state {
|
||||
@ -90,7 +89,7 @@ private func updateChatTranslationState(engine: TelegramEngine, peerId: EnginePe
|
||||
}
|
||||
|
||||
public func updateChatTranslationStateInteractively(engine: TelegramEngine, peerId: EnginePeer.Id, _ f: @escaping (ChatTranslationState?) -> ChatTranslationState?) -> Signal<Never, NoError> {
|
||||
let key = ValueBoxKey(length: 8)
|
||||
let key = EngineDataBuffer(length: 8)
|
||||
key.setInt64(0, value: peerId.id._internalGetInt64Value())
|
||||
|
||||
return engine.data.get(TelegramEngine.EngineData.Item.ItemCache.Item(collectionId: ApplicationSpecificItemCacheCollectionId.translationState, id: key))
|
||||
@ -151,7 +150,7 @@ public func translateMessageIds(context: AccountContext, messageIds: [EngineMess
|
||||
}
|
||||
|
||||
public func chatTranslationState(context: AccountContext, peerId: EnginePeer.Id) -> Signal<ChatTranslationState?, NoError> {
|
||||
if peerId.id == PeerId.Id._internalFromInt64Value(777000) {
|
||||
if peerId.id == EnginePeer.Id.Id._internalFromInt64Value(777000) {
|
||||
return .single(nil)
|
||||
}
|
||||
|
||||
|
@ -2,7 +2,6 @@ import Foundation
|
||||
import UIKit
|
||||
import Display
|
||||
import SwiftSignalKit
|
||||
import Postbox
|
||||
import TelegramCore
|
||||
import TelegramPresentationData
|
||||
import TelegramUIPreferences
|
||||
|
@ -2,7 +2,6 @@ import Foundation
|
||||
import UIKit
|
||||
import Display
|
||||
import AsyncDisplayKit
|
||||
import Postbox
|
||||
import TelegramCore
|
||||
import SwiftSignalKit
|
||||
import AccountContext
|
||||
|
@ -4,7 +4,6 @@ import AsyncDisplayKit
|
||||
import Display
|
||||
import SwiftSignalKit
|
||||
import TelegramCore
|
||||
import Postbox
|
||||
import TelegramPresentationData
|
||||
import TextFormat
|
||||
import Markdown
|
||||
|
Loading…
x
Reference in New Issue
Block a user