VoIP: Fallback to matrix.org STUN server with a confirmation dialog

#2646
This commit is contained in:
manuroe
2019-08-28 17:04:49 +02:00
parent 0fa42c251f
commit ef767d4178
10 changed files with 207 additions and 2 deletions
+41 -2
View File
@@ -86,7 +86,9 @@ enum
enum
{
CALLS_ENABLE_CALLKIT_INDEX = 0,
CALLS_DESCRIPTION_INDEX,
CALLS_CALLKIT_DESCRIPTION_INDEX,
CALLS_ENABLE_STUN_SERVER_FALLBACK_INDEX,
CALLS_STUN_SERVER_FALLBACK_DESCRIPTION_INDEX,
CALLS_COUNT
};
@@ -1266,6 +1268,11 @@ SingleImagePickerPresenterDelegate>
else if (section == SETTINGS_SECTION_CALLS_INDEX)
{
count = CALLS_COUNT;
if (!RiotSettings.shared.stunServerFallback)
{
count -= 2;
}
}
else if (section == SETTINGS_SECTION_USER_INTERFACE_INDEX)
{
@@ -1834,7 +1841,7 @@ SingleImagePickerPresenterDelegate>
cell = labelAndSwitchCell;
}
else if (row == CALLS_DESCRIPTION_INDEX)
else if (row == CALLS_CALLKIT_DESCRIPTION_INDEX)
{
MXKTableViewCell *globalInfoCell = [self getDefaultTableViewCell:tableView];
globalInfoCell.textLabel.text = NSLocalizedStringFromTable(@"settings_callkit_info", @"Vector", nil);
@@ -1846,6 +1853,30 @@ SingleImagePickerPresenterDelegate>
globalInfoCell.textLabel.enabled = NO;
}
cell = globalInfoCell;
}
else if (row == CALLS_ENABLE_STUN_SERVER_FALLBACK_INDEX)
{
MXKTableViewCellWithLabelAndSwitch* labelAndSwitchCell = [self getLabelAndSwitchCell:tableView forIndexPath:indexPath];
labelAndSwitchCell.mxkLabel.text = NSLocalizedStringFromTable(@"settings_calls_stun_server_fallback_button", @"Vector", nil);
labelAndSwitchCell.mxkSwitch.on = RiotSettings.shared.allowStunServerFallback;
labelAndSwitchCell.mxkSwitch.onTintColor = ThemeService.shared.theme.tintColor;
labelAndSwitchCell.mxkSwitch.enabled = YES;
[labelAndSwitchCell.mxkSwitch addTarget:self action:@selector(toggleStunServerFallback:) forControlEvents:UIControlEventTouchUpInside];
cell = labelAndSwitchCell;
}
else if (row == CALLS_STUN_SERVER_FALLBACK_DESCRIPTION_INDEX)
{
NSString *stunFallbackHost = RiotSettings.shared.stunServerFallback;
// Remove "stun:"
stunFallbackHost = [stunFallbackHost componentsSeparatedByString:@":"].lastObject;
MXKTableViewCell *globalInfoCell = [self getDefaultTableViewCell:tableView];
globalInfoCell.textLabel.text = [NSString stringWithFormat:NSLocalizedStringFromTable(@"settings_calls_stun_server_fallback_description", @"Vector", nil), stunFallbackHost];
globalInfoCell.textLabel.numberOfLines = 0;
globalInfoCell.selectionStyle = UITableViewCellSelectionStyleNone;
cell = globalInfoCell;
}
}
@@ -2945,6 +2976,14 @@ SingleImagePickerPresenterDelegate>
[MXKAppSettings standardAppSettings].enableCallKit = switchButton.isOn;
}
- (void)toggleStunServerFallback:(id)sender
{
UISwitch *switchButton = (UISwitch*)sender;
RiotSettings.shared.allowStunServerFallback = switchButton.isOn;
self.mainSession.callManager.fallbackSTUNServer = RiotSettings.shared.allowStunServerFallback ? RiotSettings.shared.stunServerFallback : nil;
}
- (void)toggleShowDecodedContent:(id)sender
{
UISwitch *switchButton = (UISwitch*)sender;