From 0ad6defca4a25fcc0b9d1e89c06063efe4503e02 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Laurent=20Tr=C3=A9guier?= Date: Thu, 12 Sep 2024 23:45:05 +0200 Subject: [PATCH] Try to better handle deep links --- .../Views/Navigation/NavigationProtocol.swift | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/Fyreplace/Views/Navigation/NavigationProtocol.swift b/Fyreplace/Views/Navigation/NavigationProtocol.swift index 5a30b56..fb1244f 100644 --- a/Fyreplace/Views/Navigation/NavigationProtocol.swift +++ b/Fyreplace/Views/Navigation/NavigationProtocol.swift @@ -11,19 +11,19 @@ extension NavigationProtocol { func handle(url: URL) { switch url.path().trimmingPrefix("/") { case "login", "register": - attemptAuthentication(with: url.fragment() ?? "") + Task { + await attemptAuthentication(with: url.fragment() ?? "") + } default: break } } - func attemptAuthentication(with randomCode: String) { + private func attemptAuthentication(with randomCode: String) async { + try? await Task.sleep(for: .seconds(0.3)) navigateToSettings() - - Task { - try? await Task.sleep(for: .seconds(0.5)) - eventBus.send(.randomCode(randomCode)) - } + try? await Task.sleep(for: .seconds(0.3)) + eventBus.send(.randomCode(randomCode)) } }