Let MatrixClient exposes val instead of fun for the services.

This commit is contained in:
Benoit Marty 2025-10-01 18:22:31 +02:00 committed by Benoit Marty
parent 68700d9bf9
commit 77647a3f11
27 changed files with 129 additions and 155 deletions

View file

@ -50,7 +50,7 @@ class DefaultPusherSubscriber(
Timber.tag(loggerTag.value)
.d("Unnecessary to register again the same pusher, but do it in case the pusher has been removed from the server")
}
return matrixClient.pushersService()
return matrixClient.pushersService
.setHttpPusher(
createHttpPusher(pushKey, gateway, matrixClient.sessionId)
)
@ -100,7 +100,7 @@ class DefaultPusherSubscriber(
gateway: String,
): Result<Unit> {
val userDataStore = userPushStoreFactory.getOrCreate(matrixClient.sessionId)
return matrixClient.pushersService()
return matrixClient.pushersService
.unsetHttpPusher(
unsetHttpPusherData = UnsetHttpPusherData(
pushKey = pushKey,

View file

@ -98,7 +98,7 @@ class DefaultNotifiableEventResolver(
val ids = notificationEventRequests.groupBy { it.roomId }.mapValues { (_, value) -> value.map { it.eventId } }
// TODO this notificationData is not always valid at the moment, sometimes the Rust SDK can't fetch the matching event
val notificationsResult = client.notificationService().getNotifications(ids)
val notificationsResult = client.notificationService.getNotifications(ids)
if (notificationsResult.isFailure) {
val exception = notificationsResult.exceptionOrNull()
@ -131,7 +131,7 @@ class DefaultNotifiableEventResolver(
): Result<ResolvedPushEvent> = runCatchingExceptions {
when (val content = this.content) {
is NotificationContent.MessageLike.RoomMessage -> {
val showMediaPreview = client.mediaPreviewService().getMediaPreviewValue() == MediaPreviewValue.On
val showMediaPreview = client.mediaPreviewService.getMediaPreviewValue() == MediaPreviewValue.On
val senderDisambiguatedDisplayName = getDisambiguatedDisplayName(content.senderId)
val messageBody = descriptionFromMessageContent(content, senderDisambiguatedDisplayName)
val notifiableMessageEvent = buildNotifiableMessageEvent(

View file

@ -30,7 +30,7 @@ class DefaultOnMissedCallNotificationHandler(
) {
// Resolve the event and add a notification for it, at this point it should no longer be a ringing one
val notificationData = matrixClientProvider.getOrRestore(sessionId).getOrNull()
?.notificationService()
?.notificationService
?.getNotifications(mapOf(roomId to listOf(eventId)))
?.getOrNull()
?.get(eventId)