6195: Add labbs flag for live location sharing

This commit is contained in:
MaximeE
2022-05-24 11:43:00 +02:00
parent 8f13fc2980
commit 16950ad58b
7 changed files with 40 additions and 4 deletions
+27 -1
View File
@@ -167,7 +167,8 @@ typedef NS_ENUM(NSUInteger, LABS_ENABLE)
LABS_ENABLE_THREADS_INDEX,
LABS_ENABLE_MESSAGE_BUBBLES_INDEX,
LABS_ENABLE_AUTO_REPORT_DECRYPTION_ERRORS,
LABS_USE_ONLY_LATEST_USER_AVATAR_AND_NAME_INDEX
LABS_USE_ONLY_LATEST_USER_AVATAR_AND_NAME_INDEX,
LABS_ENABLE_LIVE_LOCATION_SHARING
};
typedef NS_ENUM(NSUInteger, SECURITY)
@@ -595,6 +596,7 @@ ThreadsBetaCoordinatorBridgePresenterDelegate>
[sectionLabs addRowWithTag:LABS_ENABLE_MESSAGE_BUBBLES_INDEX];
[sectionLabs addRowWithTag:LABS_ENABLE_AUTO_REPORT_DECRYPTION_ERRORS];
[sectionLabs addRowWithTag:LABS_USE_ONLY_LATEST_USER_AVATAR_AND_NAME_INDEX];
[sectionLabs addRowWithTag:LABS_ENABLE_LIVE_LOCATION_SHARING];
sectionLabs.headerTitle = [VectorL10n settingsLabs];
if (sectionLabs.hasAnyRows)
{
@@ -1522,6 +1524,21 @@ ThreadsBetaCoordinatorBridgePresenterDelegate>
return labelAndSwitchCell;
}
- (UITableViewCell *)buildLiveLocationSharingCellForTableView:(UITableView*)tableView
atIndexPath:(NSIndexPath*)indexPath
{
MXKTableViewCellWithLabelAndSwitch* labelAndSwitchCell = [self getLabelAndSwitchCell:tableView forIndexPath:indexPath];
labelAndSwitchCell.mxkLabel.text = [VectorL10n settingsLabsEnableLiveLocationSharing];
labelAndSwitchCell.mxkSwitch.on = RiotSettings.shared.enableLiveLocationSharing;
labelAndSwitchCell.mxkSwitch.onTintColor = ThemeService.shared.theme.tintColor;
labelAndSwitchCell.mxkSwitch.enabled = YES;
[labelAndSwitchCell.mxkSwitch addTarget:self action:@selector(toggleEnableLiveLocationSharing:) forControlEvents:UIControlEventTouchUpInside];
return labelAndSwitchCell;
}
#pragma mark - 3Pid Add
- (void)showAuthenticationIfNeededForAdding:(MX3PIDMedium)medium withSession:(MXSession*)session completion:(void (^)(NSDictionary* authParams))completion
@@ -2528,6 +2545,10 @@ ThreadsBetaCoordinatorBridgePresenterDelegate>
cell = labelAndSwitchCell;
}
else if (row == LABS_ENABLE_LIVE_LOCATION_SHARING)
{
cell = [self buildLiveLocationSharingCellForTableView:tableView atIndexPath:indexPath];
}
}
else if (section == SECTION_TAG_FLAIR)
{
@@ -4003,6 +4024,11 @@ ThreadsBetaCoordinatorBridgePresenterDelegate>
RiotSettings.shared.enableUISIAutoReporting = sender.isOn;
}
- (void)toggleEnableLiveLocationSharing:(UISwitch *)sender
{
RiotSettings.shared.enableLiveLocationSharing = sender.isOn;
}
#pragma mark - TextField listener
- (IBAction)textFieldDidChange:(id)sender