Replace AppSettings with UserSettings from the UserSessionFlow and below.

Remove some redundant injections when passed alongside a user session too.

# Conflicts:
#	ElementX/Sources/Screens/PinnedEventsTimelineScreen/View/PinnedEventsTimelineScreen.swift
#	ElementX/Sources/Screens/Timeline/TimelineViewModel.swift
This commit is contained in:
Doug
2026-09-25 13:51:33 +01:00
committed by Stefan Ceriu
parent 54cc1cba60
commit fccad5fc30
117 changed files with 554 additions and 594 deletions
@@ -29,7 +29,7 @@ nonisolated struct NotificationToneManager: NotificationToneManagerProtocol {
case bufferCreationFailed
}
private let appSettings: AppSettings
private let userSettings: UserSettings
/// The default Element X bundled message tone.
static let defaultElementXMessageTone: NotificationTone = .createBundledSound(label: L10n.screenNotificationSettingsSoundElementDefault,
@@ -45,8 +45,8 @@ nonisolated struct NotificationToneManager: NotificationToneManagerProtocol {
nonisolated static let libraryLocation = URL.libraryDirectory.appending(components: "Sounds", "AvailableSounds", directoryHint: .isDirectory)
/// Creates the manager and ensures required library directories exist.
init(appSettings: AppSettings) {
self.appSettings = appSettings
init(userSettings: UserSettings) {
self.userSettings = userSettings
do {
try FileManager.default.createDirectory(at: NotificationToneManager.libraryLocation, withIntermediateDirectories: true)
@@ -67,12 +67,12 @@ nonisolated struct NotificationToneManager: NotificationToneManagerProtocol {
try? FileManager.default.removeItem(at: Self.selectedToneLocation)
let toneLocation = Self.toneLocation(for: alertTone)
try FileManager.default.copyItem(at: toneLocation, to: Self.selectedToneLocation)
appSettings.selectedNotificationTone = alertTone
userSettings.selectedNotificationTone = alertTone
return Self.selectedToneLocation
} catch {
if (try? Self.selectedToneLocation.checkResourceIsReachable()) != true {
// make sure the selected tone is reset if there's no custom tone present
appSettings.selectedNotificationTone = nil
userSettings.selectedNotificationTone = nil
}
throw error
}
@@ -81,7 +81,7 @@ nonisolated struct ClientFactory: ClientFactoryProtocol {
func makeNSEClient(credentials: KeychainCredentials,
roomID: String,
clientSessionDelegate: ClientSessionDelegate,
appSettings: CommonSettingsProtocol,
userSettings: CommonSettingsProtocol,
appHooks: AppHooks) async throws -> ClientProtocol {
let homeserverURL = credentials.restorationToken.session.homeserverUrl
@@ -90,10 +90,10 @@ nonisolated struct ClientFactory: ClientFactoryProtocol {
discoverSlidingSync: false,
sessionDelegate: clientSessionDelegate,
appHooks: appHooks,
enableOnlySignedDeviceIsolationMode: appSettings.enableOnlySignedDeviceIsolationMode,
enableOnlySignedDeviceIsolationMode: userSettings.enableOnlySignedDeviceIsolationMode,
requestTimeout: 15000,
maxRequestRetryTime: 5000,
threadsEnabled: appSettings.threadsEnabled)
threadsEnabled: userSettings.threadsEnabled)
.systemIsMemoryConstrained()
.sqliteStore(config: .init(dataPath: credentials.restorationToken.sessionDirectories.dataPath,
cachePath: credentials.restorationToken.sessionDirectories.cachePath)
@@ -36,6 +36,6 @@ nonisolated protocol ClientFactoryProtocol {
func makeNSEClient(credentials: KeychainCredentials,
roomID: String,
clientSessionDelegate: ClientSessionDelegate,
appSettings: CommonSettingsProtocol,
userSettings: CommonSettingsProtocol,
appHooks: AppHooks) async throws -> ClientProtocol
}
@@ -17,7 +17,7 @@ import OrderedCollections
class ClientProxy: ClientProxyProtocol {
private let client: ClientProtocol
private let networkMonitor: NetworkMonitorProtocol
private let appSettings: AppSettings
private let userSettings: UserSettings
private let analyticsService: AnalyticsServiceProtocol
let mediaLoader: MediaLoaderProtocol
@@ -206,11 +206,11 @@ class ClientProxy: ClientProxyProtocol {
init(client: ClientProtocol,
networkMonitor: NetworkMonitorProtocol,
appSettings: AppSettings,
userSettings: UserSettings,
analyticsService: AnalyticsServiceProtocol) async throws {
self.client = client
self.networkMonitor = networkMonitor
self.appSettings = appSettings
self.userSettings = userSettings
self.analyticsService = analyticsService
userProfileSubject = .init(UserProfile(userID: (try? client.userId()) ?? ""))
@@ -219,7 +219,7 @@ class ClientProxy: ClientProxyProtocol {
// Route media downloads through a content scanner when one has been configured for the server,
// and expose a proxy for the active scanning of content in the timeline.
if let contentScannerURL = appSettings.contentScannerURL.publisher.value, let client = client as? Client {
if let contentScannerURL = userSettings.contentScannerURL.publisher.value, let client = client as? Client {
let scanner = ContentScanner(scannerUrl: contentScannerURL.absoluteString)
await client.setContentScanner(contentScanner: scanner)
contentScanner = ContentScannerProxy(contentScanner: scanner, client: client)
@@ -244,7 +244,7 @@ class ClientProxy: ClientProxyProtocol {
let configuredAppService = try await ClientProxyServices(client: client,
notificationSettings: notificationSettings,
appSettings: appSettings)
userSettings: userSettings)
syncService = configuredAppService.syncService
roomListService = configuredAppService.roomListService
@@ -495,7 +495,7 @@ class ClientProxy: ClientProxyProtocol {
do {
let parameters = CreateRoomParameters(name: nil,
topic: nil,
isEncrypted: !appSettings.forceDisableE2EE.publisher.value,
isEncrypted: !userSettings.forceDisableE2EE.publisher.value,
isDirect: true,
visibility: .private,
preset: .trustedPrivateChat,
@@ -538,7 +538,7 @@ class ClientProxy: ClientProxyProtocol {
let parameters = CreateRoomParameters(name: name,
topic: topic,
isEncrypted: !appSettings.forceDisableE2EE.publisher.value && accessType.isEncrypted,
isEncrypted: !userSettings.forceDisableE2EE.publisher.value && accessType.isEncrypted,
isDirect: false,
visibility: accessType.visibility,
preset: accessType.preset,
@@ -1158,7 +1158,7 @@ class ClientProxy: ClientProxyProtocol {
private func reconcileServiceState() async {
switch desiredServiceState {
case .running(let offline):
if appSettings.clientPausingAndResumingEnabled {
if userSettings.clientPausingAndResumingEnabled {
do {
MXLog.info("Resuming client")
try await client.resume()
@@ -1192,7 +1192,7 @@ class ClientProxy: ClientProxyProtocol {
await syncService.stop()
MXLog.info("Sync stopped")
if appSettings.clientPausingAndResumingEnabled {
if userSettings.clientPausingAndResumingEnabled {
do {
MXLog.info("Pausing client")
try await client.pause()
@@ -1375,7 +1375,7 @@ class ClientProxy: ClientProxyProtocol {
case .joined:
let roomProxy = try await JoinedRoomProxy(roomListService: roomListService,
room: room,
appSettings: appSettings,
userSettings: userSettings,
analyticsService: analyticsService,
eventStringBuilder: eventStringBuilder)
@@ -1531,7 +1531,7 @@ private struct ClientProxyServices {
init(client: ClientProtocol,
notificationSettings: NotificationSettingsProxyProtocol,
appSettings: AppSettings) async throws {
userSettings: UserSettings) async throws {
let syncService = try await client
.syncService()
.withOfflineMode()
@@ -1553,21 +1553,21 @@ private struct ClientProxyServices {
name: "AllRooms",
shouldUpdateVisibleRange: true,
notificationSettings: notificationSettings,
appSettings: appSettings)
userSettings: userSettings)
try await roomSummaryProvider.setRoomList(roomListService.allRooms())
alternateRoomSummaryProvider = RoomSummaryProvider(roomListService: roomListService,
eventStringBuilder: eventStringBuilder,
name: "AlternateAllRooms",
notificationSettings: notificationSettings,
appSettings: appSettings)
userSettings: userSettings)
staticRoomSummaryProvider = RoomSummaryProvider(roomListService: roomListService,
eventStringBuilder: eventStringBuilder,
name: "StaticAllRooms",
roomListPageSize: .max,
notificationSettings: notificationSettings,
appSettings: appSettings)
userSettings: userSettings)
// Setting a provider's room list will create summaries for every room so
// wait until the app is fully running for the alternate and static providers.
@@ -12,13 +12,13 @@ import Foundation
class EmojiProvider: EmojiProviderProtocol {
private let maxFrequentEmojis = 20
private let loader: EmojiLoaderProtocol
private let appSettings: AppSettings
private let userSettings: UserSettings
private(set) var state: EmojiProviderState = .notLoaded
init(loader: EmojiLoaderProtocol = EmojibaseDatasource(), appSettings: AppSettings) {
init(loader: EmojiLoaderProtocol = EmojibaseDatasource(), userSettings: UserSettings) {
self.loader = loader
self.appSettings = appSettings
self.userSettings = userSettings
Task {
await loadIfNeeded()
@@ -61,7 +61,7 @@ class EmojiProvider: EmojiProviderProtocol {
return []
}
return appSettings.frequentlyUsedSystemEmojis.map(\.key)
return userSettings.frequentlyUsedSystemEmojis.map(\.key)
}
func markEmojiAsFrequentlyUsed(_ emoji: String) {
@@ -70,9 +70,9 @@ class EmojiProvider: EmojiProviderProtocol {
}
let frequentlyUsed = if !frequentlyUsedSystemEmojis().contains(emoji) {
appSettings.frequentlyUsedSystemEmojis + [.init(count: 0, key: emoji)]
userSettings.frequentlyUsedSystemEmojis + [.init(count: 0, key: emoji)]
} else {
appSettings.frequentlyUsedSystemEmojis.map { frequentlyUsedEmoji in
userSettings.frequentlyUsedSystemEmojis.map { frequentlyUsedEmoji in
if frequentlyUsedEmoji.key == emoji {
return FrequentlyUsedEmoji(count: frequentlyUsedEmoji.count + 1, key: emoji)
}
@@ -81,7 +81,7 @@ class EmojiProvider: EmojiProviderProtocol {
}
}
appSettings.frequentlyUsedSystemEmojis = frequentlyUsed.sorted { $0.count > $1.count }
userSettings.frequentlyUsedSystemEmojis = frequentlyUsed.sorted { $0.count > $1.count }
}
// MARK: - Private
@@ -11,7 +11,7 @@ import CoreLocation
class LiveLocationManager: NSObject, LiveLocationManagerProtocol, CLLocationManagerDelegate {
private let clientProxy: ClientProxyProtocol
private let locationManager: CLLocationManagerProtocol
private let appSettings: AppSettings
private let userSettings: UserSettings
private let authorizationStatusSubject: CurrentValueSubject<CLAuthorizationStatus, Never>
var authorizationStatus: CurrentValuePublisher<CLAuthorizationStatus, Never> {
@@ -42,10 +42,10 @@ class LiveLocationManager: NSObject, LiveLocationManagerProtocol, CLLocationMana
private var lastLocation: CLLocationCoordinate2D?
init(clientProxy: ClientProxyProtocol,
appSettings: AppSettings,
userSettings: UserSettings,
locationManager: @autoclosure @MainActor () -> CLLocationManagerProtocol = CLLocationManager()) {
self.clientProxy = clientProxy
self.appSettings = appSettings
self.userSettings = userSettings
// Very important, the CLLocationManager needs to be initialised on the main thread
// or the delegate functions won't be handled!
// https://developer.apple.com/documentation/corelocation/cllocationmanagerdelegate
@@ -64,7 +64,7 @@ class LiveLocationManager: NSObject, LiveLocationManagerProtocol, CLLocationMana
// https://developer.apple.com/documentation/corelocation/cllocationmanager/pauseslocationupdatesautomatically
self.locationManager.pausesLocationUpdatesAutomatically = false
setupMinimumDistanceUpdatesAndAccuracy(minimumDistance: appSettings.liveLocationMinimumDistanceUpdate)
setupMinimumDistanceUpdatesAndAccuracy(minimumDistance: userSettings.liveLocationMinimumDistanceUpdate)
setupSubscriptions()
}
@@ -72,8 +72,8 @@ class LiveLocationManager: NSObject, LiveLocationManagerProtocol, CLLocationMana
@discardableResult
func requestAlwaysAuthorizationIfPossible() -> Bool {
guard !appSettings.hasRequestedLocationAlwaysLocationAuthorization else { return false }
appSettings.hasRequestedLocationAlwaysLocationAuthorization = true
guard !userSettings.hasRequestedLocationAlwaysLocationAuthorization else { return false }
userSettings.hasRequestedLocationAlwaysLocationAuthorization = true
locationManager.requestAlwaysAuthorization()
return true
}
@@ -81,7 +81,7 @@ class LiveLocationManager: NSObject, LiveLocationManagerProtocol, CLLocationMana
func startLiveLocation(roomID: String, duration: Duration) async -> Result<Void, LiveLocationManagerError> {
// Stop any existing session for this room first
var didAlreadyStopLocalSession = false
if appSettings.liveLocationSharingSessionsByRoomID[roomID] != nil
if userSettings.liveLocationSharingSessionsByRoomID[roomID] != nil
|| startingLiveLocationSharingSessionsByRoomID[roomID] != nil {
await stopLiveLocation(roomID: roomID)
didAlreadyStopLocalSession = true
@@ -114,7 +114,7 @@ class LiveLocationManager: NSObject, LiveLocationManagerProtocol, CLLocationMana
var roomProxy: JoinedRoomProxyProtocol?
let cachedRoomProxy = activeRoomProxies[roomID]
startingLiveLocationSharingSessionsByRoomID.removeValue(forKey: roomID)
appSettings.liveLocationSharingSessionsByRoomID.removeValue(forKey: roomID)
userSettings.liveLocationSharingSessionsByRoomID.removeValue(forKey: roomID)
if let cachedRoomProxy {
roomProxy = cachedRoomProxy
@@ -137,7 +137,7 @@ class LiveLocationManager: NSObject, LiveLocationManagerProtocol, CLLocationMana
// If the system resets authorization to notDetermined (e.g. after app reinstall or
// settings reset), clear the flag so we can request again.
if manager.authorizationStatus == .notDetermined {
appSettings.hasRequestedLocationAlwaysLocationAuthorization = false
userSettings.hasRequestedLocationAlwaysLocationAuthorization = false
}
// If authorization was revoked, stop all active sessions.
@@ -146,7 +146,7 @@ class LiveLocationManager: NSObject, LiveLocationManagerProtocol, CLLocationMana
}
// Accuracy authorization may have changed, reapply new accuracy settings.
setupMinimumDistanceUpdatesAndAccuracy(minimumDistance: appSettings.liveLocationMinimumDistanceUpdate)
setupMinimumDistanceUpdatesAndAccuracy(minimumDistance: userSettings.liveLocationMinimumDistanceUpdate)
authorizationStatusSubject.send(manager.authorizationStatus)
}
@@ -183,7 +183,7 @@ class LiveLocationManager: NSObject, LiveLocationManagerProtocol, CLLocationMana
}
.store(in: &cancellables)
appSettings.liveLocationSharingSessionsByRoomIDPublisher
userSettings.liveLocationSharingSessionsByRoomIDPublisher
.removeDuplicates()
.sink { [weak self] sessions in
guard let self else { return }
@@ -197,7 +197,7 @@ class LiveLocationManager: NSObject, LiveLocationManagerProtocol, CLLocationMana
}
.store(in: &cancellables)
appSettings.liveLocationMinimumDistanceUpdatePublisher
userSettings.liveLocationMinimumDistanceUpdatePublisher
.removeDuplicates()
.debounce(for: .seconds(1), scheduler: DispatchQueue.main)
.sink { [weak self] newValue in
@@ -210,7 +210,7 @@ class LiveLocationManager: NSObject, LiveLocationManagerProtocol, CLLocationMana
// A new beaconInfo has been received in a room with existing active session.
// This is either a new start or a new stop from a different device, so we
// should remove the session from the current local one.
appSettings.liveLocationSharingSessionsByRoomID.removeValue(forKey: update.roomID)
userSettings.liveLocationSharingSessionsByRoomID.removeValue(forKey: update.roomID)
// Instead if we receive a new isLiveUpdate
guard update.isLive else { return }
@@ -224,7 +224,7 @@ class LiveLocationManager: NSObject, LiveLocationManagerProtocol, CLLocationMana
// This means the server has echoed the start of the session and we can safely promote it
// to a started session and start sending live locations.
startingLiveLocationSharingSessionsByRoomID.removeValue(forKey: update.roomID)
appSettings.liveLocationSharingSessionsByRoomID[update.roomID] = session
userSettings.liveLocationSharingSessionsByRoomID[update.roomID] = session
if isUpdatingLocation, let lastLocation {
locationUpdateSubject.send(lastLocation)
@@ -281,7 +281,7 @@ class LiveLocationManager: NSObject, LiveLocationManagerProtocol, CLLocationMana
/// discarding any intermediate updates while always keeping the last one.
private func processLocationUpdateIfNeeded() {
guard !isProcessingLocationUpdate, let location = latestPendingLocation else { return }
guard !appSettings.liveLocationSharingSessionsByRoomID.isEmpty else { return }
guard !userSettings.liveLocationSharingSessionsByRoomID.isEmpty else { return }
latestPendingLocation = nil
isProcessingLocationUpdate = true
@@ -306,7 +306,7 @@ class LiveLocationManager: NSObject, LiveLocationManagerProtocol, CLLocationMana
}
private func sendLocationToActiveRooms(_ coordinate: CLLocationCoordinate2D) async {
let sessions = appSettings.liveLocationSharingSessionsByRoomID
let sessions = userSettings.liveLocationSharingSessionsByRoomID
let geoURI = GeoURI(coordinate: coordinate, uncertainty: nil)
for (roomID, session) in sessions {
@@ -351,7 +351,7 @@ class LiveLocationManager: NSObject, LiveLocationManagerProtocol, CLLocationMana
}
private func stopAllSessions() {
let roomIDs = Array(Set(appSettings.liveLocationSharingSessionsByRoomID.keys)
let roomIDs = Array(Set(userSettings.liveLocationSharingSessionsByRoomID.keys)
.union(startingLiveLocationSharingSessionsByRoomID.keys))
Task { [weak self] in
guard let self else { return }
@@ -86,7 +86,7 @@ private struct VideoProcessingInfo {
}
struct MediaUploadingPreprocessor {
let appSettings: AppSettings
let userSettings: UserSettings
enum Constants {
static let maximumThumbnailSize = CGSize(width: 800, height: 600)
@@ -171,7 +171,7 @@ struct MediaUploadingPreprocessor {
try stripLocationFromImage(at: url, type: type)
var mimeType = mimeType
if appSettings.optimizeMediaUploads, !type.conforms(to: .gif) {
if userSettings.optimizeMediaUploads, !type.conforms(to: .gif) {
let outputType = type.conforms(to: .png) ? UTType.png : .jpeg
mimeType = outputType.preferredMIMEType ?? "application/octet-stream"
try resizeImage(at: url, maxPixelSize: Constants.optimizedMaxPixelSize, destination: url, type: outputType)
@@ -439,7 +439,7 @@ struct MediaUploadingPreprocessor {
/// - Returns: the URL for the resulting video and its media info as a `VideoProcessingResult`
private func convertVideoToMP4(_ url: URL, targetFileSize: UInt) async throws(MediaUploadingPreprocessorError) -> VideoProcessingInfo {
let asset = AVURLAsset(url: url)
let presetName = appSettings.optimizeMediaUploads ? AVAssetExportPreset1280x720 : AVAssetExportPreset1920x1080
let presetName = userSettings.optimizeMediaUploads ? AVAssetExportPreset1280x720 : AVAssetExportPreset1920x1080
guard let exportSession = AVAssetExportSession(asset: asset, presetName: presetName) else {
throw .failedConvertingVideo
@@ -11,7 +11,7 @@ import UIKit
final class PresenceService {
private let clientProxy: ClientProxyProtocol
private let appSettings: AppSettings
private let userSettings: UserSettings
private let notificationCenter: NotificationCenter
private var isForegroundActive: Bool
@@ -22,11 +22,11 @@ final class PresenceService {
private var cancellables = Set<AnyCancellable>()
init(clientProxy: ClientProxyProtocol,
appSettings: AppSettings,
userSettings: UserSettings,
notificationCenter: NotificationCenter = .default,
initialApplicationState: UIApplication.State = UIApplication.shared.applicationState) {
self.clientProxy = clientProxy
self.appSettings = appSettings
self.userSettings = userSettings
self.notificationCenter = notificationCenter
isForegroundActive = initialApplicationState == .active
@@ -41,7 +41,7 @@ final class PresenceService {
}
private var desiredPresence: ClientProxyPresence {
switch (isForegroundActive, appSettings.sharePresence) {
switch (isForegroundActive, userSettings.sharePresence) {
case (true, true):
.online
case (true, false):
@@ -68,7 +68,7 @@ final class PresenceService {
}
private func observeSharePresence() {
appSettings.sharePresencePublisher
userSettings.sharePresencePublisher
.removeDuplicates()
.sink { [weak self] _ in
self?.reportCurrentState()
@@ -14,7 +14,7 @@ import UIKit
class JoinedRoomProxy: JoinedRoomProxyProtocol {
private let roomListService: RoomListServiceProtocol
private let room: RoomProtocol
private let appSettings: AppSettings
private let userSettings: UserSettings
private let analyticsService: AnalyticsServiceProtocol
private let eventStringBuilder: RoomEventStringBuilder
@@ -71,19 +71,19 @@ class JoinedRoomProxy: JoinedRoomProxyProtocol {
init(roomListService: RoomListServiceProtocol,
room: RoomProtocol,
appSettings: AppSettings,
userSettings: UserSettings,
analyticsService: AnalyticsServiceProtocol,
eventStringBuilder: RoomEventStringBuilder) async throws {
self.roomListService = roomListService
self.room = room
self.appSettings = appSettings
self.userSettings = userSettings
self.analyticsService = analyticsService
self.eventStringBuilder = eventStringBuilder
infoSubject = try await .init(RoomInfoProxy(roomInfo: room.roomInfo()))
let openRoomSpan = analyticsService.signpost.addSpan(.timelineLoad, toTransaction: .openRoom)
timeline = try await TimelineProxy(timeline: room.timelineWithConfiguration(configuration: .init(focus: .live(hideThreadedEvents: appSettings.threadsEnabled),
timeline = try await TimelineProxy(timeline: room.timelineWithConfiguration(configuration: .init(focus: .live(hideThreadedEvents: userSettings.threadsEnabled),
filter: .eventFilter(filter: Self.excludedEventsFilter),
internalIdPrefix: nil,
dateDividerMode: .daily,
@@ -150,7 +150,7 @@ class JoinedRoomProxy: JoinedRoomProxyProtocol {
let openRoomSpan = analyticsService.signpost.addSpan(.timelineLoad, toTransaction: .notificationToMessage)
let sdkTimeline = try await room.timelineWithConfiguration(configuration: .init(focus: .event(eventId: eventID,
numContextEvents: numberOfEvents,
threadMode: .automatic(hideThreadedEvents: appSettings.threadsEnabled)),
threadMode: .automatic(hideThreadedEvents: userSettings.threadsEnabled)),
filter: .all,
internalIdPrefix: UUID().uuidString,
dateDividerMode: .daily,
@@ -16,7 +16,7 @@ class RoomSummaryProvider: RoomSummaryProviderProtocol {
private let name: String
private let shouldUpdateVisibleRange: Bool
private let notificationSettings: NotificationSettingsProxyProtocol
private let appSettings: AppSettings
private let userSettings: UserSettings
private let roomListPageSize: UInt32
/// Remember how many rooms we had on the previous requests so we can deduplicate
@@ -68,13 +68,13 @@ class RoomSummaryProvider: RoomSummaryProviderProtocol {
shouldUpdateVisibleRange: Bool = false,
roomListPageSize: UInt32 = 100,
notificationSettings: NotificationSettingsProxyProtocol,
appSettings: AppSettings) {
userSettings: UserSettings) {
self.roomListService = roomListService
self.eventStringBuilder = eventStringBuilder
self.name = name
self.shouldUpdateVisibleRange = shouldUpdateVisibleRange
self.notificationSettings = notificationSettings
self.appSettings = appSettings
self.userSettings = userSettings
self.roomListPageSize = roomListPageSize
let (diffsStream, diffsContinuation) = AsyncStream<[RoomListEntriesUpdate]>.makeStream()
@@ -161,7 +161,7 @@ class RoomSummaryProvider: RoomSummaryProviderProtocol {
rustFilters.append(.identifiers(identifiers: Array(roomIDs)))
if !filters.contains(.lowPriority), appSettings.lowPriorityFilterEnabled {
if !filters.contains(.lowPriority), userSettings.lowPriorityFilterEnabled {
rustFilters.append(.nonLowPriority)
}
@@ -169,7 +169,7 @@ class RoomSummaryProvider: RoomSummaryProviderProtocol {
case let .all(filters):
var rustFilters = filters.map(\.rustFilter) + baseFilter
if !filters.contains(.lowPriority), appSettings.lowPriorityFilterEnabled {
if !filters.contains(.lowPriority), userSettings.lowPriorityFilterEnabled {
rustFilters.append(.nonLowPriority)
}
@@ -180,7 +180,7 @@ class RoomSummaryProvider: RoomSummaryProviderProtocol {
// MARK: - Private
private func nameFilter(for query: String) -> [RoomListEntriesDynamicFilterKind] {
appSettings.fuzzyRoomListSearchEnabled ? [.fuzzyMatchRoomName(pattern: query)] : [.normalizedMatchRoomName(pattern: query)]
userSettings.fuzzyRoomListSearchEnabled ? [.fuzzyMatchRoomName(pattern: query)] : [.normalizedMatchRoomName(pattern: query)]
}
private func setupVisibleRangeObservers() {
@@ -17,7 +17,7 @@ class TimelineController: TimelineControllerProtocol {
private let liveTimelineItemProvider: TimelineItemProviderProtocol
private let timelineItemFactory: RoomTimelineItemFactoryProtocol
private let mediaProvider: MediaProviderProtocol
private let appSettings: AppSettings
private let userSettings: UserSettings
let callbacks = PassthroughSubject<TimelineControllerCallback, Never>()
@@ -51,14 +51,14 @@ class TimelineController: TimelineControllerProtocol {
initialFocussedEventID: String?,
timelineItemFactory: RoomTimelineItemFactoryProtocol,
mediaProvider: MediaProviderProtocol,
appSettings: AppSettings,
userSettings: UserSettings,
allowedGalleryItemTypes: [TimelineAllowedGalleryItemType]? = nil) {
self.allowedGalleryItemTypes = allowedGalleryItemTypes
self.roomProxy = roomProxy
liveTimelineItemProvider = timelineProxy.timelineItemProvider
self.timelineItemFactory = timelineItemFactory
self.mediaProvider = mediaProvider
self.appSettings = appSettings
self.userSettings = userSettings
activeTimeline = timelineProxy
activeTimelineItemProvider = liveTimelineItemProvider
@@ -127,7 +127,7 @@ class TimelineController: TimelineControllerProtocol {
}
func sendReadReceipt(for itemID: TimelineItemIdentifier) async {
let receiptType: MatrixRustSDK.ReceiptType = appSettings.sharePresence ? .read : .readPrivate
let receiptType: MatrixRustSDK.ReceiptType = userSettings.sharePresence ? .read : .readPrivate
guard let eventID = itemID.eventID else {
return
@@ -10,7 +10,7 @@ import Foundation
import MatrixRustSDK
struct TimelineControllerFactory: TimelineControllerFactoryProtocol {
let appSettings: AppSettings
let userSettings: UserSettings
func buildTimelineController(roomProxy: JoinedRoomProxyProtocol,
initialFocussedEventID: String?,
@@ -21,7 +21,7 @@ struct TimelineControllerFactory: TimelineControllerFactoryProtocol {
initialFocussedEventID: initialFocussedEventID,
timelineItemFactory: timelineItemFactory,
mediaProvider: mediaProvider,
appSettings: appSettings)
userSettings: userSettings)
}
func buildThreadTimelineController(threadRootEventID: String,
@@ -36,7 +36,7 @@ struct TimelineControllerFactory: TimelineControllerFactoryProtocol {
initialFocussedEventID: initialFocussedEventID,
timelineItemFactory: timelineItemFactory,
mediaProvider: mediaProvider,
appSettings: appSettings))
userSettings: userSettings))
case .failure(let error):
return .failure(.roomProxyError(error))
}
@@ -52,7 +52,7 @@ struct TimelineControllerFactory: TimelineControllerFactoryProtocol {
initialFocussedEventID: nil,
timelineItemFactory: timelineItemFactory,
mediaProvider: mediaProvider,
appSettings: appSettings))
userSettings: userSettings))
case .failure(let error):
return .failure(.roomProxyError(error))
}
@@ -71,7 +71,7 @@ struct TimelineControllerFactory: TimelineControllerFactoryProtocol {
initialFocussedEventID: nil,
timelineItemFactory: timelineItemFactory,
mediaProvider: mediaProvider,
appSettings: appSettings,
userSettings: userSettings,
allowedGalleryItemTypes: allowedMessageTypes.allowedGalleryItemTypes))
case .failure(let error):
return .failure(.roomProxyError(error))