Rework WellknownRetriever so it uses the GetUrlResolver

Also, allow instantiating it using a factory: with this we can always decide where to take the config from and how to do it

Do the same for `ElementWellknownStore` so we can store and restore the values for different sources (endpoints) independently
This commit is contained in:
Jorge Martín
2026-08-10 14:22:39 +02:00
committed by Jorge Martin Espinosa
parent 3f19100427
commit 25eca29cd2
5 changed files with 137 additions and 41 deletions
+4
View File
@@ -12,3 +12,7 @@ plugins {
android {
namespace = "io.element.android.libraries.wellknown.api"
}
dependencies {
implementation(projects.libraries.matrix.api)
}
@@ -11,4 +11,8 @@ interface ElementWellknownStore {
suspend fun get(domain: String): WellknownRetrieverResult<ElementWellKnown>
suspend fun update(domain: String, wellknown: String): Result<Unit>
suspend fun delete(domain: String): Result<Unit>
fun interface Factory {
fun create(prefix: String?): ElementWellknownStore
}
}
@@ -8,6 +8,15 @@
package io.element.android.libraries.wellknown.api
import io.element.android.libraries.matrix.api.GetUrlResolver
interface WellknownRetriever {
suspend fun getElementWellKnown(baseUrl: String): WellknownRetrieverResult<ElementWellKnown>
suspend fun getElementWellKnown(
host: String,
source: EnterpriseRemoteConfigSource
): WellknownRetrieverResult<ElementWellKnown>
interface Factory {
fun create(getUrlResolver: GetUrlResolver): WellknownRetriever
}
}