mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-22 22:25:57 +00:00
Update invoice API
This commit is contained in:
@@ -1,10 +1,20 @@
|
||||
import Foundation
|
||||
import TelegramCore
|
||||
import Postbox
|
||||
|
||||
public extension Message {
|
||||
func isRestricted(platform: String, contentSettings: ContentSettings) -> Bool {
|
||||
if let attribute = self.restrictedContentAttribute {
|
||||
return attribute.platformText(platform: platform, contentSettings: contentSettings) != nil
|
||||
}
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
public extension RestrictedContentMessageAttribute {
|
||||
func platformText(platform: String, contentSettings: ContentSettings) -> String? {
|
||||
for rule in self.rules {
|
||||
if rule.platform == "all" || rule.platform == "ios" {
|
||||
if rule.platform == "all" || rule.platform == "ios" || contentSettings.addContentRestrictionReasons.contains(rule.platform) {
|
||||
if !contentSettings.ignoreContentRestrictionReasons.contains(rule.reason) {
|
||||
return rule.text
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user