MESSENGER-5358 add switch in settings for wysiwyg composer

This commit is contained in:
JanNiklas Grabowski
2023-11-29 15:32:00 +01:00
parent d446aaf24e
commit 2842f021ab
6 changed files with 39 additions and 4 deletions
+25 -2
View File
@@ -173,7 +173,8 @@ typedef NS_ENUM(NSUInteger, USER_INTERFACE)
TIMELINE_ENTER_ROOM_INDEX,
USER_INTERFACE_LANGUAGE_INDEX,
USER_INTERFACE_TIMELINE_STYLE_INDEX,
PERSONAL_NOTES_INDEX
PERSONAL_NOTES_INDEX,
WYSIWYG_COMPOSER_INDEX
};
typedef NS_ENUM(NSUInteger, TIMELINE)
@@ -705,6 +706,10 @@ SSOAuthenticationPresenterDelegate>
[tmpSections addObject:sectionPresence];
}
// bwi: #5358 the user should be able to switch back to the old composer
if (BWIBuildSettings.shared.bwiWYSIWYGVisibilityInSettings) {
[sectionUserInterface addRowWithTag:WYSIWYG_COMPOSER_INDEX];
};
Section *sectionAdvanced = [Section sectionWithTag:SECTION_TAG_ADVANCED];
sectionAdvanced.headerTitle = [VectorL10n settingsAdvanced];
@@ -2583,7 +2588,11 @@ SSOAuthenticationPresenterDelegate>
} else if (row == PERSONAL_NOTES_INDEX)
{
cell = [self cellForPersonalNotesVisibility:tableView indexPath:indexPath row:row];
} else {
} else if (row == WYSIWYG_COMPOSER_INDEX)
{
cell = [self toggleWYSIWYGComposer:tableView indexPath:indexPath row:row];
} else
{
cell = [self cellForTimeline:tableView indexPath:indexPath row:row];
}
}
@@ -5482,6 +5491,20 @@ SSOAuthenticationPresenterDelegate>
settings.personalNotesVisible = sender.on;
}
- (UITableViewCell*) toggleWYSIWYGComposer:(UITableView*)tableView indexPath:(NSIndexPath*)indexPath row:(NSInteger)row {
MXKTableViewCellWithLabelAndSwitch *labelAndSwitchCell = [self getLabelAndSwitchCell:tableView forIndexPath:indexPath];
labelAndSwitchCell.mxkLabel.text = [BWIL10n bwiSettingsEnableWysiwygComposer];
labelAndSwitchCell.mxkSwitch.on = RiotSettings.shared.enableWysiwygComposer;
labelAndSwitchCell.mxkSwitch.thumbTintColor = ThemeService.shared.theme.backgroundColor;
labelAndSwitchCell.mxkSwitch.onTintColor = ThemeService.shared.theme.tintColor;
[labelAndSwitchCell.mxkSwitch addTarget:self action:@selector(toggleEnableWysiwygComposerFeature:) forControlEvents:UIControlEventTouchUpInside];
return labelAndSwitchCell;
}
#pragma mark - ThreadsBetaCoordinatorBridgePresenterDelegate
- (void)threadsBetaCoordinatorBridgePresenterDelegateDidTapEnable:(ThreadsBetaCoordinatorBridgePresenter *)coordinatorBridgePresenter