mirror of
https://github.com/ichmagmaus111/ghostgram.git
synced 2026-04-25 09:05:58 +02:00
21 lines
630 B
Swift
21 lines
630 B
Swift
import Foundation
|
|
import Postbox
|
|
import TelegramApi
|
|
|
|
|
|
extension RestrictionRule {
|
|
convenience init(apiReason: Api.RestrictionReason) {
|
|
switch apiReason {
|
|
case let .restrictionReason(restrictionReasonData):
|
|
let (platform, reason, text) = (restrictionReasonData.platform, restrictionReasonData.reason, restrictionReasonData.text)
|
|
self.init(platform: platform, reason: reason, text: text)
|
|
}
|
|
}
|
|
}
|
|
|
|
extension PeerAccessRestrictionInfo {
|
|
convenience init(apiReasons: [Api.RestrictionReason]) {
|
|
self.init(rules: apiReasons.map(RestrictionRule.init(apiReason:)))
|
|
}
|
|
}
|