diff --git a/submodules/GraphCore/Sources/Helpers/TimeZone.swift b/submodules/GraphCore/Sources/Helpers/TimeZone.swift index 457ef9aec1..ff4b9038ce 100644 --- a/submodules/GraphCore/Sources/Helpers/TimeZone.swift +++ b/submodules/GraphCore/Sources/Helpers/TimeZone.swift @@ -35,7 +35,7 @@ extension DateFormatter { let formatter = DateFormatter() formatter.calendar = Calendar.utc formatter.dateFormat = format - formatter.timeZone = TimeZone.utc + formatter.timeZone = .current return formatter } } diff --git a/submodules/TelegramCore/Sources/PendingMessages/PendingMessageUploadedContent.swift b/submodules/TelegramCore/Sources/PendingMessages/PendingMessageUploadedContent.swift index 7025a9bed1..0c3352a210 100644 --- a/submodules/TelegramCore/Sources/PendingMessages/PendingMessageUploadedContent.swift +++ b/submodules/TelegramCore/Sources/PendingMessages/PendingMessageUploadedContent.swift @@ -56,7 +56,7 @@ func messageContentToUpload(accountPeerId: PeerId, network: Network, postbox: Po return messageContentToUpload(accountPeerId: accountPeerId, network: network, postbox: postbox, auxiliaryMethods: auxiliaryMethods, transformOutgoingMessageMedia: transformOutgoingMessageMedia, messageMediaPreuploadManager: messageMediaPreuploadManager, revalidationContext: revalidationContext, forceReupload: forceReupload, isGrouped: isGrouped, passFetchProgress: passFetchProgress, forceNoBigParts: false, peerId: message.id.peerId, messageId: message.id, attributes: message.attributes, text: message.text, media: message.media) } -func messageContentToUpload(accountPeerId: PeerId, network: Network, postbox: Postbox, auxiliaryMethods: AccountAuxiliaryMethods, transformOutgoingMessageMedia: TransformOutgoingMessageMedia?, messageMediaPreuploadManager: MessageMediaPreuploadManager, revalidationContext: MediaReferenceRevalidationContext, forceReupload: Bool, isGrouped: Bool, passFetchProgress: Bool, forceNoBigParts: Bool, peerId: PeerId, messageId: MessageId?, attributes: [MessageAttribute], text: String, media: [Media]) -> MessageContentToUpload { +func messageContentToUpload(accountPeerId: PeerId, network: Network, postbox: Postbox, auxiliaryMethods: AccountAuxiliaryMethods, transformOutgoingMessageMedia: TransformOutgoingMessageMedia?, messageMediaPreuploadManager: MessageMediaPreuploadManager, revalidationContext: MediaReferenceRevalidationContext, forceReupload: Bool, isGrouped: Bool, passFetchProgress: Bool, forceNoBigParts: Bool, peerId: PeerId, messageId: MessageId?, attributes: [MessageAttribute], text: String, media: [Media], mediaReference: AnyMediaReference? = nil) -> MessageContentToUpload { var contextResult: OutgoingChatContextResultMessageAttribute? var autoremoveMessageAttribute: AutoremoveTimeoutMessageAttribute? var autoclearMessageAttribute: AutoclearTimeoutMessageAttribute? @@ -110,14 +110,14 @@ func messageContentToUpload(accountPeerId: PeerId, network: Network, postbox: Po return .content(PendingMessageUploadedContentAndReuploadInfo(content: .media(.inputMediaWebPage(flags: flags, url: content.url), text), reuploadInfo: nil, cacheReferenceKey: nil)) } |> castError(PendingMessageUploadError.self), .text) - } else if let media = media.first, let mediaResult = mediaContentToUpload(accountPeerId: accountPeerId, network: network, postbox: postbox, auxiliaryMethods: auxiliaryMethods, transformOutgoingMessageMedia: transformOutgoingMessageMedia, messageMediaPreuploadManager: messageMediaPreuploadManager, revalidationContext: revalidationContext, forceReupload: forceReupload, isGrouped: isGrouped, passFetchProgress: passFetchProgress, forceNoBigParts: forceNoBigParts, peerId: peerId, media: media, text: text, autoremoveMessageAttribute: autoremoveMessageAttribute, autoclearMessageAttribute: autoclearMessageAttribute, messageId: messageId, attributes: attributes) { + } else if let media = media.first, let mediaResult = mediaContentToUpload(accountPeerId: accountPeerId, network: network, postbox: postbox, auxiliaryMethods: auxiliaryMethods, transformOutgoingMessageMedia: transformOutgoingMessageMedia, messageMediaPreuploadManager: messageMediaPreuploadManager, revalidationContext: revalidationContext, forceReupload: forceReupload, isGrouped: isGrouped, passFetchProgress: passFetchProgress, forceNoBigParts: forceNoBigParts, peerId: peerId, media: media, text: text, autoremoveMessageAttribute: autoremoveMessageAttribute, autoclearMessageAttribute: autoclearMessageAttribute, messageId: messageId, attributes: attributes, mediaReference: mediaReference) { return .signal(mediaResult, .media) } else { return .signal(.single(.content(PendingMessageUploadedContentAndReuploadInfo(content: .text(text), reuploadInfo: nil, cacheReferenceKey: nil))), .text) } } -func mediaContentToUpload(accountPeerId: PeerId, network: Network, postbox: Postbox, auxiliaryMethods: AccountAuxiliaryMethods, transformOutgoingMessageMedia: TransformOutgoingMessageMedia?, messageMediaPreuploadManager: MessageMediaPreuploadManager, revalidationContext: MediaReferenceRevalidationContext, forceReupload: Bool, isGrouped: Bool, passFetchProgress: Bool, forceNoBigParts: Bool, peerId: PeerId, media: Media, text: String, autoremoveMessageAttribute: AutoremoveTimeoutMessageAttribute?, autoclearMessageAttribute: AutoclearTimeoutMessageAttribute?, messageId: MessageId?, attributes: [MessageAttribute]) -> Signal? { +func mediaContentToUpload(accountPeerId: PeerId, network: Network, postbox: Postbox, auxiliaryMethods: AccountAuxiliaryMethods, transformOutgoingMessageMedia: TransformOutgoingMessageMedia?, messageMediaPreuploadManager: MessageMediaPreuploadManager, revalidationContext: MediaReferenceRevalidationContext, forceReupload: Bool, isGrouped: Bool, passFetchProgress: Bool, forceNoBigParts: Bool, peerId: PeerId, media: Media, text: String, autoremoveMessageAttribute: AutoremoveTimeoutMessageAttribute?, autoclearMessageAttribute: AutoclearTimeoutMessageAttribute?, messageId: MessageId?, attributes: [MessageAttribute], mediaReference: AnyMediaReference?) -> Signal? { if let image = media as? TelegramMediaImage, let largest = largestImageRepresentation(image.representations) { if peerId.namespace == Namespaces.Peer.SecretChat, let resource = largest.resource as? SecretFileMediaResource { return .single(.content(PendingMessageUploadedContentAndReuploadInfo(content: .secretMedia(.inputEncryptedFile(id: resource.fileId, accessHash: resource.accessHash), resource.decryptedSize, resource.key), reuploadInfo: nil, cacheReferenceKey: nil))) @@ -140,13 +140,15 @@ func mediaContentToUpload(accountPeerId: PeerId, network: Network, postbox: Post return uploadedMediaFileContent(network: network, postbox: postbox, auxiliaryMethods: auxiliaryMethods, transformOutgoingMessageMedia: transformOutgoingMessageMedia, messageMediaPreuploadManager: messageMediaPreuploadManager, forceReupload: true, isGrouped: isGrouped, passFetchProgress: false, forceNoBigParts: false, peerId: peerId, messageId: messageId, text: text, attributes: attributes, autoremoveMessageAttribute: autoremoveMessageAttribute, autoclearMessageAttribute: autoclearMessageAttribute, file: file) } else { if forceReupload { - let mediaReference: AnyMediaReference - if file.isSticker { - mediaReference = .standalone(media: file) + let finalMediaReference: AnyMediaReference + if let mediaReference = mediaReference { + finalMediaReference = mediaReference + } else if file.isSticker { + finalMediaReference = .standalone(media: file) } else { - mediaReference = .savedGif(media: file) + finalMediaReference = .savedGif(media: file) } - return revalidateMediaResourceReference(accountPeerId: accountPeerId, postbox: postbox, network: network, revalidationContext: revalidationContext, info: TelegramCloudMediaResourceFetchInfo(reference: mediaReference.resourceReference(file.resource), preferBackgroundReferenceRevalidation: false, continueInBackground: false), resource: resource) + return revalidateMediaResourceReference(accountPeerId: accountPeerId, postbox: postbox, network: network, revalidationContext: revalidationContext, info: TelegramCloudMediaResourceFetchInfo(reference: finalMediaReference.resourceReference(file.resource), preferBackgroundReferenceRevalidation: false, continueInBackground: false), resource: resource) |> mapError { _ -> PendingMessageUploadError in return .generic } diff --git a/submodules/TelegramCore/Sources/PendingMessages/RequestEditMessage.swift b/submodules/TelegramCore/Sources/PendingMessages/RequestEditMessage.swift index f58525cf85..bb4bf0d33d 100644 --- a/submodules/TelegramCore/Sources/PendingMessages/RequestEditMessage.swift +++ b/submodules/TelegramCore/Sources/PendingMessages/RequestEditMessage.swift @@ -63,7 +63,7 @@ private func requestEditMessageInternal(accountPeerId: PeerId, postbox: Postbox, if let webpagePreviewAttribute = webpagePreviewAttribute { attributes.append(webpagePreviewAttribute) } - return mediaContentToUpload(accountPeerId: accountPeerId, network: network, postbox: postbox, auxiliaryMethods: stateManager.auxiliaryMethods, transformOutgoingMessageMedia: transformOutgoingMessageMedia, messageMediaPreuploadManager: messageMediaPreuploadManager, revalidationContext: mediaReferenceRevalidationContext, forceReupload: forceReupload, isGrouped: false, passFetchProgress: false, forceNoBigParts: false, peerId: messageId.peerId, media: augmentedMedia, text: "", autoremoveMessageAttribute: nil, autoclearMessageAttribute: nil, messageId: nil, attributes: attributes) + return mediaContentToUpload(accountPeerId: accountPeerId, network: network, postbox: postbox, auxiliaryMethods: stateManager.auxiliaryMethods, transformOutgoingMessageMedia: transformOutgoingMessageMedia, messageMediaPreuploadManager: messageMediaPreuploadManager, revalidationContext: mediaReferenceRevalidationContext, forceReupload: forceReupload, isGrouped: false, passFetchProgress: false, forceNoBigParts: false, peerId: messageId.peerId, media: augmentedMedia, text: "", autoremoveMessageAttribute: nil, autoclearMessageAttribute: nil, messageId: nil, attributes: attributes, mediaReference: nil) } if let uploadSignal = generateUploadSignal(forceReupload) { uploadedMedia = .single(.progress(0.027)) diff --git a/submodules/TelegramCore/Sources/TelegramEngine/Messages/PendingStoryManager.swift b/submodules/TelegramCore/Sources/TelegramEngine/Messages/PendingStoryManager.swift index c57264f9ab..865182cda3 100644 --- a/submodules/TelegramCore/Sources/TelegramEngine/Messages/PendingStoryManager.swift +++ b/submodules/TelegramCore/Sources/TelegramEngine/Messages/PendingStoryManager.swift @@ -43,17 +43,14 @@ public extension Stories { private enum CodingKeys: String, CodingKey { case peerId = "peerId" case storyId = "storyId" - case isForwardingDisabled = "isForwardingDisabled" } public let peerId: EnginePeer.Id public let storyId: Int32 - public let isForwardingDisabled: Bool - public init(peerId: EnginePeer.Id, storyId: Int32, isForwardingDisabled: Bool) { + public init(peerId: EnginePeer.Id, storyId: Int32) { self.peerId = peerId self.storyId = storyId - self.isForwardingDisabled = isForwardingDisabled } public init(from decoder: Decoder) throws { @@ -61,7 +58,6 @@ public extension Stories { self.peerId = EnginePeer.Id(try container.decode(Int64.self, forKey: .peerId)) self.storyId = try container.decode(Int32.self, forKey: .storyId) - self.isForwardingDisabled = try container.decode(Bool.self, forKey: .isForwardingDisabled) } public func encode(to encoder: Encoder) throws { @@ -69,7 +65,6 @@ public extension Stories { try container.encode(self.peerId.toInt64(), forKey: .peerId) try container.encode(self.storyId, forKey: .storyId) - try container.encode(self.isForwardingDisabled, forKey: .isForwardingDisabled) } } diff --git a/submodules/TelegramCore/Sources/TelegramEngine/Messages/Stories.swift b/submodules/TelegramCore/Sources/TelegramEngine/Messages/Stories.swift index 27b4569911..ca94e3320d 100644 --- a/submodules/TelegramCore/Sources/TelegramEngine/Messages/Stories.swift +++ b/submodules/TelegramCore/Sources/TelegramEngine/Messages/Stories.swift @@ -839,7 +839,7 @@ private func prepareUploadStoryContent(account: Account, media: EngineStoryInput } } -private func uploadedStoryContent(postbox: Postbox, network: Network, media: Media, embeddedStickers: [TelegramMediaFile], accountPeerId: PeerId, messageMediaPreuploadManager: MessageMediaPreuploadManager, revalidationContext: MediaReferenceRevalidationContext, auxiliaryMethods: AccountAuxiliaryMethods, passFetchProgress: Bool) -> (signal: Signal, media: Media) { +private func uploadedStoryContent(postbox: Postbox, network: Network, media: Media, mediaReference: AnyMediaReference?, embeddedStickers: [TelegramMediaFile], accountPeerId: PeerId, messageMediaPreuploadManager: MessageMediaPreuploadManager, revalidationContext: MediaReferenceRevalidationContext, auxiliaryMethods: AccountAuxiliaryMethods, passFetchProgress: Bool) -> (signal: Signal, media: Media) { let originalMedia: Media = media let contentToUpload: MessageContentToUpload @@ -864,7 +864,8 @@ private func uploadedStoryContent(postbox: Postbox, network: Network, media: Med messageId: nil, attributes: attributes, text: "", - media: [media] + media: [media], + mediaReference: mediaReference ) let contentSignal: Signal @@ -1024,16 +1025,28 @@ func _internal_uploadStoryImpl( randomId: Int64, forwardInfo: Stories.PendingForwardInfo? ) -> Signal { - return postbox.transaction { transaction -> Api.InputPeer? in - return transaction.getPeer(toPeerId).flatMap(apiInputPeer) + return postbox.transaction { transaction -> (Peer, Peer?)? in + if let peer = transaction.getPeer(toPeerId) { + if let forwardInfo = forwardInfo { + return (peer, transaction.getPeer(forwardInfo.peerId)) + } else { + return (peer, nil) + } + } + return nil } - |> mapToSignal { inputPeer -> Signal in - guard let inputPeer = inputPeer else { + |> mapToSignal { inputPeerAndForwardInfoPeer -> Signal in + guard let (inputPeer, forwardInfoPeer) = inputPeerAndForwardInfoPeer, let inputPeer = apiInputPeer(inputPeer) else { return .single(.completed(nil)) } + var mediaReference: AnyMediaReference? + if let forwardInfo = forwardInfo, let forwardInfoPeer = forwardInfoPeer.flatMap(PeerReference.init) { + mediaReference = .story(peer: forwardInfoPeer, id: forwardInfo.storyId, media: media) + } + let passFetchProgress = media is TelegramMediaFile - let (contentSignal, originalMedia) = uploadedStoryContent(postbox: postbox, network: network, media: media, embeddedStickers: embeddedStickers, accountPeerId: accountPeerId, messageMediaPreuploadManager: messageMediaPreuploadManager, revalidationContext: revalidationContext, auxiliaryMethods: auxiliaryMethods, passFetchProgress: passFetchProgress) + let (contentSignal, originalMedia) = uploadedStoryContent(postbox: postbox, network: network, media: media, mediaReference: mediaReference, embeddedStickers: embeddedStickers, accountPeerId: accountPeerId, messageMediaPreuploadManager: messageMediaPreuploadManager, revalidationContext: revalidationContext, auxiliaryMethods: auxiliaryMethods, passFetchProgress: passFetchProgress) return contentSignal |> mapToSignal { result -> Signal in switch result { @@ -1209,7 +1222,7 @@ func _internal_editStory(account: Account, peerId: PeerId, id: Int32, media: Eng if case .video = media { passFetchProgress = true } - (contentSignal, originalMedia) = uploadedStoryContent(postbox: account.postbox, network: account.network, media: prepareUploadStoryContent(account: account, media: media), embeddedStickers: media.embeddedStickers, accountPeerId: account.peerId, messageMediaPreuploadManager: account.messageMediaPreuploadManager, revalidationContext: account.mediaReferenceRevalidationContext, auxiliaryMethods: account.auxiliaryMethods, passFetchProgress: passFetchProgress) + (contentSignal, originalMedia) = uploadedStoryContent(postbox: account.postbox, network: account.network, media: prepareUploadStoryContent(account: account, media: media), mediaReference: nil, embeddedStickers: media.embeddedStickers, accountPeerId: account.peerId, messageMediaPreuploadManager: account.messageMediaPreuploadManager, revalidationContext: account.mediaReferenceRevalidationContext, auxiliaryMethods: account.auxiliaryMethods, passFetchProgress: passFetchProgress) } else { contentSignal = .single(nil) originalMedia = nil diff --git a/submodules/TelegramStringFormatting/Sources/PresenceStrings.swift b/submodules/TelegramStringFormatting/Sources/PresenceStrings.swift index d790dddb53..b8f5bbd3db 100644 --- a/submodules/TelegramStringFormatting/Sources/PresenceStrings.swift +++ b/submodules/TelegramStringFormatting/Sources/PresenceStrings.swift @@ -454,9 +454,9 @@ public func stringForStoryActivityTimestamp(strings: PresentationStrings, dateTi let dayDifference = timeinfo.tm_yday - timeinfoNow.tm_yday if dayDifference == 0 || dayDifference == -1 { let day: RelativeTimestampFormatDay - if dayDifference == 0 { - let minutes = difference / (60 * 60) - return short ? strings.ShortTime_HoursAgo(minutes) : strings.Time_HoursAgo(minutes) + if dayDifference == 0 || short { + let hours = difference / (60 * 60) + return short ? strings.ShortTime_HoursAgo(hours) : strings.Time_HoursAgo(hours) } else { day = .yesterday } diff --git a/submodules/TelegramUI/Components/MediaEditorScreen/Sources/MediaEditorScreen.swift b/submodules/TelegramUI/Components/MediaEditorScreen/Sources/MediaEditorScreen.swift index f3ab7e5434..3c671cef21 100644 --- a/submodules/TelegramUI/Components/MediaEditorScreen/Sources/MediaEditorScreen.swift +++ b/submodules/TelegramUI/Components/MediaEditorScreen/Sources/MediaEditorScreen.swift @@ -1034,7 +1034,8 @@ final class MediaEditorScreenComponent: Component { authorName: authorName, text: forwardStory.text, isChannel: forwardAuthor.id.isGroupOrChannel, - isVibrant: true + isVibrant: true, + fillsWidth: true ) ) } diff --git a/submodules/TelegramUI/Components/MessageInputPanelComponent/Sources/MessageInputPanelComponent.swift b/submodules/TelegramUI/Components/MessageInputPanelComponent/Sources/MessageInputPanelComponent.swift index 3cf84f4c46..20378991c8 100644 --- a/submodules/TelegramUI/Components/MessageInputPanelComponent/Sources/MessageInputPanelComponent.swift +++ b/submodules/TelegramUI/Components/MessageInputPanelComponent/Sources/MessageInputPanelComponent.swift @@ -340,6 +340,9 @@ public final class MessageInputPanelComponent: Component { if (lhs.moreAction == nil) != (rhs.moreAction == nil) { return false } + if (lhs.setMediaRecordingActive == nil) != (rhs.setMediaRecordingActive == nil) { + return false + } if lhs.hideKeyboard != rhs.hideKeyboard { return false } diff --git a/submodules/TelegramUI/Components/Stories/ForwardInfoPanelComponent/Sources/ForwardInfoPanelComponent.swift b/submodules/TelegramUI/Components/Stories/ForwardInfoPanelComponent/Sources/ForwardInfoPanelComponent.swift index c4fadcd075..975b044bed 100644 --- a/submodules/TelegramUI/Components/Stories/ForwardInfoPanelComponent/Sources/ForwardInfoPanelComponent.swift +++ b/submodules/TelegramUI/Components/Stories/ForwardInfoPanelComponent/Sources/ForwardInfoPanelComponent.swift @@ -10,17 +10,20 @@ public final class ForwardInfoPanelComponent: Component { public let text: String public let isChannel: Bool public let isVibrant: Bool + public let fillsWidth: Bool public init( authorName: String, text: String, isChannel: Bool, - isVibrant: Bool + isVibrant: Bool, + fillsWidth: Bool ) { self.authorName = authorName self.text = text self.isChannel = isChannel self.isVibrant = isVibrant + self.fillsWidth = fillsWidth } public static func ==(lhs: ForwardInfoPanelComponent, rhs: ForwardInfoPanelComponent) -> Bool { @@ -36,6 +39,9 @@ public final class ForwardInfoPanelComponent: Component { if lhs.isVibrant != rhs.isVibrant { return false } + if lhs.fillsWidth != rhs.fillsWidth { + return false + } return true } @@ -80,24 +86,6 @@ public final class ForwardInfoPanelComponent: Component { self.component = component self.state = state - let size = CGSize(width: availableSize.width, height: 40.0) - - let lineColor: UIColor - if !component.isVibrant { -// self.blurBackgroundView.update(size: size, cornerRadius: 4.0, transition: .immediate) - self.blurBackgroundView.frame = CGRect(origin: .zero, size: size) - self.insertSubview(self.blurBackgroundView, at: 0) - - lineColor = UIColor.white - } else { - lineColor = UIColor(white: 1.0, alpha: 0.5) - } - - self.blockView.update(size: size, isTransparent: true, primaryColor: lineColor, secondaryColor: nil, thirdColor: nil, backgroundColor: nil, pattern: nil, animation: .None) - self.blockView.frame = CGRect(origin: .zero, size: size) - - - var titleOffset: CGFloat = 0.0 if component.isChannel { let iconView: UIImageView @@ -118,6 +106,7 @@ public final class ForwardInfoPanelComponent: Component { iconView.removeFromSuperview() } + let sideInset: CGFloat = 9.0 let titleSize = self.title.update( transition: .immediate, component: AnyComponent(MultilineTextComponent( @@ -131,7 +120,7 @@ public final class ForwardInfoPanelComponent: Component { environment: {}, containerSize: CGSize(width: availableSize.width - titleOffset - 20.0, height: availableSize.height) ) - let titleFrame = CGRect(origin: CGPoint(x: 9.0 + titleOffset, y: 3.0), size: titleSize) + let titleFrame = CGRect(origin: CGPoint(x: sideInset + titleOffset, y: 3.0), size: titleSize) if let view = self.title.view { if view.superview == nil { self.addSubview(view) @@ -152,7 +141,7 @@ public final class ForwardInfoPanelComponent: Component { environment: {}, containerSize: CGSize(width: availableSize.width - 20.0, height: availableSize.height) ) - let textFrame = CGRect(origin: CGPoint(x: 9.0, y: 20.0), size: textSize) + let textFrame = CGRect(origin: CGPoint(x: sideInset, y: 20.0), size: textSize) if let view = self.text.view { if view.superview == nil { self.addSubview(view) @@ -160,6 +149,27 @@ public final class ForwardInfoPanelComponent: Component { view.frame = textFrame } + let size: CGSize + if component.fillsWidth { + size = CGSize(width: availableSize.width, height: 40.0) + } else { + size = CGSize(width: max(titleFrame.maxX, textFrame.maxX) + sideInset, height: 40.0) + } + + let lineColor: UIColor + if !component.isVibrant { +// self.blurBackgroundView.update(size: size, cornerRadius: 4.0, transition: .immediate) + self.blurBackgroundView.frame = CGRect(origin: .zero, size: size) + self.insertSubview(self.blurBackgroundView, at: 0) + + lineColor = UIColor.white + } else { + lineColor = UIColor(white: 1.0, alpha: 0.5) + } + + self.blockView.update(size: size, isTransparent: true, primaryColor: lineColor, secondaryColor: nil, thirdColor: nil, backgroundColor: nil, pattern: nil, animation: .None) + self.blockView.frame = CGRect(origin: .zero, size: size) + return size } } diff --git a/submodules/TelegramUI/Components/Stories/StoryContainerScreen/Sources/StoryAuthorInfoComponent.swift b/submodules/TelegramUI/Components/Stories/StoryContainerScreen/Sources/StoryAuthorInfoComponent.swift index aba5fa1306..adff85b989 100644 --- a/submodules/TelegramUI/Components/Stories/StoryContainerScreen/Sources/StoryAuthorInfoComponent.swift +++ b/submodules/TelegramUI/Components/Stories/StoryContainerScreen/Sources/StoryAuthorInfoComponent.swift @@ -104,6 +104,7 @@ final class StoryAuthorInfoComponent: Component { let titleColor = UIColor.white let subtitleColor = UIColor(white: 1.0, alpha: 0.8) let subtitle: NSAttributedString + let subtitleTruncationType: CTLineTruncationType if let forwardInfo = component.forwardInfo { let authorName: String switch forwardInfo { @@ -117,6 +118,7 @@ final class StoryAuthorInfoComponent: Component { combinedString.append(NSAttributedString(string: authorName, font: Font.medium(11.0), textColor: titleColor)) combinedString.append(NSAttributedString(string: " • \(timeString)", font: Font.regular(11.0), textColor: subtitleColor)) subtitle = combinedString + subtitleTruncationType = .middle } else { var subtitleString = stringForStoryActivityTimestamp(strings: presentationData.strings, dateTimeFormat: presentationData.dateTimeFormat, preciseTime: true, relativeTimestamp: component.timestamp, relativeTo: timestamp) if component.isEdited { @@ -124,6 +126,7 @@ final class StoryAuthorInfoComponent: Component { subtitleString.append(component.strings.Story_HeaderEdited) } subtitle = NSAttributedString(string: subtitleString, font: Font.regular(11.0), textColor: subtitleColor) + subtitleTruncationType = .end } let titleSize = self.title.update( @@ -140,7 +143,7 @@ final class StoryAuthorInfoComponent: Component { transition: .immediate, component: AnyComponent(MultilineTextComponent( text: .plain(subtitle), - truncationType: .end, + truncationType: subtitleTruncationType, maximumNumberOfLines: 1 )), environment: {}, diff --git a/submodules/TelegramUI/Components/Stories/StoryContainerScreen/Sources/StoryChatContent.swift b/submodules/TelegramUI/Components/Stories/StoryContainerScreen/Sources/StoryChatContent.swift index 9107995366..bc2cc04e10 100644 --- a/submodules/TelegramUI/Components/Stories/StoryContainerScreen/Sources/StoryChatContent.swift +++ b/submodules/TelegramUI/Components/Stories/StoryContainerScreen/Sources/StoryChatContent.swift @@ -113,12 +113,7 @@ public final class StoryContentContextImpl: StoryContentContext { if let stateView = views.views[PostboxViewKey.storiesState(key: .local)] as? StoryStatesView, let localState = stateView.value?.get(Stories.LocalState.self) { for item in localState.items { if let forwardInfo = item.forwardInfo, let peer = transaction.getPeer(forwardInfo.peerId) { - let peer = EnginePeer(peer) - if forwardInfo.isForwardingDisabled { - pendingForwardsInfo[item.randomId] = .unknown(name: peer.compactDisplayTitle) - } else { - pendingForwardsInfo[item.randomId] = .known(peer: peer, storyId: forwardInfo.storyId) - } + pendingForwardsInfo[item.randomId] = .known(peer: EnginePeer(peer), storyId: forwardInfo.storyId) } } } diff --git a/submodules/TelegramUI/Components/Stories/StoryContainerScreen/Sources/StoryContentCaptionComponent.swift b/submodules/TelegramUI/Components/Stories/StoryContainerScreen/Sources/StoryContentCaptionComponent.swift index fe13b584ce..3d61f1101a 100644 --- a/submodules/TelegramUI/Components/Stories/StoryContainerScreen/Sources/StoryContentCaptionComponent.swift +++ b/submodules/TelegramUI/Components/Stories/StoryContainerScreen/Sources/StoryContentCaptionComponent.swift @@ -678,7 +678,8 @@ final class StoryContentCaptionComponent: Component { authorName: authorName, text: "Story", isChannel: isChannel, - isVibrant: false + isVibrant: false, + fillsWidth: false ) ), environment: {}, diff --git a/submodules/TelegramUI/Components/Stories/StoryContainerScreen/Sources/StoryItemSetContainerComponent.swift b/submodules/TelegramUI/Components/Stories/StoryContainerScreen/Sources/StoryItemSetContainerComponent.swift index 65cebc254a..021e119546 100644 --- a/submodules/TelegramUI/Components/Stories/StoryContainerScreen/Sources/StoryItemSetContainerComponent.swift +++ b/submodules/TelegramUI/Components/Stories/StoryContainerScreen/Sources/StoryItemSetContainerComponent.swift @@ -5222,11 +5222,12 @@ public final class StoryItemSetContainerComponent: Component { if case let .user(user) = peer { externalState.isPeerArchived = user.storiesHidden ?? false + } else if case let .channel(channel) = peer { externalState.isPeerArchived = channel.storiesHidden ?? false } - let forwardInfo = Stories.PendingForwardInfo(peerId: component.slice.peer.id, storyId: item.id, isForwardingDisabled: item.isForwardingDisabled) + let forwardInfo = Stories.PendingForwardInfo(peerId: component.slice.peer.id, storyId: item.id) if let rootController = context.sharedContext.mainWindow?.viewController as? TelegramRootControllerInterface { var existingMedia: EngineMedia? diff --git a/submodules/TelegramUI/Components/Stories/StoryContainerScreen/Sources/StoryItemSetContainerViewSendMessage.swift b/submodules/TelegramUI/Components/Stories/StoryContainerScreen/Sources/StoryItemSetContainerViewSendMessage.swift index 2e7b084f9a..cd9d8d1231 100644 --- a/submodules/TelegramUI/Components/Stories/StoryContainerScreen/Sources/StoryItemSetContainerViewSendMessage.swift +++ b/submodules/TelegramUI/Components/Stories/StoryContainerScreen/Sources/StoryItemSetContainerViewSendMessage.swift @@ -1041,11 +1041,13 @@ final class StoryItemSetContainerSendMessage { immediateExternalShare: false, forceTheme: defaultDarkColorPresentationTheme ) - shareController.shareStory = { [weak view] in - guard let view else { - return + if !component.slice.peer.isService { + shareController.shareStory = { [weak view] in + guard let view else { + return + } + view.openStoryEditing(repost: true) } - view.openStoryEditing(repost: true) } shareController.completed = { [weak view] peerIds in guard let view, let component = view.component else {