You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

148 lines
4.7 KiB

6 years ago
6 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
6 years ago
6 years ago
5 years ago
  1. //
  2. // AboutGMEViewController.swift
  3. // GMERemittance
  4. //
  5. // Created by Sujal on 2/13/18.
  6. // Copyright © 2018 Gobal Money Express Co. Ltd. All rights reserved.
  7. //
  8. import UIKit
  9. import SafariServices
  10. class AboutGMEViewController: UIViewController {
  11. struct StringConstants {
  12. let descriptionText = "about_me_description_text".localized()
  13. let appVersionText = "app_version_text".localized()
  14. let followText = "follow_us_text".localized()
  15. let aboutGme = "about_gme_text".localized()
  16. let termsAndConditions = "terms_and_condition_title_text".localized()
  17. let privacyPolicy = "privacyAndPolicy_text".localized()
  18. }
  19. // language
  20. @IBOutlet weak var versionLabel: UILabel!
  21. @IBOutlet weak var descriptionLabel: UILabel!
  22. @IBOutlet weak var followUsTitleText: UILabel!
  23. @IBOutlet weak var versionTitleLabel: UILabel!
  24. @IBOutlet weak var termsAndConditionButton: UIButton!
  25. @IBOutlet weak var privacyPolicy: UIButton!
  26. let facebookUrls: [String: String] = [
  27. "np" : "",
  28. "kh" : "",
  29. "lk" : "",
  30. "vn" : "",
  31. "ph" : "",
  32. "bd" : "",
  33. "id" : "",
  34. "th" : "",
  35. "mn" : "",
  36. "uz" : "",
  37. "in" : "",
  38. "pk" : "",
  39. "mm" : ""
  40. ]
  41. override func viewDidLoad() {
  42. super.viewDidLoad()
  43. self.versionLabel.text = Utility.getAppVersion()
  44. configureLanguage()
  45. configureColor()
  46. }
  47. override func viewWillAppear(_ animated: Bool) {
  48. super.viewWillAppear(animated)
  49. setupNormalNavigation(color: .themeRedDark)
  50. }
  51. override func viewWillDisappear(_ animated: Bool) {
  52. super.viewWillDisappear(animated)
  53. }
  54. override func didReceiveMemoryWarning() {
  55. super.didReceiveMemoryWarning()
  56. // Dispose of any resources that can be recreated.
  57. }
  58. func configureColor() {
  59. self.termsAndConditionButton.setTitleColor(UIColor.themeBlue, for: .normal)
  60. self.privacyPolicy.setTitleColor(UIColor.themeBlue, for: .normal)
  61. self.versionTitleLabel.textColor = .themeBlue
  62. self.followUsTitleText.textColor = .themeBlue
  63. }
  64. func configureLanguage() {
  65. self.descriptionLabel.text = StringConstants().descriptionText
  66. self.followUsTitleText.text = StringConstants().followText
  67. self.versionTitleLabel.text = StringConstants().appVersionText
  68. self.termsAndConditionButton.setTitle(StringConstants().termsAndConditions, for: .normal)
  69. self.privacyPolicy.setTitle(StringConstants().privacyPolicy, for: .normal)
  70. }
  71. @IBAction func checkForUpdate(_ sender: Any) {
  72. }
  73. @IBAction func openLinkedIn(_ sender: Any) {
  74. }
  75. @IBAction func openFacebook(_ sender: Any) {
  76. // Based on native country
  77. guard let nativeCountry = GMEDB.shared.user.string(.countryCode)?.lowercased() else {
  78. return
  79. }
  80. UIApplication.tryURL(
  81. url: "https://www.facebook.com/jmeremit/"
  82. //url: self.facebookUrls[nativeCountry.lowercased()] ?? "https://www.facebook.com/jmeremit/"
  83. )
  84. }
  85. @IBAction func termsAndCondition(_ sender: UIButton) {
  86. let urlString = "https://www.japanremit.com/Website/TermsAndConditions"
  87. showTutorial(url: urlString)
  88. }
  89. @IBAction func privacyPolicy(_ sender: UIButton) {
  90. let urlString = "https://japanremit.com/Website/PrivacyPolicy"
  91. showTutorial(url: urlString)
  92. }
  93. @IBAction func fraudGuaranteePolicy(_ sender: Any) {
  94. let urlString = "https://japanremit.com/Website/FraudGuaranteePolicy"
  95. showTutorial(url: urlString)
  96. }
  97. func showTutorial(url: String) {
  98. if let url = URL(string: url) {
  99. let config = SFSafariViewController.Configuration()
  100. config.entersReaderIfAvailable = false
  101. let vc = SFSafariViewController(url: url, configuration: config)
  102. present(vc, animated: true)
  103. }
  104. }
  105. }
  106. extension UIApplication {
  107. class func tryURL(url: String) {
  108. let application = UIApplication.shared
  109. if let url = URL(string: url), application.canOpenURL(url) {
  110. application.open(
  111. url,
  112. options: convertToUIApplicationOpenExternalURLOptionsKeyDictionary([:]),
  113. completionHandler: nil
  114. )
  115. }
  116. }
  117. // Helper function inserted by Swift 4.2 migrator.
  118. class func convertToUIApplicationOpenExternalURLOptionsKeyDictionary(
  119. _ input: [String: Any]
  120. ) -> [UIApplication.OpenExternalURLOptionsKey: Any] {
  121. return Dictionary(uniqueKeysWithValues: input.map { key, value in
  122. (UIApplication.OpenExternalURLOptionsKey(rawValue: key), value)
  123. })
  124. }
  125. }