This repository was archived by the owner on Jan 15, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #152 from d4rken/dev
v0.8.0 release.
- Loading branch information
Showing
64 changed files
with
1,467 additions
and
481 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
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
35 changes: 35 additions & 0 deletions
35
app/src/main/java/subreddit/android/appstore/backend/HttpModule.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,35 @@ | ||
package subreddit.android.appstore.backend; | ||
|
||
import com.google.gson.Gson; | ||
import com.google.gson.GsonBuilder; | ||
|
||
import dagger.Module; | ||
import dagger.Provides; | ||
import okhttp3.OkHttpClient; | ||
import okhttp3.logging.HttpLoggingInterceptor; | ||
import subreddit.android.appstore.BuildConfig; | ||
import subreddit.android.appstore.util.dagger.ApplicationScope; | ||
|
||
@Module | ||
public class HttpModule { | ||
|
||
@Provides | ||
@ApplicationScope | ||
Gson provideGson() { | ||
return new GsonBuilder().create(); | ||
} | ||
|
||
@Provides | ||
@ApplicationScope | ||
OkHttpClient provideOkHttpClient(UserAgentInterceptor userAgent) { | ||
OkHttpClient.Builder builder = new OkHttpClient.Builder(); | ||
if (BuildConfig.DEBUG) { | ||
HttpLoggingInterceptor interceptor = new HttpLoggingInterceptor(); | ||
interceptor.setLevel(HttpLoggingInterceptor.Level.BODY); | ||
builder.addInterceptor(interceptor); | ||
} | ||
builder.addInterceptor(userAgent); | ||
return builder.build(); | ||
} | ||
|
||
} |
Oops, something went wrong.