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.

124 lines
4.0 KiB

6 years ago
5 years ago
5 years ago
5 years ago
6 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. class AboutGMEViewController: UIViewController {
  10. struct StringConstants {
  11. let descriptionText = "about_me_description_text".localized()
  12. let appVersionText = "app_version_text".localized()
  13. let followText = "follow_us_text".localized()
  14. let aboutGme = "about_gme_text".localized()
  15. }
  16. // language
  17. @IBOutlet weak var versionLabel: UILabel!
  18. @IBOutlet weak var descriptionLabel: UILabel!
  19. @IBOutlet weak var followUsTitleText: UILabel!
  20. @IBOutlet weak var versionTitleLabel: UILabel!
  21. let URLFacebookApp: String = "fb://profile/1129818613815224"
  22. let URLFacebookApp2: String = "fb://page/1129818613815224"
  23. let URLFacebookBrowser: String = "https://www.facebook.com/1129818613815224/"
  24. let URLLinkedInApp: String = "linkedin://company/gmeremit/"
  25. let URLLinkedInBrowser: String = "https://www.linkedin.com/company/gmeremit/"
  26. let facebookUrls: [String: String] = [
  27. "np" : "https://www.facebook.com/gmenepal/",
  28. "kh" : "https://www.facebook.com/gmecambodia/",
  29. "lk" : "https://www.facebook.com/gmeremitsrilanka/",
  30. "vn" : "https://www.facebook.com/gmevietnam/",
  31. "ph" : "https://www.facebook.com/gmephilippines/",
  32. "bd" : "https://www.facebook.com/gmebangladesh/",
  33. "id" : "https://www.facebook.com/gmeindonesia/",
  34. "th" : "https://www.facebook.com/gmethailand/",
  35. "mn" : "https://www.facebook.com/gmemongolia/",
  36. "uz" : "https://www.facebook.com/gmeuzbekistan/",
  37. "in" : "https://www.facebook.com/GMEindia/",
  38. "pk" : "https://www.facebook.com/gmepakistan/",
  39. "mm" : "https://www.facebook.com/gmemyanmar/"
  40. ]
  41. override func viewDidLoad() {
  42. super.viewDidLoad()
  43. self.versionLabel.text = Utility.getAppVersion()
  44. configureLanguage()
  45. versionTitleLabel.textColor = .themeRed
  46. followUsTitleText.textColor = .themeRed
  47. }
  48. override func viewWillAppear(_ animated: Bool) {
  49. super.viewWillAppear(animated)
  50. // self.setupNormalNavigation()
  51. // self.navigationItem.title = StringConstants().aboutGme
  52. setupNormalNavigation(color: .themeRedDark)
  53. setupNavigationShadow(isUse: false)
  54. }
  55. override func viewWillDisappear(_ animated: Bool) {
  56. super.viewWillDisappear(animated)
  57. setupNavigationShadow(isUse: true)
  58. }
  59. override func didReceiveMemoryWarning() {
  60. super.didReceiveMemoryWarning()
  61. // Dispose of any resources that can be recreated.
  62. }
  63. func configureLanguage() {
  64. self.descriptionLabel.text = StringConstants().descriptionText
  65. self.followUsTitleText.text = StringConstants().followText
  66. self.versionTitleLabel.text = StringConstants().appVersionText
  67. }
  68. @IBAction func checkForUpdate(_ sender: Any) {
  69. //
  70. }
  71. @IBAction func openLinkedIn(_ sender: Any) {
  72. // UIApplication.tryURL(urls: [self.URLLinkedInApp,
  73. // self.URLLinkedInBrowser
  74. // ])
  75. }
  76. @IBAction func openFacebook(_ sender: Any) {
  77. // Based on native country
  78. guard let nativeCountry = GMEDB.shared.user.string(.countryCode)?.lowercased() else {
  79. return
  80. }
  81. UIApplication.tryURL(
  82. url: self.facebookUrls[nativeCountry.lowercased()] ?? "https://www.facebook.com/gmenepal/"
  83. )
  84. }
  85. }
  86. extension UIApplication {
  87. class func tryURL(url: String) {
  88. let application = UIApplication.shared
  89. if let url = URL(string: url), application.canOpenURL(url) {
  90. application.open(
  91. url,
  92. options: convertToUIApplicationOpenExternalURLOptionsKeyDictionary([:]),
  93. completionHandler: nil
  94. )
  95. }
  96. }
  97. // Helper function inserted by Swift 4.2 migrator.
  98. class func convertToUIApplicationOpenExternalURLOptionsKeyDictionary(
  99. _ input: [String: Any]
  100. ) -> [UIApplication.OpenExternalURLOptionsKey: Any] {
  101. return Dictionary(uniqueKeysWithValues: input.map { key, value in
  102. (UIApplication.OpenExternalURLOptionsKey(rawValue: key), value)
  103. })
  104. }
  105. }