mirror of
https://github.com/writeas/writefreely-swiftui-multiplatform.git
synced 2024-11-15 01:11:02 +00:00
Merge pull request #150 from writeas/show-progressview-during-network-request
Show ProgressView during network request
This commit is contained in:
commit
1397009a8a
@ -51,7 +51,34 @@ struct ContentView: View {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if os(macOS)
|
#if os(macOS)
|
||||||
PostListView(selectedCollection: model.selectedCollection, showAllPosts: model.showAllPosts)
|
ZStack {
|
||||||
|
PostListView(selectedCollection: nil, showAllPosts: model.account.isLoggedIn)
|
||||||
|
.toolbar {
|
||||||
|
ToolbarItemGroup(placement: .primaryAction) {
|
||||||
|
if let selectedPost = model.selectedPost {
|
||||||
|
ActivePostToolbarView(activePost: selectedPost)
|
||||||
|
.alert(isPresented: $model.isPresentingNetworkErrorAlert, content: {
|
||||||
|
Alert(
|
||||||
|
title: Text("Connection Error"),
|
||||||
|
message: Text("""
|
||||||
|
There is no internet connection at the moment. \
|
||||||
|
Please reconnect or try again later.
|
||||||
|
"""),
|
||||||
|
dismissButton: .default(Text("OK"), action: {
|
||||||
|
model.isPresentingNetworkErrorAlert = false
|
||||||
|
})
|
||||||
|
)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if model.isProcessingRequest {
|
||||||
|
ZStack {
|
||||||
|
Color(NSColor.controlBackgroundColor).opacity(0.75)
|
||||||
|
ProgressView()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
#else
|
#else
|
||||||
PostListView(selectedCollection: nil, showAllPosts: model.account.isLoggedIn)
|
PostListView(selectedCollection: nil, showAllPosts: model.account.isLoggedIn)
|
||||||
#endif
|
#endif
|
||||||
|
@ -1,6 +1,21 @@
|
|||||||
import SwiftUI
|
import SwiftUI
|
||||||
|
|
||||||
@main
|
@main
|
||||||
|
struct CheckForDebugModifier {
|
||||||
|
static func main() {
|
||||||
|
#if os(macOS)
|
||||||
|
if NSEvent.modifierFlags.contains(.shift) {
|
||||||
|
print("Debug launch detected")
|
||||||
|
// Run debug-mode launch code here
|
||||||
|
} else {
|
||||||
|
print("Normal launch detected")
|
||||||
|
// Don't do anything
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
WriteFreely_MultiPlatformApp.main()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
struct WriteFreely_MultiPlatformApp: App {
|
struct WriteFreely_MultiPlatformApp: App {
|
||||||
@StateObject private var model = WriteFreelyModel()
|
@StateObject private var model = WriteFreelyModel()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user