Various fixes

This commit is contained in:
Ilya Laktyushin 2023-06-22 02:51:48 +04:00
parent 270f72dac0
commit 75c01b0897
4 changed files with 9 additions and 9 deletions

View File

@ -38,14 +38,16 @@ final class CameraDeviceContext {
private weak var previewView: CameraSimplePreviewView? private weak var previewView: CameraSimplePreviewView?
private let exclusive: Bool private let exclusive: Bool
private let additional: Bool
let device = CameraDevice() let device = CameraDevice()
let input = CameraInput() let input = CameraInput()
let output: CameraOutput let output: CameraOutput
init(session: CameraSession, exclusive: Bool) { init(session: CameraSession, exclusive: Bool, additional: Bool) {
self.session = session self.session = session
self.exclusive = exclusive self.exclusive = exclusive
self.additional = additional
self.output = CameraOutput(exclusive: exclusive) self.output = CameraOutput(exclusive: exclusive)
} }
@ -169,7 +171,7 @@ private final class CameraContext {
self.simplePreviewView = previewView self.simplePreviewView = previewView
self.secondaryPreviewView = secondaryPreviewView self.secondaryPreviewView = secondaryPreviewView
self.mainDeviceContext = CameraDeviceContext(session: session, exclusive: true) self.mainDeviceContext = CameraDeviceContext(session: session, exclusive: true, additional: false)
self.configure { self.configure {
self.mainDeviceContext.configure(position: configuration.position, previewView: self.simplePreviewView, audio: configuration.audio, photo: configuration.photo, metadata: configuration.metadata) self.mainDeviceContext.configure(position: configuration.position, previewView: self.simplePreviewView, audio: configuration.audio, photo: configuration.photo, metadata: configuration.metadata)
} }
@ -313,10 +315,10 @@ private final class CameraContext {
if enabled { if enabled {
self.configure { self.configure {
self.mainDeviceContext.invalidate() self.mainDeviceContext.invalidate()
self.mainDeviceContext = CameraDeviceContext(session: self.session, exclusive: false) self.mainDeviceContext = CameraDeviceContext(session: self.session, exclusive: false, additional: false)
self.mainDeviceContext.configure(position: .back, previewView: self.simplePreviewView, audio: self.initialConfiguration.audio, photo: self.initialConfiguration.photo, metadata: self.initialConfiguration.metadata) self.mainDeviceContext.configure(position: .back, previewView: self.simplePreviewView, audio: self.initialConfiguration.audio, photo: self.initialConfiguration.photo, metadata: self.initialConfiguration.metadata)
self.additionalDeviceContext = CameraDeviceContext(session: self.session, exclusive: false) self.additionalDeviceContext = CameraDeviceContext(session: self.session, exclusive: false, additional: true)
self.additionalDeviceContext?.configure(position: .front, previewView: self.secondaryPreviewView, audio: false, photo: true, metadata: false) self.additionalDeviceContext?.configure(position: .front, previewView: self.secondaryPreviewView, audio: false, photo: true, metadata: false)
} }
self.mainDeviceContext.output.processSampleBuffer = { [weak self] sampleBuffer, pixelBuffer, connection in self.mainDeviceContext.output.processSampleBuffer = { [weak self] sampleBuffer, pixelBuffer, connection in
@ -355,7 +357,7 @@ private final class CameraContext {
self.additionalDeviceContext?.invalidate() self.additionalDeviceContext?.invalidate()
self.additionalDeviceContext = nil self.additionalDeviceContext = nil
self.mainDeviceContext = CameraDeviceContext(session: self.session, exclusive: true) self.mainDeviceContext = CameraDeviceContext(session: self.session, exclusive: true, additional: false)
self.mainDeviceContext.configure(position: .back, previewView: self.simplePreviewView, audio: self.initialConfiguration.audio, photo: self.initialConfiguration.photo, metadata: self.initialConfiguration.metadata) self.mainDeviceContext.configure(position: .back, previewView: self.simplePreviewView, audio: self.initialConfiguration.audio, photo: self.initialConfiguration.photo, metadata: self.initialConfiguration.metadata)
} }
self.mainDeviceContext.output.processSampleBuffer = { [weak self] sampleBuffer, pixelBuffer, connection in self.mainDeviceContext.output.processSampleBuffer = { [weak self] sampleBuffer, pixelBuffer, connection in

View File

@ -54,7 +54,6 @@ public class CameraSimplePreviewView: UIView {
self.videoPreviewLayer.videoGravity = .resizeAspectFill self.videoPreviewLayer.videoGravity = .resizeAspectFill
self.placeholderView.alpha = 0.0
self.placeholderView.contentMode = .scaleAspectFill self.placeholderView.contentMode = .scaleAspectFill
self.placeholderView.image = additional ? CameraSimplePreviewView.lastAdditionalStateImage() : CameraSimplePreviewView.lastStateImage() self.placeholderView.image = additional ? CameraSimplePreviewView.lastAdditionalStateImage() : CameraSimplePreviewView.lastStateImage()
self.addSubview(self.placeholderView) self.addSubview(self.placeholderView)
@ -72,8 +71,6 @@ public class CameraSimplePreviewView: UIView {
self.removePlaceholder(delay: 0.15) self.removePlaceholder(delay: 0.15)
} }
} }
} else {
self.placeholderView.alpha = 1.0
} }
} }

View File

@ -1879,7 +1879,7 @@ public final class StoryItemSetContainerComponent: Component {
self.addSubview(targetView) self.addSubview(targetView)
reactionContextNode.willAnimateOutToReaction(value: updateReaction.reaction) reactionContextNode.willAnimateOutToReaction(value: updateReaction.reaction)
reactionContextNode.animateOutToReaction(value: updateReaction.reaction, targetView: targetView, hideNode: false, animateTargetContainer: nil, addStandaloneReactionAnimation: { [weak self] standaloneReactionAnimation in reactionContextNode.animateOutToReaction(value: updateReaction.reaction, targetView: targetView, hideNode: false, animateTargetContainer: nil, addStandaloneReactionAnimation: "".isEmpty ? nil : { [weak self] standaloneReactionAnimation in
guard let self else { guard let self else {
return return
} }

View File

@ -587,6 +587,7 @@ public func refreshChatTextInputAttributes(textView: UITextView, primaryTextColo
} }
} else if key == ChatTextInputAttributes.customEmoji, let value = value as? ChatTextInputTextCustomEmojiAttribute { } else if key == ChatTextInputAttributes.customEmoji, let value = value as? ChatTextInputTextCustomEmojiAttribute {
textView.textStorage.addAttribute(key, value: value, range: range) textView.textStorage.addAttribute(key, value: value, range: range)
textView.textStorage.addAttribute(NSAttributedString.Key.foregroundColor, value: UIColor.clear, range: range)
} }
} }