Add refresh buttons keyboard shortcuts

This commit is contained in:
Arkadiusz Fal 2022-01-07 00:00:40 +01:00
parent 3495ecf693
commit 9304bf6158
3 changed files with 22 additions and 0 deletions

View File

@ -122,6 +122,12 @@ struct TrendingView: View {
.frame(minWidth: 400, minHeight: 400)
#endif
}
.background(
Button("Refresh") {
resource.load()
}
.keyboardShortcut("r")
)
.navigationTitle("Trending")
#endif
#if os(iOS)

View File

@ -30,6 +30,14 @@ struct PopularView: View {
FavoriteButton(item: FavoriteItem(section: .popular))
}
}
#if !os(tvOS)
.background(
Button("Refresh") {
resource?.load()
}
.keyboardShortcut("r")
)
#endif
#if os(iOS)
.refreshControl { refreshControl in
resource?.load().onCompletion { _ in

View File

@ -38,6 +38,14 @@ struct SubscriptionsView: View {
FavoriteButton(item: FavoriteItem(section: .subscriptions))
}
}
#if !os(tvOS)
.background(
Button("Refresh") {
loadResources(force: true)
}
.keyboardShortcut("r")
)
#endif
#if os(iOS)
.navigationBarTitleDisplayMode(RefreshControl.navigationBarTitleDisplayMode)
#endif