diff --git a/submodules/TelegramUI/Components/CameraScreen/Sources/CameraCollage.swift b/submodules/TelegramUI/Components/CameraScreen/Sources/CameraCollage.swift index 58246d48c1..f95d423fd5 100644 --- a/submodules/TelegramUI/Components/CameraScreen/Sources/CameraCollage.swift +++ b/submodules/TelegramUI/Components/CameraScreen/Sources/CameraCollage.swift @@ -738,7 +738,7 @@ final class CameraCollageView: UIView, UIGestureRecognizerDelegate { self.extractedContainerView.contentView.clipsToBounds = false self.clippingView.clipsToBounds = false - let scale = size.width / originalCameraFrame.width + let scale = self.bounds.width / originalCameraFrame.width transition.animateScale(view: cameraContainerView, from: 1.0, to: scale) transition.animatePosition(view: cameraContainerView, from: originalCameraFrame.center, to: cameraContainerView.center, completion: { _ in self.extractedContainerView.contentView.clipsToBounds = true @@ -815,7 +815,7 @@ final class CameraCollageView: UIView, UIGestureRecognizerDelegate { self.state = state if let size = self.validLayout { var transition: ComponentTransition = .spring(duration: 0.3) - if let previousState, previousState.innerProgress != state.innerProgress { + if let previousState, previousState.grid == state.grid && previousState.innerProgress != state.innerProgress { transition = .immediate } var progressUpdated = false diff --git a/submodules/TelegramUI/Components/CameraScreen/Sources/CameraVideoLayer.swift b/submodules/TelegramUI/Components/CameraScreen/Sources/CameraVideoLayer.swift index c00df1c15e..b76aaac311 100644 --- a/submodules/TelegramUI/Components/CameraScreen/Sources/CameraVideoLayer.swift +++ b/submodules/TelegramUI/Components/CameraScreen/Sources/CameraVideoLayer.swift @@ -300,7 +300,7 @@ final class CameraVideoLayer: MetalEngineSubjectLayer, MetalEngineSubject { encoder.setFragmentTexture(blurredTexture, index: 0) - var brightness: Float = 0.75 + var brightness: Float = 0.85 var saturation: Float = 1.3 var overlay: SIMD4 = SIMD4() encoder.setFragmentBytes(&brightness, length: 4, index: 0) @@ -311,32 +311,32 @@ final class CameraVideoLayer: MetalEngineSubjectLayer, MetalEngineSubject { }) } - context.renderToLayer(spec: renderSpec, state: RenderState.self, layer: self, inputs: rgbaTexture.placeholer, commands: { encoder, placement, rgbaTexture in - guard let rgbaTexture else { - return - } - - let effectiveRect = placement.effectiveRect - - var rect = SIMD4(Float(effectiveRect.minX), Float(effectiveRect.minY), Float(effectiveRect.width), Float(effectiveRect.height)) - encoder.setVertexBytes(&rect, length: 4 * 4, index: 0) - - var mirror = SIMD2( - videoTextures.mirrorDirection.contains(.horizontal) ? 1 : 0, - videoTextures.mirrorDirection.contains(.vertical) ? 1 : 0 - ) - encoder.setVertexBytes(&mirror, length: 2 * 4, index: 1) - - encoder.setFragmentTexture(rgbaTexture, index: 0) - - var brightness: Float = 1.0 - var saturation: Float = 1.0 - var overlay: SIMD4 = SIMD4() - encoder.setFragmentBytes(&brightness, length: 4, index: 0) - encoder.setFragmentBytes(&saturation, length: 4, index: 1) - encoder.setFragmentBytes(&overlay, length: 4 * 4, index: 2) - - encoder.drawPrimitives(type: .triangle, vertexStart: 0, vertexCount: 6) - }) +// context.renderToLayer(spec: renderSpec, state: RenderState.self, layer: self, inputs: rgbaTexture.placeholer, commands: { encoder, placement, rgbaTexture in +// guard let rgbaTexture else { +// return +// } +// +// let effectiveRect = placement.effectiveRect +// +// var rect = SIMD4(Float(effectiveRect.minX), Float(effectiveRect.minY), Float(effectiveRect.width), Float(effectiveRect.height)) +// encoder.setVertexBytes(&rect, length: 4 * 4, index: 0) +// +// var mirror = SIMD2( +// videoTextures.mirrorDirection.contains(.horizontal) ? 1 : 0, +// videoTextures.mirrorDirection.contains(.vertical) ? 1 : 0 +// ) +// encoder.setVertexBytes(&mirror, length: 2 * 4, index: 1) +// +// encoder.setFragmentTexture(rgbaTexture, index: 0) +// +// var brightness: Float = 1.0 +// var saturation: Float = 1.0 +// var overlay: SIMD4 = SIMD4() +// encoder.setFragmentBytes(&brightness, length: 4, index: 0) +// encoder.setFragmentBytes(&saturation, length: 4, index: 1) +// encoder.setFragmentBytes(&overlay, length: 4 * 4, index: 2) +// +// encoder.drawPrimitives(type: .triangle, vertexStart: 0, vertexCount: 6) +// }) } } diff --git a/submodules/WebUI/Sources/WebAppController.swift b/submodules/WebUI/Sources/WebAppController.swift index fb7f715de7..50cbb8e7ac 100644 --- a/submodules/WebUI/Sources/WebAppController.swift +++ b/submodules/WebUI/Sources/WebAppController.swift @@ -2349,6 +2349,12 @@ public final class WebAppController: ViewController, AttachmentContainable { guard let controller = self.controller else { return } + + guard !fileName.contains("/") && fileName.lengthOfBytes(using: .utf8) < 256 && url.lengthOfBytes(using: .utf8) < 32768 else { + self.webView?.sendEvent(name: "file_download_requested", data: "{status: \"cancelled\"}") + return + } + var isMedia = false var title: String? let photoExtensions = [".jpg", ".png", ".gif", ".tiff"]