From 8eb12b7bdc23a5424efbdd373bc1a1eb70c49a1b Mon Sep 17 00:00:00 2001 From: Ryan Zhao Date: Thu, 24 Aug 2023 13:35:23 +1000 Subject: [PATCH] remove loading screen in navigation stack when display name screen shows --- Session/Onboarding/LoadingView.swift | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Session/Onboarding/LoadingView.swift b/Session/Onboarding/LoadingView.swift index 62d0743df..3e4a52015 100644 --- a/Session/Onboarding/LoadingView.swift +++ b/Session/Onboarding/LoadingView.swift @@ -79,7 +79,9 @@ struct LoadingView: View { .receive(on: DispatchQueue.main) .sinkUntilComplete( receiveValue: { displayName in - finishLoading(success: true) + if displayName?.isEmpty == false { + finishLoading(success: true) + } } ) } @@ -88,7 +90,11 @@ struct LoadingView: View { guard success else { let viewController: SessionHostingViewController = SessionHostingViewController(rootView: DisplayNameView(flow: flow)) viewController.setUpNavBarSessionIcon() - self.host.controller?.navigationController?.pushViewController(viewController, animated: true) + if let navigationController = self.host.controller?.navigationController { + let index = navigationController.viewControllers.count - 1 + navigationController.pushViewController(viewController, animated: true) + navigationController.viewControllers.remove(at: index) + } return } self.animationTimer?.invalidate()