diff --git a/Vector/ViewController/RoomViewController.m b/Vector/ViewController/RoomViewController.m index 45ca32d8c..61df580b9 100644 --- a/Vector/ViewController/RoomViewController.m +++ b/Vector/ViewController/RoomViewController.m @@ -233,8 +233,11 @@ if (self.roomDataSource) { - // this room view controller has its own typing management. - self.roomDataSource.showTypingNotifications = NO; + // this room view controller has its own typing management. + self.roomDataSource.showTypingNotifications = NO; + + // Check whether call option is supported + ((RoomInputToolbarView*)self.inputToolbarView).supportCallOption = (self.roomDataSource.mxSession.callManager != nil); } } @@ -342,6 +345,12 @@ { customizedRoomDataSource = (RoomDataSource*)dataSource; } + + if (self.inputToolbarView && [self.inputToolbarView isKindOfClass:RoomInputToolbarView.class]) + { + // Update call option support + ((RoomInputToolbarView*)self.inputToolbarView).supportCallOption = (dataSource.mxSession.callManager != nil); + } } - (void)updateViewControllerAppearanceOnRoomDataSourceState diff --git a/Vector/Views/RoomInputToolbar/RoomInputToolbarView.h b/Vector/Views/RoomInputToolbar/RoomInputToolbarView.h index 96b3af4df..6e27e2de7 100644 --- a/Vector/Views/RoomInputToolbar/RoomInputToolbarView.h +++ b/Vector/Views/RoomInputToolbar/RoomInputToolbarView.h @@ -37,4 +37,11 @@ @property (weak, nonatomic) IBOutlet UIButton *attachMediaButton; @property (weak, nonatomic) IBOutlet UIButton *voiceCallButton; +@property (weak, nonatomic) IBOutlet NSLayoutConstraint *voiceCallButtonWidthConstraint; + +/** + Tell whether the call option is supported. YES by default. + */ +@property (nonatomic) BOOL supportCallOption; + @end diff --git a/Vector/Views/RoomInputToolbar/RoomInputToolbarView.m b/Vector/Views/RoomInputToolbar/RoomInputToolbarView.m index 13fac34a1..1724baa80 100644 --- a/Vector/Views/RoomInputToolbar/RoomInputToolbarView.m +++ b/Vector/Views/RoomInputToolbar/RoomInputToolbarView.m @@ -56,6 +56,8 @@ // Remove default toolbar background color self.backgroundColor = [UIColor clearColor]; + _supportCallOption = YES; + self.rightInputToolbarButton.hidden = YES; self.separatorView.backgroundColor = kVectorColorSiver; @@ -71,6 +73,25 @@ self.placeholder = NSLocalizedStringFromTable(@"room_message_placeholder", @"Vector", nil); } +- (void)setSupportCallOption:(BOOL)supportCallOption +{ + if (_supportCallOption != supportCallOption) + { + _supportCallOption = supportCallOption; + + if (supportCallOption) + { + self.voiceCallButtonWidthConstraint.constant = 46; + } + else + { + self.voiceCallButtonWidthConstraint.constant = 0; + } + + [self setNeedsUpdateConstraints]; + } +} + #pragma mark - HPGrowingTextView delegate //- (BOOL)growingTextViewShouldReturn:(HPGrowingTextView *)hpGrowingTextView diff --git a/Vector/Views/RoomInputToolbar/RoomInputToolbarView.xib b/Vector/Views/RoomInputToolbar/RoomInputToolbarView.xib index 8ae6ef9c9..4add0b805 100644 --- a/Vector/Views/RoomInputToolbar/RoomInputToolbarView.xib +++ b/Vector/Views/RoomInputToolbar/RoomInputToolbarView.xib @@ -1,8 +1,8 @@ - + - + @@ -58,8 +58,9 @@