Remove some Env Object from NotificationRowView

This commit is contained in:
Thomas Ricouard 2023-02-15 09:04:35 +01:00
parent d958d10036
commit f544d65862
2 changed files with 5 additions and 10 deletions

View file

@ -7,13 +7,13 @@ import SwiftUI
import Network
struct NotificationRowView: View {
@EnvironmentObject private var client: Client
@EnvironmentObject private var currentAccount: CurrentAccount
@EnvironmentObject private var theme: Theme
@EnvironmentObject private var routerPath: RouterPath
@Environment(\.redactionReasons) private var reasons
let notification: ConsolidatedNotification
let client: Client
let routerPath: RouterPath
var body: some View {
HStack(alignment: .top, spacing: 8) {
@ -178,9 +178,3 @@ struct NotificationRowView: View {
}
}
}
struct NotificationRowView_Previews: PreviewProvider {
static var previews: some View {
NotificationRowView(notification: .placeholder())
}
}

View file

@ -10,6 +10,7 @@ public struct NotificationsListView: View {
@EnvironmentObject private var theme: Theme
@EnvironmentObject private var watcher: StreamWatcher
@EnvironmentObject private var client: Client
@EnvironmentObject private var routerPath: RouterPath
@EnvironmentObject private var account: CurrentAccount
@StateObject private var viewModel = NotificationsViewModel()
@ -83,7 +84,7 @@ public struct NotificationsListView: View {
switch viewModel.state {
case .loading:
ForEach(ConsolidatedNotification.placeholders()) { notification in
NotificationRowView(notification: notification)
NotificationRowView(notification: notification, client: client, routerPath: routerPath)
.redacted(reason: .placeholder)
.listRowInsets(.init(top: 12,
leading: .layoutPadding + 4,
@ -102,7 +103,7 @@ public struct NotificationsListView: View {
.listSectionSeparator(.hidden)
} else {
ForEach(notifications) { notification in
NotificationRowView(notification: notification)
NotificationRowView(notification: notification, client: client, routerPath: routerPath)
.listRowInsets(.init(top: 12,
leading: .layoutPadding + 4,
bottom: 12,