From 18abe55c4905dbc0df13393e5977dcfda2508a82 Mon Sep 17 00:00:00 2001 From: Blacky <106263486+Black-Fox-2022@users.noreply.github.com> Date: Thu, 23 May 2024 09:31:08 +0200 Subject: [PATCH] Add FunctionCall to finish Loading Fix #174 --- Services/OrgService.swift | 4 +++- Shared/Navigational Structure/LeftSidebarView.swift | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/Services/OrgService.swift b/Services/OrgService.swift index 87d8e83..b904ca3 100644 --- a/Services/OrgService.swift +++ b/Services/OrgService.swift @@ -22,6 +22,9 @@ class OrgService: ObservableObject { self.errorService = errors } + // Wasn't getting called before -> Never leaving loading state. + // For now called when retrieveOrganisations also called + // Maybe move getCode into the retrieve Func? func getOrganisation() { let locallyCachedOrganization = retrieveFromDisk() self.organization = locallyCachedOrganization @@ -33,7 +36,6 @@ class OrgService: ObservableObject { let org = try await self.retrieveOrganisation() DispatchQueue.main.async { self.organization = org - self.loadingState = .finished(Date()) } } catch { diff --git a/Shared/Navigational Structure/LeftSidebarView.swift b/Shared/Navigational Structure/LeftSidebarView.swift index 4859153..76cec7c 100644 --- a/Shared/Navigational Structure/LeftSidebarView.swift +++ b/Shared/Navigational Structure/LeftSidebarView.swift @@ -125,6 +125,7 @@ struct LeftSidebarView: View { if let organization = try? await orgService.retrieveOrganisation() { DispatchQueue.main.async { orgService.organization = organization + orgService.getOrganisation() } } }