mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-07-25 20:50:47 +00:00
Fixed chat message menu presentation
This commit is contained in:
parent
fb3eeaa323
commit
bb44184bd3
@ -272,7 +272,7 @@ open class NavigationController: UINavigationController, ContainableController,
|
|||||||
return (CGRect(origin: CGPoint(), size: detailFrame.size), ContainerViewLayout(size: CGSize(width: detailWidth, height: layout.size.height), metrics: LayoutMetrics(widthClass: .regular, heightClass: .regular), intrinsicInsets: layout.intrinsicInsets, safeInsets: layout.safeInsets, statusBarHeight: layout.statusBarHeight, inputHeight: layout.inputHeight, standardInputHeight: layout.standardInputHeight, inputHeightIsInteractivellyChanging: layout.inputHeightIsInteractivellyChanging, inVoiceOver: layout.inVoiceOver))
|
return (CGRect(origin: CGPoint(), size: detailFrame.size), ContainerViewLayout(size: CGSize(width: detailWidth, height: layout.size.height), metrics: LayoutMetrics(widthClass: .regular, heightClass: .regular), intrinsicInsets: layout.intrinsicInsets, safeInsets: layout.safeInsets, statusBarHeight: layout.statusBarHeight, inputHeight: layout.inputHeight, standardInputHeight: layout.standardInputHeight, inputHeightIsInteractivellyChanging: layout.inputHeightIsInteractivellyChanging, inVoiceOver: layout.inVoiceOver))
|
||||||
}
|
}
|
||||||
case .single:
|
case .single:
|
||||||
return (CGRect(origin: CGPoint(), size: CGSize(width: layout.size.width, height: layout.size.height)), ContainerViewLayout(size: CGSize(width: layout.size.width, height: layout.size.height), metrics: LayoutMetrics(widthClass: .compact, heightClass: .compact), intrinsicInsets: layout.intrinsicInsets, safeInsets: layout.safeInsets, statusBarHeight: layout.statusBarHeight, inputHeight: layout.inputHeight, standardInputHeight: layout.standardInputHeight, inputHeightIsInteractivellyChanging: layout.inputHeightIsInteractivellyChanging, inVoiceOver: layout.inVoiceOver))
|
return (CGRect(origin: CGPoint(), size: CGSize(width: layout.size.width, height: layout.size.height)), ContainerViewLayout(size: CGSize(width: layout.size.width, height: layout.size.height), metrics: LayoutMetrics(widthClass: .compact, heightClass: layout.size.height > 900.0 ? .regular : .compact), intrinsicInsets: layout.intrinsicInsets, safeInsets: layout.safeInsets, statusBarHeight: layout.statusBarHeight, inputHeight: layout.inputHeight, standardInputHeight: layout.standardInputHeight, inputHeightIsInteractivellyChanging: layout.inputHeightIsInteractivellyChanging, inVoiceOver: layout.inVoiceOver))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1815,8 +1815,16 @@ class ChatControllerNode: ASDisplayNode, UIScrollViewDelegate {
|
|||||||
}, associatedController: contextMenuController)
|
}, associatedController: contextMenuController)
|
||||||
self.messageActionSheetController = (controller, stableId)
|
self.messageActionSheetController = (controller, stableId)
|
||||||
self.accessibilityElementsHidden = true
|
self.accessibilityElementsHidden = true
|
||||||
if let sheetActions = sheetActions, !sheetActions.isEmpty {
|
if let sheetActions = sheetActions, !sheetActions.isEmpty, let (layout, _) = self.validLayout {
|
||||||
self.controllerInteraction.presentGlobalOverlayController(controller, nil)
|
var isSlideOver = false
|
||||||
|
if case .compact = layout.metrics.widthClass, case .regular = layout.metrics.heightClass {
|
||||||
|
isSlideOver = true
|
||||||
|
}
|
||||||
|
if isSlideOver {
|
||||||
|
self.controllerInteraction.presentController(controller, nil)
|
||||||
|
} else {
|
||||||
|
self.controllerInteraction.presentGlobalOverlayController(controller, nil)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
animateIn = true
|
animateIn = true
|
||||||
}
|
}
|
||||||
|
@ -170,6 +170,11 @@ final class ChatMessageActionSheetControllerNode: ViewControllerTracingNode {
|
|||||||
horizontalOffset += UIScreenPixel
|
horizontalOffset += UIScreenPixel
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var isSlideOver = false
|
||||||
|
if case .compact = layout.metrics.widthClass, case .regular = layout.metrics.heightClass {
|
||||||
|
isSlideOver = true
|
||||||
|
}
|
||||||
|
|
||||||
transition.updateFrame(node: self.sideDimNode, frame: CGRect(origin: CGPoint(x: 0.0, y: 0.0), size: CGSize(width: max(0.0, horizontalOffset), height: max(0.0, layout.size.height - inputHeight))))
|
transition.updateFrame(node: self.sideDimNode, frame: CGRect(origin: CGPoint(x: 0.0, y: 0.0), size: CGSize(width: max(0.0, horizontalOffset), height: max(0.0, layout.size.height - inputHeight))))
|
||||||
transition.updateFrame(node: self.sideInputDimNode, frame: CGRect(origin: CGPoint(x: 0.0, y: layout.size.height - inputHeight), size: CGSize(width: max(0.0, horizontalOrigin), height: max(0.0, inputHeight))))
|
transition.updateFrame(node: self.sideInputDimNode, frame: CGRect(origin: CGPoint(x: 0.0, y: layout.size.height - inputHeight), size: CGSize(width: max(0.0, horizontalOrigin), height: max(0.0, inputHeight))))
|
||||||
transition.updateFrame(node: self.inputDimNode, frame: CGRect(origin: CGPoint(x: horizontalOrigin, y: layout.size.height - inputHeight), size: CGSize(width: layout.size.width, height: inputHeight)))
|
transition.updateFrame(node: self.inputDimNode, frame: CGRect(origin: CGPoint(x: horizontalOrigin, y: layout.size.height - inputHeight), size: CGSize(width: layout.size.width, height: inputHeight)))
|
||||||
@ -185,12 +190,19 @@ final class ChatMessageActionSheetControllerNode: ViewControllerTracingNode {
|
|||||||
itemsHeight += actionNode.bounds.height
|
itemsHeight += actionNode.bounds.height
|
||||||
}
|
}
|
||||||
|
|
||||||
let containerFrame = CGRect(origin: CGPoint(x: horizontalOrigin + floor((layout.size.width - containerWidth) / 2.0), y: layout.size.height - height - itemsHeight - inputHeight), size: CGSize(width: containerWidth, height: itemsHeight))
|
var containerFrame = CGRect(origin: CGPoint(x: horizontalOrigin + floor((layout.size.width - containerWidth) / 2.0), y: layout.size.height - height - itemsHeight), size: CGSize(width: containerWidth, height: itemsHeight))
|
||||||
|
if isSlideOver {
|
||||||
|
containerFrame = containerFrame.offsetBy(dx: 0.0, dy: -inputHeight)
|
||||||
|
}
|
||||||
transition.updateFrame(node: self.itemsContainerNode, frame: containerFrame)
|
transition.updateFrame(node: self.itemsContainerNode, frame: containerFrame)
|
||||||
transition.updateFrame(node: self.itemsShadowNode, frame: containerFrame.insetBy(dx: -shadowInset, dy: -shadowInset))
|
transition.updateFrame(node: self.itemsShadowNode, frame: containerFrame.insetBy(dx: -shadowInset, dy: -shadowInset))
|
||||||
|
|
||||||
height += itemsHeight
|
height += itemsHeight
|
||||||
height += inputHeight
|
|
||||||
|
if isSlideOver {
|
||||||
|
height += inputHeight
|
||||||
|
}
|
||||||
|
|
||||||
height += 6.0
|
height += 6.0
|
||||||
|
|
||||||
return height
|
return height
|
||||||
|
Loading…
x
Reference in New Issue
Block a user