File tree Expand file tree Collapse file tree
Application/DevLogInfra/Sources Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -61,6 +61,10 @@ public final class InfraAssembler: Assembler {
6161 UserServiceImpl ( )
6262 }
6363
64+ container. register ( ProfileImageDataService . self) {
65+ ProfileImageDataServiceImpl ( )
66+ }
67+
6468 container. register ( PushNotificationService . self) {
6569 PushNotificationServiceImpl ( )
6670 }
Original file line number Diff line number Diff line change 1+ //
2+ // ProfileImageDataServiceImpl.swift
3+ // DevLogInfra
4+ //
5+ // Created by opfic on 6/11/26.
6+ //
7+
8+ import Foundation
9+ import Nexa
10+ import DevLogData
11+
12+ final class ProfileImageDataServiceImpl : ProfileImageDataService {
13+ func fetchImageData( from url: URL ) async throws -> Data {
14+ try await NXAPIClient (
15+ configuration: NXClientConfiguration ( baseURL: url)
16+ )
17+ . get ( url. absoluteString)
18+ . timeout ( 10 )
19+ . intercept ( ProfileImageDataCachePolicyInterceptor ( ) )
20+ . validate ( . successStatusCode)
21+ . raw ( )
22+ . data
23+ }
24+ }
25+
26+ private struct ProfileImageDataCachePolicyInterceptor : NXHTTPInterceptor {
27+ func intercept(
28+ context: NXRequestExecutionContext ,
29+ next: @escaping @Sendable ( NXRequestExecutionContext) async throws -> NXRawResponse
30+ ) async throws -> NXRawResponse {
31+ var request = context. request
32+ request. cachePolicy = . reloadIgnoringLocalCacheData
33+ return try await next ( context. replacingRequest ( request) )
34+ }
35+ }
You can’t perform that action at this time.
0 commit comments