From 995dd6afdf4332175e788212934097786aae21a3 Mon Sep 17 00:00:00 2001 From: Riley Testut Date: Thu, 16 Nov 2023 16:10:48 -0600 Subject: [PATCH] =?UTF-8?q?Shows=20=E2=80=9CLearn=20More=E2=80=9D=20FAQ=20?= =?UTF-8?q?button=20if=20there=20are=20no=20games?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Delta/Game Selection/GamesViewController.swift | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/Delta/Game Selection/GamesViewController.swift b/Delta/Game Selection/GamesViewController.swift index a0fe535..d2b8200 100644 --- a/Delta/Game Selection/GamesViewController.swift +++ b/Delta/Game Selection/GamesViewController.swift @@ -91,10 +91,17 @@ extension GamesViewController { super.viewDidLoad() + let faqButton = UIButton(type: .system) + faqButton.addTarget(self, action: #selector(GamesViewController.openFAQ), for: .primaryActionTriggered) + faqButton.setTitle(NSLocalizedString("Learn More…", comment: ""), for: .normal) + faqButton.titleLabel?.font = UIFont.preferredFont(forTextStyle: .title3) + self.placeholderView = RSTPlaceholderView(frame: self.view.bounds) self.placeholderView.autoresizingMask = [.flexibleWidth, .flexibleHeight] self.placeholderView.textLabel.text = NSLocalizedString("No Games", comment: "") self.placeholderView.detailTextLabel.text = NSLocalizedString("You can import games by pressing the + button in the top right.", comment: "") + self.placeholderView.stackView.addArrangedSubview(faqButton) + self.placeholderView.stackView.setCustomSpacing(20.0, after: self.placeholderView.detailTextLabel) self.view.insertSubview(self.placeholderView, at: 0) self.pageControl = UIPageControl() @@ -350,6 +357,7 @@ private extension GamesViewController if let viewController = self.viewControllerForIndex(index) { self.pageViewController.view.setHidden(false, animated: animated) + self.pageViewController.view.superview?.setHidden(false, animated: animated) self.placeholderView.setHidden(true, animated: animated) self.pageViewController.setViewControllers([viewController], direction: .forward, animated: false, completion: nil) @@ -368,9 +376,16 @@ private extension GamesViewController self.title = NSLocalizedString("Games", comment: "") self.pageViewController.view.setHidden(true, animated: animated) + self.pageViewController.view.superview?.setHidden(true, animated: animated) self.placeholderView.setHidden(false, animated: animated) } } + + @objc func openFAQ() + { + let faqURL = URL(string: "https://faq.deltaemulator.com/getting-started/importing-games")! + UIApplication.shared.open(faqURL) + } } //MARK: - Importing -