Merge branch 'drive-support-on-reddit'

This commit is contained in:
Davide De Rosa 2018-10-18 17:02:24 +02:00
commit 5bede48c1c
6 changed files with 50 additions and 38 deletions

View File

@ -46,14 +46,11 @@ class IssueReporter: NSObject {
self.viewController = viewController
let alert = Macros.alert(L10n.IssueReporter.title, L10n.IssueReporter.message)
alert.addDefaultAction(L10n.IssueReporter.Buttons.withLog) {
alert.addDefaultAction(L10n.IssueReporter.Buttons.accept) {
VPN.shared.requestDebugLog(fallback: AppConstants.Log.debugSnapshot) {
self.composeEmail(withDebugLog: $0)
}
}
alert.addAction(UIAlertAction(title: L10n.IssueReporter.Buttons.withoutLog, style: .default) { (action) in
self.composeEmail(withDebugLog: nil)
})
alert.addCancelAction(L10n.Global.cancel)
viewController.present(alert, animated: true, completion: nil)
}

View File

@ -39,7 +39,7 @@ class AboutViewController: UITableViewController, TableModelHost {
model.setHeader(L10n.About.Sections.Feedback.header, for: .feedback)
model.set([.version, .credits, .disclaimer, .website], in: .info)
model.set([.sourcePassepartout, .sourceTunnelKit], in: .source)
model.set([.discussReddit, .reportIssue, .writeReview], in: .feedback)
model.set([.requestSupport, .submitDebugLog, .writeReview], in: .feedback)
return model
}()
@ -82,7 +82,7 @@ class AboutViewController: UITableViewController, TableModelHost {
UIApplication.shared.open(url, options: [:], completionHandler: nil)
}
private func discussReddit() {
private func requestRedditSupport() {
UIApplication.shared.open(AppConstants.URLs.subreddit, options: [:], completionHandler: nil)
}
@ -146,9 +146,9 @@ extension AboutViewController {
case sourceTunnelKit
case discussReddit
case requestSupport
case reportIssue
case submitDebugLog
case writeReview
}
@ -202,12 +202,12 @@ extension AboutViewController {
cell.leftText = GroupConstants.App.tunnelKitName
return cell
case .discussReddit:
case .requestSupport:
let cell = Cells.setting.dequeue(from: tableView, for: indexPath)
cell.leftText = L10n.About.Cells.DiscussReddit.caption
cell.leftText = L10n.About.Cells.RequestSupport.caption
return cell
case .reportIssue:
case .submitDebugLog:
let cell = Cells.setting.dequeue(from: tableView, for: indexPath)
cell.leftText = L10n.IssueReporter.title
return cell
@ -239,10 +239,10 @@ extension AboutViewController {
case .sourceTunnelKit:
visitRepository(AppConstants.Repos.tunnelKit)
case .discussReddit:
discussReddit()
case .requestSupport:
requestRedditSupport()
case .reportIssue:
case .submitDebugLog:
reportIssue()
case .writeReview:

View File

@ -111,7 +111,7 @@ class OrganizerViewController: UITableViewController, TableModelHost {
if !didShowSubreddit && !TransientStore.shared.didHandleSubreddit {
didShowSubreddit = true
let alert = Macros.alert(L10n.About.Cells.DiscussReddit.caption, L10n.Reddit.message)
let alert = Macros.alert(L10n.Reddit.title, L10n.Reddit.message)
alert.addDefaultAction(L10n.Reddit.Buttons.subscribe) {
TransientStore.shared.didHandleSubreddit = true
self.subscribeSubreddit()

View File

@ -350,6 +350,10 @@ class ServiceViewController: UIViewController, TableModelHost {
}
}
private func requestRedditSupport() {
UIApplication.shared.open(AppConstants.URLs.subreddit, options: [:], completionHandler: nil)
}
private func reportIssue() {
IssueReporter.shared.present(in: self)
}
@ -389,7 +393,7 @@ extension ServiceViewController: UITableViewDataSource, UITableViewDelegate, Tog
case diagnostics
case contacts
case feedback
}
enum RowType: Int {
@ -429,7 +433,9 @@ extension ServiceViewController: UITableViewDataSource, UITableViewDelegate, Tog
case debugLog
case reportIssue
case requestSupport
case submitDebugLog
}
private var trustedSectionIndex: Int {
@ -635,9 +641,14 @@ extension ServiceViewController: UITableViewDataSource, UITableViewDelegate, Tog
cell.leftText = L10n.Service.Cells.DebugLog.caption
return cell
// contacts
// feedback
case .reportIssue:
case .requestSupport:
let cell = Cells.setting.dequeue(from: tableView, for: indexPath)
cell.leftText = L10n.About.Cells.RequestSupport.caption
return cell
case .submitDebugLog:
let cell = Cells.setting.dequeue(from: tableView, for: indexPath)
cell.leftText = L10n.IssueReporter.title
return cell
@ -735,7 +746,10 @@ extension ServiceViewController: UITableViewDataSource, UITableViewDelegate, Tog
perform(segue: StoryboardSegue.Main.debugLogSegueIdentifier, sender: cell)
return true
case .reportIssue:
case .requestSupport:
requestRedditSupport()
case .submitDebugLog:
reportIssue()
default:
@ -806,7 +820,7 @@ extension ServiceViewController: UITableViewDataSource, UITableViewDelegate, Tog
model.add(.trusted)
model.add(.trustedPolicy)
model.add(.diagnostics)
model.add(.contacts)
model.add(.feedback)
}
// headers
@ -823,6 +837,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)
}
// footers
@ -855,7 +870,7 @@ extension ServiceViewController: UITableViewDataSource, UITableViewDelegate, Tog
model.set([.vpnSurvivesSleep], in: .vpnSurvivesSleep)
model.set([.trustedPolicy], in: .trustedPolicy)
model.set([.testConnectivity, .dataCount, .debugLog], in: .diagnostics)
model.set([.reportIssue], in: .contacts)
model.set([.requestSupport, .submitDebugLog], in: .feedback)
}
trustedNetworks.delegate = self

View File

@ -27,6 +27,7 @@
"global.cancel" = "Cancel";
"global.next" = "Next";
"reddit.title" = "Reddit";
"reddit.message" = "Did you know that Passepartout has a subreddit? Subscribe for updates or to discuss issues, features, new platforms or whatever you like.\n\nIt's also a great way to show you care about this project.";
"reddit.buttons.subscribe" = "Subscribe now!";
"reddit.buttons.remind" = "Remind me later";
@ -160,12 +161,11 @@
"vpn.inactive" = "Inactive";
"vpn.disabled" = "Disabled";
"issue_reporter.title" = "Report an issue";
"issue_reporter.message" = "Do you want to attach the debug log of your latest connections? The log is crucial to resolve your connectivity issues and is completely anonymous.";
"issue_reporter.buttons.with_log" = "Attach debug log";
"issue_reporter.buttons.without_log" = "Omit debug log";
"issue_reporter.title" = "Submit debug log";
"issue_reporter.message" = "The debug log of your latest connections is crucial to resolve your connectivity issues and is completely anonymous.";
"issue_reporter.buttons.accept" = "I understand";
"issue_reporter.alerts.email_not_configured.message" = "No e-mail account is configured.";
"issue_reporter.email.subject" = "%@ - Report issue";
"issue_reporter.email.subject" = "%@ - Debug log";
"issue_reporter.email.body" = "Hi,\n\ndescription of the issue:\n\n%@\n\nRegards";
"about.title" = "About";
@ -173,7 +173,7 @@
"about.sections.source.header" = "Source code";
"about.sections.feedback.header" = "Feedback";
"about.cells.version.caption" = "Version";
"about.cells.discuss_reddit.caption" = "Discuss on Reddit";
"about.cells.request_support.caption" = "Request support";
"about.cells.write_review.caption" = "Write a review";
"about.cells.website.caption" = "Visit website";

View File

@ -14,9 +14,9 @@ internal enum L10n {
internal enum Cells {
internal enum DiscussReddit {
/// Discuss on Reddit
internal static let caption = L10n.tr("Localizable", "about.cells.discuss_reddit.caption")
internal enum RequestSupport {
/// Request support
internal static let caption = L10n.tr("Localizable", "about.cells.request_support.caption")
}
internal enum Version {
@ -288,9 +288,9 @@ internal enum L10n {
}
internal enum IssueReporter {
/// Do you want to attach the debug log of your latest connections? The log is crucial to resolve your connectivity issues and is completely anonymous.
/// The debug log of your latest connections is crucial to resolve your connectivity issues and is completely anonymous.
internal static let message = L10n.tr("Localizable", "issue_reporter.message")
/// Report an issue
/// Submit debug log
internal static let title = L10n.tr("Localizable", "issue_reporter.title")
internal enum Alerts {
@ -302,10 +302,8 @@ internal enum L10n {
}
internal enum Buttons {
/// Attach debug log
internal static let withLog = L10n.tr("Localizable", "issue_reporter.buttons.with_log")
/// Omit debug log
internal static let withoutLog = L10n.tr("Localizable", "issue_reporter.buttons.without_log")
/// I understand
internal static let accept = L10n.tr("Localizable", "issue_reporter.buttons.accept")
}
internal enum Email {
@ -313,7 +311,7 @@ internal enum L10n {
internal static func body(_ p1: String) -> String {
return L10n.tr("Localizable", "issue_reporter.email.body", p1)
}
/// %@ - Report issue
/// %@ - Debug log
internal static func subject(_ p1: String) -> String {
return L10n.tr("Localizable", "issue_reporter.email.subject", p1)
}
@ -408,6 +406,8 @@ internal enum L10n {
internal enum Reddit {
/// Did you know that Passepartout has a subreddit? Subscribe for updates or to discuss issues, features, new platforms or whatever you like.\n\nIt's also a great way to show you care about this project.
internal static let message = L10n.tr("Localizable", "reddit.message")
/// Reddit
internal static let title = L10n.tr("Localizable", "reddit.title")
internal enum Buttons {
/// Don't ask again