From 5bbc75fc7c763b65175e591844d7df9a5b0376bf Mon Sep 17 00:00:00 2001 From: Isaac <> Date: Tue, 30 Sep 2025 01:53:14 +0800 Subject: [PATCH] Glass debug --- .../DebugSettingsUI/Sources/DebugController.swift | 14 +++++++------- .../Sources/GlassBackgroundComponent.swift | 4 +++- .../TabBarComponent/Sources/TabBarComponent.swift | 2 +- .../TelegramUI/Sources/ChatControllerNode.swift | 6 ------ .../TelegramUI/Sources/SharedAccountContext.swift | 5 +++++ .../Sources/ExperimentalUISettings.swift | 12 ++++++------ 6 files changed, 22 insertions(+), 21 deletions(-) diff --git a/submodules/DebugSettingsUI/Sources/DebugController.swift b/submodules/DebugSettingsUI/Sources/DebugController.swift index 66490f7246..4e221c4aa6 100644 --- a/submodules/DebugSettingsUI/Sources/DebugController.swift +++ b/submodules/DebugSettingsUI/Sources/DebugController.swift @@ -95,7 +95,7 @@ private enum DebugControllerEntry: ItemListNodeEntry { case knockoutWallpaper(PresentationTheme, Bool) case experimentalCompatibility(Bool) case enableDebugDataDisplay(Bool) - case rippleEffect(Bool) + case fakeGlass(Bool) case browserExperiment(Bool) case allForumsHaveTabs(Bool) case enableReactionOverrides(Bool) @@ -135,7 +135,7 @@ private enum DebugControllerEntry: ItemListNodeEntry { return DebugControllerSection.web.rawValue case .keepChatNavigationStack, .skipReadHistory, .alwaysDisplayTyping, .debugRatingLayout, .crashOnSlowQueries, .crashOnMemoryPressure: return DebugControllerSection.experiments.rawValue - case .clearTips, .resetNotifications, .crash, .fillLocalSavedMessageCache, .resetDatabase, .resetDatabaseAndCache, .resetHoles, .resetTagHoles, .reindexUnread, .resetCacheIndex, .reindexCache, .resetBiometricsData, .optimizeDatabase, .photoPreview, .knockoutWallpaper, .compressedEmojiCache, .storiesJpegExperiment, .checkSerializedData, .enableQuickReactionSwitch, .experimentalCompatibility, .enableDebugDataDisplay, .rippleEffect, .browserExperiment, .allForumsHaveTabs, .enableReactionOverrides, .restorePurchases, .disableReloginTokens, .liveStreamV2, .experimentalCallMute, .playerV2, .devRequests, .enableUpdates, .fakeAds, .enableLocalTranslation: + case .clearTips, .resetNotifications, .crash, .fillLocalSavedMessageCache, .resetDatabase, .resetDatabaseAndCache, .resetHoles, .resetTagHoles, .reindexUnread, .resetCacheIndex, .reindexCache, .resetBiometricsData, .optimizeDatabase, .photoPreview, .knockoutWallpaper, .compressedEmojiCache, .storiesJpegExperiment, .checkSerializedData, .enableQuickReactionSwitch, .experimentalCompatibility, .enableDebugDataDisplay, .fakeGlass, .browserExperiment, .allForumsHaveTabs, .enableReactionOverrides, .restorePurchases, .disableReloginTokens, .liveStreamV2, .experimentalCallMute, .playerV2, .devRequests, .enableUpdates, .fakeAds, .enableLocalTranslation: return DebugControllerSection.experiments.rawValue case .logTranslationRecognition, .resetTranslationStates: return DebugControllerSection.translation.rawValue @@ -226,7 +226,7 @@ private enum DebugControllerEntry: ItemListNodeEntry { return 37 case .enableDebugDataDisplay: return 38 - case .rippleEffect: + case .fakeGlass: return 39 case .browserExperiment: return 40 @@ -1258,12 +1258,12 @@ private enum DebugControllerEntry: ItemListNodeEntry { }) }).start() }) - case let .rippleEffect(value): - return ItemListSwitchItem(presentationData: presentationData, title: "Ripple", value: value, sectionId: self.section, style: .blocks, updated: { value in + case let .fakeGlass(value): + return ItemListSwitchItem(presentationData: presentationData, title: "Fake glass", value: value, sectionId: self.section, style: .blocks, updated: { value in let _ = arguments.sharedContext.accountManager.transaction ({ transaction in transaction.updateSharedData(ApplicationSpecificSharedDataKeys.experimentalUISettings, { settings in var settings = settings?.get(ExperimentalUISettings.self) ?? ExperimentalUISettings.defaultSettings - settings.rippleEffect = value + settings.fakeGlass = value return PreferencesEntry(settings) }) }).start() @@ -1543,7 +1543,7 @@ private func debugControllerEntries(sharedContext: SharedAccountContext, present entries.append(.knockoutWallpaper(presentationData.theme, experimentalSettings.knockoutWallpaper)) entries.append(.experimentalCompatibility(experimentalSettings.experimentalCompatibility)) entries.append(.enableDebugDataDisplay(experimentalSettings.enableDebugDataDisplay)) - entries.append(.rippleEffect(experimentalSettings.rippleEffect)) + entries.append(.fakeGlass(experimentalSettings.fakeGlass)) #if DEBUG entries.append(.browserExperiment(experimentalSettings.browserExperiment)) #else diff --git a/submodules/TelegramUI/Components/GlassBackgroundComponent/Sources/GlassBackgroundComponent.swift b/submodules/TelegramUI/Components/GlassBackgroundComponent/Sources/GlassBackgroundComponent.swift index 90e6d94780..6cbdb2bd03 100644 --- a/submodules/TelegramUI/Components/GlassBackgroundComponent/Sources/GlassBackgroundComponent.swift +++ b/submodules/TelegramUI/Components/GlassBackgroundComponent/Sources/GlassBackgroundComponent.swift @@ -294,8 +294,10 @@ public class GlassBackgroundView: UIView { private var params: Params? + public static var useCustomGlassImpl: Bool = false + public override init(frame: CGRect) { - if #available(iOS 26.0, *) { + if #available(iOS 26.0, *), !GlassBackgroundView.useCustomGlassImpl { self.backgroundNode = nil let glassEffect = UIGlassEffect(style: .regular) diff --git a/submodules/TelegramUI/Components/TabBarComponent/Sources/TabBarComponent.swift b/submodules/TelegramUI/Components/TabBarComponent/Sources/TabBarComponent.swift index c19c336a7c..7dd6f2930a 100644 --- a/submodules/TelegramUI/Components/TabBarComponent/Sources/TabBarComponent.swift +++ b/submodules/TelegramUI/Components/TabBarComponent/Sources/TabBarComponent.swift @@ -89,7 +89,7 @@ public final class TabBarComponent: Component { private weak var state: EmptyComponentState? public override init(frame: CGRect) { - self.backgroundView = GlassBackgroundView(frame: CGRect()) + self.backgroundView = GlassBackgroundView() self.selectionView = GlassBackgroundView.ContentImageView() self.contextGestureContainerView = ContextControllerSourceView() diff --git a/submodules/TelegramUI/Sources/ChatControllerNode.swift b/submodules/TelegramUI/Sources/ChatControllerNode.swift index fa1c971e6d..bcf11e3564 100644 --- a/submodules/TelegramUI/Sources/ChatControllerNode.swift +++ b/submodules/TelegramUI/Sources/ChatControllerNode.swift @@ -3761,12 +3761,6 @@ class ChatControllerNode: ASDisplayNode, ASScrollViewDelegate { return } - if let view, let location { - if context.sharedContext.immediateExperimentalUISettings.rippleEffect { - self.wrappingNode.triggerRipple(at: self.contentContainerNode.view.convert(location, from: view)) - } - } - switch self.chatPresentationInterfaceState.inputMode { case .none: break diff --git a/submodules/TelegramUI/Sources/SharedAccountContext.swift b/submodules/TelegramUI/Sources/SharedAccountContext.swift index 13f65ed3ee..2c070e7f58 100644 --- a/submodules/TelegramUI/Sources/SharedAccountContext.swift +++ b/submodules/TelegramUI/Sources/SharedAccountContext.swift @@ -86,6 +86,7 @@ import SendInviteLinkScreen import PostSuggestionsSettingsScreen import ForumSettingsScreen import ForumCreateTopicScreen +import GlassBackgroundComponent private final class AccountUserInterfaceInUseContext { let subscribers = Bag<(Bool) -> Void>() @@ -477,12 +478,16 @@ public final class SharedAccountContextImpl: SharedAccountContext { let immediateExperimentalUISettingsValue = self.immediateExperimentalUISettingsValue let _ = immediateExperimentalUISettingsValue.swap(initialPresentationDataAndSettings.experimentalUISettings) + + GlassBackgroundView.useCustomGlassImpl = immediateExperimentalUISettingsValue.with({ $0.fakeGlass }) + self.experimentalUISettingsDisposable = (self.accountManager.sharedData(keys: [ApplicationSpecificSharedDataKeys.experimentalUISettings]) |> deliverOnMainQueue).start(next: { sharedData in if let settings = sharedData.entries[ApplicationSpecificSharedDataKeys.experimentalUISettings]?.get(ExperimentalUISettings.self) { let _ = immediateExperimentalUISettingsValue.swap(settings) flatBuffers_checkedGet = settings.checkSerializedData + GlassBackgroundView.useCustomGlassImpl = settings.fakeGlass } }) diff --git a/submodules/TelegramUIPreferences/Sources/ExperimentalUISettings.swift b/submodules/TelegramUIPreferences/Sources/ExperimentalUISettings.swift index 419c0e3de1..319cb1690c 100644 --- a/submodules/TelegramUIPreferences/Sources/ExperimentalUISettings.swift +++ b/submodules/TelegramUIPreferences/Sources/ExperimentalUISettings.swift @@ -38,7 +38,7 @@ public struct ExperimentalUISettings: Codable, Equatable { public var enableVoipTcp: Bool public var experimentalCompatibility: Bool public var enableDebugDataDisplay: Bool - public var rippleEffect: Bool + public var fakeGlass: Bool public var compressedEmojiCache: Bool public var localTranscription: Bool public var enableReactionOverrides: Bool @@ -86,7 +86,7 @@ public struct ExperimentalUISettings: Codable, Equatable { enableVoipTcp: false, experimentalCompatibility: false, enableDebugDataDisplay: false, - rippleEffect: false, + fakeGlass: false, compressedEmojiCache: false, localTranscription: false, enableReactionOverrides: false, @@ -135,7 +135,7 @@ public struct ExperimentalUISettings: Codable, Equatable { enableVoipTcp: Bool, experimentalCompatibility: Bool, enableDebugDataDisplay: Bool, - rippleEffect: Bool, + fakeGlass: Bool, compressedEmojiCache: Bool, localTranscription: Bool, enableReactionOverrides: Bool, @@ -181,7 +181,7 @@ public struct ExperimentalUISettings: Codable, Equatable { self.enableVoipTcp = enableVoipTcp self.experimentalCompatibility = experimentalCompatibility self.enableDebugDataDisplay = enableDebugDataDisplay - self.rippleEffect = rippleEffect + self.fakeGlass = fakeGlass self.compressedEmojiCache = compressedEmojiCache self.localTranscription = localTranscription self.enableReactionOverrides = enableReactionOverrides @@ -231,7 +231,7 @@ public struct ExperimentalUISettings: Codable, Equatable { self.enableVoipTcp = (try container.decodeIfPresent(Int32.self, forKey: "enableVoipTcp") ?? 0) != 0 self.experimentalCompatibility = (try container.decodeIfPresent(Int32.self, forKey: "experimentalCompatibility") ?? 0) != 0 self.enableDebugDataDisplay = (try container.decodeIfPresent(Int32.self, forKey: "enableDebugDataDisplay") ?? 0) != 0 - self.rippleEffect = (try container.decodeIfPresent(Int32.self, forKey: "rippleEffect") ?? 0) != 0 + self.fakeGlass = (try container.decodeIfPresent(Int32.self, forKey: "fakeGlass") ?? 0) != 0 self.compressedEmojiCache = (try container.decodeIfPresent(Int32.self, forKey: "compressedEmojiCache") ?? 0) != 0 self.localTranscription = (try container.decodeIfPresent(Int32.self, forKey: "localTranscription") ?? 0) != 0 self.enableReactionOverrides = try container.decodeIfPresent(Bool.self, forKey: "enableReactionOverrides") ?? false @@ -281,7 +281,7 @@ public struct ExperimentalUISettings: Codable, Equatable { try container.encode((self.enableVoipTcp ? 1 : 0) as Int32, forKey: "enableVoipTcp") try container.encode((self.experimentalCompatibility ? 1 : 0) as Int32, forKey: "experimentalCompatibility") try container.encode((self.enableDebugDataDisplay ? 1 : 0) as Int32, forKey: "enableDebugDataDisplay") - try container.encode((self.rippleEffect ? 1 : 0) as Int32, forKey: "rippleEffect") + try container.encode((self.fakeGlass ? 1 : 0) as Int32, forKey: "fakeGlass") try container.encode((self.compressedEmojiCache ? 1 : 0) as Int32, forKey: "compressedEmojiCache") try container.encode((self.localTranscription ? 1 : 0) as Int32, forKey: "localTranscription") try container.encode(self.enableReactionOverrides, forKey: "enableReactionOverrides")