mirror of
https://github.com/yattee/yattee.git
synced 2025-08-05 02:04:07 +00:00
Pull to refresh fixes, added alert for playlist error
This commit is contained in:
@@ -129,6 +129,21 @@ struct PlaylistsView: View {
|
||||
.onChange(of: model.reloadPlaylists) { _ in
|
||||
resource?.load()
|
||||
}
|
||||
#if os(iOS)
|
||||
.refreshControl { refreshControl in
|
||||
model.load(force: true) {
|
||||
model.reloadPlaylists.toggle()
|
||||
refreshControl.endRefreshing()
|
||||
}
|
||||
}
|
||||
.backport
|
||||
.refreshable {
|
||||
DispatchQueue.main.async {
|
||||
model.load(force: true) { model.reloadPlaylists.toggle() }
|
||||
}
|
||||
}
|
||||
.navigationBarTitleDisplayMode(RefreshControl.navigationBarTitleDisplayMode)
|
||||
#endif
|
||||
#if os(tvOS)
|
||||
.fullScreenCover(isPresented: $showingNewPlaylist, onDismiss: selectCreatedPlaylist) {
|
||||
PlaylistFormView(playlist: $createdPlaylist)
|
||||
@@ -155,15 +170,22 @@ struct PlaylistsView: View {
|
||||
}
|
||||
)
|
||||
#endif
|
||||
#if os(iOS)
|
||||
.navigationBarTitleDisplayMode(RefreshControl.navigationBarTitleDisplayMode)
|
||||
#endif
|
||||
|
||||
#if !os(macOS)
|
||||
.onReceive(NotificationCenter.default.publisher(for: UIApplication.willEnterForegroundNotification)) { _ in
|
||||
model.load()
|
||||
resource?.loadIfNeeded()
|
||||
}
|
||||
#endif
|
||||
#if !os(tvOS)
|
||||
.background(
|
||||
Button("Refresh") {
|
||||
resource?.load()
|
||||
}
|
||||
.keyboardShortcut("r")
|
||||
.opacity(0)
|
||||
)
|
||||
#endif
|
||||
}
|
||||
|
||||
#if os(tvOS)
|
||||
|
Reference in New Issue
Block a user