From eea0ef258c382b189fbdd9d9c5e250eec92a285e Mon Sep 17 00:00:00 2001 From: Shadowfacts Date: Thu, 8 Aug 2024 20:39:55 -0700 Subject: [PATCH] Add pointless ToS nag before logging in Thanks, App Review --- .../Onboarding/OnboardingViewController.swift | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/Tusker/Screens/Onboarding/OnboardingViewController.swift b/Tusker/Screens/Onboarding/OnboardingViewController.swift index 36f2e775..5e6553f7 100644 --- a/Tusker/Screens/Onboarding/OnboardingViewController.swift +++ b/Tusker/Screens/Onboarding/OnboardingViewController.swift @@ -245,10 +245,17 @@ extension OnboardingViewController { extension OnboardingViewController: InstanceSelectorTableViewControllerDelegate { func didSelectInstance(url instanceURL: URL) { - Task { - await self.login(to: instanceURL) - instanceSelector.tableView.selectRow(at: nil, animated: true, scrollPosition: .none) - } + let alert = UIAlertController(title: "Terms of Service", message: "By logging in to '\(instanceURL.host!)', you agree to follow all applicable rules and terms of service for that instance.", preferredStyle: .alert) + alert.addAction(UIAlertAction(title: "Cancel", style: .cancel, handler: { [unowned self] _ in + self.instanceSelector.tableView.selectRow(at: nil, animated: false, scrollPosition: .none) + })) + alert.addAction(UIAlertAction(title: "Continue", style: .default, handler: { [unowned self] _ in + Task { + await self.login(to: instanceURL) + self.instanceSelector.tableView.selectRow(at: nil, animated: true, scrollPosition: .none) + } + })) + present(alert, animated: true) } }