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