mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-23 22:55:00 +00:00
Various fixes
This commit is contained in:
@@ -483,7 +483,7 @@ public final class SecretMediaPreviewController: ViewController {
|
|||||||
if !self.didSetReady {
|
if !self.didSetReady {
|
||||||
self._ready.set(.single(true))
|
self._ready.set(.single(true))
|
||||||
}
|
}
|
||||||
if !(self.currentNodeMessageIsVideo && !self.currentNodeMessageIsViewOnce) {
|
if !(self.currentNodeMessageIsVideo || self.currentNodeMessageIsViewOnce) {
|
||||||
self.dismiss()
|
self.dismiss()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -95,7 +95,14 @@ final class RadialStatusSecretTimeoutContentNode: RadialStatusContentNode {
|
|||||||
override func layout() {
|
override func layout() {
|
||||||
super.layout()
|
super.layout()
|
||||||
|
|
||||||
self.animationNode.frame = CGRect(x: 6.0, y: 2.0, width: 36.0, height: 36.0)
|
var factor: CGFloat = 0.75
|
||||||
|
var offset: CGFloat = 0.0415
|
||||||
|
if self.bounds.width < 30.0 {
|
||||||
|
factor = 0.66
|
||||||
|
offset = 0.08
|
||||||
|
}
|
||||||
|
let size = floorToScreenPixels(self.bounds.width * factor)
|
||||||
|
self.animationNode.frame = CGRect(x: floorToScreenPixels((self.bounds.width - size) / 2.0), y: ceil(self.bounds.height * offset), width: size, height: size)
|
||||||
}
|
}
|
||||||
|
|
||||||
override func animateOut(to: RadialStatusNodeState, completion: @escaping () -> Void) {
|
override func animateOut(to: RadialStatusNodeState, completion: @escaping () -> Void) {
|
||||||
@@ -194,15 +201,15 @@ final class RadialStatusSecretTimeoutContentNode: RadialStatusContentNode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if let parameters = parameters as? RadialStatusSecretTimeoutContentNodeParameters {
|
if let parameters = parameters as? RadialStatusSecretTimeoutContentNodeParameters {
|
||||||
if let icon = parameters.icon, let iconImage = icon.cgImage {
|
// if let icon = parameters.icon, let _ = icon.cgImage {
|
||||||
let imageRect = CGRect(origin: CGPoint(x: floor((bounds.size.width - icon.size.width) / 2.0), y: floor((bounds.size.height - icon.size.height) / 2.0)), size: icon.size)
|
// let imageRect = CGRect(origin: CGPoint(x: floor((bounds.size.width - icon.size.width) / 2.0), y: floor((bounds.size.height - icon.size.height) / 2.0)), size: icon.size)
|
||||||
context.saveGState()
|
// context.saveGState()
|
||||||
context.translateBy(x: imageRect.midX, y: imageRect.midY)
|
// context.translateBy(x: imageRect.midX, y: imageRect.midY)
|
||||||
context.scaleBy(x: 1.0, y: -1.0)
|
// context.scaleBy(x: 1.0, y: -1.0)
|
||||||
context.translateBy(x: -imageRect.midX, y: -imageRect.midY)
|
// context.translateBy(x: -imageRect.midX, y: -imageRect.midY)
|
||||||
context.draw(iconImage, in: imageRect)
|
// context.draw(iconImage, in: imageRect)
|
||||||
context.restoreGState()
|
// context.restoreGState()
|
||||||
}
|
// }
|
||||||
|
|
||||||
let lineWidth: CGFloat
|
let lineWidth: CGFloat
|
||||||
if parameters.sparks {
|
if parameters.sparks {
|
||||||
|
|||||||
@@ -389,7 +389,7 @@ public final class MediaEditorVideoExport {
|
|||||||
|
|
||||||
try? videoTrack.insertTimeRange(timeRange, of: videoAssetTrack, at: .zero)
|
try? videoTrack.insertTimeRange(timeRange, of: videoAssetTrack, at: .zero)
|
||||||
|
|
||||||
if let audioAssetTrack = asset.tracks(withMediaType: .audio).first, let audioTrack = mixComposition.addMutableTrack(withMediaType: .audio, preferredTrackID: kCMPersistentTrackID_Invalid) {
|
if let audioAssetTrack = asset.tracks(withMediaType: .audio).first, let audioTrack = mixComposition.addMutableTrack(withMediaType: .audio, preferredTrackID: kCMPersistentTrackID_Invalid), !self.configuration.values.videoIsMuted {
|
||||||
try? audioTrack.insertTimeRange(timeRange, of: audioAssetTrack, at: .zero)
|
try? audioTrack.insertTimeRange(timeRange, of: audioAssetTrack, at: .zero)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -488,7 +488,7 @@ public final class MediaEditorVideoExport {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let audioTracks = inputAsset.tracks(withMediaType: .audio)
|
let audioTracks = inputAsset.tracks(withMediaType: .audio)
|
||||||
if audioTracks.count > 0, !self.configuration.values.videoIsMuted {
|
if audioTracks.count > 0, !self.configuration.values.videoIsMuted || self.configuration.values.audioTrack != nil {
|
||||||
let audioOutput = AVAssetReaderAudioMixOutput(audioTracks: audioTracks, audioSettings: nil)
|
let audioOutput = AVAssetReaderAudioMixOutput(audioTracks: audioTracks, audioSettings: nil)
|
||||||
audioOutput.alwaysCopiesSampleData = false
|
audioOutput.alwaysCopiesSampleData = false
|
||||||
if reader.canAdd(audioOutput) {
|
if reader.canAdd(audioOutput) {
|
||||||
|
|||||||
@@ -189,7 +189,7 @@ private class ExtendedMediaOverlayNode: ASDisplayNode {
|
|||||||
var isRevealed = false
|
var isRevealed = false
|
||||||
var tapped: () -> Void = {}
|
var tapped: () -> Void = {}
|
||||||
|
|
||||||
init(enableAnimations: Bool) {
|
init(hasImageOverlay: Bool, enableAnimations: Bool) {
|
||||||
self.blurredImageNode = TransformImageNode()
|
self.blurredImageNode = TransformImageNode()
|
||||||
self.blurredImageNode.contentAnimations = []
|
self.blurredImageNode.contentAnimations = []
|
||||||
|
|
||||||
@@ -212,7 +212,9 @@ private class ExtendedMediaOverlayNode: ASDisplayNode {
|
|||||||
|
|
||||||
super.init()
|
super.init()
|
||||||
|
|
||||||
self.addSubnode(self.blurredImageNode)
|
if hasImageOverlay {
|
||||||
|
self.addSubnode(self.blurredImageNode)
|
||||||
|
}
|
||||||
self.addSubnode(self.dustNode)
|
self.addSubnode(self.dustNode)
|
||||||
self.addSubnode(self.buttonNode)
|
self.addSubnode(self.buttonNode)
|
||||||
|
|
||||||
@@ -1986,7 +1988,7 @@ final class ChatMessageInteractiveMediaNode: ASDisplayNode, GalleryItemTransitio
|
|||||||
} else {
|
} else {
|
||||||
secretProgressIcon = PresentationResourcesChat.chatBubbleSecretMediaCompactIcon(theme)
|
secretProgressIcon = PresentationResourcesChat.chatBubbleSecretMediaCompactIcon(theme)
|
||||||
}
|
}
|
||||||
if isSecretMedia, let (maybeBeginTime, timeout) = secretBeginTimeAndTimeout, let beginTime = maybeBeginTime {
|
if isSecretMedia, let (maybeBeginTime, timeout) = secretBeginTimeAndTimeout, let beginTime = maybeBeginTime, timeout != viewOnceTimeout {
|
||||||
state = .secretTimeout(color: messageTheme.mediaOverlayControlColors.foregroundColor, icon: secretProgressIcon, beginTime: beginTime, timeout: timeout, sparks: true)
|
state = .secretTimeout(color: messageTheme.mediaOverlayControlColors.foregroundColor, icon: secretProgressIcon, beginTime: beginTime, timeout: timeout, sparks: true)
|
||||||
backgroundColor = messageTheme.mediaDateAndStatusFillColor
|
backgroundColor = messageTheme.mediaDateAndStatusFillColor
|
||||||
} else if isSecretMedia, let _ = secretProgressIcon {
|
} else if isSecretMedia, let _ = secretProgressIcon {
|
||||||
@@ -2133,7 +2135,7 @@ final class ChatMessageInteractiveMediaNode: ASDisplayNode, GalleryItemTransitio
|
|||||||
|
|
||||||
if displaySpoiler {
|
if displaySpoiler {
|
||||||
if self.extendedMediaOverlayNode == nil {
|
if self.extendedMediaOverlayNode == nil {
|
||||||
let extendedMediaOverlayNode = ExtendedMediaOverlayNode(enableAnimations: self.context?.sharedContext.energyUsageSettings.fullTranslucency ?? true)
|
let extendedMediaOverlayNode = ExtendedMediaOverlayNode(hasImageOverlay: !isSecretMedia, enableAnimations: self.context?.sharedContext.energyUsageSettings.fullTranslucency ?? true)
|
||||||
extendedMediaOverlayNode.tapped = { [weak self] in
|
extendedMediaOverlayNode.tapped = { [weak self] in
|
||||||
self?.internallyVisible = true
|
self?.internallyVisible = true
|
||||||
self?.updateVisibility()
|
self?.updateVisibility()
|
||||||
|
|||||||
Reference in New Issue
Block a user