You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Provides a configured Retrofit instance for making network requests.
13
+
*
14
+
* This function sets up a Retrofit client with the following features:
15
+
* - **Base URL:** Uses the [BASE_URL] constant as the base URL for all requests. Ensure this constant is defined in your project.
16
+
* - **OkHttpClient:** Uses an OkHttpClient to handle the network communication, configured with:
17
+
* - **Logging Interceptor:** An [HttpLoggingInterceptor] that logs the request and response bodies at the `BODY` level, aiding in debugging. **Note:** This should be removed or adjusted for production builds.
18
+
* - **Gson Converter Factory:** Uses a [GsonConverterFactory] to serialize and deserialize JSON responses using the Gson library. The Gson instance is configured to be lenient, allowing for some flexibility in the expected JSON structure.
19
+
*
20
+
* @return A configured [Retrofit] instance ready for creating API interfaces.
21
+
*/
11
22
funprovideRetrofit(): Retrofit {
12
23
val loggingInterceptor =HttpLoggingInterceptor().apply {
13
24
level =HttpLoggingInterceptor.Level.BODY
14
25
}
15
26
val okHttpClient =OkHttpClient.Builder().addInterceptor(loggingInterceptor).build()
* The main screen of the application, displaying a list of users and a search bar.
23
+
*
24
+
* @param onUserClicked Callback function invoked when a user item in the list is clicked. It takes a [User] object as a parameter representing the clicked user.
25
+
* @param mainViewModel The [MainViewModel] instance used to manage the data and state for the screen, defaults to an instance retrieved from Koin.
0 commit comments