Previously, when we type a message in `ConversationViewController`, and then click "Send" when there is a pending autocorrect suggestion in the keyboard, the autocorrect suggestion is ignored. This results in messages being sent with typos. This commit accepts the autocorrect suggestion before the message is sent, emulating the behaviour in Apple Messages and Facebook Messenger. Fixes #2875. Signed-off-by: Jonathan Chan <jonchanyc@outlook.com>
100 lines
2.3 KiB
Objective-C
100 lines
2.3 KiB
Objective-C
//
|
|
// Copyright (c) 2019 Open Whisper Systems. All rights reserved.
|
|
//
|
|
|
|
NS_ASSUME_NONNULL_BEGIN
|
|
|
|
@class ConversationStyle;
|
|
@class OWSLinkPreviewDraft;
|
|
@class OWSQuotedReplyModel;
|
|
@class SignalAttachment;
|
|
@class StickerInfo;
|
|
|
|
@protocol ConversationInputToolbarDelegate <NSObject>
|
|
|
|
- (void)sendButtonPressed;
|
|
|
|
- (void)attachmentButtonPressed;
|
|
|
|
- (void)cameraButtonPressed;
|
|
|
|
- (void)sendSticker:(StickerInfo *)stickerInfo;
|
|
|
|
- (void)presentManageStickersView;
|
|
|
|
- (CGSize)rootViewSize;
|
|
|
|
#pragma mark - Voice Memo
|
|
|
|
- (void)voiceMemoGestureDidStart;
|
|
|
|
- (void)voiceMemoGestureDidLock;
|
|
|
|
- (void)voiceMemoGestureDidComplete;
|
|
|
|
- (void)voiceMemoGestureDidCancel;
|
|
|
|
- (void)voiceMemoGestureDidUpdateCancelWithRatioComplete:(CGFloat)cancelAlpha;
|
|
|
|
@end
|
|
|
|
#pragma mark -
|
|
|
|
@class ConversationInputTextView;
|
|
|
|
@protocol ConversationInputTextViewDelegate;
|
|
|
|
@interface ConversationInputToolbar : UIView
|
|
|
|
- (instancetype)initWithConversationStyle:(ConversationStyle *)conversationStyle NS_DESIGNATED_INITIALIZER;
|
|
- (instancetype)initWithCoder:(NSCoder *)aDecoder NS_UNAVAILABLE;
|
|
- (instancetype)initWithFrame:(CGRect)frame NS_UNAVAILABLE;
|
|
|
|
@property (nonatomic, weak) id<ConversationInputToolbarDelegate> inputToolbarDelegate;
|
|
|
|
- (void)beginEditingMessage;
|
|
- (void)endEditingMessage;
|
|
- (BOOL)isInputViewFirstResponder;
|
|
|
|
- (void)setInputTextViewDelegate:(id<ConversationInputTextViewDelegate>)value;
|
|
|
|
- (NSString *)messageText;
|
|
- (void)setMessageText:(NSString *_Nullable)value animated:(BOOL)isAnimated;
|
|
/// Makes the text field accept the current autocorrect suggestion from the keyboard.
|
|
/// For instance, accept it when there is a suggestion when the send button is pressed.
|
|
- (void)acceptAutocorrectSuggestion;
|
|
- (void)clearTextMessageAnimated:(BOOL)isAnimated;
|
|
- (void)clearStickerKeyboard;
|
|
- (void)toggleDefaultKeyboard;
|
|
|
|
- (void)updateFontSizes;
|
|
|
|
- (void)updateLayoutWithSafeAreaInsets:(UIEdgeInsets)safeAreaInsets;
|
|
- (void)ensureTextViewHeight;
|
|
|
|
- (void)viewDidAppear;
|
|
|
|
- (void)ensureFirstResponderState;
|
|
|
|
#pragma mark - Voice Memo
|
|
|
|
- (void)lockVoiceMemoUI;
|
|
|
|
- (void)showVoiceMemoUI;
|
|
|
|
- (void)hideVoiceMemoUI:(BOOL)animated;
|
|
|
|
- (void)setVoiceMemoUICancelAlpha:(CGFloat)cancelAlpha;
|
|
|
|
- (void)cancelVoiceMemoIfNecessary;
|
|
|
|
#pragma mark -
|
|
|
|
@property (nonatomic, nullable) OWSQuotedReplyModel *quotedReply;
|
|
|
|
@property (nonatomic, nullable, readonly) OWSLinkPreviewDraft *linkPreviewDraft;
|
|
|
|
@end
|
|
|
|
NS_ASSUME_NONNULL_END
|