<commit_before>import ImageSource
import UIKit
import AVFoundation

final class CameraView: UIView, CameraViewInput, ThemeConfigurable {
    
    typealias ThemeType = MediaPickerRootModuleUITheme
    
    private let accessDeniedView = AccessDeniedView()
    private var cameraOutputView: CameraOutputView?
    private var outputParameters: CameraOutputParameters?
    private var focusIndicator: FocusIndicator?
    private var theme: ThemeType?
    
    // MARK: - Init
    
    init() {
        super.init(frame: .zero)
        
        accessDeniedView.isHidden = true
        
        addSubview(accessDeniedView)
    }
    
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    // MARK: - UIView
    
    override func layoutSubviews() {
        super.layoutSubviews()
        
        accessDeniedView.bounds = bounds
        accessDeniedView.center = bounds.center
        
        cameraOutputView?.frame = bounds
    }
    
    override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {
        super.touchesBegan(touches, with: event)
        
        let screenSize = bounds.size
        guard screenSize.width != 0 && screenSize.height != 0 else {
            return
        }
        
        if let touchPoint = touches.first?.location(in: self) {
            let focusOriginX = touchPoint.y / screenSize.height
            let focusOriginY = 1.0 - touchPoint.x / screenSize.width
            let focusPoint = CGPoint(x: focusOriginX, y: focusOriginY)
            
            onFocusTap?(focusPoint, touchPoint)
        }
    }
    
    // MARK: - CameraViewInput
    
    var onFocusTap: ((_ focusPoint: CGPoint, _ touchPoint: CGPoint) -> Void)?
    
    func displayFocus(onPoint focusPoint: CGPoint) {
        focusIndicator?.hide()
        focusIndicator = FocusIndicator()
        if let theme = theme {
            focusIndicator?.setColor(theme.focusIndicatorColor)
        }
        focusIndicator?.animate(in: layer, focusPoint: focusPoint)
    }
    <commit_msg>SEL-496: Prevent focus animation if user denied access to camera<commit_after>import ImageSource
import UIKit
import AVFoundation

final class CameraView: UIView, CameraViewInput, ThemeConfigurable {
    
    typealias ThemeType = MediaPickerRootModuleUITheme
    
    private let accessDeniedView = AccessDeniedView()
    private var cameraOutputView: CameraOutputView?
    private var outputParameters: CameraOutputParameters?
    private var focusIndicator: FocusIndicator?
    private var theme: ThemeType?
    
    // MARK: - Init
    
    init() {
        super.init(frame: .zero)
        
        accessDeniedView.isHidden = true
        
        addSubview(accessDeniedView)
    }
    
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    // MARK: - UIView
    
    override func layoutSubviews() {
        super.layoutSubviews()
        
        accessDeniedView.bounds = bounds
        accessDeniedView.center = bounds.center
        
        cameraOutputView?.frame = bounds
    }
    
    override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {
        super.touchesBegan(touches, with: event)
        
        let screenSize = bounds.size
        guard screenSize.width != 0 && screenSize.height != 0 && accessDeniedView.isHidden == true  else {
            return
        }
        
        if let touchPoint = touches.first?.location(in: self) {
            let focusOriginX = touchPoint.y / screenSize.height
            let focusOriginY = 1.0 - touchPoint.x / screenSize.width
            let focusPoint = CGPoint(x: focusOriginX, y: focusOriginY)
            
            onFocusTap?(focusPoint, touchPoint)
        }
    }
    
    // MARK: - CameraViewInput
    
    var onFocusTap: ((_ focusPoint: CGPoint, _ touchPoint: CGPoint) -> Void)?
    
    func displayFocus(onPoint focusPoint: CGPoint) {
        focusIndicator?.hide()
        focusIndicator = FocusIndicator()
        if let theme = theme {
            focusIndicator?.setColor(theme.focusIndicatorColor)
        }
        focusIndicator?.animate(in: layer, focusPoint: focusPoint)
    }
    
{'fraction_non_alphanumeric': 0.08004722550177096, 'fraction_numerical': 0.0025974025974025974, 'mean_word_length': 2.245977011494253, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3864058', 'n_tokens_mistral': 1181, 'n_tokens_neox': 1165, 'n_words': 275}