|
@@ -413,23 +413,19 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
|
|
|
|
|
|
// MARK: - Handle notification banners
|
|
|
|
|
|
- private func userNotificationCenter(_: UNUserNotificationCenter, willPresent _: UNNotification, withCompletionHandler completionHandler: @escaping (UNNotificationPresentationOptions) -> Void) {
|
|
|
+ func userNotificationCenter(_: UNUserNotificationCenter, willPresent _: UNNotification, withCompletionHandler completionHandler: @escaping (UNNotificationPresentationOptions) -> Void) {
|
|
|
logger.info("forground notification")
|
|
|
completionHandler([.alert, .sound])
|
|
|
}
|
|
|
|
|
|
- private func userNotificationCenter(_: UNUserNotificationCenter, didReceive response: UNNotificationResponse, withCompletionHandler completionHandler: @escaping () -> Void) {
|
|
|
+ func userNotificationCenter(_: UNUserNotificationCenter, didReceive response: UNNotificationResponse, withCompletionHandler completionHandler: @escaping () -> Void) {
|
|
|
if response.notification.request.identifier == Constants.notificationIdentifier {
|
|
|
logger.info("handling notifications")
|
|
|
let userInfo = response.notification.request.content.userInfo
|
|
|
- let nc = NotificationCenter.default
|
|
|
- DispatchQueue.main.async {
|
|
|
- nc.post(
|
|
|
- name: dcNotificationViewChat,
|
|
|
- object: nil,
|
|
|
- userInfo: userInfo
|
|
|
- )
|
|
|
- }
|
|
|
+ if let chatId = userInfo["chat_id"] as? Int,
|
|
|
+ let msgId = userInfo["message_id"] as? Int {
|
|
|
+ appCoordinator.showChat(chatId: chatId, msgId: msgId)
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
completionHandler()
|