mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-10-08 19:10:53 +00:00
Media editor improvements
This commit is contained in:
parent
28dd60b887
commit
fa57a05bcb
@ -476,8 +476,9 @@ public class AttachmentTextInputPanelNode: ASDisplayNode, TGCaptionPanelView, AS
|
||||
public func onAnimateOut() {
|
||||
}
|
||||
|
||||
public func dismissInput() {
|
||||
public func dismissInput() -> Bool {
|
||||
self.ensureUnfocused()
|
||||
return true
|
||||
}
|
||||
|
||||
public func baseHeight() -> CGFloat {
|
||||
@ -1695,7 +1696,7 @@ public class AttachmentTextInputPanelNode: ASDisplayNode, TGCaptionPanelView, AS
|
||||
}
|
||||
}
|
||||
if let sendPressed = self.sendPressed, let presentationInterfaceState = self.effectivePresentationInterfaceState?() {
|
||||
self.dismissInput()
|
||||
let _ = self.dismissInput()
|
||||
let effectiveInputText = presentationInterfaceState.interfaceState.composeInputState.inputText
|
||||
sendPressed(effectiveInputText)
|
||||
return
|
||||
|
@ -26,7 +26,7 @@
|
||||
|
||||
- (NSAttributedString * _Nonnull)caption;
|
||||
- (void)setCaption:(NSAttributedString * _Nullable)caption;
|
||||
- (void)dismissInput;
|
||||
- (bool)dismissInput;
|
||||
|
||||
- (void)animateView:(UIView * _Nonnull)view frame:(CGRect)frame;
|
||||
|
||||
|
@ -170,13 +170,14 @@
|
||||
if (gestureRecognizer.state != UIGestureRecognizerStateRecognized)
|
||||
return;
|
||||
|
||||
_editing = false;
|
||||
|
||||
[self.inputPanel dismissInput];
|
||||
[_dismissView removeFromSuperview];
|
||||
|
||||
if (self.finishedWithCaption != nil)
|
||||
self.finishedWithCaption([_inputPanel caption]);
|
||||
if ([self.inputPanel dismissInput]) {
|
||||
_editing = false;
|
||||
|
||||
[_dismissView removeFromSuperview];
|
||||
|
||||
if (self.finishedWithCaption != nil)
|
||||
self.finishedWithCaption([_inputPanel caption]);
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - Input Panel Delegate
|
||||
|
@ -106,11 +106,19 @@ public class LegacyMessageInputPanelNode: ASDisplayNode, TGCaptionPanelView {
|
||||
self.currentIsVideo = isVideo
|
||||
}
|
||||
|
||||
public func dismissInput() {
|
||||
public func dismissInput() -> Bool {
|
||||
if let view = self.inputPanel.view as? MessageInputPanelComponent.View {
|
||||
self.isEmojiKeyboardActive = false
|
||||
self.inputView = nil
|
||||
view.deactivateInput(force: true)
|
||||
if view.canDeactivateInput() {
|
||||
self.isEmojiKeyboardActive = false
|
||||
self.inputView = nil
|
||||
view.deactivateInput(force: true)
|
||||
return true
|
||||
} else {
|
||||
view.animateError()
|
||||
return false
|
||||
}
|
||||
} else {
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
@ -198,7 +206,7 @@ public class LegacyMessageInputPanelNode: ASDisplayNode, TGCaptionPanelView {
|
||||
sendMessageAction: { [weak self] in
|
||||
if let self {
|
||||
self.sendPressed?(self.caption())
|
||||
self.dismissInput()
|
||||
let _ = self.dismissInput()
|
||||
}
|
||||
},
|
||||
sendMessageOptionsAction: nil,
|
||||
|
Loading…
x
Reference in New Issue
Block a user