mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00
Merge commit '555c097d0725be294d0dcf27e94f0ec8d0448613'
This commit is contained in:
commit
2984a7657d
@ -279,9 +279,6 @@ public class AttachmentController: ViewController {
|
||||
}
|
||||
|
||||
func switchToController(_ type: AttachmentButtonType, _ ascending: Bool) -> Bool {
|
||||
guard !self.animating else {
|
||||
return false
|
||||
}
|
||||
guard self.currentType != type else {
|
||||
if let controller = self.currentControllers.last {
|
||||
controller.scrollToTopWithTabBar?()
|
||||
@ -360,12 +357,22 @@ public class AttachmentController: ViewController {
|
||||
}
|
||||
|
||||
if case .compact = layout.metrics.widthClass {
|
||||
let offset = strongSelf.container.isExpanded ? 10.0 : 24.0
|
||||
strongSelf.container.clipNode.layer.animatePosition(from: CGPoint(), to: CGPoint(x: 0.0, y: offset), duration: 0.18, removeOnCompletion: false, additive: true, completion: { [weak self] _ in
|
||||
if let strongSelf = self {
|
||||
strongSelf.container.clipNode.layer.animateSpring(from: NSValue(cgPoint: CGPoint(x: 0.0, y: 0.0)), to: NSValue(cgPoint: CGPoint(x: 0.0, y: -offset)), keyPath: "position", duration: 0.55, delay: 0.0, initialVelocity: 0.0, damping: 70.0, removeOnCompletion: false, additive: true, completion: { [weak self] _ in
|
||||
self?.container.clipNode.layer.removeAllAnimations()
|
||||
self?.animating = false
|
||||
let offset = 25.0
|
||||
|
||||
let initialPosition = strongSelf.container.clipNode.layer.position
|
||||
let targetPosition = initialPosition.offsetBy(dx: 0.0, dy: offset)
|
||||
var startPosition = initialPosition
|
||||
if let presentation = strongSelf.container.clipNode.layer.presentation() {
|
||||
startPosition = presentation.position
|
||||
}
|
||||
|
||||
strongSelf.container.clipNode.layer.animatePosition(from: startPosition, to: targetPosition, duration: 0.2, removeOnCompletion: false, completion: { [weak self] finished in
|
||||
if let strongSelf = self, finished {
|
||||
strongSelf.container.clipNode.layer.animateSpring(from: NSValue(cgPoint: targetPosition), to: NSValue(cgPoint: initialPosition), keyPath: "position", duration: 0.4, delay: 0.0, initialVelocity: 0.0, damping: 70.0, removeOnCompletion: false, completion: { [weak self] finished in
|
||||
if finished {
|
||||
self?.container.clipNode.layer.removeAllAnimations()
|
||||
self?.animating = false
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
@ -373,7 +380,7 @@ public class AttachmentController: ViewController {
|
||||
strongSelf.animating = false
|
||||
}
|
||||
|
||||
snapshotView?.layer.animateAlpha(from: 1.0, to: 0.0, duration: 0.25, removeOnCompletion: false, completion: { [weak snapshotView] _ in
|
||||
snapshotView?.layer.animateAlpha(from: 1.0, to: 0.0, duration: 0.23, removeOnCompletion: false, completion: { [weak snapshotView] _ in
|
||||
snapshotView?.removeFromSuperview()
|
||||
previousController?.resetForReuse()
|
||||
})
|
||||
|
@ -208,7 +208,7 @@ public final class MediaPickerScreen: ViewController, AttachmentContainable {
|
||||
self.addSubnode(self.containerNode)
|
||||
self.containerNode.addSubnode(self.backgroundNode)
|
||||
self.containerNode.addSubnode(self.gridNode)
|
||||
self.containerNode.addSubnode(self.scrollingArea)
|
||||
// self.containerNode.addSubnode(self.scrollingArea)
|
||||
|
||||
let collection = controller.collection
|
||||
let preloadPromise = self.preloadPromise
|
||||
@ -533,6 +533,7 @@ public final class MediaPickerScreen: ViewController, AttachmentContainable {
|
||||
self.currentDisplayMode = displayMode
|
||||
|
||||
self.dismissInput()
|
||||
self.controller?.dismissAllTooltips()
|
||||
|
||||
if case .selected = displayMode, self.selectionNode == nil, let controller = self.controller {
|
||||
let selectionNode = MediaPickerSelectedListNode(context: controller.context)
|
||||
@ -669,6 +670,8 @@ public final class MediaPickerScreen: ViewController, AttachmentContainable {
|
||||
}
|
||||
|
||||
fileprivate func send(asFile: Bool = false, silently: Bool, scheduleTime: Int32?, animated: Bool, completion: @escaping () -> Void) {
|
||||
self.controller?.dismissAllTooltips()
|
||||
|
||||
var hasHeic = false
|
||||
let allItems = self.controller?.interaction?.selectionState?.selectedItems() ?? []
|
||||
for item in allItems {
|
||||
@ -1194,7 +1197,7 @@ public final class MediaPickerScreen: ViewController, AttachmentContainable {
|
||||
super.displayNodeDidLoad()
|
||||
}
|
||||
|
||||
private weak var undoController: UndoOverlayController?
|
||||
private weak var undoOverlayController: UndoOverlayController?
|
||||
private func showSelectionUndo(item: TGMediaSelectableItem, count: Int32) {
|
||||
var asset: PHAsset?
|
||||
if let item = item as? TGMediaAsset {
|
||||
@ -1216,12 +1219,12 @@ public final class MediaPickerScreen: ViewController, AttachmentContainable {
|
||||
}
|
||||
|
||||
let presentationData = strongSelf.presentationData
|
||||
if let undoController = strongSelf.undoController {
|
||||
if let undoOverlayController = strongSelf.undoOverlayController {
|
||||
let text = presentationData.strings.Attachment_DeselectedItems(count)
|
||||
undoController.content = .image(image: image ?? UIImage(), text: text)
|
||||
undoOverlayController.content = .image(image: image ?? UIImage(), text: text)
|
||||
} else {
|
||||
let text = presentationData.strings.Attachment_DeselectedItems(count)
|
||||
let undoController = UndoOverlayController(presentationData: presentationData, content: .image(image: image ?? UIImage(), text: text), elevatedLayout: true, action: { [weak self] action in
|
||||
let undoOverlayController = UndoOverlayController(presentationData: presentationData, content: .image(image: image ?? UIImage(), text: text), elevatedLayout: true, action: { [weak self] action in
|
||||
guard let strongSelf = self else {
|
||||
return true
|
||||
}
|
||||
@ -1233,8 +1236,8 @@ public final class MediaPickerScreen: ViewController, AttachmentContainable {
|
||||
}
|
||||
return true
|
||||
})
|
||||
strongSelf.present(undoController, in: .window(.root))
|
||||
strongSelf.undoController = undoController
|
||||
strongSelf.present(undoOverlayController, in: .window(.root))
|
||||
strongSelf.undoOverlayController = undoOverlayController
|
||||
}
|
||||
})
|
||||
}
|
||||
@ -1275,7 +1278,12 @@ public final class MediaPickerScreen: ViewController, AttachmentContainable {
|
||||
}
|
||||
}
|
||||
|
||||
func dismissAllTooltips() {
|
||||
self.undoOverlayController?.dismissWithCommitAction()
|
||||
}
|
||||
|
||||
@objc private func cancelPressed() {
|
||||
self.dismissAllTooltips()
|
||||
self.dismiss()
|
||||
}
|
||||
|
||||
|
@ -8998,6 +8998,8 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
|
||||
self.sendMessageActionsController?.dismiss()
|
||||
self.themeSceen?.dismiss()
|
||||
|
||||
self.attachmentController?.dismiss()
|
||||
|
||||
self.chatDisplayNode.messageTransitionNode.dismissMessageReactionContexts()
|
||||
|
||||
if let _ = self.peekData {
|
||||
@ -10322,6 +10324,9 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
|
||||
guard let peer = self.presentationInterfaceState.renderedPeer?.peer else {
|
||||
return
|
||||
}
|
||||
|
||||
let inputIsActive = self.presentationInterfaceState.inputMode == .text
|
||||
|
||||
self.chatDisplayNode.dismissInput()
|
||||
|
||||
var bannedSendMedia: (Int32, Bool)?
|
||||
@ -10619,10 +10624,18 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
|
||||
return
|
||||
}
|
||||
}
|
||||
Queue.mainQueue().justDispatch {
|
||||
let present = {
|
||||
self.present(attachmentController, in: .window(.root))
|
||||
self.attachmentController = attachmentController
|
||||
}
|
||||
|
||||
if inputIsActive {
|
||||
Queue.mainQueue().after(0.1, {
|
||||
present()
|
||||
})
|
||||
} else {
|
||||
present()
|
||||
}
|
||||
}
|
||||
|
||||
private func oldPresentAttachmentMenu(editMediaOptions: MessageMediaEditingOptions?, editMediaReference: AnyMediaReference?) {
|
||||
|
@ -1207,7 +1207,7 @@ class ChatMessageBubbleItemNode: ChatMessageItemView, ChatMessagePreviewItemNode
|
||||
needsShareButton = false
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
var tmpWidth: CGFloat
|
||||
if allowFullWidth {
|
||||
tmpWidth = baseWidth
|
||||
|
@ -493,7 +493,7 @@ final class ChatMessageReactionsFooterContentNode: ChatMessageBubbleContentNode
|
||||
context: item.context,
|
||||
presentationData: item.presentationData,
|
||||
presentationContext: item.controllerInteraction.presentationContext,
|
||||
availableReactions: item.associatedData.availableReactions, reactions: reactionsAttribute, message: item.message, alignment: .left, constrainedWidth: constrainedSize.width, type: item.message.effectivelyIncoming(item.context.account.peerId) ? .incoming : .outgoing)
|
||||
availableReactions: item.associatedData.availableReactions, reactions: reactionsAttribute, message: item.message, alignment: .left, constrainedWidth: constrainedSize.width - layoutConstants.text.bubbleInsets.left - layoutConstants.text.bubbleInsets.right, type: item.message.effectivelyIncoming(item.context.account.peerId) ? .incoming : .outgoing)
|
||||
|
||||
return (layoutConstants.text.bubbleInsets.left + layoutConstants.text.bubbleInsets.right + buttonsUpdate.proposedWidth, { boundingWidth in
|
||||
var boundingSize = CGSize()
|
||||
|
Loading…
x
Reference in New Issue
Block a user