Skip to content

Commit

Permalink
Merge pull request #286 from vimeo/caching-fix
Browse files Browse the repository at this point in the history
Fixing Caching
  • Loading branch information
anthonycr authored Feb 14, 2018
2 parents 8eb24fc + ed40329 commit 9454de5
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 10 deletions.
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@

buildscript {
ext.supportLibraryVersion = '26.1.0'
ext.kotlin_version = '1.2.20'
ext.kotlin_version = '1.2.21'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.0'
classpath 'com.android.tools.build:gradle:3.0.1'
classpath "com.jfrog.bintray.gradle:gradle-bintray-plugin:1.7.3"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ public void onCreate() {
configBuilder.enableCertPinning(false);
configBuilder.setLogLevel(LogLevel.VERBOSE);
}
configBuilder
.setCacheDirectory(this.getCacheDir())
.setUserAgentString(getUserAgentString(this))
.setDebugLogger(new NetworkingLogger());
VimeoClient.initialize(configBuilder.build());
// </editor-fold>
}
Expand All @@ -64,8 +68,7 @@ public Configuration.Builder getClientIdAndClientSecretBuilder() {
TestAccountStore testAccountStore = new TestAccountStore(this.getApplicationContext());
Configuration.Builder configBuilder =
new Configuration.Builder(clientId, clientSecret, SCOPE, testAccountStore);
configBuilder.setCacheDirectory(this.getCacheDir())
.setUserAgentString(getUserAgentString(this)).setDebugLogger(new NetworkingLogger())
configBuilder
// Used for oauth flow
.setCodeGrantRedirectUri(codeGrantRedirectUri);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ class TestApp : Application() {
configBuilder.enableCertPinning(false)
configBuilder.setLogLevel(LogLevel.VERBOSE)
}
configBuilder
.setCacheDirectory(this.cacheDir)
.setUserAgentString(getUserAgentString(this))
.setDebugLogger(NetworkingLogger())
VimeoClient.initialize(configBuilder.build())
// </editor-fold>
}
Expand All @@ -56,8 +60,7 @@ class TestApp : Application() {
val codeGrantRedirectUri = getString(R.string.deeplink_redirect_scheme) + "://" + getString(R.string.deeplink_redirect_host)
val testAccountStore = TestAccountStore(this.applicationContext)
val configBuilder = Configuration.Builder(clientId, clientSecret, SCOPE)
configBuilder.setCacheDirectory(this.cacheDir)
.setUserAgentString(getUserAgentString(this)).setDebugLogger(NetworkingLogger())
configBuilder
.setCodeGrantRedirectUri(codeGrantRedirectUri)

return configBuilder
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ public class CacheControlInterceptor implements Interceptor {

@Override
public Response intercept(Chain chain) throws IOException {
return chain.proceed(chain.request()
.newBuilder()
.header(Vimeo.HEADER_CACHE_CONTROL, Vimeo.HEADER_CACHE_PUBLIC)
.build());
return chain.proceed(chain.request())
.newBuilder()
.header(Vimeo.HEADER_CACHE_CONTROL, Vimeo.HEADER_CACHE_PUBLIC)
.build();
}
}

0 comments on commit 9454de5

Please sign in to comment.