Commit b91e5848 authored by Jü's avatar

added feedback gate

parent 53d087bf
......@@ -42,5 +42,7 @@ public class Constants {
public static let feeProviderUri = "http://node.moneroworld.com:18089/json_rpc"
public static let feeUpdateIntervalInSeconds = 30
public static let estimatedMessageSizeInKB: Int = 13
public static let troubleShootingLink = "https://gitlab.com/rusticbison/xwallet#troubleshooting"
}
......@@ -104,6 +104,10 @@ public class SettingsCoordinator: Coordinator {
viewModel.feedbackCellButtonTitle = Constants.feedbackEmail
viewModel.feedbackSubject = "X Wallet Feedback"
viewModel.feedbackMessageBody = "Hi, I am a happy X Wallet user and I have a question/suggestion:\n\n"
viewModel.feedbackDescription = "Please check our troubleshooting web page before you send a support request."
viewModel.feedbackShowFAQTitle = "Show FAQ"
viewModel.feedbackSendTitle = "Send Feedback"
viewModel.feedbackCancelTitle = "Cancel"
return viewModel
}
......
......@@ -210,7 +210,7 @@ class SettingsVC: UIViewController {
if let buttonTitle = self.viewModel.feedbackCellButtonTitle {
cell.buttonTitle = buttonTitle
}
cell.buttonTouchedHandler = { () in self.sendFeedback() }
cell.buttonTouchedHandler = { () in self.askForFeedback() }
cell.redraw()
return cell
}()
......@@ -219,6 +219,28 @@ class SettingsVC: UIViewController {
extension SettingsVC: MFMailComposeViewControllerDelegate {
private func askForFeedback() {
let alertView = UIAlertController(title: self.viewModel.feedbackCellTitle,
message: self.viewModel.feedbackDescription,
preferredStyle: .alert)
alertView.addAction(UIAlertAction(title: self.viewModel.feedbackShowFAQTitle,
style: .default,
handler: { (_) in self.showFAQ() }))
alertView.addAction(UIAlertAction(title: self.viewModel.feedbackSendTitle,
style: .default,
handler: { (_) in self.sendFeedback() }))
alertView.addAction(UIAlertAction(title: self.viewModel.feedbackCancelTitle,
style: .default,
handler: nil))
self.present(alertView, animated: true, completion: nil)
}
private func showFAQ() {
if let url = URL(string: Constants.troubleShootingLink) {
UIApplication.shared.open(url, options: [:])
}
}
private func sendFeedback() {
if MFMailComposeViewController.canSendMail() {
let mail = MFMailComposeViewController()
......
......@@ -46,6 +46,10 @@ struct SettingsViewModel {
public var feedbackCellButtonTitle: String?
public var feedbackSubject: String?
public var feedbackMessageBody: String?
public var feedbackDescription: String?
public var feedbackShowFAQTitle: String?
public var feedbackSendTitle: String?
public var feedbackCancelTitle: String?
public weak var delegate: SettingsVCProtocol?
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment