diff --git a/enterprise b/enterprise index 6207ddc1cb..6c63bfa2d2 160000 --- a/enterprise +++ b/enterprise @@ -1 +1 @@ -Subproject commit 6207ddc1cb7dac7fdb6212c0158497a1d9752c75 +Subproject commit 6c63bfa2d2147dd1667b644b9d4fc3bebcd31c4c diff --git a/features/enterprise/api/src/main/kotlin/io/element/android/features/enterprise/api/EnterpriseService.kt b/features/enterprise/api/src/main/kotlin/io/element/android/features/enterprise/api/EnterpriseService.kt index ecf1ba6b64..65fe3fe087 100644 --- a/features/enterprise/api/src/main/kotlin/io/element/android/features/enterprise/api/EnterpriseService.kt +++ b/features/enterprise/api/src/main/kotlin/io/element/android/features/enterprise/api/EnterpriseService.kt @@ -35,6 +35,11 @@ interface EnterpriseService { fun bugReportUrlFlow(sessionId: SessionId?): Flow + /** + * 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 = "*" } diff --git a/features/enterprise/impl-foss/src/main/kotlin/io/element/android/features/enterprise/impl/DefaultEnterpriseService.kt b/features/enterprise/impl-foss/src/main/kotlin/io/element/android/features/enterprise/impl/DefaultEnterpriseService.kt index b154d78afa..932d082fd9 100644 --- a/features/enterprise/impl-foss/src/main/kotlin/io/element/android/features/enterprise/impl/DefaultEnterpriseService.kt +++ b/features/enterprise/impl-foss/src/main/kotlin/io/element/android/features/enterprise/impl/DefaultEnterpriseService.kt @@ -43,4 +43,6 @@ class DefaultEnterpriseService : EnterpriseService { override fun bugReportUrlFlow(sessionId: SessionId?): Flow { return flowOf(BugReportUrl.UseDefault) } + + override fun getNoisyNotificationChannelId(sessionId: SessionId): String? = null } diff --git a/features/enterprise/impl-foss/src/test/kotlin/io/element/android/features/enterprise/impl/DefaultEnterpriseServiceTest.kt b/features/enterprise/impl-foss/src/test/kotlin/io/element/android/features/enterprise/impl/DefaultEnterpriseServiceTest.kt index ff95fd8721..2bee3f8b4d 100644 --- a/features/enterprise/impl-foss/src/test/kotlin/io/element/android/features/enterprise/impl/DefaultEnterpriseServiceTest.kt +++ b/features/enterprise/impl-foss/src/test/kotlin/io/element/android/features/enterprise/impl/DefaultEnterpriseServiceTest.kt @@ -98,4 +98,10 @@ class DefaultEnterpriseServiceTest { awaitComplete() } } + + @Test + fun `getNoisyNotificationChannelId returns null`() = runTest { + val defaultEnterpriseService = DefaultEnterpriseService() + assertThat(defaultEnterpriseService.getNoisyNotificationChannelId(A_SESSION_ID)).isNull() + } } diff --git a/features/enterprise/test/src/main/kotlin/io/element/android/features/enterprise/test/FakeEnterpriseService.kt b/features/enterprise/test/src/main/kotlin/io/element/android/features/enterprise/test/FakeEnterpriseService.kt index b2c386267a..3c17a4de7c 100644 --- a/features/enterprise/test/src/main/kotlin/io/element/android/features/enterprise/test/FakeEnterpriseService.kt +++ b/features/enterprise/test/src/main/kotlin/io/element/android/features/enterprise/test/FakeEnterpriseService.kt @@ -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 { return bugReportUrlMutableFlow.asStateFlow() } + + override fun getNoisyNotificationChannelId(sessionId: SessionId): String? { + return getNoisyNotificationChannelIdResult(sessionId) + } } diff --git a/features/messages/impl/src/test/kotlin/io/element/android/features/messages/impl/MessagesPresenterTest.kt b/features/messages/impl/src/test/kotlin/io/element/android/features/messages/impl/MessagesPresenterTest.kt index d52179f3ef..f6967de0e5 100644 --- a/features/messages/impl/src/test/kotlin/io/element/android/features/messages/impl/MessagesPresenterTest.kt +++ b/features/messages/impl/src/test/kotlin/io/element/android/features/messages/impl/MessagesPresenterTest.kt @@ -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( diff --git a/libraries/push/impl/src/main/kotlin/io/element/android/libraries/push/impl/notifications/channels/NotificationChannels.kt b/libraries/push/impl/src/main/kotlin/io/element/android/libraries/push/impl/notifications/channels/NotificationChannels.kt index 9d1452fdae..120d48cf4b 100644 --- a/libraries/push/impl/src/main/kotlin/io/element/android/libraries/push/impl/notifications/channels/NotificationChannels.kt +++ b/libraries/push/impl/src/main/kotlin/io/element/android/libraries/push/impl/notifications/channels/NotificationChannels.kt @@ -23,7 +23,9 @@ import dev.zacsweers.metro.AppScope import dev.zacsweers.metro.ContributesBinding import dev.zacsweers.metro.SingleIn import io.element.android.appconfig.NotificationConfig +import io.element.android.features.enterprise.api.EnterpriseService import io.element.android.libraries.di.annotations.ApplicationContext +import io.element.android.libraries.matrix.api.core.SessionId import io.element.android.libraries.push.impl.R import io.element.android.services.toolbox.api.strings.StringProvider @@ -47,9 +49,10 @@ interface NotificationChannels { /** * Get the channel for messages. + * @param sessionId the session the message belongs to. * @param noisy true if the notification should have sound and vibration. */ - fun getChannelIdForMessage(noisy: Boolean): String + fun getChannelIdForMessage(sessionId: SessionId, noisy: Boolean): String /** * Get the channel for test notifications. @@ -67,6 +70,7 @@ class DefaultNotificationChannels( private val stringProvider: StringProvider, @ApplicationContext private val context: Context, + private val enterpriseService: EnterpriseService, ) : NotificationChannels { init { createNotificationChannels() @@ -115,7 +119,7 @@ class DefaultNotificationChannels( .setSound( Uri.Builder() .scheme(ContentResolver.SCHEME_ANDROID_RESOURCE) - // Strangely wwe have to provide a "//" before the package name + // Strangely we have to provide a "//" before the package name .path("//" + context.packageName + "/" + R.raw.message) .build(), AudioAttributes.Builder() @@ -186,8 +190,13 @@ class DefaultNotificationChannels( return if (ring) RINGING_CALL_NOTIFICATION_CHANNEL_ID else CALL_NOTIFICATION_CHANNEL_ID } - override fun getChannelIdForMessage(noisy: Boolean): String { - return if (noisy) NOISY_NOTIFICATION_CHANNEL_ID else SILENT_NOTIFICATION_CHANNEL_ID + override fun getChannelIdForMessage(sessionId: SessionId, noisy: Boolean): String { + return if (noisy) { + enterpriseService.getNoisyNotificationChannelId(sessionId) + ?: NOISY_NOTIFICATION_CHANNEL_ID + } else { + SILENT_NOTIFICATION_CHANNEL_ID + } } override fun getChannelIdForTest(): String = NOISY_NOTIFICATION_CHANNEL_ID diff --git a/libraries/push/impl/src/main/kotlin/io/element/android/libraries/push/impl/notifications/factories/NotificationCreator.kt b/libraries/push/impl/src/main/kotlin/io/element/android/libraries/push/impl/notifications/factories/NotificationCreator.kt index 1102c7c9f6..4249c5653c 100755 --- a/libraries/push/impl/src/main/kotlin/io/element/android/libraries/push/impl/notifications/factories/NotificationCreator.kt +++ b/libraries/push/impl/src/main/kotlin/io/element/android/libraries/push/impl/notifications/factories/NotificationCreator.kt @@ -151,7 +151,10 @@ class DefaultNotificationCreator( val channelId = if (containsMissedCall) { notificationChannels.getChannelForIncomingCall(false) } else { - notificationChannels.getChannelIdForMessage(noisy = roomInfo.shouldBing) + notificationChannels.getChannelIdForMessage( + sessionId = roomInfo.sessionId, + noisy = roomInfo.shouldBing, + ) } // A category allows groups of notifications to be ranked and filtered – per user or system settings. // For example, alarm notifications should display before promo notifications, or message from known contact @@ -230,7 +233,10 @@ class DefaultNotificationCreator( notificationAccountParams: NotificationAccountParams, inviteNotifiableEvent: InviteNotifiableEvent, ): Notification { - val channelId = notificationChannels.getChannelIdForMessage(inviteNotifiableEvent.noisy) + val channelId = notificationChannels.getChannelIdForMessage( + sessionId = inviteNotifiableEvent.sessionId, + noisy = inviteNotifiableEvent.noisy, + ) return NotificationCompat.Builder(context, channelId) .setOnlyAlertOnce(true) .setContentTitle((inviteNotifiableEvent.roomName ?: buildMeta.applicationName).annotateForDebug(5)) @@ -270,7 +276,10 @@ class DefaultNotificationCreator( notificationAccountParams: NotificationAccountParams, simpleNotifiableEvent: SimpleNotifiableEvent, ): Notification { - val channelId = notificationChannels.getChannelIdForMessage(simpleNotifiableEvent.noisy) + val channelId = notificationChannels.getChannelIdForMessage( + sessionId = simpleNotifiableEvent.sessionId, + noisy = simpleNotifiableEvent.noisy, + ) return NotificationCompat.Builder(context, channelId) .setOnlyAlertOnce(true) .setContentTitle(buildMeta.applicationName.annotateForDebug(7)) @@ -302,7 +311,10 @@ class DefaultNotificationCreator( notificationAccountParams: NotificationAccountParams, fallbackNotifiableEvent: FallbackNotifiableEvent, ): Notification { - val channelId = notificationChannels.getChannelIdForMessage(false) + val channelId = notificationChannels.getChannelIdForMessage( + sessionId = fallbackNotifiableEvent.sessionId, + noisy = false, + ) return NotificationCompat.Builder(context, channelId) .setOnlyAlertOnce(true) .setContentTitle(buildMeta.applicationName.annotateForDebug(7)) @@ -334,8 +346,11 @@ class DefaultNotificationCreator( noisy: Boolean, lastMessageTimestamp: Long, ): Notification { - val channelId = notificationChannels.getChannelIdForMessage(noisy) val userId = notificationAccountParams.user.userId + val channelId = notificationChannels.getChannelIdForMessage( + sessionId = userId, + noisy = noisy, + ) return NotificationCompat.Builder(context, channelId) .setOnlyAlertOnce(true) // used in compat < N, after summary is built based on child notifications diff --git a/libraries/push/impl/src/test/kotlin/io/element/android/libraries/push/impl/notifications/DefaultBaseRoomGroupMessageCreatorTest.kt b/libraries/push/impl/src/test/kotlin/io/element/android/libraries/push/impl/notifications/DefaultBaseRoomGroupMessageCreatorTest.kt index 542608254a..3caec04add 100644 --- a/libraries/push/impl/src/test/kotlin/io/element/android/libraries/push/impl/notifications/DefaultBaseRoomGroupMessageCreatorTest.kt +++ b/libraries/push/impl/src/test/kotlin/io/element/android/libraries/push/impl/notifications/DefaultBaseRoomGroupMessageCreatorTest.kt @@ -13,6 +13,8 @@ import android.os.Build import androidx.core.app.NotificationCompat import com.google.common.truth.Truth.assertThat import io.element.android.appconfig.NotificationConfig +import io.element.android.features.enterprise.api.EnterpriseService +import io.element.android.features.enterprise.test.FakeEnterpriseService import io.element.android.libraries.matrix.api.media.MediaSource import io.element.android.libraries.matrix.test.A_ROOM_ID import io.element.android.libraries.matrix.test.A_TIMESTAMP @@ -66,7 +68,11 @@ class DefaultBaseRoomGroupMessageCreatorTest { @Test fun `test createRoomMessage with one noisy Event`() = runTest { - val sut = createRoomGroupMessageCreator() + val sut = createRoomGroupMessageCreator( + enterpriseService = FakeEnterpriseService( + getNoisyNotificationChannelIdResult = { null } + ) + ) val fakeImageLoader = FakeImageLoader() val result = sut.createRoomMessage( notificationAccountParams = aNotificationAccountParams(), @@ -228,6 +234,7 @@ class DefaultBaseRoomGroupMessageCreatorTest { fun createRoomGroupMessageCreator( sdkIntProvider: BuildVersionSdkIntProvider = FakeBuildVersionSdkIntProvider(Build.VERSION_CODES.O), + enterpriseService: EnterpriseService = FakeEnterpriseService(), ): RoomGroupMessageCreator { val context = RuntimeEnvironment.getApplication() as Context val bitmapLoader = DefaultNotificationBitmapLoader( @@ -236,7 +243,10 @@ fun createRoomGroupMessageCreator( initialsAvatarBitmapGenerator = FakeInitialsAvatarBitmapGenerator(), ) return DefaultRoomGroupMessageCreator( - notificationCreator = createNotificationCreator(bitmapLoader = bitmapLoader), + notificationCreator = createNotificationCreator( + bitmapLoader = bitmapLoader, + enterpriseService = enterpriseService, + ), bitmapLoader = bitmapLoader, stringProvider = AndroidStringProvider(context.resources) ) diff --git a/libraries/push/impl/src/test/kotlin/io/element/android/libraries/push/impl/notifications/channels/FakeNotificationChannels.kt b/libraries/push/impl/src/test/kotlin/io/element/android/libraries/push/impl/notifications/channels/FakeNotificationChannels.kt index 6caf02b41b..194caf7287 100644 --- a/libraries/push/impl/src/test/kotlin/io/element/android/libraries/push/impl/notifications/channels/FakeNotificationChannels.kt +++ b/libraries/push/impl/src/test/kotlin/io/element/android/libraries/push/impl/notifications/channels/FakeNotificationChannels.kt @@ -8,17 +8,19 @@ package io.element.android.libraries.push.impl.notifications.channels +import io.element.android.libraries.matrix.api.core.SessionId + class FakeNotificationChannels( var channelForIncomingCall: (ring: Boolean) -> String = { _ -> "" }, - var channelIdForMessage: (noisy: Boolean) -> String = { _ -> "" }, + var channelIdForMessage: (sessionId: SessionId, noisy: Boolean) -> String = { _, _ -> "" }, var channelIdForTest: () -> String = { "" } ) : NotificationChannels { override fun getChannelForIncomingCall(ring: Boolean): String { return channelForIncomingCall(ring) } - override fun getChannelIdForMessage(noisy: Boolean): String { - return channelIdForMessage(noisy) + override fun getChannelIdForMessage(sessionId: SessionId, noisy: Boolean): String { + return channelIdForMessage(sessionId, noisy) } override fun getChannelIdForTest(): String { diff --git a/libraries/push/impl/src/test/kotlin/io/element/android/libraries/push/impl/notifications/channels/NotificationChannelsTest.kt b/libraries/push/impl/src/test/kotlin/io/element/android/libraries/push/impl/notifications/channels/NotificationChannelsTest.kt index e6b28831bd..b004c35537 100644 --- a/libraries/push/impl/src/test/kotlin/io/element/android/libraries/push/impl/notifications/channels/NotificationChannelsTest.kt +++ b/libraries/push/impl/src/test/kotlin/io/element/android/libraries/push/impl/notifications/channels/NotificationChannelsTest.kt @@ -12,6 +12,9 @@ import android.os.Build import androidx.core.app.NotificationChannelCompat import androidx.core.app.NotificationManagerCompat import com.google.common.truth.Truth.assertThat +import io.element.android.features.enterprise.api.EnterpriseService +import io.element.android.features.enterprise.test.FakeEnterpriseService +import io.element.android.libraries.matrix.test.A_SESSION_ID import io.element.android.services.toolbox.test.strings.FakeStringProvider import io.mockk.every import io.mockk.mockk @@ -50,10 +53,28 @@ class NotificationChannelsTest { @Test fun `getChannelIdForMessage - returns the right channel`() { - val notificationChannels = createNotificationChannels() + val notificationChannels = createNotificationChannels( + enterpriseService = FakeEnterpriseService( + getNoisyNotificationChannelIdResult = { null } + ), + ) + assertThat(notificationChannels.getChannelIdForMessage(sessionId = A_SESSION_ID, noisy = true)) + .isEqualTo(NOISY_NOTIFICATION_CHANNEL_ID) + assertThat(notificationChannels.getChannelIdForMessage(sessionId = A_SESSION_ID, noisy = false)) + .isEqualTo(SILENT_NOTIFICATION_CHANNEL_ID) + } - assertThat(notificationChannels.getChannelIdForMessage(noisy = true)).isEqualTo(NOISY_NOTIFICATION_CHANNEL_ID) - assertThat(notificationChannels.getChannelIdForMessage(noisy = false)).isEqualTo(SILENT_NOTIFICATION_CHANNEL_ID) + @Test + fun `getChannelIdForMessage - returns the right channel when enterprise service override the result`() { + val notificationChannels = createNotificationChannels( + enterpriseService = FakeEnterpriseService( + getNoisyNotificationChannelIdResult = { "A_CHANNEL_ID" } + ), + ) + assertThat(notificationChannels.getChannelIdForMessage(sessionId = A_SESSION_ID, noisy = true)) + .isEqualTo("A_CHANNEL_ID") + assertThat(notificationChannels.getChannelIdForMessage(sessionId = A_SESSION_ID, noisy = false)) + .isEqualTo(SILENT_NOTIFICATION_CHANNEL_ID) } @Test @@ -65,9 +86,11 @@ class NotificationChannelsTest { private fun createNotificationChannels( notificationManager: NotificationManagerCompat = mockk(relaxed = true), + enterpriseService: EnterpriseService = FakeEnterpriseService(), ) = DefaultNotificationChannels( notificationManager = notificationManager, stringProvider = FakeStringProvider(), context = RuntimeEnvironment.getApplication(), + enterpriseService = enterpriseService, ) } diff --git a/libraries/push/impl/src/test/kotlin/io/element/android/libraries/push/impl/notifications/factories/DefaultNotificationCreatorTest.kt b/libraries/push/impl/src/test/kotlin/io/element/android/libraries/push/impl/notifications/factories/DefaultNotificationCreatorTest.kt index 0504ae433b..f2649ec32e 100644 --- a/libraries/push/impl/src/test/kotlin/io/element/android/libraries/push/impl/notifications/factories/DefaultNotificationCreatorTest.kt +++ b/libraries/push/impl/src/test/kotlin/io/element/android/libraries/push/impl/notifications/factories/DefaultNotificationCreatorTest.kt @@ -15,6 +15,8 @@ import androidx.core.app.NotificationCompat import androidx.core.app.NotificationManagerCompat import com.google.common.truth.Truth.assertThat import io.element.android.appconfig.NotificationConfig +import io.element.android.features.enterprise.api.EnterpriseService +import io.element.android.features.enterprise.test.FakeEnterpriseService import io.element.android.libraries.core.meta.BuildMeta import io.element.android.libraries.matrix.test.AN_EVENT_ID import io.element.android.libraries.matrix.test.A_COLOR_INT @@ -129,7 +131,11 @@ class DefaultNotificationCreatorTest { @Test fun `test createSimpleEventNotification noisy`() { - val sut = createNotificationCreator() + val sut = createNotificationCreator( + enterpriseService = FakeEnterpriseService( + getNoisyNotificationChannelIdResult = { null }, + ), + ) val result = sut.createSimpleEventNotification( notificationAccountParams = aNotificationAccountParams(), SimpleNotifiableEvent( @@ -189,7 +195,11 @@ class DefaultNotificationCreatorTest { @Test fun `test createRoomInvitationNotification noisy`() { - val sut = createNotificationCreator() + val sut = createNotificationCreator( + enterpriseService = FakeEnterpriseService( + getNoisyNotificationChannelIdResult = { null }, + ), + ) val result = sut.createRoomInvitationNotification( notificationAccountParams = aNotificationAccountParams(), InviteNotifiableEvent( @@ -231,7 +241,11 @@ class DefaultNotificationCreatorTest { @Test fun `test createSummaryListNotification noisy`() { - val sut = createNotificationCreator() + val sut = createNotificationCreator( + enterpriseService = FakeEnterpriseService( + getNoisyNotificationChannelIdResult = { null }, + ), + ) val matrixUser = aMatrixUser() val result = sut.createSummaryListNotification( notificationAccountParams = aNotificationAccountParams(user = matrixUser), @@ -271,7 +285,11 @@ class DefaultNotificationCreatorTest { @Test fun `test createMessagesListNotification should bing and thread`() = runTest { - val sut = createNotificationCreator() + val sut = createNotificationCreator( + enterpriseService = FakeEnterpriseService( + getNoisyNotificationChannelIdResult = { null }, + ), + ) val result = sut.createMessagesListNotification( notificationAccountParams = aNotificationAccountParams(), roomInfo = RoomEventGroupInfo( @@ -312,7 +330,8 @@ const val REJECT_INVITATION_ACTION_TITLE = "RejectInvitationAction" fun createNotificationCreator( context: Context = RuntimeEnvironment.getApplication(), buildMeta: BuildMeta = aBuildMeta(), - notificationChannels: NotificationChannels = createNotificationChannels(), + enterpriseService: EnterpriseService = FakeEnterpriseService(), + notificationChannels: NotificationChannels = createNotificationChannels(enterpriseService), bitmapLoader: NotificationBitmapLoader = DefaultNotificationBitmapLoader( context = context, sdkIntProvider = FakeBuildVersionSdkIntProvider(Build.VERSION_CODES.R), @@ -358,11 +377,14 @@ fun createNotificationCreator( ) } -fun createNotificationChannels(): NotificationChannels { +fun createNotificationChannels( + enterpriseService: EnterpriseService = FakeEnterpriseService(), +): NotificationChannels { val context = RuntimeEnvironment.getApplication() return DefaultNotificationChannels( notificationManager = NotificationManagerCompat.from(context), stringProvider = FakeStringProvider(""), context = context, + enterpriseService = enterpriseService, ) } diff --git a/libraries/wellknown/api/src/main/kotlin/io/element/android/libraries/wellknown/api/ElementWellKnown.kt b/libraries/wellknown/api/src/main/kotlin/io/element/android/libraries/wellknown/api/ElementWellKnown.kt index 7dc230d2e1..134a9bcdb5 100644 --- a/libraries/wellknown/api/src/main/kotlin/io/element/android/libraries/wellknown/api/ElementWellKnown.kt +++ b/libraries/wellknown/api/src/main/kotlin/io/element/android/libraries/wellknown/api/ElementWellKnown.kt @@ -13,4 +13,5 @@ data class ElementWellKnown( val enforceElementPro: Boolean?, val rageshakeUrl: String?, val brandColor: String?, + val notificationSound: String?, ) diff --git a/libraries/wellknown/impl/src/main/kotlin/io/element/android/libraries/wellknown/impl/InternalElementWellKnown.kt b/libraries/wellknown/impl/src/main/kotlin/io/element/android/libraries/wellknown/impl/InternalElementWellKnown.kt index c79d8fa4c3..d4661d1be0 100644 --- a/libraries/wellknown/impl/src/main/kotlin/io/element/android/libraries/wellknown/impl/InternalElementWellKnown.kt +++ b/libraries/wellknown/impl/src/main/kotlin/io/element/android/libraries/wellknown/impl/InternalElementWellKnown.kt @@ -30,4 +30,6 @@ data class InternalElementWellKnown( val rageshakeUrl: String? = null, @SerialName("brand_color") val brandColor: String? = null, + @SerialName("notification_sound") + val notificationSound: String? = null, ) diff --git a/libraries/wellknown/impl/src/main/kotlin/io/element/android/libraries/wellknown/impl/Mapper.kt b/libraries/wellknown/impl/src/main/kotlin/io/element/android/libraries/wellknown/impl/Mapper.kt index d3f57806b3..c7ca088e68 100644 --- a/libraries/wellknown/impl/src/main/kotlin/io/element/android/libraries/wellknown/impl/Mapper.kt +++ b/libraries/wellknown/impl/src/main/kotlin/io/element/android/libraries/wellknown/impl/Mapper.kt @@ -15,4 +15,5 @@ internal fun InternalElementWellKnown.map() = ElementWellKnown( enforceElementPro = enforceElementPro, rageshakeUrl = rageshakeUrl, brandColor = brandColor, + notificationSound = notificationSound, ) diff --git a/libraries/wellknown/impl/src/test/kotlin/io/element/android/libraries/wellknown/impl/DefaultSessionWellknownRetrieverTest.kt b/libraries/wellknown/impl/src/test/kotlin/io/element/android/libraries/wellknown/impl/DefaultSessionWellknownRetrieverTest.kt index 4e384dbc0d..faad139a36 100644 --- a/libraries/wellknown/impl/src/test/kotlin/io/element/android/libraries/wellknown/impl/DefaultSessionWellknownRetrieverTest.kt +++ b/libraries/wellknown/impl/src/test/kotlin/io/element/android/libraries/wellknown/impl/DefaultSessionWellknownRetrieverTest.kt @@ -35,6 +35,7 @@ class DefaultSessionWellknownRetrieverTest { enforceElementPro = null, rageshakeUrl = null, brandColor = null, + notificationSound = null, ) ) ) @@ -51,7 +52,8 @@ class DefaultSessionWellknownRetrieverTest { "registration_helper_url": "a_registration_url", "enforce_element_pro": true, "rageshake_url": "a_rageshake_url", - "brand_color": "#FF0000" + "brand_color": "#FF0000", + "notification_sound": "a_notification_sound.flac" }""".trimIndent().toByteArray() ) } @@ -63,6 +65,7 @@ class DefaultSessionWellknownRetrieverTest { enforceElementPro = true, rageshakeUrl = "a_rageshake_url", brandColor = "#FF0000", + notificationSound = "a_notification_sound.flac", ) ) ) @@ -89,6 +92,7 @@ class DefaultSessionWellknownRetrieverTest { enforceElementPro = true, rageshakeUrl = "a_rageshake_url", brandColor = null, + notificationSound = null, ) ) ) diff --git a/libraries/wellknown/test/src/main/kotlin/io/element/android/features/wellknown/test/Fixtures.kt b/libraries/wellknown/test/src/main/kotlin/io/element/android/features/wellknown/test/Fixtures.kt index b5fd9f6020..7457aafc98 100644 --- a/libraries/wellknown/test/src/main/kotlin/io/element/android/features/wellknown/test/Fixtures.kt +++ b/libraries/wellknown/test/src/main/kotlin/io/element/android/features/wellknown/test/Fixtures.kt @@ -15,9 +15,11 @@ fun anElementWellKnown( enforceElementPro: Boolean? = null, rageshakeUrl: String? = null, brandColor: String? = null, + notificationSound: String? = null, ) = ElementWellKnown( registrationHelperUrl = registrationHelperUrl, enforceElementPro = enforceElementPro, rageshakeUrl = rageshakeUrl, brandColor = brandColor, + notificationSound = notificationSound, )