Improve API: use RoomId instead of String.
This commit is contained in:
@@ -32,7 +32,7 @@ interface NotificationSettingsService {
|
||||
suspend fun setCallEnabled(enabled: Boolean): Result<Unit>
|
||||
suspend fun isInviteForMeEnabled(): Result<Boolean>
|
||||
suspend fun setInviteForMeEnabled(enabled: Boolean): Result<Unit>
|
||||
suspend fun getRoomsWithUserDefinedRules(): Result<List<String>>
|
||||
suspend fun getRoomsWithUserDefinedRules(): Result<List<RoomId>>
|
||||
suspend fun canHomeServerPushEncryptedEventsToDevice(): Result<Boolean>
|
||||
suspend fun getRawPushRules(): Result<String?>
|
||||
}
|
||||
|
||||
@@ -131,9 +131,9 @@ class RustNotificationSettingsService(
|
||||
}
|
||||
}
|
||||
|
||||
override suspend fun getRoomsWithUserDefinedRules(): Result<List<String>> =
|
||||
override suspend fun getRoomsWithUserDefinedRules(): Result<List<RoomId>> =
|
||||
runCatchingExceptions {
|
||||
notificationSettings.await().getRoomsWithUserDefinedRules(enabled = true)
|
||||
notificationSettings.await().getRoomsWithUserDefinedRules(enabled = true).map(::RoomId)
|
||||
}
|
||||
|
||||
override suspend fun canHomeServerPushEncryptedEventsToDevice(): Result<Boolean> =
|
||||
|
||||
@@ -25,7 +25,7 @@ class FakeNotificationSettingsService(
|
||||
initialOneToOneDefaultMode: RoomNotificationMode = RoomNotificationMode.ALL_MESSAGES,
|
||||
initialEncryptedOneToOneDefaultMode: RoomNotificationMode = RoomNotificationMode.ALL_MESSAGES,
|
||||
private val getRawPushRulesResult: () -> Result<String> = { lambdaError() },
|
||||
private val getRoomsWithUserDefinedRulesResult: () -> Result<List<String>> = { lambdaError() },
|
||||
private val getRoomsWithUserDefinedRulesResult: () -> Result<List<RoomId>> = { lambdaError() },
|
||||
) : NotificationSettingsService {
|
||||
private val notificationSettingsStateFlow = MutableStateFlow(Unit)
|
||||
private var defaultGroupRoomNotificationMode: RoomNotificationMode = initialGroupDefaultMode
|
||||
@@ -154,7 +154,7 @@ class FakeNotificationSettingsService(
|
||||
return Result.success(Unit)
|
||||
}
|
||||
|
||||
override suspend fun getRoomsWithUserDefinedRules(): Result<List<String>> {
|
||||
override suspend fun getRoomsWithUserDefinedRules(): Result<List<RoomId>> {
|
||||
return getRoomsWithUserDefinedRulesResult()
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user