Skip to content

Instantly share code, notes, and snippets.

@angelsystem
Created December 12, 2017 15:51
Show Gist options
  • Save angelsystem/52afefeb1957b6b8ba60791e75647719 to your computer and use it in GitHub Desktop.
Save angelsystem/52afefeb1957b6b8ba60791e75647719 to your computer and use it in GitHub Desktop.
function que bloquea la vista si la version no es la minima
func showBlockerViewByVersionIfNeeded() {
if let version = Bundle.main.releaseVersionNumber {
let verifyAppURL = WURL.verifyAppVersion!+"?version=\(version)"+"&os=ios"
_ = Server.instance.request(method: .get, URLString: verifyAppURL, response: { (result) in
switch result {
case .success(let value):
print("value: \(value)")
let result = (value as? [String: Any])
let update_force = result?["update_force"] as! Bool
if update_force {
let blockerVC = self.window?.rootViewController?.storyboard?.instantiateViewController(withIdentifier: "BlockerVersionVC") as? BlockerVersionVC
blockerVC?.message = result?["message"] as? String
blockerVC?.urlStore = result?["url"] as? String
if let blockerViewController = blockerVC {
self.window?.rootViewController?.present(blockerViewController, animated: true, completion: nil)
}
}
break
case .failure:
break
}
})
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment