mirror of
https://github.com/GLEGram/GLEGram-iOS.git
synced 2026-04-23 19:36:26 +02:00
4647310322
Based on Swiftgram 12.5 (Telegram iOS 12.5). All GLEGram features ported and organized in GLEGram/ folder. Features: Ghost Mode, Saved Deleted Messages, Content Protection Bypass, Font Replacement, Fake Profile, Chat Export, Plugin System, and more. See CHANGELOG_12.5.md for full details.
52 lines
2.1 KiB
Swift
52 lines
2.1 KiB
Swift
import Foundation
|
|
|
|
import SGAPIToken
|
|
import SGAPI
|
|
import SGLogging
|
|
|
|
import AccountContext
|
|
|
|
import SGSimpleSettings
|
|
import TelegramCore
|
|
|
|
public func updateSGWebSettingsInteractivelly(context: AccountContext) {
|
|
let _ = getSGApiToken(context: context).startStandalone(next: { token in
|
|
let _ = getSGSettings(token: token).startStandalone(next: { webSettings in
|
|
SGLogger.shared.log("SGAPI", "New SGWebSettings for id \(context.account.peerId.id._internalGetInt64Value()): \(webSettings) ")
|
|
SGSimpleSettings.shared.canUseStealthMode = webSettings.global.storiesAvailable
|
|
SGSimpleSettings.shared.duckyAppIconAvailable = webSettings.global.duckyAppIconAvailable
|
|
SGSimpleSettings.shared.canUseNY = webSettings.global.nyAvailable
|
|
let _ = (context.account.postbox.transaction { transaction in
|
|
updateAppConfiguration(transaction: transaction, { configuration -> AppConfiguration in
|
|
var configuration = configuration
|
|
configuration.sgWebSettings = webSettings
|
|
return configuration
|
|
})
|
|
}).startStandalone()
|
|
}, error: { e in
|
|
if case let .generic(errorMessage) = e, let errorMessage = errorMessage {
|
|
SGLogger.shared.log("SGAPI", errorMessage)
|
|
}
|
|
})
|
|
}, error: { e in
|
|
if case let .generic(errorMessage) = e, let errorMessage = errorMessage {
|
|
SGLogger.shared.log("SGAPI", errorMessage)
|
|
}
|
|
})
|
|
}
|
|
|
|
|
|
public func postSGWebSettingsInteractivelly(context: AccountContext, data: [String: Any]) {
|
|
let _ = getSGApiToken(context: context).startStandalone(next: { token in
|
|
let _ = postSGSettings(token: token, data: data).startStandalone(error: { e in
|
|
if case let .generic(errorMessage) = e, let errorMessage = errorMessage {
|
|
SGLogger.shared.log("SGAPI", errorMessage)
|
|
}
|
|
})
|
|
}, error: { e in
|
|
if case let .generic(errorMessage) = e, let errorMessage = errorMessage {
|
|
SGLogger.shared.log("SGAPI", errorMessage)
|
|
}
|
|
})
|
|
}
|