crypto: Add configuration flag to enable invisible crypto (#3247)

This commit is contained in:
Valere
2024-09-18 17:30:45 +02:00
committed by GitHub
parent 5acfb5dd87
commit f7d878bac6
10 changed files with 44 additions and 27 deletions
@@ -32,7 +32,7 @@ import UserNotifications
// We keep a global `environment` singleton to ensure that our app context,
// database, logging, etc. are only ever setup once per *process*
private let settings: NSESettingsProtocol = AppSettings()
private let settings: CommonSettingsProtocol = AppSettings()
private let notificationContentBuilder = NotificationContentBuilder(messageEventStringBuilder: RoomMessageEventStringBuilder(attributedStringBuilder: AttributedStringBuilder(mentionBuilder: PlainMentionBuilder()), prefix: .none))
private let keychainController = KeychainController(service: .sessions,
accessGroup: InfoPlistReader.main.keychainAccessGroupIdentifier)
@@ -81,7 +81,8 @@ class NotificationServiceExtension: UNNotificationServiceExtension {
do {
Self.userSession = try await NSEUserSession(credentials: credentials,
clientSessionDelegate: keychainController,
appHooks: appHooks)
appHooks: appHooks,
appSettings: settings)
} catch {
MXLog.error("Failed creating user session with error: \(error)")
}
@@ -1,14 +0,0 @@
//
// Copyright 2023, 2024 New Vector Ltd.
//
// SPDX-License-Identifier: AGPL-3.0-only
// Please see LICENSE in the repository root for full details.
//
import Foundation
protocol NSESettingsProtocol {
var logLevel: TracingConfiguration.LogLevel { get }
}
extension AppSettings: NSESettingsProtocol { }
+3 -2
View File
@@ -19,7 +19,7 @@ final class NSEUserSession {
networkMonitor: nil)
private let delegateHandle: TaskHandle?
init(credentials: KeychainCredentials, clientSessionDelegate: ClientSessionDelegate, appHooks: AppHooks) async throws {
init(credentials: KeychainCredentials, clientSessionDelegate: ClientSessionDelegate, appHooks: AppHooks, appSettings: CommonSettingsProtocol) async throws {
sessionDirectories = credentials.restorationToken.sessionDirectories
userID = credentials.userID
@@ -33,7 +33,8 @@ final class NSEUserSession {
httpProxy: URL(string: homeserverURL)?.globalProxy,
slidingSync: .restored,
sessionDelegate: clientSessionDelegate,
appHooks: appHooks)
appHooks: appHooks,
invisibleCryptoEnabled: appSettings.invisibleCryptoEnabled)
.sessionPaths(dataPath: credentials.restorationToken.sessionDirectories.dataPath,
cachePath: credentials.restorationToken.sessionDirectories.cachePath)
.username(username: credentials.userID)