Skip to content

Commit bb07742

Browse files
committed
Merge pull request slackhq#264 from slackhq/bug-fixes
Bug Fixes
2 parents 44c861e + 5dbdd1d commit bb07742

File tree

2 files changed

+18
-20
lines changed

2 files changed

+18
-20
lines changed

Examples/Messenger-Shared/MessageViewController.m

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -194,18 +194,23 @@ - (void)simulateUserTyping:(id)sender
194194
- (void)didLongPressCell:(UIGestureRecognizer *)gesture
195195
{
196196
#ifdef __IPHONE_8_0
197-
UIAlertController *alertController = [UIAlertController alertControllerWithTitle:nil message:nil preferredStyle:UIAlertControllerStyleActionSheet];
198-
alertController.modalPresentationStyle = UIModalPresentationPopover;
199-
alertController.popoverPresentationController.sourceView = gesture.view.superview;
200-
alertController.popoverPresentationController.sourceRect = gesture.view.frame;
201-
202-
[alertController addAction:[UIAlertAction actionWithTitle:@"Edit Message" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {
197+
if ([UIAlertController class]) {
198+
UIAlertController *alertController = [UIAlertController alertControllerWithTitle:nil message:nil preferredStyle:UIAlertControllerStyleActionSheet];
199+
alertController.modalPresentationStyle = UIModalPresentationPopover;
200+
alertController.popoverPresentationController.sourceView = gesture.view.superview;
201+
alertController.popoverPresentationController.sourceRect = gesture.view.frame;
202+
203+
[alertController addAction:[UIAlertAction actionWithTitle:@"Edit Message" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {
204+
[self editCellMessage:gesture];
205+
}]];
206+
207+
[alertController addAction:[UIAlertAction actionWithTitle:@"Cancel" style:UIAlertActionStyleCancel handler:NULL]];
208+
209+
[self.navigationController presentViewController:alertController animated:YES completion:nil];
210+
}
211+
else {
203212
[self editCellMessage:gesture];
204-
}]];
205-
206-
[alertController addAction:[UIAlertAction actionWithTitle:@"Cancel" style:UIAlertActionStyleCancel handler:NULL]];
207-
208-
[self.navigationController presentViewController:alertController animated:YES completion:nil];
213+
}
209214
#else
210215
[self editCellMessage:gesture];
211216
#endif

Source/Classes/SLKTextViewController.m

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -700,23 +700,16 @@ - (void)editText:(NSString *)text
700700
// Caches the current text, in case the user cancels the edition
701701
[self slk_cacheTextToDisk:self.textView.text];
702702

703-
if (!SLK_IS_LANDSCAPE) {
704-
[self.textView setText:text];
705-
}
706-
707703
[self.textInputbar beginTextEditing];
708704

709-
// Setting the text after calling -beginTextEditing is safer when on landscape orientation
710-
if (SLK_IS_LANDSCAPE) {
711-
[self.textView setText:text];
712-
}
705+
// Setting the text after calling -beginTextEditing is safer
706+
[self.textView setText:text];
713707

714708
[self.textView slk_scrollToCaretPositonAnimated:YES];
715709

716710
// Brings up the keyboard if needed
717711
[self presentKeyboard:YES];
718712
}
719-
720713
- (void)didCommitTextEditing:(id)sender
721714
{
722715
if (!self.textInputbar.isEditing) {

0 commit comments

Comments
 (0)