Closed connected-rkingsmill closed 4 years ago
For your consideration :)
Requirement: reduce amount of network calls made to fetch avatar images. The URL to the avatar image changes when a new avatar image is uploaded.
private func downloadAvatar(_ url: URL)
can be a part of the GuardianAPI.accountInfo(...)
call instead of being done ad-hoc herereturnCacheDataElseLoad
so that iOS will always check local cache first before making a new network call. In you code change, you essentially created your own cache of the avatar url.
Prevent multiple calls to mozillausercontent.com by only getting avatar image when the user's url changes