mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-10-09 03:20:48 +00:00
Don't initialize camera on attach menu appearance if effects are disabled
This commit is contained in:
parent
a65d7bba8f
commit
b39238c6db
@ -408,17 +408,26 @@ public final class MediaPickerScreen: ViewController, AttachmentContainable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if let controller = self.controller, case .assets(nil) = controller.subject {
|
if let controller = self.controller, case .assets(nil) = controller.subject {
|
||||||
|
let enableAnimations = self.controller?.context.sharedContext.energyUsageSettings.fullTranslucency ?? true
|
||||||
|
|
||||||
let cameraView = TGAttachmentCameraView(forSelfPortrait: false, videoModeByDefault: controller.bannedSendPhotos != nil && controller.bannedSendVideos == nil)!
|
let cameraView = TGAttachmentCameraView(forSelfPortrait: false, videoModeByDefault: controller.bannedSendPhotos != nil && controller.bannedSendVideos == nil)!
|
||||||
cameraView.clipsToBounds = true
|
cameraView.clipsToBounds = true
|
||||||
cameraView.removeCorners()
|
cameraView.removeCorners()
|
||||||
cameraView.pressed = { [weak self] in
|
cameraView.pressed = { [weak self, weak cameraView] in
|
||||||
if let strongSelf = self, !strongSelf.openingMedia {
|
if let strongSelf = self, !strongSelf.openingMedia {
|
||||||
strongSelf.dismissInput()
|
strongSelf.dismissInput()
|
||||||
strongSelf.controller?.openCamera?(strongSelf.cameraView)
|
strongSelf.controller?.openCamera?(strongSelf.cameraView)
|
||||||
|
|
||||||
|
if !enableAnimations {
|
||||||
|
cameraView?.startPreview()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
self.cameraView = cameraView
|
self.cameraView = cameraView
|
||||||
cameraView.startPreview()
|
|
||||||
|
if enableAnimations {
|
||||||
|
cameraView.startPreview()
|
||||||
|
}
|
||||||
|
|
||||||
self.gridNode.scrollView.addSubview(cameraView)
|
self.gridNode.scrollView.addSubview(cameraView)
|
||||||
self.gridNode.addSubnode(self.cameraActivateAreaNode)
|
self.gridNode.addSubnode(self.cameraActivateAreaNode)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user