mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-02 20:39:24 +00:00
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:
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user