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.
84 lines
2.3 KiB
84 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 updateMessageLabel: UILabel!
|
|
@IBOutlet weak var updateMessageTextLabel: UILabel!
|
|
@IBOutlet weak var notNowButton: UIButton!
|
|
var presenter: AppUpdateModuleInterface?
|
|
|
|
// MARK: IBOutlets
|
|
|
|
// MARK: VC's Life cycle
|
|
var messageText: String = ""
|
|
override func viewDidLoad() {
|
|
super.viewDidLoad()
|
|
self.setup()
|
|
self.updateMessageLabel.text = messageText
|
|
}
|
|
|
|
// MARK: IBActions
|
|
|
|
@IBAction func dismiss(_ sender: Any) {
|
|
self.dismiss()
|
|
}
|
|
|
|
@IBAction func update(_ sender: UIButton) {
|
|
self.update()
|
|
}
|
|
|
|
@IBAction func backButtonPressed(_ sender: Any) {
|
|
self.dismiss(animated: true, completion: nil)
|
|
}
|
|
// 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.cornerRadius = 25
|
|
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 {}
|