mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-02 04:38:33 +00:00
Input field fixes
This commit is contained in:
parent
16b981651a
commit
80a7f9fcd2
@ -2190,12 +2190,6 @@ public class ChatTextInputPanelNode: ChatInputPanelNode, ASEditableTextNodeDeleg
|
|||||||
self.actionButtons.micButton.audioRecorder = nil
|
self.actionButtons.micButton.audioRecorder = nil
|
||||||
self.actionButtons.micButton.videoRecordingStatus = nil
|
self.actionButtons.micButton.videoRecordingStatus = nil
|
||||||
transition.updateAlpha(layer: self.textInputBackgroundNode.layer, alpha: 1.0)
|
transition.updateAlpha(layer: self.textInputBackgroundNode.layer, alpha: 1.0)
|
||||||
if let textInputNode = self.textInputNode {
|
|
||||||
transition.updateAlpha(node: textInputNode, alpha: audioRecordingItemsAlpha)
|
|
||||||
}
|
|
||||||
for (_, button) in self.accessoryItemButtons {
|
|
||||||
transition.updateAlpha(layer: button.layer, alpha: audioRecordingItemsAlpha)
|
|
||||||
}
|
|
||||||
|
|
||||||
if let audioRecordingInfoContainerNode = self.audioRecordingInfoContainerNode {
|
if let audioRecordingInfoContainerNode = self.audioRecordingInfoContainerNode {
|
||||||
self.audioRecordingInfoContainerNode = nil
|
self.audioRecordingInfoContainerNode = nil
|
||||||
@ -2238,6 +2232,13 @@ public class ChatTextInputPanelNode: ChatInputPanelNode, ASEditableTextNodeDeleg
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if let textInputNode = self.textInputNode {
|
||||||
|
transition.updateAlpha(node: textInputNode, alpha: audioRecordingItemsAlpha)
|
||||||
|
}
|
||||||
|
for (_, button) in self.accessoryItemButtons {
|
||||||
|
transition.updateAlpha(layer: button.layer, alpha: audioRecordingItemsAlpha)
|
||||||
|
}
|
||||||
|
|
||||||
leftInset += leftMenuInset
|
leftInset += leftMenuInset
|
||||||
|
|
||||||
var composeButtonsOffset: CGFloat = 0.0
|
var composeButtonsOffset: CGFloat = 0.0
|
||||||
@ -2359,8 +2360,9 @@ public class ChatTextInputPanelNode: ChatInputPanelNode, ASEditableTextNodeDeleg
|
|||||||
let _ = mediaPreviewPanelNode.updateLayout(width: mediaPreviewPanelFrame.width, leftInset: 0.0, rightInset: 0.0, bottomInset: 0.0, additionalSideInsets: UIEdgeInsets(), maxHeight: 40.0, maxOverlayHeight: 40.0, isSecondary: false, transition: mediaPreviewPanelTransition, interfaceState: interfaceState, metrics: metrics, isMediaInputExpanded: false)
|
let _ = mediaPreviewPanelNode.updateLayout(width: mediaPreviewPanelFrame.width, leftInset: 0.0, rightInset: 0.0, bottomInset: 0.0, additionalSideInsets: UIEdgeInsets(), maxHeight: 40.0, maxOverlayHeight: 40.0, isSecondary: false, transition: mediaPreviewPanelTransition, interfaceState: interfaceState, metrics: metrics, isMediaInputExpanded: false)
|
||||||
} else if let mediaPreviewPanelNode = self.mediaPreviewPanelNode {
|
} else if let mediaPreviewPanelNode = self.mediaPreviewPanelNode {
|
||||||
self.mediaPreviewPanelNode = nil
|
self.mediaPreviewPanelNode = nil
|
||||||
transition.updateAlpha(node: mediaPreviewPanelNode, alpha: 0.0, completion: { [weak mediaPreviewPanelNode] _ in
|
let mediaPreviewPanelView = mediaPreviewPanelNode.view
|
||||||
mediaPreviewPanelNode?.view.removeFromSuperview()
|
transition.updateAlpha(layer: mediaPreviewPanelView.layer, alpha: 0.0, completion: { [weak mediaPreviewPanelView] _ in
|
||||||
|
mediaPreviewPanelView?.removeFromSuperview()
|
||||||
})
|
})
|
||||||
let mediaPreviewPanelNodeTintMaskView = mediaPreviewPanelNode.tintMaskView
|
let mediaPreviewPanelNodeTintMaskView = mediaPreviewPanelNode.tintMaskView
|
||||||
transition.updateAlpha(layer: mediaPreviewPanelNodeTintMaskView.layer, alpha: 0.0, completion: { [weak mediaPreviewPanelNodeTintMaskView] _ in
|
transition.updateAlpha(layer: mediaPreviewPanelNodeTintMaskView.layer, alpha: 0.0, completion: { [weak mediaPreviewPanelNodeTintMaskView] _ in
|
||||||
|
|||||||
@ -420,10 +420,13 @@ private final class VideoMessageCameraScreenComponent: CombinedComponent {
|
|||||||
|
|
||||||
controller.updatePreviewState({ _ in return nil }, transition: .spring(duration: 0.4))
|
controller.updatePreviewState({ _ in return nil }, transition: .spring(duration: 0.4))
|
||||||
|
|
||||||
controller.node.withReadyCamera(isFirstTime: !controller.node.cameraIsActive) {
|
controller.node.withReadyCamera(isFirstTime: !controller.node.cameraIsActive) { [weak self] in
|
||||||
Queue.mainQueue().after(0.15) {
|
Queue.mainQueue().after(0.15) {
|
||||||
|
guard let self else {
|
||||||
|
return
|
||||||
|
}
|
||||||
self.resultDisposable.set((camera.startRecording()
|
self.resultDisposable.set((camera.startRecording()
|
||||||
|> deliverOnMainQueue).start(next: { [weak self] recordingData in
|
|> deliverOnMainQueue).startStrict(next: { [weak self] recordingData in
|
||||||
let duration = initialDuration + recordingData.duration
|
let duration = initialDuration + recordingData.duration
|
||||||
if let self, let controller = self.getController() {
|
if let self, let controller = self.getController() {
|
||||||
controller.updateCameraState({ $0.updatedDuration(duration) }, transition: .easeInOut(duration: 0.1))
|
controller.updateCameraState({ $0.updatedDuration(duration) }, transition: .easeInOut(duration: 0.1))
|
||||||
@ -462,7 +465,7 @@ private final class VideoMessageCameraScreenComponent: CombinedComponent {
|
|||||||
controller.lastActionTimestamp = currentTimestamp
|
controller.lastActionTimestamp = currentTimestamp
|
||||||
|
|
||||||
self.resultDisposable.set((camera.stopRecording()
|
self.resultDisposable.set((camera.stopRecording()
|
||||||
|> deliverOnMainQueue).start(next: { [weak self] result in
|
|> deliverOnMainQueue).startStrict(next: { [weak self] result in
|
||||||
if let self, let controller = self.getController(), case let .finished(mainResult, _, duration, _, _) = result {
|
if let self, let controller = self.getController(), case let .finished(mainResult, _, duration, _, _) = result {
|
||||||
self.completion.invoke(
|
self.completion.invoke(
|
||||||
.video(VideoMessageCameraScreen.CaptureResult.Video(
|
.video(VideoMessageCameraScreen.CaptureResult.Video(
|
||||||
@ -986,7 +989,10 @@ public class VideoMessageCameraScreen: ViewController {
|
|||||||
if isDualCameraEnabled {
|
if isDualCameraEnabled {
|
||||||
self.mainPreviewView.removePlaceholder(delay: 0.0)
|
self.mainPreviewView.removePlaceholder(delay: 0.0)
|
||||||
}
|
}
|
||||||
self.withReadyCamera(isFirstTime: true, {
|
self.withReadyCamera(isFirstTime: true, { [weak self] in
|
||||||
|
guard let self else {
|
||||||
|
return
|
||||||
|
}
|
||||||
if !isDualCameraEnabled {
|
if !isDualCameraEnabled {
|
||||||
self.mainPreviewView.removePlaceholder(delay: 0.0)
|
self.mainPreviewView.removePlaceholder(delay: 0.0)
|
||||||
}
|
}
|
||||||
@ -1063,7 +1069,7 @@ public class VideoMessageCameraScreen: ViewController {
|
|||||||
queue: Queue.mainQueue(),
|
queue: Queue.mainQueue(),
|
||||||
camera.flashMode,
|
camera.flashMode,
|
||||||
camera.position
|
camera.position
|
||||||
).start(next: { [weak self] flashMode, position in
|
).startStrict(next: { [weak self] flashMode, position in
|
||||||
guard let self else {
|
guard let self else {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -1116,8 +1122,8 @@ public class VideoMessageCameraScreen: ViewController {
|
|||||||
|
|
||||||
UIView.animate(withDuration: 0.5, delay: 0.0, usingSpringWithDamping: 0.8, initialSpringVelocity: 0.2, animations: {
|
UIView.animate(withDuration: 0.5, delay: 0.0, usingSpringWithDamping: 0.8, initialSpringVelocity: 0.2, animations: {
|
||||||
self.previewContainerView.center = targetPosition
|
self.previewContainerView.center = targetPosition
|
||||||
}, completion: { _ in
|
}, completion: { [weak self] _ in
|
||||||
self.animatingIn = false
|
self?.animatingIn = false
|
||||||
})
|
})
|
||||||
|
|
||||||
if let view = self.componentHost.view {
|
if let view = self.componentHost.view {
|
||||||
@ -1130,8 +1136,8 @@ public class VideoMessageCameraScreen: ViewController {
|
|||||||
|
|
||||||
UIView.animate(withDuration: 0.25, animations: {
|
UIView.animate(withDuration: 0.25, animations: {
|
||||||
self.backgroundView.alpha = 0.0
|
self.backgroundView.alpha = 0.0
|
||||||
}, completion: { _ in
|
}, completion: { [weak self] _ in
|
||||||
self.backgroundView.removeFromSuperview()
|
self?.backgroundView.removeFromSuperview()
|
||||||
completion()
|
completion()
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -1150,9 +1156,9 @@ public class VideoMessageCameraScreen: ViewController {
|
|||||||
}
|
}
|
||||||
UIView.animate(withDuration: 0.2, animations: {
|
UIView.animate(withDuration: 0.2, animations: {
|
||||||
self.previewSnapshotView?.alpha = 0.0
|
self.previewSnapshotView?.alpha = 0.0
|
||||||
}, completion: { _ in
|
}, completion: { [weak self] _ in
|
||||||
self.previewSnapshotView?.removeFromSuperview()
|
self?.previewSnapshotView?.removeFromSuperview()
|
||||||
self.previewSnapshotView = nil
|
self?.previewSnapshotView = nil
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1195,22 +1201,16 @@ public class VideoMessageCameraScreen: ViewController {
|
|||||||
UIView.animate(withDuration: 0.4, animations: {
|
UIView.animate(withDuration: 0.4, animations: {
|
||||||
self.previewBlurView.effect = nil
|
self.previewBlurView.effect = nil
|
||||||
self.previewSnapshotView?.alpha = 0.0
|
self.previewSnapshotView?.alpha = 0.0
|
||||||
}, completion: { _ in
|
}, completion: { [weak self] _ in
|
||||||
self.previewSnapshotView?.removeFromSuperview()
|
self?.previewSnapshotView?.removeFromSuperview()
|
||||||
self.previewSnapshotView = nil
|
self?.previewSnapshotView = nil
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
if #available(iOS 13.0, *) {
|
let _ = (self.mainPreviewView.isPreviewing
|
||||||
let _ = (self.mainPreviewView.isPreviewing
|
|> filter { $0 }
|
||||||
|> filter { $0 }
|
|> take(1)).startStandalone(next: { _ in
|
||||||
|> take(1)).startStandalone(next: { _ in
|
action()
|
||||||
action()
|
})
|
||||||
})
|
|
||||||
} else {
|
|
||||||
Queue.mainQueue().after(1.0) {
|
|
||||||
action()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
self.cameraIsActive = true
|
self.cameraIsActive = true
|
||||||
self.requestUpdateLayout(transition: .immediate)
|
self.requestUpdateLayout(transition: .immediate)
|
||||||
@ -1260,7 +1260,7 @@ public class VideoMessageCameraScreen: ViewController {
|
|||||||
let file = TelegramMediaFile(fileId: MediaId(namespace: Namespaces.Media.LocalFile, id: id), partialReference: nil, resource: fileResource, previewRepresentations: [], videoThumbnails: [], immediateThumbnailData: nil, mimeType: "video/mp4", size: Int64(data.count), attributes: [.FileName(fileName: "video.mp4")], alternativeRepresentations: [])
|
let file = TelegramMediaFile(fileId: MediaId(namespace: Namespaces.Media.LocalFile, id: id), partialReference: nil, resource: fileResource, previewRepresentations: [], videoThumbnails: [], immediateThumbnailData: nil, mimeType: "video/mp4", size: Int64(data.count), attributes: [.FileName(fileName: "video.mp4")], alternativeRepresentations: [])
|
||||||
let message: EnqueueMessage = .message(text: "", attributes: [], inlineStickers: [:], mediaReference: .standalone(media: file), threadId: nil, replyToMessageId: nil, replyToStoryId: nil, localGroupingKey: nil, correlationId: nil, bubbleUpEmojiOrStickersets: [])
|
let message: EnqueueMessage = .message(text: "", attributes: [], inlineStickers: [:], mediaReference: .standalone(media: file), threadId: nil, replyToMessageId: nil, replyToStoryId: nil, localGroupingKey: nil, correlationId: nil, bubbleUpEmojiOrStickersets: [])
|
||||||
|
|
||||||
let _ = enqueueMessages(account: self.context.engine.account, peerId: self.context.engine.account.peerId, messages: [message]).start()
|
let _ = enqueueMessages(account: self.context.engine.account, peerId: self.context.engine.account.peerId, messages: [message]).startStandalone()
|
||||||
}
|
}
|
||||||
|
|
||||||
override func hitTest(_ point: CGPoint, with event: UIEvent?) -> UIView? {
|
override func hitTest(_ point: CGPoint, with event: UIEvent?) -> UIView? {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user