Add proper offline/online request interceptors
This commit is contained in:
@@ -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();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user