Skip to content

Commit fe3575c

Browse files
authored
Merge pull request #150 from QuickBlox/feature/issues/149
fixed GitHub issue 149 - When Keyboard is visible, swipe back gesture…
2 parents 7508529 + 04fba1c commit fe3575c

1 file changed

Lines changed: 24 additions & 31 deletions

File tree

QMChatViewController/QMChatViewController.m

Lines changed: 24 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -93,21 +93,20 @@ - (void)viewDidLoad {
9393
self.systemInputToolbar.frame = CGRectMake(0, 0, 0, kQMSystemInputToolbarDebugHeight);
9494
self.systemInputToolbar.hostViewFrameChangeBlock = ^(UIView *view, BOOL animated) {
9595

96-
CGFloat pos = weakSelf.view.frame.size.height - [view.superview convertPoint:view.frame.origin toView:weakSelf.view].y;
97-
96+
CGFloat pos = weakSelf.view.frame.size.height - [weakSelf.view.superview convertPoint:view.frame.origin toView:weakSelf.view].y;
97+
9898
if (weakSelf.inputToolbar.contentView.textView.isFirstResponder) {
99-
100-
if (view.superview.frame.origin.y > 0 && pos == 0) {
99+
if (view.superview.frame.origin.y > 0 && pos <= 0) {
101100
return;
102101
}
103102
}
104-
103+
105104
const CGFloat v = [weakSelf inputToolBarStartPos];
106-
105+
107106
if (pos < v || !view) {
108107
pos = v;
109108
}
110-
109+
111110
[weakSelf setToolbarBottomConstraintValue:pos animated:animated];
112111
};
113112

@@ -254,18 +253,18 @@ - (void)changeDataSource:(QMChatDataSource *)dataSource
254253
}
255254

256255
switch (updateType) {
257-
256+
258257
case QMDataSourceActionTypeAdd:
259-
[self.collectionView insertItemsAtIndexPaths:indexPaths];
260-
break;
261-
258+
[self.collectionView insertItemsAtIndexPaths:indexPaths];
259+
break;
260+
262261
case QMDataSourceActionTypeUpdate:
263-
[self.collectionView reloadItemsAtIndexPaths:indexPaths];
264-
break;
265-
262+
[self.collectionView reloadItemsAtIndexPaths:indexPaths];
263+
break;
264+
266265
case QMDataSourceActionTypeRemove:
267-
[self.collectionView deleteItemsAtIndexPaths:indexPaths];
268-
break;
266+
[self.collectionView deleteItemsAtIndexPaths:indexPaths];
267+
break;
269268
}
270269
};
271270

@@ -282,7 +281,7 @@ - (void)chatDataSource:(QMChatDataSource *)chatDataSource willBeChangedWithMessa
282281
#pragma mark - View lifecycle
283282

284283
- (NSUInteger)inputToolBarStartPos {
285-
284+
286285
return 0;
287286
}
288287

@@ -794,12 +793,6 @@ - (void)setToolbarBottomConstraintValue:(CGFloat)constraintValue animated:(BOOL)
794793
self.toolbarBottomLayoutGuide.constant = constraintValue;
795794

796795
if (animated) {
797-
self.navigationController.interactivePopGestureRecognizer.enabled = NO;
798-
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
799-
800-
self.navigationController.interactivePopGestureRecognizer.enabled = YES;
801-
});
802-
803796
[self.view layoutIfNeeded];
804797
}
805798
}
@@ -950,10 +943,10 @@ - (void)checkAuthorizationStatusWithCompletion:(void (^)(BOOL granted))completio
950943
switch (status)
951944
{
952945
case PHAuthorizationStatusAuthorized:
953-
if (completion) {
954-
completion(YES);
955-
}
956-
break;
946+
if (completion) {
947+
completion(YES);
948+
}
949+
break;
957950
case PHAuthorizationStatusNotDetermined:
958951
{
959952
[PHPhotoLibrary requestAuthorization:^(PHAuthorizationStatus authorizationStatus)
@@ -967,10 +960,10 @@ - (void)checkAuthorizationStatusWithCompletion:(void (^)(BOOL granted))completio
967960
break;
968961
}
969962
default:
970-
if (completion) {
971-
completion(NO);
972-
}
973-
break;
963+
if (completion) {
964+
completion(NO);
965+
}
966+
break;
974967
}
975968
}
976969
}

0 commit comments

Comments
 (0)