Created
December 12, 2017 15:51
-
-
Save angelsystem/52afefeb1957b6b8ba60791e75647719 to your computer and use it in GitHub Desktop.
function que bloquea la vista si la version no es la minima
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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