// // AppUpdateViewController.swift // GME Remit // // Created by shishir sapkota on 12/11/18. //Copyright © 2018 Gobal Money Express Co. Ltd. All rights reserved. // import UIKit class AppUpdateViewController: UIViewController { struct StringConstants { let updateMessageText = "new_update_is_available_text".localized() let updateText = "update_text".localized() let notNowText = "not_now_text".localized() } // MARK: Properties @IBOutlet weak var updateButton: UIButton! @IBOutlet weak var updateMessageTextLabel: UILabel! @IBOutlet weak var notNowButton: UIButton! var presenter: AppUpdateModuleInterface? // MARK: IBOutlets // MARK: VC's Life cycle override func viewDidLoad() { super.viewDidLoad() self.setup() } // MARK: IBActions @IBAction func dismiss(_ sender: Any) { self.dismiss() } @IBAction func update(_ sender: UIButton) { self.update() } // MARK: Other Functions private func setup() { let shouldHideDismiss = Utility.isCriticalUpdate() self.notNowButton.isHidden = shouldHideDismiss configureUpdateButton() configureText() } private func configureText() { self.updateMessageTextLabel.text = StringConstants().updateMessageText self.updateButton.setTitle(StringConstants().updateText, for: UIControl.State.normal) self.notNowButton.setTitle(StringConstants().notNowText, for: UIControl.State.normal) } func configureUpdateButton() { self.updateButton.layer.borderColor = UIColor.white.cgColor self.updateButton.layer.borderWidth = 1 self.updateButton.layer.addShadow(offset: CGSize.init(width: -1, height: 1)) } func dismiss() { self.dismiss(animated: true, completion: nil) } func update() { let urlStr = "itms-apps://itunes.apple.com/gh/app/gme-remit/id1439161261?mt=8" UIApplication.tryURL(url: urlStr) } } // MARK: AppUpdateViewInterface extension AppUpdateViewController: AppUpdateViewInterface {}