diff --git a/Telegram/NotificationService/Sources/NotificationService.swift b/Telegram/NotificationService/Sources/NotificationService.swift index e5be042e7f..72292568a5 100644 --- a/Telegram/NotificationService/Sources/NotificationService.swift +++ b/Telegram/NotificationService/Sources/NotificationService.swift @@ -1222,10 +1222,6 @@ private final class NotificationServiceHandler { content.userInfo["peerId"] = "\(peerId.toInt64())" content.userInfo["accountId"] = "\(recordId.int64)" - - if let dataUrl = payloadJson["data_url"] as? String { - content.userInfo["data_url"] = dataUrl - } if let silentString = payloadJson["silent"] as? String { if let silentValue = Int(silentString), silentValue != 0 { @@ -1304,6 +1300,35 @@ private final class NotificationServiceHandler { } updateCurrentContent(content) + } else if let aps = payloadJson["aps"] as? [String: Any], let url = payloadJson["url"] as? String { + var content: NotificationContent = NotificationContent(isLockedMessage: nil) + content.userInfo["url"] = url + content.userInfo["peerId"] = "777000" + content.userInfo["accountId"] = "\(recordId.int64)" + if let sound = aps["sound"] as? String { + content.sound = sound + } + if let alert = aps["alert"] as? [String: Any] { + if let topicTitleValue = payloadJson["topic_title"] as? String { + topicTitle = topicTitleValue + if let title = alert["title"] as? String { + content.title = "\(topicTitleValue) (\(title))" + } else { + content.title = topicTitleValue + } + } else { + content.title = alert["title"] as? String + } + content.subtitle = alert["subtitle"] as? String + content.body = alert["body"] as? String + } else if let alert = aps["alert"] as? String { + content.body = alert + } else { + content.body = "You have a new message" + } + updateCurrentContent(content) + completed() + return } } diff --git a/Telegram/Telegram-iOS/en.lproj/Localizable.strings b/Telegram/Telegram-iOS/en.lproj/Localizable.strings index 1c8d3932c6..d502eee560 100644 --- a/Telegram/Telegram-iOS/en.lproj/Localizable.strings +++ b/Telegram/Telegram-iOS/en.lproj/Localizable.strings @@ -15945,3 +15945,5 @@ Error: %8$@"; "DisableSharing.Saving.Title" = "No Saving"; "DisableSharing.Saving.Text" = "Disable copying text and saving photos and videos to Photos."; "DisableSharing.Confirm" = "Disable Sharing"; + +"OAUTH_REQUEST" = "Login request for %1$@, location: %2$@"; diff --git a/submodules/TelegramUI/Sources/AppDelegate.swift b/submodules/TelegramUI/Sources/AppDelegate.swift index 6de065f2bc..ce44ba07c9 100644 --- a/submodules/TelegramUI/Sources/AppDelegate.swift +++ b/submodules/TelegramUI/Sources/AppDelegate.swift @@ -2793,13 +2793,13 @@ private func extractAccountManagerState(records: AccountRecordsView take(1) |> deliverOnMainQueue).start(next: { [weak self] context in - context.openUrl(url) + context.openUrl(url, external: external) Queue.mainQueue().after(1.0, { self?.openUrlInProgress = nil @@ -2811,9 +2811,9 @@ private func extractAccountManagerState(records: AccountRecordsView deliverOnMainQueue).start(next: { accountId in if response.actionIdentifier == UNNotificationDefaultActionIdentifier { - if let dataUrl = response.notification.request.content.userInfo["data_url"] as? String { + if let dataUrl = response.notification.request.content.userInfo["url"] as? String { if let url = URL(string: dataUrl) { - self.openUrlWhenReady(url: url) + self.openUrlWhenReady(url: url, external: true) } } else { if let (peerId, threadId) = peerIdFromNotification(response.notification) {