Guest User

Untitled

a guest
Dec 14th, 2017
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.35 KB | None | 0 0
  1. func showBlockerViewByVersionIfNeeded() {
  2.  
  3. if let version = Bundle.main.releaseVersionNumber {
  4. let verifyAppURL = WURL.verifyAppVersion!+"?version=\(version)"+"&os=ios"
  5.  
  6. _ = Server.instance.request(method: .get, URLString: verifyAppURL, response: { (result) in
  7. switch result {
  8.  
  9. case .success(let value):
  10. print("value: \(value)")
  11. let result = (value as? [String: Any])
  12. let update_force = result?["update_force"] as! Bool
  13. if update_force {
  14. let blockerVC = self.window?.rootViewController?.storyboard?.instantiateViewController(withIdentifier: "BlockerVersionVC") as? BlockerVersionVC
  15. blockerVC?.message = result?["message"] as? String
  16. blockerVC?.urlStore = result?["url"] as? String
  17.  
  18. if let blockerViewController = blockerVC {
  19. self.window?.rootViewController?.present(blockerViewController, animated: true, completion: nil)
  20.  
  21. }
  22. }
  23. break
  24.  
  25. case .failure:
  26. break
  27. }
  28. })
  29. }
  30. }
Add Comment
Please, Sign In to add comment