From 94a23e63b6c6e1c57b0973a849a1de9329c547f1 Mon Sep 17 00:00:00 2001 From: Michael Kirk Date: Mon, 2 Jul 2018 22:42:32 -0600 Subject: [PATCH] resize bar after send --- .../ConversationInputToolbar.h | 4 +-- .../ConversationInputToolbar.m | 25 ++++--------------- .../ConversationViewController.m | 4 +-- 3 files changed, 9 insertions(+), 24 deletions(-) diff --git a/Signal/src/ViewControllers/ConversationView/ConversationInputToolbar.h b/Signal/src/ViewControllers/ConversationView/ConversationInputToolbar.h index 085e25d30..b1c5fb4e7 100644 --- a/Signal/src/ViewControllers/ConversationView/ConversationInputToolbar.h +++ b/Signal/src/ViewControllers/ConversationView/ConversationInputToolbar.h @@ -47,8 +47,8 @@ NS_ASSUME_NONNULL_BEGIN - (void)setInputTextViewDelegate:(id)value; - (NSString *)messageText; -- (void)setMessageText:(NSString *_Nullable)value; -- (void)clearTextMessage; +- (void)setMessageText:(NSString *_Nullable)value animated:(BOOL)isAnimated; +- (void)clearTextMessageAnimated:(BOOL)isAnimated; - (void)toggleDefaultKeyboard; - (void)updateFontSizes; diff --git a/Signal/src/ViewControllers/ConversationView/ConversationInputToolbar.m b/Signal/src/ViewControllers/ConversationView/ConversationInputToolbar.m index 593e13c65..39af63b52 100644 --- a/Signal/src/ViewControllers/ConversationView/ConversationInputToolbar.m +++ b/Signal/src/ViewControllers/ConversationView/ConversationInputToolbar.m @@ -192,18 +192,19 @@ const CGFloat kMaxTextViewHeight = 98; return self.inputTextView.trimmedText; } -- (void)setMessageText:(NSString *_Nullable)value +- (void)setMessageText:(NSString *_Nullable)value animated:(BOOL)isAnimated { OWSAssert(self.inputTextView); self.inputTextView.text = value; - [self ensureShouldShowVoiceMemoButtonAnimated:NO]; + [self ensureShouldShowVoiceMemoButtonAnimated:isAnimated]; + [self updateHeightWithTextView:self.inputTextView]; } -- (void)clearTextMessage +- (void)clearTextMessageAnimated:(BOOL)isAnimated { - [self setMessageText:nil]; + [self setMessageText:nil animated:isAnimated]; [self.inputTextView.undoManager removeAllActions]; } @@ -578,22 +579,6 @@ const CGFloat kMaxTextViewHeight = 98; #pragma mark - Event Handlers -//- (void)leftButtonTapped:(UIGestureRecognizer *)sender -//{ -// if (sender.state == UIGestureRecognizerStateRecognized) { -// [self attachmentButtonPressed]; -// } -//} - -//- (void)rightButtonTapped:(UIGestureRecognizer *)sender -//{ -// if (sender.state == UIGestureRecognizerStateRecognized) { -// if (!self.shouldShowVoiceMemoButton) { -// [self sendButtonPressed]; -// } -// } -//} - - (void)sendButtonPressed { OWSAssert(self.inputToolbarDelegate); diff --git a/Signal/src/ViewControllers/ConversationView/ConversationViewController.m b/Signal/src/ViewControllers/ConversationView/ConversationViewController.m index 1294604a9..2677f4e39 100644 --- a/Signal/src/ViewControllers/ConversationView/ConversationViewController.m +++ b/Signal/src/ViewControllers/ConversationView/ConversationViewController.m @@ -3980,7 +3980,7 @@ typedef enum : NSUInteger { [self.uiDatabaseConnection readWithBlock:^(YapDatabaseReadTransaction *transaction) { draft = [_thread currentDraftWithTransaction:transaction]; }]; - [self.inputToolbar setMessageText:draft]; + [self.inputToolbar setMessageText:draft animated:NO]; } - (void)saveDraft @@ -4417,7 +4417,7 @@ typedef enum : NSUInteger { if (updateKeyboardState) { [self.inputToolbar toggleDefaultKeyboard]; } - [self.inputToolbar clearTextMessage]; + [self.inputToolbar clearTextMessageAnimated:YES]; [self clearDraft]; if (didAddToProfileWhitelist) { [self ensureDynamicInteractions];