From 4166bae2e24f0b6d85e82f4e4d8e02692649a2ca Mon Sep 17 00:00:00 2001 From: Ilya Laktyushin Date: Wed, 9 Aug 2023 02:31:08 +0200 Subject: [PATCH] Various fixes --- .../Sources/State/UserLimitsConfiguration.swift | 4 ++-- .../StoryItemSetContainerViewSendMessage.swift | 16 +++++++++++++++- .../TelegramUI/Sources/AccountContext.swift | 10 +++------- 3 files changed, 20 insertions(+), 10 deletions(-) diff --git a/submodules/TelegramCore/Sources/State/UserLimitsConfiguration.swift b/submodules/TelegramCore/Sources/State/UserLimitsConfiguration.swift index 0391b18969..af50a6472d 100644 --- a/submodules/TelegramCore/Sources/State/UserLimitsConfiguration.swift +++ b/submodules/TelegramCore/Sources/State/UserLimitsConfiguration.swift @@ -117,7 +117,7 @@ extension UserLimitsConfiguration { self.maxReactionsPerMessage = getValue("reactions_user_max", orElse: 1) self.maxSharedFolderInviteLinks = getValue("chatlist_invites_limit", orElse: isPremium ? 100 : 3) self.maxSharedFolderJoin = getValue("chatlists_joined_limit", orElse: isPremium ? 100 : 2) - self.maxStoryCaptionLength = getGeneralValue("story_caption_length_limit", orElse: defaultValue.maxStoryCaptionLength) - self.maxExpiringStoriesCount = getGeneralValue("story_expiring_limit", orElse: defaultValue.maxExpiringStoriesCount) + self.maxStoryCaptionLength = getValue("story_caption_length_limit", orElse: defaultValue.maxStoryCaptionLength) + self.maxExpiringStoriesCount = getValue("story_expiring_limit", orElse: defaultValue.maxExpiringStoriesCount) } } diff --git a/submodules/TelegramUI/Components/Stories/StoryContainerScreen/Sources/StoryItemSetContainerViewSendMessage.swift b/submodules/TelegramUI/Components/Stories/StoryContainerScreen/Sources/StoryItemSetContainerViewSendMessage.swift index 5f873e2134..dd72cef086 100644 --- a/submodules/TelegramUI/Components/Stories/StoryContainerScreen/Sources/StoryItemSetContainerViewSendMessage.swift +++ b/submodules/TelegramUI/Components/Stories/StoryContainerScreen/Sources/StoryItemSetContainerViewSendMessage.swift @@ -3108,8 +3108,22 @@ final class StoryItemSetContainerSendMessage { case let .venue(_, venue): let subject = EngineMessage(stableId: 0, stableVersion: 0, id: EngineMessage.Id(peerId: PeerId(0), namespace: 0, id: 0), globallyUniqueId: nil, groupingKey: nil, groupInfo: nil, threadId: nil, timestamp: 0, flags: [], tags: [], globalTags: [], localTags: [], forwardInfo: nil, author: nil, text: "", attributes: [], media: [.geo(TelegramMediaMap(latitude: venue.latitude, longitude: venue.longitude, heading: nil, accuracyRadius: nil, geoPlace: nil, venue: venue.venue, liveBroadcastingTimeout: nil, liveProximityNotificationRadius: nil))], peers: [:], associatedMessages: [:], associatedMessageIds: [], associatedMedia: [:], associatedThreadInfo: nil, associatedStories: [:]) + let context = component.context actions.append(ContextMenuAction(content: .textWithIcon(title: "View Location", icon: generateTintedImage(image: UIImage(bundleImageName: "Settings/TextArrowRight"), color: .white)), action: { [weak controller, weak view] in - let locationController = LocationViewController(context: component.context, updatedPresentationData: updatedPresentationData, subject: subject, isStoryLocation: true, params: LocationViewParams(sendLiveLocation: { _ in }, stopLiveLocation: { _ in }, openUrl: { _ in }, openPeer: { _ in })) + let locationController = LocationViewController( + context: context, + updatedPresentationData: updatedPresentationData, + subject: subject, + isStoryLocation: true, + params: LocationViewParams( + sendLiveLocation: { _ in }, + stopLiveLocation: { _ in }, + openUrl: { url in + context.sharedContext.applicationBindings.openUrl(url) + }, + openPeer: { _ in } + ) + ) view?.updateModalTransitionFactor(1.0, transition: .animated(duration: 0.5, curve: .spring)) locationController.dismissed = { [weak view] in view?.updateModalTransitionFactor(0.0, transition: .animated(duration: 0.5, curve: .spring)) diff --git a/submodules/TelegramUI/Sources/AccountContext.swift b/submodules/TelegramUI/Sources/AccountContext.swift index 8bda5b9955..751d5d04c2 100644 --- a/submodules/TelegramUI/Sources/AccountContext.swift +++ b/submodules/TelegramUI/Sources/AccountContext.swift @@ -379,13 +379,9 @@ public final class AccountContextImpl: AccountContext { strongSelf.animatedEmojiStickersValue.set(.single(stickers)) }) - self.userLimitsConfigurationDisposable = (self.account.postbox.peerView(id: self.account.peerId) - |> mapToSignal { peerView -> Signal in - if let peer = peerView.peers[peerView.peerId] { - return self.engine.data.subscribe(TelegramEngine.EngineData.Item.Configuration.UserLimits(isPremium: peer.isPremium)) - } else { - return .complete() - } + self.userLimitsConfigurationDisposable = (self.engine.data.subscribe(TelegramEngine.EngineData.Item.Peer.Peer(id: account.peerId)) + |> mapToSignal { peer -> Signal in + return self.engine.data.subscribe(TelegramEngine.EngineData.Item.Configuration.UserLimits(isPremium: peer?.isPremium ?? false)) } |> deliverOnMainQueue).start(next: { [weak self] value in guard let strongSelf = self else {