Search in sources :

Example 21 with CommunicationIdentifier

use of com.azure.android.communication.common.CommunicationIdentifier in project azure-sdk-for-android by Azure.

the class ChatThreadCreatedEvent method setCreatedBy.

/**
 * Sets the createdBy of the thread.
 */
ChatThreadCreatedEvent setCreatedBy() {
    this.createdBy = new ChatParticipant();
    try {
        JSONObject createdByJsonObject = new JSONObject(this.createdByJsonString);
        CommunicationIdentifier createdByCommunicationIdentifier = NotificationUtils.getCommunicationIdentifier(createdByJsonObject.getString("participantId"));
        this.createdBy.setCommunicationIdentifier(createdByCommunicationIdentifier).setDisplayName(createdByJsonObject.getString("displayName"));
    } catch (JSONException e) {
        return this;
    }
    return this;
}
Also used : JSONObject(org.json.JSONObject) CommunicationIdentifier(com.azure.android.communication.common.CommunicationIdentifier) JSONException(org.json.JSONException)

Aggregations

CommunicationIdentifier (com.azure.android.communication.common.CommunicationIdentifier)21 Test (org.junit.jupiter.api.Test)13 JSONException (org.json.JSONException)8 JSONObject (org.json.JSONObject)8 CommunicationUserIdentifier (com.azure.android.communication.common.CommunicationUserIdentifier)4 MicrosoftTeamsUserIdentifier (com.azure.android.communication.common.MicrosoftTeamsUserIdentifier)4 CommunicationIdentifierModel (com.azure.android.communication.chat.implementation.models.CommunicationIdentifierModel)3 JSONArray (org.json.JSONArray)3 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)3 CommunicationUserIdentifierModel (com.azure.android.communication.chat.implementation.models.CommunicationUserIdentifierModel)1 PhoneNumberIdentifierModel (com.azure.android.communication.chat.implementation.models.PhoneNumberIdentifierModel)1 PhoneNumberIdentifier (com.azure.android.communication.common.PhoneNumberIdentifier)1 UnknownIdentifier (com.azure.android.communication.common.UnknownIdentifier)1