Update API around brandColor.
This commit is contained in:
parent
b62382ffc7
commit
38908a42a2
12 changed files with 29 additions and 6 deletions
|
|
@ -73,3 +73,15 @@ fun List<SessionData>.toUserList(): List<String> {
|
|||
fun Flow<List<SessionData>>.toUserListFlow(): Flow<List<String>> {
|
||||
return map { it.toUserList() }
|
||||
}
|
||||
|
||||
/**
|
||||
* @return a flow emitting the userId of the latest session if logged in, null otherwise.
|
||||
*/
|
||||
fun SessionStore.userIdFlow(): Flow<String?> {
|
||||
return loggedInStateFlow().map {
|
||||
when (it) {
|
||||
is LoggedInState.LoggedIn -> it.sessionId
|
||||
is LoggedInState.NotLoggedIn -> null
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,4 +11,5 @@ data class ElementWellKnown(
|
|||
val registrationHelperUrl: String?,
|
||||
val enforceElementPro: Boolean?,
|
||||
val rageshakeUrl: String?,
|
||||
val brandColor: String?,
|
||||
)
|
||||
|
|
|
|||
|
|
@ -27,4 +27,6 @@ data class InternalElementWellKnown(
|
|||
val enforceElementPro: Boolean? = null,
|
||||
@SerialName("rageshake_url")
|
||||
val rageshakeUrl: String? = null,
|
||||
@SerialName("brand_color")
|
||||
val brandColor: String? = null,
|
||||
)
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ internal fun InternalElementWellKnown.map() = ElementWellKnown(
|
|||
registrationHelperUrl = registrationHelperUrl,
|
||||
enforceElementPro = enforceElementPro,
|
||||
rageshakeUrl = rageshakeUrl,
|
||||
brandColor = brandColor,
|
||||
)
|
||||
|
||||
internal fun InternalWellKnown.map() = WellKnown(
|
||||
|
|
|
|||
|
|
@ -161,6 +161,7 @@ class DefaultSessionWellknownRetrieverTest {
|
|||
registrationHelperUrl = null,
|
||||
enforceElementPro = null,
|
||||
rageshakeUrl = null,
|
||||
brandColor = null,
|
||||
)
|
||||
)
|
||||
getUrlLambda.assertions().isCalledOnce()
|
||||
|
|
@ -175,7 +176,8 @@ class DefaultSessionWellknownRetrieverTest {
|
|||
"""{
|
||||
"registration_helper_url": "a_registration_url",
|
||||
"enforce_element_pro": true,
|
||||
"rageshake_url": "a_rageshake_url"
|
||||
"rageshake_url": "a_rageshake_url",
|
||||
"brand_color": "#FF0000"
|
||||
}""".trimIndent().toByteArray()
|
||||
)
|
||||
}
|
||||
|
|
@ -185,6 +187,7 @@ class DefaultSessionWellknownRetrieverTest {
|
|||
registrationHelperUrl = "a_registration_url",
|
||||
enforceElementPro = true,
|
||||
rageshakeUrl = "a_rageshake_url",
|
||||
brandColor = "#FF0000",
|
||||
)
|
||||
)
|
||||
}
|
||||
|
|
@ -208,6 +211,7 @@ class DefaultSessionWellknownRetrieverTest {
|
|||
registrationHelperUrl = "a_registration_url",
|
||||
enforceElementPro = true,
|
||||
rageshakeUrl = "a_rageshake_url",
|
||||
brandColor = null,
|
||||
)
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,8 +13,10 @@ fun anElementWellKnown(
|
|||
registrationHelperUrl: String? = null,
|
||||
enforceElementPro: Boolean? = null,
|
||||
rageshakeUrl: String? = null,
|
||||
brandColor: String? = null,
|
||||
) = ElementWellKnown(
|
||||
registrationHelperUrl = registrationHelperUrl,
|
||||
enforceElementPro = enforceElementPro,
|
||||
rageshakeUrl = rageshakeUrl,
|
||||
brandColor = brandColor,
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue