Rust sdk : handle the remaining changes
This commit is contained in:
@@ -53,6 +53,7 @@ sealed interface NotificationContent {
|
||||
data class CallInvite(
|
||||
val senderId: UserId,
|
||||
) : MessageLike
|
||||
|
||||
data class CallNotify(
|
||||
val senderId: UserId,
|
||||
val type: CallNotifyType,
|
||||
@@ -77,7 +78,11 @@ sealed interface NotificationContent {
|
||||
val messageType: MessageType
|
||||
) : MessageLike
|
||||
|
||||
data object RoomRedaction : MessageLike
|
||||
data class RoomRedaction(
|
||||
val redactedEventId: String?,
|
||||
val reason: String?
|
||||
) : MessageLike
|
||||
|
||||
data object Sticker : MessageLike
|
||||
data class Poll(
|
||||
val senderId: UserId,
|
||||
|
||||
@@ -93,7 +93,8 @@ class RustMatrixClientFactory @Inject constructor(
|
||||
slidingSync: ClientBuilderSlidingSync,
|
||||
): ClientBuilder {
|
||||
return ClientBuilder()
|
||||
.sessionPath(sessionPath)
|
||||
// TODO SDK claims it's valid to use the same path for data and cache, but would be better to use different paths
|
||||
.sessionPaths(dataPath = sessionPath, cachePath = sessionPath)
|
||||
.passphrase(passphrase)
|
||||
.slidingSyncProxy(slidingSyncProxy)
|
||||
.userAgent(userAgentProvider.provide())
|
||||
|
||||
@@ -94,7 +94,7 @@ private fun MessageLikeEventContent.toContent(senderId: UserId): NotificationCon
|
||||
is MessageLikeEventContent.RoomMessage -> {
|
||||
NotificationContent.MessageLike.RoomMessage(senderId, EventMessageMapper().mapMessageType(messageType))
|
||||
}
|
||||
MessageLikeEventContent.RoomRedaction -> NotificationContent.MessageLike.RoomRedaction
|
||||
is MessageLikeEventContent.RoomRedaction -> NotificationContent.MessageLike.RoomRedaction(redactedEventId = redactedEventId, reason = reason)
|
||||
MessageLikeEventContent.Sticker -> NotificationContent.MessageLike.Sticker
|
||||
is MessageLikeEventContent.Poll -> NotificationContent.MessageLike.Poll(senderId, question)
|
||||
}
|
||||
|
||||
@@ -56,7 +56,7 @@ class MatrixRoomInfoMapper {
|
||||
userPowerLevels = mapPowerLevels(it.userPowerLevels),
|
||||
highlightCount = it.highlightCount.toLong(),
|
||||
notificationCount = it.notificationCount.toLong(),
|
||||
userDefinedNotificationMode = it.userDefinedNotificationMode?.map(),
|
||||
userDefinedNotificationMode = it.cachedUserDefinedNotificationMode?.map(),
|
||||
hasRoomCall = it.hasRoomCall,
|
||||
activeRoomCallParticipants = it.activeRoomCallParticipants.toImmutableList(),
|
||||
heroes = it.elementHeroes().toImmutableList(),
|
||||
|
||||
@@ -47,7 +47,7 @@ class RoomSummaryDetailsFactory(private val roomMessageFactory: RoomMessageFacto
|
||||
isMarkedUnread = roomInfo.isMarkedUnread,
|
||||
lastMessage = latestRoomMessage,
|
||||
inviter = roomInfo.inviter?.let(RoomMemberMapper::map),
|
||||
userDefinedNotificationMode = roomInfo.userDefinedNotificationMode?.let(RoomNotificationSettingsMapper::mapMode),
|
||||
userDefinedNotificationMode = roomInfo.cachedUserDefinedNotificationMode?.let(RoomNotificationSettingsMapper::mapMode),
|
||||
hasRoomCall = roomInfo.hasRoomCall,
|
||||
isDm = isDm(isDirect = roomInfo.isDirect, activeMembersCount = roomInfo.activeMembersCount.toInt()),
|
||||
isFavorite = roomInfo.isFavourite,
|
||||
|
||||
@@ -204,7 +204,7 @@ class DefaultNotifiableEventResolver @Inject constructor(
|
||||
NotificationContent.MessageLike.RoomEncrypted -> fallbackNotifiableEvent(userId, roomId, eventId).also {
|
||||
Timber.tag(loggerTag.value).w("Notification with encrypted content -> fallback")
|
||||
}
|
||||
NotificationContent.MessageLike.RoomRedaction -> null.also {
|
||||
is NotificationContent.MessageLike.RoomRedaction -> null.also {
|
||||
Timber.tag(loggerTag.value).d("Ignoring notification for redaction")
|
||||
}
|
||||
NotificationContent.MessageLike.Sticker -> null.also {
|
||||
|
||||
Reference in New Issue
Block a user