mirror of
https://github.com/TelegramMessenger/Telegram-iOS.git
synced 2026-07-06 03:33:41 +02:00
Various fixes
This commit is contained in:
parent
c05a1dd17c
commit
1ab69f4527
3 changed files with 35 additions and 8 deletions
|
|
@ -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
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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$@";
|
||||
|
|
|
|||
|
|
@ -2793,13 +2793,13 @@ private func extractAccountManagerState(records: AccountRecordsView<TelegramAcco
|
|||
}
|
||||
|
||||
private var openUrlInProgress: URL?
|
||||
private func openUrlWhenReady(url: URL) {
|
||||
private func openUrlWhenReady(url: URL, external: Bool = false) {
|
||||
self.openUrlInProgress = url
|
||||
|
||||
self.openUrlWhenReadyDisposable.set((self.authorizedContext()
|
||||
|> 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<TelegramAcco
|
|||
let _ = (accountIdFromNotification(response.notification, sharedContext: self.sharedContextPromise.get())
|
||||
|> 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) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue