mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-01-17 11:08:06 +00:00
repair scroll after isComposing and photo fetching
This commit is contained in:
parent
4efecb8f25
commit
7ea543f1b0
2 changed files with 37 additions and 12 deletions
|
|
@ -334,6 +334,7 @@ static UICompositeViewDescription *compositeDescription = nil;
|
|||
}
|
||||
|
||||
- (void)setComposingVisible:(BOOL)visible withDelay:(CGFloat)delay {
|
||||
Boolean shouldAnimate = composingVisible == visible;
|
||||
CGRect keyboardFrame = [_messageView frame];
|
||||
CGRect newComposingFrame = [_composeIndicatorView frame];
|
||||
CGRect newTableFrame = [_tableController.tableView frame];
|
||||
|
|
@ -364,8 +365,10 @@ static UICompositeViewDescription *compositeDescription = nil;
|
|||
composingVisible = visible;
|
||||
[UIView animateWithDuration:delay
|
||||
animations:^{
|
||||
_tableController.tableView.frame = newTableFrame;
|
||||
_composeIndicatorView.frame = newComposingFrame;
|
||||
if (shouldAnimate)
|
||||
return;
|
||||
_tableController.tableView.frame = newTableFrame;
|
||||
_composeIndicatorView.frame = newComposingFrame;
|
||||
}
|
||||
completion:^(BOOL finished) {
|
||||
[_tableController scrollToBottom:TRUE];
|
||||
|
|
|
|||
|
|
@ -85,6 +85,17 @@
|
|||
[super setChatMessage:amessage];
|
||||
}
|
||||
|
||||
- (void) loadAsset:(ALAsset*) asset {
|
||||
UIImage *image = [[UIImage alloc] initWithCGImage:[asset thumbnail]];
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
[_messageImageView setImage:image];
|
||||
[_messageImageView setFullImageUrl:asset];
|
||||
[_messageImageView stopLoading];
|
||||
_messageImageView.hidden = NO;
|
||||
_imageGestureRecognizer.enabled = YES;
|
||||
});
|
||||
}
|
||||
|
||||
- (void)update {
|
||||
if (self.message == nil) {
|
||||
LOGW(@"Cannot update message room cell: NULL message");
|
||||
|
|
@ -113,16 +124,27 @@
|
|||
resultBlock:^(ALAsset *asset) {
|
||||
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, (unsigned long)NULL),
|
||||
^(void) {
|
||||
if (achat == self.message) { // Avoid glitch and scrolling
|
||||
UIImage *image = [[UIImage alloc] initWithCGImage:[asset thumbnail]];
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
[_messageImageView setImage:image];
|
||||
[_messageImageView setFullImageUrl:asset];
|
||||
[_messageImageView stopLoading];
|
||||
_messageImageView.hidden = NO;
|
||||
_imageGestureRecognizer.enabled = YES;
|
||||
});
|
||||
}
|
||||
if (achat != self.message) // Avoid glitch and scrolling
|
||||
return;
|
||||
|
||||
if (asset)
|
||||
[self loadAsset:asset];
|
||||
else {
|
||||
[LinphoneManager.instance.photoLibrary
|
||||
enumerateGroupsWithTypes:ALAssetsGroupAll
|
||||
usingBlock:^(ALAssetsGroup *group, BOOL *stop) {
|
||||
[group enumerateAssetsWithOptions:NSEnumerationReverse
|
||||
usingBlock:^(ALAsset *result, NSUInteger index, BOOL *stop) {
|
||||
if([result.defaultRepresentation.url isEqual:imageUrl]) {
|
||||
[self loadAsset:result];
|
||||
*stop = YES;
|
||||
}
|
||||
}];
|
||||
}
|
||||
failureBlock:^(NSError *error) {
|
||||
LOGE(@"Error: Cannot load asset from photo stream - %@", [error localizedDescription]);
|
||||
}];
|
||||
}
|
||||
});
|
||||
}
|
||||
failureBlock:^(NSError *error) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue