Conference call: Let users join confs as voice or video #574

This commit is contained in:
manuroe
2016-09-06 13:30:06 +02:00
parent 8a5e60a4dd
commit 342f102c2a
5 changed files with 67 additions and 31 deletions
+1 -1
View File
@@ -161,7 +161,7 @@
"room_message_placeholder" = "Type a message...";
"room_offline_notification" = "Connectivity to the server has been lost.";
"room_unsent_messages_notification" = "Messages not sent.";
"room_ongoing_conference_call" = "Ongoing conference call";
"room_ongoing_conference_call" = "Ongoing conference call. Join as %@ or %@.";
"room_prompt_resend" = "Resend now?";
"room_resend_unsent_messages" = "Resend unsent messages";
"room_delete_unsent_messages" = "Delete unsent messages";
+9 -17
View File
@@ -2185,17 +2185,6 @@
}
}
- (void)onActivitiesViewOngoingConferenceCallTap:(UITapGestureRecognizer*)sender
{
NSLog(@"[Vector RoomVC] onActivitiesViewOngoingConferenceCallTap");
// Make sure there is not yet a call
if (![customizedRoomDataSource.mxSession.callManager callInRoom:customizedRoomDataSource.roomId])
{
[customizedRoomDataSource.room placeCallWithVideo:YES success:nil failure:nil];
}
}
#pragma mark - UITableViewDelegate
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
@@ -2655,13 +2644,16 @@
}
else
{
[roomActivitiesView displayOngoingConferenceCall:NSLocalizedStringFromTable(@"room_ongoing_conference_call", @"Vector", nil)];
[roomActivitiesView displayOngoingConferenceCall:^(BOOL video) {
UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(onActivitiesViewOngoingConferenceCallTap:)];
[tapGesture setNumberOfTouchesRequired:1];
[tapGesture setNumberOfTapsRequired:1];
[tapGesture setDelegate:self];
[roomActivitiesView addGestureRecognizer:tapGesture];
NSLog(@"[Vector RoomVC] onOngoingConferenceCallPressed");
// Make sure there is not yet a call
if (![customizedRoomDataSource.mxSession.callManager callInRoom:customizedRoomDataSource.roomId])
{
[customizedRoomDataSource.room placeCallWithVideo:video success:nil failure:nil];
}
}];
}
}
else if ([self checkUnsentMessages] == NO)
@@ -58,9 +58,11 @@
Display an ongoing conference call.
Replace the current notification if any.
@param labelText the current typing message.
@param ongoingConferenceCallPressed the block called when the user clicks on the banner.
video is YES if the user chose to join the conf in video mode.
*/
- (void)displayOngoingConferenceCall:(NSString*)labelText;
- (void)displayOngoingConferenceCall:(void (^)(BOOL video))ongoingConferenceCallPressed;
/**
Display a "scroll to bottom" icon.
@@ -126,20 +126,42 @@
}
}
- (void)displayOngoingConferenceCall:(NSString *)labelText
- (void)displayOngoingConferenceCall:(void (^)(BOOL))onOngoingConferenceCallPressed
{
[self reset];
if (labelText.length)
{
self.backgroundColor = kVectorColorPinkRed;
objc_setAssociatedObject(self.messageTextView, "onOngoingConferenceCallPressed", [onOngoingConferenceCallPressed copy], OBJC_ASSOCIATION_RETAIN_NONATOMIC);
self.iconImageView.image = [UIImage imageNamed:@"typing"];
self.messageLabel.text = labelText;
self.messageLabel.textColor = UIColor.whiteColor;
// Build the string to display in the banner
NSString *onGoingConferenceCall =
[NSString stringWithFormat:NSLocalizedStringFromTable(@"room_ongoing_conference_call", @"Vector", nil),
NSLocalizedStringFromTable(@"voice", @"Vector", nil),
NSLocalizedStringFromTable(@"video", @"Vector", nil)];
self.messageLabel.hidden = NO;
}
NSMutableAttributedString *onGoingConferenceCallAttibutedString = [[NSMutableAttributedString alloc] initWithString:onGoingConferenceCall];
// Add a link on the "voice" string
NSRange voiceRange = [onGoingConferenceCall rangeOfString:NSLocalizedStringFromTable(@"voice", @"Vector", nil)];
[onGoingConferenceCallAttibutedString addAttribute:NSUnderlineStyleAttributeName value:@(NSUnderlineStyleSingle) range:voiceRange];
[onGoingConferenceCallAttibutedString addAttribute:NSLinkAttributeName value:@"onOngoingConferenceCallWithVoicePressed" range:voiceRange];
// Add a link on the "video" string
NSRange videoRange = [onGoingConferenceCall rangeOfString:NSLocalizedStringFromTable(@"video", @"Vector", nil)];
[onGoingConferenceCallAttibutedString addAttribute:NSUnderlineStyleAttributeName value:@(NSUnderlineStyleSingle) range:videoRange];
[onGoingConferenceCallAttibutedString addAttribute:NSLinkAttributeName value:@"onOngoingConferenceCallWithVideoPressed" range:videoRange];
// Display the string in white on pink red
NSRange wholeString = NSMakeRange(0, onGoingConferenceCallAttibutedString.length);
[onGoingConferenceCallAttibutedString addAttribute:NSForegroundColorAttributeName value:UIColor.whiteColor range:wholeString];
[onGoingConferenceCallAttibutedString addAttribute:NSBackgroundColorAttributeName value:kVectorColorPinkRed range:wholeString];
[onGoingConferenceCallAttibutedString addAttribute:NSFontAttributeName value:[UIFont systemFontOfSize:15] range:wholeString];
self.messageTextView.attributedText = onGoingConferenceCallAttibutedString;
self.messageTextView.tintColor = UIColor.whiteColor;
self.messageTextView.hidden = NO;
self.backgroundColor = kVectorColorPinkRed;
self.messageTextView.backgroundColor = kVectorColorPinkRed;
}
- (void)displayScrollToBottomIcon:(NSUInteger)newMessagesCount onIconTapGesture:(void (^)(void))onIconTapGesture
@@ -234,6 +256,26 @@
return NO;
}
else if ([[URL absoluteString] isEqualToString:@"onOngoingConferenceCallWithVoicePressed"])
{
void (^onOngoingConferenceCallPressed)(BOOL) = objc_getAssociatedObject(self.messageTextView, "onOngoingConferenceCallPressed");
if (onOngoingConferenceCallPressed)
{
onOngoingConferenceCallPressed(NO);
}
return NO;
}
else if ([[URL absoluteString] isEqualToString:@"onOngoingConferenceCallWithVideoPressed"])
{
void (^onOngoingConferenceCallPressed)(BOOL) = objc_getAssociatedObject(self.messageTextView, "onOngoingConferenceCallPressed");
if (onOngoingConferenceCallPressed)
{
onOngoingConferenceCallPressed(YES);
}
return NO;
}
return YES;
}
@@ -39,10 +39,10 @@
<nil key="highlightedColor"/>
</label>
<textView hidden="YES" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" bounces="NO" scrollEnabled="NO" editable="NO" textAlignment="natural" translatesAutoresizingMaskIntoConstraints="NO" id="6ND-Cq-ABj">
<rect key="frame" x="56" y="15" width="514" height="21"/>
<rect key="frame" x="56" y="4.5" width="514" height="42"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<constraints>
<constraint firstAttribute="height" constant="21" id="lGP-xN-uuP"/>
<constraint firstAttribute="height" relation="lessThanOrEqual" constant="42" id="lGP-xN-uuP"/>
</constraints>
<string key="text">Lorem ipsum dolor sit er elit lamet, consectetaur cillium adipisicing pecu, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. Nam liber te conscient to factor tum poen legum odioque civiuda.</string>
<color key="textColor" red="1" green="0.119521145" blue="0.2069467156" alpha="1" colorSpace="calibratedRGB"/>