mirror of
https://github.com/antebudimir/tempus.git
synced 2026-01-01 18:03:33 +00:00
Add proper offline/online request interceptors
This commit is contained in:
parent
ac584974c6
commit
55b4d97195
9 changed files with 53 additions and 21 deletions
|
|
@ -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();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue