mirror of
https://github.com/TelegramMessenger/Telegram-iOS.git
synced 2026-07-06 03:33:41 +02:00
Merge branch 'master' of gitlab.com:peter-iakovlev/telegram-ios
This commit is contained in:
commit
8a7daf3662
1 changed files with 40 additions and 20 deletions
|
|
@ -1038,22 +1038,10 @@ public final class PendingMessageManager {
|
|||
|
||||
var flags: Int32 = 0
|
||||
|
||||
var topMsgId: Int32?
|
||||
var monoforumPeerId: Api.InputPeer?
|
||||
if let threadId = messages[0].0.threadId {
|
||||
if let channel = peer as? TelegramChannel, channel.flags.contains(.isMonoforum) {
|
||||
if let linkedMonoforumId = channel.linkedMonoforumId, let mainChannel = transaction.getPeer(linkedMonoforumId) as? TelegramChannel, mainChannel.hasPermission(.manageDirect) {
|
||||
monoforumPeerId = transaction.getPeer(PeerId(threadId)).flatMap(apiInputPeer)
|
||||
}
|
||||
} else {
|
||||
topMsgId = Int32(clamping: threadId)
|
||||
}
|
||||
}
|
||||
|
||||
for attribute in messages[0].0.attributes {
|
||||
if let replyAttribute = attribute as? ReplyMessageAttribute {
|
||||
replyMessageId = replyAttribute.messageId.id
|
||||
if peerId != replyAttribute.messageId.peerId || (topMsgId != nil && replyAttribute.threadMessageId != nil && replyAttribute.threadMessageId?.id != topMsgId) {
|
||||
if peerId != replyAttribute.messageId.peerId {
|
||||
replyPeerId = replyAttribute.messageId.peerId
|
||||
}
|
||||
if replyAttribute.isQuote {
|
||||
|
|
@ -1146,10 +1134,19 @@ public final class PendingMessageManager {
|
|||
}
|
||||
}
|
||||
|
||||
if topMsgId != nil {
|
||||
flags |= Int32(1 << 9)
|
||||
var topMsgId: Int32?
|
||||
var monoforumPeerId: Api.InputPeer?
|
||||
if let threadId = messages[0].0.threadId {
|
||||
if let channel = peer as? TelegramChannel, channel.flags.contains(.isMonoforum) {
|
||||
if let linkedMonoforumId = channel.linkedMonoforumId, let mainChannel = transaction.getPeer(linkedMonoforumId) as? TelegramChannel, mainChannel.hasPermission(.manageDirect) {
|
||||
monoforumPeerId = transaction.getPeer(PeerId(threadId)).flatMap(apiInputPeer)
|
||||
}
|
||||
} else {
|
||||
flags |= Int32(1 << 9)
|
||||
topMsgId = Int32(clamping: threadId)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
var quickReplyShortcut: Api.InputQuickReplyShortcut?
|
||||
if let quickReply {
|
||||
if let threadId = messages[0].0.threadId {
|
||||
|
|
@ -1236,7 +1233,20 @@ public final class PendingMessageManager {
|
|||
if bubbleUpEmojiOrStickersets {
|
||||
flags |= Int32(1 << 15)
|
||||
}
|
||||
|
||||
|
||||
var topMsgId: Int32?
|
||||
var monoforumPeerId: Api.InputPeer?
|
||||
if let threadId = messages[0].0.threadId {
|
||||
if let channel = peer as? TelegramChannel, channel.flags.contains(.isMonoforum) {
|
||||
if let linkedMonoforumId = channel.linkedMonoforumId, let mainChannel = transaction.getPeer(linkedMonoforumId) as? TelegramChannel, mainChannel.hasPermission(.manageDirect) {
|
||||
monoforumPeerId = transaction.getPeer(PeerId(threadId)).flatMap(apiInputPeer)
|
||||
}
|
||||
} else {
|
||||
flags |= Int32(1 << 9)
|
||||
topMsgId = Int32(clamping: threadId)
|
||||
}
|
||||
}
|
||||
|
||||
var replyTo: Api.InputReplyTo?
|
||||
if let replyMessageId = replyMessageId {
|
||||
flags |= 1 << 0
|
||||
|
|
@ -1561,7 +1571,7 @@ public final class PendingMessageManager {
|
|||
for attribute in message.attributes {
|
||||
if let replyAttribute = attribute as? ReplyMessageAttribute {
|
||||
replyMessageId = replyAttribute.messageId.id
|
||||
if peer.id != replyAttribute.messageId.peerId || (topMsgId != nil && replyAttribute.threadMessageId != nil && replyAttribute.threadMessageId?.id != topMsgId) {
|
||||
if peer.id != replyAttribute.messageId.peerId {
|
||||
replyPeerId = replyAttribute.messageId.peerId
|
||||
}
|
||||
if replyAttribute.isQuote {
|
||||
|
|
@ -1841,9 +1851,19 @@ public final class PendingMessageManager {
|
|||
sendMessageRequest = network.request(Api.functions.messages.sendMedia(flags: flags, peer: inputPeer, replyTo: replyTo, media: inputMedia, message: text, randomId: uniqueId, replyMarkup: nil, entities: messageEntities, scheduleDate: scheduleTime, scheduleRepeatPeriod: scheduleRepeatPeriod, sendAs: sendAsInputPeer, quickReplyShortcut: quickReplyShortcut, effect: messageEffectId, allowPaidStars: allowPaidStars, suggestedPost: suggestedPost), tag: dependencyTag)
|
||||
|> map(NetworkRequestResult.result)
|
||||
case let .forward(sourceInfo):
|
||||
if topMsgId != nil {
|
||||
flags |= Int32(1 << 9)
|
||||
var topMsgId: Int32?
|
||||
var monoforumPeerId: Api.InputPeer?
|
||||
if let threadId = message.threadId {
|
||||
if let channel = peer as? TelegramChannel, channel.flags.contains(.isMonoforum) {
|
||||
if let linkedMonoforumId = channel.linkedMonoforumId, let mainChannel = transaction.getPeer(linkedMonoforumId) as? TelegramChannel, mainChannel.hasPermission(.manageDirect) {
|
||||
monoforumPeerId = transaction.getPeer(PeerId(threadId)).flatMap(apiInputPeer)
|
||||
}
|
||||
} else {
|
||||
flags |= Int32(1 << 9)
|
||||
topMsgId = Int32(clamping: threadId)
|
||||
}
|
||||
}
|
||||
|
||||
var quickReplyShortcut: Api.InputQuickReplyShortcut?
|
||||
if let quickReply {
|
||||
if let threadId = message.threadId {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue