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.

72 lines
1.7 KiB

6 years ago
  1. //
  2. // AppUpdateViewController.swift
  3. // GME Remit
  4. //
  5. // Created by shishir sapkota on 12/11/18.
  6. //Copyright © 2018 Gobal Money Express Co. Ltd. All rights reserved.
  7. //
  8. import UIKit
  9. class AppUpdateViewController: UIViewController {
  10. // MARK: Properties
  11. @IBOutlet weak var updateButton: UIButton!
  12. @IBOutlet weak var notNowButton: UIButton!
  13. var presenter: AppUpdateModuleInterface?
  14. // MARK: IBOutlets
  15. // MARK: VC's Life cycle
  16. override func viewDidLoad() {
  17. super.viewDidLoad()
  18. self.setup()
  19. }
  20. // MARK: IBActions
  21. @IBAction func dismiss(_ sender: Any) {
  22. self.dismiss()
  23. }
  24. @IBAction func update(_ sender: UIButton) {
  25. self.update()
  26. }
  27. // MARK: Other Functions
  28. private func setup() {
  29. let shouldHideDismiss = Utility.isCriticalUpdate()
  30. self.notNowButton.isHidden = shouldHideDismiss
  31. configureUpdateButton()
  32. }
  33. func configureUpdateButton() {
  34. self.updateButton.layer.borderColor = UIColor.white.cgColor
  35. self.updateButton.layer.borderWidth = 1
  36. self.updateButton.layer.addShadow(offset: CGSize.init(width: -1, height: 1))
  37. }
  38. func dismiss() {
  39. self.dismiss(animated: true, completion: nil)
  40. }
  41. func update() {
  42. let urlStr = "itms://itunes.apple.com/gh/app/gme-remit/id1439161261?mt=8"
  43. if #available(iOS 10.0, *) {
  44. UIApplication.shared.open(URL(string: urlStr)!, options: [:], completionHandler: nil)
  45. } else {
  46. UIApplication.shared.openURL(URL(string: urlStr)!)
  47. }
  48. }
  49. }
  50. // MARK: AppUpdateViewInterface
  51. extension AppUpdateViewController: AppUpdateViewInterface {
  52. }