use of com.azure.android.communication.common.CommunicationIdentifier in project azure-sdk-for-android by Azure.
the class ParticipantsAddedEvent method setAddedBy.
/**
* Sets the addedBy of the thread.
*/
ParticipantsAddedEvent setAddedBy() {
this.addedBy = new ChatParticipant();
try {
JSONObject addedByJsonObject = new JSONObject(this.addedByJsonString);
CommunicationIdentifier addedByCommunicationIdentifier = NotificationUtils.getCommunicationIdentifier(addedByJsonObject.getString("participantId"));
this.addedBy.setCommunicationIdentifier(addedByCommunicationIdentifier).setDisplayName(addedByJsonObject.getString("displayName"));
} catch (JSONException e) {
return this;
}
return this;
}
use of com.azure.android.communication.common.CommunicationIdentifier in project azure-sdk-for-android by Azure.
the class CommunicationIdentifierConverterTests method deserializeUnknown.
@Test
public void deserializeUnknown() {
CommunicationIdentifier unknownIdentifier = CommunicationIdentifierConverter.convert(new CommunicationIdentifierModel().setRawId(rawId), logger);
assertEquals(UnknownIdentifier.class, unknownIdentifier.getClass());
assertEquals(rawId, ((UnknownIdentifier) unknownIdentifier).getId());
}
use of com.azure.android.communication.common.CommunicationIdentifier in project azure-sdk-for-android by Azure.
the class ParticipantsAddedEvent method setParticipantsAdded.
/**
* Sets the participants added to the thread.
*/
ParticipantsAddedEvent setParticipantsAdded() {
this.participantsAdded = new ArrayList<>();
try {
JSONArray participantsAddedJsonArray = new JSONArray(this.participantsAddedJsonString);
for (int i = 0; i < participantsAddedJsonArray.length(); i++) {
JSONObject participant = participantsAddedJsonArray.getJSONObject(i);
CommunicationIdentifier communicationUser = NotificationUtils.getCommunicationIdentifier(participant.getString("participantId"));
ChatParticipant chatParticipant = new ChatParticipant();
chatParticipant.setCommunicationIdentifier(communicationUser);
chatParticipant.setDisplayName(participant.getString("displayName"));
chatParticipant.setShareHistoryTime(NotificationUtils.parseEpochTime(participant.getLong("shareHistoryTime")));
this.participantsAdded.add(chatParticipant);
}
} catch (JSONException e) {
return this;
}
return this;
}
use of com.azure.android.communication.common.CommunicationIdentifier in project azure-sdk-for-android by Azure.
the class ParticipantsRemovedEvent method setRemovedBy.
/**
* Sets the removedBy of the thread.
*/
ParticipantsRemovedEvent setRemovedBy() {
this.removedBy = new ChatParticipant();
try {
JSONObject removedByJsonObject = new JSONObject(this.removedByJsonString);
CommunicationIdentifier removedByCommunicationIdentifier = NotificationUtils.getCommunicationIdentifier(removedByJsonObject.getString("participantId"));
this.removedBy.setCommunicationIdentifier(removedByCommunicationIdentifier).setDisplayName(removedByJsonObject.getString("displayName"));
} catch (JSONException e) {
return this;
}
return this;
}
use of com.azure.android.communication.common.CommunicationIdentifier in project azure-sdk-for-android by Azure.
the class ParticipantsRemovedEvent method setParticipantsRemoved.
/**
* Sets the participants removed from the thread.
*/
ParticipantsRemovedEvent setParticipantsRemoved() {
this.participantsRemoved = new ArrayList<>();
try {
JSONArray participantsRemovedJsonArray = new JSONArray(this.participantsRemovedJsonString);
for (int i = 0; i < participantsRemovedJsonArray.length(); i++) {
JSONObject participant = participantsRemovedJsonArray.getJSONObject(i);
CommunicationIdentifier communicationUser = NotificationUtils.getCommunicationIdentifier(participant.getString("participantId"));
ChatParticipant chatParticipant = new ChatParticipant();
chatParticipant.setCommunicationIdentifier(communicationUser);
chatParticipant.setDisplayName(participant.getString("displayName"));
chatParticipant.setShareHistoryTime(NotificationUtils.parseEpochTime(participant.getLong("shareHistoryTime")));
this.participantsRemoved.add(chatParticipant);
}
} catch (JSONException e) {
return this;
}
return this;
}
Aggregations