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.

168 lines
6.2 KiB

6 years ago
6 years ago
4 years ago
2 years ago
4 years ago
2 years ago
4 years ago
4 years ago
4 years ago
2 years ago
2 years ago
2 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. let fraudGuaranteePolicy = "fraud_guarantee_policy_text".localized()
  19. let furikomaDetails = "JP_Bank_Details_text".localized()
  20. }
  21. // language
  22. @IBOutlet weak var versionLabel: UILabel!
  23. @IBOutlet weak var descriptionLabel: UILabel!
  24. @IBOutlet weak var followUsTitleText: UILabel!
  25. @IBOutlet weak var versionTitleLabel: UILabel!
  26. @IBOutlet weak var termsAndConditionButton: UIButton!
  27. @IBOutlet weak var privacyPolicy: UIButton!
  28. @IBOutlet weak var fraudGuarnteePolicy: UIButton!
  29. @IBOutlet weak var furkomiDetailButtom: UIButton!
  30. let facebookUrls: [String: String] = [
  31. "np" : "",
  32. "kh" : "",
  33. "lk" : "",
  34. "vn" : "",
  35. "ph" : "",
  36. "bd" : "",
  37. "id" : "",
  38. "th" : "",
  39. "mn" : "",
  40. "uz" : "",
  41. "in" : "",
  42. "pk" : "",
  43. "mm" : ""
  44. ]
  45. override func viewDidLoad() {
  46. super.viewDidLoad()
  47. self.versionLabel.text = Utility.getAppVersion()
  48. configureLanguage()
  49. configureColor()
  50. }
  51. override func viewWillAppear(_ animated: Bool) {
  52. super.viewWillAppear(animated)
  53. setupNormalNavigation(color: .themeRedDark)
  54. self.title = "About us"
  55. }
  56. override func viewWillDisappear(_ animated: Bool) {
  57. super.viewWillDisappear(animated)
  58. }
  59. override func didReceiveMemoryWarning() {
  60. super.didReceiveMemoryWarning()
  61. // Dispose of any resources that can be recreated.
  62. }
  63. func configureColor() {
  64. self.termsAndConditionButton.setTitleColor(UIColor.themeBlue, for: .normal)
  65. self.privacyPolicy.setTitleColor(UIColor.themeBlue, for: .normal)
  66. self.versionTitleLabel.textColor = .themeBlue
  67. self.followUsTitleText.textColor = .themeBlue
  68. }
  69. func configureLanguage() {
  70. let attributes: [NSAttributedString.Key: Any] = [.underlineStyle: NSUnderlineStyle.single.rawValue]
  71. let termsAndConditionAttribute = NSMutableAttributedString(string: StringConstants().termsAndConditions, attributes: attributes)
  72. let privacyAttribute = NSMutableAttributedString(string: StringConstants().privacyPolicy, attributes: attributes)
  73. let fraudAttribute = NSMutableAttributedString(string: StringConstants().fraudGuaranteePolicy, attributes: attributes)
  74. let faurkomiAttribute = NSMutableAttributedString(string: StringConstants().furikomaDetails, attributes: attributes)
  75. self.descriptionLabel.text = StringConstants().descriptionText
  76. self.followUsTitleText.text = StringConstants().followText
  77. self.versionTitleLabel.text = StringConstants().appVersionText
  78. self.termsAndConditionButton.setAttributedTitle(termsAndConditionAttribute, for: .normal)
  79. self.privacyPolicy.setAttributedTitle(privacyAttribute, for: .normal)
  80. self.fraudGuarnteePolicy.setAttributedTitle(fraudAttribute, for: .normal)
  81. self.furkomiDetailButtom.setAttributedTitle(faurkomiAttribute, for: .normal)
  82. //self.termsAndConditionButton.setTitle(StringConstants().termsAndConditions, for: .normal)
  83. // self.privacyPolicy.setTitle(StringConstants().privacyPolicy, for: .normal)
  84. // self.fraudGuarnteePolicy.setTitle(StringConstants().fraudGuaranteePolicy, for: .normal)
  85. }
  86. @IBAction func checkForUpdate(_ sender: Any) {
  87. }
  88. @IBAction func openLinkedIn(_ sender: Any) {
  89. }
  90. @IBAction func openFacebook(_ sender: Any) {
  91. // Based on native country
  92. guard let nativeCountry = GMEDB.shared.user.string(.countryCode)?.lowercased() else {
  93. return
  94. }
  95. UIApplication.tryURL(
  96. url: "https://www.facebook.com/jmeremit/"
  97. //url: self.facebookUrls[nativeCountry.lowercased()] ?? "https://www.facebook.com/jmeremit/"
  98. )
  99. }
  100. @IBAction func furkomiButtonClicked(_ sender: Any) {
  101. let urlString = "https://japanremit.com/document/FurikomiDetails.html"
  102. showTutorial(url: urlString)
  103. }
  104. @IBAction func termsAndCondition(_ sender: UIButton) {
  105. let urlString = "https://www.japanremit.com/Website/TermsAndConditions"
  106. showTutorial(url: urlString)
  107. }
  108. @IBAction func privacyPolicy(_ sender: UIButton) {
  109. let urlString = "https://japanremit.com/Website/PrivacyPolicy"
  110. showTutorial(url: urlString)
  111. }
  112. @IBAction func fraudGuaranteePolicy(_ sender: Any) {
  113. let urlString = "https://japanremit.com/Website/FraudGuaranteePolicy"
  114. showTutorial(url: urlString)
  115. }
  116. func showTutorial(url: String) {
  117. if let url = URL(string: url) {
  118. let config = SFSafariViewController.Configuration()
  119. config.entersReaderIfAvailable = false
  120. let vc = SFSafariViewController(url: url, configuration: config)
  121. present(vc, animated: true)
  122. }
  123. }
  124. }
  125. extension UIApplication {
  126. class func tryURL(url: String) {
  127. let application = UIApplication.shared
  128. if let url = URL(string: url), application.canOpenURL(url) {
  129. application.open(
  130. url,
  131. options: convertToUIApplicationOpenExternalURLOptionsKeyDictionary([:]),
  132. completionHandler: nil
  133. )
  134. }
  135. }
  136. // Helper function inserted by Swift 4.2 migrator.
  137. class func convertToUIApplicationOpenExternalURLOptionsKeyDictionary(
  138. _ input: [String: Any]
  139. ) -> [UIApplication.OpenExternalURLOptionsKey: Any] {
  140. return Dictionary(uniqueKeysWithValues: input.map { key, value in
  141. (UIApplication.OpenExternalURLOptionsKey(rawValue: key), value)
  142. })
  143. }
  144. }