diff --git a/submodules/PhotoResources/Sources/PhotoResources.swift b/submodules/PhotoResources/Sources/PhotoResources.swift index 38378ab4f5..04b5f8dbd4 100644 --- a/submodules/PhotoResources/Sources/PhotoResources.swift +++ b/submodules/PhotoResources/Sources/PhotoResources.swift @@ -2185,7 +2185,10 @@ public func chatSecretMessageVideo(account: Account, userLocation: MediaResource } } -// addCorners(context, arguments: arguments) + if arguments.corners.topLeft > 40.0 { + } else { + addCorners(context, arguments: arguments) + } return context } diff --git a/submodules/SemanticStatusNode/Sources/SemanticStatusNode.swift b/submodules/SemanticStatusNode/Sources/SemanticStatusNode.swift index 01df0bddf2..7cb36a0453 100644 --- a/submodules/SemanticStatusNode/Sources/SemanticStatusNode.swift +++ b/submodules/SemanticStatusNode/Sources/SemanticStatusNode.swift @@ -443,7 +443,7 @@ public final class SemanticStatusNode: ASControlNode { self.setNeedsDisplay() } - public func transitionToState(_ state: SemanticStatusNodeState, animated: Bool = true, synchronous: Bool = false, completion: @escaping () -> Void = {}) { + public func transitionToState(_ state: SemanticStatusNodeState, animated: Bool = true, synchronous: Bool = false, cutout: CGRect? = nil, updateCutout: Bool = false, completion: @escaping () -> Void = {}) { var animated = animated if !self.hasState { self.hasState = true @@ -452,13 +452,18 @@ public final class SemanticStatusNode: ASControlNode { if self.state != state || self.appearanceContext.cutout != cutout { self.state = state let previousStateContext = self.stateContext + let previousAppearanceContext = updateCutout ? self.appearanceContext : nil + self.stateContext = self.state.context(current: self.stateContext) self.stateContext.requestUpdate = { [weak self] in self?.setNeedsDisplay() } + if updateCutout { + self.appearanceContext = self.appearanceContext.withUpdatedCutout(cutout) + } - if animated && previousStateContext !== self.stateContext { - self.transitionContext = SemanticStatusNodeTransitionContext(startTime: CACurrentMediaTime(), duration: 0.18, previousStateContext: previousStateContext, previousAppearanceContext: nil, completion: completion) + if animated && (previousStateContext !== self.stateContext || (updateCutout && previousAppearanceContext?.cutout != cutout)) { + self.transitionContext = SemanticStatusNodeTransitionContext(startTime: CACurrentMediaTime(), duration: 0.18, previousStateContext: previousStateContext, previousAppearanceContext: previousAppearanceContext, completion: completion) } else { completion() } @@ -513,7 +518,7 @@ public final class SemanticStatusNode: ASControlNode { return } - if let transitionAppearanceState = parameters.transitionState?.appearanceState { + if let transitionAppearanceState = parameters.transitionState?.appearanceState, transitionAppearanceState.background.alpha == 1.0 { transitionAppearanceState.drawBackground(context: context, size: bounds.size) } parameters.appearanceState.drawBackground(context: context, size: bounds.size) diff --git a/submodules/SemanticStatusNode/Sources/SemanticStatusNodeIconContext.swift b/submodules/SemanticStatusNode/Sources/SemanticStatusNodeIconContext.swift index 9824108a51..f47b643bf7 100644 --- a/submodules/SemanticStatusNode/Sources/SemanticStatusNodeIconContext.swift +++ b/submodules/SemanticStatusNode/Sources/SemanticStatusNodeIconContext.swift @@ -20,9 +20,11 @@ final class SemanticStatusNodeIconContext: SemanticStatusNodeStateContext { } func draw(context: CGContext, size: CGSize, foregroundColor: UIColor) { + let transitionScale = max(0.01, self.transitionFraction) + context.saveGState() context.translateBy(x: size.width / 2.0, y: size.height / 2.0) - context.scaleBy(x: max(0.01, self.transitionFraction), y: max(0.01, self.transitionFraction)) + context.scaleBy(x: transitionScale, y: transitionScale) context.translateBy(x: -size.width / 2.0, y: -size.height / 2.0) if foregroundColor.alpha.isZero { @@ -38,56 +40,23 @@ final class SemanticStatusNodeIconContext: SemanticStatusNodeStateContext { switch self.icon { case .none, .secretTimeout: break - case .play: + case .play, .pause: let diameter = size.width let factor = diameter / 50.0 - let size: CGSize - var offset: CGFloat = 0.0 - if let iconImage = self.iconImage { - size = iconImage.size - offset = self.iconOffset - } else { - offset = 1.5 - size = CGSize(width: 15.0, height: 18.0) - } - context.translateBy(x: (diameter - size.width) / 2.0 + offset, y: (diameter - size.height) / 2.0) - if (diameter < 40.0) { - context.translateBy(x: size.width / 2.0, y: size.height / 2.0) - context.scaleBy(x: factor, y: factor) - context.translateBy(x: -size.width / 2.0, y: -size.height / 2.0) - } - if let iconImage = self.iconImage { - context.saveGState() - let iconRect = CGRect(origin: CGPoint(), size: iconImage.size) - context.translateBy(x: size.width / 2.0, y: size.height / 2.0) - context.scaleBy(x: 1.0, y: -1.0) - context.translateBy(x: -size.width / 2.0, y: -size.height / 2.0) - context.clip(to: iconRect, mask: iconImage.cgImage!) - context.fill(iconRect) - context.restoreGState() - } else { - let _ = try? drawSvgPath(context, path: "M1.71891969,0.209353049 C0.769586558,-0.350676705 0,0.0908839327 0,1.18800046 L0,16.8564753 C0,17.9569971 0.750549162,18.357187 1.67393713,17.7519379 L14.1073836,9.60224049 C15.0318735,8.99626906 15.0094718,8.04970371 14.062401,7.49100858 L1.71891969,0.209353049 ") - context.fillPath() - } - if (diameter < 40.0) { - context.translateBy(x: size.width / 2.0, y: size.height / 2.0) - context.scaleBy(x: 1.0 / 0.8, y: 1.0 / 0.8) - context.translateBy(x: -size.width / 2.0, y: -size.height / 2.0) - } - context.translateBy(x: -(diameter - size.width) / 2.0 - offset, y: -(diameter - size.height) / 2.0) - case .pause: - let diameter = size.width - let factor = diameter / 50.0 - let size: CGSize let offset: CGFloat if let iconImage = self.iconImage { size = iconImage.size offset = self.iconOffset } else { - size = CGSize(width: 15.0, height: 16.0) - offset = 0.0 + if case .play = self.icon { + offset = 1.5 + size = CGSize(width: 15.0, height: 18.0) + } else { + size = CGSize(width: 15.0, height: 16.0) + offset = 0.0 + } } context.translateBy(x: (diameter - size.width) / 2.0 + offset, y: (diameter - size.height) / 2.0) if (diameter < 40.0) { @@ -97,7 +66,7 @@ final class SemanticStatusNodeIconContext: SemanticStatusNodeStateContext { } if let iconImage = self.iconImage { context.saveGState() - let iconRect = CGRect(origin: CGPoint(), size: iconImage.size) + let iconRect = CGRect(origin: CGPoint(), size: iconImage.size)//.applying(CGAffineTransformMakeScale(transitionScale, transitionScale)) context.translateBy(x: size.width / 2.0, y: size.height / 2.0) context.scaleBy(x: 1.0, y: -1.0) context.translateBy(x: -size.width / 2.0, y: -size.height / 2.0) @@ -105,26 +74,22 @@ final class SemanticStatusNodeIconContext: SemanticStatusNodeStateContext { context.fill(iconRect) context.restoreGState() } else { - let _ = try? drawSvgPath(context, path: "M0,1.00087166 C0,0.448105505 0.443716645,0 0.999807492,0 L4.00019251,0 C4.55237094,0 5,0.444630861 5,1.00087166 L5,14.9991283 C5,15.5518945 4.55628335,16 4.00019251,16 L0.999807492,16 C0.447629061,16 0,15.5553691 0,14.9991283 L0,1.00087166 Z M10,1.00087166 C10,0.448105505 10.4437166,0 10.9998075,0 L14.0001925,0 C14.5523709,0 15,0.444630861 15,1.00087166 L15,14.9991283 C15,15.5518945 14.5562834,16 14.0001925,16 L10.9998075,16 C10.4476291,16 10,15.5553691 10,14.9991283 L10,1.00087166 ") + if case .play = self.icon { + let _ = try? drawSvgPath(context, path: "M1.71891969,0.209353049 C0.769586558,-0.350676705 0,0.0908839327 0,1.18800046 L0,16.8564753 C0,17.9569971 0.750549162,18.357187 1.67393713,17.7519379 L14.1073836,9.60224049 C15.0318735,8.99626906 15.0094718,8.04970371 14.062401,7.49100858 L1.71891969,0.209353049 ") + } else { + let _ = try? drawSvgPath(context, path: "M0,1.00087166 C0,0.448105505 0.443716645,0 0.999807492,0 L4.00019251,0 C4.55237094,0 5,0.444630861 5,1.00087166 L5,14.9991283 C5,15.5518945 4.55628335,16 4.00019251,16 L0.999807492,16 C0.447629061,16 0,15.5553691 0,14.9991283 L0,1.00087166 Z M10,1.00087166 C10,0.448105505 10.4437166,0 10.9998075,0 L14.0001925,0 C14.5523709,0 15,0.444630861 15,1.00087166 L15,14.9991283 C15,15.5518945 14.5562834,16 14.0001925,16 L10.9998075,16 C10.4476291,16 10,15.5553691 10,14.9991283 L10,1.00087166 ") + } context.fillPath() } - if (diameter < 40.0) { - context.translateBy(x: size.width / 2.0, y: size.height / 2.0) - context.scaleBy(x: 1.0 / 0.8, y: 1.0 / 0.8) - context.translateBy(x: -size.width / 2.0, y: -size.height / 2.0) - } - context.translateBy(x: -(diameter - size.width) / 2.0, y: -(diameter - size.height) / 2.0) case let .custom(image): let diameter = size.width let imageRect = CGRect(origin: CGPoint(x: floor((diameter - image.size.width) / 2.0), y: floor((diameter - image.size.height) / 2.0)), size: image.size) - context.saveGState() context.translateBy(x: imageRect.midX, y: imageRect.midY) context.scaleBy(x: 1.0, y: -1.0) context.translateBy(x: -imageRect.midX, y: -imageRect.midY) context.clip(to: imageRect, mask: image.cgImage!) context.fill(imageRect) - context.restoreGState() case .download: let diameter = size.width let factor = diameter / 50.0 diff --git a/submodules/TelegramCallsUI/Sources/GroupCallNavigationAccessoryPanel.swift b/submodules/TelegramCallsUI/Sources/GroupCallNavigationAccessoryPanel.swift index 3adde6596e..60e738a176 100644 --- a/submodules/TelegramCallsUI/Sources/GroupCallNavigationAccessoryPanel.swift +++ b/submodules/TelegramCallsUI/Sources/GroupCallNavigationAccessoryPanel.swift @@ -634,7 +634,11 @@ public final class GroupCallNavigationAccessoryPanel: ASDisplayNode { var isChannel = false if let currentData = self.currentData { if currentData.isChannel || currentData.info.isStream { - title = self.strings.VoiceChatChannel_Title + if let titleValue = currentData.info.title, !titleValue.isEmpty { + title = titleValue + } else { + title = self.strings.VoiceChatChannel_Title + } isChannel = true } } diff --git a/submodules/TelegramUI/Components/Chat/ChatMessageInteractiveInstantVideoNode/Sources/ChatMessageInteractiveInstantVideoNode.swift b/submodules/TelegramUI/Components/Chat/ChatMessageInteractiveInstantVideoNode/Sources/ChatMessageInteractiveInstantVideoNode.swift index 5566b8bb8c..84ca40fbbd 100644 --- a/submodules/TelegramUI/Components/Chat/ChatMessageInteractiveInstantVideoNode/Sources/ChatMessageInteractiveInstantVideoNode.swift +++ b/submodules/TelegramUI/Components/Chat/ChatMessageInteractiveInstantVideoNode/Sources/ChatMessageInteractiveInstantVideoNode.swift @@ -1347,16 +1347,6 @@ public class ChatMessageInteractiveInstantVideoNode: ASDisplayNode { if item.presentationData.isPreview { state = .play } - if let statusNode = self.statusNode { - if state == .none { - self.statusNode = nil - } - statusNode.transitionToState(state, completion: { [weak statusNode] in - if state == .none { - statusNode?.removeFromSupernode() - } - }) - } let streamingProgressDiameter: CGFloat = 20.0 let streamingCacheStatusFrame = CGRect(origin: statusFrame.origin.offsetBy(dx: 37.0, dy: 37.0), size: CGSize(width: streamingProgressDiameter, height: streamingProgressDiameter)) @@ -1374,8 +1364,6 @@ public class ChatMessageInteractiveInstantVideoNode: ASDisplayNode { streamingStatusNode.layer.animateScale(from: 0.1, to: 1.0, duration: 0.2, timingFunction: CAMediaTimingFunctionName.linear.rawValue) streamingStatusNode.layer.animateAlpha(from: 0.1, to: 1.0, duration: 0.2, timingFunction: CAMediaTimingFunctionName.linear.rawValue) } - } else if let streamingStatusNode = self.streamingStatusNode { - streamingStatusNode.backgroundNodeColor = item.presentationData.theme.theme.chat.message.mediaOverlayControlColors.fillColor } if let streamingStatusNode = self.streamingStatusNode { @@ -1399,9 +1387,21 @@ public class ChatMessageInteractiveInstantVideoNode: ASDisplayNode { } } - if let statusNode = self.statusNode, streamingState != .none { - let cutoutFrame = streamingCacheStatusFrame.offsetBy(dx: -statusFrame.minX, dy: -statusFrame.minY).insetBy(dx: -2.0 + UIScreenPixel, dy: -2.0 + UIScreenPixel) - statusNode.setCutout(cutoutFrame, animated: true) + if let statusNode = self.statusNode { + if state == .none { + self.statusNode = nil + } + + var cutoutFrame: CGRect? + if streamingState != .none { + cutoutFrame = streamingCacheStatusFrame.offsetBy(dx: -statusFrame.minX, dy: -statusFrame.minY).insetBy(dx: -2.0 + UIScreenPixel, dy: -2.0 + UIScreenPixel) + } + + statusNode.transitionToState(state, animated: true, cutout: cutoutFrame, updateCutout: true, completion: { [weak statusNode] in + if state == .none { + statusNode?.removeFromSupernode() + } + }) } if case .playbackStatus = status.mediaStatus, !isViewOnceMessage || item.associatedData.isStandalone { diff --git a/submodules/TelegramUI/Sources/ChatController.swift b/submodules/TelegramUI/Sources/ChatController.swift index a7a7ece3a6..b1de49a714 100644 --- a/submodules/TelegramUI/Sources/ChatController.swift +++ b/submodules/TelegramUI/Sources/ChatController.swift @@ -15707,6 +15707,8 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G switch recordedMediaPreview { case let .audio(audio): + self.audioRecorder.set(.single(nil)) + var isScheduledMessages = false if case .scheduledMessages = self.presentationInterfaceState.subject { isScheduledMessages = true