mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-02 12:07:55 +00:00
Updated setPusher function (#684)
* updated set_pusher function from the SDK * this fixes a crash and allows for the navigation to work by using the threadIdentifier of the notification * adding NCE target * project setup completed with xcodegen * no need for those ugly storyboards * code improvement * removing unused outlet * mocks generated with the comment instead of the marker protocol * updated stencil * fixed unit tests * updated swiftformat * pr comments
This commit is contained in:
@@ -84,24 +84,25 @@ class NotificationManager: NSObject, NotificationManagerProtocol {
|
||||
|
||||
private func setPusher(with deviceToken: Data, clientProxy: ClientProxyProtocol) async -> Bool {
|
||||
do {
|
||||
try await clientProxy.setPusher(pushkey: deviceToken.base64EncodedString(),
|
||||
kind: .http,
|
||||
appId: ServiceLocator.shared.settings.pusherAppId,
|
||||
appDisplayName: "\(InfoPlistReader.main.bundleDisplayName) (iOS)",
|
||||
deviceDisplayName: UIDevice.current.name,
|
||||
profileTag: pusherProfileTag(),
|
||||
lang: Bundle.preferredLanguages.first ?? "en",
|
||||
url: ServiceLocator.shared.settings.pushGatewayBaseURL,
|
||||
format: .eventIdOnly,
|
||||
defaultPayload: [
|
||||
"aps": [
|
||||
"mutable-content": 1,
|
||||
"alert": [
|
||||
"loc-key": "Notification",
|
||||
"loc-args": []
|
||||
]
|
||||
]
|
||||
])
|
||||
let defaultPayload = [
|
||||
"aps": [
|
||||
"mutable-content": 1,
|
||||
"alert": [
|
||||
"loc-key": "Notification",
|
||||
"loc-args": []
|
||||
]
|
||||
]
|
||||
]
|
||||
let configuration = await PusherConfiguration(identifiers: .init(pushkey: deviceToken.base64EncodedString(),
|
||||
appId: ServiceLocator.shared.settings.pusherAppId),
|
||||
kind: .http(data: .init(url: ServiceLocator.shared.settings.pushGatewayBaseURL.absoluteString,
|
||||
format: .eventIdOnly,
|
||||
defaultPayload: defaultPayload.jsonString)),
|
||||
appDisplayName: "\(InfoPlistReader.main.bundleDisplayName) (iOS)",
|
||||
deviceDisplayName: UIDevice.current.name,
|
||||
profileTag: pusherProfileTag(),
|
||||
lang: Bundle.preferredLanguages.first ?? "en")
|
||||
try await clientProxy.setPusher(with: configuration)
|
||||
MXLog.info("[NotificationManager] set pusher succeeded")
|
||||
return true
|
||||
} catch {
|
||||
@@ -144,6 +145,7 @@ extension NotificationManager: UNUserNotificationCenterDelegate {
|
||||
return [.badge, .sound, .list, .banner]
|
||||
}
|
||||
|
||||
@MainActor
|
||||
func userNotificationCenter(_ center: UNUserNotificationCenter,
|
||||
didReceive response: UNNotificationResponse) async {
|
||||
switch response.actionIdentifier {
|
||||
|
||||
Reference in New Issue
Block a user