From a6745ceec7f4480f8208508c58ac56ec692f9eb4 Mon Sep 17 00:00:00 2001 From: Davide De Rosa Date: Mon, 15 Apr 2019 14:29:31 +0200 Subject: [PATCH] Move feedback section to main screen --- .../Scenes/About/AboutViewController.swift | 34 ------------------- .../Organizer/OrganizerViewController.swift | 30 ++++++++++++++++ .../Scenes/ServiceViewController.swift | 4 +-- .../Resources/en.lproj/Localizable.strings | 6 ++-- .../Resources/it.lproj/Localizable.strings | 6 ++-- Passepartout/Sources/SwiftGen+Strings.swift | 24 ++++++------- 6 files changed, 50 insertions(+), 54 deletions(-) diff --git a/Passepartout-iOS/Scenes/About/AboutViewController.swift b/Passepartout-iOS/Scenes/About/AboutViewController.swift index 66746ec8..501fa818 100644 --- a/Passepartout-iOS/Scenes/About/AboutViewController.swift +++ b/Passepartout-iOS/Scenes/About/AboutViewController.swift @@ -35,14 +35,11 @@ class AboutViewController: UITableViewController, TableModelHost { model.add(.info) model.add(.web) model.add(.share) - model.add(.feedback) model.setHeader(L10n.About.Sections.Web.header, for: .web) model.setHeader(L10n.About.Sections.Share.header, for: .share) - model.setHeader(L10n.About.Sections.Feedback.header, for: .feedback) model.set([.version], in: .info) model.set([.website, .faq, .disclaimer, .privacyPolicy], in: .web) model.set([.shareTwitter, .shareGeneric], in: .share) - model.set([.joinCommunity, .writeReview], in: .feedback) return model }() @@ -100,15 +97,6 @@ class AboutViewController: UITableViewController, TableModelHost { present(vc, animated: true, completion: nil) } - private func postSupportRequest() { - UIApplication.shared.open(AppConstants.URLs.subreddit, options: [:], completionHandler: nil) - } - - private func writeReview() { - let url = AppConstants.URLs.review(withId: GroupConstants.App.appId) - UIApplication.shared.open(url, options: [:], completionHandler: nil) - } - @IBAction private func dismiss() { dismiss(animated: true, completion: nil) } @@ -123,8 +111,6 @@ extension AboutViewController { case web case share - - case feedback } enum RowType: Int { @@ -141,10 +127,6 @@ extension AboutViewController { case shareTwitter case shareGeneric - - case joinCommunity - - case writeReview } override func numberOfSections(in tableView: UITableView) -> Int { @@ -200,16 +182,6 @@ extension AboutViewController { let cell = Cells.setting.dequeue(from: tableView, for: indexPath) cell.leftText = L10n.About.Cells.ShareGeneric.caption return cell - - case .joinCommunity: - let cell = Cells.setting.dequeue(from: tableView, for: indexPath) - cell.leftText = L10n.About.Cells.JoinCommunity.caption - return cell - - case .writeReview: - let cell = Cells.setting.dequeue(from: tableView, for: indexPath) - cell.leftText = L10n.About.Cells.WriteReview.caption - return cell } } @@ -235,12 +207,6 @@ extension AboutViewController { case .shareGeneric: inviteFriend(sender: tableView.cellForRow(at: indexPath)) - - case .joinCommunity: - postSupportRequest() - - case .writeReview: - writeReview() } tableView.deselectRow(at: indexPath, animated: true) } diff --git a/Passepartout-iOS/Scenes/Organizer/OrganizerViewController.swift b/Passepartout-iOS/Scenes/Organizer/OrganizerViewController.swift index 99912b14..79bdc85e 100644 --- a/Passepartout-iOS/Scenes/Organizer/OrganizerViewController.swift +++ b/Passepartout-iOS/Scenes/Organizer/OrganizerViewController.swift @@ -52,6 +52,7 @@ class OrganizerViewController: UITableViewController, TableModelHost { model.add(.siri) } model.add(.support) + model.add(.feedback) model.add(.about) model.add(.destruction) model.setHeader(L10n.Service.Sections.Vpn.header, for: .vpn) @@ -65,8 +66,10 @@ class OrganizerViewController: UITableViewController, TableModelHost { model.set([.siriShortcuts], in: .siri) } model.setHeader(L10n.Organizer.Sections.Support.header, for: .support) + model.setHeader(L10n.Organizer.Sections.Feedback.header, for: .feedback) model.set([.connectionStatus], in: .vpn) model.set([.donate, .patreon, .translate], in: .support) + model.set([.joinCommunity, .writeReview], in: .feedback) model.set([.openAbout], in: .about) model.set([.uninstall], in: .destruction) if AppConstants.Flags.isBeta { @@ -315,6 +318,11 @@ class OrganizerViewController: UITableViewController, TableModelHost { UIApplication.shared.open(AppConstants.URLs.subreddit, options: [:], completionHandler: nil) } + private func writeReview() { + let url = AppConstants.URLs.review(withId: GroupConstants.App.appId) + UIApplication.shared.open(url, options: [:], completionHandler: nil) + } + // private func testDisplayLog() { @@ -350,6 +358,8 @@ extension OrganizerViewController { case siri case support + + case feedback case about @@ -374,6 +384,10 @@ extension OrganizerViewController { case patreon case translate + + case joinCommunity + + case writeReview case openAbout @@ -452,6 +466,16 @@ extension OrganizerViewController { let cell = Cells.setting.dequeue(from: tableView, for: indexPath) cell.leftText = L10n.Organizer.Cells.Translate.caption return cell + + case .joinCommunity: + let cell = Cells.setting.dequeue(from: tableView, for: indexPath) + cell.leftText = L10n.Organizer.Cells.JoinCommunity.caption + return cell + + case .writeReview: + let cell = Cells.setting.dequeue(from: tableView, for: indexPath) + cell.leftText = L10n.Organizer.Cells.WriteReview.caption + return cell case .openAbout: let cell = Cells.setting.dequeue(from: tableView, for: indexPath) @@ -502,6 +526,12 @@ extension OrganizerViewController { case .translate: offerTranslation() + case .joinCommunity: + subscribeSubreddit() + + case .writeReview: + writeReview() + case .openAbout: about() diff --git a/Passepartout-iOS/Scenes/ServiceViewController.swift b/Passepartout-iOS/Scenes/ServiceViewController.swift index 100a2e6c..dcad03ab 100644 --- a/Passepartout-iOS/Scenes/ServiceViewController.swift +++ b/Passepartout-iOS/Scenes/ServiceViewController.swift @@ -830,7 +830,7 @@ extension ServiceViewController: UITableViewDataSource, UITableViewDelegate, Tog case .joinCommunity: let cell = Cells.setting.dequeue(from: tableView, for: indexPath) - cell.leftText = L10n.About.Cells.JoinCommunity.caption + cell.leftText = L10n.Organizer.Cells.JoinCommunity.caption return cell case .reportIssue: @@ -1035,7 +1035,7 @@ extension ServiceViewController: UITableViewDataSource, UITableViewDelegate, Tog } model.setHeader(L10n.Service.Sections.Trusted.header, for: .trusted) model.setHeader(L10n.Service.Sections.Diagnostics.header, for: .diagnostics) - model.setHeader(L10n.About.Sections.Feedback.header, for: .feedback) + model.setHeader(L10n.Organizer.Sections.Feedback.header, for: .feedback) } // footers diff --git a/Passepartout/Resources/en.lproj/Localizable.strings b/Passepartout/Resources/en.lproj/Localizable.strings index bbfd45d0..09fb40e9 100644 --- a/Passepartout/Resources/en.lproj/Localizable.strings +++ b/Passepartout/Resources/en.lproj/Localizable.strings @@ -44,10 +44,13 @@ "organizer.sections.siri.header" = "Siri"; "organizer.sections.siri.footer" = "Get help from Siri to speed up your most common interactions with the app."; "organizer.sections.support.header" = "Support"; +"organizer.sections.feedback.header" = "Feedback"; "organizer.cells.profile.value.current" = "In use"; "organizer.cells.add_provider.caption" = "Add new provider"; "organizer.cells.add_host.caption" = "Add new host"; "organizer.cells.siri_shortcuts.caption" = "Manage shortcuts"; +"organizer.cells.join_community.caption" = "Join community"; +"organizer.cells.write_review.caption" = "Write a review"; "organizer.cells.donate.caption" = "Make a donation"; "organizer.cells.patreon.caption" = "Support me on Patreon"; "organizer.cells.translate.caption" = "Offer to translate"; @@ -245,15 +248,12 @@ "about.title" = "About"; "about.sections.web.header" = "Web"; "about.sections.share.header" = "Share"; -"about.sections.feedback.header" = "Feedback"; "about.cells.website.caption" = "Home page"; "about.cells.faq.caption" = "FAQ"; "about.cells.disclaimer.caption" = "Disclaimer"; "about.cells.privacy_policy.caption" = "Privacy policy"; "about.cells.share_twitter.caption" = "Tweet about it!"; "about.cells.share_generic.caption" = "Invite a friend"; -"about.cells.join_community.caption" = "Join community"; -"about.cells.write_review.caption" = "Write a review"; "donation.title" = "Donate"; "donation.sections.one_time.header" = "One time"; diff --git a/Passepartout/Resources/it.lproj/Localizable.strings b/Passepartout/Resources/it.lproj/Localizable.strings index 59f3939f..5d88461a 100644 --- a/Passepartout/Resources/it.lproj/Localizable.strings +++ b/Passepartout/Resources/it.lproj/Localizable.strings @@ -44,10 +44,13 @@ "organizer.sections.siri.header" = "Siri"; "organizer.sections.siri.footer" = "Chiedi aiuto a Siri per velocizzare le tue interazioni piĆ¹ frequenti con l'app."; "organizer.sections.support.header" = "Supporto"; +"organizer.sections.feedback.header" = "Feedback"; "organizer.cells.profile.value.current" = "In uso"; "organizer.cells.add_provider.caption" = "Aggiungi provider"; "organizer.cells.add_host.caption" = "Aggiungi host"; "organizer.cells.siri_shortcuts.caption" = "Gestisci comandi rapidi"; +"organizer.cells.join_community.caption" = "Entra nella community"; +"organizer.cells.write_review.caption" = "Scrivi una recensione"; "organizer.cells.donate.caption" = "Fai una donazione"; "organizer.cells.patreon.caption" = "Supportami su Patreon"; "organizer.cells.translate.caption" = "Offri una traduzione"; @@ -238,15 +241,12 @@ "about.title" = "Informazioni su"; "about.sections.web.header" = "Web"; "about.sections.share.header" = "Condividi"; -"about.sections.feedback.header" = "Feedback"; "about.cells.website.caption" = "Home page"; "about.cells.faq.caption" = "FAQ"; "about.cells.disclaimer.caption" = "Disclaimer"; "about.cells.privacy_policy.caption" = "Privacy policy"; "about.cells.share_twitter.caption" = "Manda un Tweet!"; "about.cells.share_generic.caption" = "Invita un amico"; -"about.cells.join_community.caption" = "Entra nella community"; -"about.cells.write_review.caption" = "Scrivi una recensione"; "donation.title" = "Donazione"; "donation.sections.one_time.header" = "Unica"; diff --git a/Passepartout/Sources/SwiftGen+Strings.swift b/Passepartout/Sources/SwiftGen+Strings.swift index c46d1964..28c5f37a 100644 --- a/Passepartout/Sources/SwiftGen+Strings.swift +++ b/Passepartout/Sources/SwiftGen+Strings.swift @@ -24,10 +24,6 @@ public enum L10n { /// FAQ public static let caption = L10n.tr("Localizable", "about.cells.faq.caption") } - public enum JoinCommunity { - /// Join community - public static let caption = L10n.tr("Localizable", "about.cells.join_community.caption") - } public enum PrivacyPolicy { /// Privacy policy public static let caption = L10n.tr("Localizable", "about.cells.privacy_policy.caption") @@ -44,16 +40,8 @@ public enum L10n { /// Home page public static let caption = L10n.tr("Localizable", "about.cells.website.caption") } - public enum WriteReview { - /// Write a review - public static let caption = L10n.tr("Localizable", "about.cells.write_review.caption") - } } public enum Sections { - public enum Feedback { - /// Feedback - public static let header = L10n.tr("Localizable", "about.sections.feedback.header") - } public enum Share { /// Share public static let header = L10n.tr("Localizable", "about.sections.share.header") @@ -453,6 +441,10 @@ public enum L10n { /// Make a donation public static let caption = L10n.tr("Localizable", "organizer.cells.donate.caption") } + public enum JoinCommunity { + /// Join community + public static let caption = L10n.tr("Localizable", "organizer.cells.join_community.caption") + } public enum Patreon { /// Support me on Patreon public static let caption = L10n.tr("Localizable", "organizer.cells.patreon.caption") @@ -475,8 +467,16 @@ public enum L10n { /// Remove VPN configuration public static let caption = L10n.tr("Localizable", "organizer.cells.uninstall.caption") } + public enum WriteReview { + /// Write a review + public static let caption = L10n.tr("Localizable", "organizer.cells.write_review.caption") + } } public enum Sections { + public enum Feedback { + /// Feedback + public static let header = L10n.tr("Localizable", "organizer.sections.feedback.header") + } public enum Hosts { /// Import hosts from raw .ovpn configuration files. public static let footer = L10n.tr("Localizable", "organizer.sections.hosts.footer")