Use the ClientFactory pattern everywhere replacing raw ClientBuilders.

# Conflicts:
#	ElementX/Sources/Services/UserSession/UserSessionStore.swift
#	NSE/Sources/NSEUserSession.swift
This commit is contained in:
Doug
2026-08-20 11:50:18 +01:00
committed by Doug
parent 5481f35727
commit 9c65d36101
22 changed files with 571 additions and 377 deletions
+2 -2
View File
@@ -53,8 +53,8 @@ final nonisolated class AppHooks: AppHooksProtocol {
@AppHook(default: DefaultTracingHook())
var tracingHook: TracingHookProtocol
@AppHook(default: DefaultClientBuilderHook())
var clientBuilderHook: ClientBuilderHookProtocol
@AppHook(default: DefaultClientFactoryHook())
var clientFactoryHook: ClientFactoryHookProtocol
@AppHook(default: DefaultRemoteSettingsHook())
var remoteSettingsHook: RemoteSettingsHookProtocol
@@ -1,19 +0,0 @@
//
// Copyright 2025 Element Creations Ltd.
// Copyright 2024-2025 New Vector Ltd.
//
// SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial.
// Please see LICENSE files in the repository root for full details.
//
import MatrixRustSDK
nonisolated protocol ClientBuilderHookProtocol: Sendable {
func configure(_ builder: ClientBuilder) -> ClientBuilder
}
nonisolated struct DefaultClientBuilderHook: ClientBuilderHookProtocol {
func configure(_ builder: ClientBuilder) -> ClientBuilder {
builder
}
}
@@ -0,0 +1,25 @@
//
// Copyright 2025 Element Creations Ltd.
// Copyright 2024-2025 New Vector Ltd.
//
// SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial.
// Please see LICENSE files in the repository root for full details.
//
import MatrixRustSDK
nonisolated protocol ClientFactoryHookProtocol: Sendable {
func configure(_ builder: ClientBuilder, toRestore session: Session?) -> ClientBuilder
func updateAuthenticationClient(_ client: ClientProtocol) -> ClientProtocol
}
nonisolated struct DefaultClientFactoryHook: ClientFactoryHookProtocol {
func configure(_ builder: ClientBuilder, toRestore session: Session?) -> ClientBuilder {
builder
}
func updateAuthenticationClient(_ client: ClientProtocol) -> ClientProtocol {
client
}
}