From 42e2576dce78c2eade62a34ba90900fa257f6917 Mon Sep 17 00:00:00 2001 From: Ilya Laktyushin Date: Mon, 18 Dec 2023 02:31:48 +0400 Subject: [PATCH] Various fixes --- .../Sources/ShareControllerNode.swift | 2 +- .../Sources/SharePeersContainerNode.swift | 4 ++-- .../State/UserLimitsConfiguration.swift | 2 +- .../Sources/MediaEditorScreen.swift | 21 ++++++++++++++++--- .../TelegramUI/Sources/ChatController.swift | 2 +- 5 files changed, 23 insertions(+), 8 deletions(-) diff --git a/submodules/ShareController/Sources/ShareControllerNode.swift b/submodules/ShareController/Sources/ShareControllerNode.swift index 647108975e..c21786a1e8 100644 --- a/submodules/ShareController/Sources/ShareControllerNode.swift +++ b/submodules/ShareController/Sources/ShareControllerNode.swift @@ -1074,7 +1074,7 @@ final class ShareControllerNode: ViewControllerTracingNode, UIScrollViewDelegate self?.switchToAnotherAccount?() }, debugAction: { [weak self] in self?.debugAction?() - }, extendedInitialReveal: self.presetText != nil, segmentedValues: self.segmentedValues) + }, extendedInitialReveal: self.presetText != nil, segmentedValues: self.segmentedValues, fromPublicChannel: self.fromPublicChannel) self.peersContentNode = peersContentNode peersContentNode.openSearch = { [weak self] in let _ = (_internal_recentlySearchedPeers(postbox: context.stateManager.postbox) diff --git a/submodules/ShareController/Sources/SharePeersContainerNode.swift b/submodules/ShareController/Sources/SharePeersContainerNode.swift index c9d7851fa3..15eaac5cd5 100644 --- a/submodules/ShareController/Sources/SharePeersContainerNode.swift +++ b/submodules/ShareController/Sources/SharePeersContainerNode.swift @@ -145,7 +145,7 @@ final class SharePeersContainerNode: ASDisplayNode, ShareContentContainerNode { } private let tick = ValuePromise(0) - init(environment: ShareControllerEnvironment, context: ShareControllerAccountContext, switchableAccounts: [ShareControllerSwitchableAccount], theme: PresentationTheme, strings: PresentationStrings, nameDisplayOrder: PresentationPersonNameOrder, peers: [(EngineRenderedPeer, EnginePeer.Presence?)], accountPeer: EnginePeer, controllerInteraction: ShareControllerInteraction, externalShare: Bool, switchToAnotherAccount: @escaping () -> Void, debugAction: @escaping () -> Void, extendedInitialReveal: Bool, segmentedValues: [ShareControllerSegmentedValue]?) { + init(environment: ShareControllerEnvironment, context: ShareControllerAccountContext, switchableAccounts: [ShareControllerSwitchableAccount], theme: PresentationTheme, strings: PresentationStrings, nameDisplayOrder: PresentationPersonNameOrder, peers: [(EngineRenderedPeer, EnginePeer.Presence?)], accountPeer: EnginePeer, controllerInteraction: ShareControllerInteraction, externalShare: Bool, switchToAnotherAccount: @escaping () -> Void, debugAction: @escaping () -> Void, extendedInitialReveal: Bool, segmentedValues: [ShareControllerSegmentedValue]?, fromPublicChannel: Bool) { self.environment = environment self.context = context self.theme = theme @@ -170,7 +170,7 @@ final class SharePeersContainerNode: ASDisplayNode, ShareContentContainerNode { var index: Int32 = 0 if canShareStory { - entries.append(SharePeerEntry(index: index, item: .story(isMessage: false), theme: theme, strings: strings)) + entries.append(SharePeerEntry(index: index, item: .story(isMessage: fromPublicChannel), theme: theme, strings: strings)) index += 1 } diff --git a/submodules/TelegramCore/Sources/State/UserLimitsConfiguration.swift b/submodules/TelegramCore/Sources/State/UserLimitsConfiguration.swift index 6735c5c129..d833c3e2a9 100644 --- a/submodules/TelegramCore/Sources/State/UserLimitsConfiguration.swift +++ b/submodules/TelegramCore/Sources/State/UserLimitsConfiguration.swift @@ -51,7 +51,7 @@ public struct UserLimitsConfiguration: Equatable { maxStoriesSuggestedReactions: 1, maxGiveawayChannelsCount: 10, maxGiveawayCountriesCount: 10, - maxGiveawayPeriodSeconds: 86400 * 7, + maxGiveawayPeriodSeconds: 86400 * 31, maxChannelRecommendationsCount: 10 ) } diff --git a/submodules/TelegramUI/Components/MediaEditorScreen/Sources/MediaEditorScreen.swift b/submodules/TelegramUI/Components/MediaEditorScreen/Sources/MediaEditorScreen.swift index 9ce3a9ab84..5ad6be4099 100644 --- a/submodules/TelegramUI/Components/MediaEditorScreen/Sources/MediaEditorScreen.swift +++ b/submodules/TelegramUI/Components/MediaEditorScreen/Sources/MediaEditorScreen.swift @@ -2087,6 +2087,8 @@ public final class MediaEditorScreen: ViewController, UIDropInteractionDelegate private var presentationData: PresentationData private var validLayout: ContainerViewLayout? + private let readyValue = Promise() + init(controller: MediaEditorScreen) { self.controller = controller self.context = controller.context @@ -2360,6 +2362,11 @@ public final class MediaEditorScreen: ViewController, UIDropInteractionDelegate } } + if case .message = subject { + } else { + self.readyValue.set(.single(true)) + } + if case let .image(_, _, additionalImage, position) = subject, let additionalImage { let image = generateImage(CGSize(width: additionalImage.size.width, height: additionalImage.size.width), contextGenerator: { size, context in let bounds = CGRect(origin: .zero, size: size) @@ -2422,9 +2429,10 @@ public final class MediaEditorScreen: ViewController, UIDropInteractionDelegate messageEntity.scale = 3.3 * fraction self.entitiesView.add(messageEntity, announce: false) + + self.readyValue.set(.single(true)) }) }) - } self.gradientColorsDisposable = mediaEditor.gradientColors.start(next: { [weak self] colors in @@ -4088,7 +4096,14 @@ public final class MediaEditorScreen: ViewController, UIDropInteractionDelegate controller.presentationContext.containerLayoutUpdated(layout, transition: transition.containedViewLayoutTransition) if isFirstTime { - self.animateIn() + self.isHidden = true + let _ = (self.readyValue.get() + |> take(1)).start(next: { [weak self] _ in + if let self { + self.isHidden = false + self.animateIn() + } + }) } } } @@ -4221,7 +4236,7 @@ public final class MediaEditorScreen: ViewController, UIDropInteractionDelegate private var audioSessionDisposable: Disposable? private let postingAvailabilityPromise = Promise() private var postingAvailabilityDisposable: Disposable? - + public init( context: AccountContext, subject: Signal, diff --git a/submodules/TelegramUI/Sources/ChatController.swift b/submodules/TelegramUI/Sources/ChatController.swift index 5eba98702a..baff4f5502 100644 --- a/submodules/TelegramUI/Sources/ChatController.swift +++ b/submodules/TelegramUI/Sources/ChatController.swift @@ -2432,7 +2432,7 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G guard let self else { return } - Queue.mainQueue().after(0.1) { + Queue.mainQueue().after(0.05) { self.openStorySharing(messages: messages) } }