[MatrixSDK] remove Rust AuthenticationService from the dependency graph

This commit is contained in:
ganfra
2023-03-14 12:04:53 +01:00
parent dc8cfcdb8e
commit 76aefaf995
5 changed files with 2 additions and 42 deletions

View File

@@ -219,7 +219,6 @@ dependencies {
implementation(libs.androidx.activity.compose)
implementation(libs.androidx.startup)
implementation(libs.coil)
implementation(libs.matrix.sdk)
implementation(libs.dagger)
kapt(libs.dagger.compiler)

View File

@@ -34,13 +34,13 @@ import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.StateFlow
import kotlinx.coroutines.withContext
import org.matrix.rustcomponents.sdk.AuthenticationService
import org.matrix.rustcomponents.sdk.Client
import org.matrix.rustcomponents.sdk.ClientBuilder
import org.matrix.rustcomponents.sdk.Session
import org.matrix.rustcomponents.sdk.use
import java.io.File
import javax.inject.Inject
import org.matrix.rustcomponents.sdk.AuthenticationService as RustAuthenticationService
@ContributesBinding(AppScope::class)
@SingleIn(AppScope::class)
@@ -49,9 +49,9 @@ class RustMatrixAuthenticationService @Inject constructor(
private val coroutineScope: CoroutineScope,
private val coroutineDispatchers: CoroutineDispatchers,
private val sessionStore: SessionStore,
private val authService: AuthenticationService,
) : MatrixAuthenticationService {
private val authService: RustAuthenticationService = RustAuthenticationService(baseDirectory.absolutePath, null, null)
private var currentHomeserver = MutableStateFlow<MatrixHomeServerDetails?>(null)
override fun isLoggedIn(): Flow<Boolean> {

View File

@@ -1,36 +0,0 @@
/*
* Copyright (c) 2023 New Vector Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.element.android.libraries.matrix.impl.di
import com.squareup.anvil.annotations.ContributesTo
import dagger.Module
import dagger.Provides
import io.element.android.libraries.di.AppScope
import io.element.android.libraries.di.SingleIn
import org.matrix.rustcomponents.sdk.AuthenticationService
import java.io.File
@Module
@ContributesTo(AppScope::class)
object MatrixModule {
@Provides
@SingleIn(AppScope::class)
fun providesRustAuthenticationService(baseDirectory: File): AuthenticationService {
return AuthenticationService(baseDirectory.absolutePath, null, null)
}
}

View File

@@ -57,6 +57,5 @@ dependencies {
implementation(projects.features.roomlist.impl)
implementation(projects.features.login.impl)
implementation(libs.coroutines.core)
implementation(libs.matrix.sdk)
coreLibraryDesugaring("com.android.tools:desugar_jdk_libs:2.0.2")
}

View File

@@ -33,7 +33,6 @@ import io.element.android.libraries.matrix.api.auth.MatrixAuthenticationService
import io.element.android.libraries.matrix.impl.auth.RustMatrixAuthenticationService
import io.element.android.libraries.sessionstorage.impl.memory.InMemorySessionStore
import kotlinx.coroutines.runBlocking
import org.matrix.rustcomponents.sdk.AuthenticationService
import java.io.File
class MainActivity : ComponentActivity() {
@@ -46,7 +45,6 @@ class MainActivity : ComponentActivity() {
coroutineScope = Singleton.appScope,
coroutineDispatchers = Singleton.coroutineDispatchers,
sessionStore = InMemorySessionStore(),
authService = AuthenticationService(baseDirectory.absolutePath, null, null),
)
}