Merge remote-tracking branch 'origin/develop' into vector_301

This commit is contained in:
manuroe 2016-08-09 14:17:18 +02:00
parent 9d181f5dfd
commit 06c902540e
18 changed files with 300 additions and 46 deletions

View file

@ -21,6 +21,10 @@
325F6A481C21D4C100C12F51 /* chevron@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 325F6A451C21D4C100C12F51 /* chevron@2x.png */; };
325F6A491C21D4C100C12F51 /* chevron@3x.png in Resources */ = {isa = PBXBuildFile; fileRef = 325F6A461C21D4C100C12F51 /* chevron@3x.png */; };
327F8DB51C64DB9D00581CA3 /* VectorDesignValues.m in Sources */ = {isa = PBXBuildFile; fileRef = 327F8DB41C64DB9C00581CA3 /* VectorDesignValues.m */; };
32952C5B1D59D38C0039DC0C /* settings_icon@3x.png in Resources */ = {isa = PBXBuildFile; fileRef = 32952C5A1D59D38C0039DC0C /* settings_icon@3x.png */; };
32952C5F1D59D3C80039DC0C /* hangUp.png in Resources */ = {isa = PBXBuildFile; fileRef = 32952C5C1D59D3C80039DC0C /* hangUp.png */; };
32952C601D59D3C80039DC0C /* hangUp@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 32952C5D1D59D3C80039DC0C /* hangUp@2x.png */; };
32952C611D59D3C80039DC0C /* hangUp@3x.png in Resources */ = {isa = PBXBuildFile; fileRef = 32952C5E1D59D3C80039DC0C /* hangUp@3x.png */; };
329D08101CD26177007CECC6 /* Tools.m in Sources */ = {isa = PBXBuildFile; fileRef = 329D080F1CD26177007CECC6 /* Tools.m */; };
32A887211C89B9580037DC17 /* SimpleRoomTitleView.m in Sources */ = {isa = PBXBuildFile; fileRef = 32A8871F1C89B9580037DC17 /* SimpleRoomTitleView.m */; };
32A887221C89B9580037DC17 /* SimpleRoomTitleView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 32A887201C89B9580037DC17 /* SimpleRoomTitleView.xib */; };
@ -293,6 +297,10 @@
325F6A451C21D4C100C12F51 /* chevron@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "chevron@2x.png"; sourceTree = "<group>"; };
325F6A461C21D4C100C12F51 /* chevron@3x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "chevron@3x.png"; sourceTree = "<group>"; };
327F8DB41C64DB9C00581CA3 /* VectorDesignValues.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = VectorDesignValues.m; sourceTree = "<group>"; };
32952C5A1D59D38C0039DC0C /* settings_icon@3x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "settings_icon@3x.png"; sourceTree = "<group>"; };
32952C5C1D59D3C80039DC0C /* hangUp.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = hangUp.png; sourceTree = "<group>"; };
32952C5D1D59D3C80039DC0C /* hangUp@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "hangUp@2x.png"; sourceTree = "<group>"; };
32952C5E1D59D3C80039DC0C /* hangUp@3x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "hangUp@3x.png"; sourceTree = "<group>"; };
329D080E1CD26177007CECC6 /* Tools.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Tools.h; sourceTree = "<group>"; };
329D080F1CD26177007CECC6 /* Tools.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Tools.m; sourceTree = "<group>"; };
32A8871E1C89B9580037DC17 /* SimpleRoomTitleView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SimpleRoomTitleView.h; path = RoomTitle/SimpleRoomTitleView.h; sourceTree = "<group>"; };
@ -1159,6 +1167,9 @@
F02528A41C11B6FC00E1FE1B /* create_room.png */,
F02528A51C11B6FC00E1FE1B /* create_room@2x.png */,
F02528A61C11B6FC00E1FE1B /* create_room@3x.png */,
32952C5C1D59D3C80039DC0C /* hangUp.png */,
32952C5D1D59D3C80039DC0C /* hangUp@2x.png */,
32952C5E1D59D3C80039DC0C /* hangUp@3x.png */,
F02528AB1C11B6FC00E1FE1B /* logo.png */,
F02528AC1C11B6FC00E1FE1B /* logo@2x.png */,
F02528B31C11B6FC00E1FE1B /* placeholder.png */,
@ -1181,6 +1192,7 @@
F02528C31C11B6FC00E1FE1B /* selection_untick@3x.png */,
F02528C41C11B6FC00E1FE1B /* settings_icon.png */,
F02528C51C11B6FC00E1FE1B /* settings_icon@2x.png */,
32952C5A1D59D38C0039DC0C /* settings_icon@3x.png */,
F02528C71C11B6FC00E1FE1B /* typing.png */,
F02528C81C11B6FC00E1FE1B /* typing@2x.png */,
F02528C91C11B6FC00E1FE1B /* typing@3x.png */,
@ -1306,6 +1318,7 @@
F001D7631B8207C000A162C3 /* RoomInputToolbarView.xib in Resources */,
F02528DE1C11B6FC00E1FE1B /* camera_switch@3x.png in Resources */,
F02529091C11B6FC00E1FE1B /* upload_icon.png in Resources */,
32952C601D59D3C80039DC0C /* hangUp@2x.png in Resources */,
F03FBCD91CBC49B6000A5770 /* disclosure_icon@3x.png in Resources */,
F05641931C7DF9DE002276ED /* error@2x.png in Resources */,
F0D2D9861C197DCB007B8C96 /* RoomIncomingAttachmentWithoutSenderInfoBubbleCell.xib in Resources */,
@ -1334,6 +1347,7 @@
F05641831C7CBB58002276ED /* bubbles_bg_landscape.png in Resources */,
F02528D61C11B6FC00E1FE1B /* camera_capture@2x.png in Resources */,
32D0A4BE1CA44509008F3451 /* plus_icon@3x.png in Resources */,
32952C5F1D59D3C80039DC0C /* hangUp.png in Resources */,
71046D601C0C86C600DCA984 /* RoomTitleView.xib in Resources */,
F0026B5A1C916E68001D2C04 /* notifications@3x.png in Resources */,
F0DD2C721D141B0600654345 /* ContactPickerViewController.xib in Resources */,
@ -1406,6 +1420,7 @@
F02528D71C11B6FC00E1FE1B /* camera_capture@3x.png in Resources */,
F05641921C7DF9DE002276ED /* error.png in Resources */,
32D0A4BD1CA44509008F3451 /* plus_icon@2x.png in Resources */,
32952C5B1D59D38C0039DC0C /* settings_icon@3x.png in Resources */,
F02528EF1C11B6FC00E1FE1B /* placeholder.png in Resources */,
F094A9B41B78D8F000B1FBBF /* Main.storyboard in Resources */,
71F7F51E1C23079F00E7ED8F /* ContactTableViewCell.xib in Resources */,
@ -1448,6 +1463,7 @@
F02528FD1C11B6FC00E1FE1B /* selection_untick.png in Resources */,
F07ECA4E1D2BB0A60060C09F /* TableViewCellWithCheckBoxes.xib in Resources */,
F0026B5C1C916E68001D2C04 /* notificationsOff@2x.png in Resources */,
32952C611D59D3C80039DC0C /* hangUp@3x.png in Resources */,
F0CC4DC11C4E26FA003BBE45 /* MediaAlbumTableCell.xib in Resources */,
F02528DD1C11B6FC00E1FE1B /* camera_switch@2x.png in Resources */,
);

View file

@ -111,5 +111,9 @@ extern NSString *const kAppDelegateDidTapStatusBarNotification;
*/
- (BOOL)handleUniversalLinkFragment:(NSString*)fragment;
#pragma mark - Call status handling
- (void)returnToCallView;
@end

View file

@ -1837,7 +1837,7 @@ NSString *const kAppDelegateDidTapStatusBarNotification = @"kAppDelegateDidTapSt
[callStatusBarButton setTitle:btnTitle forState:UIControlStateHighlighted];
callStatusBarButton.titleLabel.textColor = [UIColor whiteColor];
[callStatusBarButton setBackgroundColor:[UIColor blueColor]];
[callStatusBarButton setBackgroundColor:kVectorColorGreen];
[callStatusBarButton addTarget:self action:@selector(returnToCallView) forControlEvents:UIControlEventTouchUpInside];
// Place button into the new window

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

View file

@ -158,6 +158,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_prompt_resend" = "Resend now?";
"room_resend_unsent_messages" = "Resend unsent messages";
"room_delete_unsent_messages" = "Delete unsent messages";
@ -245,6 +246,7 @@
"settings_password_updated" = "Your password has been updated";
"settings_labs_outgoing_voip" = "Placing VoIP/Video calls";
"settings_labs_conference_call" = "Conference Call";
// Room Details
"room_details_title" = "Room Details";

View file

@ -702,7 +702,7 @@
// Place the call directly if the room exists
if (oneToOneRoom)
{
[self.mainSession.callManager placeCallInRoom:oneToOneRoom.state.roomId withVideo:isVideoCall];
[oneToOneRoom placeCallWithVideo:isVideoCall success:nil failure:nil];
[self removePendingActionMask];
}
else
@ -719,7 +719,7 @@
// Delay the call in order to be sure that the room is ready
dispatch_async(dispatch_get_main_queue(), ^{
[self.mainSession.callManager placeCallInRoom:room.state.roomId withVideo:isVideoCall];
[room placeCallWithVideo:isVideoCall success:nil failure:nil];
[self removePendingActionMask];
});

View file

@ -28,6 +28,8 @@
#import "Contact.h"
#import "MXCallManager.h"
@interface RoomParticipantsViewController ()
{
// Search session
@ -429,7 +431,7 @@
if (self.mxRoom)
{
// Retrieve the current members from the room state
NSArray *members = self.mxRoom.state.members;
NSArray *members = [self.mxRoom.state membersWithoutConferenceUser];
NSString *userId = self.mxRoom.mxSession.myUser.userId;
NSArray *roomThirdPartyInvites = self.mxRoom.state.thirdPartyInvites;

View file

@ -24,7 +24,7 @@
#import "UIViewController+VectorSearch.h"
@interface RoomViewController : MXKRoomViewController <UISearchBarDelegate, RoomTitleViewTapGestureDelegate, RoomParticipantsViewControllerDelegate, MXKRoomMemberDetailsViewControllerDelegate>
@interface RoomViewController : MXKRoomViewController <UISearchBarDelegate, UIGestureRecognizerDelegate, RoomTitleViewTapGestureDelegate, RoomParticipantsViewControllerDelegate, MXKRoomMemberDetailsViewControllerDelegate>
// The expanded header
@property (weak, nonatomic) IBOutlet UIView *expandedHeaderContainer;

View file

@ -97,6 +97,11 @@
// Observe kAppDelegateDidTapStatusBarNotification to handle tap on clock status bar.
id kAppDelegateDidTapStatusBarNotificationObserver;
// Observers to manage ongoing conference call banner
id kMXCallStateDidChangeObserver;
id kMXCallManagerConferenceStartedObserver;
id kMXCallManagerConferenceFinishedObserver;
}
@end
@ -276,6 +281,7 @@
}
[self listenTypingNotifications];
[self listenCallNotifications];
if (self.showExpandedHeader)
{
@ -321,6 +327,8 @@
[[NSNotificationCenter defaultCenter] removeObserver:kAppDelegateDidTapStatusBarNotificationObserver];
kAppDelegateDidTapStatusBarNotificationObserver = nil;
}
[self removeCallNotificationsListeners];
}
- (void)viewDidAppear:(BOOL)animated
@ -706,7 +714,9 @@
[[NSNotificationCenter defaultCenter] removeObserver:kAppDelegateDidTapStatusBarNotificationObserver];
kAppDelegateDidTapStatusBarNotificationObserver = nil;
}
[self removeCallNotificationsListeners];
if (previewHeader || (self.expandedHeaderContainer.isHidden == NO))
{
// Here [destroy] is called before [viewWillDisappear:]
@ -810,10 +820,12 @@
RoomInputToolbarView *roomInputToolbarView = (RoomInputToolbarView*)self.inputToolbarView;
// Check whether the call option is supported
roomInputToolbarView.supportCallOption = [[NSUserDefaults standardUserDefaults] boolForKey:@"labsEnableOutgoingVoIP"]
&& self.roomDataSource.mxSession.callManager != nil
&& self.roomDataSource.room.state.joinedMembers.count == 2;
roomInputToolbarView.supportCallOption =
[[NSUserDefaults standardUserDefaults] boolForKey:@"labsEnableOutgoingVoIP"]
&& self.roomDataSource.mxSession.callManager != nil
&& (self.roomDataSource.room.state.joinedMembers.count == 2
|| ([[NSUserDefaults standardUserDefaults] boolForKey:@"labsEnableConferenceCall"] && self.roomDataSource.room.state.joinedMembers.count > 2));
// Set user picture in input toolbar
MXKImageView *userPictureView = roomInputToolbarView.pictureView;
if (userPictureView)
@ -830,6 +842,17 @@
[userPictureView.layer setCornerRadius:userPictureView.frame.size.width / 2];
userPictureView.clipsToBounds = YES;
}
// Show the hangup button if there is an active call
MXCall *callInRoom = [self.roomDataSource.mxSession.callManager callInRoom:self.roomDataSource.roomId];
if (callInRoom && callInRoom.state != MXCallStateEnded)
{
roomInputToolbarView.activeCall = YES;
}
else
{
roomInputToolbarView.activeCall = NO;
}
}
}
@ -1833,7 +1856,7 @@
if (granted)
{
[self.mainSession.callManager placeCallInRoom:self.roomDataSource.roomId withVideo:video];
[self.roomDataSource.room placeCallWithVideo:video success:nil failure:nil];
}
else
{
@ -1842,6 +1865,15 @@
}];
}
- (void)roomInputToolbarViewHangupCall:(MXKRoomInputToolbarView *)toolbarView
{
MXCall *callInRoom = [self.roomDataSource.mxSession.callManager callInRoom:self.roomDataSource.roomId];
if (callInRoom)
{
[callInRoom hangup];
}
}
- (void)roomInputToolbarView:(MXKRoomInputToolbarView*)toolbarView heightDidChanged:(CGFloat)height completion:(void (^)(BOOL finished))completion
{
if (self.roomInputToolbarContainerHeightConstraint.constant != height)
@ -1902,6 +1934,17 @@
}
}
- (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
@ -2212,6 +2255,64 @@
}
}
#pragma mark - Call notifications management
- (void)removeCallNotificationsListeners
{
if (kMXCallStateDidChangeObserver)
{
[[NSNotificationCenter defaultCenter] removeObserver:kMXCallStateDidChangeObserver];
kMXCallStateDidChangeObserver = nil;
}
if (kMXCallManagerConferenceStartedObserver)
{
[[NSNotificationCenter defaultCenter] removeObserver:kMXCallManagerConferenceStartedObserver];
kMXCallManagerConferenceStartedObserver = nil;
}
if (kMXCallManagerConferenceFinishedObserver)
{
[[NSNotificationCenter defaultCenter] removeObserver:kMXCallManagerConferenceFinishedObserver];
kMXCallManagerConferenceFinishedObserver = nil;
}
}
- (void)listenCallNotifications
{
kMXCallStateDidChangeObserver = [[NSNotificationCenter defaultCenter] addObserverForName:kMXCallStateDidChange object:nil queue:[NSOperationQueue mainQueue] usingBlock:^(NSNotification *notif) {
MXCall *call = notif.object;
if ([call.room.roomId isEqualToString:customizedRoomDataSource.roomId])
{
if (call.state == MXCallStateEnded)
{
// Workaround to manage the "back to call" banner: go back temporary the call screen.
// It will correctly manage the hide of this banner
[[AppDelegate theDelegate] returnToCallView];
}
[self refreshActivitiesViewDisplay];
[self refreshRoomInputToolbar];
}
}];
kMXCallManagerConferenceStartedObserver = [[NSNotificationCenter defaultCenter] addObserverForName:kMXCallManagerConferenceStarted object:nil queue:[NSOperationQueue mainQueue] usingBlock:^(NSNotification *notif) {
NSString *roomId = notif.object;
if ([roomId isEqualToString:customizedRoomDataSource.roomId])
{
[self refreshActivitiesViewDisplay];
}
}];
kMXCallManagerConferenceFinishedObserver = [[NSNotificationCenter defaultCenter] addObserverForName:kMXCallManagerConferenceFinished object:nil queue:[NSOperationQueue mainQueue] usingBlock:^(NSNotification *notif) {
NSString *roomId = notif.object;
if ([roomId isEqualToString:customizedRoomDataSource.roomId])
{
[self refreshActivitiesViewDisplay];
[self refreshRoomInputToolbar];
}
}];
}
#pragma mark - KVO
- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context
@ -2232,9 +2333,38 @@
{
if (self.activitiesView)
{
RoomActivitiesView *roomActivitiesView = (RoomActivitiesView*)self.activitiesView;
// Reset the button to join a conf call
roomActivitiesView.userInteractionEnabled = NO;
if ([AppDelegate theDelegate].isOffline)
{
[((RoomActivitiesView*) self.activitiesView) displayNetworkErrorNotification:NSLocalizedStringFromTable(@"room_offline_notification", @"Vector", nil)];
[roomActivitiesView displayNetworkErrorNotification:NSLocalizedStringFromTable(@"room_offline_notification", @"Vector", nil)];
}
else if (customizedRoomDataSource.room.state.isOngoingConferenceCall)
{
// Show the "Ongoing conference call" banner only if the user is not in the conference
MXCall *callInRoom = [self.roomDataSource.mxSession.callManager callInRoom:self.roomDataSource.roomId];
if (callInRoom && callInRoom.state != MXCallStateEnded)
{
if ([self checkUnsentMessages] == NO)
{
[self refreshTypingNotification];
}
}
else
{
[roomActivitiesView displayOngoingConferenceCall:NSLocalizedStringFromTable(@"room_ongoing_conference_call", @"Vector", nil)];
UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(onActivitiesViewOngoingConferenceCallTap:)];
[tapGesture setNumberOfTouchesRequired:1];
[tapGesture setNumberOfTapsRequired:1];
[tapGesture setDelegate:self];
[roomActivitiesView addGestureRecognizer:tapGesture];
roomActivitiesView.userInteractionEnabled = YES;
}
}
else if ([self checkUnsentMessages] == NO)
{

View file

@ -54,8 +54,9 @@
#define OTHER_CLEAR_CACHE_INDEX 5
#define OTHER_COUNT 6
#define LABS_VOIP_INDEX 0
#define LABS_COUNT 1
#define LABS_VOIP_INDEX 0
#define LABS_CONFERENCE_CALL_INDEX 1
#define LABS_COUNT 2
#define SECTION_TITLE_PADDING_WHEN_HIDDEN 0.01f
@ -979,14 +980,35 @@ typedef void (^blockSettingsViewController_onReadyToDestroy)();
{
if (row == LABS_VOIP_INDEX)
{
MXKTableViewCellWithLabelAndSwitch* sendCrashReportCell = [self getLabelAndSwitchCell:tableView forIndexPath:indexPath];
MXKTableViewCellWithLabelAndSwitch* labelAndSwitchCell = [self getLabelAndSwitchCell:tableView forIndexPath:indexPath];
sendCrashReportCell.mxkLabel.text = NSLocalizedStringFromTable(@"settings_labs_outgoing_voip", @"Vector", nil);
sendCrashReportCell.mxkSwitch.on = [[NSUserDefaults standardUserDefaults] boolForKey:@"labsEnableOutgoingVoIP"];
[sendCrashReportCell.mxkSwitch removeTarget:self action:nil forControlEvents:UIControlEventTouchUpInside];
[sendCrashReportCell.mxkSwitch addTarget:self action:@selector(toggleLabsVoIP:) forControlEvents:UIControlEventTouchUpInside];
labelAndSwitchCell.mxkLabel.text = NSLocalizedStringFromTable(@"settings_labs_outgoing_voip", @"Vector", nil);
labelAndSwitchCell.mxkSwitch.on = [[NSUserDefaults standardUserDefaults] boolForKey:@"labsEnableOutgoingVoIP"];
[labelAndSwitchCell.mxkSwitch removeTarget:self action:nil forControlEvents:UIControlEventTouchUpInside];
[labelAndSwitchCell.mxkSwitch addTarget:self action:@selector(toggleLabsVoIP:) forControlEvents:UIControlEventTouchUpInside];
cell = sendCrashReportCell;
cell = labelAndSwitchCell;
}
else if (row == LABS_CONFERENCE_CALL_INDEX)
{
MXKTableViewCellWithLabelAndSwitch* labelAndSwitchCell = [self getLabelAndSwitchCell:tableView forIndexPath:indexPath];
labelAndSwitchCell.mxkLabel.text = NSLocalizedStringFromTable(@"settings_labs_conference_call", @"Vector", nil);
labelAndSwitchCell.mxkSwitch.on = [[NSUserDefaults standardUserDefaults] boolForKey:@"labsEnableConferenceCall"];
// VoIP must be enabled on order to change this settings
if ([[NSUserDefaults standardUserDefaults] boolForKey:@"labsEnableOutgoingVoIP"])
{
[labelAndSwitchCell.mxkSwitch removeTarget:self action:nil forControlEvents:UIControlEventTouchUpInside];
[labelAndSwitchCell.mxkSwitch addTarget:self action:@selector(toggleLabsConferenceCall:) forControlEvents:UIControlEventTouchUpInside];
}
else
{
labelAndSwitchCell.mxkLabel.enabled = NO;
labelAndSwitchCell.mxkSwitch.enabled = NO;
}
cell = labelAndSwitchCell;
}
}
@ -1293,18 +1315,25 @@ typedef void (^blockSettingsViewController_onReadyToDestroy)();
- (void)toggleLabsVoIP:(id)sender
{
BOOL enable = [[NSUserDefaults standardUserDefaults] boolForKey:@"labsEnableOutgoingVoIP"];
if (enable)
{
NSLog(@"[SettingsViewController] Disable VoIP");
[[NSUserDefaults standardUserDefaults] setBool:NO forKey:@"labsEnableOutgoingVoIP"];
[[NSUserDefaults standardUserDefaults] synchronize];
}
else
{
NSLog(@"[SettingsViewController] Enable VoIP");
[[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"labsEnableOutgoingVoIP"];
[[NSUserDefaults standardUserDefaults] synchronize];
}
NSLog(@"[SettingsViewController] %@ VoIP", enable ? @"Disable" : @"Enable");
[[NSUserDefaults standardUserDefaults] setBool:!enable forKey:@"labsEnableOutgoingVoIP"];
[[NSUserDefaults standardUserDefaults] synchronize];
// Refresh the "Conference Call" button
[self.tableView reloadRowsAtIndexPaths:@[[NSIndexPath indexPathForRow:LABS_CONFERENCE_CALL_INDEX inSection:SETTINGS_SECTION_LABS_INDEX]]
withRowAnimation:UITableViewRowAnimationNone];
}
- (void)toggleLabsConferenceCall:(id)sender
{
BOOL enable = [[NSUserDefaults standardUserDefaults] boolForKey:@"labsEnableConferenceCall"];
NSLog(@"[SettingsViewController] %@ connference call", enable ? @"Disable" : @"Enable");
[[NSUserDefaults standardUserDefaults] setBool:!enable forKey:@"labsEnableConferenceCall"];
[[NSUserDefaults standardUserDefaults] synchronize];
}
- (void)onClearCache:(id)sender

View file

@ -54,6 +54,14 @@
*/
- (void)displayTypingNotification:(NSString*)labelText;
/**
Display an ongoing conference call.
Replace the current notification if any.
@param labelText the current typing message.
*/
- (void)displayOngoingConferenceCall:(NSString*)labelText;
/**
Remove any displayed information.
*/

View file

@ -127,8 +127,26 @@
}
}
- (void)displayOngoingConferenceCall:(NSString *)labelText
{
[self reset];
if (labelText.length)
{
self.backgroundColor = kVectorColorPinkRed;
self.iconImageView.image = [UIImage imageNamed:@"typing"];
self.messageLabel.text = labelText;
self.messageLabel.textColor = UIColor.whiteColor;
self.messageLabel.hidden = NO;
}
}
- (void)reset
{
self.backgroundColor = UIColor.clearColor;
self.iconImageView.hidden = YES;
self.messageLabel.hidden = YES;

View file

@ -36,6 +36,7 @@
@property (weak, nonatomic) IBOutlet UIButton *attachMediaButton;
@property (weak, nonatomic) IBOutlet UIButton *voiceCallButton;
@property (weak, nonatomic) IBOutlet UIButton *hangupCallButton;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *voiceCallButtonWidthConstraint;
@ -44,4 +45,9 @@
*/
@property (nonatomic) BOOL supportCallOption;
/**
Tell whether a call is active.
*/
@property (nonatomic) BOOL activeCall;
@end

View file

@ -99,6 +99,17 @@
}
}
- (void)setActiveCall:(BOOL)activeCall
{
if (_activeCall != activeCall)
{
_activeCall = activeCall;
self.voiceCallButton.hidden = _activeCall;
self.hangupCallButton.hidden = !activeCall;
}
}
#pragma mark - HPGrowingTextView delegate
//- (BOOL)growingTextViewShouldReturn:(HPGrowingTextView *)hpGrowingTextView
@ -222,7 +233,14 @@
[callActionSheet showInViewController:self.window.rootViewController];
}
}
else if (button == self.hangupCallButton)
{
if ([self.delegate respondsToSelector:@selector(roomInputToolbarViewHangupCall:)])
{
[self.delegate roomInputToolbarViewHangupCall:self];
}
}
[super onTouchUpInside:button];
}

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="10117" systemVersion="15F34" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="10117" systemVersion="15G31" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES">
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="10085"/>
@ -84,6 +84,20 @@
<action selector="onTouchUpInside:" destination="iN0-l3-epB" eventType="touchUpInside" id="Cxg-BO-TfK"/>
</connections>
</button>
<button hidden="YES" opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="2nY-YP-BvA" userLabel="hangup call Button">
<rect key="frame" x="554" y="0.0" width="46" height="46"/>
<constraints>
<constraint firstAttribute="width" secondItem="2nY-YP-BvA" secondAttribute="height" multiplier="1:1" id="59L-Jf-tXO"/>
<constraint firstAttribute="width" constant="46" id="p4p-x1-Puf"/>
</constraints>
<state key="normal" image="hangUp.png">
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
</state>
<state key="highlighted" image="voice_call_icon.png"/>
<connections>
<action selector="onTouchUpInside:" destination="iN0-l3-epB" eventType="touchUpInside" id="PB3-d8-Kbf"/>
</connections>
</button>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<constraints>
@ -99,13 +113,21 @@
<constraint firstAttribute="bottom" secondItem="Owf-M8-qJi" secondAttribute="bottom" id="Wo7-Qc-PSL"/>
<constraint firstItem="QWp-NV-uh5" firstAttribute="top" secondItem="a84-Vc-6ud" secondAttribute="top" constant="4" id="WyZ-3i-OHi"/>
<constraint firstAttribute="height" constant="46" id="Yjj-ua-rbe"/>
<constraint firstAttribute="bottom" secondItem="2nY-YP-BvA" secondAttribute="bottom" id="asf-hj-bby"/>
<constraint firstAttribute="trailing" secondItem="2nY-YP-BvA" secondAttribute="trailing" id="gNM-BS-Uwc"/>
<constraint firstAttribute="trailing" secondItem="QWp-NV-uh5" secondAttribute="trailing" constant="95" id="hXO-cY-Jgz"/>
<constraint firstItem="Hga-l8-Wua" firstAttribute="top" secondItem="a84-Vc-6ud" secondAttribute="top" id="pPH-Fp-phr"/>
<constraint firstAttribute="trailing" secondItem="Owf-M8-qJi" secondAttribute="trailing" id="vCd-Md-dvr"/>
<constraint firstAttribute="bottom" secondItem="G8Z-CM-tGs" secondAttribute="bottom" id="vpk-lw-TnO"/>
<constraint firstItem="dd4-pE-Es1" firstAttribute="top" secondItem="a84-Vc-6ud" secondAttribute="top" constant="8" id="xjT-If-1cd"/>
<constraint firstItem="2nY-YP-BvA" firstAttribute="width" secondItem="2nY-YP-BvA" secondAttribute="height" multiplier="1:1" id="yBV-cL-cfq"/>
<constraint firstItem="3ln-yI-ef9" firstAttribute="top" secondItem="a84-Vc-6ud" secondAttribute="top" id="yUF-5t-x03"/>
</constraints>
<variation key="default">
<mask key="constraints">
<exclude reference="yBV-cL-cfq"/>
</mask>
</variation>
</view>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
@ -121,6 +143,7 @@
<connections>
<outlet property="attachMediaButton" destination="Hga-l8-Wua" id="Osr-ek-c91"/>
<outlet property="growingTextView" destination="wgb-ON-N29" id="nwF-uV-Ng9"/>
<outlet property="hangupCallButton" destination="2nY-YP-BvA" id="a0m-xv-sVg"/>
<outlet property="mainToolbarHeightConstraint" destination="Yjj-ua-rbe" id="Lu8-UC-Vbo"/>
<outlet property="mainToolbarMinHeightConstraint" destination="1FO-iu-urG" id="2U6-h2-0zQ"/>
<outlet property="mainToolbarView" destination="a84-Vc-6ud" id="5p3-Ft-0gv"/>
@ -137,6 +160,7 @@
</view>
</objects>
<resources>
<image name="hangUp.png" width="27" height="27"/>
<image name="upload_icon.png" width="21" height="26"/>
<image name="voice_call_icon.png" width="24" height="27"/>
</resources>

View file

@ -57,25 +57,22 @@
self.roomTopic.text = [MXTools stripNewlineCharacters:self.mxRoom.state.topic];
// Compute active members count
NSArray *members = self.mxRoom.state.members;
NSArray *members = [self.mxRoom.state membersWithMembership:MXMembershipJoin includeConferenceUser:NO];
NSUInteger activeCount = 0;
NSUInteger memberCount = 0;
for (MXRoomMember *mxMember in members)
{
if (mxMember.membership == MXMembershipJoin)
memberCount ++;
// Get the user that corresponds to this member
MXUser *user = [self.mxRoom.mxSession userWithUserId:mxMember.userId];
// existing user ?
if (user && user.presence == MXPresenceOnline)
{
memberCount ++;
// Get the user that corresponds to this member
MXUser *user = [self.mxRoom.mxSession userWithUserId:mxMember.userId];
// existing user ?
if (user && user.presence == MXPresenceOnline)
{
activeCount ++;
}
activeCount ++;
}
}
if (memberCount)
{
// Check whether the logged in user is alone in this room