-
Notifications
You must be signed in to change notification settings - Fork 741
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3452 from vector-im/feature/fga/voip_asserted_ide…
…ntity Feature/fga/voip asserted identity
- Loading branch information
Showing
18 changed files
with
327 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 57 additions & 0 deletions
57
...in/java/org/matrix/android/sdk/api/session/room/model/call/CallAssertedIdentityContent.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
/* | ||
* Copyright 2021 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.call | ||
|
||
import com.squareup.moshi.Json | ||
import com.squareup.moshi.JsonClass | ||
|
||
/** | ||
* This event is sent by the callee when they wish to answer the call. | ||
*/ | ||
@JsonClass(generateAdapter = true) | ||
data class CallAssertedIdentityContent( | ||
/** | ||
* Required. The ID of the call this event relates to. | ||
*/ | ||
@Json(name = "call_id") override val callId: String, | ||
/** | ||
* Required. ID to let user identify remote echo of their own events | ||
*/ | ||
@Json(name = "party_id") override val partyId: String? = null, | ||
/** | ||
* Required. The version of the VoIP specification this messages adheres to. | ||
*/ | ||
@Json(name = "version") override val version: String?, | ||
|
||
/** | ||
* Optional. Used to inform the transferee who they're now speaking to. | ||
*/ | ||
@Json(name = "asserted_identity") val assertedIdentity: AssertedIdentity? = null | ||
) : CallSignalingContent { | ||
|
||
/** | ||
* A user ID may be included if relevant, but unlike target_user, it is purely informational. | ||
* The asserted identity may not represent a matrix user at all, | ||
* in which case just a display_name may be given, or a perhaps a display_name and avatar_url. | ||
*/ | ||
@JsonClass(generateAdapter = true) | ||
data class AssertedIdentity( | ||
@Json(name = "id") val id: String? = null, | ||
@Json(name = "display_name") val displayName: String? = null, | ||
@Json(name = "avatar_url") val avatarUrl: String? = null | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Adds support for receiving MSC3086 Asserted Identity events. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
82 changes: 82 additions & 0 deletions
82
vector/src/main/java/im/vector/app/core/glide/AvatarPlaceholder.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
/* | ||
* Copyright (c) 2021 New Vector Ltd | ||
* | ||
* 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 im.vector.app.core.glide | ||
|
||
import android.content.Context | ||
import android.graphics.drawable.Drawable | ||
import com.bumptech.glide.Priority | ||
import com.bumptech.glide.load.DataSource | ||
import com.bumptech.glide.load.Options | ||
import com.bumptech.glide.load.data.DataFetcher | ||
import com.bumptech.glide.load.model.ModelLoader | ||
import com.bumptech.glide.load.model.ModelLoaderFactory | ||
import com.bumptech.glide.load.model.MultiModelLoaderFactory | ||
import com.bumptech.glide.signature.ObjectKey | ||
import im.vector.app.core.extensions.vectorComponent | ||
import org.matrix.android.sdk.api.util.MatrixItem | ||
|
||
data class AvatarPlaceholder(val matrixItem: MatrixItem) | ||
|
||
class AvatarPlaceholderModelLoaderFactory(private val context: Context) : ModelLoaderFactory<AvatarPlaceholder, Drawable> { | ||
|
||
override fun build(multiFactory: MultiModelLoaderFactory): ModelLoader<AvatarPlaceholder, Drawable> { | ||
return AvatarPlaceholderModelLoader(context) | ||
} | ||
|
||
override fun teardown() { | ||
// Is there something to do here? | ||
} | ||
} | ||
|
||
class AvatarPlaceholderModelLoader(private val context: Context) | ||
: ModelLoader<AvatarPlaceholder, Drawable> { | ||
|
||
override fun buildLoadData(model: AvatarPlaceholder, width: Int, height: Int, options: Options): ModelLoader.LoadData<Drawable>? { | ||
return ModelLoader.LoadData(ObjectKey(model), AvatarPlaceholderDataFetcher(context, model)) | ||
} | ||
|
||
override fun handles(model: AvatarPlaceholder): Boolean { | ||
return true | ||
} | ||
} | ||
|
||
class AvatarPlaceholderDataFetcher(context: Context, private val data: AvatarPlaceholder) | ||
: DataFetcher<Drawable> { | ||
|
||
private val avatarRenderer = context.vectorComponent().avatarRenderer() | ||
|
||
override fun loadData(priority: Priority, callback: DataFetcher.DataCallback<in Drawable>) { | ||
val avatarPlaceholder = avatarRenderer.getPlaceholderDrawable(data.matrixItem) | ||
callback.onDataReady(avatarPlaceholder) | ||
} | ||
|
||
override fun cleanup() { | ||
// NOOP | ||
} | ||
|
||
override fun cancel() { | ||
// NOOP | ||
} | ||
|
||
override fun getDataClass(): Class<Drawable> { | ||
return Drawable::class.java | ||
} | ||
|
||
override fun getDataSource(): DataSource { | ||
return DataSource.LOCAL | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.