Let notifications uses the brandColor.

This commit is contained in:
Benoit Marty 2025-10-24 17:04:48 +02:00
parent 257325022c
commit 6e9af83b6a
24 changed files with 239 additions and 92 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

@ -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()
}