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
8e941b324b
commit
a5d5a34d1b
@ -141,7 +141,7 @@ final class AssetDownloadManager {
|
||||
} else {
|
||||
return EmptyDisposable
|
||||
}
|
||||
}
|
||||
} |> runOn(self.queue)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -516,40 +516,45 @@ final class MediaPickerGridItemNode: GridItemNode {
|
||||
self.currentDraftState = nil
|
||||
}
|
||||
|
||||
var typeIcon: UIImage?
|
||||
var duration: String?
|
||||
if asset.isFavorite {
|
||||
self.typeIconNode.image = generateTintedImage(image: UIImage(bundleImageName: "Media Grid/Favorite"), color: .white)
|
||||
if self.typeIconNode.supernode == nil {
|
||||
self.addSubnode(self.gradientNode)
|
||||
self.addSubnode(self.typeIconNode)
|
||||
self.setNeedsLayout()
|
||||
}
|
||||
}
|
||||
|
||||
if asset.mediaType == .video {
|
||||
if !asset.isFavorite {
|
||||
typeIcon = generateTintedImage(image: UIImage(bundleImageName: "Media Grid/Favorite"), color: .white)
|
||||
} else if asset.mediaType == .video {
|
||||
if asset.mediaSubtypes.contains(.videoHighFrameRate) {
|
||||
self.typeIconNode.image = UIImage(bundleImageName: "Media Editor/MediaSlomo")
|
||||
typeIcon = UIImage(bundleImageName: "Media Editor/MediaSlomo")
|
||||
} else if asset.mediaSubtypes.contains(.videoTimelapse) {
|
||||
self.typeIconNode.image = UIImage(bundleImageName: "Media Editor/MediaTimelapse")
|
||||
typeIcon = UIImage(bundleImageName: "Media Editor/MediaTimelapse")
|
||||
} else {
|
||||
self.typeIconNode.image = UIImage(bundleImageName: "Media Editor/MediaVideo")
|
||||
typeIcon = UIImage(bundleImageName: "Media Editor/MediaVideo")
|
||||
}
|
||||
duration = stringForDuration(Int32(asset.duration))
|
||||
}
|
||||
|
||||
self.durationNode.attributedText = NSAttributedString(string: stringForDuration(Int32(asset.duration)), font: Font.semibold(12.0), textColor: .white)
|
||||
|
||||
if self.durationNode.supernode == nil {
|
||||
if typeIcon != nil || duration != nil {
|
||||
if self.gradientNode.supernode == nil {
|
||||
self.addSubnode(self.gradientNode)
|
||||
self.addSubnode(self.typeIconNode)
|
||||
self.addSubnode(self.durationNode)
|
||||
self.setNeedsLayout()
|
||||
}
|
||||
} else {
|
||||
if self.typeIconNode.supernode != nil {
|
||||
} else if self.gradientNode.supernode != nil {
|
||||
self.gradientNode.removeFromSupernode()
|
||||
self.typeIconNode.removeFromSupernode()
|
||||
self.durationNode.removeFromSupernode()
|
||||
}
|
||||
|
||||
if let typeIcon {
|
||||
self.typeIconNode.image = typeIcon
|
||||
if self.typeIconNode.supernode == nil {
|
||||
self.addSubnode(self.typeIconNode)
|
||||
}
|
||||
} else if self.typeIconNode.supernode != nil {
|
||||
self.typeIconNode.removeFromSupernode()
|
||||
}
|
||||
|
||||
if let duration {
|
||||
self.durationNode.attributedText = NSAttributedString(string: duration, font: Font.semibold(12.0), textColor: .white)
|
||||
if self.durationNode.supernode == nil {
|
||||
self.addSubnode(self.durationNode)
|
||||
}
|
||||
} else if self.durationNode.supernode != nil {
|
||||
self.durationNode.removeFromSupernode()
|
||||
}
|
||||
|
||||
self.currentAssetState = (fetchResult, index)
|
||||
|
Loading…
x
Reference in New Issue
Block a user