mirror of
https://github.com/yattee/yattee.git
synced 2024-12-23 14:03:41 +00:00
Refresh views on entering foreground
This commit is contained in:
parent
9600fc88be
commit
e71cce9b97
@ -49,6 +49,7 @@ struct FavoritesView: View {
|
|||||||
}
|
}
|
||||||
.tieToLifetime(of: accounts)
|
.tieToLifetime(of: accounts)
|
||||||
}
|
}
|
||||||
|
|
||||||
.redrawOn(change: favoritesChanged)
|
.redrawOn(change: favoritesChanged)
|
||||||
|
|
||||||
#if os(tvOS)
|
#if os(tvOS)
|
||||||
@ -64,6 +65,11 @@ struct FavoritesView: View {
|
|||||||
#if os(iOS)
|
#if os(iOS)
|
||||||
.navigationBarTitleDisplayMode(RefreshControl.navigationBarTitleDisplayMode)
|
.navigationBarTitleDisplayMode(RefreshControl.navigationBarTitleDisplayMode)
|
||||||
#endif
|
#endif
|
||||||
|
#if !os(macOS)
|
||||||
|
.onReceive(NotificationCenter.default.publisher(for: UIApplication.willEnterForegroundNotification)) { _ in
|
||||||
|
favoritesChanged.toggle()
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -158,6 +158,12 @@ struct PlaylistsView: View {
|
|||||||
#if os(iOS)
|
#if os(iOS)
|
||||||
.navigationBarTitleDisplayMode(RefreshControl.navigationBarTitleDisplayMode)
|
.navigationBarTitleDisplayMode(RefreshControl.navigationBarTitleDisplayMode)
|
||||||
#endif
|
#endif
|
||||||
|
#if !os(macOS)
|
||||||
|
.onReceive(NotificationCenter.default.publisher(for: UIApplication.willEnterForegroundNotification)) { _ in
|
||||||
|
model.load()
|
||||||
|
resource?.loadIfNeeded()
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#if os(tvOS)
|
#if os(tvOS)
|
||||||
|
@ -140,6 +140,11 @@ struct TrendingView: View {
|
|||||||
}
|
}
|
||||||
.navigationBarTitleDisplayMode(RefreshControl.navigationBarTitleDisplayMode)
|
.navigationBarTitleDisplayMode(RefreshControl.navigationBarTitleDisplayMode)
|
||||||
#endif
|
#endif
|
||||||
|
#if !os(macOS)
|
||||||
|
.onReceive(NotificationCenter.default.publisher(for: UIApplication.willEnterForegroundNotification)) { _ in
|
||||||
|
resource.loadIfNeeded()
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#if os(tvOS)
|
#if os(tvOS)
|
||||||
|
@ -47,5 +47,10 @@ struct PopularView: View {
|
|||||||
}
|
}
|
||||||
.navigationBarTitleDisplayMode(RefreshControl.navigationBarTitleDisplayMode)
|
.navigationBarTitleDisplayMode(RefreshControl.navigationBarTitleDisplayMode)
|
||||||
#endif
|
#endif
|
||||||
|
#if !os(macOS)
|
||||||
|
.onReceive(NotificationCenter.default.publisher(for: UIApplication.willEnterForegroundNotification)) { _ in
|
||||||
|
resource?.loadIfNeeded()
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -50,6 +50,11 @@ struct SubscriptionsView: View {
|
|||||||
#if os(iOS)
|
#if os(iOS)
|
||||||
.navigationBarTitleDisplayMode(RefreshControl.navigationBarTitleDisplayMode)
|
.navigationBarTitleDisplayMode(RefreshControl.navigationBarTitleDisplayMode)
|
||||||
#endif
|
#endif
|
||||||
|
#if !os(macOS)
|
||||||
|
.onReceive(NotificationCenter.default.publisher(for: UIApplication.willEnterForegroundNotification)) { _ in
|
||||||
|
loadResources()
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
private func loadResources(force: Bool = false, onCompletion: @escaping () -> Void = {}) {
|
private func loadResources(force: Bool = false, onCompletion: @escaping () -> Void = {}) {
|
||||||
|
Loading…
Reference in New Issue
Block a user