Let SpaceId be an alias of RoomId

This commit is contained in:
Benoit Marty 2025-09-30 17:09:45 +02:00 committed by Benoit Marty
parent b2306258b4
commit 6edb9acc2b
2 changed files with 1 additions and 25 deletions

View file

@ -69,14 +69,6 @@ object MatrixPatterns {
str matches PATTERN_CONTAIN_MATRIX_USER_IDENTIFIER
}
/**
* Tells if a string is a valid space id. This is an alias for [isRoomId]
*
* @param str the string to test
* @return true if the string is a valid space Id
*/
fun isSpaceId(str: String?) = isRoomId(str)
/**
* Tells if a string is a valid room id.
*

View file

@ -7,23 +7,7 @@
package io.element.android.libraries.matrix.api.core
import io.element.android.libraries.androidutils.metadata.isInDebug
import java.io.Serializable
@JvmInline
value class SpaceId(val value: String) : Serializable {
init {
if (isInDebug && !MatrixPatterns.isSpaceId(value)) {
error(
"`$value` is not a valid space id.\n" +
"Space ids are the same as room ids.\n" +
"Example space id: `!space_id:domain`."
)
}
}
override fun toString(): String = value
}
typealias SpaceId = RoomId
/**
* Value to use when no space is selected by the user.