//
//  LogoutPopupVC.swift
//  WOKA
//
//  Created by MacBook Pro on 16/07/24.
//

import UIKit

class LogoutPopupVC: UIViewController {

    @IBOutlet weak var outerView: UIView!
    @IBOutlet weak var guestLoginStack: UIStackView!
    
    override func viewDidLoad() {
        super.viewDidLoad()
        let tapGesture = UITapGestureRecognizer(target: self, action: #selector(handleTap(_:)))
                outerView.addGestureRecognizer(tapGesture)
    }

    @objc func handleTap(_ gesture: UITapGestureRecognizer) {
        let location = gesture.location(in: outerView)
        if !guestLoginStack.frame.contains(location) {
            self.dismiss(animated: true)
        }
    }
    
    @IBAction func closeBtnTapped(_ sender: UIButton) {
        self.dismiss(animated: true)
    }
    
    @IBAction func freeSignInTapped(_ sender: LocalisedElementsButton) {
        UIApplication.setRootView(LoginNavVC.instantiate(from: .AuthenticationSB))
    }
}
