Add link to Reddit

This commit is contained in:
Davide De Rosa 2018-10-17 23:24:58 +02:00
parent e31e4a31df
commit b6d430f106
4 changed files with 24 additions and 2 deletions

View File

@ -39,7 +39,7 @@ class AboutViewController: UITableViewController, TableModelHost {
model.setHeader(L10n.About.Sections.Feedback.header, for: .feedback) model.setHeader(L10n.About.Sections.Feedback.header, for: .feedback)
model.set([.version, .credits, .website], in: .info) model.set([.version, .credits, .website], in: .info)
model.set([.sourcePassepartout, .sourceTunnelKit], in: .source) model.set([.sourcePassepartout, .sourceTunnelKit], in: .source)
model.set([.reportIssue, .writeReview], in: .feedback) model.set([.discussReddit, .reportIssue, .writeReview], in: .feedback)
return model return model
}() }()
@ -78,6 +78,10 @@ class AboutViewController: UITableViewController, TableModelHost {
UIApplication.shared.open(url, options: [:], completionHandler: nil) UIApplication.shared.open(url, options: [:], completionHandler: nil)
} }
private func discussReddit() {
UIApplication.shared.open(AppConstants.URLs.subreddit, options: [:], completionHandler: nil)
}
private func reportIssue() { private func reportIssue() {
IssueReporter.shared.present(in: self) IssueReporter.shared.present(in: self)
} }
@ -114,9 +118,11 @@ extension AboutViewController {
case sourceTunnelKit case sourceTunnelKit
case writeReview case discussReddit
case reportIssue case reportIssue
case writeReview
} }
override func numberOfSections(in tableView: UITableView) -> Int { override func numberOfSections(in tableView: UITableView) -> Int {
@ -163,6 +169,11 @@ extension AboutViewController {
cell.leftText = GroupConstants.App.tunnelKitName cell.leftText = GroupConstants.App.tunnelKitName
return cell return cell
case .discussReddit:
let cell = Cells.setting.dequeue(from: tableView, for: indexPath)
cell.leftText = L10n.About.Cells.DiscussReddit.caption
return cell
case .reportIssue: case .reportIssue:
let cell = Cells.setting.dequeue(from: tableView, for: indexPath) let cell = Cells.setting.dequeue(from: tableView, for: indexPath)
cell.leftText = L10n.IssueReporter.title cell.leftText = L10n.IssueReporter.title
@ -192,6 +203,9 @@ extension AboutViewController {
case .sourceTunnelKit: case .sourceTunnelKit:
visitRepository(AppConstants.Repos.tunnelKit) visitRepository(AppConstants.Repos.tunnelKit)
case .discussReddit:
discussReddit()
case .reportIssue: case .reportIssue:
reportIssue() reportIssue()

View File

@ -168,6 +168,7 @@
"about.sections.source.header" = "Source code"; "about.sections.source.header" = "Source code";
"about.sections.feedback.header" = "Feedback"; "about.sections.feedback.header" = "Feedback";
"about.cells.version.caption" = "Version"; "about.cells.version.caption" = "Version";
"about.cells.discuss_reddit.caption" = "Discuss on Reddit";
"about.cells.write_review.caption" = "Write a review"; "about.cells.write_review.caption" = "Write a review";
"about.cells.website.caption" = "Visit website"; "about.cells.website.caption" = "Visit website";

View File

@ -110,6 +110,8 @@ class AppConstants {
static let changelog = Repos.passepartout.appendingPathComponent("blob/master/CHANGELOG.md") static let changelog = Repos.passepartout.appendingPathComponent("blob/master/CHANGELOG.md")
static let subreddit = URL(string: "https://www.reddit.com/r/passepartout")!
static func review(withId id: String) -> URL { static func review(withId id: String) -> URL {
return URL(string: "https://itunes.apple.com/app/id\(id)?action=write-review")! return URL(string: "https://itunes.apple.com/app/id\(id)?action=write-review")!
} }

View File

@ -14,6 +14,11 @@ internal enum L10n {
internal enum Cells { internal enum Cells {
internal enum DiscussReddit {
/// Discuss on Reddit
internal static let caption = L10n.tr("Localizable", "about.cells.discuss_reddit.caption")
}
internal enum Version { internal enum Version {
/// Version /// Version
internal static let caption = L10n.tr("Localizable", "about.cells.version.caption") internal static let caption = L10n.tr("Localizable", "about.cells.version.caption")