//
// © 2017-2020 Qualcomm Technologies, Inc. and/or its subsidiaries. All rights reserved.
//

import UIKit

class WiFiAdviceNavigationController: UINavigationController {
    // This exists to allow stringless instantiation from storyboard - do not remove
}

// MARK: -

class WiFiAdviceContainerViewController: ModalViewController {
    override func viewDidLoad() {
        hasCloseButton = false
        title = NSLocalizedString("WELCOME", comment: "Speaker help screen title")
        
        super.viewDidLoad()
        
        let rightBarButton = UIBarButtonItem(title: NSLocalizedString("NEXT", comment: "Next button title"),
                                             style: .plain,
                                             target: self,
                                             action: #selector(nextButtonTapped(_ :)))
        navigationItem.rightBarButtonItem = rightBarButton
    }
}

// MARK: - UI Actions
extension WiFiAdviceContainerViewController {
    @objc private func nextButtonTapped(_ sender: AnyObject?) {
        if let presenter = presentingViewController {
            presenter.dismiss(animated: true, completion: {
                appSpinnerPresenter()?.searchForSpeakers(failureIsError: true)
            })
        }
    }
}
