mirror of
https://github.com/nextcloud/talk-android
synced 2025-03-06 14:27:24 +00:00
Merge pull request #2055 from nextcloud/chore/noid/migrateParticipants
Migrate participants to kotlin
This commit is contained in:
commit
fd9637891c
@ -294,7 +294,7 @@ class MagicFirebaseMessagingService : FirebaseMessagingService() {
|
||||
}
|
||||
|
||||
override fun onNext(participantsOverall: ParticipantsOverall) {
|
||||
val participantList: List<Participant> = participantsOverall.ocs.data
|
||||
val participantList: List<Participant> = participantsOverall.ocs!!.data!!
|
||||
hasParticipantsInCall = participantList.isNotEmpty()
|
||||
if (hasParticipantsInCall) {
|
||||
for (participant in participantList) {
|
||||
|
@ -2240,8 +2240,8 @@ public class CallActivity extends CallBaseActivity {
|
||||
String userId = "";
|
||||
if (hasMCU) {
|
||||
userId = webSocketClient.getUserIdForSession(session);
|
||||
} else if (participantMap.get(session).getActorType() == Participant.ActorType.USERS) {
|
||||
userId = participantMap.get(session).getActorId();
|
||||
} else if (participantMap.get(session).getCalculatedActorType() == Participant.ActorType.USERS) {
|
||||
userId = participantMap.get(session).getCalculatedActorId();
|
||||
}
|
||||
|
||||
String urlForAvatar;
|
||||
|
@ -238,8 +238,8 @@ public class CallNotificationActivity extends CallBaseActivity {
|
||||
|
||||
if (hasParticipantsInCall) {
|
||||
for (Participant participant : participantList) {
|
||||
if (participant.getActorType() == Participant.ActorType.USERS &&
|
||||
participant.getActorId().equals(userBeingCalled.getUserId())) {
|
||||
if (participant.getCalculatedActorType() == Participant.ActorType.USERS &&
|
||||
participant.getCalculatedActorId().equals(userBeingCalled.getUserId())) {
|
||||
inCallOnDifferentDevice = true;
|
||||
break;
|
||||
}
|
||||
|
@ -140,7 +140,7 @@ public class AdvancedUserItem extends AbstractFlexibleItem<AdvancedUserItem.User
|
||||
DisplayUtils.getImageRequestForUrl(
|
||||
ApiUtils.getUrlForAvatar(
|
||||
userEntity.getBaseUrl(),
|
||||
participant.getActorId(),
|
||||
participant.getCalculatedActorId(),
|
||||
true),
|
||||
null))
|
||||
.build();
|
||||
|
@ -73,8 +73,8 @@ public class ContactItem extends AbstractFlexibleItem<ContactItem.ContactItemVie
|
||||
public boolean equals(Object o) {
|
||||
if (o instanceof ContactItem) {
|
||||
ContactItem inItem = (ContactItem) o;
|
||||
return participant.getActorType() == inItem.getModel().getActorType() &&
|
||||
participant.getActorId().equals(inItem.getModel().getActorId());
|
||||
return participant.getCalculatedActorType() == inItem.getModel().getCalculatedActorType() &&
|
||||
participant.getCalculatedActorId().equals(inItem.getModel().getCalculatedActorId());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@ -107,7 +107,7 @@ public class ContactItem extends AbstractFlexibleItem<ContactItem.ContactItemVie
|
||||
public void bindViewHolder(FlexibleAdapter adapter, ContactItemViewHolder holder, int position, List payloads) {
|
||||
holder.binding.avatarDraweeView.setController(null);
|
||||
|
||||
if (participant.isSelected()) {
|
||||
if (participant.getSelected()) {
|
||||
holder.binding.checkedImageView.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
holder.binding.checkedImageView.setVisibility(View.GONE);
|
||||
@ -152,19 +152,19 @@ public class ContactItem extends AbstractFlexibleItem<ContactItem.ContactItemVie
|
||||
}
|
||||
|
||||
if (
|
||||
participant.getActorType() == Participant.ActorType.GROUPS ||
|
||||
participant.getCalculatedActorType() == Participant.ActorType.GROUPS ||
|
||||
PARTICIPANT_SOURCE_GROUPS.equals(participant.getSource()) ||
|
||||
participant.getActorType() == Participant.ActorType.CIRCLES ||
|
||||
participant.getCalculatedActorType() == Participant.ActorType.CIRCLES ||
|
||||
PARTICIPANT_SOURCE_CIRCLES.equals(participant.getSource())) {
|
||||
|
||||
holder.binding.avatarDraweeView.setImageResource(R.drawable.ic_circular_group);
|
||||
|
||||
} else if (participant.getActorType() == Participant.ActorType.EMAILS) {
|
||||
} else if (participant.getCalculatedActorType() == Participant.ActorType.EMAILS) {
|
||||
|
||||
holder.binding.avatarDraweeView.setImageResource(R.drawable.ic_circular_mail);
|
||||
|
||||
} else if (
|
||||
participant.getActorType() == Participant.ActorType.GUESTS ||
|
||||
participant.getCalculatedActorType() == Participant.ActorType.GUESTS ||
|
||||
Participant.ParticipantType.GUEST.equals(participant.getType()) ||
|
||||
Participant.ParticipantType.GUEST_MODERATOR.equals(participant.getType())) {
|
||||
|
||||
@ -186,14 +186,14 @@ public class ContactItem extends AbstractFlexibleItem<ContactItem.ContactItemVie
|
||||
.build();
|
||||
holder.binding.avatarDraweeView.setController(draweeController);
|
||||
|
||||
} else if (participant.getActorType() == Participant.ActorType.USERS ||
|
||||
} else if (participant.getCalculatedActorType() == Participant.ActorType.USERS ||
|
||||
PARTICIPANT_SOURCE_USERS.equals(participant.getSource())) {
|
||||
DraweeController draweeController = Fresco.newDraweeControllerBuilder()
|
||||
.setOldController(holder.binding.avatarDraweeView.getController())
|
||||
.setAutoPlayAnimations(true)
|
||||
.setImageRequest(DisplayUtils.getImageRequestForUrl(
|
||||
ApiUtils.getUrlForAvatar(userEntity.getBaseUrl(),
|
||||
participant.getActorId(),
|
||||
participant.getCalculatedActorId(),
|
||||
false),
|
||||
null))
|
||||
.build();
|
||||
@ -208,7 +208,7 @@ public class ContactItem extends AbstractFlexibleItem<ContactItem.ContactItemVie
|
||||
.matcher(participant.getDisplayName().trim())
|
||||
.find() ||
|
||||
Pattern.compile(constraint, Pattern.CASE_INSENSITIVE | Pattern.LITERAL)
|
||||
.matcher(participant.getActorId().trim())
|
||||
.matcher(participant.getCalculatedActorId().trim())
|
||||
.find());
|
||||
}
|
||||
|
||||
|
@ -82,8 +82,8 @@ public class ParticipantItem extends AbstractFlexibleItem<ParticipantItem.Partic
|
||||
public boolean equals(Object o) {
|
||||
if (o instanceof ParticipantItem) {
|
||||
ParticipantItem inItem = (ParticipantItem) o;
|
||||
return participant.getActorType() == inItem.getModel().getActorType() &&
|
||||
participant.getActorId().equals(inItem.getModel().getActorId());
|
||||
return participant.getCalculatedActorType() == inItem.getModel().getCalculatedActorType() &&
|
||||
participant.getCalculatedActorId().equals(inItem.getModel().getCalculatedActorId());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@ -146,14 +146,14 @@ public class ParticipantItem extends AbstractFlexibleItem<ParticipantItem.Partic
|
||||
.getString(R.string.nc_guest));
|
||||
}
|
||||
|
||||
if (participant.getActorType() == Participant.ActorType.GROUPS ||
|
||||
if (participant.getCalculatedActorType() == Participant.ActorType.GROUPS ||
|
||||
"groups".equals(participant.getSource()) ||
|
||||
participant.getActorType() == Participant.ActorType.CIRCLES ||
|
||||
participant.getCalculatedActorType() == Participant.ActorType.CIRCLES ||
|
||||
"circles".equals(participant.getSource())) {
|
||||
holder.binding.avatarDraweeView.setImageResource(R.drawable.ic_circular_group);
|
||||
} else if (participant.getActorType() == Participant.ActorType.EMAILS) {
|
||||
} else if (participant.getCalculatedActorType() == Participant.ActorType.EMAILS) {
|
||||
holder.binding.avatarDraweeView.setImageResource(R.drawable.ic_circular_mail);
|
||||
} else if (participant.getActorType() == Participant.ActorType.GUESTS ||
|
||||
} else if (participant.getCalculatedActorType() == Participant.ActorType.GUESTS ||
|
||||
Participant.ParticipantType.GUEST.equals(participant.getType()) ||
|
||||
Participant.ParticipantType.GUEST_MODERATOR.equals(participant.getType())) {
|
||||
|
||||
@ -173,36 +173,36 @@ public class ParticipantItem extends AbstractFlexibleItem<ParticipantItem.Partic
|
||||
.build();
|
||||
holder.binding.avatarDraweeView.setController(draweeController);
|
||||
|
||||
} else if (participant.getActorType() == Participant.ActorType.USERS ||
|
||||
} else if (participant.getCalculatedActorType() == Participant.ActorType.USERS ||
|
||||
participant.getSource().equals("users")) {
|
||||
DraweeController draweeController = Fresco.newDraweeControllerBuilder()
|
||||
.setOldController(holder.binding.avatarDraweeView.getController())
|
||||
.setAutoPlayAnimations(true)
|
||||
.setImageRequest(DisplayUtils.getImageRequestForUrl(
|
||||
ApiUtils.getUrlForAvatar(userEntity.getBaseUrl(),
|
||||
participant.getActorId(), false), null))
|
||||
participant.getCalculatedActorId(), false), null))
|
||||
.build();
|
||||
holder.binding.avatarDraweeView.setController(draweeController);
|
||||
}
|
||||
|
||||
Resources resources = NextcloudTalkApplication.Companion.getSharedApplication().getResources();
|
||||
|
||||
Long inCallFlag = participant.getInCall();
|
||||
long inCallFlag = participant.getInCall();
|
||||
if ((inCallFlag & InCallFlags.WITH_PHONE) > 0) {
|
||||
holder.binding.videoCallIcon.setImageResource(R.drawable.ic_call_grey_600_24dp);
|
||||
holder.binding.videoCallIcon.setVisibility(View.VISIBLE);
|
||||
holder.binding.videoCallIcon.setContentDescription(
|
||||
resources.getString(R.string.nc_call_state_with_phone, participant.displayName));
|
||||
resources.getString(R.string.nc_call_state_with_phone, participant.getDisplayName()));
|
||||
} else if ((inCallFlag & InCallFlags.WITH_VIDEO) > 0) {
|
||||
holder.binding.videoCallIcon.setImageResource(R.drawable.ic_videocam_grey_600_24dp);
|
||||
holder.binding.videoCallIcon.setVisibility(View.VISIBLE);
|
||||
holder.binding.videoCallIcon.setContentDescription(
|
||||
resources.getString(R.string.nc_call_state_with_video, participant.displayName));
|
||||
resources.getString(R.string.nc_call_state_with_video, participant.getDisplayName()));
|
||||
} else if (inCallFlag > InCallFlags.DISCONNECTED) {
|
||||
holder.binding.videoCallIcon.setImageResource(R.drawable.ic_mic_grey_600_24dp);
|
||||
holder.binding.videoCallIcon.setVisibility(View.VISIBLE);
|
||||
holder.binding.videoCallIcon.setContentDescription(
|
||||
resources.getString(R.string.nc_call_state_in_call, participant.displayName));
|
||||
resources.getString(R.string.nc_call_state_in_call, participant.getDisplayName()));
|
||||
} else {
|
||||
holder.binding.videoCallIcon.setVisibility(View.GONE);
|
||||
}
|
||||
@ -226,13 +226,13 @@ public class ParticipantItem extends AbstractFlexibleItem<ParticipantItem.Partic
|
||||
.Companion
|
||||
.getSharedApplication()
|
||||
.getString(R.string.nc_user);
|
||||
if (participant.getActorType() == Participant.ActorType.GROUPS) {
|
||||
if (participant.getCalculatedActorType() == Participant.ActorType.GROUPS) {
|
||||
userType = NextcloudTalkApplication
|
||||
.Companion
|
||||
.getSharedApplication()
|
||||
.getString(R.string.nc_group);
|
||||
}
|
||||
if (participant.getActorType() == Participant.ActorType.CIRCLES) {
|
||||
if (participant.getCalculatedActorType() == Participant.ActorType.CIRCLES) {
|
||||
userType = NextcloudTalkApplication
|
||||
.Companion
|
||||
.getSharedApplication()
|
||||
@ -241,7 +241,7 @@ public class ParticipantItem extends AbstractFlexibleItem<ParticipantItem.Partic
|
||||
break;
|
||||
case 4:
|
||||
userType = NextcloudTalkApplication.Companion.getSharedApplication().getString(R.string.nc_guest);
|
||||
if (participant.getActorType() == Participant.ActorType.EMAILS) {
|
||||
if (participant.getCalculatedActorType() == Participant.ActorType.EMAILS) {
|
||||
userType = NextcloudTalkApplication
|
||||
.Companion
|
||||
.getSharedApplication()
|
||||
@ -270,32 +270,32 @@ public class ParticipantItem extends AbstractFlexibleItem<ParticipantItem.Partic
|
||||
private void drawStatus(ParticipantItemViewHolder holder) {
|
||||
float size = DisplayUtils.convertDpToPixel(STATUS_SIZE_IN_DP, context);
|
||||
holder.binding.userStatusImage.setImageDrawable(new StatusDrawable(
|
||||
participant.status,
|
||||
participant.getStatus(),
|
||||
NO_ICON,
|
||||
size,
|
||||
context.getResources().getColor(R.color.bg_default),
|
||||
context));
|
||||
|
||||
if (participant.statusMessage != null) {
|
||||
holder.binding.conversationInfoStatusMessage.setText(participant.statusMessage);
|
||||
if (participant.getStatusMessage() != null) {
|
||||
holder.binding.conversationInfoStatusMessage.setText(participant.getStatusMessage());
|
||||
alignUsernameVertical(holder, 0);
|
||||
} else {
|
||||
holder.binding.conversationInfoStatusMessage.setText("");
|
||||
alignUsernameVertical(holder, 10);
|
||||
}
|
||||
|
||||
if (participant.statusIcon != null && !participant.statusIcon.isEmpty()) {
|
||||
holder.binding.participantStatusEmoji.setText(participant.statusIcon);
|
||||
if (participant.getStatusIcon() != null && !participant.getStatusIcon().isEmpty()) {
|
||||
holder.binding.participantStatusEmoji.setText(participant.getStatusIcon());
|
||||
} else {
|
||||
holder.binding.participantStatusEmoji.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
if (participant.status != null && participant.status.equals(StatusType.DND.getString())) {
|
||||
if (participant.statusMessage == null || participant.statusMessage.isEmpty()) {
|
||||
if (participant.getStatus() != null && participant.getStatus().equals(StatusType.DND.getString())) {
|
||||
if (participant.getStatusMessage() == null || participant.getStatusMessage().isEmpty()) {
|
||||
holder.binding.conversationInfoStatusMessage.setText(R.string.dnd);
|
||||
}
|
||||
} else if (participant.status != null && participant.status.equals(StatusType.AWAY.getString())) {
|
||||
if (participant.statusMessage == null || participant.statusMessage.isEmpty()) {
|
||||
} else if (participant.getStatus() != null && participant.getStatus().equals(StatusType.AWAY.getString())) {
|
||||
if (participant.getStatusMessage() == null || participant.getStatusMessage().isEmpty()) {
|
||||
holder.binding.conversationInfoStatusMessage.setText(R.string.away);
|
||||
}
|
||||
}
|
||||
@ -314,7 +314,7 @@ public class ParticipantItem extends AbstractFlexibleItem<ParticipantItem.Partic
|
||||
(Pattern.compile(constraint, Pattern.CASE_INSENSITIVE | Pattern.LITERAL)
|
||||
.matcher(participant.getDisplayName().trim()).find() ||
|
||||
Pattern.compile(constraint, Pattern.CASE_INSENSITIVE | Pattern.LITERAL)
|
||||
.matcher(participant.getActorId().trim()).find());
|
||||
.matcher(participant.getCalculatedActorId().trim()).find());
|
||||
}
|
||||
|
||||
static class ParticipantItemViewHolder extends FlexibleViewHolder {
|
||||
|
@ -524,14 +524,14 @@ class ContactsController(args: Bundle) :
|
||||
|
||||
private fun getHeaderTitle(participant: Participant): String {
|
||||
return when {
|
||||
participant.getActorType() == Participant.ActorType.GROUPS -> {
|
||||
participant.calculatedActorType == Participant.ActorType.GROUPS -> {
|
||||
resources!!.getString(R.string.nc_groups)
|
||||
}
|
||||
participant.getActorType() == Participant.ActorType.CIRCLES -> {
|
||||
participant.calculatedActorType == Participant.ActorType.CIRCLES -> {
|
||||
resources!!.getString(R.string.nc_circles)
|
||||
}
|
||||
else -> {
|
||||
participant.getDisplayName().substring(0, 1).toUpperCase(Locale.getDefault())
|
||||
participant.displayName!!.substring(0, 1).toUpperCase(Locale.getDefault())
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -541,10 +541,10 @@ class ContactsController(args: Bundle) :
|
||||
actorTypeConverter: EnumActorTypeConverter
|
||||
): Participant {
|
||||
val participant = Participant()
|
||||
participant.setActorId(autocompleteUser.id)
|
||||
participant.setActorType(actorTypeConverter.getFromString(autocompleteUser.source))
|
||||
participant.setDisplayName(autocompleteUser.label)
|
||||
participant.setSource(autocompleteUser.source)
|
||||
participant.actorId = autocompleteUser.id
|
||||
participant.actorType = actorTypeConverter.getFromString(autocompleteUser.source)
|
||||
participant.displayName = autocompleteUser.label
|
||||
participant.source = autocompleteUser.source
|
||||
|
||||
return participant
|
||||
}
|
||||
@ -554,18 +554,18 @@ class ContactsController(args: Bundle) :
|
||||
newUserItemList,
|
||||
{ o1: AbstractFlexibleItem<*>, o2: AbstractFlexibleItem<*> ->
|
||||
val firstName: String = if (o1 is ContactItem) {
|
||||
(o1 as ContactItem).model.getDisplayName()
|
||||
(o1 as ContactItem).model.displayName!!
|
||||
} else {
|
||||
(o1 as GenericTextHeaderItem).model
|
||||
}
|
||||
val secondName: String = if (o2 is ContactItem) {
|
||||
(o2 as ContactItem).model.getDisplayName()
|
||||
(o2 as ContactItem).model.displayName!!
|
||||
} else {
|
||||
(o2 as GenericTextHeaderItem).model
|
||||
}
|
||||
if (o1 is ContactItem && o2 is ContactItem) {
|
||||
val firstSource: String = (o1 as ContactItem).model.getSource()
|
||||
val secondSource: String = (o2 as ContactItem).model.getSource()
|
||||
val firstSource: String = (o1 as ContactItem).model.source!!
|
||||
val secondSource: String = (o2 as ContactItem).model.source!!
|
||||
if (firstSource == secondSource) {
|
||||
return@sort firstName.compareTo(secondName, ignoreCase = true)
|
||||
}
|
||||
@ -602,23 +602,23 @@ class ContactsController(args: Bundle) :
|
||||
contactItems
|
||||
) { o1: AbstractFlexibleItem<*>, o2: AbstractFlexibleItem<*> ->
|
||||
val firstName: String = if (o1 is ContactItem) {
|
||||
(o1 as ContactItem).model.getDisplayName()
|
||||
(o1 as ContactItem).model.displayName!!
|
||||
} else {
|
||||
(o1 as GenericTextHeaderItem).model
|
||||
}
|
||||
val secondName: String = if (o2 is ContactItem) {
|
||||
(o2 as ContactItem).model.getDisplayName()
|
||||
(o2 as ContactItem).model.displayName!!
|
||||
} else {
|
||||
(o2 as GenericTextHeaderItem).model
|
||||
}
|
||||
if (o1 is ContactItem && o2 is ContactItem) {
|
||||
if ("groups" == (o1 as ContactItem).model.getSource() &&
|
||||
"groups" == (o2 as ContactItem).model.getSource()
|
||||
if ("groups" == (o1 as ContactItem).model.source &&
|
||||
"groups" == (o2 as ContactItem).model.source
|
||||
) {
|
||||
return@sort firstName.compareTo(secondName, ignoreCase = true)
|
||||
} else if ("groups" == (o1 as ContactItem).model.getSource()) {
|
||||
} else if ("groups" == (o1 as ContactItem).model.source) {
|
||||
return@sort -1
|
||||
} else if ("groups" == (o2 as ContactItem).model.getSource()) {
|
||||
} else if ("groups" == (o2 as ContactItem).model.source) {
|
||||
return@sort 1
|
||||
}
|
||||
}
|
||||
@ -776,7 +776,7 @@ class ContactsController(args: Bundle) :
|
||||
}
|
||||
|
||||
private fun updateSelection(contactItem: ContactItem) {
|
||||
contactItem.model.isSelected = !contactItem.model.isSelected
|
||||
contactItem.model.selected = !contactItem.model.selected
|
||||
updateSelectionLists(contactItem.model)
|
||||
if (CapabilitiesUtil.hasSpreedFeatureCapability(currentUser, "last-room-activity") &&
|
||||
!CapabilitiesUtil.hasSpreedFeatureCapability(currentUser, "invite-groups-and-mails") &&
|
||||
@ -786,12 +786,12 @@ class ContactsController(args: Bundle) :
|
||||
var internalParticipant: Participant
|
||||
for (i in currentItems.indices) {
|
||||
internalParticipant = currentItems[i].model
|
||||
if (internalParticipant.getActorId() == contactItem.model.getActorId() &&
|
||||
internalParticipant.getActorType() == Participant.ActorType.GROUPS &&
|
||||
internalParticipant.isSelected
|
||||
if (internalParticipant.calculatedActorId == contactItem.model.calculatedActorId &&
|
||||
internalParticipant.calculatedActorType == Participant.ActorType.GROUPS &&
|
||||
internalParticipant.selected
|
||||
) {
|
||||
internalParticipant.isSelected = false
|
||||
selectedGroupIds.remove(internalParticipant.getActorId())
|
||||
internalParticipant.selected = false
|
||||
selectedGroupIds.remove(internalParticipant.calculatedActorId!!)
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -801,7 +801,7 @@ class ContactsController(args: Bundle) :
|
||||
|
||||
private fun createRoom(contactItem: ContactItem) {
|
||||
var roomType = "1"
|
||||
if ("groups" == contactItem.model.getSource()) {
|
||||
if ("groups" == contactItem.model.source) {
|
||||
roomType = "2"
|
||||
}
|
||||
val apiVersion: Int = ApiUtils.getConversationApiVersion(currentUser, intArrayOf(ApiUtils.APIv4, 1))
|
||||
@ -810,7 +810,7 @@ class ContactsController(args: Bundle) :
|
||||
currentUser!!.baseUrl,
|
||||
roomType,
|
||||
null,
|
||||
contactItem.model.getActorId(),
|
||||
contactItem.model.calculatedActorId,
|
||||
null
|
||||
)
|
||||
ncApi.createRoom(
|
||||
@ -853,29 +853,29 @@ class ContactsController(args: Bundle) :
|
||||
}
|
||||
|
||||
private fun updateSelectionLists(participant: Participant) {
|
||||
if ("groups" == participant.getSource()) {
|
||||
if (participant.isSelected) {
|
||||
selectedGroupIds.add(participant.getActorId())
|
||||
if ("groups" == participant.source) {
|
||||
if (participant.selected) {
|
||||
selectedGroupIds.add(participant.calculatedActorId!!)
|
||||
} else {
|
||||
selectedGroupIds.remove(participant.getActorId())
|
||||
selectedGroupIds.remove(participant.calculatedActorId!!)
|
||||
}
|
||||
} else if ("emails" == participant.getSource()) {
|
||||
if (participant.isSelected) {
|
||||
selectedEmails.add(participant.getActorId())
|
||||
} else if ("emails" == participant.source) {
|
||||
if (participant.selected) {
|
||||
selectedEmails.add(participant.calculatedActorId!!)
|
||||
} else {
|
||||
selectedEmails.remove(participant.getActorId())
|
||||
selectedEmails.remove(participant.calculatedActorId!!)
|
||||
}
|
||||
} else if ("circles" == participant.getSource()) {
|
||||
if (participant.isSelected) {
|
||||
selectedCircleIds.add(participant.getActorId())
|
||||
} else if ("circles" == participant.source) {
|
||||
if (participant.selected) {
|
||||
selectedCircleIds.add(participant.calculatedActorId!!)
|
||||
} else {
|
||||
selectedCircleIds.remove(participant.getActorId())
|
||||
selectedCircleIds.remove(participant.calculatedActorId!!)
|
||||
}
|
||||
} else {
|
||||
if (participant.isSelected) {
|
||||
selectedUserIds.add(participant.getActorId())
|
||||
if (participant.selected) {
|
||||
selectedUserIds.add(participant.calculatedActorId!!)
|
||||
} else {
|
||||
selectedUserIds.remove(participant.getActorId())
|
||||
selectedUserIds.remove(participant.calculatedActorId!!)
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -885,7 +885,7 @@ class ContactsController(args: Bundle) :
|
||||
participant: Participant,
|
||||
adapter: FlexibleAdapter<*>?
|
||||
): Boolean {
|
||||
return "groups" == contactItem.model.getSource() && participant.isSelected && adapter?.selectedItemCount!! > 1
|
||||
return "groups" == contactItem.model.source && participant.selected && adapter?.selectedItemCount!! > 1
|
||||
}
|
||||
|
||||
private fun joinConversationViaLink() {
|
||||
@ -917,11 +917,11 @@ class ContactsController(args: Bundle) :
|
||||
for (i in currentItems.indices) {
|
||||
if (currentItems[i] is ContactItem) {
|
||||
internalParticipant = (currentItems[i] as ContactItem).model
|
||||
if (internalParticipant.getActorType() == Participant.ActorType.GROUPS &&
|
||||
internalParticipant.isSelected
|
||||
if (internalParticipant.calculatedActorType == Participant.ActorType.GROUPS &&
|
||||
internalParticipant.selected
|
||||
) {
|
||||
internalParticipant.isSelected = false
|
||||
selectedGroupIds.remove(internalParticipant.getActorId())
|
||||
internalParticipant.selected = false
|
||||
selectedGroupIds.remove(internalParticipant.calculatedActorId)
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -931,7 +931,7 @@ class ContactsController(args: Bundle) :
|
||||
for (i in 0 until adapter!!.itemCount) {
|
||||
if (adapter?.getItem(i) is ContactItem) {
|
||||
val contactItem: ContactItem = adapter?.getItem(i) as ContactItem
|
||||
if ("groups" == contactItem.model.getSource()) {
|
||||
if ("groups" == contactItem.model.source) {
|
||||
contactItem.isEnabled = !isPublicCall
|
||||
}
|
||||
}
|
||||
|
@ -413,7 +413,9 @@ class ConversationInfoController(args: Bundle) :
|
||||
userItem.isOnline = !participant.sessionIds!!.isEmpty()
|
||||
}
|
||||
|
||||
if (participant.getActorType() == USERS && participant.getActorId() == conversationUser!!.userId) {
|
||||
if (participant.calculatedActorType == USERS &&
|
||||
participant.calculatedActorId == conversationUser!!.userId
|
||||
) {
|
||||
ownUserItem = userItem
|
||||
ownUserItem.model.sessionId = "-1"
|
||||
ownUserItem.isOnline = true
|
||||
@ -471,7 +473,7 @@ class ConversationInfoController(args: Bundle) :
|
||||
@Suppress("Detekt.TooGenericExceptionCaught")
|
||||
override fun onNext(participantsOverall: ParticipantsOverall) {
|
||||
try {
|
||||
handleParticipants(participantsOverall.ocs.data)
|
||||
handleParticipants(participantsOverall.ocs!!.data!!)
|
||||
} catch (npe: NullPointerException) {
|
||||
// view binding can be null
|
||||
// since this is called asynchronously and UI might have been destroyed in the meantime
|
||||
@ -494,8 +496,8 @@ class ConversationInfoController(args: Bundle) :
|
||||
val existingParticipantsId = arrayListOf<String>()
|
||||
|
||||
for (userItem in userItems) {
|
||||
if (userItem.model.getActorType() == USERS) {
|
||||
existingParticipantsId.add(userItem.model.getActorId())
|
||||
if (userItem.model.calculatedActorType == USERS) {
|
||||
existingParticipantsId.add(userItem.model.calculatedActorId!!)
|
||||
}
|
||||
}
|
||||
|
||||
@ -986,7 +988,7 @@ class ConversationInfoController(args: Bundle) :
|
||||
|
||||
val apiVersion = ApiUtils.getConversationApiVersion(conversationUser, intArrayOf(ApiUtils.APIv4, 1))
|
||||
|
||||
if (participant.getActorType() == USERS && participant.getActorId() == conversationUser!!.userId) {
|
||||
if (participant.calculatedActorType == USERS && participant.calculatedActorId == conversationUser!!.userId) {
|
||||
if (participant.attendeePin?.isNotEmpty() == true) {
|
||||
val items = mutableListOf(
|
||||
BasicListItemWithImage(
|
||||
@ -1013,7 +1015,7 @@ class ConversationInfoController(args: Bundle) :
|
||||
return true
|
||||
}
|
||||
|
||||
if (participant.getActorType() == GROUPS) {
|
||||
if (participant.calculatedActorType == GROUPS) {
|
||||
val items = mutableListOf(
|
||||
BasicListItemWithImage(
|
||||
R.drawable.ic_delete_grey600_24dp,
|
||||
@ -1033,7 +1035,7 @@ class ConversationInfoController(args: Bundle) :
|
||||
return true
|
||||
}
|
||||
|
||||
if (participant.getActorType() == CIRCLES) {
|
||||
if (participant.calculatedActorType == CIRCLES) {
|
||||
val items = mutableListOf(
|
||||
BasicListItemWithImage(
|
||||
R.drawable.ic_delete_grey600_24dp,
|
||||
@ -1086,7 +1088,7 @@ class ConversationInfoController(args: Bundle) :
|
||||
items.removeAt(1)
|
||||
}
|
||||
|
||||
if (participant.attendeePin == null || participant.attendeePin.isEmpty()) {
|
||||
if (participant.attendeePin == null || participant.attendeePin!!.isEmpty()) {
|
||||
items.removeAt(0)
|
||||
}
|
||||
|
||||
@ -1097,7 +1099,7 @@ class ConversationInfoController(args: Bundle) :
|
||||
title(text = participant.displayName)
|
||||
listItemsWithImage(items = items) { dialog, index, _ ->
|
||||
var actionToTrigger = index
|
||||
if (participant.attendeePin == null || participant.attendeePin.isEmpty()) {
|
||||
if (participant.attendeePin == null || participant.attendeePin!!.isEmpty()) {
|
||||
actionToTrigger++
|
||||
}
|
||||
if (participant.type == Participant.ParticipantType.USER_FOLLOWING_LINK) {
|
||||
@ -1166,8 +1168,8 @@ class ConversationInfoController(args: Bundle) :
|
||||
return 1
|
||||
}
|
||||
|
||||
return left.model.displayName.toLowerCase(Locale.ROOT).compareTo(
|
||||
right.model.displayName.toLowerCase(Locale.ROOT)
|
||||
return left.model.displayName!!.toLowerCase(Locale.ROOT).compareTo(
|
||||
right.model.displayName!!.toLowerCase(Locale.ROOT)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -156,9 +156,9 @@ class SwitchAccountController(args: Bundle? = null) :
|
||||
userEntity.username
|
||||
}
|
||||
participant = Participant()
|
||||
participant.setActorType(Participant.ActorType.USERS)
|
||||
participant.setActorId(userId)
|
||||
participant.setDisplayName(userEntity.displayName)
|
||||
participant.actorType = Participant.ActorType.USERS
|
||||
participant.actorId = userId
|
||||
participant.displayName = userEntity.displayName
|
||||
userItems.add(AdvancedUserItem(participant, userEntity, null))
|
||||
}
|
||||
}
|
||||
@ -171,9 +171,9 @@ class SwitchAccountController(args: Bundle? = null) :
|
||||
account = accountObject
|
||||
importAccount = getInformationFromAccount(account)
|
||||
participant = Participant()
|
||||
participant.setActorType(Participant.ActorType.USERS)
|
||||
participant.setActorId(importAccount.getUsername())
|
||||
participant.setDisplayName(importAccount.getUsername())
|
||||
participant.actorType = Participant.ActorType.USERS
|
||||
participant.actorId = importAccount.getUsername()
|
||||
participant.displayName = importAccount.getUsername()
|
||||
userEntity = UserEntity()
|
||||
userEntity.baseUrl = importAccount.getBaseUrl()
|
||||
userItems.add(AdvancedUserItem(participant, userEntity, account))
|
||||
|
@ -1,341 +0,0 @@
|
||||
/*
|
||||
*
|
||||
* Nextcloud Talk application
|
||||
*
|
||||
* @author Mario Danic
|
||||
* Copyright (C) 2017 Mario Danic (mario@lovelyhq.com)
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.nextcloud.talk.models.json.participants;
|
||||
|
||||
import com.bluelinelabs.logansquare.annotation.JsonField;
|
||||
import com.bluelinelabs.logansquare.annotation.JsonObject;
|
||||
import com.nextcloud.talk.models.json.converters.EnumActorTypeConverter;
|
||||
import com.nextcloud.talk.models.json.converters.EnumParticipantTypeConverter;
|
||||
import com.nextcloud.talk.models.json.converters.ObjectParcelConverter;
|
||||
|
||||
import org.parceler.Parcel;
|
||||
import org.parceler.ParcelPropertyConverter;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
@Parcel
|
||||
@JsonObject
|
||||
public class Participant {
|
||||
@JsonField(name = "attendeeId")
|
||||
public Long attendeeId;
|
||||
|
||||
@JsonField(name = "actorType", typeConverter = EnumActorTypeConverter.class)
|
||||
public ActorType actorType;
|
||||
|
||||
@JsonField(name = "actorId")
|
||||
public String actorId;
|
||||
|
||||
@JsonField(name = "attendeePin")
|
||||
public String attendeePin;
|
||||
|
||||
@Deprecated
|
||||
@JsonField(name = "userId")
|
||||
public String userId;
|
||||
|
||||
@JsonField(name = {"type", "participantType"}, typeConverter = EnumParticipantTypeConverter.class)
|
||||
public ParticipantType type;
|
||||
|
||||
@Deprecated
|
||||
@JsonField(name = "name")
|
||||
public String name;
|
||||
|
||||
@JsonField(name = "displayName")
|
||||
public String displayName;
|
||||
|
||||
@JsonField(name = "lastPing")
|
||||
public long lastPing;
|
||||
|
||||
@Deprecated
|
||||
@JsonField(name = "sessionId")
|
||||
public String sessionId;
|
||||
|
||||
@JsonField(name = "sessionIds")
|
||||
public String[] sessionIds;
|
||||
|
||||
@Deprecated
|
||||
@JsonField(name = "roomId")
|
||||
public long roomId;
|
||||
|
||||
@ParcelPropertyConverter(ObjectParcelConverter.class)
|
||||
@JsonField(name = "inCall")
|
||||
public Object inCall;
|
||||
|
||||
@JsonField(name = "status")
|
||||
public String status;
|
||||
|
||||
@JsonField(name = "statusIcon")
|
||||
public String statusIcon;
|
||||
|
||||
@JsonField(name = "statusMessage")
|
||||
public String statusMessage;
|
||||
|
||||
public String source;
|
||||
|
||||
public boolean selected;
|
||||
|
||||
public Long getAttendeeId() {
|
||||
return attendeeId;
|
||||
}
|
||||
|
||||
public ActorType getActorType() {
|
||||
if (this.actorType == null) {
|
||||
if (this.userId != null) {
|
||||
return ActorType.USERS;
|
||||
} else {
|
||||
return ActorType.GUESTS;
|
||||
}
|
||||
}
|
||||
return actorType;
|
||||
}
|
||||
|
||||
public String getActorId() {
|
||||
if (this.actorId == null) {
|
||||
return this.userId;
|
||||
}
|
||||
return actorId;
|
||||
}
|
||||
|
||||
public String getAttendeePin() {
|
||||
return attendeePin;
|
||||
}
|
||||
|
||||
public ParticipantType getType() {
|
||||
return this.type;
|
||||
}
|
||||
|
||||
public String getDisplayName() {
|
||||
return this.displayName;
|
||||
}
|
||||
|
||||
public long getLastPing() {
|
||||
return this.lastPing;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public String getSessionId() {
|
||||
return this.sessionId;
|
||||
}
|
||||
|
||||
public String[] getSessionIds() {
|
||||
return sessionIds;
|
||||
}
|
||||
|
||||
public Long getInCall() {
|
||||
if (inCall instanceof Long) {
|
||||
return (Long) this.inCall;
|
||||
}
|
||||
|
||||
if (this.inCall instanceof Boolean) {
|
||||
if ((boolean) inCall) {
|
||||
return 1L;
|
||||
} else {
|
||||
return 0L;
|
||||
}
|
||||
}
|
||||
return 0L;
|
||||
}
|
||||
|
||||
public String getSource() {
|
||||
return this.source;
|
||||
}
|
||||
|
||||
public boolean isSelected() {
|
||||
return this.selected;
|
||||
}
|
||||
|
||||
public void setAttendeeId(Long attendeeId) {
|
||||
this.attendeeId = attendeeId;
|
||||
}
|
||||
|
||||
public void setActorType(ActorType actorType) {
|
||||
this.actorType = actorType;
|
||||
}
|
||||
|
||||
public void setActorId(String actorId) {
|
||||
this.actorId = actorId;
|
||||
}
|
||||
|
||||
public void setAttendeePin(String attendeePin) {
|
||||
this.attendeePin = attendeePin;
|
||||
}
|
||||
|
||||
public void setType(ParticipantType type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public void setDisplayName(String displayName) {
|
||||
this.displayName = displayName;
|
||||
}
|
||||
|
||||
public void setLastPing(long lastPing) {
|
||||
this.lastPing = lastPing;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public void setSessionId(String sessionId) {
|
||||
this.sessionId = sessionId;
|
||||
}
|
||||
|
||||
public void setInCall(Object inCall) {
|
||||
this.inCall = inCall;
|
||||
}
|
||||
|
||||
public void setSource(String source) {
|
||||
this.source = source;
|
||||
}
|
||||
|
||||
public void setSelected(boolean selected) {
|
||||
this.selected = selected;
|
||||
}
|
||||
|
||||
public void setSessionIds(String[] sessionIds) {
|
||||
this.sessionIds = sessionIds;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) {
|
||||
return true;
|
||||
}
|
||||
if (o == null || getClass() != o.getClass()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Participant that = (Participant) o;
|
||||
|
||||
if (lastPing != that.lastPing) {
|
||||
return false;
|
||||
}
|
||||
if (roomId != that.roomId) {
|
||||
return false;
|
||||
}
|
||||
if (selected != that.selected) {
|
||||
return false;
|
||||
}
|
||||
if (!attendeeId.equals(that.attendeeId)) {
|
||||
return false;
|
||||
}
|
||||
if (!actorType.equals(that.actorType)) {
|
||||
return false;
|
||||
}
|
||||
if (!actorId.equals(that.actorId)) {
|
||||
return false;
|
||||
}
|
||||
if (!attendeePin.equals(that.attendeePin)) {
|
||||
return false;
|
||||
}
|
||||
if (!userId.equals(that.userId)) {
|
||||
return false;
|
||||
}
|
||||
if (type != that.type) {
|
||||
return false;
|
||||
}
|
||||
if (!name.equals(that.name)) {
|
||||
return false;
|
||||
}
|
||||
if (displayName != null ? !displayName.equals(that.displayName) : that.displayName != null) {
|
||||
return false;
|
||||
}
|
||||
if (!sessionId.equals(that.sessionId)) {
|
||||
return false;
|
||||
}
|
||||
// Probably incorrect - comparing Object[] arrays with Arrays.equals
|
||||
if (!Arrays.equals(sessionIds, that.sessionIds)) {
|
||||
return false;
|
||||
}
|
||||
if (inCall != null ? !inCall.equals(that.inCall) : that.inCall != null) {
|
||||
return false;
|
||||
}
|
||||
return source != null ? source.equals(that.source) : that.source == null;
|
||||
}
|
||||
|
||||
protected boolean canEqual(final Object other) {
|
||||
return other instanceof Participant;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int result = (attendeeId != null ? attendeeId.hashCode() : 0);
|
||||
result = 31 * result + (actorType != null ? actorType.hashCode() : 0);
|
||||
result = 31 * result + (actorId != null ? actorId.hashCode() : 0);
|
||||
result = 31 * result + (attendeePin != null ? attendeePin.hashCode() : 0);
|
||||
result = 31 * result + (userId != null ? userId.hashCode() : 0);
|
||||
result = 31 * result + (type != null ? type.hashCode() : 0);
|
||||
result = 31 * result + (name != null ? name.hashCode() : 0);
|
||||
result = 31 * result + (displayName != null ? displayName.hashCode() : 0);
|
||||
result = 31 * result + (int) (lastPing ^ (lastPing >>> 32));
|
||||
result = 31 * result + (sessionId != null ? sessionId.hashCode() : 0);
|
||||
result = 31 * result + Arrays.hashCode(sessionIds);
|
||||
result = 31 * result + (int) (roomId ^ (roomId >>> 32));
|
||||
result = 31 * result + (inCall != null ? inCall.hashCode() : 0);
|
||||
result = 31 * result + (source != null ? source.hashCode() : 0);
|
||||
result = 31 * result + (selected ? 1 : 0);
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Participant{" +
|
||||
"attendeeId=" + attendeeId +
|
||||
", actorType='" + actorType + '\'' +
|
||||
", actorId='" + actorId + '\'' +
|
||||
", attendeePin='" + attendeePin + '\'' +
|
||||
", userId='" + userId + '\'' +
|
||||
", type=" + type +
|
||||
", name='" + name + '\'' +
|
||||
", displayName='" + displayName + '\'' +
|
||||
", lastPing=" + lastPing +
|
||||
", sessionId='" + sessionId + '\'' +
|
||||
", sessionIds=" + Arrays.toString(sessionIds) +
|
||||
", roomId=" + roomId +
|
||||
", inCall=" + inCall +
|
||||
", source='" + source + '\'' +
|
||||
", selected=" + selected +
|
||||
'}';
|
||||
}
|
||||
|
||||
public enum ActorType {
|
||||
DUMMY,
|
||||
EMAILS,
|
||||
GROUPS,
|
||||
GUESTS,
|
||||
USERS,
|
||||
CIRCLES,
|
||||
}
|
||||
|
||||
public enum ParticipantType {
|
||||
DUMMY,
|
||||
OWNER,
|
||||
MODERATOR,
|
||||
USER,
|
||||
GUEST,
|
||||
USER_FOLLOWING_LINK,
|
||||
GUEST_MODERATOR
|
||||
}
|
||||
|
||||
public static class InCallFlags {
|
||||
public static final int DISCONNECTED = 0;
|
||||
public static final int IN_CALL = 1;
|
||||
public static final int WITH_AUDIO = 2;
|
||||
public static final int WITH_VIDEO = 4;
|
||||
public static final int WITH_PHONE = 8;
|
||||
}
|
||||
}
|
@ -0,0 +1,135 @@
|
||||
/*
|
||||
* Nextcloud Talk application
|
||||
*
|
||||
* @author Mario Danic
|
||||
* @author Andy Scherzinger
|
||||
* Copyright (C) 2022 Andy Scherzinger <info@andy-scherzinger.de>
|
||||
* Copyright (C) 2017 Mario Danic (mario@lovelyhq.com)
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.nextcloud.talk.models.json.participants
|
||||
|
||||
import android.os.Parcelable
|
||||
import com.bluelinelabs.logansquare.annotation.JsonField
|
||||
import com.bluelinelabs.logansquare.annotation.JsonObject
|
||||
import com.nextcloud.talk.models.json.converters.EnumActorTypeConverter
|
||||
import com.nextcloud.talk.models.json.converters.EnumParticipantTypeConverter
|
||||
import kotlinx.android.parcel.Parcelize
|
||||
import java.util.ArrayList
|
||||
|
||||
@Parcelize
|
||||
@JsonObject
|
||||
data class Participant(
|
||||
@JsonField(name = ["attendeeId"])
|
||||
var attendeeId: Long? = null,
|
||||
|
||||
@JsonField(name = ["actorType"], typeConverter = EnumActorTypeConverter::class)
|
||||
var actorType: ActorType? = null,
|
||||
|
||||
@JsonField(name = ["actorId"])
|
||||
var actorId: String? = null,
|
||||
|
||||
@JsonField(name = ["attendeePin"])
|
||||
var attendeePin: String? = null,
|
||||
|
||||
@Deprecated("")
|
||||
@JsonField(name = ["userId"])
|
||||
var userId: String? = null,
|
||||
|
||||
@JsonField(name = ["type", "participantType"], typeConverter = EnumParticipantTypeConverter::class)
|
||||
var type: ParticipantType? = null,
|
||||
|
||||
@Deprecated("")
|
||||
@JsonField(name = ["name"])
|
||||
var name: String? = null,
|
||||
|
||||
@JsonField(name = ["displayName"])
|
||||
var displayName: String? = null,
|
||||
|
||||
@JsonField(name = ["lastPing"])
|
||||
var lastPing: Long = 0,
|
||||
|
||||
@Deprecated("")
|
||||
@JsonField(name = ["sessionId"])
|
||||
var sessionId: String? = null,
|
||||
|
||||
@JsonField(name = ["sessionIds"])
|
||||
var sessionIds: ArrayList<String> = ArrayList(0),
|
||||
|
||||
@Deprecated("")
|
||||
@JsonField(name = ["roomId"])
|
||||
var roomId: Long = 0,
|
||||
|
||||
@JsonField(name = ["inCall"])
|
||||
var inCall: Long = 0,
|
||||
|
||||
@JsonField(name = ["status"])
|
||||
var status: String? = null,
|
||||
|
||||
@JsonField(name = ["statusIcon"])
|
||||
var statusIcon: String? = null,
|
||||
|
||||
@JsonField(name = ["statusMessage"])
|
||||
var statusMessage: String? = null,
|
||||
|
||||
var source: String? = null,
|
||||
|
||||
var selected: Boolean = false
|
||||
) : Parcelable {
|
||||
// This constructor is added to work with the 'com.bluelinelabs.logansquare.annotation.JsonObject'
|
||||
constructor() : this(
|
||||
null, null, null, null, null, null, null, null,
|
||||
0, null, ArrayList(0), 0, 0, null,
|
||||
null, null
|
||||
)
|
||||
|
||||
/**
|
||||
* actorType is only guaranteed in APIv3+ so use calculatedActorId
|
||||
*
|
||||
* https://github.com/nextcloud/spreed/blob/stable21/lib/Controller/RoomController.php#L1145-L1148
|
||||
*/
|
||||
val calculatedActorType: ActorType
|
||||
get() = if (actorType == null) {
|
||||
if (userId != null) {
|
||||
ActorType.USERS
|
||||
} else {
|
||||
ActorType.GUESTS
|
||||
}
|
||||
} else actorType!!
|
||||
|
||||
/**
|
||||
* actorId is only guaranteed in APIv3+ so use calculatedActorId.
|
||||
*/
|
||||
val calculatedActorId: String?
|
||||
get() = if (actorId == null) {
|
||||
userId
|
||||
} else actorId
|
||||
|
||||
enum class ActorType {
|
||||
DUMMY, EMAILS, GROUPS, GUESTS, USERS, CIRCLES
|
||||
}
|
||||
|
||||
enum class ParticipantType {
|
||||
DUMMY, OWNER, MODERATOR, USER, GUEST, USER_FOLLOWING_LINK, GUEST_MODERATOR
|
||||
}
|
||||
|
||||
object InCallFlags {
|
||||
const val DISCONNECTED = 0
|
||||
const val IN_CALL = 1
|
||||
const val WITH_AUDIO = 2
|
||||
const val WITH_VIDEO = 4
|
||||
const val WITH_PHONE = 8
|
||||
}
|
||||
}
|
@ -1,77 +0,0 @@
|
||||
/*
|
||||
*
|
||||
* Nextcloud Talk application
|
||||
*
|
||||
* @author Mario Danic
|
||||
* Copyright (C) 2017 Mario Danic (mario@lovelyhq.com)
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.nextcloud.talk.models.json.participants;
|
||||
|
||||
import com.bluelinelabs.logansquare.annotation.JsonField;
|
||||
import com.bluelinelabs.logansquare.annotation.JsonObject;
|
||||
import com.nextcloud.talk.models.json.generic.GenericOCS;
|
||||
|
||||
import org.parceler.Parcel;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Parcel
|
||||
@JsonObject
|
||||
public class ParticipantsOCS extends GenericOCS {
|
||||
@JsonField(name = "data")
|
||||
public List<Participant> data;
|
||||
|
||||
public List<Participant> getData() {
|
||||
return this.data;
|
||||
}
|
||||
|
||||
public void setData(List<Participant> data) {
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
public boolean equals(final Object o) {
|
||||
if (o == this) {
|
||||
return true;
|
||||
}
|
||||
if (!(o instanceof ParticipantsOCS)) {
|
||||
return false;
|
||||
}
|
||||
final ParticipantsOCS other = (ParticipantsOCS) o;
|
||||
if (!other.canEqual((Object) this)) {
|
||||
return false;
|
||||
}
|
||||
final Object this$data = this.getData();
|
||||
final Object other$data = other.getData();
|
||||
|
||||
return this$data == null ? other$data == null : this$data.equals(other$data);
|
||||
}
|
||||
|
||||
protected boolean canEqual(final Object other) {
|
||||
return other instanceof ParticipantsOCS;
|
||||
}
|
||||
|
||||
public int hashCode() {
|
||||
final int PRIME = 59;
|
||||
int result = 1;
|
||||
final Object $data = this.getData();
|
||||
result = result * PRIME + ($data == null ? 43 : $data.hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return "ParticipantsOCS(data=" + this.getData() + ")";
|
||||
}
|
||||
}
|
@ -0,0 +1,43 @@
|
||||
/*
|
||||
* Nextcloud Talk application
|
||||
*
|
||||
* @author Mario Danic
|
||||
* @author Andy Scherzinger
|
||||
* Copyright (C) 2022 Andy Scherzinger <info@andy-scherzinger.de>
|
||||
* Copyright (C) 2017 Mario Danic <mario@lovelyhq.com>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Parts related to account import were either copied from or inspired by the great work done by David Luhmer at:
|
||||
* https://github.com/nextcloud/ownCloud-Account-Importer
|
||||
*/
|
||||
package com.nextcloud.talk.models.json.participants
|
||||
|
||||
import android.os.Parcelable
|
||||
import com.bluelinelabs.logansquare.annotation.JsonField
|
||||
import com.bluelinelabs.logansquare.annotation.JsonObject
|
||||
import com.nextcloud.talk.models.json.generic.GenericMeta
|
||||
import kotlinx.android.parcel.Parcelize
|
||||
|
||||
@Parcelize
|
||||
@JsonObject
|
||||
data class ParticipantsOCS(
|
||||
@JsonField(name = ["meta"])
|
||||
var meta: GenericMeta?,
|
||||
@JsonField(name = ["data"])
|
||||
var data: List<Participant>? = null
|
||||
) : Parcelable {
|
||||
// This constructor is added to work with the 'com.bluelinelabs.logansquare.annotation.JsonObject'
|
||||
constructor() : this(null, null)
|
||||
}
|
@ -1,74 +0,0 @@
|
||||
/*
|
||||
*
|
||||
* Nextcloud Talk application
|
||||
*
|
||||
* @author Mario Danic
|
||||
* Copyright (C) 2017 Mario Danic (mario@lovelyhq.com)
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.nextcloud.talk.models.json.participants;
|
||||
|
||||
import com.bluelinelabs.logansquare.annotation.JsonField;
|
||||
import com.bluelinelabs.logansquare.annotation.JsonObject;
|
||||
|
||||
import org.parceler.Parcel;
|
||||
|
||||
@Parcel
|
||||
@JsonObject
|
||||
public class ParticipantsOverall {
|
||||
@JsonField(name = "ocs")
|
||||
public ParticipantsOCS ocs;
|
||||
|
||||
public ParticipantsOCS getOcs() {
|
||||
return this.ocs;
|
||||
}
|
||||
|
||||
public void setOcs(ParticipantsOCS ocs) {
|
||||
this.ocs = ocs;
|
||||
}
|
||||
|
||||
public boolean equals(final Object o) {
|
||||
if (o == this) {
|
||||
return true;
|
||||
}
|
||||
if (!(o instanceof ParticipantsOverall)) {
|
||||
return false;
|
||||
}
|
||||
final ParticipantsOverall other = (ParticipantsOverall) o;
|
||||
if (!other.canEqual((Object) this)) {
|
||||
return false;
|
||||
}
|
||||
final Object this$ocs = this.getOcs();
|
||||
final Object other$ocs = other.getOcs();
|
||||
|
||||
return this$ocs == null ? other$ocs == null : this$ocs.equals(other$ocs);
|
||||
}
|
||||
|
||||
protected boolean canEqual(final Object other) {
|
||||
return other instanceof ParticipantsOverall;
|
||||
}
|
||||
|
||||
public int hashCode() {
|
||||
final int PRIME = 59;
|
||||
int result = 1;
|
||||
final Object $ocs = this.getOcs();
|
||||
result = result * PRIME + ($ocs == null ? 43 : $ocs.hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return "ParticipantsOverall(ocs=" + this.getOcs() + ")";
|
||||
}
|
||||
}
|
@ -1,8 +1,10 @@
|
||||
/*
|
||||
* Nextcloud Talk application
|
||||
*
|
||||
* @author Mario Danic
|
||||
* @author Andy Scherzinger
|
||||
* Copyright (C) 2022 Andy Scherzinger <info@andy-scherzinger.de>
|
||||
* Copyright (C) 2017 Mario Danic <mario@lovelyhq.com>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -16,9 +18,23 @@
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Parts related to account import were either copied from or inspired by the great work done by David Luhmer at:
|
||||
* https://github.com/nextcloud/ownCloud-Account-Importer
|
||||
*/
|
||||
package com.nextcloud.talk.models.json.generic
|
||||
package com.nextcloud.talk.models.json.participants
|
||||
|
||||
interface IGenericOCS {
|
||||
fun getGenericMeta(): GenericMeta?
|
||||
import android.os.Parcelable
|
||||
import com.bluelinelabs.logansquare.annotation.JsonField
|
||||
import com.bluelinelabs.logansquare.annotation.JsonObject
|
||||
import kotlinx.android.parcel.Parcelize
|
||||
|
||||
@Parcelize
|
||||
@JsonObject
|
||||
data class ParticipantsOverall(
|
||||
@JsonField(name = ["ocs"])
|
||||
var ocs: ParticipantsOCS? = null
|
||||
) : Parcelable {
|
||||
// This constructor is added to work with the 'com.bluelinelabs.logansquare.annotation.JsonObject'
|
||||
constructor() : this(null)
|
||||
}
|
@ -457,8 +457,8 @@ public class MagicWebSocketInstance extends WebSocketListener {
|
||||
public String getUserIdForSession(String session) {
|
||||
Participant participant = usersHashMap.get(session);
|
||||
if (participant != null) {
|
||||
if (participant.getActorType() == USERS) {
|
||||
return participant.getActorId();
|
||||
if (participant.getCalculatedActorType() == USERS) {
|
||||
return participant.getCalculatedActorId();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1 +1 @@
|
||||
361
|
||||
337
|
Loading…
Reference in New Issue
Block a user