Merge branch 'develop' into julioromano/poll_history_entry_point

This commit is contained in:
Benoit Marty 2023-12-14 17:34:49 +01:00 committed by GitHub
commit 8f286c8ce6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
54 changed files with 220 additions and 153 deletions

View file

@ -41,4 +41,5 @@ interface NotificationSettingsService {
suspend fun isInviteForMeEnabled(): Result<Boolean>
suspend fun setInviteForMeEnabled(enabled: Boolean): Result<Unit>
suspend fun getRoomsWithUserDefinedRules(): Result<List<String>>
suspend fun canHomeServerPushEncryptedEventsToDevice(): Result<Boolean>
}

View file

@ -140,4 +140,9 @@ class RustNotificationSettingsService(
runCatching {
notificationSettings.getRoomsWithUserDefinedRules(enabled = true)
}
override suspend fun canHomeServerPushEncryptedEventsToDevice(): Result<Boolean> =
runCatching {
notificationSettings.canHomeserverPushEncryptedEventToDevice()
}
}

View file

@ -47,6 +47,7 @@ class FakeNotificationSettingsService(
private var restoreDefaultNotificationModeError: Throwable? = null
private var setDefaultNotificationModeError: Throwable? = null
private var setAtRoomError: Throwable? = null
private var canHomeServerPushEncryptedEventsToDeviceResult = Result.success(true)
override val notificationSettingsChangeFlow: SharedFlow<Unit>
get() = _notificationSettingsStateFlow
@ -163,6 +164,10 @@ class FakeNotificationSettingsService(
return Result.success(if (roomNotificationModeIsDefault) listOf() else listOf(A_ROOM_ID.value))
}
override suspend fun canHomeServerPushEncryptedEventsToDevice(): Result<Boolean> {
return canHomeServerPushEncryptedEventsToDeviceResult
}
fun givenSetNotificationModeError(throwable: Throwable?) {
setNotificationModeError = throwable
}
@ -178,4 +183,8 @@ class FakeNotificationSettingsService(
fun givenSetDefaultNotificationModeError(throwable: Throwable?) {
setDefaultNotificationModeError = throwable
}
fun givenCanHomeServerPushEncryptedEventsToDeviceResult(result: Result<Boolean>) {
canHomeServerPushEncryptedEventsToDeviceResult = result
}
}