mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-22 14:20:20 +00:00
Do not show group message notifications in CarPlay
Navigate to original message on tapping reaction notifications
This commit is contained in:
@@ -101,8 +101,6 @@ final class AuthorizedApplicationContext {
|
||||
let rootController: TelegramRootController
|
||||
let notificationController: NotificationContainerController
|
||||
|
||||
private var scheduledOpenNotificationSettings: Bool = false
|
||||
private var scheduledOpenChatWithPeerId: (PeerId, MessageId?, Bool)?
|
||||
private let scheduledCallPeerDisposable = MetaDisposable()
|
||||
private var scheduledOpenExternalUrl: URL?
|
||||
|
||||
@@ -395,7 +393,7 @@ final class AuthorizedApplicationContext {
|
||||
}
|
||||
|
||||
if inAppNotificationSettings.displayPreviews {
|
||||
let presentationData = strongSelf.context.sharedContext.currentPresentationData.with { $0 }
|
||||
let presentationData = strongSelf.context.sharedContext.currentPresentationData.with { $0 }
|
||||
strongSelf.notificationController.enqueue(ChatMessageNotificationItem(context: strongSelf.context, strings: presentationData.strings, dateTimeFormat: presentationData.dateTimeFormat, nameDisplayOrder: presentationData.nameDisplayOrder, messages: messages, threadData: threadData, tapAction: {
|
||||
if let strongSelf = self {
|
||||
var foundOverlay = false
|
||||
@@ -833,11 +831,7 @@ final class AuthorizedApplicationContext {
|
||||
}
|
||||
|
||||
func openNotificationSettings() {
|
||||
if self.rootController.rootTabController != nil {
|
||||
self.rootController.pushViewController(notificationsAndSoundsController(context: self.context, exceptionsList: nil))
|
||||
} else {
|
||||
self.scheduledOpenNotificationSettings = true
|
||||
}
|
||||
self.rootController.pushViewController(notificationsAndSoundsController(context: self.context, exceptionsList: nil))
|
||||
}
|
||||
|
||||
func startCall(peerId: PeerId, isVideo: Bool) {
|
||||
@@ -864,27 +858,40 @@ final class AuthorizedApplicationContext {
|
||||
}
|
||||
|
||||
if visiblePeerId != peerId || messageId != nil {
|
||||
if self.rootController.rootTabController != nil {
|
||||
let _ = (self.context.engine.data.get(TelegramEngine.EngineData.Item.Peer.Peer(id: peerId))
|
||||
|> deliverOnMainQueue).start(next: { peer in
|
||||
guard let peer = peer else {
|
||||
return
|
||||
}
|
||||
|
||||
let chatLocation: NavigateToChatControllerParams.Location
|
||||
if let threadId = threadId {
|
||||
chatLocation = .replyThread(ChatReplyThreadMessage(
|
||||
messageId: MessageId(peerId: peerId, namespace: Namespaces.Message.Cloud, id: Int32(clamping: threadId)), channelMessageId: nil, isChannelPost: false, isForumPost: true, maxMessage: nil, maxReadIncomingMessageId: nil, maxReadOutgoingMessageId: nil, unreadCount: 0, initialFilledHoles: IndexSet(), initialAnchor: .automatic, isNotAvailable: false
|
||||
))
|
||||
let isOutgoingMessage: Signal<Bool, NoError>
|
||||
if let messageId {
|
||||
let accountPeerId = self.context.account.peerId
|
||||
isOutgoingMessage = self.context.engine.data.get(TelegramEngine.EngineData.Item.Messages.Message(id: messageId))
|
||||
|> map { message -> Bool in
|
||||
if let message {
|
||||
return !message._asMessage().effectivelyIncoming(accountPeerId)
|
||||
} else {
|
||||
chatLocation = .peer(peer)
|
||||
return false
|
||||
}
|
||||
|
||||
self.context.sharedContext.navigateToChatController(NavigateToChatControllerParams(navigationController: self.rootController, context: self.context, chatLocation: chatLocation, subject: messageId.flatMap { .message(id: .id($0), highlight: true, timecode: nil) }, activateInput: activateInput ? .text : nil))
|
||||
})
|
||||
}
|
||||
} else {
|
||||
self.scheduledOpenChatWithPeerId = (peerId, messageId, activateInput)
|
||||
isOutgoingMessage = .single(false)
|
||||
}
|
||||
let _ = combineLatest(
|
||||
queue: Queue.mainQueue(),
|
||||
self.context.engine.data.get(TelegramEngine.EngineData.Item.Peer.Peer(id: peerId)),
|
||||
isOutgoingMessage
|
||||
).start(next: { peer, isOutgoingMessage in
|
||||
guard let peer = peer else {
|
||||
return
|
||||
}
|
||||
|
||||
let chatLocation: NavigateToChatControllerParams.Location
|
||||
if let threadId = threadId {
|
||||
chatLocation = .replyThread(ChatReplyThreadMessage(
|
||||
messageId: MessageId(peerId: peerId, namespace: Namespaces.Message.Cloud, id: Int32(clamping: threadId)), channelMessageId: nil, isChannelPost: false, isForumPost: true, maxMessage: nil, maxReadIncomingMessageId: nil, maxReadOutgoingMessageId: nil, unreadCount: 0, initialFilledHoles: IndexSet(), initialAnchor: .automatic, isNotAvailable: false
|
||||
))
|
||||
} else {
|
||||
chatLocation = .peer(peer)
|
||||
}
|
||||
|
||||
self.context.sharedContext.navigateToChatController(NavigateToChatControllerParams(navigationController: self.rootController, context: self.context, chatLocation: chatLocation, subject: isOutgoingMessage ? messageId.flatMap { .message(id: .id($0), highlight: true, timecode: nil) } : nil, activateInput: activateInput ? .text : nil))
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user