Skip to content

Commit

Permalink
Merge pull request #150 from QuickBlox/feature/issues/149
Browse files Browse the repository at this point in the history
fixed GitHub issue 149 - When Keyboard is visible, swipe back gesture…
  • Loading branch information
pro100andrey committed May 2, 2018
2 parents 7508529 + 04fba1c commit fe3575c
Showing 1 changed file with 24 additions and 31 deletions.
55 changes: 24 additions & 31 deletions QMChatViewController/QMChatViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -93,21 +93,20 @@ - (void)viewDidLoad {
self.systemInputToolbar.frame = CGRectMake(0, 0, 0, kQMSystemInputToolbarDebugHeight);
self.systemInputToolbar.hostViewFrameChangeBlock = ^(UIView *view, BOOL animated) {

CGFloat pos = weakSelf.view.frame.size.height - [view.superview convertPoint:view.frame.origin toView:weakSelf.view].y;

CGFloat pos = weakSelf.view.frame.size.height - [weakSelf.view.superview convertPoint:view.frame.origin toView:weakSelf.view].y;
if (weakSelf.inputToolbar.contentView.textView.isFirstResponder) {

if (view.superview.frame.origin.y > 0 && pos == 0) {
if (view.superview.frame.origin.y > 0 && pos <= 0) {
return;
}
}

const CGFloat v = [weakSelf inputToolBarStartPos];

if (pos < v || !view) {
pos = v;
}

[weakSelf setToolbarBottomConstraintValue:pos animated:animated];
};

Expand Down Expand Up @@ -254,18 +253,18 @@ - (void)changeDataSource:(QMChatDataSource *)dataSource
}

switch (updateType) {

case QMDataSourceActionTypeAdd:
[self.collectionView insertItemsAtIndexPaths:indexPaths];
break;

[self.collectionView insertItemsAtIndexPaths:indexPaths];
break;
case QMDataSourceActionTypeUpdate:
[self.collectionView reloadItemsAtIndexPaths:indexPaths];
break;

[self.collectionView reloadItemsAtIndexPaths:indexPaths];
break;
case QMDataSourceActionTypeRemove:
[self.collectionView deleteItemsAtIndexPaths:indexPaths];
break;
[self.collectionView deleteItemsAtIndexPaths:indexPaths];
break;
}
};

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

- (NSUInteger)inputToolBarStartPos {

return 0;
}

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

if (animated) {
self.navigationController.interactivePopGestureRecognizer.enabled = NO;
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{

self.navigationController.interactivePopGestureRecognizer.enabled = YES;
});

[self.view layoutIfNeeded];
}
}
Expand Down Expand Up @@ -950,10 +943,10 @@ - (void)checkAuthorizationStatusWithCompletion:(void (^)(BOOL granted))completio
switch (status)
{
case PHAuthorizationStatusAuthorized:
if (completion) {
completion(YES);
}
break;
if (completion) {
completion(YES);
}
break;
case PHAuthorizationStatusNotDetermined:
{
[PHPhotoLibrary requestAuthorization:^(PHAuthorizationStatus authorizationStatus)
Expand All @@ -967,10 +960,10 @@ - (void)checkAuthorizationStatusWithCompletion:(void (^)(BOOL granted))completio
break;
}
default:
if (completion) {
completion(NO);
}
break;
if (completion) {
completion(NO);
}
break;
}
}
}
Expand Down

0 comments on commit fe3575c

Please sign in to comment.