mirror of
https://github.com/TelegramMessenger/Telegram-iOS.git
synced 2026-07-06 03:33:41 +02:00
Comment updates
This commit is contained in:
parent
483bcedad0
commit
9b90e94ab8
30 changed files with 174 additions and 145 deletions
|
|
@ -199,3 +199,30 @@ public func dismissPeerStatusOptions(account: Account, peerId: PeerId) -> Signal
|
|||
}
|
||||
} |> switchToLatest
|
||||
}
|
||||
|
||||
public func reportRepliesMessage(account: Account, messageId: MessageId, deleteMessage: Bool, deleteHistory: Bool, reportSpam: Bool) -> Signal<Never, NoError> {
|
||||
if messageId.namespace != Namespaces.Message.Cloud {
|
||||
return .complete()
|
||||
}
|
||||
var flags: Int32 = 0
|
||||
if deleteMessage {
|
||||
flags |= 1 << 0
|
||||
}
|
||||
if deleteHistory {
|
||||
flags |= 1 << 1
|
||||
}
|
||||
if reportSpam {
|
||||
flags |= 1 << 2
|
||||
}
|
||||
return account.network.request(Api.functions.contacts.blockFromReplies(flags: flags, msgId: messageId.id))
|
||||
|> map(Optional.init)
|
||||
|> `catch` { _ -> Signal<Api.Updates?, NoError> in
|
||||
return .single(nil)
|
||||
}
|
||||
|> mapToSignal { updates -> Signal<Never, NoError> in
|
||||
if let updates = updates {
|
||||
account.stateManager.addUpdates(updates)
|
||||
}
|
||||
return .complete()
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue