mirror of
https://github.com/ichmagmaus111/ghostgram.git
synced 2026-11-20 05:33:58 +01:00
Ghostgram for iOS, rebuilt from scratch on Telegram iOS 13.0. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
29 lines
976 B
Swift
29 lines
976 B
Swift
import Foundation
|
|
|
|
/// «Нужен перезапуск» without exit(0): remembers the value a `.requiresRestart` setting had in this
|
|
/// process before the menu first changed it. While the current value differs, the section shows
|
|
/// the restart footer; changing it back hides the footer again. Main thread only.
|
|
final class GGMenuRestartTracker {
|
|
static let shared = GGMenuRestartTracker()
|
|
|
|
private var launchValues: [String: Any] = [:]
|
|
|
|
private init() {
|
|
}
|
|
|
|
func noteBeforeChange<Value: Equatable>(key: String, launchValue: Value) {
|
|
assert(Thread.isMainThread)
|
|
if self.launchValues[key] == nil {
|
|
self.launchValues[key] = launchValue
|
|
}
|
|
}
|
|
|
|
func differsFromLaunch<Value: Equatable>(key: String, current: Value) -> Bool {
|
|
assert(Thread.isMainThread)
|
|
guard let launchValue = self.launchValues[key] as? Value else {
|
|
return false
|
|
}
|
|
return launchValue != current
|
|
}
|
|
}
|