diff --git a/Config/BuildSettings.swift b/Config/BuildSettings.swift index 571809009..39de0496a 100644 --- a/Config/BuildSettings.swift +++ b/Config/BuildSettings.swift @@ -420,8 +420,4 @@ final class BuildSettings: NSObject { // MARK: - New App Layout static let newAppLayoutEnabled = true - - // MARK: - Device manager - - static let deviceManagerEnabled = false } diff --git a/Config/CommonConfiguration.swift b/Config/CommonConfiguration.swift index 6f9a7f555..d304f7fbe 100644 --- a/Config/CommonConfiguration.swift +++ b/Config/CommonConfiguration.swift @@ -89,6 +89,8 @@ class CommonConfiguration: NSObject, Configurable { sdkOptions.authEnableRefreshTokens = BuildSettings.authEnableRefreshTokens // Configure key provider delegate MXKeyProvider.sharedInstance().delegate = EncryptionKeyManager.shared + + sdkOptions.enableNewClientInformationFeature = RiotSettings.shared.enableClientInformationFeature } private func makeASCIIUserAgent() -> String? { diff --git a/Riot/Assets/en.lproj/Vector.strings b/Riot/Assets/en.lproj/Vector.strings index 380ecd5c7..6449e8fbd 100644 --- a/Riot/Assets/en.lproj/Vector.strings +++ b/Riot/Assets/en.lproj/Vector.strings @@ -762,6 +762,8 @@ Tap the + to start adding people."; "settings_labs_enable_auto_report_decryption_errors" = "Auto Report Decryption Errors"; "settings_labs_use_only_latest_user_avatar_and_name" = "Show latest avatar and name for users in message history"; "settings_labs_enable_live_location_sharing" = "Live location sharing - share current location (active development, and temporarily, locations persist in room history)"; +"settings_labs_enable_new_session_manager" = "New session manager"; +"settings_labs_enable_new_client_info_feature" = "Record the client name, version, and url to recognise sessions more easily in session manager"; "settings_labs_enable_new_app_layout" = "New Application Layout"; "settings_version" = "Version %@"; diff --git a/Riot/Generated/Strings.swift b/Riot/Generated/Strings.swift index 854994c3d..65bcd2560 100644 --- a/Riot/Generated/Strings.swift +++ b/Riot/Generated/Strings.swift @@ -7379,6 +7379,14 @@ public class VectorL10n: NSObject { public static var settingsLabsEnableNewAppLayout: String { return VectorL10n.tr("Vector", "settings_labs_enable_new_app_layout") } + /// Record the client name, version, and url to recognise sessions more easily in session manager + public static var settingsLabsEnableNewClientInfoFeature: String { + return VectorL10n.tr("Vector", "settings_labs_enable_new_client_info_feature") + } + /// New session manager + public static var settingsLabsEnableNewSessionManager: String { + return VectorL10n.tr("Vector", "settings_labs_enable_new_session_manager") + } /// Ring for group calls public static var settingsLabsEnableRingingForGroupCalls: String { return VectorL10n.tr("Vector", "settings_labs_enable_ringing_for_group_calls") diff --git a/Riot/Managers/Settings/RiotSettings.swift b/Riot/Managers/Settings/RiotSettings.swift index 7d0adfbe2..523ca86a4 100644 --- a/Riot/Managers/Settings/RiotSettings.swift +++ b/Riot/Managers/Settings/RiotSettings.swift @@ -163,7 +163,15 @@ final class RiotSettings: NSObject { NotificationCenter.default.post(name: RiotSettings.didUpdateLiveLocationSharingActivation, object: self) } } - + + /// Flag indicating if the new session manager is enabled + @UserDefault(key: "enableNewSessionManager", defaultValue: false, storage: defaults) + var enableNewSessionManager + + /// Flag indicating if the new client information feature is enabled + @UserDefault(key: "enableClientInformationFeature", defaultValue: false, storage: defaults) + var enableClientInformationFeature + // MARK: Calls /// Indicate if `allowStunServerFallback` settings has been set once. diff --git a/Riot/Modules/Settings/SettingsViewController.m b/Riot/Modules/Settings/SettingsViewController.m index 9b69c0c19..1e1ec4d9f 100644 --- a/Riot/Modules/Settings/SettingsViewController.m +++ b/Riot/Modules/Settings/SettingsViewController.m @@ -172,7 +172,9 @@ typedef NS_ENUM(NSUInteger, LABS_ENABLE) LABS_ENABLE_RINGING_FOR_GROUP_CALLS_INDEX = 0, LABS_ENABLE_THREADS_INDEX, LABS_ENABLE_AUTO_REPORT_DECRYPTION_ERRORS, - LABS_ENABLE_LIVE_LOCATION_SHARING + LABS_ENABLE_LIVE_LOCATION_SHARING, + LABS_ENABLE_NEW_SESSION_MANAGER, + LABS_ENABLE_NEW_CLIENT_INFO_FEATURE }; typedef NS_ENUM(NSUInteger, SECURITY) @@ -403,7 +405,7 @@ ChangePasswordCoordinatorBridgePresenterDelegate> Section *sectionSecurity = [Section sectionWithTag:SECTION_TAG_SECURITY]; [sectionSecurity addRowWithTag:SECURITY_BUTTON_INDEX]; - if (BuildSettings.deviceManagerEnabled) + if (RiotSettings.shared.enableNewSessionManager) { // NOTE: Add device manager entry point in the security section atm for debug purpose [sectionSecurity addRowWithTag:DEVICE_MANAGER_INDEX]; @@ -595,6 +597,8 @@ ChangePasswordCoordinatorBridgePresenterDelegate> { [sectionLabs addRowWithTag:LABS_ENABLE_LIVE_LOCATION_SHARING]; } + [sectionLabs addRowWithTag:LABS_ENABLE_NEW_SESSION_MANAGER]; + [sectionLabs addRowWithTag:LABS_ENABLE_NEW_CLIENT_INFO_FEATURE]; sectionLabs.headerTitle = [VectorL10n settingsLabs]; if (sectionLabs.hasAnyRows) { @@ -2532,6 +2536,30 @@ ChangePasswordCoordinatorBridgePresenterDelegate> { cell = [self buildLiveLocationSharingCellForTableView:tableView atIndexPath:indexPath]; } + else if (row == LABS_ENABLE_NEW_SESSION_MANAGER) + { + MXKTableViewCellWithLabelAndSwitch *labelAndSwitchCell = [self getLabelAndSwitchCell:tableView forIndexPath:indexPath]; + + labelAndSwitchCell.mxkLabel.text = [VectorL10n settingsLabsEnableNewSessionManager]; + labelAndSwitchCell.mxkSwitch.on = RiotSettings.shared.enableNewSessionManager; + labelAndSwitchCell.mxkSwitch.onTintColor = ThemeService.shared.theme.tintColor; + + [labelAndSwitchCell.mxkSwitch addTarget:self action:@selector(toggleEnableNewSessionManager:) forControlEvents:UIControlEventTouchUpInside]; + + cell = labelAndSwitchCell; + } + else if (row == LABS_ENABLE_NEW_CLIENT_INFO_FEATURE) + { + MXKTableViewCellWithLabelAndSwitch *labelAndSwitchCell = [self getLabelAndSwitchCell:tableView forIndexPath:indexPath]; + + labelAndSwitchCell.mxkLabel.text = [VectorL10n settingsLabsEnableNewClientInfoFeature]; + labelAndSwitchCell.mxkSwitch.on = RiotSettings.shared.enableClientInformationFeature; + labelAndSwitchCell.mxkSwitch.onTintColor = ThemeService.shared.theme.tintColor; + + [labelAndSwitchCell.mxkSwitch addTarget:self action:@selector(toggleEnableNewClientInfoFeature:) forControlEvents:UIControlEventTouchUpInside]; + + cell = labelAndSwitchCell; + } } else if (section == SECTION_TAG_SECURITY) { @@ -3277,6 +3305,19 @@ ChangePasswordCoordinatorBridgePresenterDelegate> [[AppDelegate theDelegate] restoreEmptyDetailsViewController]; } +- (void)toggleEnableNewSessionManager:(UISwitch *)sender +{ + RiotSettings.shared.enableNewSessionManager = sender.isOn; + [self updateSections]; +} + +- (void)toggleEnableNewClientInfoFeature:(UISwitch *)sender +{ + BOOL isEnabled = sender.isOn; + RiotSettings.shared.enableClientInformationFeature = isEnabled; + MXSDKOptions.sharedInstance.enableNewClientInformationFeature = isEnabled; +} + - (void)togglePinRoomsWithMissedNotif:(UISwitch *)sender { RiotSettings.shared.pinRoomsWithMissedNotificationsOnHome = sender.isOn; diff --git a/changelog.d/pr-6780.change b/changelog.d/pr-6780.change new file mode 100644 index 000000000..a50689634 --- /dev/null +++ b/changelog.d/pr-6780.change @@ -0,0 +1 @@ +Settings: Add labs flags for new session manager (PSG-792, PSG-799).