Various fixes

This commit is contained in:
Ilya Laktyushin
2023-11-27 20:23:38 +04:00
parent 010d7d7412
commit 920406c136
6 changed files with 143 additions and 16 deletions

View File

@@ -363,6 +363,7 @@ public class DrawingStickerEntityView: DrawingEntityView {
self.addSubview(cameraPreviewView)
self.cameraPreviewView = cameraPreviewView
self.progressLayer.opacity = 1.0
self.progressLayer.transform = CATransform3DMakeRotation(-.pi / 2.0, 0.0, 0.0, 1.0)
self.progressLayer.fillColor = UIColor.clear.cgColor
self.progressLayer.strokeColor = UIColor(rgb: 0xffffff, alpha: 0.5).cgColor
@@ -385,17 +386,38 @@ public class DrawingStickerEntityView: DrawingEntityView {
guard let cameraPreviewView = self.cameraPreviewView else {
return
}
Queue.mainQueue().after(0.3, {
Queue.mainQueue().after(0.1, {
self.cameraPreviewView = nil
cameraPreviewView.layer.animateAlpha(from: 1.0, to: 0.0, duration: 0.2, removeOnCompletion: false, completion: { _ in
cameraPreviewView.removeFromSuperview()
})
cameraPreviewView.removeFromSuperview()
if let cameraSnapshotView = self.cameraSnapshotView {
self.cameraSnapshotView = nil
UIView.animate(withDuration: 0.25, animations: {
cameraSnapshotView.alpha = 0.0
}, completion: { _ in
cameraSnapshotView.removeFromSuperview()
})
}
})
self.progressLayer.opacity = 0.0
self.progressLayer.animateAlpha(from: 1.0, to: 0.0, duration: 0.2, completion: { _ in
self.progressLayer.removeFromSuperlayer()
self.progressLayer.path = nil
})
self.progressLayer.removeFromSuperlayer()
self.progressLayer.path = nil
self.progressDisposable.set(nil)
}
public func snapshotCameraPreviewView() {
guard let cameraPreviewView = self.cameraPreviewView else {
return
}
if let snapshot = cameraPreviewView.snapshotView(afterScreenUpdates: false) {
self.cameraSnapshotView = snapshot
self.addSubview(snapshot)
}
self.layer.addSublayer(self.progressLayer)
}
private var cameraBlurView: BlurView?
private var cameraSnapshotView: UIView?
public func beginCameraSwitch() {