Refactor Rageshake URL and Target configuration. (#4337)

* Move the rageshakeURL configuration from the BugReportService to AppSettings.

* Refactor Target to return a handle when configuring.

This helps with reconfiguration and removes the @MainActor constraint.
This commit is contained in:
Doug
2025-07-22 10:19:26 +01:00
committed by GitHub
parent 2a24b11c15
commit f65b191c8a
17 changed files with 241 additions and 179 deletions

View File

@@ -28,12 +28,13 @@ import UserNotifications
// notification.
class NotificationServiceExtension: UNNotificationServiceExtension {
private static var targetConfiguration: Target.Configuration?
private var notificationHandler: NotificationHandler?
private let appHooks = AppHooks()
private let settings: CommonSettingsProtocol = AppSettings()
private let keychainController = KeychainController(service: .sessions,
accessGroup: InfoPlistReader.main.keychainAccessGroupIdentifier)
@@ -44,6 +45,14 @@ class NotificationServiceExtension: UNNotificationServiceExtension {
MXLog.info("\(tag) deinit")
}
override init() {
if Self.targetConfiguration == nil {
Self.targetConfiguration = Target.nse.configure(logLevel: settings.logLevel,
traceLogPacks: settings.traceLogPacks,
sentryURL: nil)
}
}
override func didReceive(_ request: UNNotificationRequest,
withContentHandler contentHandler: @escaping (UNNotificationContent) -> Void) {
guard !DataProtectionManager.isDeviceLockedAfterReboot(containerURL: URL.appGroupContainerDirectory),
@@ -63,17 +72,13 @@ class NotificationServiceExtension: UNNotificationServiceExtension {
return contentHandler(request.content)
}
MXLog.info("\(tag) #########################################")
ExtensionLogger.logMemory(with: tag)
MXLog.info("\(tag) Received payload: \(request.content.userInfo)")
Task {
await Target.nse.configure(logLevel: settings.logLevel,
traceLogPacks: settings.traceLogPacks,
sentryURL: nil)
MXLog.info("\(tag) #########################################")
ExtensionLogger.logMemory(with: tag)
MXLog.info("\(tag) Received payload: \(request.content.userInfo)")
do {
let userSession = try await NSEUserSession(credentials: credentials,
roomID: roomID,

View File

@@ -82,7 +82,7 @@ targets:
- path: ../SupportingFiles
- path: ../../ElementX/Sources/AppHooks/AppHooks.swift
- path: ../../ElementX/Sources/AppHooks/Hooks/ClientBuilderHook.swift
- path: ../../ElementX/Sources/Application/AppSettings.swift
- path: ../../ElementX/Sources/Application/Settings
- path: ../../ElementX/Sources/Application/TargetConfiguration.swift
- path: ../../ElementX/Sources/Generated/Assets.swift
- path: ../../ElementX/Sources/Generated/Strings.swift
@@ -115,7 +115,6 @@ targets:
- path: ../../ElementX/Sources/Other/SwiftUI/Views/PlaceholderAvatarImage.swift
- path: ../../ElementX/Sources/Other/TestablePreview/TestablePreview.swift
- path: ../../ElementX/Sources/Other/UserAgentBuilder.swift
- path: ../../ElementX/Sources/Other/UserPreference.swift
- path: ../../ElementX/Sources/Services/ElementCall/ElementCallServiceConstants.swift
- path: ../../ElementX/Sources/Services/Keychain/KeychainController.swift
- path: ../../ElementX/Sources/Services/Keychain/KeychainControllerProtocol.swift