May 2022
Intermediate to advanced
688 pages
20h 12m
English
PhotoRepository provides a layer of abstraction over the source of Flickr photo metadata. Other components (such as PhotoGalleryFragment) use this abstraction to fetch Flickr data without worrying about where the data is coming from.
PhotoRepository itself does not know how to download JSON data from Flickr. Instead, PhotoRepository relies on FlickrApi to know the endpoint URL, to connect to that endpoint, and to perform the actual work of downloading the JSON data. PhotoRepository is said to have a dependency on FlickrApi.
You are initializing FlickrApi inside the PhotoRepository init block:
class PhotoRepository { ... init { val retrofit: Retrofit = Retrofit.Builder() .baseUrl("https://api.flickr.com/") ...Read now
Unlock full access