1
0
mirror of https://github.com/vector-im/element-android.git synced 2025-07-31 07:04:23 +03:00

Merge pull request #8941 from element-hq/feature/bma/elementCall

Element call incoming call
This commit is contained in:
Benoit Marty
2024-11-12 16:40:12 +01:00
committed by GitHub
15 changed files with 319 additions and 7 deletions

View File

@ -499,7 +499,11 @@ fun Event.getPollContent(): MessagePollContent? {
}
fun Event.supportsNotification() =
this.getClearType() in EventType.MESSAGE + EventType.POLL_START.values + EventType.POLL_END.values + EventType.STATE_ROOM_BEACON_INFO.values
this.getClearType() in EventType.MESSAGE +
EventType.POLL_START.values +
EventType.POLL_END.values +
EventType.STATE_ROOM_BEACON_INFO.values +
EventType.ELEMENT_CALL_NOTIFY.values
fun Event.isContentReportable() =
this.getClearType() in EventType.MESSAGE + EventType.STATE_ROOM_BEACON_INFO.values

View File

@ -87,6 +87,9 @@ object EventType {
// This type is not processed by the client, just sent to the server
const val CALL_REPLACES = "m.call.replaces"
// Element Call
val ELEMENT_CALL_NOTIFY = StableUnstableId(stable = "m.call.notify", unstable = "org.matrix.msc4075.call.notify")
// Key share events
const val ROOM_KEY_REQUEST = "m.room_key_request"
const val FORWARDED_ROOM_KEY = "m.forwarded_room_key"

View File

@ -0,0 +1,39 @@
/*
* Copyright 2024 The Matrix.org Foundation C.I.C.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.matrix.android.sdk.api.session.room.model.message
import com.squareup.moshi.Json
import com.squareup.moshi.JsonClass
@JsonClass(generateAdapter = true)
data class ElementCallNotifyContent(
@Json(name = "application") val application: String? = null,
@Json(name = "call_id") val callId: String? = null,
@Json(name = "m.mentions") val mentions: Mentions? = null,
@Json(name = "notify_type") val notifyType: String? = null,
)
@JsonClass(generateAdapter = true)
data class Mentions(
@Json(name = "room") val room: Boolean? = null,
@Json(name = "user_ids") val userIds: List<String>? = null,
)
fun ElementCallNotifyContent.isUserMentioned(userId: String): Boolean {
return mentions?.room == true ||
mentions?.userIds?.contains(userId) == true
}

View File

@ -61,6 +61,7 @@ internal class DefaultProcessEventForPushTask @Inject constructor(
in EventType.POLL_START.values,
in EventType.POLL_END.values,
in EventType.STATE_ROOM_BEACON_INFO.values,
in EventType.ELEMENT_CALL_NOTIFY.values,
EventType.MESSAGE,
EventType.REDACTION,
EventType.ENCRYPTED,