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.
 
 
 
 

117 lines
4.4 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/"
// var defaultCountries = ["Nepal", "Cambodia", "Philipinnes", "Sri Lanka", "Vietnam", "India", "Pakistan", "azerbaijan", "Bangladesh", "Belarus", "Georgia", "Indonesia", "Kazakhstan", "Kyrgyzstan", "Malaysia", "Moldova", "Mongolia", "Myanmar", "Russian Federation", "Singapore", "Tajikistan", "Thailand", "Uzbekistan"]
// var defaultCountryCodes = ["np", "kh", "ph", "lk", "vn", "in", "pk", "az", "bd", "by", "ge", "id", "kz", "kg", "my", "md", "mn", "mm", "ru", "sg", "tj", "th", "uz", "en"]
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()
}
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
self.setupNormalNavigation()
self.navigationItem.title = StringConstants().aboutGme
}
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) {
if #available(iOS 10.0, *) {
application.open(URL(string: url)!, options: convertToUIApplicationOpenExternalURLOptionsKeyDictionary([:]), completionHandler: nil)
} else {
// Fallback on earlier versions
}
return
}
}
}
// Helper function inserted by Swift 4.2 migrator.
fileprivate func convertToUIApplicationOpenExternalURLOptionsKeyDictionary(_ input: [String: Any]) -> [UIApplication.OpenExternalURLOptionsKey: Any] {
return Dictionary(uniqueKeysWithValues: input.map { key, value in (UIApplication.OpenExternalURLOptionsKey(rawValue: key), value)})
}