Skip to content
This repository was archived by the owner on Oct 30, 2018. It is now read-only.

Commit d851da2

Browse files
author
Tosin Afolabi
committed
Merge pull request #394 from slackhq/revert-390-textbar-dismissal-public
Revert "Make dismissTextInputBar method public"
2 parents 919e57b + 031d410 commit d851da2

2 files changed

Lines changed: 15 additions & 37 deletions

File tree

Source/SLKTextViewController.h

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -208,16 +208,6 @@ NS_CLASS_AVAILABLE_IOS(7_0) @interface SLKTextViewController : UIViewController
208208
*/
209209
- (void)dismissKeyboard:(BOOL)animated;
210210

211-
/**
212-
Dismisses the text input bar, if not already
213-
214-
The recommended method to use is forceTextInputbarAdjustmentForResponder:
215-
Only if that doesn't dismiss the textInputBar should this be used.
216-
217-
@param animated YES if the textInputBar should be dismissed using an animation.
218-
*/
219-
- (void)dismissTextInputbar:(BOOL)animated;
220-
221211
/**
222212
Verifies if the text input bar should still move up/down even if it is not first responder. Default is NO.
223213
You can override this method to perform additional tasks associated with presenting the view.

Source/SLKTextViewController.m

Lines changed: 15 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -892,32 +892,6 @@ - (void)setTextInputbarHidden:(BOOL)hidden animated:(BOOL)animated
892892
}
893893
}
894894

895-
- (void)dismissTextInputbar:(BOOL)animated
896-
{
897-
if (self.keyboardHC.constant == 0) {
898-
return;
899-
}
900-
901-
__weak typeof(self) weakSelf = self;
902-
903-
[self slk_hideAutoCompletionViewIfNeeded];
904-
905-
void (^animations)() = ^void(){
906-
907-
weakSelf.keyboardHC.constant = 0.0;
908-
weakSelf.scrollViewHC.constant = [weakSelf slk_appropriateScrollViewHeight];
909-
910-
[weakSelf.view layoutIfNeeded];
911-
};
912-
913-
if (animated) {
914-
[UIView animateWithDuration:0.25 animations:animations completion:nil];
915-
}
916-
else {
917-
animations();
918-
}
919-
}
920-
921895

922896
#pragma mark - Private Methods
923897

@@ -1186,6 +1160,20 @@ - (void)slk_enableTypingSuggestionIfNeeded
11861160
[self.textView setTypingSuggestionEnabled:enable];
11871161
}
11881162

1163+
- (void)slk_dismissTextInputbarIfNeeded
1164+
{
1165+
if (self.keyboardHC.constant == 0) {
1166+
return;
1167+
}
1168+
1169+
self.keyboardHC.constant = 0.0;
1170+
self.scrollViewHC.constant = [self slk_appropriateScrollViewHeight];
1171+
1172+
[self slk_hideAutoCompletionViewIfNeeded];
1173+
1174+
[self.view layoutIfNeeded];
1175+
}
1176+
11891177
- (void)slk_detectKeyboardStatesInNotification:(NSNotification *)notification
11901178
{
11911179
// Tear down
@@ -1355,7 +1343,7 @@ - (void)slk_willShowOrHideKeyboard:(NSNotification *)notification
13551343
return;
13561344
}
13571345
else if (![self forceTextInputbarAdjustmentForResponder:currentResponder]) {
1358-
return [self dismissTextInputbar:NO];
1346+
return [self slk_dismissTextInputbarIfNeeded];
13591347
}
13601348
}
13611349

0 commit comments

Comments
 (0)