From 583500698519857538a01b7c6104a2b847064509 Mon Sep 17 00:00:00 2001 From: Hykilpikonna Date: Fri, 22 Jan 2021 17:44:46 -0500 Subject: [PATCH] [F] Fix "Main thread only" errors --- ProjectClock/AccountViewController.swift | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/ProjectClock/AccountViewController.swift b/ProjectClock/AccountViewController.swift index 6040634..87565f1 100644 --- a/ProjectClock/AccountViewController.swift +++ b/ProjectClock/AccountViewController.swift @@ -89,20 +89,23 @@ class LoginVC: UIViewController localStorage["pass"] = pass.sha256 localStorage["id"] = $0 - a.dismiss + ui { - // Send feedback - 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 - ui { AccountViewController.this.login() } + a.dismiss + { + // Send feedback + 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() + } } } err: { print($0) - a.dismiss { self.msg("An error occurred", "Maybe the server is on fire, just wait a few hours.") } + ui { a.dismiss { self.msg("An error occurred", "Maybe the server is on fire, just wait a few hours.") } } } }