diff --git a/submodules/BrowserUI/Sources/BrowserWebContent.swift b/submodules/BrowserUI/Sources/BrowserWebContent.swift index 5a9a2b0b69..9fa6fab203 100644 --- a/submodules/BrowserUI/Sources/BrowserWebContent.swift +++ b/submodules/BrowserUI/Sources/BrowserWebContent.swift @@ -1708,11 +1708,10 @@ let setupFontFunctions = """ """ private let videoSource = """ +document.addEventListener('DOMContentLoaded', () => { function tgBrowserDisableWebkitEnterFullscreen(videoElement) { if (videoElement && videoElement.webkitEnterFullscreen) { - Object.defineProperty(videoElement, 'webkitEnterFullscreen', { - value: undefined - }); + videoElement.setAttribute('playsinline', ''); } } @@ -1747,6 +1746,7 @@ _tgbrowser_observer.observe(document.body, { function tgBrowserDisconnectObserver() { _tgbrowser_observer.disconnect(); } +}); """ let setupTouchObservers = diff --git a/submodules/DeviceAccess/Sources/DeviceAccess.swift b/submodules/DeviceAccess/Sources/DeviceAccess.swift index cfa335f52d..1b8b3e4d11 100644 --- a/submodules/DeviceAccess/Sources/DeviceAccess.swift +++ b/submodules/DeviceAccess/Sources/DeviceAccess.swift @@ -100,7 +100,7 @@ public final class DeviceAccess { public static func isCameraAccessAuthorized() -> Bool { return AVCaptureDevice.authorizationStatus(for: .video) == .authorized } - + public static func authorizationStatus(applicationInForeground: Signal? = nil, siriAuthorization: (() -> AccessType)? = nil, subject: DeviceAccessSubject) -> Signal { switch subject { case .notifications: diff --git a/submodules/GalleryUI/Sources/GalleryController.swift b/submodules/GalleryUI/Sources/GalleryController.swift index 4027a66ff9..57077e9045 100644 --- a/submodules/GalleryUI/Sources/GalleryController.swift +++ b/submodules/GalleryUI/Sources/GalleryController.swift @@ -309,13 +309,16 @@ public func galleryItemForEntry( } else { if let fileName = file.fileName, (fileName as NSString).pathExtension.lowercased() == "json" { return ChatAnimationGalleryItem(context: context, presentationData: presentationData, message: message, location: location) - } - else if file.mimeType.hasPrefix("image/") && file.mimeType != "image/gif" { + } else if file.mimeType.hasPrefix("image/") && file.mimeType != "image/gif" { var pixelsCount: Int = 0 if let dimensions = file.dimensions { pixelsCount = Int(dimensions.width) * Int(dimensions.height) } - if pixelsCount < 10000 * 10000 { + var fileSize: Int64 = 0 + if let size = file.size { + fileSize = size + } + if pixelsCount < 10000 * 10000 && fileSize < 16 * 1024 * 1024 { return ChatImageGalleryItem( context: context, presentationData: presentationData, diff --git a/submodules/TelegramUI/Components/Chat/ChatMessageBubbleItemNode/Sources/ChatMessageBubbleItemNode.swift b/submodules/TelegramUI/Components/Chat/ChatMessageBubbleItemNode/Sources/ChatMessageBubbleItemNode.swift index b011df3a7f..f6522e1c14 100644 --- a/submodules/TelegramUI/Components/Chat/ChatMessageBubbleItemNode/Sources/ChatMessageBubbleItemNode.swift +++ b/submodules/TelegramUI/Components/Chat/ChatMessageBubbleItemNode/Sources/ChatMessageBubbleItemNode.swift @@ -1283,24 +1283,22 @@ public class ChatMessageBubbleItemNode: ChatMessageItemView, ChatMessagePreviewI } } recognizer.highlight = { [weak self] point in - if let strongSelf = self { - if strongSelf.selectionNode == nil { - if let replyInfoNode = strongSelf.replyInfoNode { - var translatedPoint: CGPoint? - let convertedNodeFrame = replyInfoNode.view.convert(replyInfoNode.bounds, to: strongSelf.view) - if let point = point, convertedNodeFrame.insetBy(dx: -4.0, dy: -4.0).contains(point) { - translatedPoint = strongSelf.view.convert(point, to: replyInfoNode.view) - } - replyInfoNode.updateTouchesAtPoint(translatedPoint) + if let strongSelf = self, strongSelf.selectionNode == nil { + if let replyInfoNode = strongSelf.replyInfoNode { + var translatedPoint: CGPoint? + let convertedNodeFrame = replyInfoNode.view.convert(replyInfoNode.bounds, to: strongSelf.view) + if let point = point, convertedNodeFrame.insetBy(dx: -4.0, dy: -4.0).contains(point) { + translatedPoint = strongSelf.view.convert(point, to: replyInfoNode.view) } - if let forwardInfoNode = strongSelf.forwardInfoNode { - var translatedPoint: CGPoint? - let convertedNodeFrame = forwardInfoNode.view.convert(forwardInfoNode.bounds, to: strongSelf.view) - if let point = point, convertedNodeFrame.insetBy(dx: -4.0, dy: -4.0).contains(point) { - translatedPoint = strongSelf.view.convert(point, to: forwardInfoNode.view) - } - forwardInfoNode.updateTouchesAtPoint(translatedPoint) + replyInfoNode.updateTouchesAtPoint(translatedPoint) + } + if let forwardInfoNode = strongSelf.forwardInfoNode { + var translatedPoint: CGPoint? + let convertedNodeFrame = forwardInfoNode.view.convert(forwardInfoNode.bounds, to: strongSelf.view) + if let point = point, convertedNodeFrame.insetBy(dx: -4.0, dy: -4.0).contains(point) { + translatedPoint = strongSelf.view.convert(point, to: forwardInfoNode.view) } + forwardInfoNode.updateTouchesAtPoint(translatedPoint) } for contentNode in strongSelf.contentNodes { var translatedPoint: CGPoint? @@ -5254,10 +5252,6 @@ public class ChatMessageBubbleItemNode: ChatMessageItemView, ChatMessagePreviewI } if let selectionNode = self.selectionNode { -// if let replyInfoNode = self.replyInfoNode, replyInfoNode.frame.contains(point) { -// return replyInfoNode.view.hitTest(self.view.convert(point, to: replyInfoNode.view), with: event) -// } - if let result = self.traceSelectionNodes(parent: self, point: point.offsetBy(dx: -42.0, dy: 0.0)) { return result.view } diff --git a/submodules/TelegramUI/Components/MediaEditor/Sources/MediaEditor.swift b/submodules/TelegramUI/Components/MediaEditor/Sources/MediaEditor.swift index 09b076bbd2..4b7755eda9 100644 --- a/submodules/TelegramUI/Components/MediaEditor/Sources/MediaEditor.swift +++ b/submodules/TelegramUI/Components/MediaEditor/Sources/MediaEditor.swift @@ -628,10 +628,20 @@ public final class MediaEditor { case let .asset(asset): textureSource = Signal { subscriber in let isVideo = asset.mediaType == .video - + let targetSize = isVideo ? CGSize(width: 128.0, height: 128.0) : CGSize(width: 1920.0, height: 1920.0) let options = PHImageRequestOptions() - options.deliveryMode = isVideo ? .fastFormat : .highQualityFormat + let deliveryMode: PHImageRequestOptionsDeliveryMode + if isVideo { + if #available(iOS 14.0, *), PHPhotoLibrary.authorizationStatus(for: .readWrite) == .limited { + deliveryMode = .highQualityFormat + } else { + deliveryMode = .fastFormat + } + } else { + deliveryMode = .highQualityFormat + } + options.deliveryMode = deliveryMode options.isNetworkAccessAllowed = true let requestId = PHImageManager.default().requestImage(