mirror of
https://github.com/Dimillian/IceCubesApp.git
synced 2024-11-22 08:20:59 +00:00
Refresh notifications list on resume from background
This commit is contained in:
parent
70f60ee977
commit
8768f28073
1 changed files with 11 additions and 0 deletions
|
@ -6,6 +6,7 @@ import DesignSystem
|
|||
import Env
|
||||
|
||||
public struct NotificationsListView: View {
|
||||
@Environment(\.scenePhase) private var scenePhase
|
||||
@EnvironmentObject private var theme: Theme
|
||||
@EnvironmentObject private var watcher: StreamWatcher
|
||||
@EnvironmentObject private var client: Client
|
||||
|
@ -59,6 +60,16 @@ public struct NotificationsListView: View {
|
|||
viewModel.handleEvent(event: latestEvent)
|
||||
}
|
||||
})
|
||||
.onChange(of: scenePhase, perform: { scenePhase in
|
||||
switch scenePhase {
|
||||
case .active:
|
||||
Task {
|
||||
await viewModel.fetchNotifications()
|
||||
}
|
||||
default:
|
||||
break
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
@ViewBuilder
|
||||
|
|
Loading…
Reference in a new issue