Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 046ca6e4 authored by Mohammed Althaf T's avatar Mohammed Althaf T 😊
Browse files

Merge branch '3511-main-ose-murena_login5' into 'main-ose'

Initial Account Manager Transition - Part 5

See merge request !173
parents 0b18854e 7e8ae0a4
Loading
Loading
Loading
Loading
Loading
+10 −1
Original line number Diff line number Diff line
@@ -274,7 +274,6 @@ dependencies {
    implementation(libs.okhttp.base)
    implementation(libs.okhttp.brotli)
    implementation(libs.okhttp.logging)
    implementation(libs.openid.appauth)
    implementation(libs.unifiedpush) {
        // UnifiedPush connector seems to be using a workaround by importing this library.
        // Will be removed after https://github.com/tink-crypto/tink-java-apps/pull/5 is merged.
@@ -288,9 +287,12 @@ dependencies {
    implementation(libs.commons.lang)

    // e-Specific dependencies
    implementation(libs.appauth)
    implementation(libs.android.singlesignon)
    implementation(libs.androidx.runtime.livedata)
    implementation(libs.elib)
    implementation(libs.ez.vcard)
    implementation(libs.jackrabbit.webdav)
    implementation(libs.synctools) {
        exclude(group="androidx.test")
        exclude(group = "junit")
@@ -298,6 +300,13 @@ dependencies {
    implementation(libs.ical4j) {
        exclude(group = "commons-logging", module = "commons-logging")
    }
    implementation(libs.nextcloud.library) {
        exclude(group = "org.ogce", module = "xpp3")
    }
    implementation(libs.commons.httpclient) {
        exclude(group = "commons-logging", module = "commons-logging")
    }
    implementation(libs.okhttp.urlconnection)

    // for tests
    androidTestImplementation(libs.androidx.arch.core.testing)
+7 −0
Original line number Diff line number Diff line
@@ -24,3 +24,10 @@
-dontwarn sun.net.spi.nameservice.NameService
-dontwarn sun.net.spi.nameservice.NameServiceDescriptor
-dontwarn org.xbill.DNS.spi.DnsjavaInetAddressResolverProvider

-dontwarn edu.umd.cs.findbugs.annotations.SuppressFBWarnings

-keep class com.nextcloud.android.sso.** { *; }
-keep interface com.nextcloud.android.sso.** { *; }
-keep class org.apache.commons.httpclient.** { *; }
-keep interface org.apache.commons.httpclient.** { *; }
+3 −0
Original line number Diff line number Diff line
@@ -16,6 +16,9 @@ interface ServiceDao {
    @Query("SELECT * FROM service WHERE accountName=:accountName AND type=:type")
    suspend fun getByAccountAndType(accountName: String, @ServiceType type: String): Service?

    @Query("SELECT * FROM service WHERE accountName=:accountName")
    suspend fun getByAccountName(accountName: String): List<Service?>

    @Query("SELECT * FROM service WHERE accountName=:accountName AND type=:type")
    fun getByAccountAndTypeFlow(accountName: String, @ServiceType type: String): Flow<Service?>

+14 −1
Original line number Diff line number Diff line
@@ -19,6 +19,8 @@ import at.bitfire.davdroid.settings.SettingsManager
import at.bitfire.davdroid.ui.ForegroundTracker
import com.google.common.net.HttpHeaders
import dagger.hilt.android.qualifiers.ApplicationContext
import foundation.e.accountmanager.network.CookieParser
import foundation.e.accountmanager.network.PersistentCookieStore
import kotlinx.coroutines.CoroutineDispatcher
import kotlinx.coroutines.withContext
import net.openid.appauth.AuthState
@@ -173,9 +175,12 @@ class HttpClient(
                    accountSettings.credentials()
                },
                updateAuthState = { authState ->
                    accountSettings.updateAuthState(authState)
                    accountSettings.updateAuthState(authState, cookieStore)
                }
            )

            cookieStore = PersistentCookieStore.create(context, account, cookieStore)

            return this
        }

@@ -312,4 +317,12 @@ class HttpClient(

    }

    fun getCookieAsString(): String {
        val cookieJar = okHttpClient.cookieJar
        if (cookieJar is CookieParser) {
            return cookieJar.cookiesAsString()
        }

        return ""
    }
}
 No newline at end of file
+11 −2
Original line number Diff line number Diff line
@@ -4,7 +4,8 @@

package at.bitfire.davdroid.network

import androidx.annotation.VisibleForTesting
import com.owncloud.android.lib.common.accounts.AccountUtils
import foundation.e.accountmanager.network.CookieParser
import okhttp3.Cookie
import okhttp3.CookieJar
import okhttp3.HttpUrl
@@ -14,7 +15,7 @@ import java.util.LinkedList
 * Primitive cookie store that stores cookies in a (volatile) hash map.
 * Will be sufficient for session cookies.
 */
class MemoryCookieStore : CookieJar {
class MemoryCookieStore : CookieJar, CookieParser {

    data class StorageKey(
        val domain: String,
@@ -78,4 +79,12 @@ class MemoryCookieStore : CookieJar {
        return cookies
    }

    override fun cookiesAsString(): String {
        if (storage.isEmpty()) {
            return ""
        }

        return storage.values.joinToString(separator = AccountUtils.Constants.OKHTTP_COOKIE_SEPARATOR)
    }

}
 No newline at end of file
Loading