Skip to content
This repository has been archived by the owner on May 10, 2024. It is now read-only.

Commit

Permalink
Adding description to issue section screen details
Browse files Browse the repository at this point in the history
  • Loading branch information
soner-yuksel committed Aug 3, 2023
1 parent fbf5693 commit 257837d
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 29 deletions.
29 changes: 11 additions & 18 deletions Sources/Brave/Frontend/Settings/SettingsViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -565,25 +565,18 @@ class SettingsViewController: TableViewController {
selection: { [unowned self] in

let vc = { () -> UIViewController? in
let vc = BraveVPNSettingsViewController()
vc.openURL = { [unowned self] url in
self.settingsDelegate?.settingsOpenURLInNewTab(url)
self.dismiss(animated: true)
switch BraveVPN.vpnState {
case .notPurchased, .expired:
return BraveVPN.vpnState.enableVPNDestinationVC
case .purchased:
let vc = BraveVPNSettingsViewController()
vc.openURL = { [unowned self] url in
self.settingsDelegate?.settingsOpenURLInNewTab(url)
self.dismiss(animated: true)
}

return vc
}
return vc

// switch BraveVPN.vpnState {
// case .notPurchased, .expired:
// return BraveVPN.vpnState.enableVPNDestinationVC
// case .purchased:
// let vc = BraveVPNSettingsViewController()
// vc.openURL = { [unowned self] url in
// self.settingsDelegate?.settingsOpenURLInNewTab(url)
// self.dismiss(animated: true)
// }
//
// return vc
// }
}()

guard let vcToShow = vc else { return }
Expand Down
5 changes: 5 additions & 0 deletions Sources/BraveStrings/BraveStrings.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2856,6 +2856,11 @@ extension Strings {
NSLocalizedString("vpn.contactFormIssue", tableName: "BraveShared", bundle: .module,
value: "Issue",
comment: "Specific issue field for customer support contact form.")

public static let contactFormIssueDescription =
NSLocalizedString("vpn.contactFormIssueDescription", tableName: "BraveShared", bundle: .module,
value: "Please choose the cetagory that describes the issue.",
comment: "Description used for specific issue field for customer support contact form.")

public static let contactFormFooterSharedWithGuardian =
NSLocalizedString("vpn.contactFormFooterSharedWithGuardian", tableName: "BraveShared", bundle: .module,
Expand Down
29 changes: 18 additions & 11 deletions Sources/BraveVPN/BraveVPNContactFormViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,8 @@ class BraveVPNContactFormViewController: TableViewController {

let optionsVC =
OptionSelectionViewController<IssueType>(
headerText: Strings.VPN.contactFormIssue,
footerText: Strings.VPN.contactFormIssueDescription,
options: IssueType.allCases,
optionChanged: optionChanged)

Expand Down Expand Up @@ -255,7 +257,12 @@ class BraveVPNContactFormViewController: TableViewController {
$0.setToRecipients([self.supportEmail])
}

mail.setSubject(Strings.VPN.contactFormTitle)
var formTitle = Strings.VPN.contactFormTitle
if let issue = contactForm.issue {
formTitle += " + \(issue)"
}

mail.setSubject(formTitle)
mail.setMessageBody(self.composeEmailBody(with: self.contactForm), isHTML: false)
present(mail, animated: true)
}
Expand All @@ -282,10 +289,18 @@ class BraveVPNContactFormViewController: TableViewController {
}

private func composeEmailBody(with contactForm: ContactForm) -> String {
var body = "\n\n"
var body = "\n"

body.append(contentsOf: "#### \(Strings.VPN.contactFormDoNotEditText) ####\n\n")

body.append(Strings.VPN.contactFormPlatform)
body.append("\n\(UIDevice.current.systemName)\n\n")

if let issue = contactForm.issue {
body.append(Strings.VPN.contactFormIssue)
body.append("\n\(issue)\n\n")
}

if let hostname = contactForm.hostname {
body.append(Strings.VPN.contactFormHostname)
body.append("\n\(hostname)\n\n")
Expand All @@ -305,10 +320,7 @@ class BraveVPNContactFormViewController: TableViewController {
body.append(Strings.VPN.contactFormAppVersion)
body.append("\n\(appVersion)\n\n")
}

body.append(Strings.VPN.contactFormPlatform)
body.append("\n\(UIDevice.current.systemName)\n\n")


if let timezone = contactForm.timezone {
body.append(Strings.VPN.contactFormTimezone)
body.append("\n\(timezone)\n\n")
Expand Down Expand Up @@ -337,11 +349,6 @@ class BraveVPNContactFormViewController: TableViewController {
body.append("\n")
}

if let issue = contactForm.issue {
body.append(Strings.VPN.contactFormIssue)
body.append("\n\(issue)\n\n")
}

if let receipt = contactForm.receipt {
body.append(Strings.VPN.contactFormAppStoreReceipt)
body.append("\n\(receipt)\n\n")
Expand Down

0 comments on commit 257837d

Please sign in to comment.