Add proper offline/online request interceptors

This commit is contained in:
CappielloAntonio committed 2021-08-31 09:34:53 +02:00
1 parent ac584974c6
commit 55b4d97195
9 files changed
+53 -21

No files matched your search

@@ -72,10 +72,12 @@ public class AlbumSongListClient {
}
private OkHttpClient getOkHttpClient() {
CacheUtil cacheUtil = new CacheUtil(context);
return new OkHttpClient.Builder()
.addInterceptor(getHttpLoggingInterceptor())
.addInterceptor(CacheUtil.offlineInterceptor)
.addNetworkInterceptor(CacheUtil.onlineInterceptor)
.addInterceptor(cacheUtil.offlineInterceptor)
.addNetworkInterceptor(cacheUtil.onlineInterceptor)
.cache(getCache())
.build();
}
@@ -122,10 +122,12 @@ public class BrowsingClient {
}
private OkHttpClient getOkHttpClient() {
CacheUtil cacheUtil = new CacheUtil(context);
return new OkHttpClient.Builder()
.addInterceptor(getHttpLoggingInterceptor())
.addInterceptor(CacheUtil.offlineInterceptor)
.addNetworkInterceptor(CacheUtil.onlineInterceptor)
.addInterceptor(cacheUtil.offlineInterceptor)
.addNetworkInterceptor(cacheUtil.onlineInterceptor)
.cache(getCache())
.build();
}
@@ -57,10 +57,12 @@ public class MediaAnnotationClient {
}
private OkHttpClient getOkHttpClient() {
CacheUtil cacheUtil = new CacheUtil(context);
return new OkHttpClient.Builder()
.addInterceptor(getHttpLoggingInterceptor())
.addInterceptor(CacheUtil.offlineInterceptor)
.addNetworkInterceptor(CacheUtil.onlineInterceptor)
.addInterceptor(cacheUtil.offlineInterceptor)
.addNetworkInterceptor(cacheUtil.onlineInterceptor)
.cache(getCache())
.build();
}
@@ -48,10 +48,12 @@ public class MediaLibraryScanningClient {
}
private OkHttpClient getOkHttpClient() {
CacheUtil cacheUtil = new CacheUtil(context);
return new OkHttpClient.Builder()
.addInterceptor(getHttpLoggingInterceptor())
.addInterceptor(CacheUtil.offlineInterceptor)
.addNetworkInterceptor(CacheUtil.onlineInterceptor)
.addInterceptor(cacheUtil.offlineInterceptor)
.addNetworkInterceptor(cacheUtil.onlineInterceptor)
.cache(getCache())
.build();
}
@@ -47,10 +47,12 @@ public class MediaRetrievalClient {
}
private OkHttpClient getOkHttpClient() {
CacheUtil cacheUtil = new CacheUtil(context);
return new OkHttpClient.Builder()
.addInterceptor(getHttpLoggingInterceptor())
.addInterceptor(CacheUtil.offlineInterceptor)
.addNetworkInterceptor(CacheUtil.onlineInterceptor)
.addInterceptor(cacheUtil.offlineInterceptor)
.addNetworkInterceptor(cacheUtil.onlineInterceptor)
.cache(getCache())
.build();
}
@@ -64,10 +64,12 @@ public class PlaylistClient {
}
private OkHttpClient getOkHttpClient() {
CacheUtil cacheUtil = new CacheUtil(context);
return new OkHttpClient.Builder()
.addInterceptor(getHttpLoggingInterceptor())
.addInterceptor(CacheUtil.offlineInterceptor)
.addNetworkInterceptor(CacheUtil.onlineInterceptor)
.addInterceptor(cacheUtil.offlineInterceptor)
.addNetworkInterceptor(cacheUtil.onlineInterceptor)
.cache(getCache())
.build();
}
@@ -47,10 +47,12 @@ public class SearchingClient {
}
private OkHttpClient getOkHttpClient() {
CacheUtil cacheUtil = new CacheUtil(context);
return new OkHttpClient.Builder()
.addInterceptor(getHttpLoggingInterceptor())
.addInterceptor(CacheUtil.offlineInterceptor)
.addNetworkInterceptor(CacheUtil.onlineInterceptor)
.addInterceptor(cacheUtil.offlineInterceptor)
.addNetworkInterceptor(cacheUtil.onlineInterceptor)
.cache(getCache())
.build();
}
@@ -47,10 +47,12 @@ public class SystemClient {
}
private OkHttpClient getOkHttpClient() {
CacheUtil cacheUtil = new CacheUtil(context);
return new OkHttpClient.Builder()
.addInterceptor(getHttpLoggingInterceptor())
.addInterceptor(CacheUtil.offlineInterceptor)
.addNetworkInterceptor(CacheUtil.onlineInterceptor)
.addInterceptor(cacheUtil.offlineInterceptor)
.addNetworkInterceptor(cacheUtil.onlineInterceptor)
.cache(getCache())
.build();
}