From 113428aa13ed69a00705512f8524f1d8d84f16d0 Mon Sep 17 00:00:00 2001 From: Peter <> Date: Mon, 15 Oct 2018 17:41:02 +0300 Subject: [PATCH] Added icon for downloaded music --- .../FileCloudFetched.imageset/Contents.json | 12 +++++++ .../FileCloudFetched.imageset/phone.pdf | Bin 0 -> 4213 bytes .../ChatMessageInteractiveFileNode.swift | 31 +++++++++--------- TelegramUI/PresentationResourceKey.swift | 2 ++ TelegramUI/PresentationResourcesChat.swift | 12 +++++++ 5 files changed, 42 insertions(+), 15 deletions(-) create mode 100644 Images.xcassets/Chat/Message/FileCloudFetched.imageset/Contents.json create mode 100644 Images.xcassets/Chat/Message/FileCloudFetched.imageset/phone.pdf diff --git a/Images.xcassets/Chat/Message/FileCloudFetched.imageset/Contents.json b/Images.xcassets/Chat/Message/FileCloudFetched.imageset/Contents.json new file mode 100644 index 0000000000..70484f8552 --- /dev/null +++ b/Images.xcassets/Chat/Message/FileCloudFetched.imageset/Contents.json @@ -0,0 +1,12 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "phone.pdf" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/Images.xcassets/Chat/Message/FileCloudFetched.imageset/phone.pdf b/Images.xcassets/Chat/Message/FileCloudFetched.imageset/phone.pdf new file mode 100644 index 0000000000000000000000000000000000000000..8aef36688bb8535471a575e9513f4bf49691d9f5 GIT binary patch literal 4213 zcmai%c|25Y8^FzHkAM(8jsgdDsI|6iFYDP{%uY;0Tnb6WRlZ#9>`+aDajW*xiGG zLpy_gsGSWoZ@q&u)sv6!C~@htb7roG%FR$84rS;)X5G6_r=R@pGHX7Ii*dSW`8Oxm znGv?cFcO9_wAmLVQ)*DG0soU8tZ!nWw6a=(DpfaR&0KBL$7 z%Ls#Yl1_CIUf!EZd3=b(7A=^GB(tclklLYpY%w1ilS&3R=>D9yXNqMZ3AG1!lx9Gc zx(f2o;!$j>ugryghbmaxkBwWmBaen1k{%p<0tugzfz<=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5N1v{}y3 zyP>FO`Or#k9UQnKDxU4oKXChNZvI{Eww9`vpgS=89-c)*ozxFRhMPryxgATg#Q0`yz|5`v%oDURhj%`SH~8;geJ4L3FuvDESIlx% zvD;5}&wdZPG?gm|);XJ1qFA;!xIJuJOx#$yKWt5^ylEF7QKKrcpYrvQPRk)uF-b(d zN__!Uh9bp&jUDrQywUc#D>k)%D!ftn+q12dzS8VKZ!*yi)7kpjv2QV5QER-YL2hSg z(|OM3<8;3_e&s=7^mu85;%3NR4jH@Akublcv#pbo9jEAhond#)N5I*3c48}Ro&3N2 zd_bY!p;;Ox`3rat`1L@eK(3~$stVd2X9FAntUh4*E93y8e=+f2jO`9cT*BGl(JHP! zfH{;B0+R+L5#J%%lS1AwK;k0a#+?Gs2Z&C|_8TC>4#NMQQ5Efhc5=1*f$#1=x&1FJ zhrxcnA>@q4>KFjVID$Lg)dhe-#bF4*LP*6E?_>kOWR>A^FbiQo&l64X@B=8+{vGsv zJcNJk1@^095JH}lgu-NDP?!`9E+qw*HiJS1DfeHIzpatd3D|gIDQ)KWbx^uaRZ4g1 zL0JIu0OP;sq==VXZGQj%*Xn%;I9o8~fZ$;0e=k6q@=+bWh5zkJh%XtUm8?O zic+$_YjA`Nr49PK28Bvew)GE93PCyLe`wP1f64bRaWYVfE&l#493lBX`6%Z`>6iWy zCk_1FK>YNqnsb5Dbja!rFiDR7nFn4bg^}%80g0sNwLrc1P(51 zgTX?jY$c^IlmQ%LgO$Ug;aF)|n4B~QrvU!{AwMkW?m@A}_kzG> 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) diff --git a/TelegramUI/PresentationResourceKey.swift b/TelegramUI/PresentationResourceKey.swift index f306ec92c9..2b6616617e 100644 --- a/TelegramUI/PresentationResourceKey.swift +++ b/TelegramUI/PresentationResourceKey.swift @@ -112,6 +112,8 @@ enum PresentationResourceKey: Int32 { case chatBubbleFileCloudFetchIncomingIcon case chatBubbleFileCloudFetchOutgoingIcon + case chatBubbleFileCloudFetchedIncomingIcon + case chatBubbleFileCloudFetchedOutgoingIcon case chatBubbleReplyThumbnailPlayImage diff --git a/TelegramUI/PresentationResourcesChat.swift b/TelegramUI/PresentationResourcesChat.swift index 6f1fc9b850..9c25036f3d 100644 --- a/TelegramUI/PresentationResourcesChat.swift +++ b/TelegramUI/PresentationResourcesChat.swift @@ -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) + }) + } }