Update Ghostgram features

This commit is contained in:
ichmagmaus 812
2026-03-07 18:19:16 +01:00
parent 32b0dddcd9
commit 13a43b9068
902 changed files with 148295 additions and 62348 deletions
@@ -4,14 +4,16 @@ import TelegramApi
import SwiftSignalKit
public struct ContentSettings: Equatable {
public static var `default` = ContentSettings(ignoreContentRestrictionReasons: [], addContentRestrictionReasons: [])
public static var `default` = ContentSettings(ignoreContentRestrictionReasons: [], addContentRestrictionReasons: [], appConfiguration: AppConfiguration.defaultValue)
public var ignoreContentRestrictionReasons: Set<String>
public var addContentRestrictionReasons: [String]
public var appConfiguration: AppConfiguration
public init(ignoreContentRestrictionReasons: Set<String>, addContentRestrictionReasons: [String]) {
public init(ignoreContentRestrictionReasons: Set<String>, addContentRestrictionReasons: [String], appConfiguration: AppConfiguration) {
self.ignoreContentRestrictionReasons = ignoreContentRestrictionReasons
self.addContentRestrictionReasons = addContentRestrictionReasons
self.appConfiguration = appConfiguration
}
}
@@ -27,7 +29,9 @@ extension ContentSettings {
addContentRestrictionReasons = addContentRestrictionReasonsData
}
}
self.init(ignoreContentRestrictionReasons: Set(reasons), addContentRestrictionReasons: addContentRestrictionReasons)
// MARK: Swiftgram
reasons += appConfiguration.sgWebSettings.user.expandedContentReasons()
self.init(ignoreContentRestrictionReasons: Set(reasons), addContentRestrictionReasons: addContentRestrictionReasons, appConfiguration: appConfiguration)
}
}
@@ -61,7 +65,8 @@ public func contentSettingsConfiguration(network: Network) -> Signal<ContentSett
return network.request(Api.functions.account.getContentSettings())
|> map { result -> ContentSettingsConfiguration in
switch result {
case let .contentSettings(flags):
case let .contentSettings(contentSettingsData):
let flags = contentSettingsData.flags
return ContentSettingsConfiguration(sensitiveContentEnabled: (flags & (1 << 0)) != 0, canAdjustSensitiveContent: (flags & (1 << 1)) != 0)
}
}