Files
Leeksov 4647310322 GLEGram 12.5 — Initial public release
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.
2026-04-06 09:48:12 +03:00

52 lines
2.2 KiB
Swift

import Foundation
import SwiftSignalKit
import TelegramCore
public struct SGUISettings: Equatable, Codable {
public var hideStories: Bool
public var showProfileId: Bool
public var warnOnStoriesOpen: Bool
public var sendWithReturnKey: Bool
public static var `default`: SGUISettings {
return SGUISettings(hideStories: false, showProfileId: true, warnOnStoriesOpen: false, sendWithReturnKey: false)
}
public init(hideStories: Bool, showProfileId: Bool, warnOnStoriesOpen: Bool, sendWithReturnKey: Bool) {
self.hideStories = hideStories
self.showProfileId = showProfileId
self.warnOnStoriesOpen = warnOnStoriesOpen
self.sendWithReturnKey = sendWithReturnKey
}
public init(from decoder: Decoder) throws {
let container = try decoder.container(keyedBy: StringCodingKey.self)
self.hideStories = (try container.decode(Int32.self, forKey: "hideStories")) != 0
self.showProfileId = (try container.decode(Int32.self, forKey: "showProfileId")) != 0
self.warnOnStoriesOpen = (try container.decode(Int32.self, forKey: "warnOnStoriesOpen")) != 0
self.sendWithReturnKey = (try container.decode(Int32.self, forKey: "sendWithReturnKey")) != 0
}
public func encode(to encoder: Encoder) throws {
var container = encoder.container(keyedBy: StringCodingKey.self)
try container.encode((self.hideStories ? 1 : 0) as Int32, forKey: "hideStories")
try container.encode((self.showProfileId ? 1 : 0) as Int32, forKey: "showProfileId")
try container.encode((self.warnOnStoriesOpen ? 1 : 0) as Int32, forKey: "warnOnStoriesOpen")
try container.encode((self.sendWithReturnKey ? 1 : 0) as Int32, forKey: "sendWithReturnKey")
}
}
public func updateSGUISettings(engine: TelegramEngine, _ f: @escaping (SGUISettings) -> SGUISettings) -> Signal<Never, NoError> {
return engine.preferences.update(id: ApplicationSpecificPreferencesKeys.SGUISettings, { entry in
let currentSettings: SGUISettings
if let entry = entry?.get(SGUISettings.self) {
currentSettings = entry
} else {
currentSettings = .default
}
return SharedPreferencesEntry(f(currentSettings))
})
}