diff --git a/submodules/Components/ReactionListContextMenuContent/Sources/ReactionListContextMenuContent.swift b/submodules/Components/ReactionListContextMenuContent/Sources/ReactionListContextMenuContent.swift index 624fab38f2..39a023e72a 100644 --- a/submodules/Components/ReactionListContextMenuContent/Sources/ReactionListContextMenuContent.swift +++ b/submodules/Components/ReactionListContextMenuContent/Sources/ReactionListContextMenuContent.swift @@ -353,6 +353,7 @@ public final class ReactionListContextMenuContent: ContextControllerItemsContent } private static let readIconImage: UIImage? = generateTintedImage(image: UIImage(bundleImageName: "Chat/Message/MenuReadIcon"), color: .white)?.withRenderingMode(.alwaysTemplate) + private static let reactionIconImage: UIImage? = generateTintedImage(image: UIImage(bundleImageName: "Chat/Message/MenuReactionIcon"), color: .white)?.withRenderingMode(.alwaysTemplate) private final class ReactionsTabNode: ASDisplayNode, UIScrollViewDelegate { private final class ItemNode: HighlightTrackingButtonNode { @@ -643,6 +644,9 @@ public final class ReactionListContextMenuContent: ContextControllerItemsContent let textFrame = CGRect(origin: CGPoint(x: titleFrame.minX + floor(textFontFraction * 18.0), y: titleFrame.maxY + textSpacing), size: textSize) self.textLabelNode.frame = textFrame + + self.readIconView.image = item.timestampIsReaction ? ReactionListContextMenuContent.reactionIconImage : ReactionListContextMenuContent.readIconImage + if let readImage = self.readIconView.image { self.readIconView.tintColor = presentationData.theme.contextMenu.secondaryColor let fraction: CGFloat = textFontFraction @@ -694,7 +698,7 @@ public final class ReactionListContextMenuContent: ContextControllerItemsContent for peer in readStats.peers { if !existingPeers.contains(peer.id) { existingPeers.insert(peer.id) - mergedItems.append(EngineMessageReactionListContext.Item(peer: peer, reaction: nil, timestamp: readStats.readTimestamps[peer.id])) + mergedItems.append(EngineMessageReactionListContext.Item(peer: peer, reaction: nil, timestamp: readStats.readTimestamps[peer.id], timestampIsReaction: false)) } } } diff --git a/submodules/GalleryUI/Sources/Items/UniversalVideoGalleryItem.swift b/submodules/GalleryUI/Sources/Items/UniversalVideoGalleryItem.swift index 0158cdf4a5..39da60db97 100644 --- a/submodules/GalleryUI/Sources/Items/UniversalVideoGalleryItem.swift +++ b/submodules/GalleryUI/Sources/Items/UniversalVideoGalleryItem.swift @@ -2629,11 +2629,14 @@ final class UniversalVideoGalleryItemNode: ZoomableContentGalleryItemNode { let sliderValuePromise = ValuePromise(nil) items.append(.custom(SliderContextItem(minValue: 0.2, maxValue: 2.5, value: status.baseRate, valueChanged: { [weak self] newValue, _ in - guard let strongSelf = self else { + guard let strongSelf = self, let videoNode = strongSelf.videoNode else { return } let newValue = normalizeValue(newValue) - strongSelf.updatePlaybackRate(newValue) + videoNode.setBaseRate(newValue) + if let controller = strongSelf.galleryController() as? GalleryController { + controller.updateSharedPlaybackRate(newValue) + } sliderValuePromise.set(newValue) }), true)) @@ -2656,7 +2659,6 @@ final class UniversalVideoGalleryItemNode: ZoomableContentGalleryItemNode { } videoNode.setBaseRate(rate) - if let controller = strongSelf.galleryController() as? GalleryController { controller.updateSharedPlaybackRate(rate) } diff --git a/submodules/TelegramCore/Sources/State/ApplyUpdateMessage.swift b/submodules/TelegramCore/Sources/State/ApplyUpdateMessage.swift index 0ddf59afbe..701e55b066 100644 --- a/submodules/TelegramCore/Sources/State/ApplyUpdateMessage.swift +++ b/submodules/TelegramCore/Sources/State/ApplyUpdateMessage.swift @@ -26,10 +26,10 @@ func applyMediaResourceChanges(from: Media, to: Media, postbox: Postbox, force: } } if let fromLargestRepresentation = largestImageRepresentation(fromImage.representations), let toLargestRepresentation = largestImageRepresentation(toImage.representations) { - if fromLargestRepresentation.progressiveSizes != toLargestRepresentation.progressiveSizes { - } else { + /*if fromLargestRepresentation.progressiveSizes != toLargestRepresentation.progressiveSizes { + } else {*/ copyOrMoveResourceData(from: fromLargestRepresentation.resource, to: toLargestRepresentation.resource, mediaBox: postbox.mediaBox) - } + //} } } else if let fromFile = from as? TelegramMediaFile, let toFile = to as? TelegramMediaFile { if let fromPreview = smallestImageRepresentation(fromFile.previewRepresentations), let toPreview = smallestImageRepresentation(toFile.previewRepresentations) { diff --git a/submodules/TelegramCore/Sources/State/MessageReactions.swift b/submodules/TelegramCore/Sources/State/MessageReactions.swift index ad811dbec4..5a0dabd7f8 100644 --- a/submodules/TelegramCore/Sources/State/MessageReactions.swift +++ b/submodules/TelegramCore/Sources/State/MessageReactions.swift @@ -338,7 +338,7 @@ public extension EngineMessageReactionListContext.State { for recentPeer in reactionsAttribute.recentPeers { if let peer = message.peers[recentPeer.peerId] { if reaction == nil || recentPeer.value == reaction { - items.append(EngineMessageReactionListContext.Item(peer: EnginePeer(peer), reaction: recentPeer.value, timestamp: recentPeer.timestamp ?? readStats?.readTimestamps[peer.id])) + items.append(EngineMessageReactionListContext.Item(peer: EnginePeer(peer), reaction: recentPeer.value, timestamp: recentPeer.timestamp ?? readStats?.readTimestamps[peer.id], timestampIsReaction: recentPeer.timestamp != nil)) } } } @@ -360,15 +360,18 @@ public final class EngineMessageReactionListContext { public let peer: EnginePeer public let reaction: MessageReaction.Reaction? public let timestamp: Int32? + public let timestampIsReaction: Bool public init( peer: EnginePeer, reaction: MessageReaction.Reaction?, - timestamp: Int32? + timestamp: Int32?, + timestampIsReaction: Bool ) { self.peer = peer self.reaction = reaction self.timestamp = timestamp + self.timestampIsReaction = timestampIsReaction } public static func ==(lhs: Item, rhs: Item) -> Bool { @@ -381,6 +384,9 @@ public final class EngineMessageReactionListContext { if lhs.timestamp != rhs.timestamp { return false } + if lhs.timestampIsReaction != rhs.timestampIsReaction { + return false + } return true } } @@ -509,7 +515,7 @@ public final class EngineMessageReactionListContext { switch reaction { case let .messagePeerReaction(_, peer, date, reaction): if let peer = transaction.getPeer(peer.peerId), let reaction = MessageReaction.Reaction(apiReaction: reaction) { - items.append(EngineMessageReactionListContext.Item(peer: EnginePeer(peer), reaction: reaction, timestamp: date)) + items.append(EngineMessageReactionListContext.Item(peer: EnginePeer(peer), reaction: reaction, timestamp: date, timestampIsReaction: true)) } } } diff --git a/submodules/TelegramUI/Images.xcassets/Chat/Message/MenuReactionIcon.imageset/Contents.json b/submodules/TelegramUI/Images.xcassets/Chat/Message/MenuReactionIcon.imageset/Contents.json new file mode 100644 index 0000000000..36798f7056 --- /dev/null +++ b/submodules/TelegramUI/Images.xcassets/Chat/Message/MenuReactionIcon.imageset/Contents.json @@ -0,0 +1,12 @@ +{ + "images" : [ + { + "filename" : "heart.pdf", + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/submodules/TelegramUI/Images.xcassets/Chat/Message/MenuReactionIcon.imageset/heart.pdf b/submodules/TelegramUI/Images.xcassets/Chat/Message/MenuReactionIcon.imageset/heart.pdf new file mode 100644 index 0000000000..a35acfc919 --- /dev/null +++ b/submodules/TelegramUI/Images.xcassets/Chat/Message/MenuReactionIcon.imageset/heart.pdf @@ -0,0 +1,135 @@ +%PDF-1.7 + +1 0 obj + << >> +endobj + +2 0 obj + << /Length 3 0 R >> +stream +/DeviceRGB CS +/DeviceRGB cs +q +1.000000 0.000000 -0.000000 1.000000 1.625000 0.360352 cm +0.000000 0.000000 0.000000 scn +6.962005 1.569971 m +7.317825 1.008150 l +7.322064 1.010880 l +6.962005 1.569971 l +h +6.375000 11.403881 m +5.789029 11.089458 l +5.904477 10.874304 6.128550 10.739723 6.372719 10.738885 c +6.616888 10.738048 6.841879 10.871088 6.958801 11.085444 c +6.375000 11.403881 l +h +5.787995 1.569971 m +5.427937 1.010880 l +5.432092 1.008204 5.436277 1.005574 5.440492 1.002992 c +5.787995 1.569971 l +h +6.375000 0.665119 m +6.595855 0.665119 6.796738 0.739336 6.926071 0.796043 c +7.069793 0.859060 7.206355 0.937575 7.317815 1.008166 c +6.606195 2.131776 l +6.528299 2.082441 6.453413 2.041030 6.391999 2.014103 c +6.361848 2.000883 6.342614 1.994561 6.333794 1.992147 c +6.322921 1.989172 6.338955 1.995120 6.375000 1.995120 c +6.375000 0.665119 l +h +7.322064 1.010880 m +10.881090 3.302918 13.415000 6.139813 13.415000 9.207347 c +12.085000 9.207347 l +12.085000 6.871911 10.099603 4.381577 6.601946 2.129062 c +7.322064 1.010880 l +h +13.415000 9.207347 m +13.415000 11.850730 11.559452 13.804648 9.139605 13.804648 c +9.139605 12.474648 l +10.746737 12.474648 12.085000 11.196884 12.085000 9.207347 c +13.415000 9.207347 l +h +9.139605 13.804648 m +7.595778 13.804648 6.452867 12.935374 5.791200 11.722318 c +6.958801 11.085444 l +7.433272 11.955309 8.171302 12.474648 9.139605 12.474648 c +9.139605 13.804648 l +h +6.960972 11.718305 m +6.311201 12.929241 5.160131 13.804648 3.616708 13.804648 c +3.616708 12.474648 l +4.585414 12.474648 5.327909 11.948818 5.789029 11.089458 c +6.960972 11.718305 l +h +3.616708 13.804648 m +1.198328 13.804648 -0.665000 11.852291 -0.665000 9.207347 c +0.665000 9.207347 l +0.665000 11.195323 2.008108 12.474648 3.616708 12.474648 c +3.616708 13.804648 l +h +-0.665000 9.207347 m +-0.665000 6.139813 1.868910 3.302918 5.427937 1.010880 c +6.148054 2.129062 l +2.650397 4.381577 0.665000 6.871911 0.665000 9.207347 c +-0.665000 9.207347 l +h +5.440492 1.002992 m +5.551538 0.934931 5.687469 0.857952 5.828663 0.796043 c +5.953417 0.741344 6.154605 0.665119 6.375000 0.665119 c +6.375000 1.995120 l +6.415094 1.995120 6.433691 1.988276 6.422485 1.991394 c +6.413795 1.993813 6.394164 2.000322 6.362735 2.014103 c +6.298793 2.042139 6.220120 2.085086 6.135499 2.136950 c +5.440492 1.002992 l +h +f +n +Q + +endstream +endobj + +3 0 obj + 2285 +endobj + +4 0 obj + << /Annots [] + /Type /Page + /MediaBox [ 0.000000 0.000000 16.000000 16.000000 ] + /Resources 1 0 R + /Contents 2 0 R + /Parent 5 0 R + >> +endobj + +5 0 obj + << /Kids [ 4 0 R ] + /Count 1 + /Type /Pages + >> +endobj + +6 0 obj + << /Pages 5 0 R + /Type /Catalog + >> +endobj + +xref +0 7 +0000000000 65535 f +0000000010 00000 n +0000000034 00000 n +0000002375 00000 n +0000002398 00000 n +0000002571 00000 n +0000002645 00000 n +trailer +<< /ID [ (some) (id) ] + /Root 6 0 R + /Size 7 +>> +startxref +2704 +%%EOF \ No newline at end of file diff --git a/submodules/TelegramUI/Sources/ChatInterfaceStateContextMenus.swift b/submodules/TelegramUI/Sources/ChatInterfaceStateContextMenus.swift index 1b559b012e..36378e61d9 100644 --- a/submodules/TelegramUI/Sources/ChatInterfaceStateContextMenus.swift +++ b/submodules/TelegramUI/Sources/ChatInterfaceStateContextMenus.swift @@ -1787,6 +1787,16 @@ func contextMenuForChatPresentationInterfaceState(chatPresentationInterfaceState if let stats, !stats.readTimestamps.isEmpty { displayReadTimestamps = true } + let tempState = EngineMessageReactionListContext.State(message: EngineMessage(message), readStats: stats, reaction: nil) + var allItemsHaveTimestamp = true + for item in tempState.items { + if item.timestamp == nil { + allItemsHaveTimestamp = false + } + } + if allItemsHaveTimestamp { + displayReadTimestamps = true + } c.pushItems(items: .single(ContextController.Items(content: .custom(ReactionListContextMenuContent( context: context, diff --git a/submodules/WallpaperBackgroundNode/Sources/WallpaperBackgroundNode.swift b/submodules/WallpaperBackgroundNode/Sources/WallpaperBackgroundNode.swift index 9c6f3038b6..c1f84f03dc 100644 --- a/submodules/WallpaperBackgroundNode/Sources/WallpaperBackgroundNode.swift +++ b/submodules/WallpaperBackgroundNode/Sources/WallpaperBackgroundNode.swift @@ -602,6 +602,7 @@ final class WallpaperBackgroundNodeImpl: ASDisplayNode, WallpaperBackgroundNode super.init() self.view.addSubview(portalView.view) + self.clipsToBounds = true } deinit { @@ -818,7 +819,7 @@ final class WallpaperBackgroundNodeImpl: ASDisplayNode, WallpaperBackgroundNode if #available(iOS 12.0, *) { let blurredBackgroundPortalSourceView = PortalSourceView() self.blurredBackgroundPortalSourceView = blurredBackgroundPortalSourceView - blurredBackgroundPortalSourceView.alpha = 0.0001 + blurredBackgroundPortalSourceView.alpha = 0.0 self.view.addSubview(blurredBackgroundPortalSourceView) let blurredBackgroundContentView = UIImageView() @@ -827,12 +828,12 @@ final class WallpaperBackgroundNodeImpl: ASDisplayNode, WallpaperBackgroundNode let incomingBackgroundPortalSourceView = PortalSourceView() self.incomingBackgroundPortalSourceView = incomingBackgroundPortalSourceView - incomingBackgroundPortalSourceView.alpha = 0.00001 + incomingBackgroundPortalSourceView.alpha = 0.0 self.view.addSubview(incomingBackgroundPortalSourceView) let outgoingBackgroundPortalSourceView = PortalSourceView() self.outgoingBackgroundPortalSourceView = outgoingBackgroundPortalSourceView - outgoingBackgroundPortalSourceView.alpha = 0.00001 + outgoingBackgroundPortalSourceView.alpha = 0.0 self.view.addSubview(outgoingBackgroundPortalSourceView) } @@ -1423,7 +1424,7 @@ final class WallpaperBackgroundNodeImpl: ASDisplayNode, WallpaperBackgroundNode return nil } - #if DEBUG && false + #if true var sourceView: PortalSourceView? switch type { case .free: