Merge commit '4bd653c0c0fd5c4be29dba67021342a0b863c507'

This commit is contained in:
Peter 2019-07-01 21:45:59 +03:00
commit 2003e723ce
3 changed files with 7 additions and 7 deletions

View File

@ -92,8 +92,6 @@ final class HorizontalStickerGridItemNode: GridItemNode {
if self.currentState == nil || self.currentState!.0 !== account || self.currentState!.1.file.id != item.file.id { if self.currentState == nil || self.currentState!.0 !== account || self.currentState!.1.file.id != item.file.id {
if let dimensions = item.file.dimensions { if let dimensions = item.file.dimensions {
if item.file.isAnimatedSticker { if item.file.isAnimatedSticker {
self.stickerFetchedDisposable.set(nil)
let animationNode: AnimatedStickerNode let animationNode: AnimatedStickerNode
if let currentAnimationNode = self.animationNode { if let currentAnimationNode = self.animationNode {
animationNode = currentAnimationNode animationNode = currentAnimationNode
@ -111,7 +109,6 @@ final class HorizontalStickerGridItemNode: GridItemNode {
} else { } else {
self.imageNode.alpha = 1.0 self.imageNode.alpha = 1.0
self.imageNode.setSignal(chatMessageSticker(account: account, file: item.file, small: true)) self.imageNode.setSignal(chatMessageSticker(account: account, file: item.file, small: true))
self.stickerFetchedDisposable.set(freeMediaFileResourceInteractiveFetched(account: account, fileReference: stickerPackFileReference(item.file), resource: chatMessageStickerResource(file: item.file, small: true)).start())
if let currentAnimationNode = self.animationNode { if let currentAnimationNode = self.animationNode {
self.animationNode = nil self.animationNode = nil
@ -119,6 +116,8 @@ final class HorizontalStickerGridItemNode: GridItemNode {
} }
} }
self.stickerFetchedDisposable.set(freeMediaFileResourceInteractiveFetched(account: account, fileReference: stickerPackFileReference(item.file), resource: chatMessageStickerResource(file: item.file, small: true)).start())
self.currentState = (account, item, dimensions) self.currentState = (account, item, dimensions)
self.setNeedsLayout() self.setNeedsLayout()
} }

View File

@ -209,4 +209,3 @@ public class InviteContactsController: ViewController, MFMessageComposeViewContr
self.contactsNode.selectionState = self.contactsNode.selectionState.withClearedSelection() self.contactsNode.selectionState = self.contactsNode.selectionState.withClearedSelection()
} }
} }

View File

@ -91,13 +91,15 @@ private final class TrendingTopItemNode: ASDisplayNode {
self.addSubnode(self.imageNode) self.addSubnode(self.imageNode)
} }
deinit {
self.loadDisposable.dispose()
}
func setup(account: Account, item: StickerPackItem, itemSize: CGSize, synchronousLoads: Bool) { func setup(account: Account, item: StickerPackItem, itemSize: CGSize, synchronousLoads: Bool) {
self.file = item.file self.file = item.file
self.itemSize = itemSize self.itemSize = itemSize
if item.file.isAnimatedSticker { if item.file.isAnimatedSticker {
self.loadDisposable.set(nil)
let animationNode: AnimatedStickerNode let animationNode: AnimatedStickerNode
if let currentAnimationNode = self.animationNode { if let currentAnimationNode = self.animationNode {
animationNode = currentAnimationNode animationNode = currentAnimationNode
@ -114,13 +116,13 @@ private final class TrendingTopItemNode: ASDisplayNode {
animationNode.setup(account: account, resource: item.file.resource, width: 140, height: 140, mode: .cached) animationNode.setup(account: account, resource: item.file.resource, width: 140, height: 140, mode: .cached)
} else { } else {
self.imageNode.setSignal(chatMessageSticker(account: account, file: item.file, small: true, synchronousLoad: synchronousLoads), attemptSynchronously: synchronousLoads) self.imageNode.setSignal(chatMessageSticker(account: account, file: item.file, small: true, synchronousLoad: synchronousLoads), attemptSynchronously: synchronousLoads)
self.loadDisposable.set(freeMediaFileResourceInteractiveFetched(account: account, fileReference: stickerPackFileReference(item.file), resource: chatMessageStickerResource(file: item.file, small: true)).start())
if let currentAnimationNode = self.animationNode { if let currentAnimationNode = self.animationNode {
self.animationNode = nil self.animationNode = nil
currentAnimationNode.removeFromSupernode() currentAnimationNode.removeFromSupernode()
} }
} }
self.loadDisposable.set(freeMediaFileResourceInteractiveFetched(account: account, fileReference: stickerPackFileReference(item.file), resource: chatMessageStickerResource(file: item.file, small: true)).start())
} }
func updatePreviewing(animated: Bool, isPreviewing: Bool) { func updatePreviewing(animated: Bool, isPreviewing: Bool) {