Add toolbar button logic, menu item, keyboard shortcut for server reload

This commit is contained in:
Angelo Stavrow 2020-11-25 15:10:22 -05:00
parent 735867a940
commit acde0c8978
No known key found for this signature in database
GPG Key ID: 1A49C7064E060EEE
2 changed files with 15 additions and 1 deletions

View File

@ -54,7 +54,12 @@ struct ContentView: View {
PostListView(selectedCollection: nil, showAllPosts: model.account.isLoggedIn)
.toolbar {
ToolbarItem(placement: .navigation) {
Button(action: {}, label: { Image(systemName: "arrow.clockwise") })
Button(action: {
DispatchQueue.main.async {
model.fetchUserCollections()
model.fetchUserPosts()
}
}, label: { Image(systemName: "arrow.clockwise") })
.padding(.leading, sidebarIsHidden ? 8 : 0)
.animation(.linear)
}

View File

@ -30,6 +30,15 @@ struct WriteFreely_MultiPlatformApp: App {
}
.keyboardShortcut("n", modifiers: [.command])
})
CommandGroup(after: .newItem) {
Button("Reload From Server") {
DispatchQueue.main.async {
model.fetchUserCollections()
model.fetchUserPosts()
}
}
.keyboardShortcut("r", modifiers: [.command])
}
#if os(macOS)
CommandGroup(after: .sidebar) {
Button("Toggle Sidebar") {