Rust sdk : handle the remaining changes
This commit is contained in:
parent
18959a930f
commit
f06b2290ea
6 changed files with 12 additions and 6 deletions
|
|
@ -53,6 +53,7 @@ sealed interface NotificationContent {
|
||||||
data class CallInvite(
|
data class CallInvite(
|
||||||
val senderId: UserId,
|
val senderId: UserId,
|
||||||
) : MessageLike
|
) : MessageLike
|
||||||
|
|
||||||
data class CallNotify(
|
data class CallNotify(
|
||||||
val senderId: UserId,
|
val senderId: UserId,
|
||||||
val type: CallNotifyType,
|
val type: CallNotifyType,
|
||||||
|
|
@ -77,7 +78,11 @@ sealed interface NotificationContent {
|
||||||
val messageType: MessageType
|
val messageType: MessageType
|
||||||
) : MessageLike
|
) : MessageLike
|
||||||
|
|
||||||
data object RoomRedaction : MessageLike
|
data class RoomRedaction(
|
||||||
|
val redactedEventId: String?,
|
||||||
|
val reason: String?
|
||||||
|
) : MessageLike
|
||||||
|
|
||||||
data object Sticker : MessageLike
|
data object Sticker : MessageLike
|
||||||
data class Poll(
|
data class Poll(
|
||||||
val senderId: UserId,
|
val senderId: UserId,
|
||||||
|
|
|
||||||
|
|
@ -93,7 +93,8 @@ class RustMatrixClientFactory @Inject constructor(
|
||||||
slidingSync: ClientBuilderSlidingSync,
|
slidingSync: ClientBuilderSlidingSync,
|
||||||
): ClientBuilder {
|
): ClientBuilder {
|
||||||
return 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)
|
.passphrase(passphrase)
|
||||||
.slidingSyncProxy(slidingSyncProxy)
|
.slidingSyncProxy(slidingSyncProxy)
|
||||||
.userAgent(userAgentProvider.provide())
|
.userAgent(userAgentProvider.provide())
|
||||||
|
|
|
||||||
|
|
@ -94,7 +94,7 @@ private fun MessageLikeEventContent.toContent(senderId: UserId): NotificationCon
|
||||||
is MessageLikeEventContent.RoomMessage -> {
|
is MessageLikeEventContent.RoomMessage -> {
|
||||||
NotificationContent.MessageLike.RoomMessage(senderId, EventMessageMapper().mapMessageType(messageType))
|
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
|
MessageLikeEventContent.Sticker -> NotificationContent.MessageLike.Sticker
|
||||||
is MessageLikeEventContent.Poll -> NotificationContent.MessageLike.Poll(senderId, question)
|
is MessageLikeEventContent.Poll -> NotificationContent.MessageLike.Poll(senderId, question)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -56,7 +56,7 @@ class MatrixRoomInfoMapper {
|
||||||
userPowerLevels = mapPowerLevels(it.userPowerLevels),
|
userPowerLevels = mapPowerLevels(it.userPowerLevels),
|
||||||
highlightCount = it.highlightCount.toLong(),
|
highlightCount = it.highlightCount.toLong(),
|
||||||
notificationCount = it.notificationCount.toLong(),
|
notificationCount = it.notificationCount.toLong(),
|
||||||
userDefinedNotificationMode = it.userDefinedNotificationMode?.map(),
|
userDefinedNotificationMode = it.cachedUserDefinedNotificationMode?.map(),
|
||||||
hasRoomCall = it.hasRoomCall,
|
hasRoomCall = it.hasRoomCall,
|
||||||
activeRoomCallParticipants = it.activeRoomCallParticipants.toImmutableList(),
|
activeRoomCallParticipants = it.activeRoomCallParticipants.toImmutableList(),
|
||||||
heroes = it.elementHeroes().toImmutableList(),
|
heroes = it.elementHeroes().toImmutableList(),
|
||||||
|
|
|
||||||
|
|
@ -47,7 +47,7 @@ class RoomSummaryDetailsFactory(private val roomMessageFactory: RoomMessageFacto
|
||||||
isMarkedUnread = roomInfo.isMarkedUnread,
|
isMarkedUnread = roomInfo.isMarkedUnread,
|
||||||
lastMessage = latestRoomMessage,
|
lastMessage = latestRoomMessage,
|
||||||
inviter = roomInfo.inviter?.let(RoomMemberMapper::map),
|
inviter = roomInfo.inviter?.let(RoomMemberMapper::map),
|
||||||
userDefinedNotificationMode = roomInfo.userDefinedNotificationMode?.let(RoomNotificationSettingsMapper::mapMode),
|
userDefinedNotificationMode = roomInfo.cachedUserDefinedNotificationMode?.let(RoomNotificationSettingsMapper::mapMode),
|
||||||
hasRoomCall = roomInfo.hasRoomCall,
|
hasRoomCall = roomInfo.hasRoomCall,
|
||||||
isDm = isDm(isDirect = roomInfo.isDirect, activeMembersCount = roomInfo.activeMembersCount.toInt()),
|
isDm = isDm(isDirect = roomInfo.isDirect, activeMembersCount = roomInfo.activeMembersCount.toInt()),
|
||||||
isFavorite = roomInfo.isFavourite,
|
isFavorite = roomInfo.isFavourite,
|
||||||
|
|
|
||||||
|
|
@ -204,7 +204,7 @@ class DefaultNotifiableEventResolver @Inject constructor(
|
||||||
NotificationContent.MessageLike.RoomEncrypted -> fallbackNotifiableEvent(userId, roomId, eventId).also {
|
NotificationContent.MessageLike.RoomEncrypted -> fallbackNotifiableEvent(userId, roomId, eventId).also {
|
||||||
Timber.tag(loggerTag.value).w("Notification with encrypted content -> fallback")
|
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")
|
Timber.tag(loggerTag.value).d("Ignoring notification for redaction")
|
||||||
}
|
}
|
||||||
NotificationContent.MessageLike.Sticker -> null.also {
|
NotificationContent.MessageLike.Sticker -> null.also {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue