-
Notifications
You must be signed in to change notification settings - Fork 206
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
OkHttp 3.1.0, Retrofit 2.0.0-beta4, Stetho 1.3.0
- Loading branch information
1 parent
df3cf02
commit 1c973e6
Showing
23 changed files
with
179 additions
and
97 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
app/src/debug/java/com/artemzin/qualitymatters/network/OkHttpInterceptorsModule.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package com.artemzin.qualitymatters.network; | ||
|
||
import android.support.annotation.NonNull; | ||
|
||
import com.facebook.stetho.okhttp3.StethoInterceptor; | ||
|
||
import java.util.List; | ||
|
||
import javax.inject.Named; | ||
import javax.inject.Singleton; | ||
|
||
import dagger.Module; | ||
import dagger.Provides; | ||
import okhttp3.Interceptor; | ||
import okhttp3.logging.HttpLoggingInterceptor; | ||
import timber.log.Timber; | ||
|
||
import static com.artemzin.qualitymatters.network.NetworkModule.LIST_OF_OK_HTTP_INTERCEPTORS; | ||
import static com.artemzin.qualitymatters.network.NetworkModule.LIST_OF_OK_HTTP_NETWORK_INTERCEPTORS; | ||
import static java.util.Collections.singletonList; | ||
|
||
/** | ||
* Provides OkHttp interceptors for debug build. | ||
*/ | ||
@Module | ||
public class OkHttpInterceptorsModule { | ||
|
||
// Provided as separate dependency for Developer Settings to be able to change HTTP log level at runtime. | ||
@Provides @Singleton @NonNull | ||
public HttpLoggingInterceptor provideHttpLoggingInterceptor() { | ||
return new HttpLoggingInterceptor(message -> Timber.d(message)); | ||
} | ||
|
||
@Provides @Named(LIST_OF_OK_HTTP_INTERCEPTORS) @Singleton @NonNull | ||
public List<Interceptor> provideOkHttpInterceptors(@NonNull HttpLoggingInterceptor httpLoggingInterceptor) { | ||
return singletonList(httpLoggingInterceptor); | ||
} | ||
|
||
@Provides @Named(LIST_OF_OK_HTTP_NETWORK_INTERCEPTORS) @Singleton @NonNull | ||
public List<Interceptor> provideOkHttpNetworkInterceptors() { | ||
return singletonList(new StethoInterceptor()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.