mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00
24 lines
868 B
Swift
24 lines
868 B
Swift
import Foundation
|
|
import Postbox
|
|
import TelegramApi
|
|
|
|
extension TelegramChatBannedRights {
|
|
init(apiBannedRights: Api.ChatBannedRights) {
|
|
switch apiBannedRights {
|
|
case let .chatBannedRights(flags, untilDate):
|
|
var effectiveFlags = TelegramChatBannedRightsFlags(rawValue: flags)
|
|
effectiveFlags.remove(.banSendMedia)
|
|
effectiveFlags.remove(TelegramChatBannedRightsFlags(rawValue: 1 << 1))
|
|
self.init(flags: effectiveFlags, untilDate: untilDate)
|
|
}
|
|
}
|
|
|
|
var apiBannedRights: Api.ChatBannedRights {
|
|
var effectiveFlags = self.flags
|
|
effectiveFlags.remove(.banSendMedia)
|
|
effectiveFlags.remove(TelegramChatBannedRightsFlags(rawValue: 1 << 1))
|
|
|
|
return .chatBannedRights(flags: effectiveFlags.rawValue, untilDate: self.untilDate)
|
|
}
|
|
}
|