Implement copy restriction and send as peer

This commit is contained in:
Ilya Laktyushin
2021-11-05 21:45:48 +04:00
parent 003d263ebd
commit 1a717fbda5
37 changed files with 1004 additions and 216 deletions

View File

@@ -1232,12 +1232,19 @@ private final class ContextControllerNode: ViewControllerTracingNode, UIScrollVi
var originalContentFrame = CGRect(origin: CGPoint(x: originalContentX, y: originalContentY), size: originalProjectedContentViewFrame.1.size)
let topEdge = max(contentTopInset, self.contentAreaInScreenSpace?.minY ?? 0.0)
let bottomEdge = max(layout.intrinsicInsets.bottom, self.contentAreaInScreenSpace?.maxY ?? layout.size.height)
if originalContentFrame.minY < topEdge {
let requiredOffset = topEdge - originalContentFrame.minY
let availableOffset = max(0.0, layout.size.height - layout.intrinsicInsets.bottom - actionsBottomInset - originalActionsFrame.maxY)
let offset = min(requiredOffset, availableOffset)
originalActionsFrame = originalActionsFrame.offsetBy(dx: 0.0, dy: offset)
originalContentFrame = originalContentFrame.offsetBy(dx: 0.0, dy: offset)
} else if originalContentFrame.maxY > bottomEdge {
let requiredOffset = bottomEdge - originalContentFrame.maxY
let offset = requiredOffset
originalActionsFrame = originalActionsFrame.offsetBy(dx: 0.0, dy: offset)
originalContentFrame = originalContentFrame.offsetBy(dx: 0.0, dy: offset)
}
var contentHeight = max(layout.size.height, max(layout.size.height, originalActionsFrame.maxY + actionsBottomInset) - originalContentFrame.minY + contentTopInset)