From 428eec4607fc04afb95be0b64e89b11401cc8176 Mon Sep 17 00:00:00 2001 From: decanus <7621705+decanus@users.noreply.github.com> Date: Thu, 27 May 2021 14:23:54 +0200 Subject: [PATCH] removed --- CHANGELOG.md | 2 + Sources/AppDelegate.swift | 6 +- Sources/NavigationViewController.swift | 4 - .../PMFSurveyPromptViewController.swift | 101 ------------------ Sources/UserDefaultsKeys.swift | 4 - Sources/UserPrompts.swift | 15 --- 6 files changed, 3 insertions(+), 129 deletions(-) delete mode 100644 Sources/Scenes/PMFSurveyPrompt/PMFSurveyPromptViewController.swift diff --git a/CHANGELOG.md b/CHANGELOG.md index 9590d025..8e72ae9b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ ## [Unreleased] + - Thank you for everyone who recently completed our survey. + ## [2.33.0] - 2021-05-19Z - We are working on getting better at recommending who you should follow! diff --git a/Sources/AppDelegate.swift b/Sources/AppDelegate.swift index ad54f176..30883eab 100644 --- a/Sources/AppDelegate.swift +++ b/Sources/AppDelegate.swift @@ -265,11 +265,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate { return } - if nav.presentNotificiationPrompt() { - return - } - - _ = nav.presentSurveyPrompt() + _ = nav.presentNotificiationPrompt() } } diff --git a/Sources/NavigationViewController.swift b/Sources/NavigationViewController.swift index 20d65cb1..7387220b 100644 --- a/Sources/NavigationViewController.swift +++ b/Sources/NavigationViewController.swift @@ -125,10 +125,6 @@ class NavigationViewController: UINavigationController { return UserPrompts.promptForNotifications(onView: self) } - func presentSurveyPrompt() -> Bool { - return UserPrompts.promptForPMFSurvey(onView: self) - } - private func showClosedError() { let banner = NotificationBanner( title: NSLocalizedString("room_was_closed", comment: ""), diff --git a/Sources/Scenes/PMFSurveyPrompt/PMFSurveyPromptViewController.swift b/Sources/Scenes/PMFSurveyPrompt/PMFSurveyPromptViewController.swift deleted file mode 100644 index 8dc2deed..00000000 --- a/Sources/Scenes/PMFSurveyPrompt/PMFSurveyPromptViewController.swift +++ /dev/null @@ -1,101 +0,0 @@ -import SafariServices -import UIKit - -class PMFSurveyPromptViewController: DrawerViewController { - override init() { - super.init() - - manager.drawer.openHeightBehavior = .fitting - manager.drawer.backgroundColor = .foreground - } - - override func viewDidLoad() { - super.viewDidLoad() - - view.backgroundColor = .foreground - - let image = UIImageView(image: UIImage(named: "survey.dude")) - image.translatesAutoresizingMaskIntoConstraints = false - view.addSubview(image) - - let title = UILabel() - title.translatesAutoresizingMaskIntoConstraints = false - title.text = "We want your feedback!" - title.font = .rounded(forTextStyle: .title1, weight: .bold) - title.numberOfLines = 0 - title.textAlignment = .center - view.addSubview(title) - - let content = UILabel() - content.translatesAutoresizingMaskIntoConstraints = false - content.text = "Please take the time to complete this quick 2 minute survey. Your answers will help us create a better Soapbox experience for you!" - content.numberOfLines = 0 - content.font = .rounded(forTextStyle: .body, weight: .semibold) - view.addSubview(content) - - let survey = Button(size: .large) - survey.translatesAutoresizingMaskIntoConstraints = false - survey.setTitle("Complete Survey", for: .normal) - survey.addTarget(self, action: #selector(openSurvey), for: .touchUpInside) - view.addSubview(survey) - - let cancelButton = UIButton() - cancelButton.setTitle("Not Now", for: .normal) - cancelButton.setTitleColor(.secondaryLabel, for: .normal) - cancelButton.translatesAutoresizingMaskIntoConstraints = false - cancelButton.titleLabel?.font = .rounded(forTextStyle: .title3, weight: .bold) - cancelButton.addTarget(self, action: #selector(close), for: .touchUpInside) - view.addSubview(cancelButton) - - NSLayoutConstraint.activate([ - image.centerXAnchor.constraint(equalTo: view.centerXAnchor), - image.topAnchor.constraint(equalTo: handle.bottomAnchor, constant: 40), - ]) - - NSLayoutConstraint.activate([ - title.leftAnchor.constraint(equalTo: view.leftAnchor, constant: 60), - title.rightAnchor.constraint(equalTo: view.rightAnchor, constant: -60), - title.topAnchor.constraint(equalTo: image.bottomAnchor, constant: 20), - ]) - - NSLayoutConstraint.activate([ - content.leftAnchor.constraint(equalTo: view.leftAnchor, constant: 30), - content.rightAnchor.constraint(equalTo: view.rightAnchor, constant: -30), - content.topAnchor.constraint(equalTo: title.bottomAnchor, constant: 40), - ]) - - NSLayoutConstraint.activate([ - survey.leftAnchor.constraint(equalTo: view.leftAnchor, constant: 20), - survey.rightAnchor.constraint(equalTo: view.rightAnchor, constant: -20), - survey.topAnchor.constraint(equalTo: content.bottomAnchor, constant: 20), - ]) - - NSLayoutConstraint.activate([ - cancelButton.leftAnchor.constraint(equalTo: view.leftAnchor, constant: 20), - cancelButton.rightAnchor.constraint(equalTo: view.rightAnchor, constant: -20), - cancelButton.topAnchor.constraint(equalTo: survey.bottomAnchor, constant: 20), - cancelButton.bottomAnchor.constraint(equalTo: view.bottomAnchor, constant: -20), - ]) - } - - required init?(coder _: NSCoder) { - fatalError("init(coder:) has not been implemented") - } - - @objc private func openSurvey() { - let parent = presentingViewController! - - let url = "https://soapboxsocial.typeform.com/to/X2RBcn2C#user_id=\(UserDefaults.standard.integer(forKey: UserDefaultsKeys.userId))" - dismiss(animated: true, completion: { - DispatchQueue.main.async { - let safari = SFSafariViewController(url: URL(string: url)!) - safari.modalPresentationStyle = .overFullScreen - parent.present(safari, animated: true) - } - }) - } - - @objc private func close() { - dismiss(animated: true) - } -} diff --git a/Sources/UserDefaultsKeys.swift b/Sources/UserDefaultsKeys.swift index 2bf2115c..e5d1342f 100644 --- a/Sources/UserDefaultsKeys.swift +++ b/Sources/UserDefaultsKeys.swift @@ -32,8 +32,4 @@ class UserDefaultsKeys { class var lastNotificationsStartupPrompted: String { return "lastNotificationsStartupPrompted" } - - class var hasAskedForPMFSurvey: String { - return "hasAskedForPMFSurvey" - } } diff --git a/Sources/UserPrompts.swift b/Sources/UserPrompts.swift index 9e8c7114..cadfc2af 100644 --- a/Sources/UserPrompts.swift +++ b/Sources/UserPrompts.swift @@ -76,19 +76,4 @@ class UserPrompts { return true } - - static func promptForPMFSurvey(onView view: UIViewController) -> Bool { - if UserDefaults.standard.bool(forKey: UserDefaultsKeys.hasAskedForPMFSurvey) { - return false - } - - if UserDefaults.standard.integer(forKey: UserDefaultsKeys.userId) == 19 { - return false - } - - view.present(PMFSurveyPromptViewController(), animated: true) - UserDefaults.standard.set(true, forKey: UserDefaultsKeys.hasAskedForPMFSurvey) - - return true - } }