mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00
Merge branch 'beta'
# Conflicts: # Telegram/Telegram-iOS/en.lproj/Localizable.strings
This commit is contained in:
commit
a9c8ae8595
@ -857,6 +857,8 @@ private final class NotificationServiceHandler {
|
|||||||
}
|
}
|
||||||
strongSelf.stateManager = stateManager
|
strongSelf.stateManager = stateManager
|
||||||
|
|
||||||
|
let accountPeerId = stateManager.accountPeerId
|
||||||
|
|
||||||
let settings = stateManager.postbox.transaction { transaction -> NotificationSoundList? in
|
let settings = stateManager.postbox.transaction { transaction -> NotificationSoundList? in
|
||||||
return _internal_cachedNotificationSoundList(transaction: transaction)
|
return _internal_cachedNotificationSoundList(transaction: transaction)
|
||||||
}
|
}
|
||||||
@ -978,7 +980,7 @@ private final class NotificationServiceHandler {
|
|||||||
enum Action {
|
enum Action {
|
||||||
case logout
|
case logout
|
||||||
case poll(peerId: PeerId, content: NotificationContent, messageId: MessageId?)
|
case poll(peerId: PeerId, content: NotificationContent, messageId: MessageId?)
|
||||||
case pollStories(peerId: PeerId, content: NotificationContent, storyId: Int32)
|
case pollStories(peerId: PeerId, content: NotificationContent, storyId: Int32, isReaction: Bool)
|
||||||
case deleteMessage([MessageId])
|
case deleteMessage([MessageId])
|
||||||
case readReactions([MessageId])
|
case readReactions([MessageId])
|
||||||
case readMessage(MessageId)
|
case readMessage(MessageId)
|
||||||
@ -1046,7 +1048,7 @@ private final class NotificationServiceHandler {
|
|||||||
break
|
break
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if let aps = payloadJson["aps"] as? [String: Any], let peerId = peerId {
|
if let aps = payloadJson["aps"] as? [String: Any], var peerId = peerId {
|
||||||
var content: NotificationContent = NotificationContent(isLockedMessage: isLockedMessage)
|
var content: NotificationContent = NotificationContent(isLockedMessage: isLockedMessage)
|
||||||
if let alert = aps["alert"] as? [String: Any] {
|
if let alert = aps["alert"] as? [String: Any] {
|
||||||
if let topicTitleValue = payloadJson["topic_title"] as? String {
|
if let topicTitleValue = payloadJson["topic_title"] as? String {
|
||||||
@ -1075,8 +1077,35 @@ private final class NotificationServiceHandler {
|
|||||||
|
|
||||||
messageIdValue = MessageId(peerId: peerId, namespace: Namespaces.Message.Cloud, id: messageId)
|
messageIdValue = MessageId(peerId: peerId, namespace: Namespaces.Message.Cloud, id: messageId)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var isReaction = false
|
||||||
|
if let category = aps["category"] as? String {
|
||||||
|
if peerId.isGroupOrChannel && ["r", "m"].contains(category) {
|
||||||
|
content.category = "g\(category)"
|
||||||
|
} else {
|
||||||
|
content.category = category
|
||||||
|
}
|
||||||
|
|
||||||
|
if aps["r"] != nil || aps["react_emoji"] != nil {
|
||||||
|
isReaction = true
|
||||||
|
content.category = "t"
|
||||||
|
} else if payloadJson["r"] != nil || payloadJson["react_emoji"] != nil {
|
||||||
|
isReaction = true
|
||||||
|
content.category = "t"
|
||||||
|
}
|
||||||
|
|
||||||
|
if category == "str" {
|
||||||
|
isReaction = true
|
||||||
|
}
|
||||||
|
|
||||||
|
let _ = messageId
|
||||||
|
}
|
||||||
|
|
||||||
if let storyId = storyId {
|
if let storyId = storyId {
|
||||||
interactionAuthorId = peerId
|
interactionAuthorId = peerId
|
||||||
|
if isReaction {
|
||||||
|
peerId = accountPeerId
|
||||||
|
}
|
||||||
content.userInfo["story_id"] = "\(storyId)"
|
content.userInfo["story_id"] = "\(storyId)"
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1144,29 +1173,14 @@ private final class NotificationServiceHandler {
|
|||||||
content.sound = sound
|
content.sound = sound
|
||||||
}
|
}
|
||||||
|
|
||||||
if let category = aps["category"] as? String {
|
|
||||||
if peerId.isGroupOrChannel && ["r", "m"].contains(category) {
|
|
||||||
content.category = "g\(category)"
|
|
||||||
} else {
|
|
||||||
content.category = category
|
|
||||||
}
|
|
||||||
|
|
||||||
if aps["r"] != nil || aps["react_emoji"] != nil {
|
|
||||||
content.category = "t"
|
|
||||||
} else if payloadJson["r"] != nil || payloadJson["react_emoji"] != nil {
|
|
||||||
content.category = "t"
|
|
||||||
}
|
|
||||||
|
|
||||||
let _ = messageId
|
|
||||||
}
|
|
||||||
|
|
||||||
if let storyId {
|
if let storyId {
|
||||||
if content.category == "t" {
|
if isReaction {
|
||||||
content.category = "str"
|
content.category = "str"
|
||||||
} else {
|
} else {
|
||||||
content.category = "st"
|
content.category = "st"
|
||||||
}
|
}
|
||||||
action = .pollStories(peerId: peerId, content: content, storyId: storyId)
|
|
||||||
|
action = .pollStories(peerId: peerId, content: content, storyId: storyId, isReaction: isReaction)
|
||||||
} else {
|
} else {
|
||||||
action = .poll(peerId: peerId, content: content, messageId: messageIdValue)
|
action = .poll(peerId: peerId, content: content, messageId: messageIdValue)
|
||||||
}
|
}
|
||||||
@ -1645,8 +1659,8 @@ private final class NotificationServiceHandler {
|
|||||||
} else {
|
} else {
|
||||||
completed()
|
completed()
|
||||||
}
|
}
|
||||||
case let .pollStories(peerId, initialContent, storyId):
|
case let .pollStories(peerId, initialContent, storyId, isReaction):
|
||||||
Logger.shared.log("NotificationService \(episode)", "Will poll stories for \(peerId)")
|
Logger.shared.log("NotificationService \(episode)", "Will poll stories for \(peerId) isReaction: \(isReaction)")
|
||||||
if let stateManager = strongSelf.stateManager {
|
if let stateManager = strongSelf.stateManager {
|
||||||
let pollCompletion: (NotificationContent) -> Void = { content in
|
let pollCompletion: (NotificationContent) -> Void = { content in
|
||||||
let content = content
|
let content = content
|
||||||
@ -1674,8 +1688,12 @@ private final class NotificationServiceHandler {
|
|||||||
let firstUnseenItem = transaction.getStoryItems(peerId: peerId).first(where: { entry in
|
let firstUnseenItem = transaction.getStoryItems(peerId: peerId).first(where: { entry in
|
||||||
return entry.id > state.maxReadId
|
return entry.id > state.maxReadId
|
||||||
})
|
})
|
||||||
guard let firstUnseenItem, firstUnseenItem.id == storyId else {
|
if isReaction {
|
||||||
return nil
|
return nil
|
||||||
|
} else {
|
||||||
|
guard let firstUnseenItem, firstUnseenItem.id == storyId else {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
}
|
}
|
||||||
guard let peer = transaction.getPeer(peerId).flatMap(PeerReference.init) else {
|
guard let peer = transaction.getPeer(peerId).flatMap(PeerReference.init) else {
|
||||||
return nil
|
return nil
|
||||||
@ -1812,8 +1830,13 @@ private final class NotificationServiceHandler {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let wasDisplayed = stateManager.postbox.transaction { transaction -> Bool in
|
let wasDisplayed: Signal<Bool, NoError>
|
||||||
return _internal_getStoryNotificationWasDisplayed(transaction: transaction, id: StoryId(peerId: peerId, id: storyId))
|
if isReaction {
|
||||||
|
wasDisplayed = .single(false)
|
||||||
|
} else {
|
||||||
|
wasDisplayed = stateManager.postbox.transaction { transaction -> Bool in
|
||||||
|
return _internal_getStoryNotificationWasDisplayed(transaction: transaction, id: StoryId(peerId: peerId, id: storyId))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Logger.shared.log("NotificationService \(episode)", "Will fetch media")
|
Logger.shared.log("NotificationService \(episode)", "Will fetch media")
|
||||||
|
@ -270,7 +270,7 @@
|
|||||||
"PUSH_CHAT_MESSAGE_STORY" = "%2$@|%1$@ shared a story to the group";
|
"PUSH_CHAT_MESSAGE_STORY" = "%2$@|%1$@ shared a story to the group";
|
||||||
|
|
||||||
"PUSH_REACT_HIDDEN" = "New reaction to your message";
|
"PUSH_REACT_HIDDEN" = "New reaction to your message";
|
||||||
"PUSH_REACT_STORY" = "%1$@|%3$@ %2$@ to your story";
|
"PUSH_REACT_STORY" = "%1$@|%2$@ to your story";
|
||||||
"PUSH_REACT_STORY_HIDDEN" = "New reaction to your story";
|
"PUSH_REACT_STORY_HIDDEN" = "New reaction to your story";
|
||||||
|
|
||||||
"LOCAL_MESSAGE_FWDS" = "%1$@ forwarded you %2$d messages";
|
"LOCAL_MESSAGE_FWDS" = "%1$@ forwarded you %2$d messages";
|
||||||
|
@ -1518,12 +1518,6 @@ public func _internal_pollPeerStories(postbox: Postbox, network: Network, accoun
|
|||||||
return .complete()
|
return .complete()
|
||||||
}
|
}
|
||||||
|
|
||||||
#if DEBUG
|
|
||||||
if "".isEmpty {
|
|
||||||
return .complete()
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return network.request(Api.functions.stories.getPeerStories(peer: inputPeer))
|
return network.request(Api.functions.stories.getPeerStories(peer: inputPeer))
|
||||||
|> map(Optional.init)
|
|> map(Optional.init)
|
||||||
|> `catch` { _ -> Signal<Api.stories.PeerStories?, NoError> in
|
|> `catch` { _ -> Signal<Api.stories.PeerStories?, NoError> in
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"app": "10.11",
|
"app": "10.11.1",
|
||||||
"xcode": "15.2",
|
"xcode": "15.2",
|
||||||
"bazel": "7.1.1",
|
"bazel": "7.1.1",
|
||||||
"macos": "13.0"
|
"macos": "13.0"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user