diff --git a/submodules/ChatListUI/Sources/ChatListController.swift b/submodules/ChatListUI/Sources/ChatListController.swift index 4ec3cbea55..5a4590c118 100644 --- a/submodules/ChatListUI/Sources/ChatListController.swift +++ b/submodules/ChatListUI/Sources/ChatListController.swift @@ -6324,6 +6324,14 @@ private final class ChatListLocationContext { return lhs == rhs }) + // MARK: Swiftgram + let hideStoriesSignal = context.account.postbox.preferencesView(keys: [ApplicationSpecificPreferencesKeys.SGUISettings]) + |> map { view -> Bool in + let settings: SGUISettings = view.values[ApplicationSpecificPreferencesKeys.SGUISettings]?.get(SGUISettings.self) ?? .default + return settings.hideStories + } + |> distinctUntilChanged + let passcode = context.sharedContext.accountManager.accessChallengeData() |> map { view -> (Bool, Bool) in let data = view.data @@ -6392,6 +6400,7 @@ private final class ChatListLocationContext { case .chatList: if !hideNetworkActivityStatus { self.titleDisposable = combineLatest(queue: .mainQueue(), + hideStoriesSignal, networkState, hasProxy, passcode, @@ -6400,12 +6409,13 @@ private final class ChatListLocationContext { peerStatus, parentController.updatedPresentationData.1, storyPostingAvailable - ).startStrict(next: { [weak self] networkState, proxy, passcode, stateAndFilterId, isReorderingTabs, peerStatus, presentationData, storyPostingAvailable in + ).startStrict(next: { [weak self] hideStories, networkState, proxy, passcode, stateAndFilterId, isReorderingTabs, peerStatus, presentationData, storyPostingAvailable in guard let self else { return } self.updateChatList( + hideStories: hideStories, networkState: networkState, proxy: proxy, passcode: passcode, @@ -6624,6 +6634,7 @@ private final class ChatListLocationContext { } private func updateChatList( + hideStories: Bool, networkState: AccountNetworkState, proxy: (Bool, Bool), passcode: (Bool, Bool), @@ -6740,7 +6751,7 @@ private final class ChatListLocationContext { } } - if storyPostingAvailable { + if storyPostingAvailable && !hideStories { self.storyButton = AnyComponentWithIdentity(id: "story", component: AnyComponent(NavigationButtonComponent( content: .icon(imageName: "Chat List/AddStoryIcon"), pressed: { [weak self] _ in diff --git a/submodules/TelegramUI/Components/PeerInfo/PeerInfoScreen/BUILD b/submodules/TelegramUI/Components/PeerInfo/PeerInfoScreen/BUILD index 10129e58ea..ba39d7fd8e 100644 --- a/submodules/TelegramUI/Components/PeerInfo/PeerInfoScreen/BUILD +++ b/submodules/TelegramUI/Components/PeerInfo/PeerInfoScreen/BUILD @@ -6,23 +6,10 @@ sgdeps = [ "//Swiftgram/SGSimpleSettings:SGSimpleSettings", "//Swiftgram/SGRegDate:SGRegDate", - "//Swiftgram/SGRegDateScheme:SGRegDateScheme" + "//Swiftgram/SGRegDateScheme:SGRegDateScheme", + "//Swiftgram/SGDebugUI:SGDebugUI", ] -config_setting( - name = "debug_build", - values = { - "compilation_mode": "dbg", - }, -) - -flex_dependency = select({ - ":debug_build": [ - "@flex_sdk//:FLEX" - ], - "//conditions:default": [], -}) - swift_library( name = "PeerInfoScreen", @@ -33,7 +20,7 @@ swift_library( copts = [ "-warnings-as-errors", ], - deps = flex_dependency + sgdeps + [ + deps = sgdeps + [ "//submodules/AccountContext", "//submodules/AccountUtils", "//submodules/ActionSheetPeerItem", diff --git a/submodules/TelegramUI/Components/PeerInfo/PeerInfoScreen/Sources/PeerInfoScreen.swift b/submodules/TelegramUI/Components/PeerInfo/PeerInfoScreen/Sources/PeerInfoScreen.swift index b1f3f7e6d3..cc2183384c 100644 --- a/submodules/TelegramUI/Components/PeerInfo/PeerInfoScreen/Sources/PeerInfoScreen.swift +++ b/submodules/TelegramUI/Components/PeerInfo/PeerInfoScreen/Sources/PeerInfoScreen.swift @@ -1,7 +1,5 @@ // MARK: Swiftgram -#if DEBUG -import FLEX -#endif +import SGDebugUI import SGSimpleSettings import SGSettingsUI import SGStrings @@ -13186,19 +13184,10 @@ public final class PeerInfoScreenImpl: ViewController, PeerInfoScreen, KeyShortc items.append(.action(ContextMenuActionItem(text: "Swiftgram Debug", icon: { theme in return generateTintedImage(image: nil, color: theme.contextMenu.primaryColor) }, action: { [weak self] _, f in - guard let _ = self else { + guard let self = self else { return } - #if DEBUG - FLEXManager.shared.showExplorer() - #endif -// SGSimpleSettings.shared.hideReactions = !SGSimpleSettings.shared.hideReactions -// let _ = updateSGUISettings(engine: strongSelf.context.engine, { settings in -// var settings = settings -// settings.sendWithReturnKey = !settings.sendWithReturnKey -// print("New setting value \(settings.sendWithReturnKey)") -// return settings -// }).startStandalone() + self.push(sgDebugController(context: self.context)) f(.dismissWithoutContent) }))) @@ -14362,9 +14351,11 @@ extension PeerInfoScreenImpl { items.append(.action(ContextMenuActionItem(text: "Swiftgram Debug", icon: { theme in return generateTintedImage(image: nil, color: theme.contextMenu.primaryColor) }, action: { [weak self] _, f in - guard let _ = self else { + guard let self = self else { return } + self.push(sgDebugController(context: self.context)) + f(.dismissWithoutContent) }))) #endif