[O] Encapsulate ui{} inside alarm.dismiss{}
This commit is contained in:
@@ -92,23 +92,20 @@ class LoginVC: UIViewController
|
|||||||
localStorage["pass"] = pass.sha256
|
localStorage["pass"] = pass.sha256
|
||||||
localStorage["id"] = $0
|
localStorage["id"] = $0
|
||||||
|
|
||||||
ui
|
a.dismiss
|
||||||
{
|
{
|
||||||
a.dismiss
|
// Send feedback
|
||||||
{
|
if login { self.msg("Login success!", "Now you can use account features, yay!") }
|
||||||
// Send feedback
|
else { self.msg("Registration success!", "Now you have an account, yay!") }
|
||||||
if login { self.msg("Login success!", "Now you can use account features, yay!") }
|
|
||||||
else { self.msg("Registration success!", "Now you have an account, yay!") }
|
// Hide registration and show account detail view
|
||||||
|
AccountViewController.this.login()
|
||||||
// Hide registration and show account detail view
|
|
||||||
AccountViewController.this.login()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
err:
|
err:
|
||||||
{
|
{
|
||||||
print($0)
|
print($0)
|
||||||
ui { a.dismiss { self.msg("An error occurred", "Maybe the server is on fire, just wait a few hours.") } }
|
a.dismiss { self.msg("An error occurred", "Maybe the server is on fire, just wait a few hours.") }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -139,7 +139,7 @@ extension UIViewController
|
|||||||
func msg(_ title: String, _ message: String) -> UIAlertController { alert(title, message, okayable: true) }
|
func msg(_ title: String, _ message: String) -> UIAlertController { alert(title, message, okayable: true) }
|
||||||
|
|
||||||
/// More convenient dismiss function
|
/// More convenient dismiss function
|
||||||
func dismiss(_ completion: (() -> Void)? = nil) { dismiss(animated: false, completion: completion) }
|
func dismiss(_ completion: (() -> Void)? = nil) { ui { dismiss(animated: false, completion: completion) } }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user