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.
 
 
 
 

86 lines
2.3 KiB

//
// 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: UIControlState.normal)
self.notNowButton.setTitle(StringConstants().notNowText, for: UIControlState.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://itunes.apple.com/gh/app/gme-remit/id1439161261?mt=8"
if #available(iOS 10.0, *) {
UIApplication.shared.open(URL(string: urlStr)!, options: [:], completionHandler: nil)
} else {
UIApplication.shared.openURL(URL(string: urlStr)!)
}
}
}
// MARK: AppUpdateViewInterface
extension AppUpdateViewController: AppUpdateViewInterface {
}