mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00
Disable dual camera on XR
This commit is contained in:
parent
e1626c11af
commit
94835e8272
@ -144,7 +144,7 @@ private final class CameraContext {
|
||||
transform = CGAffineTransformTranslate(transform, 0.0, -size.height)
|
||||
ciImage = ciImage.transformed(by: transform)
|
||||
}
|
||||
ciImage = ciImage.clampedToExtent().applyingGaussianBlur(sigma: Camera.isDualCameraSupported ? 100.0 : 40.0).cropped(to: CGRect(origin: .zero, size: size))
|
||||
ciImage = ciImage.clampedToExtent().applyingGaussianBlur(sigma: Camera.isDualCameraSupported(forRoundVideo: true) ? 100.0 : 40.0).cropped(to: CGRect(origin: .zero, size: size))
|
||||
if let cgImage = self.ciContext.createCGImage(ciImage, from: ciImage.extent) {
|
||||
let uiImage = UIImage(cgImage: cgImage, scale: 1.0, orientation: .right)
|
||||
if front {
|
||||
@ -1056,8 +1056,11 @@ public final class Camera {
|
||||
}
|
||||
}
|
||||
|
||||
public static var isDualCameraSupported: Bool {
|
||||
public static func isDualCameraSupported(forRoundVideo: Bool = false) -> Bool {
|
||||
if #available(iOS 13.0, *), AVCaptureMultiCamSession.isMultiCamSupported && !DeviceModel.current.isIpad {
|
||||
if forRoundVideo && DeviceModel.current == .iPhoneXR {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
} else {
|
||||
return false
|
||||
|
@ -1061,7 +1061,7 @@ private final class CameraScreenComponent: CombinedComponent {
|
||||
.disappear(.default(scale: true))
|
||||
)
|
||||
|
||||
if !isTablet && Camera.isDualCameraSupported {
|
||||
if !isTablet && Camera.isDualCameraSupported(forRoundVideo: false) {
|
||||
let dualButton = dualButton.update(
|
||||
component: CameraButton(
|
||||
content: AnyComponentWithIdentity(
|
||||
@ -1513,7 +1513,7 @@ public class CameraScreen: ViewController {
|
||||
self.previewBlurView = BlurView()
|
||||
self.previewBlurView.isUserInteractionEnabled = false
|
||||
|
||||
var isDualCameraEnabled = Camera.isDualCameraSupported
|
||||
var isDualCameraEnabled = Camera.isDualCameraSupported(forRoundVideo: false)
|
||||
if isDualCameraEnabled {
|
||||
if let isDualCameraEnabledValue = UserDefaults.standard.object(forKey: "TelegramStoryCameraIsDualEnabled") as? NSNumber {
|
||||
isDualCameraEnabled = isDualCameraEnabledValue.boolValue
|
||||
|
@ -621,7 +621,7 @@ public class VideoMessageCameraScreen: ViewController {
|
||||
self.previewContainerView = UIView()
|
||||
self.previewContainerView.clipsToBounds = true
|
||||
|
||||
let isDualCameraEnabled = Camera.isDualCameraSupported
|
||||
let isDualCameraEnabled = Camera.isDualCameraSupported(forRoundVideo: true)
|
||||
let isFrontPosition = "".isEmpty
|
||||
|
||||
self.mainPreviewView = CameraSimplePreviewView(frame: .zero, main: true, roundVideo: true)
|
||||
@ -695,7 +695,7 @@ public class VideoMessageCameraScreen: ViewController {
|
||||
func withReadyCamera(isFirstTime: Bool = false, _ f: @escaping () -> Void) {
|
||||
let previewReady: Signal<Bool, NoError>
|
||||
if #available(iOS 13.0, *) {
|
||||
previewReady = self.cameraState.isDualCameraEnabled ? self.additionalPreviewView.isPreviewing : self.mainPreviewView.isPreviewing |> delay(0.25, queue: Queue.mainQueue())
|
||||
previewReady = self.cameraState.isDualCameraEnabled ? self.additionalPreviewView.isPreviewing : self.mainPreviewView.isPreviewing |> delay(0.3, queue: Queue.mainQueue())
|
||||
} else {
|
||||
previewReady = .single(true) |> delay(0.35, queue: Queue.mainQueue())
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user