Skip to content
This repository was archived by the owner on Mar 19, 2024. It is now read-only.

Commit cfd6998

Browse files
committed
update session from APM while running the app
1 parent b2f6d7f commit cfd6998

File tree

5 files changed

+14
-12
lines changed

5 files changed

+14
-12
lines changed

owncloudComLibrary/build.gradle

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ dependencies {
77
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlinVersion"
88
api 'com.gitlab.ownclouders:dav4android:oc_support_2.1.5'
99
api 'com.github.AppDevNext.Logcat:LogcatCore:2.2.2'
10+
debugImplementation 'com.facebook.stetho:stetho:1.5.1'
11+
debugImplementation 'com.facebook.stetho:stetho-okhttp3:1.5.1'
1012

1113
// Moshi
1214
implementation("com.squareup.moshi:moshi-kotlin:$moshiVersion") {

owncloudComLibrary/src/main/java/com/owncloud/android/lib/common/ConnectionValidator.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class ConnectionValidator (
2121
var validationRetryCount = 0
2222
val client = OwnCloudClient(baseClient.baseUri, null, false)
2323
if (clearCookiesOnValidation) {
24-
client.clearCookies()
24+
client.clearCookies();
2525
} else {
2626
client.cookiesForBaseUri = baseClient.cookiesForBaseUri
2727
}
@@ -84,7 +84,7 @@ class ConnectionValidator (
8484
}
8585

8686
private fun triggerAuthRefresh(): OwnCloudCredentials {
87-
//TODO: Implement me
87+
Timber.d("!!!!!!!!!!!!!!!!!!!!!!!!!!!! need to reauthenticate !!!!!!!!!!!!!!!!!!!!!!!!!!")
8888
return OwnCloudCredentialsFactory.getAnonymousCredentials()
8989
}
9090

owncloudComLibrary/src/main/java/com/owncloud/android/lib/common/OwnCloudClient.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -340,10 +340,6 @@ public List<Cookie> getCookiesForBaseUri() {
340340
HttpUrl.parse(mBaseUri.toString()));
341341
}
342342

343-
public void clearCookies() {
344-
setCookiesForBaseUri(new ArrayList<>());
345-
}
346-
347343
public OwnCloudVersion getOwnCloudVersion() {
348344
return mVersion;
349345
}

owncloudComLibrary/src/main/java/com/owncloud/android/lib/common/http/CookieJarImpl.kt

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ import okhttp3.CookieJar
2828
import okhttp3.HttpUrl
2929

3030
class CookieJarImpl(
31-
private val sCookieStore: HashMap<String, List<Cookie>>
31+
private val cookieStore: HashMap<String, List<Cookie>>
3232
) : CookieJar {
3333

3434
fun containsCookieWithName(cookies: List<Cookie>, name: String): Boolean {
@@ -52,12 +52,11 @@ class CookieJarImpl(
5252

5353
override fun saveFromResponse(url: HttpUrl, cookies: List<Cookie>) {
5454
// Avoid duplicated cookies but update
55-
val currentCookies: List<Cookie> = sCookieStore[url.host] ?: ArrayList()
55+
val currentCookies: List<Cookie> = cookieStore[url.host] ?: ArrayList()
5656
val updatedCookies: List<Cookie> = getUpdatedCookies(currentCookies, cookies)
57-
sCookieStore[url.host] = updatedCookies
57+
cookieStore[url.host] = updatedCookies
5858
}
5959

6060
override fun loadForRequest(url: HttpUrl) =
61-
sCookieStore[url.host] ?: ArrayList()
62-
63-
}
61+
cookieStore[url.host] ?: ArrayList()
62+
}

owncloudComLibrary/src/main/java/com/owncloud/android/lib/common/http/HttpClient.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626

2727
import android.content.Context;
2828

29+
import com.facebook.stetho.okhttp3.StethoInterceptor;
2930
import com.owncloud.android.lib.common.network.AdvancedX509TrustManager;
3031
import com.owncloud.android.lib.common.network.NetworkUtils;
3132
import okhttp3.Cookie;
@@ -139,4 +140,8 @@ public Context getContext() {
139140
public static void setContext(Context context) {
140141
sContext = context;
141142
}
143+
144+
public void clearCookies() {
145+
sCookieStore.clear();
146+
}
142147
}

0 commit comments

Comments
 (0)