Improve API and documentation
This commit is contained in:
parent
0f3858649c
commit
64b5b53510
9 changed files with 22 additions and 15 deletions
|
|
@ -21,9 +21,10 @@ interface EnterpriseService {
|
|||
|
||||
/**
|
||||
* Override the brand color.
|
||||
* @param sessionId the session to override the brand color for, or null to set the brand color to use when there is no session.
|
||||
* @param brandColor the color in hex format (#RRGGBBAA or #RRGGBB), or null to reset to default.
|
||||
*/
|
||||
suspend fun overrideBrandColor(brandColor: String?)
|
||||
suspend fun overrideBrandColor(sessionId: SessionId?, brandColor: String?)
|
||||
|
||||
@Composable
|
||||
fun semanticColorsLight(): State<SemanticColors>
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ class DefaultEnterpriseService : EnterpriseService {
|
|||
override fun defaultHomeserverList(): List<String> = emptyList()
|
||||
override suspend fun isAllowedToConnectToHomeserver(homeserverUrl: String) = true
|
||||
|
||||
override suspend fun overrideBrandColor(brandColor: String?) = Unit
|
||||
override suspend fun overrideBrandColor(sessionId: SessionId?, brandColor: String?) = Unit
|
||||
|
||||
@Composable
|
||||
override fun semanticColorsLight(): State<SemanticColors> {
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ class DefaultEnterpriseServiceTest {
|
|||
}.test {
|
||||
val initialState = awaitItem()
|
||||
assertThat(initialState).isEqualTo(compoundColorsLight)
|
||||
defaultEnterpriseService.overrideBrandColor("#87654321")
|
||||
defaultEnterpriseService.overrideBrandColor(A_SESSION_ID, "#87654321")
|
||||
expectNoEvents()
|
||||
}
|
||||
}
|
||||
|
|
@ -64,7 +64,7 @@ class DefaultEnterpriseServiceTest {
|
|||
}.test {
|
||||
val initialState = awaitItem()
|
||||
assertThat(initialState).isEqualTo(compoundColorsDark)
|
||||
defaultEnterpriseService.overrideBrandColor("#87654321")
|
||||
defaultEnterpriseService.overrideBrandColor(A_SESSION_ID, "#87654321")
|
||||
expectNoEvents()
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ class FakeEnterpriseService(
|
|||
private val isAllowedToConnectToHomeserverResult: (String) -> Boolean = { lambdaError() },
|
||||
private val semanticColorsLightResult: () -> State<SemanticColors> = { lambdaError() },
|
||||
private val semanticColorsDarkResult: () -> State<SemanticColors> = { lambdaError() },
|
||||
private val overrideBrandColorResult: (String?) -> Unit = { lambdaError() },
|
||||
private val overrideBrandColorResult: (SessionId?, String?) -> Unit = { _, _ -> lambdaError() },
|
||||
private val firebasePushGatewayResult: () -> String? = { lambdaError() },
|
||||
private val unifiedPushDefaultPushGatewayResult: () -> String? = { lambdaError() },
|
||||
) : EnterpriseService {
|
||||
|
|
@ -42,8 +42,8 @@ class FakeEnterpriseService(
|
|||
isAllowedToConnectToHomeserverResult(homeserverUrl)
|
||||
}
|
||||
|
||||
override suspend fun overrideBrandColor(brandColor: String?) = simulateLongTask {
|
||||
overrideBrandColorResult(brandColor)
|
||||
override suspend fun overrideBrandColor(sessionId: SessionId?, brandColor: String?) = simulateLongTask {
|
||||
overrideBrandColorResult(sessionId, brandColor)
|
||||
}
|
||||
|
||||
@Composable
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue