Configure SDK to use the global/OS proxy (#2493)

This commit is contained in:
Mauro
2024-02-21 15:17:23 +01:00
committed by GitHub
parent d380c2de56
commit 9b949ce84e
10 changed files with 117 additions and 37 deletions
+10 -2
View File
@@ -31,15 +31,23 @@ final class NSEUserSession {
if credentials.restorationToken.passphrase != nil {
MXLog.info("Restoring client with encrypted store.")
}
baseClient = try ClientBuilder()
let homeserverURL = credentials.restorationToken.session.homeserverUrl
var clientBuilder = ClientBuilder()
.basePath(path: URL.sessionsBaseDirectory.path)
.username(username: credentials.userID)
.homeserverUrl(url: homeserverURL)
.passphrase(passphrase: credentials.restorationToken.passphrase)
.userAgent(userAgent: UserAgentBuilder.makeASCIIUserAgent())
.enableCrossProcessRefreshLock(processId: InfoPlistReader.main.bundleIdentifier,
sessionDelegate: clientSessionDelegate)
.build()
if let homeserverURL = URL(string: homeserverURL),
let proxy = homeserverURL.globalProxy {
clientBuilder = clientBuilder.proxy(url: proxy)
}
baseClient = try clientBuilder.build()
delegateHandle = baseClient.setDelegate(delegate: ClientDelegateWrapper())
try baseClient.restoreSession(session: credentials.restorationToken.session)