mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00
Added icon for downloaded music
This commit is contained in:
parent
d0911df3b8
commit
113428aa13
12
Images.xcassets/Chat/Message/FileCloudFetched.imageset/Contents.json
vendored
Normal file
12
Images.xcassets/Chat/Message/FileCloudFetched.imageset/Contents.json
vendored
Normal file
@ -0,0 +1,12 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"filename" : "phone.pdf"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"version" : 1,
|
||||
"author" : "xcode"
|
||||
}
|
||||
}
|
BIN
Images.xcassets/Chat/Message/FileCloudFetched.imageset/phone.pdf
vendored
Normal file
BIN
Images.xcassets/Chat/Message/FileCloudFetched.imageset/phone.pdf
vendored
Normal file
Binary file not shown.
@ -46,6 +46,7 @@ final class ChatMessageInteractiveFileNode: ASDisplayNode {
|
||||
private var streamingCacheStatusFrame: CGRect?
|
||||
private var fileIconImage: UIImage?
|
||||
private var cloudFetchIconImage: UIImage?
|
||||
private var cloudFetchedIconImage: UIImage?
|
||||
|
||||
override init() {
|
||||
self.titleNode = TextNode()
|
||||
@ -322,14 +323,7 @@ final class ChatMessageInteractiveFileNode: ASDisplayNode {
|
||||
let streamingProgressDiameter: CGFloat = 28.0
|
||||
var hasStreamingProgress = false
|
||||
if isAudio && !isVoice {
|
||||
if let resourceStatus = currentResourceStatus {
|
||||
switch resourceStatus.fetchStatus {
|
||||
case .Fetching, .Remote:
|
||||
hasStreamingProgress = true
|
||||
case .Local:
|
||||
break
|
||||
}
|
||||
}
|
||||
hasStreamingProgress = true
|
||||
|
||||
if hasStreamingProgress {
|
||||
textConstrainedSize.width -= streamingProgressDiameter + 4.0
|
||||
@ -359,9 +353,11 @@ final class ChatMessageInteractiveFileNode: ASDisplayNode {
|
||||
}
|
||||
|
||||
var cloudFetchIconImage: UIImage?
|
||||
var cloudFetchedIconImage: UIImage?
|
||||
if hasStreamingProgress {
|
||||
minLayoutWidth += streamingProgressDiameter + 4.0
|
||||
cloudFetchIconImage = incoming ? PresentationResourcesChat.chatBubbleFileCloudFetchIncomingIcon(presentationData.theme.theme) : PresentationResourcesChat.chatBubbleFileCloudFetchOutgoingIcon(presentationData.theme.theme)
|
||||
cloudFetchedIconImage = incoming ? PresentationResourcesChat.chatBubbleFileCloudFetchedIncomingIcon(presentationData.theme.theme) : PresentationResourcesChat.chatBubbleFileCloudFetchedOutgoingIcon(presentationData.theme.theme)
|
||||
}
|
||||
|
||||
let fileIconImage: UIImage?
|
||||
@ -431,7 +427,7 @@ final class ChatMessageInteractiveFileNode: ASDisplayNode {
|
||||
}
|
||||
|
||||
if isAudio && !isVoice {
|
||||
streamingCacheStatusFrame = CGRect(origin: CGPoint(x: fittedLayoutSize.width + 6.0, y: 4.0), size: CGSize(width: streamingProgressDiameter, height: streamingProgressDiameter))
|
||||
streamingCacheStatusFrame = CGRect(origin: CGPoint(x: fittedLayoutSize.width + 6.0, y: 8.0), size: CGSize(width: streamingProgressDiameter, height: streamingProgressDiameter))
|
||||
if hasStreamingProgress {
|
||||
fittedLayoutSize.width += streamingProgressDiameter + 6.0
|
||||
}
|
||||
@ -531,7 +527,7 @@ final class ChatMessageInteractiveFileNode: ASDisplayNode {
|
||||
strongSelf.statusDisposable.set((updatedStatusSignal |> deliverOnMainQueue).start(next: { [weak strongSelf] status in
|
||||
displayLinkDispatcher.dispatch {
|
||||
if let strongSelf = strongSelf {
|
||||
var previousHadCacheStatus = false
|
||||
/*var previousHadCacheStatus = false
|
||||
if let resourceStatus = strongSelf.resourceStatus {
|
||||
switch resourceStatus.fetchStatus {
|
||||
case .Fetching, .Remote:
|
||||
@ -546,13 +542,13 @@ final class ChatMessageInteractiveFileNode: ASDisplayNode {
|
||||
hasCacheStatus = true
|
||||
case .Local:
|
||||
hasCacheStatus = false
|
||||
}
|
||||
}*/
|
||||
strongSelf.resourceStatus = status
|
||||
if isAudio && !isVoice && previousHadCacheStatus != hasCacheStatus {
|
||||
/*if isAudio && !isVoice && previousHadCacheStatus != hasCacheStatus {
|
||||
strongSelf.requestUpdateLayout(false)
|
||||
} else {
|
||||
} else {*/
|
||||
strongSelf.updateStatus()
|
||||
}
|
||||
//}
|
||||
}
|
||||
}
|
||||
}))
|
||||
@ -567,6 +563,7 @@ final class ChatMessageInteractiveFileNode: ASDisplayNode {
|
||||
strongSelf.streamingCacheStatusFrame = streamingCacheStatusFrame
|
||||
strongSelf.fileIconImage = fileIconImage
|
||||
strongSelf.cloudFetchIconImage = cloudFetchIconImage
|
||||
strongSelf.cloudFetchedIconImage = cloudFetchedIconImage
|
||||
|
||||
if let updatedFetchControls = updatedFetchControls {
|
||||
let _ = strongSelf.fetchControls.swap(updatedFetchControls)
|
||||
@ -632,7 +629,11 @@ final class ChatMessageInteractiveFileNode: ASDisplayNode {
|
||||
}
|
||||
streamingState = .cloudProgress(color: streamingStatusForegroundColor, strokeBackgroundColor: streamingStatusBackgroundColor, lineWidth: 2.0, value: CGFloat(adjustedProgress))
|
||||
case .Local:
|
||||
streamingState = .none
|
||||
if let cloudFetchedIconImage = self.cloudFetchedIconImage {
|
||||
streamingState = .customIcon(cloudFetchedIconImage)
|
||||
} else {
|
||||
streamingState = .none
|
||||
}
|
||||
case .Remote:
|
||||
if let cloudFetchIconImage = self.cloudFetchIconImage {
|
||||
streamingState = .customIcon(cloudFetchIconImage)
|
||||
|
@ -112,6 +112,8 @@ enum PresentationResourceKey: Int32 {
|
||||
|
||||
case chatBubbleFileCloudFetchIncomingIcon
|
||||
case chatBubbleFileCloudFetchOutgoingIcon
|
||||
case chatBubbleFileCloudFetchedIncomingIcon
|
||||
case chatBubbleFileCloudFetchedOutgoingIcon
|
||||
|
||||
case chatBubbleReplyThumbnailPlayImage
|
||||
|
||||
|
@ -1023,4 +1023,16 @@ struct PresentationResourcesChat {
|
||||
generateTintedImage(image: UIImage(bundleImageName: "Chat/Message/FileCloudFetch"), color: theme.chat.bubble.outgoingAccentControlColor)
|
||||
})
|
||||
}
|
||||
|
||||
static func chatBubbleFileCloudFetchedIncomingIcon(_ theme: PresentationTheme) -> UIImage? {
|
||||
return theme.image(PresentationResourceKey.chatBubbleFileCloudFetchedIncomingIcon.rawValue, { theme in
|
||||
generateTintedImage(image: UIImage(bundleImageName: "Chat/Message/FileCloudFetched"), color: theme.chat.bubble.incomingAccentControlColor)
|
||||
})
|
||||
}
|
||||
|
||||
static func chatBubbleFileCloudFetchedOutgoingIcon(_ theme: PresentationTheme) -> UIImage? {
|
||||
return theme.image(PresentationResourceKey.chatBubbleFileCloudFetchedOutgoingIcon.rawValue, { theme in
|
||||
generateTintedImage(image: UIImage(bundleImageName: "Chat/Message/FileCloudFetched"), color: theme.chat.bubble.outgoingAccentControlColor)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user