mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-15 13:35:19 +00:00
Various fixes
This commit is contained in:
parent
25251fc9d4
commit
4f255424e5
@ -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 =
|
||||
|
@ -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<Bool, NoError>? = nil, siriAuthorization: (() -> AccessType)? = nil, subject: DeviceAccessSubject) -> Signal<AccessType, NoError> {
|
||||
switch subject {
|
||||
case .notifications:
|
||||
|
@ -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,
|
||||
|
@ -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
|
||||
}
|
||||
|
@ -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(
|
||||
|
Loading…
x
Reference in New Issue
Block a user