Make the remote settings hook usable within the app extensions. (#4342)
This commit is contained in:
@@ -29,12 +29,10 @@ import UserNotifications
|
||||
|
||||
class NotificationServiceExtension: UNNotificationServiceExtension {
|
||||
private static var targetConfiguration: Target.Configuration?
|
||||
private var notificationHandler: NotificationHandler?
|
||||
|
||||
private let appHooks = AppHooks()
|
||||
|
||||
private let settings: CommonSettingsProtocol = AppSettings()
|
||||
private let appHooks: AppHooks
|
||||
|
||||
private var notificationHandler: NotificationHandler?
|
||||
private let keychainController = KeychainController(service: .sessions,
|
||||
accessGroup: InfoPlistReader.main.keychainAccessGroupIdentifier)
|
||||
|
||||
@@ -46,6 +44,9 @@ class NotificationServiceExtension: UNNotificationServiceExtension {
|
||||
}
|
||||
|
||||
override init() {
|
||||
appHooks = AppHooks()
|
||||
appHooks.setUp()
|
||||
|
||||
if Self.targetConfiguration == nil {
|
||||
Self.targetConfiguration = Target.nse.configure(logLevel: settings.logLevel,
|
||||
traceLogPacks: settings.traceLogPacks,
|
||||
@@ -68,6 +69,9 @@ class NotificationServiceExtension: UNNotificationServiceExtension {
|
||||
return contentHandler(request.content)
|
||||
}
|
||||
|
||||
let homeserverURL = credentials.restorationToken.session.homeserverUrl
|
||||
appHooks.remoteSettingsHook.loadCache(forHomeserver: homeserverURL, applyingTo: settings)
|
||||
|
||||
guard let mutableContent = request.content.mutableCopy() as? UNMutableNotificationContent else {
|
||||
return contentHandler(request.content)
|
||||
}
|
||||
|
||||
@@ -82,6 +82,8 @@ targets:
|
||||
- path: ../SupportingFiles
|
||||
- path: ../../ElementX/Sources/AppHooks/AppHooks.swift
|
||||
- path: ../../ElementX/Sources/AppHooks/Hooks/ClientBuilderHook.swift
|
||||
- path: ../../ElementX/Sources/AppHooks/Hooks/RemoteSettingsHook.swift
|
||||
- path: ../../Secrets/Secrets.swift
|
||||
- path: ../../ElementX/Sources/Application/Settings
|
||||
- path: ../../ElementX/Sources/Application/TargetConfiguration.swift
|
||||
- path: ../../ElementX/Sources/Generated/Assets.swift
|
||||
|
||||
Reference in New Issue
Block a user