Skip to content

Commit 26c576e

Browse files
committed
proper env
1 parent c667517 commit 26c576e

File tree

3 files changed

+26
-3
lines changed

3 files changed

+26
-3
lines changed

App/IcySkyApp.swift

+2
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ struct IcySkyApp: App {
2121
@State var currentUser: CurrentUser?
2222
@State var router: Router = .init()
2323
@State var isLoadingInitialSession: Bool = true
24+
@State var postDataControllerProvider: PostDataControllerProvider = .init()
2425

2526
init() {
2627
ImagePipeline.shared = ImagePipeline(configuration: .withDataCache)
@@ -44,6 +45,7 @@ struct IcySkyApp: App {
4445
.environment(currentUser)
4546
.environment(auth)
4647
.environment(router)
48+
.environment(postDataControllerProvider)
4749
.modelContainer(for: RecentFeedItem.self)
4850
.sheet(
4951
item: $router.presentedSheet,

Packages/Features/Sources/NotificationsUI/Rows/SingleNotificationRow.swift

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
import ATProtoKit
22
import Models
3+
import Network
34
import PostUI
45
import Router
56
import SwiftUI
6-
import Network
77

88
struct SingleNotificationRow: View {
99
@Environment(Router.self) var router
1010
@Environment(BSkyClient.self) var client
11+
@Environment(PostDataControllerProvider.self) var postDataControllerProvider
1112

1213
let notification: AppBskyLexicon.Notification.Notification
1314
let postItem: PostItem?
@@ -56,7 +57,7 @@ struct SingleNotificationRow: View {
5657
.onTapGesture {
5758
router.navigateTo(RouterDestination.post(postItem))
5859
}
59-
.environment(PostDataController(post: postItem, client: client))
60+
.environment(postDataControllerProvider.getController(for: postItem, client: client))
6061
}
6162
}
6263

Packages/Features/Sources/PostUI/Row/PostRowView.swift

+21-1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ public struct PostRowView: View {
1515
@Environment(\.isFocused) var isFocused
1616
@Environment(\.sizeCategory) var sizeCategory
1717

18+
@Environment(PostDataControllerProvider.self) var postDataControllerProvider
1819
@Environment(Router.self) var router
1920
@Environment(BSkyClient.self) var client
2021

@@ -35,7 +36,7 @@ public struct PostRowView: View {
3536
mainView
3637
.padding(.bottom, 18)
3738
}
38-
.environment(PostDataController(post: post, client: client))
39+
.environment(postDataControllerProvider.getController(for: post, client: client))
3940
.listRowSeparator(.hidden)
4041
.listRowInsets(.init(top: 0, leading: 18, bottom: 0, trailing: 18))
4142
}
@@ -186,5 +187,24 @@ public struct PostRowView: View {
186187
}
187188
.listStyle(.plain)
188189
.environment(Router())
190+
.environment(PostDataControllerProvider())
191+
.environment(
192+
BSkyClient(
193+
session: .init(
194+
handle: "",
195+
sessionDID: "",
196+
email: nil,
197+
isEmailConfirmed: nil,
198+
isEmailAuthenticationFactorEnabled: nil,
199+
accessToken: "",
200+
refreshToken: "",
201+
didDocument: nil,
202+
isActive: nil,
203+
status: nil,
204+
pdsURL: nil,
205+
logger: nil
206+
)
207+
)
208+
)
189209
}
190210
}

0 commit comments

Comments
 (0)