mirror of
https://github.com/vector-im/element-ios.git
synced 2024-09-28 23:32:41 +00:00
Jitsi widget: Create a specific [NSUserDefaults standardUserDefaults] key for useJitsiForConferenceCalls
This commit is contained in:
parent
40995c9663
commit
1e62fcadaa
2 changed files with 11 additions and 18 deletions
|
@ -394,14 +394,10 @@
|
|||
{
|
||||
Widget *jitsiWidget;
|
||||
|
||||
NSArray<Widget*> *widgets = [[WidgetManager sharedManager] widgetsInRoom:self.room];
|
||||
for (Widget *widget in widgets)
|
||||
// Manage only one jitsi widget at a time for the moment
|
||||
if ([[NSUserDefaults standardUserDefaults] boolForKey:@"useJitsiForConferenceCalls"])
|
||||
{
|
||||
if ([widget.type isEqualToString:kWidgetTypeJitsi])
|
||||
{
|
||||
jitsiWidget = widget;
|
||||
break;
|
||||
}
|
||||
jitsiWidget = [[WidgetManager sharedManager] widgetsOfTypes:@[kWidgetTypeJitsi] inRoom:self.room].firstObject;
|
||||
}
|
||||
|
||||
return jitsiWidget;
|
||||
|
|
|
@ -1870,14 +1870,11 @@ typedef void (^blockSettingsViewController_onReadyToDestroy)();
|
|||
{
|
||||
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.on = [[NSUserDefaults standardUserDefaults] boolForKey:@"useJitsiForConferenceCalls"];
|
||||
|
||||
[labelAndSwitchCell.mxkSwitch removeTarget:self action:nil forControlEvents:UIControlEventTouchUpInside];
|
||||
[labelAndSwitchCell.mxkSwitch addTarget:self action:@selector(toggleLabsMatrixApps:) forControlEvents:UIControlEventTouchUpInside];
|
||||
[labelAndSwitchCell.mxkSwitch addTarget:self action:@selector(toggleJitsiForConference:) forControlEvents:UIControlEventTouchUpInside];
|
||||
|
||||
cell = labelAndSwitchCell;
|
||||
}
|
||||
|
@ -2570,16 +2567,16 @@ typedef void (^blockSettingsViewController_onReadyToDestroy)();
|
|||
}
|
||||
}
|
||||
|
||||
- (void)toggleLabsMatrixApps:(id)sender
|
||||
- (void)toggleJitsiForConference:(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];
|
||||
}
|
||||
|
||||
[[NSUserDefaults standardUserDefaults] setBool:switchButton.isOn forKey:@"useJitsiForConferenceCalls"];
|
||||
[[NSUserDefaults standardUserDefaults] synchronize];
|
||||
|
||||
[self.tableView reloadData];
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue