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

//
// AboutGMEViewController.swift
// GMERemittance
//
// Created by Sujal on 2/13/18.
// Copyright © 2018 Gobal Money Express Co. Ltd. All rights reserved.
//
import UIKit
class AboutGMEViewController: UIViewController {
struct StringConstants {
let descriptionText = "about_me_description_text".localized()
let appVersionText = "app_version_text".localized()
let followText = "follow_us_text".localized()
let aboutGme = "about_gme_text".localized()
}
// language
@IBOutlet weak var versionLabel: UILabel!
@IBOutlet weak var descriptionLabel: UILabel!
@IBOutlet weak var followUsTitleText: UILabel!
@IBOutlet weak var versionTitleLabel: UILabel!
let URLFacebookApp: String = "fb://profile/1129818613815224"
let URLFacebookApp2: String = "fb://page/1129818613815224"
let URLFacebookBrowser: String = "https://www.facebook.com/1129818613815224/"
let URLLinkedInApp: String = "linkedin://company/gmeremit/"
let URLLinkedInBrowser: String = "https://www.linkedin.com/company/gmeremit/"
let facebookUrls: [String: String] = [
"np" : "https://www.facebook.com/gmenepal/",
"kh" : "https://www.facebook.com/gmecambodia/",
"lk" : "https://www.facebook.com/gmeremitsrilanka/",
"vn" : "https://www.facebook.com/gmevietnam/",
"ph" : "https://www.facebook.com/gmephilippines/",
"bd" : "https://www.facebook.com/gmebangladesh/",
"id" : "https://www.facebook.com/gmeindonesia/",
"th" : "https://www.facebook.com/gmethailand/",
"mn" : "https://www.facebook.com/gmemongolia/",
"uz" : "https://www.facebook.com/gmeuzbekistan/",
"in" : "https://www.facebook.com/GMEindia/",
"pk" : "https://www.facebook.com/gmepakistan/",
"mm" : "https://www.facebook.com/gmemyanmar/"
]
override func viewDidLoad() {
super.viewDidLoad()
self.versionLabel.text = Utility.getAppVersion()
configureLanguage()
versionTitleLabel.textColor = .themeRed
followUsTitleText.textColor = .themeRed
}
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
// self.setupNormalNavigation()
// self.navigationItem.title = StringConstants().aboutGme
setupNormalNavigation(color: .themeRedDark)
setupNavigationShadow(isUse: false)
}
override func viewWillDisappear(_ animated: Bool) {
super.viewWillDisappear(animated)
setupNavigationShadow(isUse: true)
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
func configureLanguage() {
self.descriptionLabel.text = StringConstants().descriptionText
self.followUsTitleText.text = StringConstants().followText
self.versionTitleLabel.text = StringConstants().appVersionText
}
@IBAction func checkForUpdate(_ sender: Any) {
//
}
@IBAction func openLinkedIn(_ sender: Any) {
// UIApplication.tryURL(urls: [self.URLLinkedInApp,
// self.URLLinkedInBrowser
// ])
}
@IBAction func openFacebook(_ sender: Any) {
// Based on native country
guard let nativeCountry = GMEDB.shared.user.string(.countryCode)?.lowercased() else {
return
}
UIApplication.tryURL(
url: self.facebookUrls[nativeCountry.lowercased()] ?? "https://www.facebook.com/gmenepal/"
)
}
}
extension UIApplication {
class func tryURL(url: String) {
let application = UIApplication.shared
if let url = URL(string: url), application.canOpenURL(url) {
application.open(
url,
options: convertToUIApplicationOpenExternalURLOptionsKeyDictionary([:]),
completionHandler: nil
)
}
}
// Helper function inserted by Swift 4.2 migrator.
class func convertToUIApplicationOpenExternalURLOptionsKeyDictionary(
_ input: [String: Any]
) -> [UIApplication.OpenExternalURLOptionsKey: Any] {
return Dictionary(uniqueKeysWithValues: input.map { key, value in
(UIApplication.OpenExternalURLOptionsKey(rawValue: key), value)
})
}
}