From 248fcbbd5dca84747e6f3fd9d1d52c41ab8640c3 Mon Sep 17 00:00:00 2001 From: Dustin Mierau Date: Tue, 12 Dec 2023 15:27:00 -0800 Subject: New category listing is working again. Added optionset for user access info. Some UI cleanup across the board. --- Hotline/Views/FilesView.swift | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) (limited to 'Hotline/Views/FilesView.swift') diff --git a/Hotline/Views/FilesView.swift b/Hotline/Views/FilesView.swift index 23b19b1..5cbf0c9 100644 --- a/Hotline/Views/FilesView.swift +++ b/Hotline/Views/FilesView.swift @@ -27,6 +27,10 @@ struct FileView: View { } } .onChange(of: expanded) { + if !expanded { + return + } + Task { await model.getFileList(path: file.path) } @@ -85,7 +89,7 @@ struct FileView: View { struct FilesView: View { @Environment(Hotline.self) private var model: Hotline - @State var initialLoad = false + @State var initialLoadComplete = false var body: some View { NavigationStack { @@ -94,9 +98,18 @@ struct FilesView: View { .frame(height: 44) } .task { - if !initialLoad { + if !initialLoadComplete { let _ = await model.getFileList() - initialLoad = true + initialLoadComplete = true + } + } + .overlay { + if !initialLoadComplete { + VStack { + ProgressView() + .controlSize(.large) + } + .frame(maxWidth: .infinity) } } .listStyle(.plain) -- cgit