From b734b2a970a060d7f7d14e4459bc1d7586c6eb82 Mon Sep 17 00:00:00 2001 From: Ilya Laktyushin Date: Thu, 25 Nov 2021 20:26:37 +0400 Subject: [PATCH] Various Improvements --- .../Sources/AuthTransferScanScreen.swift | 2 +- .../GalleryUI/Sources/GalleryController.swift | 8 +- .../MediaPlayer/Sources/MediaPlayerNode.swift | 11 + .../ItemListRecentSessionItem.swift | 2 +- .../RecentSessionsHeaderItem.swift | 3 +- .../Devices/Generic.imageset/Contents.json | 12 ++ .../Devices/Generic.imageset/Title + Icon.pdf | 191 ++++++++++++++++++ .../Sources/PeerInfo/PeerInfoScreen.swift | 2 +- .../Sources/NativeVideoContent.swift | 11 +- 9 files changed, 231 insertions(+), 11 deletions(-) create mode 100644 submodules/TelegramUI/Images.xcassets/Settings/Devices/Generic.imageset/Contents.json create mode 100644 submodules/TelegramUI/Images.xcassets/Settings/Devices/Generic.imageset/Title + Icon.pdf diff --git a/submodules/AuthTransferUI/Sources/AuthTransferScanScreen.swift b/submodules/AuthTransferUI/Sources/AuthTransferScanScreen.swift index a9ec457417..63d63bc84a 100644 --- a/submodules/AuthTransferUI/Sources/AuthTransferScanScreen.swift +++ b/submodules/AuthTransferUI/Sources/AuthTransferScanScreen.swift @@ -504,7 +504,7 @@ private final class AuthTransferScanScreenNode: ViewControllerTracingNode, UIScr let titleSize = self.titleNode.updateLayout(CGSize(width: layout.size.width - 16.0, height: layout.size.height)) let textSize = self.textNode.updateLayout(CGSize(width: layout.size.width - 16.0, height: layout.size.height)) let errorTextSize = self.errorTextNode.updateLayout(CGSize(width: layout.size.width - 16.0, height: layout.size.height)) - let textFrame = CGRect(origin: CGPoint(x: floor((layout.size.width - textSize.width) / 2.0), y: dimHeight - textSize.height - titleSpacing), size: textSize) + let textFrame = CGRect(origin: CGPoint(x: floor((layout.size.width - textSize.width) / 2.0), y: min(dimHeight - textSize.height - titleSpacing, navigationHeight + floorToScreenPixels((dimHeight - navigationHeight - textSize.height) / 2.0) + 5.0)), size: textSize) let titleFrame = CGRect(origin: CGPoint(x: floor((layout.size.width - titleSize.width) / 2.0), y: textFrame.minY - 18.0 - titleSize.height), size: titleSize) var errorTextFrame = CGRect(origin: CGPoint(x: floor((layout.size.width - errorTextSize.width) / 2.0), y: dimHeight + frameSide + 48.0), size: errorTextSize) errorTextFrame.origin.y += floor(additionalTorchOffset / 2.0) diff --git a/submodules/GalleryUI/Sources/GalleryController.swift b/submodules/GalleryUI/Sources/GalleryController.swift index a2492e9890..b3df37dbef 100644 --- a/submodules/GalleryUI/Sources/GalleryController.swift +++ b/submodules/GalleryUI/Sources/GalleryController.swift @@ -154,10 +154,10 @@ public func galleryItemForEntry(context: AccountContext, presentationData: Prese if file.isVideo { let content: UniversalVideoContent if file.isAnimated { - content = NativeVideoContent(id: .message(message.stableId, file.fileId), fileReference: .message(message: MessageReference(message), media: file), imageReference: mediaImage.flatMap({ ImageMediaReference.message(message: MessageReference(message), media: $0) }), loopVideo: true, enableSound: false, tempFilePath: tempFilePath) + content = NativeVideoContent(id: .message(message.stableId, file.fileId), fileReference: .message(message: MessageReference(message), media: file), imageReference: mediaImage.flatMap({ ImageMediaReference.message(message: MessageReference(message), media: $0) }), loopVideo: true, enableSound: false, tempFilePath: tempFilePath, captureProtected: message.isCopyProtected()) } else { if true || (file.mimeType == "video/mpeg4" || file.mimeType == "video/mov" || file.mimeType == "video/mp4") { - content = NativeVideoContent(id: .message(message.stableId, file.fileId), fileReference: .message(message: MessageReference(message), media: file), imageReference: mediaImage.flatMap({ ImageMediaReference.message(message: MessageReference(message), media: $0) }), streamVideo: .conservative, loopVideo: loopVideos, tempFilePath: tempFilePath) + content = NativeVideoContent(id: .message(message.stableId, file.fileId), fileReference: .message(message: MessageReference(message), media: file), imageReference: mediaImage.flatMap({ ImageMediaReference.message(message: MessageReference(message), media: $0) }), streamVideo: .conservative, loopVideo: loopVideos, tempFilePath: tempFilePath, captureProtected: message.isCopyProtected()) } else { content = PlatformVideoContent(id: .message(message.id, message.stableId, file.fileId), content: .file(.message(message: MessageReference(message), media: file)), streamVideo: streamVideos, loopVideo: loopVideos) } @@ -202,11 +202,11 @@ public func galleryItemForEntry(context: AccountContext, presentationData: Prese var content: UniversalVideoContent? switch websiteType(of: webpageContent.websiteName) { case .instagram where webpageContent.file != nil && webpageContent.image != nil && webpageContent.file!.isVideo: - content = NativeVideoContent(id: .message(message.stableId, webpageContent.file?.id ?? webpage.webpageId), fileReference: .message(message: MessageReference(message), media: webpageContent.file!), imageReference: webpageContent.image.flatMap({ ImageMediaReference.message(message: MessageReference(message), media: $0) }), streamVideo: .conservative, enableSound: true) + content = NativeVideoContent(id: .message(message.stableId, webpageContent.file?.id ?? webpage.webpageId), fileReference: .message(message: MessageReference(message), media: webpageContent.file!), imageReference: webpageContent.image.flatMap({ ImageMediaReference.message(message: MessageReference(message), media: $0) }), streamVideo: .conservative, enableSound: true, captureProtected: message.isCopyProtected()) default: if let embedUrl = webpageContent.embedUrl, let image = webpageContent.image { if let file = webpageContent.file, file.isVideo { - content = NativeVideoContent(id: .message(message.stableId, file.fileId), fileReference: .message(message: MessageReference(message), media: file), imageReference: mediaImage.flatMap({ ImageMediaReference.message(message: MessageReference(message), media: $0) }), streamVideo: .conservative, loopVideo: loopVideos, tempFilePath: tempFilePath) + content = NativeVideoContent(id: .message(message.stableId, file.fileId), fileReference: .message(message: MessageReference(message), media: file), imageReference: mediaImage.flatMap({ ImageMediaReference.message(message: MessageReference(message), media: $0) }), streamVideo: .conservative, loopVideo: loopVideos, tempFilePath: tempFilePath, captureProtected: message.isCopyProtected()) } else if URL(string: embedUrl)?.pathExtension == "mp4" { content = SystemVideoContent(url: embedUrl, imageReference: .webPage(webPage: WebpageReference(webpage), media: image), dimensions: webpageContent.embedSize?.cgSize ?? CGSize(width: 640.0, height: 640.0), duration: Int32(webpageContent.duration ?? 0)) } diff --git a/submodules/MediaPlayer/Sources/MediaPlayerNode.swift b/submodules/MediaPlayer/Sources/MediaPlayerNode.swift index 11cb7f2949..b7d66155a7 100644 --- a/submodules/MediaPlayer/Sources/MediaPlayerNode.swift +++ b/submodules/MediaPlayer/Sources/MediaPlayerNode.swift @@ -367,6 +367,14 @@ public final class MediaPlayerNode: ASDisplayNode { } } + public var captureProtected: Bool = false { + didSet { + if #available(iOS 13.0, *) { + self.videoLayer?.preventsCapture = captureProtected + } + } + } + public init(backgroundThread: Bool = false) { self.videoNode = MediaPlayerNodeDisplayNode() @@ -397,6 +405,9 @@ public final class MediaPlayerNode: ASDisplayNode { Queue.mainQueue().async { if let strongSelf = self { strongSelf.videoLayer = videoLayer + if #available(iOS 13.0, *) { + videoLayer.preventsCapture = strongSelf.captureProtected + } strongSelf.updateLayout() strongSelf.layer.addSublayer(videoLayer) diff --git a/submodules/SettingsUI/Sources/Privacy and Security/Recent Sessions/ItemListRecentSessionItem.swift b/submodules/SettingsUI/Sources/Privacy and Security/Recent Sessions/ItemListRecentSessionItem.swift index 4e049c9ed0..249534c507 100644 --- a/submodules/SettingsUI/Sources/Privacy and Security/Recent Sessions/ItemListRecentSessionItem.swift +++ b/submodules/SettingsUI/Sources/Privacy and Security/Recent Sessions/ItemListRecentSessionItem.swift @@ -159,7 +159,7 @@ func iconForSession(_ session: RecentAccountSession) -> (UIImage?, UIColor?, Str if platform.contains("windows") || systemVersion.contains("windows") { return (UIImage(bundleImageName: "Settings/Devices/Windows"), UIColor(rgb: 0x0079ff), "device_windows", nil) } - return (nil, nil, nil, nil) + return (UIImage(bundleImageName: "Settings/Devices/Generic"), UIColor(rgb: 0x8e8e93), nil, nil) } private func trimmedLocationName(_ session: RecentAccountSession) -> String { diff --git a/submodules/SettingsUI/Sources/Privacy and Security/Recent Sessions/RecentSessionsHeaderItem.swift b/submodules/SettingsUI/Sources/Privacy and Security/Recent Sessions/RecentSessionsHeaderItem.swift index cf1aefa970..bfc12f83f1 100644 --- a/submodules/SettingsUI/Sources/Privacy and Security/Recent Sessions/RecentSessionsHeaderItem.swift +++ b/submodules/SettingsUI/Sources/Privacy and Security/Recent Sessions/RecentSessionsHeaderItem.swift @@ -154,7 +154,8 @@ class RecentSessionsHeaderItemNode: ListViewItemNode { strongSelf.buttonNode.updateTheme(SolidRoundedButtonTheme(theme: item.theme)) } - let buttonWidth = min(375, contentSize.width - params.leftInset - params.rightInset) + let inset = max(16.0, params.leftInset) + let buttonWidth = min(375, contentSize.width - inset - inset) let buttonHeight = strongSelf.buttonNode.updateLayout(width: buttonWidth, transition: .immediate) let buttonFrame = CGRect(x: floorToScreenPixels((params.width - buttonWidth) / 2.0), y: contentSize.height - buttonHeight + 4.0, width: buttonWidth, height: buttonHeight) strongSelf.buttonNode.frame = buttonFrame diff --git a/submodules/TelegramUI/Images.xcassets/Settings/Devices/Generic.imageset/Contents.json b/submodules/TelegramUI/Images.xcassets/Settings/Devices/Generic.imageset/Contents.json new file mode 100644 index 0000000000..8eb30858d4 --- /dev/null +++ b/submodules/TelegramUI/Images.xcassets/Settings/Devices/Generic.imageset/Contents.json @@ -0,0 +1,12 @@ +{ + "images" : [ + { + "filename" : "Title + Icon.pdf", + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/submodules/TelegramUI/Images.xcassets/Settings/Devices/Generic.imageset/Title + Icon.pdf b/submodules/TelegramUI/Images.xcassets/Settings/Devices/Generic.imageset/Title + Icon.pdf new file mode 100644 index 0000000000..8d8e795a20 --- /dev/null +++ b/submodules/TelegramUI/Images.xcassets/Settings/Devices/Generic.imageset/Title + Icon.pdf @@ -0,0 +1,191 @@ +%PDF-1.7 + +1 0 obj + << >> +endobj + +2 0 obj + << /Length 3 0 R >> +stream +/DeviceRGB CS +/DeviceRGB cs +q +1.000000 0.000000 -0.000000 1.000000 0.000000 0.000000 cm +0.556863 0.556863 0.576471 scn +0.000000 45.119995 m +0.000000 54.528881 0.000000 59.233322 1.831091 62.827042 c +3.441763 65.988159 6.011837 68.558235 9.172960 70.168907 c +12.766678 72.000000 17.471119 72.000000 26.880003 72.000000 c +45.119995 72.000000 l +54.528881 72.000000 59.233322 72.000000 62.827042 70.168907 c +65.988167 68.558235 68.558235 65.988159 70.168907 62.827042 c +72.000000 59.233322 72.000000 54.528881 72.000000 45.119995 c +72.000000 26.880005 l +72.000000 17.471119 72.000000 12.766678 70.168907 9.172958 c +68.558235 6.011833 65.988167 3.441765 62.827042 1.831093 c +59.233322 0.000000 54.528881 0.000000 45.119999 0.000000 c +26.880005 0.000000 l +17.471119 0.000000 12.766678 0.000000 9.172960 1.831093 c +6.011837 3.441765 3.441763 6.011833 1.831091 9.172958 c +0.000000 12.766678 0.000000 17.471119 0.000000 26.880001 c +0.000000 45.119995 l +h +f +n +Q +q +1.000000 0.000000 -0.000000 1.000000 7.200001 14.399868 cm +1.000000 1.000000 1.000000 scn +38.787495 43.200127 m +38.880005 43.200127 l +45.119999 43.200127 l +45.212505 43.200127 l +45.841881 43.200150 46.428265 43.200169 46.969349 43.191143 c +47.072140 43.197105 47.175716 43.200127 47.280003 43.200127 c +48.000000 43.200127 l +48.000000 43.157841 l +48.161369 43.149311 48.317421 43.139069 48.468071 43.126759 c +49.416901 43.049236 50.360626 42.878078 51.268738 42.415371 c +52.623505 41.725082 53.724964 40.623623 54.415253 39.268856 c +54.877960 38.360744 55.049118 37.417023 55.126640 36.468193 c +55.200085 35.569252 55.200050 34.477867 55.200008 33.212769 c +55.200008 33.212666 l +55.200005 33.120125 l +55.200005 10.080116 l +55.200008 9.987576 l +55.200008 9.987473 l +55.200050 8.722374 55.200085 7.630997 55.126640 6.732056 c +55.049118 5.783226 54.877960 4.839504 54.415253 3.931393 c +53.724964 2.576626 52.623505 1.475166 51.268738 0.784878 c +50.360626 0.322170 49.416901 0.151012 48.468075 0.073490 c +47.569088 0.000038 46.477638 0.000076 45.212460 0.000122 c +45.120007 0.000122 l +38.880013 0.000122 l +38.787560 0.000122 l +37.522377 0.000076 36.430927 0.000038 35.531940 0.073490 c +34.583111 0.151012 33.639385 0.322170 32.731274 0.784878 c +31.376507 1.475166 30.275047 2.576626 29.584759 3.931393 c +29.122053 4.839504 28.950893 5.783230 28.873371 6.732056 c +28.799923 7.631027 28.799959 8.722462 28.800003 9.987614 c +28.800005 10.080124 l +28.800005 33.120132 l +28.800003 33.212639 l +28.799959 34.477791 28.799923 35.569221 28.873371 36.468193 c +28.950893 37.417023 29.122053 38.360748 29.584759 39.268856 c +30.275047 40.623623 31.376507 41.725082 32.731274 42.415371 c +33.639385 42.878078 34.583111 43.049236 35.531937 43.126759 c +35.682583 43.139069 35.838634 43.149311 36.000000 43.157837 c +36.000000 43.200127 l +36.720001 43.200127 l +36.824287 43.200127 36.927864 43.197105 37.030655 43.191143 c +37.571739 43.200169 38.158119 43.200150 38.787495 43.200127 c +h +36.834694 38.386337 m +36.487091 38.377934 36.188641 38.364418 35.922810 38.342701 c +35.270821 38.289429 35.029095 38.199005 34.910427 38.138542 c +34.458839 37.908443 34.091686 37.541290 33.861591 37.089703 c +33.801128 36.971039 33.710701 36.729309 33.657433 36.077320 c +33.601871 35.397312 33.600006 34.503857 33.600006 33.120132 c +33.600006 10.080124 l +33.600006 8.696396 33.601871 7.802940 33.657433 7.122929 c +33.710701 6.470940 33.801128 6.229210 33.861591 6.110546 c +34.091686 5.658958 34.458839 5.291805 34.910427 5.061707 c +35.029095 5.001244 35.270821 4.910820 35.922813 4.857548 c +36.602825 4.801991 37.496281 4.800125 38.880013 4.800125 c +45.120007 4.800125 l +46.503735 4.800125 47.397190 4.801991 48.077202 4.857548 c +48.729191 4.910820 48.970917 5.001244 49.089584 5.061707 c +49.541172 5.291805 49.908325 5.658958 50.138420 6.110546 c +50.198887 6.229214 50.289310 6.470940 50.342583 7.122929 c +50.398140 7.802937 50.400005 8.696392 50.400005 10.080116 c +50.400005 33.120125 l +50.400005 34.503853 50.398140 35.397308 50.342583 36.077320 c +50.289310 36.729313 50.198883 36.971039 50.138420 37.089703 c +49.908325 37.541290 49.541172 37.908443 49.089584 38.138542 c +48.970921 38.199005 48.729191 38.289429 48.077198 38.342701 c +47.811367 38.364418 47.512917 38.377934 47.165310 38.386337 c +46.955601 38.334915 46.799999 38.145691 46.799999 37.920128 c +46.799999 36.197002 45.403133 34.800129 43.680000 34.800129 c +40.320000 34.800129 l +38.596870 34.800129 37.200001 36.197002 37.200001 37.920128 c +37.200001 38.145691 37.044403 38.334915 36.834694 38.386337 c +h +26.405619 9.600121 m +9.600000 9.600121 l +9.600000 28.320120 l +9.600000 29.703850 9.601868 30.597305 9.657425 31.277317 c +9.710695 31.929310 9.801123 32.171036 9.861584 32.289700 c +10.091681 32.741287 10.458834 33.108444 10.910423 33.338539 c +11.029089 33.399002 11.270815 33.489426 11.922806 33.542698 c +12.602816 33.598259 13.496273 33.600124 14.880001 33.600124 c +26.405619 33.600124 l +26.422094 35.719273 26.486925 37.205048 26.742056 38.400124 c +14.880001 38.400124 l +14.787493 38.400127 l +14.787432 38.400127 l +13.522301 38.400169 12.430891 38.400204 11.531933 38.326756 c +10.583105 38.249233 9.639380 38.078075 8.731268 37.615372 c +7.376502 36.925083 6.275042 35.823624 5.584754 34.468857 c +5.122047 33.560745 4.950889 32.617020 4.873367 31.668190 c +4.799918 30.769217 4.799955 29.677786 4.799998 28.412628 c +4.800000 28.320120 l +4.800000 9.600121 l +1.200000 9.600121 l +0.537258 9.600121 0.000000 9.062862 0.000000 8.400120 c +0.000000 6.411896 1.611772 4.800117 3.599997 4.800117 c +4.800000 4.800117 l +7.200000 4.800117 l +26.742058 4.800117 l +26.486925 5.995197 26.422094 7.480972 26.405619 9.600121 c +h +f* +n +Q + +endstream +endobj + +3 0 obj + 5604 +endobj + +4 0 obj + << /Annots [] + /Type /Page + /MediaBox [ 0.000000 0.000000 72.000000 72.000000 ] + /Resources 1 0 R + /Contents 2 0 R + /Parent 5 0 R + >> +endobj + +5 0 obj + << /Kids [ 4 0 R ] + /Count 1 + /Type /Pages + >> +endobj + +6 0 obj + << /Pages 5 0 R + /Type /Catalog + >> +endobj + +xref +0 7 +0000000000 65535 f +0000000010 00000 n +0000000034 00000 n +0000005694 00000 n +0000005717 00000 n +0000005890 00000 n +0000005964 00000 n +trailer +<< /ID [ (some) (id) ] + /Root 6 0 R + /Size 7 +>> +startxref +6023 +%%EOF \ No newline at end of file diff --git a/submodules/TelegramUI/Sources/PeerInfo/PeerInfoScreen.swift b/submodules/TelegramUI/Sources/PeerInfo/PeerInfoScreen.swift index 4ff7bf17c0..04fa0b309a 100644 --- a/submodules/TelegramUI/Sources/PeerInfo/PeerInfoScreen.swift +++ b/submodules/TelegramUI/Sources/PeerInfo/PeerInfoScreen.swift @@ -3503,7 +3503,7 @@ final class PeerInfoScreenNode: ViewControllerTracingNode, UIScrollViewDelegate let filteredButtons = allHeaderButtons.subtracting(headerButtons) var canChangeColors = false - if peer is TelegramUser, strongSelf.data?.encryptionKeyFingerprint == nil { + if let peer = peer as? TelegramUser, peer.botInfo == nil && strongSelf.data?.encryptionKeyFingerprint == nil { canChangeColors = true } diff --git a/submodules/TelegramUniversalVideoContent/Sources/NativeVideoContent.swift b/submodules/TelegramUniversalVideoContent/Sources/NativeVideoContent.swift index 1ec861766b..d4e64eee59 100644 --- a/submodules/TelegramUniversalVideoContent/Sources/NativeVideoContent.swift +++ b/submodules/TelegramUniversalVideoContent/Sources/NativeVideoContent.swift @@ -37,8 +37,9 @@ public final class NativeVideoContent: UniversalVideoContent { let continuePlayingWithoutSoundOnLostAudioSession: Bool let placeholderColor: UIColor let tempFilePath: String? + let captureProtected: Bool - public init(id: NativeVideoContentId, fileReference: FileMediaReference, imageReference: ImageMediaReference? = nil, streamVideo: MediaPlayerStreaming = .none, loopVideo: Bool = false, enableSound: Bool = true, baseRate: Double = 1.0, fetchAutomatically: Bool = true, onlyFullSizeThumbnail: Bool = false, useLargeThumbnail: Bool = false, autoFetchFullSizeThumbnail: Bool = false, startTimestamp: Double? = nil, continuePlayingWithoutSoundOnLostAudioSession: Bool = false, placeholderColor: UIColor = .white, tempFilePath: String? = nil) { + public init(id: NativeVideoContentId, fileReference: FileMediaReference, imageReference: ImageMediaReference? = nil, streamVideo: MediaPlayerStreaming = .none, loopVideo: Bool = false, enableSound: Bool = true, baseRate: Double = 1.0, fetchAutomatically: Bool = true, onlyFullSizeThumbnail: Bool = false, useLargeThumbnail: Bool = false, autoFetchFullSizeThumbnail: Bool = false, startTimestamp: Double? = nil, continuePlayingWithoutSoundOnLostAudioSession: Bool = false, placeholderColor: UIColor = .white, tempFilePath: String? = nil, captureProtected: Bool = false) { self.id = id self.nativeId = id self.fileReference = fileReference @@ -69,10 +70,11 @@ public final class NativeVideoContent: UniversalVideoContent { self.continuePlayingWithoutSoundOnLostAudioSession = continuePlayingWithoutSoundOnLostAudioSession self.placeholderColor = placeholderColor self.tempFilePath = tempFilePath + self.captureProtected = captureProtected } public func makeContentNode(postbox: Postbox, audioSession: ManagedAudioSession) -> UniversalVideoContentNode & ASDisplayNode { - return NativeVideoContentNode(postbox: postbox, audioSessionManager: audioSession, fileReference: self.fileReference, imageReference: self.imageReference, streamVideo: self.streamVideo, loopVideo: self.loopVideo, enableSound: self.enableSound, baseRate: self.baseRate, fetchAutomatically: self.fetchAutomatically, onlyFullSizeThumbnail: self.onlyFullSizeThumbnail, useLargeThumbnail: self.useLargeThumbnail, autoFetchFullSizeThumbnail: self.autoFetchFullSizeThumbnail, startTimestamp: self.startTimestamp, continuePlayingWithoutSoundOnLostAudioSession: self.continuePlayingWithoutSoundOnLostAudioSession, placeholderColor: self.placeholderColor, tempFilePath: self.tempFilePath) + return NativeVideoContentNode(postbox: postbox, audioSessionManager: audioSession, fileReference: self.fileReference, imageReference: self.imageReference, streamVideo: self.streamVideo, loopVideo: self.loopVideo, enableSound: self.enableSound, baseRate: self.baseRate, fetchAutomatically: self.fetchAutomatically, onlyFullSizeThumbnail: self.onlyFullSizeThumbnail, useLargeThumbnail: self.useLargeThumbnail, autoFetchFullSizeThumbnail: self.autoFetchFullSizeThumbnail, startTimestamp: self.startTimestamp, continuePlayingWithoutSoundOnLostAudioSession: self.continuePlayingWithoutSoundOnLostAudioSession, placeholderColor: self.placeholderColor, tempFilePath: self.tempFilePath, captureProtected: self.captureProtected) } public func isEqual(to other: UniversalVideoContent) -> Bool { @@ -96,6 +98,7 @@ private final class NativeVideoContentNode: ASDisplayNode, UniversalVideoContent private let loopVideo: Bool private let baseRate: Double private let audioSessionManager: ManagedAudioSession + private let captureProtected: Bool private let player: MediaPlayer private var thumbnailPlayer: MediaPlayer? @@ -145,7 +148,7 @@ private final class NativeVideoContentNode: ASDisplayNode, UniversalVideoContent private var shouldPlay: Bool = false - init(postbox: Postbox, audioSessionManager: ManagedAudioSession, fileReference: FileMediaReference, imageReference: ImageMediaReference?, streamVideo: MediaPlayerStreaming, loopVideo: Bool, enableSound: Bool, baseRate: Double, fetchAutomatically: Bool, onlyFullSizeThumbnail: Bool, useLargeThumbnail: Bool, autoFetchFullSizeThumbnail: Bool, startTimestamp: Double?, continuePlayingWithoutSoundOnLostAudioSession: Bool = false, placeholderColor: UIColor, tempFilePath: String?) { + init(postbox: Postbox, audioSessionManager: ManagedAudioSession, fileReference: FileMediaReference, imageReference: ImageMediaReference?, streamVideo: MediaPlayerStreaming, loopVideo: Bool, enableSound: Bool, baseRate: Double, fetchAutomatically: Bool, onlyFullSizeThumbnail: Bool, useLargeThumbnail: Bool, autoFetchFullSizeThumbnail: Bool, startTimestamp: Double?, continuePlayingWithoutSoundOnLostAudioSession: Bool = false, placeholderColor: UIColor, tempFilePath: String?, captureProtected: Bool) { self.postbox = postbox self.fileReference = fileReference self.placeholderColor = placeholderColor @@ -153,6 +156,7 @@ private final class NativeVideoContentNode: ASDisplayNode, UniversalVideoContent self.loopVideo = loopVideo self.baseRate = baseRate self.audioSessionManager = audioSessionManager + self.captureProtected = captureProtected self.imageNode = TransformImageNode() @@ -169,6 +173,7 @@ private final class NativeVideoContentNode: ASDisplayNode, UniversalVideoContent }) } self.playerNode = MediaPlayerNode(backgroundThread: false) + self.playerNode.captureProtected = captureProtected self.player.attachPlayerNode(self.playerNode) self.dimensions = fileReference.media.dimensions?.cgSize