mirror of
https://github.com/ichmagmaus111/ghostgram.git
synced 2026-08-21 21:37:23 +02:00
Update Ghostgram features
This commit is contained in:
@@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user