mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00
UI improvements
This commit is contained in:
parent
4fbcfa7925
commit
08ee841e45
@ -223,7 +223,7 @@ private final class ShareContentInfoView: UIView {
|
||||
}
|
||||
}
|
||||
|
||||
textText.append(NSAttributedString(string: "\n\(params.strings.CollectibleItemInfo_ShareInlineText_LearnMore)", attributes: [
|
||||
textText.append(NSAttributedString(string: " \(params.strings.CollectibleItemInfo_ShareInlineText_LearnMore)", attributes: [
|
||||
.font: Font.medium(14.0),
|
||||
.foregroundColor: accentColor,
|
||||
NSAttributedString.Key(rawValue: "URL"): ""
|
||||
|
@ -521,7 +521,7 @@ public final class PresentationCallImpl: PresentationCall {
|
||||
presentationState = PresentationCallState(state: .terminated(id, reason, self.callWasActive && (options.contains(.reportRating) || self.shouldPresentCallRating)), videoState: mappedVideoState, remoteVideoState: .inactive, remoteAudioState: mappedRemoteAudioState, remoteBatteryLevel: mappedRemoteBatteryLevel)
|
||||
case let .requesting(ringing):
|
||||
presentationState = PresentationCallState(state: .requesting(ringing), videoState: mappedVideoState, remoteVideoState: mappedRemoteVideoState, remoteAudioState: mappedRemoteAudioState, remoteBatteryLevel: mappedRemoteBatteryLevel)
|
||||
case let .active(_, _, keyVisualHash, _, _, _, _):
|
||||
case let .active(_, _, keyVisualHash, _, _, _, _, _):
|
||||
self.callWasActive = true
|
||||
if let callContextState = callContextState {
|
||||
switch callContextState.state {
|
||||
@ -559,14 +559,14 @@ public final class PresentationCallImpl: PresentationCall {
|
||||
if let _ = audioSessionControl {
|
||||
self.audioSessionShouldBeActive.set(true)
|
||||
}
|
||||
case let .active(id, key, _, connections, maxLayer, version, allowsP2P):
|
||||
case let .active(id, key, _, connections, maxLayer, version, customParameters, allowsP2P):
|
||||
self.audioSessionShouldBeActive.set(true)
|
||||
if let _ = audioSessionControl, !wasActive || previousControl == nil {
|
||||
let logName = "\(id.id)_\(id.accessHash)"
|
||||
|
||||
let updatedConnections = connections
|
||||
|
||||
let ongoingContext = OngoingCallContext(account: self.context.account, callSessionManager: self.callSessionManager, callId: id, internalId: self.internalId, proxyServer: proxyServer, initialNetworkType: self.currentNetworkType, updatedNetworkType: self.updatedNetworkType, serializedData: self.serializedData, dataSaving: dataSaving, key: key, isOutgoing: sessionState.isOutgoing, video: self.videoCapturer, connections: updatedConnections, maxLayer: maxLayer, version: version, allowP2P: allowsP2P, enableTCP: self.enableTCP, enableStunMarking: self.enableStunMarking, audioSessionActive: self.audioSessionActive.get(), logName: logName, preferredVideoCodec: self.preferredVideoCodec, audioDevice: self.sharedAudioDevice)
|
||||
let ongoingContext = OngoingCallContext(account: self.context.account, callSessionManager: self.callSessionManager, callId: id, internalId: self.internalId, proxyServer: proxyServer, initialNetworkType: self.currentNetworkType, updatedNetworkType: self.updatedNetworkType, serializedData: self.serializedData, dataSaving: dataSaving, key: key, isOutgoing: sessionState.isOutgoing, video: self.videoCapturer, connections: updatedConnections, maxLayer: maxLayer, version: version, customParameters: customParameters, allowP2P: allowsP2P, enableTCP: self.enableTCP, enableStunMarking: self.enableStunMarking, audioSessionActive: self.audioSessionActive.get(), logName: logName, preferredVideoCodec: self.preferredVideoCodec, audioDevice: self.sharedAudioDevice)
|
||||
self.ongoingContext = ongoingContext
|
||||
ongoingContext.setIsMuted(self.isMutedValue)
|
||||
if let requestedVideoAspect = self.requestedVideoAspect {
|
||||
|
@ -894,7 +894,7 @@ private final class MultipartFetchManager {
|
||||
case .fatal:
|
||||
strongSelf.finishWithError(.generic)
|
||||
case .revalidateMediaReference:
|
||||
if !strongSelf.revalidatingMediaReference && !strongSelf.revalidatedMediaReference {
|
||||
if !strongSelf.revalidatingMediaReference {
|
||||
strongSelf.revalidatingMediaReference = true
|
||||
for (_, part) in strongSelf.fetchingParts {
|
||||
part.disposable.dispose()
|
||||
|
@ -60,7 +60,7 @@ enum CallSessionInternalState {
|
||||
case requesting(a: Data, disposable: Disposable)
|
||||
case requested(id: Int64, accessHash: Int64, a: Data, gA: Data, config: SecretChatEncryptionConfig, remoteConfirmationTimestamp: Int32?)
|
||||
case confirming(id: Int64, accessHash: Int64, key: Data, keyId: Int64, keyVisualHash: Data, disposable: Disposable)
|
||||
case active(id: Int64, accessHash: Int64, beginTimestamp: Int32, key: Data, keyId: Int64, keyVisualHash: Data, connections: CallSessionConnectionSet, maxLayer: Int32, version: String, allowsP2P: Bool)
|
||||
case active(id: Int64, accessHash: Int64, beginTimestamp: Int32, key: Data, keyId: Int64, keyVisualHash: Data, connections: CallSessionConnectionSet, maxLayer: Int32, version: String, customParameters: [String: Any], allowsP2P: Bool)
|
||||
case dropping(reason: CallSessionTerminationReason, disposable: Disposable)
|
||||
case terminated(id: Int64?, accessHash: Int64?, reason: CallSessionTerminationReason, reportRating: Bool, sendDebugLogs: Bool)
|
||||
|
||||
@ -78,7 +78,7 @@ enum CallSessionInternalState {
|
||||
return id
|
||||
case let .confirming(id, _, _, _, _, _):
|
||||
return id
|
||||
case let .active(id, _, _, _, _, _, _, _, _, _):
|
||||
case let .active(id, _, _, _, _, _, _, _, _, _, _):
|
||||
return id
|
||||
case .dropping:
|
||||
return nil
|
||||
@ -143,7 +143,7 @@ public enum CallSessionState {
|
||||
case ringing
|
||||
case accepting
|
||||
case requesting(ringing: Bool)
|
||||
case active(id: CallId, key: Data, keyVisualHash: Data, connections: CallSessionConnectionSet, maxLayer: Int32, version: String, allowsP2P: Bool)
|
||||
case active(id: CallId, key: Data, keyVisualHash: Data, connections: CallSessionConnectionSet, maxLayer: Int32, version: String, customParameters: [String: Any], allowsP2P: Bool)
|
||||
case dropping(reason: CallSessionTerminationReason)
|
||||
case terminated(id: CallId?, reason: CallSessionTerminationReason, options: CallTerminationOptions)
|
||||
|
||||
@ -159,8 +159,8 @@ public enum CallSessionState {
|
||||
self = .requesting(ringing: true)
|
||||
case let .requested(_, _, _, _, _, remoteConfirmationTimestamp):
|
||||
self = .requesting(ringing: remoteConfirmationTimestamp != nil)
|
||||
case let .active(id, accessHash, _, key, _, keyVisualHash, connections, maxLayer, version, allowsP2P):
|
||||
self = .active(id: CallId(id: id, accessHash: accessHash), key: key, keyVisualHash: keyVisualHash, connections: connections, maxLayer: maxLayer, version: version, allowsP2P: allowsP2P)
|
||||
case let .active(id, accessHash, _, key, _, keyVisualHash, connections, maxLayer, version, customParameters, allowsP2P):
|
||||
self = .active(id: CallId(id: id, accessHash: accessHash), key: key, keyVisualHash: keyVisualHash, connections: connections, maxLayer: maxLayer, version: version, customParameters: customParameters, allowsP2P: allowsP2P)
|
||||
case let .dropping(reason, _):
|
||||
self = .dropping(reason: reason)
|
||||
case let .terminated(id, accessHash, reason, reportRating, sendDebugLogs):
|
||||
@ -615,7 +615,7 @@ private final class CallSessionManagerContext {
|
||||
case let .accepting(id, accessHash, _, _, disposable):
|
||||
dropData = (id, accessHash, .abort)
|
||||
disposable.dispose()
|
||||
case let .active(id, accessHash, beginTimestamp, _, _, _, _, _, _, _):
|
||||
case let .active(id, accessHash, beginTimestamp, _, _, _, _, _, _, _, _):
|
||||
let duration = max(0, Int32(CFAbsoluteTimeGetCurrent()) - beginTimestamp)
|
||||
let internalReason: DropCallSessionReason
|
||||
switch reason {
|
||||
@ -731,9 +731,9 @@ private final class CallSessionManagerContext {
|
||||
case let .waiting(config):
|
||||
context.state = .awaitingConfirmation(id: id, accessHash: accessHash, gAHash: gAHash, b: b, config: config)
|
||||
strongSelf.contextUpdated(internalId: internalId)
|
||||
case let .call(config, gA, timestamp, connections, maxLayer, version, allowsP2P):
|
||||
case let .call(config, gA, timestamp, connections, maxLayer, version, customParameters, allowsP2P):
|
||||
if let (key, keyId, keyVisualHash) = strongSelf.makeSessionEncryptionKey(config: config, gAHash: gAHash, b: b, gA: gA) {
|
||||
context.state = .active(id: id, accessHash: accessHash, beginTimestamp: timestamp, key: key, keyId: keyId, keyVisualHash: keyVisualHash, connections: connections, maxLayer: maxLayer, version: version, allowsP2P: allowsP2P)
|
||||
context.state = .active(id: id, accessHash: accessHash, beginTimestamp: timestamp, key: key, keyId: keyId, keyVisualHash: keyVisualHash, connections: connections, maxLayer: maxLayer, version: version, customParameters: customParameters, allowsP2P: allowsP2P)
|
||||
strongSelf.contextUpdated(internalId: internalId)
|
||||
} else {
|
||||
strongSelf.drop(internalId: internalId, reason: .disconnect, debugLog: .single(nil))
|
||||
@ -754,7 +754,7 @@ private final class CallSessionManagerContext {
|
||||
func sendSignalingData(internalId: CallSessionInternalId, data: Data) {
|
||||
if let context = self.contexts[internalId] {
|
||||
switch context.state {
|
||||
case let .active(id, accessHash, _, _, _, _, _, _, _, _):
|
||||
case let .active(id, accessHash, _, _, _, _, _, _, _, _, _):
|
||||
context.signalingDisposables.add(self.network.request(Api.functions.phone.sendSignalingData(peer: .inputPhoneCall(id: id, accessHash: accessHash), data: Buffer(data: data))).start())
|
||||
default:
|
||||
break
|
||||
@ -856,7 +856,7 @@ private final class CallSessionManagerContext {
|
||||
disposable.dispose()
|
||||
context.state = .terminated(id: id, accessHash: accessHash, reason: parsedReason, reportRating: reportRating, sendDebugLogs: sendDebugLogs)
|
||||
self.contextUpdated(internalId: internalId)
|
||||
case let .active(id, accessHash, _, _, _, _, _, _, _, _):
|
||||
case let .active(id, accessHash, _, _, _, _, _, _, _, _, _):
|
||||
context.state = .terminated(id: id, accessHash: accessHash, reason: parsedReason, reportRating: reportRating, sendDebugLogs: sendDebugLogs)
|
||||
self.contextUpdated(internalId: internalId)
|
||||
case let .awaitingConfirmation(id, accessHash, _, _, _):
|
||||
@ -897,10 +897,12 @@ private final class CallSessionManagerContext {
|
||||
switch callProtocol {
|
||||
case let .phoneCallProtocol(_, _, maxLayer, versions):
|
||||
if !versions.isEmpty {
|
||||
let customParameters: [String: Any] = [:]
|
||||
|
||||
let isVideoPossible = self.videoVersions().contains(where: { versions.contains($0) })
|
||||
context.isVideoPossible = isVideoPossible
|
||||
|
||||
context.state = .active(id: id, accessHash: accessHash, beginTimestamp: startDate, key: key, keyId: calculatedKeyId, keyVisualHash: keyVisualHash, connections: parseConnectionSet(primary: connections.first!, alternative: Array(connections[1...])), maxLayer: maxLayer, version: versions[0], allowsP2P: allowsP2P)
|
||||
context.state = .active(id: id, accessHash: accessHash, beginTimestamp: startDate, key: key, keyId: calculatedKeyId, keyVisualHash: keyVisualHash, connections: parseConnectionSet(primary: connections.first!, alternative: Array(connections[1...])), maxLayer: maxLayer, version: versions[0], customParameters: customParameters, allowsP2P: allowsP2P)
|
||||
self.contextUpdated(internalId: internalId)
|
||||
} else {
|
||||
self.drop(internalId: internalId, reason: .disconnect, debugLog: .single(nil))
|
||||
@ -916,10 +918,12 @@ private final class CallSessionManagerContext {
|
||||
switch callProtocol {
|
||||
case let .phoneCallProtocol(_, _, maxLayer, versions):
|
||||
if !versions.isEmpty {
|
||||
let customParameters: [String: Any] = [:]
|
||||
|
||||
let isVideoPossible = self.videoVersions().contains(where: { versions.contains($0) })
|
||||
context.isVideoPossible = isVideoPossible
|
||||
|
||||
context.state = .active(id: id, accessHash: accessHash, beginTimestamp: startDate, key: key, keyId: keyId, keyVisualHash: keyVisualHash, connections: parseConnectionSet(primary: connections.first!, alternative: Array(connections[1...])), maxLayer: maxLayer, version: versions[0], allowsP2P: allowsP2P)
|
||||
context.state = .active(id: id, accessHash: accessHash, beginTimestamp: startDate, key: key, keyId: keyId, keyVisualHash: keyVisualHash, connections: parseConnectionSet(primary: connections.first!, alternative: Array(connections[1...])), maxLayer: maxLayer, version: versions[0], customParameters: customParameters, allowsP2P: allowsP2P)
|
||||
self.contextUpdated(internalId: internalId)
|
||||
} else {
|
||||
self.drop(internalId: internalId, reason: .disconnect, debugLog: .single(nil))
|
||||
@ -1199,7 +1203,7 @@ public final class CallSessionManager {
|
||||
|
||||
private enum AcceptedCall {
|
||||
case waiting(config: SecretChatEncryptionConfig)
|
||||
case call(config: SecretChatEncryptionConfig, gA: Data, timestamp: Int32, connections: CallSessionConnectionSet, maxLayer: Int32, version: String, allowsP2P: Bool)
|
||||
case call(config: SecretChatEncryptionConfig, gA: Data, timestamp: Int32, connections: CallSessionConnectionSet, maxLayer: Int32, version: String, customParameters: [String: Any], allowsP2P: Bool)
|
||||
}
|
||||
|
||||
private enum AcceptCallResult {
|
||||
@ -1244,7 +1248,8 @@ private func acceptCallSession(accountPeerId: PeerId, postbox: Postbox, network:
|
||||
switch callProtocol{
|
||||
case let .phoneCallProtocol(_, _, maxLayer, versions):
|
||||
if !versions.isEmpty {
|
||||
return .success(.call(config: config, gA: gAOrB.makeData(), timestamp: startDate, connections: parseConnectionSet(primary: connections.first!, alternative: Array(connections[1...])), maxLayer: maxLayer, version: versions[0], allowsP2P: (flags & (1 << 5)) != 0))
|
||||
let customParameters: [String: Any] = [:]
|
||||
return .success(.call(config: config, gA: gAOrB.makeData(), timestamp: startDate, connections: parseConnectionSet(primary: connections.first!, alternative: Array(connections[1...])), maxLayer: maxLayer, version: versions[0], customParameters: customParameters, allowsP2P: (flags & (1 << 5)) != 0))
|
||||
} else {
|
||||
return .failed
|
||||
}
|
||||
|
@ -1235,9 +1235,8 @@ private final class EmptyAttachedDescriptionNode: HighlightTrackingButtonNode {
|
||||
self.textNode.maximumNumberOfLines = 0
|
||||
|
||||
self.textMaskNode = LinkHighlightingNode(color: .white)
|
||||
self.textMaskNode.innerRadius = 5.0
|
||||
self.textMaskNode.outerRadius = 10.0
|
||||
self.textMaskNode.inset = 0.0
|
||||
self.textMaskNode.useModernPathCalculation = true
|
||||
|
||||
self.badgeTextNode = ImmediateTextNode()
|
||||
self.badgeBackgroundView = UIImageView()
|
||||
@ -1363,12 +1362,37 @@ private final class EmptyAttachedDescriptionNode: HighlightTrackingButtonNode {
|
||||
}
|
||||
}
|
||||
for i in 0 ..< labelRects.count {
|
||||
labelRects[i] = labelRects[i].insetBy(dx: -6.0, dy: floor((labelRects[i].height - 20.0) / 2.0))
|
||||
labelRects[i].size.height = 20.0
|
||||
labelRects[i] = labelRects[i].insetBy(dx: -6.0, dy: 0.0)
|
||||
if i == 0 {
|
||||
labelRects[i].origin.y -= 2.0
|
||||
labelRects[i].size.height += 2.0
|
||||
}
|
||||
if i == labelRects.count - 1 {
|
||||
labelRects[i].size.height += 2.0
|
||||
} else {
|
||||
let deltaY = labelRects[i + 1].minY - labelRects[i].maxY
|
||||
let topDelta = deltaY * 0.5 + 2.0
|
||||
let bottomDelta = deltaY * 0.5 - 2.0
|
||||
labelRects[i].size.height += topDelta
|
||||
labelRects[i + 1].origin.y -= bottomDelta
|
||||
labelRects[i + 1].size.height += bottomDelta
|
||||
}
|
||||
labelRects[i].origin.x = floor((textLayout.size.width - labelRects[i].width) / 2.0)
|
||||
}
|
||||
for i in 0 ..< labelRects.count {
|
||||
labelRects[i].origin.y -= 12.0
|
||||
}
|
||||
if !labelRects.isEmpty {
|
||||
self.textMaskNode.innerRadius = labelRects[0].height * 0.5
|
||||
self.textMaskNode.outerRadius = labelRects[0].height * 0.5
|
||||
}
|
||||
self.textMaskNode.updateRects(labelRects)
|
||||
|
||||
/*if self.textMaskNode.supernode == nil {
|
||||
self.addSubnode(self.textMaskNode)
|
||||
self.textMaskNode.alpha = 0.5
|
||||
}*/
|
||||
|
||||
let size = CGSize(width: textLayout.size.width + 4.0 * 2.0, height: textLayout.size.height + 4.0 * 2.0)
|
||||
let textFrame = CGRect(origin: CGPoint(x: 4.0, y: 4.0), size: textLayout.size)
|
||||
self.textNode.frame = textFrame
|
||||
@ -1387,7 +1411,7 @@ private final class EmptyAttachedDescriptionNode: HighlightTrackingButtonNode {
|
||||
self.badgeBackgroundView.frame = badgeBackgroundFrame
|
||||
}
|
||||
|
||||
self.textMaskNode.frame = CGRect(origin: CGPoint(x: textFrame.minX - self.textMaskNode.inset + 4.0, y: textFrame.minY - self.textMaskNode.inset - 11.0), size: CGSize())
|
||||
self.textMaskNode.frame = textFrame.offsetBy(dx: 3.0, dy: 0.0)
|
||||
|
||||
if let wallpaperBackgroundNode {
|
||||
if self.backgroundContent == nil, let backgroundContent = wallpaperBackgroundNode.makeBubbleBackground(for: .free) {
|
||||
|
@ -33,6 +33,8 @@ swift_library(
|
||||
"//submodules/TelegramStringFormatting",
|
||||
"//submodules/AvatarNode",
|
||||
"//submodules/PhoneNumberFormat",
|
||||
"//submodules/UndoUI",
|
||||
"//submodules/TelegramUI/Components/LottieComponent",
|
||||
],
|
||||
visibility = [
|
||||
"//visibility:public",
|
||||
|
@ -16,6 +16,8 @@ import AvatarNode
|
||||
import TelegramPresentationData
|
||||
import PhoneNumberFormat
|
||||
import BundleIconComponent
|
||||
import UndoUI
|
||||
import LottieComponent
|
||||
|
||||
private final class PeerBadgeComponent: Component {
|
||||
let context: AccountContext
|
||||
@ -164,6 +166,7 @@ private final class CollectibleItemInfoScreenContentComponent: Component {
|
||||
private let copyButton = ComponentView<Empty>()
|
||||
|
||||
private var component: CollectibleItemInfoScreenContentComponent?
|
||||
private var environment: EnvironmentType?
|
||||
|
||||
private var currencySymbolIcon: UIImage?
|
||||
|
||||
@ -179,9 +182,10 @@ private final class CollectibleItemInfoScreenContentComponent: Component {
|
||||
self.component = component
|
||||
|
||||
let environment = environment[EnvironmentType.self].value
|
||||
self.environment = environment
|
||||
|
||||
let sideInset: CGFloat = 16.0
|
||||
let contentSideInset: CGFloat = sideInset + 16.0
|
||||
let contentSideInset: CGFloat = sideInset + 4.0
|
||||
|
||||
var contentHeight: CGFloat = 0.0
|
||||
contentHeight += 30.0
|
||||
@ -202,19 +206,27 @@ private final class CollectibleItemInfoScreenContentComponent: Component {
|
||||
contentHeight += iconBackgroundSize.height
|
||||
contentHeight += 16.0
|
||||
|
||||
let iconAnimationName: String
|
||||
switch component.initialData.subject {
|
||||
case .username:
|
||||
iconAnimationName = "anim_collectible_username"
|
||||
case .phoneNumber:
|
||||
iconAnimationName = "anim_collectible_generic"
|
||||
}
|
||||
let iconSize = self.icon.update(
|
||||
transition: transition,
|
||||
component: AnyComponent(BundleIconComponent(
|
||||
name: "Peer Info/CollectibleUsernameInfoTitleIcon",
|
||||
tintColor: environment.theme.list.itemCheckColors.foregroundColor
|
||||
component: AnyComponent(LottieComponent(
|
||||
content: LottieComponent.AppBundleContent(name: iconAnimationName),
|
||||
loop: false
|
||||
)),
|
||||
environment: {},
|
||||
containerSize: iconBackgroundFrame.size
|
||||
containerSize: CGSize(width: floor(iconBackgroundFrame.size.width * 0.8), height: floor(iconBackgroundFrame.size.height * 0.8))
|
||||
)
|
||||
let iconFrame = CGRect(origin: CGPoint(x: iconBackgroundFrame.minX + floor((iconBackgroundFrame.width - iconSize.width) * 0.5), y: iconBackgroundFrame.minY + floor((iconBackgroundFrame.height - iconSize.height) * 0.5)), size: iconSize)
|
||||
if let iconView = self.icon.view {
|
||||
if let iconView = self.icon.view as? LottieComponent.View {
|
||||
if iconView.superview == nil {
|
||||
self.addSubview(iconView)
|
||||
iconView.playOnce(delay: 0.1)
|
||||
}
|
||||
transition.setFrame(view: iconView, frame: iconFrame)
|
||||
}
|
||||
@ -488,7 +500,6 @@ private final class CollectibleItemInfoScreenContentComponent: Component {
|
||||
copyButtonTitle = environment.strings.CollectibleItemInfo_ButtonCopyPhone
|
||||
}
|
||||
|
||||
|
||||
let copyButtonSize = self.copyButton.update(
|
||||
transition: transition,
|
||||
component: AnyComponent(PlainButtonComponent(
|
||||
@ -500,18 +511,25 @@ private final class CollectibleItemInfoScreenContentComponent: Component {
|
||||
minSize: CGSize(width: availableSize.width - sideInset * 2.0, height: 50.0),
|
||||
contentInsets: UIEdgeInsets(),
|
||||
action: { [weak self] in
|
||||
guard let self, let component = self.component else {
|
||||
guard let self, let component = self.component, let environment = self.environment else {
|
||||
return
|
||||
}
|
||||
|
||||
let toastText: String
|
||||
switch component.initialData.subject {
|
||||
case let .username(username):
|
||||
UIPasteboard.general.string = "https://t.me/\(username.username)"
|
||||
toastText = environment.strings.Conversation_LinkCopied
|
||||
case let .phoneNumber(phoneNumber):
|
||||
let formattedPhoneNumber = formatPhoneNumber(context: component.context, number: phoneNumber.phoneNumber)
|
||||
UIPasteboard.general.string = formattedPhoneNumber
|
||||
//TODO:localize
|
||||
toastText = "Phone number copied to clipboard."
|
||||
}
|
||||
|
||||
let presentationData = component.context.sharedContext.currentPresentationData.with { $0 }
|
||||
environment.controller()?.present(UndoOverlayController(presentationData: presentationData, content: .linkCopied(text: toastText), elevatedLayout: false, animateInAsReplacement: false, action: { _ in return false }), in: .window(.root))
|
||||
|
||||
component.dismiss()
|
||||
},
|
||||
isEnabled: true,
|
||||
|
Binary file not shown.
Binary file not shown.
@ -826,7 +826,7 @@ public final class OngoingCallContext {
|
||||
}
|
||||
}
|
||||
|
||||
public init(account: Account, callSessionManager: CallSessionManager, callId: CallId, internalId: CallSessionInternalId, proxyServer: ProxyServerSettings?, initialNetworkType: NetworkType, updatedNetworkType: Signal<NetworkType, NoError>, serializedData: String?, dataSaving: VoiceCallDataSaving, key: Data, isOutgoing: Bool, video: OngoingCallVideoCapturer?, connections: CallSessionConnectionSet, maxLayer: Int32, version: String, allowP2P: Bool, enableTCP: Bool, enableStunMarking: Bool, audioSessionActive: Signal<Bool, NoError>, logName: String, preferredVideoCodec: String?, audioDevice: AudioDevice?) {
|
||||
public init(account: Account, callSessionManager: CallSessionManager, callId: CallId, internalId: CallSessionInternalId, proxyServer: ProxyServerSettings?, initialNetworkType: NetworkType, updatedNetworkType: Signal<NetworkType, NoError>, serializedData: String?, dataSaving: VoiceCallDataSaving, key: Data, isOutgoing: Bool, video: OngoingCallVideoCapturer?, connections: CallSessionConnectionSet, maxLayer: Int32, version: String, customParameters: [String: Any], allowP2P: Bool, enableTCP: Bool, enableStunMarking: Bool, audioSessionActive: Signal<Bool, NoError>, logName: String, preferredVideoCodec: String?, audioDevice: AudioDevice?) {
|
||||
let _ = setupLogs
|
||||
OngoingCallThreadLocalContext.applyServerConfig(serializedData)
|
||||
|
||||
@ -958,8 +958,14 @@ public final class OngoingCallContext {
|
||||
directConnection = nil
|
||||
}
|
||||
|
||||
#if DEBUG
|
||||
//var customParameters = customParameters
|
||||
//customParameters["v9_reflector_shortcircuit"] = true as NSNumber
|
||||
#endif
|
||||
|
||||
let context = OngoingCallThreadLocalContextWebrtc(
|
||||
version: version,
|
||||
customParameters: customParameters,
|
||||
queue: OngoingCallThreadLocalContextQueueImpl(queue: queue),
|
||||
proxy: voipProxyServer,
|
||||
networkType: ongoingNetworkTypeForTypeWebrtc(initialNetworkType),
|
||||
@ -1556,17 +1562,7 @@ private final class CallSignalingConnectionImpl: CallSignalingConnection {
|
||||
self.dataReceived = dataReceived
|
||||
self.isClosed = isClosed
|
||||
|
||||
#if DEBUG
|
||||
if #available(iOS 15.0, *) {
|
||||
let parameters = NWParameters.quic(alpn: ["tgcalls"])
|
||||
parameters.defaultProtocolStack.internetProtocol = NWProtocolFramer.Options(definition: CustomWrapperProtocol.definition)
|
||||
self.connection = NWConnection(host: self.host, port: self.port, using: parameters)
|
||||
} else {
|
||||
preconditionFailure()
|
||||
}
|
||||
#else
|
||||
self.connection = NWConnection(host: self.host, port: self.port, using: .tcp)
|
||||
#endif
|
||||
|
||||
self.connection.stateUpdateHandler = { [weak self] state in
|
||||
queue.async {
|
||||
|
@ -242,7 +242,9 @@ typedef NS_ENUM(int32_t, OngoingCallDataSavingWebrtc) {
|
||||
@property (nonatomic, copy) void (^ _Nullable signalBarsChanged)(int32_t);
|
||||
@property (nonatomic, copy) void (^ _Nullable audioLevelUpdated)(float);
|
||||
|
||||
- (instancetype _Nonnull)initWithVersion:(NSString * _Nonnull)version queue:(id<OngoingCallThreadLocalContextQueueWebrtc> _Nonnull)queue
|
||||
- (instancetype _Nonnull)initWithVersion:(NSString * _Nonnull)version
|
||||
customParameters:(NSDictionary<NSString *, id> * _Nonnull)customParameters
|
||||
queue:(id<OngoingCallThreadLocalContextQueueWebrtc> _Nonnull)queue
|
||||
proxy:(VoipProxyServerWebrtc * _Nullable)proxy
|
||||
networkType:(OngoingCallNetworkTypeWebrtc)networkType dataSaving:(OngoingCallDataSavingWebrtc)dataSaving
|
||||
derivedState:(NSData * _Nonnull)derivedState
|
||||
|
@ -995,7 +995,9 @@ static void (*InternalVoipLoggingFunction)(NSString *) = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
- (instancetype _Nonnull)initWithVersion:(NSString * _Nonnull)version queue:(id<OngoingCallThreadLocalContextQueueWebrtc> _Nonnull)queue
|
||||
- (instancetype _Nonnull)initWithVersion:(NSString * _Nonnull)version
|
||||
customParameters:(NSDictionary<NSString *, id> * _Nonnull)customParameters
|
||||
queue:(id<OngoingCallThreadLocalContextQueueWebrtc> _Nonnull)queue
|
||||
proxy:(VoipProxyServerWebrtc * _Nullable)proxy
|
||||
networkType:(OngoingCallNetworkTypeWebrtc)networkType dataSaving:(OngoingCallDataSavingWebrtc)dataSaving
|
||||
derivedState:(NSData * _Nonnull)derivedState
|
||||
@ -1105,6 +1107,15 @@ static void (*InternalVoipLoggingFunction)(NSString *) = NULL;
|
||||
|
||||
std::vector<tgcalls::Endpoint> endpoints;
|
||||
|
||||
NSData *customParametersJsonData = [NSJSONSerialization dataWithJSONObject:customParameters options:0 error:nil];
|
||||
std::string customParametersString = "{}";
|
||||
if (customParametersJsonData) {
|
||||
NSString *customParametersJson = [[NSString alloc] initWithData:customParametersJsonData encoding:NSUTF8StringEncoding];
|
||||
if (customParametersJson && customParametersJson.length != 0) {
|
||||
customParametersString = std::string(customParametersJson.UTF8String);
|
||||
}
|
||||
}
|
||||
|
||||
tgcalls::Config config = {
|
||||
.initializationTimeout = _callConnectTimeout,
|
||||
.receiveTimeout = _callPacketTimeout,
|
||||
@ -1116,12 +1127,13 @@ static void (*InternalVoipLoggingFunction)(NSString *) = NULL;
|
||||
.enableNS = true,
|
||||
.enableAGC = true,
|
||||
.enableCallUpgrade = false,
|
||||
.logPath = std::string(logPath.length == 0 ? "" : logPath.UTF8String),
|
||||
.statsLogPath = std::string(statsLogPath.length == 0 ? "" : statsLogPath.UTF8String),
|
||||
.logPath = { std::string(logPath.length == 0 ? "" : logPath.UTF8String) },
|
||||
.statsLogPath = { std::string(statsLogPath.length == 0 ? "" : statsLogPath.UTF8String) },
|
||||
.maxApiLayer = [OngoingCallThreadLocalContextWebrtc maxLayer],
|
||||
.enableHighBitrateVideo = true,
|
||||
.preferredVideoCodecs = preferredVideoCodecs,
|
||||
.protocolVersion = [OngoingCallThreadLocalContextWebrtc protocolVersionFromLibraryVersion:version]
|
||||
.protocolVersion = [OngoingCallThreadLocalContextWebrtc protocolVersionFromLibraryVersion:version],
|
||||
.customParameters = customParametersString
|
||||
};
|
||||
|
||||
auto encryptionKeyValue = std::make_shared<std::array<uint8_t, 256>>();
|
||||
|
Loading…
x
Reference in New Issue
Block a user