API modules do not need to setup dependency injection.

Move the implementation to the impl modules.
This commit is contained in:
Benoit Marty 2025-11-12 16:03:00 +01:00 committed by Benoit Marty
parent 8cad6fba9f
commit 8285478688
43 changed files with 620 additions and 405 deletions

View file

@ -8,28 +8,12 @@
package io.element.android.libraries.matrix.api.mxc
import dev.zacsweers.metro.Inject
@Inject
class MxcTools {
/**
* Regex to match a Matrix Content (mxc://) URI.
*
* See: https://spec.matrix.org/v1.8/client-server-api/#matrix-content-mxc-uris
*/
private val mxcRegex = Regex("""^mxc://([^/]+)/([^/]+)$""")
interface MxcTools {
/**
* Sanitizes an mxcUri to be used as a relative file path.
*
* @param mxcUri the Matrix Content (mxc://) URI of the file.
* @return the relative file path as "<server-name>/<media-id>" or null if the mxcUri is invalid.
*/
fun mxcUri2FilePath(mxcUri: String): String? = mxcRegex.matchEntire(mxcUri)?.let { match ->
buildString {
append(match.groupValues[1])
append("/")
append(match.groupValues[2])
}
}
fun mxcUri2FilePath(mxcUri: String): String?
}