Merge branch 'develop' into feature/fga/message_queuing

This commit is contained in:
ganfra 2024-06-11 17:08:47 +02:00
commit b927daffe7
620 changed files with 6821 additions and 1244 deletions

View file

@ -33,3 +33,5 @@ value class ThreadId(val value: String) : Serializable {
override fun toString(): String = value
}
fun ThreadId.asEventId(): EventId = EventId(value)

View file

@ -330,5 +330,10 @@ interface MatrixRoom : Closeable {
*/
suspend fun getPermalinkFor(eventId: EventId): Result<String>
/**
* Send an Element Call started notification if needed.
*/
suspend fun sendCallNotificationIfNeeded(): Result<Unit>
override fun close() = destroy()
}

View file

@ -57,7 +57,13 @@ interface Timeline : AutoCloseable {
suspend fun enterSpecialMode(eventId: EventId?): Result<Unit>
suspend fun replyMessage(eventId: EventId, body: String, htmlBody: String?, mentions: List<Mention>): Result<Unit>
suspend fun replyMessage(
eventId: EventId,
body: String,
htmlBody: String?,
mentions: List<Mention>,
fromNotification: Boolean = false,
): Result<Unit>
suspend fun sendImage(
file: File,

View file

@ -19,6 +19,7 @@ package io.element.android.libraries.matrix.api.timeline.item.event
import androidx.compose.runtime.Immutable
import io.element.android.libraries.matrix.api.core.UserId
import io.element.android.libraries.matrix.api.media.ImageInfo
import io.element.android.libraries.matrix.api.media.MediaSource
import io.element.android.libraries.matrix.api.poll.PollAnswer
import io.element.android.libraries.matrix.api.poll.PollKind
import kotlinx.collections.immutable.ImmutableList
@ -40,7 +41,7 @@ data object RedactedContent : EventContent
data class StickerContent(
val body: String,
val info: ImageInfo,
val url: String
val source: MediaSource,
) : EventContent
data class PollContent(
@ -102,4 +103,6 @@ data class FailedToParseStateContent(
data object LegacyCallInviteContent : EventContent
data object CallNotifyContent : EventContent
data object UnknownContent : EventContent

View file

@ -72,6 +72,7 @@ object EventType {
const val CALL_NEGOTIATE = "m.call.negotiate"
const val CALL_REJECT = "m.call.reject"
const val CALL_HANGUP = "m.call.hangup"
const val CALL_NOTIFY = "m.call.notify"
// This type is not processed by the client, just sent to the server
const val CALL_REPLACES = "m.call.replaces"
@ -94,6 +95,7 @@ object EventType {
type == CALL_SELECT_ANSWER ||
type == CALL_NEGOTIATE ||
type == CALL_REJECT ||
type == CALL_REPLACES
type == CALL_REPLACES ||
type == CALL_NOTIFY
}
}

View file

@ -17,9 +17,8 @@
package io.element.android.libraries.matrix.api.notification
import com.google.common.truth.Truth.assertThat
import io.element.android.libraries.matrix.test.AN_EVENT_ID
import io.element.android.libraries.matrix.test.A_ROOM_ID
import io.element.android.libraries.matrix.test.A_USER_ID
import io.element.android.libraries.matrix.test.notification.aNotificationData
import org.junit.Test
class NotificationDataTest {
@ -49,25 +48,4 @@ class NotificationDataTest {
)
assertThat(sut.getDisambiguatedDisplayName(A_USER_ID)).isEqualTo("Alice (@alice:server.org)")
}
private fun aNotificationData(
senderDisplayName: String?,
senderIsNameAmbiguous: Boolean,
): NotificationData {
return NotificationData(
eventId = AN_EVENT_ID,
roomId = A_ROOM_ID,
senderAvatarUrl = null,
senderDisplayName = senderDisplayName,
senderIsNameAmbiguous = senderIsNameAmbiguous,
roomAvatarUrl = null,
roomDisplayName = null,
isDirect = false,
isEncrypted = false,
isNoisy = false,
timestamp = 0L,
content = NotificationContent.MessageLike.RoomEncrypted,
hasMention = false,
)
}
}