From 4437727a4cc09d19a090dd4ef1cc9c40f4fc826d Mon Sep 17 00:00:00 2001 From: SBiOSoftWhare Date: Thu, 10 Feb 2022 14:59:45 +0100 Subject: [PATCH 1/2] Message bubbles: Move bubbles settings to labs section atm. --- .../Modules/Settings/SettingsViewController.m | 39 +++++++++++++------ 1 file changed, 27 insertions(+), 12 deletions(-) diff --git a/Riot/Modules/Settings/SettingsViewController.m b/Riot/Modules/Settings/SettingsViewController.m index a1964925e..bab34cb22 100644 --- a/Riot/Modules/Settings/SettingsViewController.m +++ b/Riot/Modules/Settings/SettingsViewController.m @@ -158,7 +158,8 @@ typedef NS_ENUM(NSUInteger, ABOUT) typedef NS_ENUM(NSUInteger, LABS_ENABLE) { LABS_ENABLE_RINGING_FOR_GROUP_CALLS_INDEX = 0, - LABS_ENABLE_THREADS_INDEX + LABS_ENABLE_THREADS_INDEX, + LABS_ENABLE_MESSAGE_BUBBLES_INDEX }; typedef NS_ENUM(NSUInteger, SECURITY) @@ -510,7 +511,9 @@ TableViewSectionsDelegate> if (BuildSettings.roomScreenAllowTimelineStyleConfiguration) { - [sectionUserInterface addRowWithTag:USER_INTERFACE_TIMELINE_STYLE_INDEX]; + // NOTE: Message bubbles are under labs section atm + +// [sectionUserInterface addRowWithTag:USER_INTERFACE_TIMELINE_STYLE_INDEX]; } [tmpSections addObject: sectionUserInterface]; @@ -568,6 +571,7 @@ TableViewSectionsDelegate> Section *sectionLabs = [Section sectionWithTag:SECTION_TAG_LABS]; [sectionLabs addRowWithTag:LABS_ENABLE_RINGING_FOR_GROUP_CALLS_INDEX]; [sectionLabs addRowWithTag:LABS_ENABLE_THREADS_INDEX]; + [sectionLabs addRowWithTag:LABS_ENABLE_MESSAGE_BUBBLES_INDEX]; sectionLabs.headerTitle = [VectorL10n settingsLabs]; if (sectionLabs.hasAnyRows) { @@ -1471,6 +1475,22 @@ TableViewSectionsDelegate> return [footerText copy]; } +- (UITableViewCell *)buildMessageBubblesCellForTableView: +(UITableView*)tableView + atIndexPath:(NSIndexPath*)indexPath +{ + MXKTableViewCellWithLabelAndSwitch* labelAndSwitchCell = [self getLabelAndSwitchCell:tableView forIndexPath:indexPath]; + + labelAndSwitchCell.mxkLabel.text = [VectorL10n settingsEnableRoomMessageBubbles]; + + labelAndSwitchCell.mxkSwitch.on = RiotSettings.shared.roomScreenEnableMessageBubbles; + labelAndSwitchCell.mxkSwitch.onTintColor = ThemeService.shared.theme.tintColor; + labelAndSwitchCell.mxkSwitch.enabled = YES; + [labelAndSwitchCell.mxkSwitch addTarget:self action:@selector(toggleEnableRoomMessageBubbles:) forControlEvents:UIControlEventTouchUpInside]; + + return labelAndSwitchCell; +} + #pragma mark - 3Pid Add - (void)showAuthenticationIfNeededForAdding:(MX3PIDMedium)medium withSession:(MXSession*)session completion:(void (^)(NSDictionary* authParams))completion @@ -2208,16 +2228,7 @@ TableViewSectionsDelegate> } else if (row == USER_INTERFACE_TIMELINE_STYLE_INDEX) { - MXKTableViewCellWithLabelAndSwitch* labelAndSwitchCell = [self getLabelAndSwitchCell:tableView forIndexPath:indexPath]; - - labelAndSwitchCell.mxkLabel.text = [VectorL10n settingsEnableRoomMessageBubbles]; - - labelAndSwitchCell.mxkSwitch.on = RiotSettings.shared.roomScreenEnableMessageBubbles; - labelAndSwitchCell.mxkSwitch.onTintColor = ThemeService.shared.theme.tintColor; - labelAndSwitchCell.mxkSwitch.enabled = YES; - [labelAndSwitchCell.mxkSwitch addTarget:self action:@selector(toggleEnableRoomMessageBubbles:) forControlEvents:UIControlEventTouchUpInside]; - - cell = labelAndSwitchCell; + cell = [self buildMessageBubblesCellForTableView:tableView atIndexPath:indexPath]; } } else if (section == SECTION_TAG_IGNORED_USERS) @@ -2448,6 +2459,10 @@ TableViewSectionsDelegate> cell = labelAndSwitchCell; } + else if (row == LABS_ENABLE_MESSAGE_BUBBLES_INDEX) + { + cell = [self buildMessageBubblesCellForTableView:tableView atIndexPath:indexPath]; + } } else if (section == SECTION_TAG_FLAIR) { From 789db037cbcbacb3a8e1c39892759f881ff642cb Mon Sep 17 00:00:00 2001 From: SBiOSoftWhare Date: Thu, 10 Feb 2022 15:08:24 +0100 Subject: [PATCH 2/2] SettingsViewController: Fix indent issue. --- Riot/Modules/Settings/SettingsViewController.m | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Riot/Modules/Settings/SettingsViewController.m b/Riot/Modules/Settings/SettingsViewController.m index bab34cb22..c9c738f66 100644 --- a/Riot/Modules/Settings/SettingsViewController.m +++ b/Riot/Modules/Settings/SettingsViewController.m @@ -1475,9 +1475,8 @@ TableViewSectionsDelegate> return [footerText copy]; } -- (UITableViewCell *)buildMessageBubblesCellForTableView: -(UITableView*)tableView - atIndexPath:(NSIndexPath*)indexPath +- (UITableViewCell *)buildMessageBubblesCellForTableView:(UITableView*)tableView + atIndexPath:(NSIndexPath*)indexPath { MXKTableViewCellWithLabelAndSwitch* labelAndSwitchCell = [self getLabelAndSwitchCell:tableView forIndexPath:indexPath];