New spinner dont block while making network requests if there is local data

This commit is contained in:
Jackson Harper
2024-07-11 17:16:48 +08:00
parent 3d791a7866
commit 7ab328f5ce
3 changed files with 37 additions and 18 deletions

View File

@ -32,8 +32,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/nathantannar4/Engine",
"state" : {
"revision" : "0d2d5647921473be4aac40cb70ad13900f56ed2b",
"version" : "1.8.1"
"revision" : "391d0da0282f51327b5d2c0e5de64f75e59cbae7",
"version" : "1.8.3"
}
},
{
@ -239,8 +239,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/nathantannar4/Transmission",
"state" : {
"revision" : "6b3e6b46f34d0d18715d27c46e0053f1eda1bcd1",
"version" : "1.3.1"
"revision" : "9cbf1f6fec330e25c615182f3de483b129576819",
"version" : "1.3.2"
}
},
{

View File

@ -71,9 +71,7 @@ var dependencies: [Package.Dependency] {
.package(url: "https://github.com/google/GoogleSignIn-iOS", from: "6.2.2"),
.package(url: "https://github.com/gonzalezreal/swift-markdown-ui", from: "2.0.0"),
.package(url: "https://github.com/PostHog/posthog-ios.git", from: "2.0.0"),
// .package(url: "https://github.com/nathantannar4/Engine", exact: "1.0.1"),
// .package(url: "https://github.com/nathantannar4/Turbocharger", exact: "1.1.4"),
.package(url: "https://github.com/nathantannar4/Transmission", exact: "1.3.1")
.package(url: "https://github.com/nathantannar4/Transmission", exact: "1.3.2")
]
// Comment out following line for macOS build
deps.append(.package(url: "https://github.com/PSPDFKit/PSPDFKit-SP", from: "13.7.0"))

View File

@ -546,7 +546,6 @@ struct AnimatingCellHeight: AnimatableModifier {
if presentingItem.isPDF {
PDFContainerView(item: presentingItem)
} else {
let too = print("$viewModel.linkIsActive", viewModel.linkIsActive)
WebReaderContainerView(item: presentingItem)
}
} else {
@ -804,9 +803,39 @@ struct AnimatingCellHeight: AnimatableModifier {
}
}
@State private var isAnimating = false
var progress: some View {
GeometryReader { geometry in
VStack {
Spacer()
Rectangle()
.fill(Color.yellow)
.frame(height: 2)
.offset(x: self.isAnimating ? geometry.size.width - 40 : 0)
.frame(width: self.isAnimating ? geometry.size.width : 40)
.animation(Animation.linear(duration: 2).repeatForever(autoreverses: true))
Spacer()
}
.onAppear {
self.isAnimating = true
}
}
.background(Color.white)
.edgesIgnoringSafeArea(.all)
}
var body: some View {
VStack(spacing: 0) {
Color.systemBackground.frame(height: 1)
if viewModel.showLoadingBar == .simple {
progress
.frame(height: 2)
.frame(maxWidth: .infinity)
.listRowSeparator(.hidden, edges: .all)
.listRowInsets(.init(top: 0, leading: 0, bottom: 0, trailing: 0))
} else {
Color.systemBackground.frame(height: 2)
}
ScrollViewReader { reader in
List(selection: $selection) {
Section(content: {
@ -843,15 +872,7 @@ struct AnimatingCellHeight: AnimatableModifier {
}
}
if viewModel.showLoadingBar == .redacted || viewModel.showLoadingBar == .simple {
VStack {
ProgressView()
}
.frame(minHeight: 400)
.frame(maxWidth: .infinity)
.padding()
.listRowSeparator(.hidden, edges: .all)
} else if viewModel.isEmptyingTrash {
if viewModel.isEmptyingTrash {
VStack {
Text("Emptying trash")
ProgressView()