Update profile screen accordingly

This commit is contained in:
Davide De Rosa 2018-10-18 16:53:37 +02:00
parent 23e27535c6
commit ef2061de0a
1 changed files with 22 additions and 7 deletions

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