Merge branch 'reorg-support-links'

This commit is contained in:
Davide De Rosa 2019-11-20 19:21:32 +01:00
commit a82454f5cf
5 changed files with 60 additions and 35 deletions

View File

@ -75,6 +75,10 @@ extension UIViewController {
}
}
func visitURL(_ url: URL) {
UIApplication.shared.open(url, options: [:], completionHandler: nil)
}
func delay(_ block: @escaping () -> Void) {
DispatchQueue.main.asyncAfter(deadline: .now() + .milliseconds(500)) {
block()

View File

@ -74,10 +74,6 @@ class AboutViewController: UITableViewController, StrongTableHost {
perform(segue: StoryboardSegue.About.creditsSegueIdentifier)
}
private func visit(_ url: URL) {
UIApplication.shared.open(url, options: [:], completionHandler: nil)
}
private func inviteFriend(sender: UITableViewCell?) {
let message = "\(L10n.Core.Share.message) \(AppConstants.URLs.website)"
let vc = UIActivityViewController(activityItems: [message], applicationActivities: nil)
@ -195,25 +191,25 @@ extension AboutViewController {
openCredits()
case .readme:
visit(AppConstants.URLs.iOS.readme)
visitURL(AppConstants.URLs.iOS.readme)
case .changelog:
visit(AppConstants.URLs.iOS.changelog)
visitURL(AppConstants.URLs.iOS.changelog)
case .website:
visit(AppConstants.URLs.website)
visitURL(AppConstants.URLs.website)
case .faq:
visit(AppConstants.URLs.faq)
visitURL(AppConstants.URLs.faq)
case .disclaimer:
visit(AppConstants.URLs.disclaimer)
visitURL(AppConstants.URLs.disclaimer)
case .privacyPolicy:
visit(AppConstants.URLs.privacyPolicy)
visitURL(AppConstants.URLs.privacyPolicy)
case .shareTwitter:
visit(AppConstants.URLs.twitterIntent(withMessage: L10n.Core.Share.message))
visitURL(AppConstants.URLs.twitterIntent(withMessage: L10n.Core.Share.message))
case .shareGeneric:
inviteFriend(sender: tableView.cellForRow(at: indexPath))

View File

@ -56,9 +56,7 @@ class OrganizerViewController: UITableViewController, StrongTableHost {
model.add(.siri)
}
model.add(.support)
if ProductManager.shared.isEligibleForFeedback() {
model.add(.feedback)
}
model.add(.feedback)
model.add(.about)
model.add(.destruction)
model.setHeader(L10n.App.Service.Sections.Vpn.header, forSection: .vpn)
@ -74,8 +72,16 @@ class OrganizerViewController: UITableViewController, StrongTableHost {
model.setHeader(L10n.Core.Organizer.Sections.Support.header, forSection: .support)
model.setHeader(L10n.Core.Organizer.Sections.Feedback.header, forSection: .feedback)
model.set([.connectionStatus], forSection: .vpn)
model.set([.donate, .translate, .faq], forSection: .support)
model.set([.joinCommunity, .writeReview], forSection: .feedback)
model.set([.donate, .translate], forSection: .support)
var feedbackRows: [RowType] = [.joinCommunity]
if ProductManager.shared.isEligibleForFeedback() {
feedbackRows.append(.writeReview)
}
feedbackRows.append(.visitAlternativeTo)
feedbackRows.append(.visitProductHunt)
model.set(feedbackRows, forSection: .feedback)
model.set([.openAbout], forSection: .about)
model.set([.uninstall], forSection: .destruction)
if AppConstants.Flags.isBeta {
@ -234,10 +240,6 @@ class OrganizerViewController: UITableViewController, StrongTableHost {
perform(segue: StoryboardSegue.Organizer.donateSegueIdentifier, sender: nil)
}
private func visit(_ url: URL) {
UIApplication.shared.open(url, options: [:], completionHandler: nil)
}
private func offerTranslation() {
let V = AppConstants.Translations.Email.self
let recipient = V.recipient
@ -431,11 +433,13 @@ extension OrganizerViewController {
case translate
case faq
case joinCommunity
case writeReview
case visitAlternativeTo
case visitProductHunt
case openAbout
@ -517,11 +521,6 @@ extension OrganizerViewController {
cell.leftText = L10n.Core.Organizer.Cells.Translate.caption
return cell
case .faq:
let cell = Cells.setting.dequeue(from: tableView, for: indexPath)
cell.leftText = L10n.Core.About.Cells.Faq.caption
return cell
case .joinCommunity:
let cell = Cells.setting.dequeue(from: tableView, for: indexPath)
cell.leftText = L10n.Core.Organizer.Cells.JoinCommunity.caption
@ -531,6 +530,16 @@ extension OrganizerViewController {
let cell = Cells.setting.dequeue(from: tableView, for: indexPath)
cell.leftText = L10n.Core.Organizer.Cells.WriteReview.caption
return cell
case .visitAlternativeTo:
let cell = Cells.setting.dequeue(from: tableView, for: indexPath)
cell.leftText = "AlternativeTo"
return cell
case .visitProductHunt:
let cell = Cells.setting.dequeue(from: tableView, for: indexPath)
cell.leftText = "ProductHunt"
return cell
case .openAbout:
let cell = Cells.setting.dequeue(from: tableView, for: indexPath)
@ -586,14 +595,17 @@ extension OrganizerViewController {
case .translate:
offerTranslation()
case .faq:
visit(AppConstants.URLs.faq)
case .joinCommunity:
subscribeSubreddit()
case .writeReview:
writeReview()
case .visitAlternativeTo:
visitURL(AppConstants.URLs.alternativeTo)
case .visitProductHunt:
visitURL(AppConstants.URLs.productHunt)
case .openAbout:
about()

View File

@ -750,6 +750,8 @@ extension ServiceViewController: UITableViewDataSource, UITableViewDelegate, Tog
case masksPrivateData
case faq
case reportIssue
}
@ -996,6 +998,11 @@ extension ServiceViewController: UITableViewDataSource, UITableViewDelegate, Tog
// feedback
case .faq:
let cell = Cells.setting.dequeue(from: tableView, for: indexPath)
cell.leftText = L10n.Core.About.Cells.Faq.caption
return cell
case .reportIssue:
let cell = Cells.setting.dequeue(from: tableView, for: indexPath)
cell.leftText = L10n.Core.Service.Cells.ReportIssue.caption
@ -1096,6 +1103,9 @@ extension ServiceViewController: UITableViewDataSource, UITableViewDelegate, Tog
perform(segue: StoryboardSegue.Main.debugLogSegueIdentifier, sender: cell)
return true
case .faq:
visitURL(AppConstants.URLs.faq)
case .reportIssue:
reportConnectivityIssue()
@ -1166,9 +1176,7 @@ extension ServiceViewController: UITableViewDataSource, UITableViewDelegate, Tog
model.add(.trusted)
model.add(.trustedPolicy)
model.add(.diagnostics)
if ProductManager.shared.isEligibleForFeedback() {
model.add(.feedback)
}
model.add(.feedback)
}
// headers
@ -1223,7 +1231,12 @@ extension ServiceViewController: UITableViewDataSource, UITableViewDelegate, Tog
model.set([.vpnSurvivesSleep], forSection: .vpnSurvivesSleep)
model.set([.trustedPolicy], forSection: .trustedPolicy)
model.set([.dataCount, .serverConfiguration, .serverNetwork, .debugLog, .masksPrivateData], forSection: .diagnostics)
model.set([.reportIssue], forSection: .feedback)
var feedbackRows: [RowType] = [.faq]
if ProductManager.shared.isEligibleForFeedback() {
feedbackRows.append(.reportIssue)
}
model.set(feedbackRows, forSection: .feedback)
}
trustedNetworks.delegate = self

@ -1 +1 @@
Subproject commit dad47f3581ab25d966d204de93634d82b9fe808b
Subproject commit beda7086d31d8ebe531ac4f5776aa62bca6838ea