Add a feature flag for automatic back pagination. (#5445)

This commit is contained in:
Doug
2026-04-20 17:47:26 +01:00
committed by GitHub
parent 915007850e
commit d9013208dd
4 changed files with 16 additions and 0 deletions
@@ -80,6 +80,7 @@ final class AppSettings {
case focusEventOnNotificationTap case focusEventOnNotificationTap
case linkNewDeviceEnabled case linkNewDeviceEnabled
case liveLocationSharingEnabled case liveLocationSharingEnabled
case automaticBackPaginationEnabled
// Doug's tweaks 🔧 // Doug's tweaks 🔧
case hideUnreadMessagesBadge case hideUnreadMessagesBadge
@@ -447,6 +448,9 @@ final class AppSettings {
let verifyWithClassicEnabled = appBuildType != .release let verifyWithClassicEnabled = appBuildType != .release
@UserPreference(key: UserDefaultsKeys.automaticBackPaginationEnabled, defaultValue: false, storageType: .userDefaults(store))
var automaticBackPaginationEnabled
@UserPreference(key: UserDefaultsKeys.developerOptionsEnabled, defaultValue: appBuildType == .debug, storageType: .userDefaults(store)) @UserPreference(key: UserDefaultsKeys.developerOptionsEnabled, defaultValue: appBuildType == .debug, storageType: .userDefaults(store))
var developerOptionsEnabled var developerOptionsEnabled
} }
@@ -55,6 +55,7 @@ protocol DeveloperOptionsProtocol: AnyObject {
var enableKeyShareOnInvite: Bool { get set } var enableKeyShareOnInvite: Bool { get set }
var hideQuietNotificationAlerts: Bool { get set } var hideQuietNotificationAlerts: Bool { get set }
var focusEventOnNotificationTap: Bool { get set } var focusEventOnNotificationTap: Bool { get set }
var automaticBackPaginationEnabled: Bool { get set }
var hideUnreadMessagesBadge: Bool { get set } var hideUnreadMessagesBadge: Bool { get set }
var elementCallBaseURLOverride: URL? { get set } var elementCallBaseURLOverride: URL? { get set }
@@ -67,6 +67,11 @@ struct DeveloperOptionsScreen: View {
Toggle(isOn: $context.lowPriorityFilterEnabled) { Toggle(isOn: $context.lowPriorityFilterEnabled) {
Text("Low priority filter") Text("Low priority filter")
} }
Toggle(isOn: $context.automaticBackPaginationEnabled) {
Text("Automatic back pagination")
Text("Requires app reboot")
}
} }
Section("Room") { Section("Room") {
@@ -135,6 +140,7 @@ struct DeveloperOptionsScreen: View {
Text("Hide quiet alerts") Text("Hide quiet alerts")
Text("The badge count will still be updated") Text("The badge count will still be updated")
} }
Toggle(isOn: $context.focusEventOnNotificationTap) { Toggle(isOn: $context.focusEventOnNotificationTap) {
Text("Focus event on notification tap") Text("Focus event on notification tap")
} }
@@ -201,6 +201,11 @@ class ClientProxy: ClientProxyProtocol {
self.appSettings = appSettings self.appSettings = appSettings
self.analyticsService = analyticsService self.analyticsService = analyticsService
if appSettings.automaticBackPaginationEnabled {
// Must be called before creating the sync service, timelines etc.
client.enableAutomaticBackpagination()
}
clientQueue = .init(label: "ClientProxyQueue", attributes: .concurrent) clientQueue = .init(label: "ClientProxyQueue", attributes: .concurrent)
mediaLoader = MediaLoader(client: client) mediaLoader = MediaLoader(client: client)