Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixed GitHub issue 149 - When Keyboard is visible, swipe back gesture… #150

Merged
1 commit merged into from
May 2, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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