diff --git a/Vector/Assets/en.lproj/Vector.strings b/Vector/Assets/en.lproj/Vector.strings index 93e93f50a..9d4169158 100644 --- a/Vector/Assets/en.lproj/Vector.strings +++ b/Vector/Assets/en.lproj/Vector.strings @@ -35,6 +35,8 @@ "join" = "Join"; "reject" = "Reject"; "camera" = "Camera"; +"voice" = "Voice"; +"video" = "Video"; // Authentication "auth_login" = "Log in"; diff --git a/Vector/Views/RoomInputToolbar/RoomInputToolbarView.m b/Vector/Views/RoomInputToolbar/RoomInputToolbarView.m index 1724baa80..c04407990 100644 --- a/Vector/Views/RoomInputToolbar/RoomInputToolbarView.m +++ b/Vector/Views/RoomInputToolbar/RoomInputToolbarView.m @@ -25,6 +25,9 @@ @interface RoomInputToolbarView() { MediaPickerViewController *mediaPicker; + + // The call type selection (voice or video) + MXKAlert *callActionSheet; } @end @@ -186,7 +189,33 @@ { if ([self.delegate respondsToSelector:@selector(roomInputToolbarView:placeCallWithVideo:)]) { - [self.delegate roomInputToolbarView:self placeCallWithVideo:NO]; + // Ask the user the kind of the call: voice or video? + callActionSheet = [[MXKAlert alloc] initWithTitle:nil message:nil style:MXKAlertStyleActionSheet]; + + __weak typeof(self) weakSelf = self; + [callActionSheet addActionWithTitle:NSLocalizedStringFromTable(@"voice", @"Vector", nil) style:MXKAlertActionStyleDefault handler:^(MXKAlert *alert) { + __strong __typeof(weakSelf)strongSelf = weakSelf; + strongSelf->callActionSheet = nil; + + [strongSelf.delegate roomInputToolbarView:strongSelf placeCallWithVideo:NO]; + }]; + + [callActionSheet addActionWithTitle:NSLocalizedStringFromTable(@"video", @"Vector", nil) style:MXKAlertActionStyleDefault handler:^(MXKAlert *alert) { + __strong __typeof(weakSelf)strongSelf = weakSelf; + strongSelf->callActionSheet = nil; + + [strongSelf.delegate roomInputToolbarView:strongSelf placeCallWithVideo:YES]; + }]; + + callActionSheet.cancelButtonIndex = [callActionSheet addActionWithTitle:[NSBundle mxk_localizedStringForKey:@"cancel"] style:MXKAlertActionStyleCancel handler:^(MXKAlert *alert) { + + __strong __typeof(weakSelf)strongSelf = weakSelf; + strongSelf->callActionSheet = nil; + }]; + + callActionSheet.sourceView = self.voiceCallButton; + + [callActionSheet showInViewController:self.window.rootViewController]; } } @@ -197,6 +226,12 @@ - (void)destroy { [self dismissMediaPicker]; + + if (callActionSheet) + { + [callActionSheet dismiss:NO]; + callActionSheet = nil; + } [super destroy]; }