diff options
Diffstat (limited to '')
-rw-r--r-- | app/build.gradle | 4 | ||||
-rw-r--r-- | app/src/main/java/ml/docilealligator/infinityforreddit/AppModule.java | 1 | ||||
-rw-r--r-- | app/src/main/java/ml/docilealligator/infinityforreddit/Okhttp3DebugInterceptor.java | 40 | ||||
-rw-r--r-- | build.gradle | 2 |
4 files changed, 44 insertions, 3 deletions
diff --git a/app/build.gradle b/app/build.gradle index b474a42c..212de403 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -34,7 +34,7 @@ repositories { dependencies { implementation fileTree(include: ['*.jar'], dir: 'libs') implementation 'androidx.appcompat:appcompat:1.1.0' - implementation 'com.google.android.material:material:1.1.0-alpha10' + implementation 'com.google.android.material:material:1.2.0-alpha05' implementation 'androidx.constraintlayout:constraintlayout:1.1.3' implementation 'androidx.legacy:legacy-support-v4:1.0.0' implementation 'androidx.legacy:legacy-support-v13:1.0.0' @@ -79,7 +79,7 @@ dependencies { implementation 'com.github.livefront:bridge:v1.2.0' implementation 'com.evernote:android-state:1.4.1' annotationProcessor 'com.evernote:android-state-processor:1.4.1' - implementation 'androidx.work:work-runtime:2.3.0' + implementation 'androidx.work:work-runtime:2.3.2' implementation 'androidx.preference:preference:1.1.0' implementation 'com.nex3z:flow-layout:1.3.0' implementation 'com.r0adkll:slidableactivity:2.1.0' diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/AppModule.java b/app/src/main/java/ml/docilealligator/infinityforreddit/AppModule.java index a3792492..8bdf0d5d 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/AppModule.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/AppModule.java @@ -79,6 +79,7 @@ class AppModule { OkHttpClient provideOkHttpClient(@Named("no_oauth") Retrofit retrofit, RedditDataRoomDatabase accountRoomDatabase) { OkHttpClient.Builder okHttpClientBuilder = new OkHttpClient.Builder(); okHttpClientBuilder.authenticator(new AccessTokenAuthenticator(retrofit, accountRoomDatabase)); + //.addInterceptor(new Okhttp3DebugInterceptor(mApplication)); return okHttpClientBuilder.build(); } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Okhttp3DebugInterceptor.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Okhttp3DebugInterceptor.java new file mode 100644 index 00000000..3443fdc6 --- /dev/null +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Okhttp3DebugInterceptor.java @@ -0,0 +1,40 @@ +package ml.docilealligator.infinityforreddit; + +import android.app.Application; + +import androidx.annotation.NonNull; +import androidx.core.app.NotificationCompat; +import androidx.core.app.NotificationManagerCompat; + +import java.io.IOException; + +import okhttp3.Interceptor; +import okhttp3.Response; + +public class Okhttp3DebugInterceptor implements Interceptor { + private Application context; + + public Okhttp3DebugInterceptor(Application context) { + this.context = context; + } + + @NonNull + @Override + public Response intercept(Chain chain) throws IOException { + Response response = chain.proceed(chain.request()); + if (!response.isSuccessful()) { + String message = "No body"; + if (response.body() != null) { + message = response.body().string(); + } + NotificationManagerCompat notificationManager = NotificationUtils.getNotificationManager(context); + NotificationCompat.Builder builder = NotificationUtils.buildNotification(notificationManager, + context, "debug", message, Integer.toString(response.code()), + NotificationUtils.CHANNEL_ID_NEW_MESSAGES, + NotificationUtils.CHANNEL_NEW_MESSAGES, + NotificationUtils.getAccountGroupName("Debug")); + notificationManager.notify(9765, builder.build()); + } + return response; + } +} diff --git a/build.gradle b/build.gradle index a45903c1..40358cc1 100644 --- a/build.gradle +++ b/build.gradle @@ -31,6 +31,6 @@ task clean(type: Delete) { } ext { - roomVersion = '2.2.3' + roomVersion = '2.2.4' archLifecycleVersion = '2.2.0' }
\ No newline at end of file |