Give the native call component its view of Matrix

The factory lives in libraries/matrix/impl because that is the only module compiled against the Rust SDK, and is app-scoped because a call is started for whichever account it belongs to rather than the one on screen.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Valere
2026-09-22 21:04:04 +02:00
committed by Valere Fedronic
parent 0d36f70c96
commit 43a1364671
4 changed files with 108 additions and 3 deletions
+11 -1
View File
@@ -13,8 +13,18 @@ android {
namespace = "io.element.android.features.callnative.api"
}
// Temporary: `-PelementCallLocalVersion` points this at a locally published build of
// element-call-android. Goes with the repositories in settings.gradle.kts.
val elementCallVersion: String = providers.gradleProperty("elementCallLocalVersion")
.getOrElse(libs.versions.element.call.get())
dependencies {
// api, not implementation: CallData is part of NativeCallEntryPoint's signature.
// api, not implementation: ElementCallMatrixTransport is part of ElementCallTransportFactory's
// signature, and CallData of NativeCallEntryPoint's.
// api, so that consumers of this module inherit the versions the BOM pins - the artifact
// below is declared without one.
api(platform("io.element.android:element-call-bom:$elementCallVersion"))
api(libs.element.call.api)
api(projects.features.call.api)
implementation(projects.libraries.architecture)
implementation(projects.libraries.matrix.api)
@@ -0,0 +1,26 @@
/*
* Copyright (c) 2026 Element Creations Ltd.
*
* SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial.
* Please see LICENSE files in the repository root for full details.
*/
package io.element.android.features.callnative.api
import io.element.android.call.api.matrix.ElementCallMatrixTransport
import io.element.android.libraries.matrix.api.MatrixClient
/**
* Makes the native call's view of Matrix for a session.
*
* The component's turnkey transport is built over a raw Rust SDK client, and only
* `libraries/matrix/impl` is compiled against the SDK. This is the seam that keeps it that way: the
* implementation lives there, everything else takes a [MatrixClient] and asks.
*
* A factory rather than a binding for the transport itself, because the call is started from app scope
* - a call can be placed for an account that is not the one on screen - and the session it belongs to
* is known only as an id until a client is fetched for it.
*/
fun interface ElementCallTransportFactory {
fun create(client: MatrixClient): ElementCallMatrixTransport
}