Let SpaceId be an alias of RoomId
This commit is contained in:
parent
a36f10ae30
commit
fb346a1587
2 changed files with 1 additions and 25 deletions
|
|
@ -69,14 +69,6 @@ object MatrixPatterns {
|
||||||
str matches PATTERN_CONTAIN_MATRIX_USER_IDENTIFIER
|
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.
|
* Tells if a string is a valid room id.
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -7,23 +7,7 @@
|
||||||
|
|
||||||
package io.element.android.libraries.matrix.api.core
|
package io.element.android.libraries.matrix.api.core
|
||||||
|
|
||||||
import io.element.android.libraries.androidutils.metadata.isInDebug
|
typealias SpaceId = RoomId
|
||||||
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
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Value to use when no space is selected by the user.
|
* Value to use when no space is selected by the user.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue