mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00
Various fixes
This commit is contained in:
parent
0397a9560d
commit
d09c539298
@ -386,7 +386,7 @@ final class ChatImageGalleryItemNode: ZoomableContentGalleryItemNode {
|
||||
strongSelf.statusNodeContainer.isHidden = true
|
||||
|
||||
Queue.concurrentDefaultQueue().async {
|
||||
if let message = strongSelf.message, !message.isCopyProtected() && !imageReference.media.flags.contains(.hasStickers) {
|
||||
if let message = strongSelf.message, !message.isCopyProtected() && !imageReference.media.flags.contains(.hasStickers) && message.paidContent == nil {
|
||||
strongSelf.recognitionDisposable.set((recognizedContent(context: strongSelf.context, image: { return generate(TransformImageArguments(corners: ImageCorners(), imageSize: displaySize, boundingSize: displaySize, intrinsicInsets: UIEdgeInsets()))?.generateImage() }, messageId: message.id)
|
||||
|> deliverOnMainQueue).start(next: { [weak self] results in
|
||||
if let strongSelf = self {
|
||||
|
@ -1227,6 +1227,9 @@
|
||||
else if (groupedId != nil && !hasAnyTimers)
|
||||
dict[@"groupedId"] = groupedId;
|
||||
|
||||
if (price != nil)
|
||||
dict[@"price"] = price;
|
||||
|
||||
if (spoiler) {
|
||||
dict[@"spoiler"] = @true;
|
||||
}
|
||||
|
@ -111,6 +111,8 @@ public func mergedMessageReactionsAndPeers(accountPeerId: EnginePeer.Id, account
|
||||
reactions.insert(MessageReaction(value: .custom(MessageReaction.starsReactionId), count: 1000000, chosenOrder: nil), at: 0)
|
||||
}
|
||||
}
|
||||
#else
|
||||
let reactions = attribute.reactions
|
||||
#endif
|
||||
|
||||
return (reactions, recentPeers)
|
||||
|
@ -2079,7 +2079,7 @@ public final class ChatMessageInteractiveMediaNode: ASDisplayNode, GalleryItemTr
|
||||
if let invoice = media as? TelegramMediaInvoice, let selectedMedia = invoice.extendedMedia {
|
||||
extendedMedia = selectedMedia
|
||||
} else if let paidContent = media as? TelegramMediaPaidContent {
|
||||
let selectedMediaIndex = mediaIndex ?? 0
|
||||
let selectedMediaIndex = self.mediaIndex ?? 0
|
||||
if selectedMediaIndex < paidContent.extendedMedia.count {
|
||||
extendedMedia = paidContent.extendedMedia[selectedMediaIndex]
|
||||
}
|
||||
@ -2427,9 +2427,6 @@ public final class ChatMessageInteractiveMediaNode: ASDisplayNode, GalleryItemTr
|
||||
}
|
||||
}
|
||||
}
|
||||
// if let paidContent {
|
||||
// viewText = "⭐️\(paidContent.amount)"
|
||||
// }
|
||||
self.extendedMediaOverlayNode?.update(size: self.imageNode.frame.size, text: viewText, imageSignal: self.currentBlurredImageSignal, imageFrame: self.imageNode.view.convert(self.imageNode.bounds, to: self.extendedMediaOverlayNode?.view), corners: self.currentImageArguments?.corners)
|
||||
} else if let extendedMediaOverlayNode = self.extendedMediaOverlayNode {
|
||||
self.extendedMediaOverlayNode = nil
|
||||
|
@ -186,9 +186,7 @@ public class ChatMessageMediaBubbleContentNode: ChatMessageBubbleContentNode {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
let _ = selectedMediaIndex
|
||||
|
||||
|
||||
if let extendedMedia, case let .full(media) = extendedMedia {
|
||||
if let telegramImage = media as? TelegramMediaImage {
|
||||
if shouldDownloadMediaAutomatically(settings: item.controllerInteraction.automaticMediaDownloadSettings, peerType: item.associatedData.automaticDownloadPeerType, networkType: item.associatedData.automaticDownloadNetworkType, authorPeerId: item.message.author?.id, contactsPeerIds: item.associatedData.contactsPeerIds, media: telegramImage) {
|
||||
|
@ -347,6 +347,7 @@ public final class StarsImageComponent: Component {
|
||||
private var dustNode: MediaDustNode?
|
||||
private var button: UIControl?
|
||||
|
||||
private var lockView: UIImageView?
|
||||
private var countView = ComponentView<Empty>()
|
||||
|
||||
private let fetchDisposable = MetaDisposable()
|
||||
@ -641,6 +642,19 @@ public final class StarsImageComponent: Component {
|
||||
imageFrameNode.frame = imageFrame.insetBy(dx: -2.0, dy: -2.0)
|
||||
}
|
||||
|
||||
var totalLabelWidth: CGFloat = 0.0
|
||||
let labelSpacing: CGFloat = 3.0
|
||||
let lockView: UIImageView
|
||||
if let current = self.lockView {
|
||||
lockView = current
|
||||
} else {
|
||||
lockView = UIImageView(image: UIImage(bundleImageName: "Premium/Stars/MediaLock"))
|
||||
containerNode.view.addSubview(lockView)
|
||||
}
|
||||
if let icon = lockView.image {
|
||||
totalLabelWidth += icon.size.width
|
||||
}
|
||||
|
||||
if extendedMedia.count > 1 {
|
||||
let countSize = self.countView.update(
|
||||
transition: .immediate,
|
||||
@ -650,7 +664,9 @@ public final class StarsImageComponent: Component {
|
||||
environment: {},
|
||||
containerSize: imageFrame.size
|
||||
)
|
||||
let countFrame = CGRect(origin: CGPoint(x: imageFrame.minX + floorToScreenPixels((imageFrame.width - countSize.width) / 2.0), y: imageFrame.minY + floorToScreenPixels((imageFrame.height - countSize.height) / 2.0)), size: countSize)
|
||||
let iconWidth = totalLabelWidth
|
||||
totalLabelWidth += countSize.width + labelSpacing
|
||||
let countFrame = CGRect(origin: CGPoint(x: imageFrame.minX + floorToScreenPixels((imageFrame.width - totalLabelWidth) / 2.0) + iconWidth + labelSpacing, y: imageFrame.minY + floorToScreenPixels((imageFrame.height - countSize.height) / 2.0)), size: countSize)
|
||||
if let countView = self.countView.view {
|
||||
if countView.superview == nil {
|
||||
containerNode.view.addSubview(countView)
|
||||
@ -658,6 +674,8 @@ public final class StarsImageComponent: Component {
|
||||
countView.frame = countFrame
|
||||
}
|
||||
}
|
||||
|
||||
lockView.frame = CGRect(origin: CGPoint(x: imageFrame.minX + floorToScreenPixels((imageFrame.width - totalLabelWidth) / 2.0), y: imageFrame.minY + floorToScreenPixels((imageFrame.height - lockView.bounds.height) / 2.0)), size: lockView.bounds.size)
|
||||
case let .transactionPeer(peer):
|
||||
if case let .peer(peer) = peer {
|
||||
let avatarNode: ImageNode
|
||||
|
12
submodules/TelegramUI/Images.xcassets/Premium/Stars/MediaLock.imageset/Contents.json
vendored
Normal file
12
submodules/TelegramUI/Images.xcassets/Premium/Stars/MediaLock.imageset/Contents.json
vendored
Normal file
@ -0,0 +1,12 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"filename" : "lockmedia.pdf",
|
||||
"idiom" : "universal"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
BIN
submodules/TelegramUI/Images.xcassets/Premium/Stars/MediaLock.imageset/lockmedia.pdf
vendored
Normal file
BIN
submodules/TelegramUI/Images.xcassets/Premium/Stars/MediaLock.imageset/lockmedia.pdf
vendored
Normal file
Binary file not shown.
@ -134,6 +134,7 @@ private func chatForwardOptions(selfController: ChatControllerImpl, sourceNode:
|
||||
|
||||
var hasOther = false
|
||||
var hasNotOwnMessages = false
|
||||
var hasPaid = false
|
||||
for message in messages {
|
||||
if let author = message.effectiveAuthor {
|
||||
if !uniquePeerIds.contains(author.id) {
|
||||
@ -159,6 +160,8 @@ private func chatForwardOptions(selfController: ChatControllerImpl, sourceNode:
|
||||
if !message.text.isEmpty {
|
||||
hasCaptions = true
|
||||
}
|
||||
} else if media is TelegramMediaPaidContent {
|
||||
hasPaid = true
|
||||
}
|
||||
}
|
||||
if !isDice && !isMusic {
|
||||
@ -170,6 +173,9 @@ private func chatForwardOptions(selfController: ChatControllerImpl, sourceNode:
|
||||
if case let .peer(peerId) = selfController.chatLocation, peerId.namespace == Namespaces.Peer.SecretChat {
|
||||
canHideNames = false
|
||||
}
|
||||
if hasPaid {
|
||||
canHideNames = false
|
||||
}
|
||||
let hideNames = forwardOptions.hideNames
|
||||
let hideCaptions = forwardOptions.hideCaptions
|
||||
|
||||
@ -194,7 +200,7 @@ private func chatForwardOptions(selfController: ChatControllerImpl, sourceNode:
|
||||
})))
|
||||
}
|
||||
|
||||
if hasCaptions {
|
||||
if hasCaptions && !hasPaid {
|
||||
items.append(.action(ContextMenuActionItem(text: hideCaptions ? presentationData.strings.Conversation_ForwardOptions_ShowCaption : presentationData.strings.Conversation_ForwardOptions_HideCaption, icon: { _ in
|
||||
return nil
|
||||
}, iconAnimation: ContextMenuActionItem.IconAnimation(
|
||||
|
Loading…
x
Reference in New Issue
Block a user