UI improvements

This commit is contained in:
Ali
2022-09-09 21:34:27 +04:00
parent e61ae3c0b3
commit 64b1eab732
24 changed files with 675 additions and 122 deletions

View File

@@ -250,6 +250,14 @@ private final class ContextControllerNode: ViewControllerTracingNode, UIScrollVi
private let blurBackground: Bool
var overlayWantsToBeBelowKeyboard: Bool {
if let presentationNode = self.presentationNode {
return presentationNode.wantsDisplayBelowKeyboard()
} else {
return false
}
}
init(
account: Account,
controller: ContextController,
@@ -624,6 +632,7 @@ private final class ContextControllerNode: ViewControllerTracingNode, UIScrollVi
guard let strongSelf = self else {
return
}
if let validLayout = strongSelf.validLayout {
strongSelf.updateLayout(
layout: validLayout,
@@ -632,6 +641,14 @@ private final class ContextControllerNode: ViewControllerTracingNode, UIScrollVi
)
}
},
requestUpdateOverlayWantsToBeBelowKeyboard: { [weak self] transition in
guard let strongSelf = self else {
return
}
if let controller = strongSelf.getController() {
controller.overlayWantsToBeBelowKeyboardUpdated(transition: transition)
}
},
requestDismiss: { [weak self] result in
guard let strongSelf = self else {
return
@@ -681,6 +698,14 @@ private final class ContextControllerNode: ViewControllerTracingNode, UIScrollVi
)
}
},
requestUpdateOverlayWantsToBeBelowKeyboard: { [weak self] transition in
guard let strongSelf = self else {
return
}
if let controller = strongSelf.getController() {
controller.overlayWantsToBeBelowKeyboardUpdated(transition: transition)
}
},
requestDismiss: { [weak self] result in
guard let strongSelf = self else {
return
@@ -716,6 +741,14 @@ private final class ContextControllerNode: ViewControllerTracingNode, UIScrollVi
)
}
},
requestUpdateOverlayWantsToBeBelowKeyboard: { [weak self] transition in
guard let strongSelf = self else {
return
}
if let controller = strongSelf.getController() {
controller.overlayWantsToBeBelowKeyboardUpdated(transition: transition)
}
},
requestDismiss: { [weak self] result in
guard let strongSelf = self else {
return
@@ -1525,25 +1558,6 @@ private final class ContextControllerNode: ViewControllerTracingNode, UIScrollVi
reactionContextNode?.removeFromSupernode()
})
}
if !items.reactionItems.isEmpty, let context = items.context, let animationCache = items.animationCache {
let reactionContextNode = ReactionContextNode(context: context, animationCache: animationCache, presentationData: self.presentationData, items: items.reactionItems, selectedItems: items.selectedReactionItems, getEmojiContent: items.getEmojiContent, isExpandedUpdated: { _ in }, requestLayout: { _ in })
self.reactionContextNode = reactionContextNode
self.addSubnode(reactionContextNode)
reactionContextNode.reactionSelected = { [weak self] reaction, isLarge in
guard let strongSelf = self, let controller = strongSelf.getController() as? ContextController else {
return
}
controller.reactionSelected?(reaction, isLarge)
}
reactionContextNode.premiumReactionsSelected = { [weak self] _ in
guard let strongSelf = self, let controller = strongSelf.getController() as? ContextController else {
return
}
controller.premiumReactionsSelected?()
}
}
let previousActionsContainerNode = self.actionsContainerNode
let previousActionsContainerFrame = previousActionsContainerNode.view.convert(previousActionsContainerNode.bounds, to: self.view)
@@ -2508,6 +2522,14 @@ public final class ContextController: ViewController, StandalonePresentableContr
private var animatedDidAppear = false
private var wasDismissed = false
override public var overlayWantsToBeBelowKeyboard: Bool {
if self.isNodeLoaded {
return self.controllerNode.overlayWantsToBeBelowKeyboard
} else {
return false
}
}
private var controllerNode: ContextControllerNode {
return self.displayNode as! ContextControllerNode
}