Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

[IB2-459] Settings: Help Section

  • Loading branch information
Tim Palade authored and mahmoud-adam85 committed Sep 11, 2018
1 parent 608d752 commit 9a15b4f64e0b4a416904ae418892de2ca13d8a24
@@ -8,6 +8,7 @@
import Foundation
import Storage
import MessageUI

extension NSNotification.Name {
public static let GhosteryButtonPressed = NSNotification.Name(rawValue: "GhosteryButtonPressedNotification")
@@ -198,3 +199,9 @@ extension BrowserViewController: ControlCenterViewControllerDelegate {
}

}

extension BrowserViewController: MFMailComposeViewControllerDelegate {
func mailComposeController(_ controller: MFMailComposeViewController, didFinishWith result: MFMailComposeResult, error: Error?) {
self.dismiss(animated: true, completion: nil)
}
}
@@ -7,6 +7,7 @@
//
import Foundation
import MessageUI

// MARK:- cliqz settings
class CliqzConnectSetting: Setting {
@@ -167,11 +168,37 @@ class AdBlockerSetting: CliqzOnOffSetting {
}
}

class FAQSetting: Setting {

override var title: NSAttributedString? {
return NSAttributedString(string: NSLocalizedString("FAQ", tableName: "Cliqz", comment: "[Settings] FAQ"), attributes: [NSAttributedStringKey.foregroundColor: UIConstants.HighlightBlue])
}

override var url: URL? {
#if GHOSTERY
return URL(string: "https://ghostery.zendesk.com/hc/en-us/categories/115000106334-iOS-Mobile-FAQ")
#else
return URL(string: "https://cliqz.com/support")
#endif
}

override func onClick(_ navigationController: UINavigationController?) {
navigationController?.dismiss(animated: true, completion: {})
self.delegate?.settingsOpenURLInNewTab(self.url!)

// TODO: Telemetry
/*
// Cliqz: log telemetry signal
let contactSignal = TelemetryLogEventType.Settings("main", "click", "contact", nil, nil)
TelemetryLogger.sharedInstance.logEvent(contactSignal)
*/
}
}

class SupportSetting: Setting {

override var title: NSAttributedString? {
return NSAttributedString(string: NSLocalizedString("FAQ & Support", tableName: "Cliqz", comment: "[Settings] FAQ & Support"),attributes: [NSAttributedStringKey.foregroundColor: UIConstants.HighlightBlue])
return NSAttributedString(string: NSLocalizedString("Support", tableName: "Cliqz", comment: "[Settings] Support"), attributes: [:])
}

override var url: URL? {
@@ -184,7 +211,19 @@ class SupportSetting: Setting {

override func onClick(_ navigationController: UINavigationController?) {
navigationController?.dismiss(animated: true, completion: {})
self.delegate?.settingsOpenURLInNewTab(self.url!)

if !MFMailComposeViewController.canSendMail() {
self.delegate?.settingsOpenURLInNewTab(self.url!)
}
else if let nav = navigationController as? SettingsNavigationController, let vc = nav.popoverDelegate as? BrowserViewController {
let mailVC = MFMailComposeViewController()
mailVC.mailComposeDelegate = vc
mailVC.setToRecipients(["mobile@ghostery.com"])
mailVC.setSubject("Ghostery Mobile Browser Feedback")
mailVC.setMessageBody("[\(UIDevice.current.modelName), \(UIDevice.current.systemVersion), \(AppStatus.distVersion()), \(AppStatus.extensionVersion())]", isHTML: false)

vc.present(mailVC, animated: true, completion: nil)
}

// TODO: Telemetry
/*
@@ -193,7 +232,6 @@ class SupportSetting: Setting {
TelemetryLogger.sharedInstance.logEvent(contactSignal)
*/
}

}

class ReportWebsiteSetting: ShowCliqzPageSetting {
@@ -150,9 +150,10 @@ class CliqzAppSettingsTableViewController: AppSettingsTableViewController {

private func generateHelpSettings(prefs: Prefs) -> [Setting] {
let helpSettings = [
FAQSetting(delegate: settingsDelegate),
SupportSetting(delegate: settingsDelegate),
CliqzTipsAndTricksSetting(),
ReportWebsiteSetting(),
//CliqzTipsAndTricksSetting(),
//ReportWebsiteSetting(),
SendCrashReportsSetting(settings: self),
SendUsageDataSetting(settings: self),
MyOffrzSetting()

0 comments on commit 9a15b4f

Please sign in to comment.