Jitsi widget: Add Settings > LABS > Use jitsi for conference calls

This commit is contained in:
manuroe
2017-08-10 15:43:25 +02:00
parent b468151684
commit c45b846ea1
5 changed files with 62 additions and 4 deletions
+31 -2
View File
@@ -95,7 +95,8 @@ enum
enum
{
LABS_CRYPTO_INDEX = 0,
LABS_MATRIX_APPS_INDEX = 0,
LABS_CRYPTO_INDEX,
LABS_COUNT
};
@@ -1865,7 +1866,22 @@ typedef void (^blockSettingsViewController_onReadyToDestroy)();
}
else if (section == SETTINGS_SECTION_LABS_INDEX)
{
if (row == LABS_CRYPTO_INDEX)
if (row == LABS_MATRIX_APPS_INDEX)
{
MXKTableViewCellWithLabelAndSwitch* labelAndSwitchCell = [self getLabelAndSwitchCell:tableView forIndexPath:indexPath];
// In the future, the text will be "Matrix Apps".
// As we support only jitsi widget at the moment, [WidgetManager sharedManager].enabled
// conditions the activation of "Use jitsi for conference call"
labelAndSwitchCell.mxkLabel.text = NSLocalizedStringFromTable(@"settings_labs_jitsi_conference", @"Vector", nil);
labelAndSwitchCell.mxkSwitch.on = [WidgetManager sharedManager].enabled;
[labelAndSwitchCell.mxkSwitch removeTarget:self action:nil forControlEvents:UIControlEventTouchUpInside];
[labelAndSwitchCell.mxkSwitch addTarget:self action:@selector(toggleLabsMatrixApps:) forControlEvents:UIControlEventTouchUpInside];
cell = labelAndSwitchCell;
}
else if (row == LABS_CRYPTO_INDEX)
{
MXSession* session = [[AppDelegate theDelegate].mxSessions objectAtIndex:0];
@@ -2554,6 +2570,19 @@ typedef void (^blockSettingsViewController_onReadyToDestroy)();
}
}
- (void)toggleLabsMatrixApps:(id)sender
{
if (sender && [sender isKindOfClass:UISwitch.class])
{
UISwitch *switchButton = (UISwitch*)sender;
if (switchButton.isOn != [WidgetManager sharedManager].enabled)
{
[WidgetManager sharedManager].enabled = switchButton.isOn;
[self.tableView reloadData];
}
}
}
- (void)toggleLabsEndToEndEncryption:(id)sender
{
if (sender && [sender isKindOfClass:UISwitch.class])