Merge pull request #5607 from element-hq/feature/bma/notificationStyle

Update notification style
This commit is contained in:
Benoit Marty 2025-10-24 19:20:18 +02:00 committed by GitHub
commit bb12a6f18b
35 changed files with 259 additions and 136 deletions

View file

@ -7,6 +7,7 @@
package io.element.android.features.enterprise.api
import androidx.compose.ui.graphics.Color
import io.element.android.compound.colors.SemanticColorsLightDark
import io.element.android.libraries.matrix.api.core.SessionId
import kotlinx.coroutines.flow.Flow
@ -24,6 +25,8 @@ interface EnterpriseService {
*/
suspend fun overrideBrandColor(sessionId: SessionId?, brandColor: String?)
fun brandColorsFlow(sessionId: SessionId?): Flow<Color?>
fun semanticColorsFlow(sessionId: SessionId?): Flow<SemanticColorsLightDark>
fun firebasePushGateway(): String?

View file

@ -7,6 +7,7 @@
package io.element.android.features.enterprise.impl
import androidx.compose.ui.graphics.Color
import dev.zacsweers.metro.AppScope
import dev.zacsweers.metro.ContributesBinding
import io.element.android.compound.colors.SemanticColorsLightDark
@ -27,6 +28,10 @@ class DefaultEnterpriseService : EnterpriseService {
override suspend fun overrideBrandColor(sessionId: SessionId?, brandColor: String?) = Unit
override fun brandColorsFlow(sessionId: SessionId?): Flow<Color?> {
return flowOf(null)
}
override fun semanticColorsFlow(sessionId: SessionId?): Flow<SemanticColorsLightDark> {
return flowOf(SemanticColorsLightDark.default)
}

View file

@ -51,6 +51,16 @@ class DefaultEnterpriseServiceTest {
}
}
@Test
fun `brandColorsFlow always emits null`() = runTest {
val defaultEnterpriseService = DefaultEnterpriseService()
defaultEnterpriseService.brandColorsFlow(null).test {
val initialState = awaitItem()
assertThat(initialState).isNull()
awaitComplete()
}
}
@Test
fun `semanticColorsFlow always emits the same value for a session`() = runTest {
val defaultEnterpriseService = DefaultEnterpriseService()

View file

@ -7,6 +7,7 @@
package io.element.android.features.enterprise.test
import androidx.compose.ui.graphics.Color
import io.element.android.compound.colors.SemanticColorsLightDark
import io.element.android.features.enterprise.api.BugReportUrl
import io.element.android.features.enterprise.api.EnterpriseService
@ -27,6 +28,7 @@ class FakeEnterpriseService(
private val firebasePushGatewayResult: () -> String? = { lambdaError() },
private val unifiedPushDefaultPushGatewayResult: () -> String? = { lambdaError() },
) : EnterpriseService {
private val brandColorState = MutableStateFlow<Color?>(null)
private val semanticColorsState = MutableStateFlow(initialSemanticColors)
override suspend fun isEnterpriseUser(sessionId: SessionId): Boolean = simulateLongTask {
@ -45,6 +47,10 @@ class FakeEnterpriseService(
overrideBrandColorResult(sessionId, brandColor)
}
override fun brandColorsFlow(sessionId: SessionId?): Flow<Color?> {
return brandColorState.asStateFlow()
}
override fun semanticColorsFlow(sessionId: SessionId?): Flow<SemanticColorsLightDark> {
return semanticColorsState.asStateFlow()
}