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

//
// AboutGMEViewController.swift
// GMERemittance
//
// Created by Sujal on 2/13/18.
// Copyright © 2018 Gobal Money Express Co. Ltd. All rights reserved.
//
import UIKit
import SafariServices
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()
let termsAndConditions = "terms_and_condition_title_text".localized()
let privacyPolicy = "privacyAndPolicy_text".localized()
let fraudGuaranteePolicy = "fraud_guarantee_policy_text".localized()
let furikomaDetails = "JP_Bank_Details_text".localized()
}
// language
@IBOutlet weak var versionLabel: UILabel!
@IBOutlet weak var descriptionLabel: UILabel!
@IBOutlet weak var followUsTitleText: UILabel!
@IBOutlet weak var versionTitleLabel: UILabel!
@IBOutlet weak var termsAndConditionButton: UIButton!
@IBOutlet weak var privacyPolicy: UIButton!
@IBOutlet weak var fraudGuarnteePolicy: UIButton!
@IBOutlet weak var furkomiDetailButtom: UIButton!
let facebookUrls: [String: String] = [
"np" : "",
"kh" : "",
"lk" : "",
"vn" : "",
"ph" : "",
"bd" : "",
"id" : "",
"th" : "",
"mn" : "",
"uz" : "",
"in" : "",
"pk" : "",
"mm" : ""
]
override func viewDidLoad() {
super.viewDidLoad()
self.versionLabel.text = Utility.getAppVersion()
configureLanguage()
configureColor()
}
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
setupNormalNavigation(color: .themeRedDark)
self.title = "About us"
}
override func viewWillDisappear(_ animated: Bool) {
super.viewWillDisappear(animated)
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
func configureColor() {
self.termsAndConditionButton.setTitleColor(UIColor.themeBlue, for: .normal)
self.privacyPolicy.setTitleColor(UIColor.themeBlue, for: .normal)
self.versionTitleLabel.textColor = .themeBlue
self.followUsTitleText.textColor = .themeBlue
}
func configureLanguage() {
let attributes: [NSAttributedString.Key: Any] = [.underlineStyle: NSUnderlineStyle.single.rawValue]
let termsAndConditionAttribute = NSMutableAttributedString(string: StringConstants().termsAndConditions, attributes: attributes)
let privacyAttribute = NSMutableAttributedString(string: StringConstants().privacyPolicy, attributes: attributes)
let fraudAttribute = NSMutableAttributedString(string: StringConstants().fraudGuaranteePolicy, attributes: attributes)
let faurkomiAttribute = NSMutableAttributedString(string: StringConstants().furikomaDetails, attributes: attributes)
self.descriptionLabel.text = StringConstants().descriptionText
self.followUsTitleText.text = StringConstants().followText
self.versionTitleLabel.text = StringConstants().appVersionText
self.termsAndConditionButton.setAttributedTitle(termsAndConditionAttribute, for: .normal)
self.privacyPolicy.setAttributedTitle(privacyAttribute, for: .normal)
self.fraudGuarnteePolicy.setAttributedTitle(fraudAttribute, for: .normal)
self.furkomiDetailButtom.setAttributedTitle(faurkomiAttribute, for: .normal)
//self.termsAndConditionButton.setTitle(StringConstants().termsAndConditions, for: .normal)
// self.privacyPolicy.setTitle(StringConstants().privacyPolicy, for: .normal)
// self.fraudGuarnteePolicy.setTitle(StringConstants().fraudGuaranteePolicy, for: .normal)
}
@IBAction func checkForUpdate(_ sender: Any) {
}
@IBAction func openLinkedIn(_ sender: Any) {
}
@IBAction func openFacebook(_ sender: Any) {
// Based on native country
guard let nativeCountry = GMEDB.shared.user.string(.countryCode)?.lowercased() else {
return
}
UIApplication.tryURL(
url: "https://www.facebook.com/jmeremit/"
//url: self.facebookUrls[nativeCountry.lowercased()] ?? "https://www.facebook.com/jmeremit/"
)
}
@IBAction func furkomiButtonClicked(_ sender: Any) {
let urlString = "https://japanremit.com/document/FurikomiDetails.html"
showTutorial(url: urlString)
}
@IBAction func termsAndCondition(_ sender: UIButton) {
let urlString = "https://www.japanremit.com/Website/TermsAndConditions"
showTutorial(url: urlString)
}
@IBAction func privacyPolicy(_ sender: UIButton) {
let urlString = "https://japanremit.com/Website/PrivacyPolicy"
showTutorial(url: urlString)
}
@IBAction func fraudGuaranteePolicy(_ sender: Any) {
let urlString = "https://japanremit.com/Website/FraudGuaranteePolicy"
showTutorial(url: urlString)
}
func showTutorial(url: String) {
if let url = URL(string: url) {
let config = SFSafariViewController.Configuration()
config.entersReaderIfAvailable = false
let vc = SFSafariViewController(url: url, configuration: config)
present(vc, animated: true)
}
}
}
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)
})
}
}