Add tweet cell to About

This commit is contained in:
Davide De Rosa 2018-10-23 11:28:24 +02:00
parent 4bd339d456
commit 39c053bd54
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.set([.version, .credits, .disclaimer, .website], in: .info)
model.set([.sourcePassepartout, .sourceTunnelKit], in: .source)
model.set([.requestSupport, .writeReview], in: .feedback)
model.set([.shareTwitter, .requestSupport, .writeReview], in: .feedback)
return model
}()
@ -86,6 +86,10 @@ class AboutViewController: UITableViewController, TableModelHost {
UIApplication.shared.open(AppConstants.URLs.subreddit, options: [:], completionHandler: nil)
}
private func tweetAboutApp() {
UIApplication.shared.open(AppConstants.URLs.twitterIntent, options: [:], completionHandler: nil)
}
private func writeReview() {
let url = AppConstants.URLs.review(withId: GroupConstants.App.appId)
UIApplication.shared.open(url, options: [:], completionHandler: nil)
@ -142,6 +146,8 @@ extension AboutViewController {
case sourceTunnelKit
case shareTwitter
case requestSupport
case writeReview
@ -196,6 +202,11 @@ extension AboutViewController {
cell.leftText = GroupConstants.App.tunnelKitName
return cell
case .shareTwitter:
let cell = Cells.setting.dequeue(from: tableView, for: indexPath)
cell.leftText = L10n.About.Cells.ShareTwitter.caption
return cell
case .requestSupport:
let cell = Cells.setting.dequeue(from: tableView, for: indexPath)
cell.leftText = L10n.About.Cells.RequestSupport.caption
@ -228,6 +239,9 @@ extension AboutViewController {
case .sourceTunnelKit:
visitRepository(AppConstants.Repos.tunnelKit)
case .shareTwitter:
tweetAboutApp()
case .requestSupport:
postSupportRequest()

View File

@ -182,9 +182,10 @@
"about.sections.source.header" = "Source code";
"about.sections.feedback.header" = "Feedback";
"about.cells.version.caption" = "Version";
"about.cells.website.caption" = "Visit website";
"about.cells.share_twitter.caption" = "Tweet about it!";
"about.cells.request_support.caption" = "Request support";
"about.cells.write_review.caption" = "Write a review";
"about.cells.website.caption" = "Visit website";
"version.labels.intro" = "Passepartout and TunnelKit are written and maintained by Davide De Rosa (keeshux).\n\nTunnelKit is a native OpenVPN client originally forked from PIATunnel by Private Internet Access.\n\nSource code for Passepartout and TunnelKit is publicly available on GitHub under the GPLv3.";
"version.buttons.changelog" = "CHANGELOG";

View File

@ -115,6 +115,8 @@ class AppConstants {
static let subreddit = URL(string: "https://www.reddit.com/r/passepartout")!
static let twitterIntent = URL(string: "https://twitter.com/intent/tweet?url=https%3A%2F%2Fpassepartoutvpn.app%2F&via=keeshux&text=Passepartout%20is%20an%20user-friendly%2C%20open%20source%20%23OpenVPN%20client%20for%20%23iOS%20and%20%23macOS")!
static func review(withId id: String) -> URL {
return URL(string: "https://itunes.apple.com/app/id\(id)?action=write-review")!
}

View File

@ -19,6 +19,11 @@ internal enum L10n {
internal static let caption = L10n.tr("Localizable", "about.cells.request_support.caption")
}
internal enum ShareTwitter {
/// Tweet about it!
internal static let caption = L10n.tr("Localizable", "about.cells.share_twitter.caption")
}
internal enum Version {
/// Version
internal static let caption = L10n.tr("Localizable", "about.cells.version.caption")