@@ -48,6 +48,8 @@ public struct ArticlesListFeature: Reducer, Sendable {
4848
4949 public var scrollToTop : Bool = false
5050
51+ var didLoadOnce = false
52+
5153 public init (
5254 destination: Destination . State ? = nil ,
5355 appSettings: AppSettings = . default,
@@ -88,6 +90,7 @@ public struct ArticlesListFeature: Reducer, Sendable {
8890
8991 @Dependency ( \. apiClient) private var apiClient
9092 @Dependency ( \. cacheClient) private var cacheClient
93+ @Dependency ( \. analyticsClient) private var analyticsClient
9194 @Dependency ( \. pasteboardClient) private var pasteboardClient
9295 @Dependency ( \. hapticClient) private var hapticClient
9396 @Dependency ( \. continuousClock) private var clock
@@ -168,16 +171,24 @@ public struct ArticlesListFeature: Reducer, Sendable {
168171 }
169172 state. offset += state. loadAmount
170173 state. isLoading = false
174+ reportFullyDisplayed ( & state)
171175 return . none
172176
173177 case . _articlesResponse( . failure) :
174178 state. isLoading = false
175179 state. destination = . alert( . failedToConnect)
180+ reportFullyDisplayed ( & state)
176181 return . none
177182 }
178183 }
179184 . ifLet ( \. $destination, action: \. destination)
180185
181186 Analytics ( )
182187 }
188+
189+ private func reportFullyDisplayed( _ state: inout State ) {
190+ guard !state. didLoadOnce else { return }
191+ analyticsClient. reportFullyDisplayed ( )
192+ state. didLoadOnce = true
193+ }
183194}
0 commit comments