Let enterprise build be able to use a different notification channel for noisy notification.

This commit is contained in:
Benoit Marty 2026-02-11 09:59:45 +01:00
parent 7535258bae
commit 6e958f3132
17 changed files with 135 additions and 26 deletions

View file

@ -35,6 +35,11 @@ interface EnterpriseService {
fun bugReportUrlFlow(sessionId: SessionId?): Flow<BugReportUrl>
/**
* Gets Notification Channel to use for the noisy notifications of the provided session.
*/
fun getNoisyNotificationChannelId(sessionId: SessionId): String?
companion object {
const val ANY_ACCOUNT_PROVIDER = "*"
}

View file

@ -43,4 +43,6 @@ class DefaultEnterpriseService : EnterpriseService {
override fun bugReportUrlFlow(sessionId: SessionId?): Flow<BugReportUrl> {
return flowOf(BugReportUrl.UseDefault)
}
override fun getNoisyNotificationChannelId(sessionId: SessionId): String? = null
}

View file

@ -98,4 +98,10 @@ class DefaultEnterpriseServiceTest {
awaitComplete()
}
}
@Test
fun `getNoisyNotificationChannelId returns null`() = runTest {
val defaultEnterpriseService = DefaultEnterpriseService()
assertThat(defaultEnterpriseService.getNoisyNotificationChannelId(A_SESSION_ID)).isNull()
}
}

View file

@ -29,6 +29,7 @@ class FakeEnterpriseService(
private val overrideBrandColorResult: (SessionId?, String?) -> Unit = { _, _ -> lambdaError() },
private val firebasePushGatewayResult: () -> String? = { lambdaError() },
private val unifiedPushDefaultPushGatewayResult: () -> String? = { lambdaError() },
private val getNoisyNotificationChannelIdResult: (SessionId?) -> String? = { lambdaError() },
) : EnterpriseService {
private val brandColorState = MutableStateFlow(initialBrandColor)
private val semanticColorsState = MutableStateFlow(initialSemanticColors)
@ -69,4 +70,8 @@ class FakeEnterpriseService(
override fun bugReportUrlFlow(sessionId: SessionId?): Flow<BugReportUrl> {
return bugReportUrlMutableFlow.asStateFlow()
}
override fun getNoisyNotificationChannelId(sessionId: SessionId): String? {
return getNoisyNotificationChannelIdResult(sessionId)
}
}

View file

@ -1238,7 +1238,7 @@ class MessagesPresenterTest {
}
@Test
fun `present - shows a "world_readable" icon if the room is encrypted and history is world_readable`() = runTest {
fun `present - shows a 'world_readable' icon if the room is encrypted and history is world_readable`() = runTest {
val presenter = createMessagesPresenter(
joinedRoom = FakeJoinedRoom(
baseRoom = FakeBaseRoom(