diff --git a/Classes/LinphoneUI/Base.lproj/UIChatBubbleTextCell.xib b/Classes/LinphoneUI/Base.lproj/UIChatBubbleTextCell.xib index 4d7e89297..406aae959 100644 --- a/Classes/LinphoneUI/Base.lproj/UIChatBubbleTextCell.xib +++ b/Classes/LinphoneUI/Base.lproj/UIChatBubbleTextCell.xib @@ -1,11 +1,11 @@ - - + + - + @@ -20,17 +20,10 @@ - - - - - - - @@ -59,11 +52,6 @@ - - - - - @@ -94,12 +82,11 @@ - + + + - - - @@ -110,14 +97,8 @@ - - - - - - diff --git a/Classes/LinphoneUI/UIChatBubblePhotoCell.m b/Classes/LinphoneUI/UIChatBubblePhotoCell.m index b85a67c4e..f6d210880 100644 --- a/Classes/LinphoneUI/UIChatBubblePhotoCell.m +++ b/Classes/LinphoneUI/UIChatBubblePhotoCell.m @@ -172,7 +172,7 @@ } else if (_cancelButton.hidden == NO) { [self onCancelClick:event]; } else { - [super onResendClick:event]; + [super onResend]; } } diff --git a/Classes/LinphoneUI/UIChatBubbleTextCell.h b/Classes/LinphoneUI/UIChatBubbleTextCell.h index 9c3d71762..56f108874 100644 --- a/Classes/LinphoneUI/UIChatBubbleTextCell.h +++ b/Classes/LinphoneUI/UIChatBubbleTextCell.h @@ -29,7 +29,6 @@ @property(nonatomic, weak) IBOutlet UIImageView *backgroundColorImage; @property(nonatomic, weak) IBOutlet UIRoundedImageView *avatarImage; @property(nonatomic, weak) IBOutlet UILabel *contactDateLabel; -@property(nonatomic, weak) IBOutlet UIImageView *statusErrorImage; @property(weak, nonatomic) IBOutlet UIActivityIndicatorView *statusInProgressSpinner; @property(nonatomic, weak) IBOutlet UITextViewNoDefine *messageText; @property(weak, nonatomic) IBOutlet UIImageView *bottomBarColor; @@ -44,8 +43,9 @@ - (void)setChatMessage:(LinphoneChatMessage *)message; -- (IBAction)onDeleteClick:(id)event; -- (IBAction)onResendClick:(id)event; +- (void)onDelete; +- (void)onResend; +- (void)onLime; - (void)update; - (void)displayImdmStatus:(LinphoneChatMessageState)state; diff --git a/Classes/LinphoneUI/UIChatBubbleTextCell.m b/Classes/LinphoneUI/UIChatBubbleTextCell.m index 646fbeaf2..8a815ecce 100644 --- a/Classes/LinphoneUI/UIChatBubbleTextCell.m +++ b/Classes/LinphoneUI/UIChatBubbleTextCell.m @@ -40,6 +40,21 @@ [self addSubview:sub]; } } + + UITapGestureRecognizer *limeRecognizer = + [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(onLime)]; + limeRecognizer.numberOfTapsRequired = 1; + [_LIMEKO addGestureRecognizer:limeRecognizer]; + _LIMEKO.userInteractionEnabled = YES; + + UITapGestureRecognizer *resendRecognizer = + [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(onResend)]; + resendRecognizer.numberOfTapsRequired = 1; + [_imdmIcon addGestureRecognizer:resendRecognizer]; + _imdmIcon.userInteractionEnabled = YES; + [_imdmLabel addGestureRecognizer:resendRecognizer]; + _imdmLabel.userInteractionEnabled = YES; + return self; } @@ -135,13 +150,10 @@ _contactDateLabel.textColor = [UIColor colorWithPatternImage:_backgroundColorImage.image]; if (outgoing && state == LinphoneChatMessageStateInProgress) { - _statusErrorImage.hidden = YES; [_statusInProgressSpinner startAnimating]; } else if (!outgoing && state == LinphoneChatMessageStateFileTransferError) { - _statusErrorImage.hidden = NO; [_statusInProgressSpinner stopAnimating]; } else { - _statusErrorImage.hidden = YES; [_statusInProgressSpinner stopAnimating]; } @@ -195,7 +207,7 @@ #pragma mark - Action Functions -- (IBAction)onDeleteClick:(id)event { +- (void)onDelete { if (_message != NULL) { UITableView *tableView = VIEW(ChatConversationView).tableController.tableView; NSIndexPath *indexPath = [tableView indexPathForCell:self]; @@ -205,45 +217,42 @@ } } -- (IBAction)onResendClick:(id)event { - if (!_LIMEKO.hidden) { +- (void)onLime { + if (!_LIMEKO.hidden) [self displayLIMEWarning]; - return; - } +} +- (void)onResend { if (_message == nil || !linphone_chat_message_is_outgoing(_message)) return; LinphoneChatMessageState state = linphone_chat_message_get_state(_message); - if (state == LinphoneChatMessageStateNotDelivered || state == LinphoneChatMessageStateFileTransferError) { - if (linphone_chat_message_get_file_transfer_information(_message) != NULL) { - NSString *localImage = [LinphoneManager getMessageAppDataForKey:@"localimage" inMessage:_message]; - NSNumber *uploadQuality =[LinphoneManager getMessageAppDataForKey:@"uploadQuality" inMessage:_message]; - - NSURL *imageUrl = [NSURL URLWithString:localImage]; + if (state != LinphoneChatMessageStateNotDelivered && state != LinphoneChatMessageStateFileTransferError) + return; - [self onDeleteClick:nil]; - - [LinphoneManager.instance.photoLibrary assetForURL:imageUrl - resultBlock:^(ALAsset *asset) { - dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, (unsigned long)NULL), - ^(void) { - UIImage *image = [[UIImage alloc] initWithCGImage:[[asset defaultRepresentation] fullResolutionImage]]; - [_chatRoomDelegate startImageUpload:image url:imageUrl withQuality:(uploadQuality ? [uploadQuality floatValue] : 0.9)]; - }); - } - failureBlock:^(NSError *error) { - LOGE(@"Can't read image"); - }]; - } else { - [self onDeleteClick:nil]; - - double delayInSeconds = 0.4; - dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, (int64_t)(delayInSeconds * NSEC_PER_SEC)); - dispatch_after(popTime, dispatch_get_main_queue(), ^(void) { - [_chatRoomDelegate resendChat:self.textMessage withExternalUrl:nil]; - }); - } + if (linphone_chat_message_get_file_transfer_information(_message) != NULL) { + NSString *localImage = [LinphoneManager getMessageAppDataForKey:@"localimage" inMessage:_message]; + NSNumber *uploadQuality =[LinphoneManager getMessageAppDataForKey:@"uploadQuality" inMessage:_message]; + NSURL *imageUrl = [NSURL URLWithString:localImage]; + [self onDelete]; + [LinphoneManager.instance.photoLibrary assetForURL:imageUrl + resultBlock:^(ALAsset *asset) { + dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, (unsigned long)NULL), + ^(void) { + UIImage *image = [[UIImage alloc] initWithCGImage:[[asset defaultRepresentation] fullResolutionImage]]; + [_chatRoomDelegate startImageUpload:image url:imageUrl withQuality:(uploadQuality ? [uploadQuality floatValue] : 0.9)]; + }); + } + failureBlock:^(NSError *error) { + LOGE(@"Can't read image"); + }]; + } else { + [self onDelete]; + double delayInSeconds = 0.4; + dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, (int64_t)(delayInSeconds * NSEC_PER_SEC)); + dispatch_after(popTime, dispatch_get_main_queue(), ^(void) { + [_chatRoomDelegate resendChat:self.textMessage withExternalUrl:nil]; + }); } } #pragma mark - State changed handling