diff --git a/app/src/main/java/com/nextcloud/talk/activities/MainActivity.kt b/app/src/main/java/com/nextcloud/talk/activities/MainActivity.kt index cbed95d08..ea0ff0737 100644 --- a/app/src/main/java/com/nextcloud/talk/activities/MainActivity.kt +++ b/app/src/main/java/com/nextcloud/talk/activities/MainActivity.kt @@ -259,7 +259,7 @@ class MainActivity : BaseActivity(), ActionBarProvider { val credentials = ApiUtils.getCredentials(currentUser.username, currentUser.token) val retrofitBucket = ApiUtils.getRetrofitBucketForCreateRoom( apiVersion, currentUser.baseUrl, roomType, - userId, null + null, userId, null ) ncApi.createRoom( credentials, diff --git a/app/src/main/java/com/nextcloud/talk/adapters/items/UserItem.java b/app/src/main/java/com/nextcloud/talk/adapters/items/UserItem.java index f895be480..e4473464c 100644 --- a/app/src/main/java/com/nextcloud/talk/adapters/items/UserItem.java +++ b/app/src/main/java/com/nextcloud/talk/adapters/items/UserItem.java @@ -151,7 +151,10 @@ public class UserItem extends AbstractFlexibleItem holder.contactDisplayName.setText(NextcloudTalkApplication.Companion.getSharedApplication().getString(R.string.nc_guest)); } - if (participant.getActorType() == Participant.ActorType.GROUPS || "groups".equals(participant.getSource())) { + if (participant.getActorType() == Participant.ActorType.GROUPS || + "groups".equals(participant.getSource()) || + participant.getActorType() == Participant.ActorType.CIRCLES || + "circles".equals(participant.getSource())) { holder.simpleDraweeView.setImageResource(R.drawable.ic_circular_group); } else if (participant.getActorType() == Participant.ActorType.EMAILS) { holder.simpleDraweeView.setImageResource(R.drawable.ic_circular_mail); diff --git a/app/src/main/java/com/nextcloud/talk/controllers/ChatController.kt b/app/src/main/java/com/nextcloud/talk/controllers/ChatController.kt index a5ec23a8b..561b6a2fe 100644 --- a/app/src/main/java/com/nextcloud/talk/controllers/ChatController.kt +++ b/app/src/main/java/com/nextcloud/talk/controllers/ChatController.kt @@ -1625,6 +1625,7 @@ class ChatController(args: Bundle) : apiVersion, conversationUser?.baseUrl, "1", + null, message?.user?.id?.substring(6), null ) @@ -1818,8 +1819,12 @@ class ChatController(args: Bundle) : } val retrofitBucket = ApiUtils.getRetrofitBucketForCreateRoom( - apiVersion, conversationUser?.baseUrl, "1", - userMentionClickEvent.userId, null + apiVersion, + conversationUser?.baseUrl, + "1", + null, + userMentionClickEvent.userId, + null ) ncApi?.createRoom( diff --git a/app/src/main/java/com/nextcloud/talk/controllers/ContactsController.java b/app/src/main/java/com/nextcloud/talk/controllers/ContactsController.java index 792a5ceab..fd9d5243d 100644 --- a/app/src/main/java/com/nextcloud/talk/controllers/ContactsController.java +++ b/app/src/main/java/com/nextcloud/talk/controllers/ContactsController.java @@ -75,6 +75,7 @@ import org.greenrobot.eventbus.Subscribe; import org.greenrobot.eventbus.ThreadMode; import org.parceler.Parcels; +import java.io.IOException; import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; @@ -129,7 +130,6 @@ public class ContactsController extends BaseController implements SearchView.OnQ @BindView(R.id.loading_content) LinearLayout loadingContent; - @BindView(R.id.recycler_view) RecyclerView recyclerView; @@ -191,6 +191,8 @@ public class ContactsController extends BaseController implements SearchView.OnQ private Set selectedUserIds; private Set selectedGroupIds; + private Set selectedCircleIds; + private Set selectedEmails; private List existingParticipants; private boolean isAddingParticipantsView; private String conversationToken; @@ -217,8 +219,10 @@ public class ContactsController extends BaseController implements SearchView.OnQ } } - selectedGroupIds = new HashSet<>(); selectedUserIds = new HashSet<>(); + selectedGroupIds = new HashSet<>(); + selectedEmails = new HashSet<>(); + selectedCircleIds = new HashSet<>(); } @Override @@ -279,13 +283,18 @@ public class ContactsController extends BaseController implements SearchView.OnQ private void selectionDone() { if (!isAddingParticipantsView) { - if (!isPublicCall && (selectedGroupIds.size() + selectedUserIds.size() == 1)) { + if (!isPublicCall && (selectedCircleIds.size() + selectedGroupIds.size() + selectedUserIds.size() == 1)) { String userId; + String sourceType = null; String roomType = "1"; if (selectedGroupIds.size() == 1) { roomType = "2"; userId = selectedGroupIds.iterator().next(); + } else if (selectedCircleIds.size() == 1) { + roomType = "2"; + sourceType = "circles"; + userId = selectedCircleIds.iterator().next(); } else { userId = selectedUserIds.iterator().next(); } @@ -294,6 +303,7 @@ public class ContactsController extends BaseController implements SearchView.OnQ RetrofitBucket retrofitBucket = ApiUtils.getRetrofitBucketForCreateRoom(apiVersion, currentUser.getBaseUrl(), roomType, + sourceType, userId, null); ncApi.createRoom(credentials, @@ -368,23 +378,31 @@ public class ContactsController extends BaseController implements SearchView.OnQ ArrayList userIdsArray = new ArrayList<>(selectedUserIds); ArrayList groupIdsArray = new ArrayList<>(selectedGroupIds); + ArrayList emailsArray = new ArrayList<>(selectedEmails); + ArrayList circleIdsArray = new ArrayList<>(selectedCircleIds); bundle.putParcelable(BundleKeys.INSTANCE.getKEY_CONVERSATION_TYPE(), Parcels.wrap(roomType)); bundle.putStringArrayList(BundleKeys.INSTANCE.getKEY_INVITED_PARTICIPANTS(), userIdsArray); bundle.putStringArrayList(BundleKeys.INSTANCE.getKEY_INVITED_GROUP(), groupIdsArray); + bundle.putStringArrayList(BundleKeys.INSTANCE.getKEY_INVITED_EMAIL(), emailsArray); + bundle.putStringArrayList(BundleKeys.INSTANCE.getKEY_INVITED_CIRCLE(), circleIdsArray); bundle.putInt(BundleKeys.INSTANCE.getKEY_OPERATION_CODE(), 11); prepareAndShowBottomSheetWithBundle(bundle, true); } } else { String[] userIdsArray = selectedUserIds.toArray(new String[selectedUserIds.size()]); String[] groupIdsArray = selectedGroupIds.toArray(new String[selectedGroupIds.size()]); + String[] emailsArray = selectedEmails.toArray(new String[selectedEmails.size()]); + String[] circleIdsArray = selectedCircleIds.toArray(new String[selectedCircleIds.size()]); Data.Builder data = new Data.Builder(); data.putLong(BundleKeys.INSTANCE.getKEY_INTERNAL_USER_ID(), currentUser.getId()); data.putString(BundleKeys.INSTANCE.getKEY_TOKEN(), conversationToken); data.putStringArray(BundleKeys.INSTANCE.getKEY_SELECTED_USERS(), userIdsArray); data.putStringArray(BundleKeys.INSTANCE.getKEY_SELECTED_GROUPS(), groupIdsArray); + data.putStringArray(BundleKeys.INSTANCE.getKEY_SELECTED_EMAILS(), emailsArray); + data.putStringArray(BundleKeys.INSTANCE.getKEY_SELECTED_CIRCLES(), circleIdsArray); OneTimeWorkRequest addParticipantsToConversationWorker = new OneTimeWorkRequest.Builder(AddParticipantsToConversation.class).setInputData(data.build()).build(); @@ -467,15 +485,26 @@ public class ContactsController extends BaseController implements SearchView.OnQ modifiedQueryMap.put("itemId", conversationToken); } - List shareTypesList = null; + List shareTypesList; - shareTypesList = new ArrayList<>(); - // users - shareTypesList.add("0"); + shareTypesList = new ArrayList<>(); + // users + shareTypesList.add("0"); + if (!isAddingParticipantsView) { // groups shareTypesList.add("1"); + } else if (currentUser.hasSpreedFeatureCapability("invite-groups-and-mails")) { + // groups + shareTypesList.add("1"); + // emails + shareTypesList.add("4"); + } + if (currentUser.hasSpreedFeatureCapability("circles-support")) { + // circles + shareTypesList.add("7"); + } - modifiedQueryMap.put("shareTypes[]", shareTypesList); + modifiedQueryMap.put("shareTypes[]", shareTypesList); ncApi.getContactsWithSearchParam( credentials, @@ -498,43 +527,49 @@ public class ContactsController extends BaseController implements SearchView.OnQ EnumActorTypeConverter actorTypeConverter = new EnumActorTypeConverter(); try { - AutocompleteOverall autocompleteOverall = LoganSquare.parse(responseBody.string(), AutocompleteOverall.class); - autocompleteUsersHashSet.addAll(autocompleteOverall.getOcs().getData()); + AutocompleteOverall autocompleteOverall = LoganSquare.parse( + responseBody.string(), + AutocompleteOverall.class); + autocompleteUsersHashSet.addAll(autocompleteOverall.getOcs().getData()); - for (AutocompleteUser autocompleteUser : autocompleteUsersHashSet) { - if (!autocompleteUser.getId().equals(currentUser.getUserId()) && !existingParticipants.contains(autocompleteUser.getId())) { - participant = new Participant(); - participant.setActorId(autocompleteUser.getId()); - participant.setActorType(actorTypeConverter.getFromString(autocompleteUser.getSource())); - participant.setDisplayName(autocompleteUser.getLabel()); - participant.setSource(autocompleteUser.getSource()); + for (AutocompleteUser autocompleteUser : autocompleteUsersHashSet) { + if (!autocompleteUser.getId().equals(currentUser.getUserId()) + && !existingParticipants.contains(autocompleteUser.getId())) { + participant = new Participant(); + participant.setActorId(autocompleteUser.getId()); + participant.setActorType(actorTypeConverter.getFromString(autocompleteUser.getSource())); + participant.setDisplayName(autocompleteUser.getLabel()); + participant.setSource(autocompleteUser.getSource()); - String headerTitle; - - if (participant.getActorType() != Participant.ActorType.GROUPS) { - headerTitle = participant.getDisplayName().substring(0, 1).toUpperCase(); - } else { - headerTitle = getResources().getString(R.string.nc_groups); - } - - GenericTextHeaderItem genericTextHeaderItem; - if (!userHeaderItems.containsKey(headerTitle)) { - genericTextHeaderItem = new GenericTextHeaderItem(headerTitle); - userHeaderItems.put(headerTitle, genericTextHeaderItem); - } - - - UserItem newContactItem = new UserItem(participant, currentUser, - userHeaderItems.get(headerTitle)); - - if (!contactItems.contains(newContactItem)) { - newUserItemList.add(newContactItem); - } + String headerTitle; + if (participant.getActorType() == Participant.ActorType.GROUPS) { + headerTitle = getResources().getString(R.string.nc_groups); + } else if (participant.getActorType() == Participant.ActorType.CIRCLES) { + headerTitle = getResources().getString(R.string.nc_circles); + } else { + headerTitle = participant.getDisplayName().substring(0, 1).toUpperCase(); } + + GenericTextHeaderItem genericTextHeaderItem; + if (!userHeaderItems.containsKey(headerTitle)) { + genericTextHeaderItem = new GenericTextHeaderItem(headerTitle); + userHeaderItems.put(headerTitle, genericTextHeaderItem); + } + + UserItem newContactItem = new UserItem( + participant, + currentUser, + userHeaderItems.get(headerTitle) + ); + + if (!contactItems.contains(newContactItem)) { + newUserItemList.add(newContactItem); + } + } } - } catch (Exception exception) { - Log.e(TAG, "Parsing response body failed while getting contacts"); + } catch (IOException ioe) { + Log.e(TAG, "Parsing response body failed while getting contacts", ioe); } userHeaderItems = new HashMap<>(); @@ -544,7 +579,6 @@ public class ContactsController extends BaseController implements SearchView.OnQ String firstName; String secondName; - if (o1 instanceof UserItem) { firstName = ((UserItem) o1).getModel().getDisplayName(); } else { @@ -558,13 +592,35 @@ public class ContactsController extends BaseController implements SearchView.OnQ } if (o1 instanceof UserItem && o2 instanceof UserItem) { - if ("groups".equals(((UserItem) o1).getModel().getSource()) && "groups".equals(((UserItem) o2).getModel().getSource())) { + String firstSource = ((UserItem) o1).getModel().getSource(); + String secondSource = ((UserItem) o2).getModel().getSource(); + if (firstSource.equals(secondSource)) { return firstName.compareToIgnoreCase(secondName); - } else if ("groups".equals(((UserItem) o1).getModel().getSource())) { + } + + // First users + if ("users".equals(firstSource)) { return -1; - } else if ("groups".equals(((UserItem) o2).getModel().getSource())) { + } else if ("users".equals(secondSource)) { return 1; } + + // Then groups + if ("groups".equals(firstSource)) { + return -1; + } else if ("groups".equals(secondSource)) { + return 1; + } + + // Then circles + if ("circles".equals(firstSource)) { + return -1; + } else if ("circles".equals(secondSource)) { + return 1; + } + + // Otherwise fall back to name sorting + return firstName.compareToIgnoreCase(secondName); } return firstName.compareToIgnoreCase(secondName); @@ -574,7 +630,6 @@ public class ContactsController extends BaseController implements SearchView.OnQ String firstName; String secondName; - if (o1 instanceof UserItem) { firstName = ((UserItem) o1).getModel().getDisplayName(); } else { @@ -600,7 +655,6 @@ public class ContactsController extends BaseController implements SearchView.OnQ return firstName.compareToIgnoreCase(secondName); }); - if (newUserItemList.size() > 0) { adapter.updateDataSet(newUserItemList); } else { @@ -611,7 +665,6 @@ public class ContactsController extends BaseController implements SearchView.OnQ swipeRefreshLayout.setRefreshing(false); } } - } @Override @@ -620,7 +673,6 @@ public class ContactsController extends BaseController implements SearchView.OnQ swipeRefreshLayout.setRefreshing(false); } dispose(contactsQueryDisposable); - } @Override @@ -747,7 +799,7 @@ public class ContactsController extends BaseController implements SearchView.OnQ private void checkAndHandleDoneMenuItem() { if (adapter != null && doneMenuItem != null) { - if ((selectedGroupIds.size() + selectedUserIds.size() > 0) || isPublicCall) { + if ((selectedCircleIds.size() + selectedEmails.size() + selectedGroupIds.size() + selectedUserIds.size() > 0) || isPublicCall) { doneMenuItem.setVisible(true); } else { doneMenuItem.setVisible(false); @@ -759,10 +811,12 @@ public class ContactsController extends BaseController implements SearchView.OnQ @Override protected String getTitle() { - if (!isNewConversationView && !isAddingParticipantsView) { - return getResources().getString(R.string.nc_app_name); + if (isAddingParticipantsView) { + return getResources().getString(R.string.nc_add_participants); + } else if (isNewConversationView) { + return getResources().getString(R.string.nc_select_participants); } else { - return getResources().getString(R.string.nc_select_contacts); + return getResources().getString(R.string.nc_app_name); } } @@ -848,6 +902,7 @@ public class ContactsController extends BaseController implements SearchView.OnQ RetrofitBucket retrofitBucket = ApiUtils.getRetrofitBucketForCreateRoom(apiVersion, currentUser.getBaseUrl(), roomType, + null, userItem.getModel().getActorId(), null); @@ -899,6 +954,18 @@ public class ContactsController extends BaseController implements SearchView.OnQ } else { selectedGroupIds.remove(participant.getActorId()); } + } else if ("emails".equals(participant.getSource())) { + if (participant.isSelected()) { + selectedEmails.add(participant.getActorId()); + } else { + selectedEmails.remove(participant.getActorId()); + } + } else if ("circles".equals(participant.getSource())) { + if (participant.isSelected()) { + selectedCircleIds.add(participant.getActorId()); + } else { + selectedCircleIds.remove(participant.getActorId()); + } } else { if (participant.isSelected()) { selectedUserIds.add(participant.getActorId()); diff --git a/app/src/main/java/com/nextcloud/talk/controllers/bottomsheet/OperationsMenuController.java b/app/src/main/java/com/nextcloud/talk/controllers/bottomsheet/OperationsMenuController.java index eae132ecd..650f468be 100644 --- a/app/src/main/java/com/nextcloud/talk/controllers/bottomsheet/OperationsMenuController.java +++ b/app/src/main/java/com/nextcloud/talk/controllers/bottomsheet/OperationsMenuController.java @@ -403,10 +403,10 @@ public class OperationsMenuController extends BaseController { if (conversationType.equals(Conversation.ConversationType.ROOM_PUBLIC_CALL)) { retrofitBucket = ApiUtils.getRetrofitBucketForCreateRoom(apiVersion, currentUser.getBaseUrl(), - "3", invite, conversationName); + "3", null, invite, conversationName); } else { retrofitBucket = ApiUtils.getRetrofitBucketForCreateRoom(apiVersion, currentUser.getBaseUrl(), - "2", invite, conversationName); + "2", null, invite, conversationName); } ncApi.createRoom(credentials, retrofitBucket.getUrl(), retrofitBucket.getQueryMap()) @@ -582,10 +582,13 @@ public class OperationsMenuController extends BaseController { if ((localInvitedGroups.size() > 0 && currentUser.hasSpreedFeatureCapability("invite-groups-and-mails"))) { for (int i = 0; i < localInvitedGroups.size(); i++) { final String groupId = localInvitedGroups.get(i); - retrofitBucket = ApiUtils.getRetrofitBucketForAddGroupParticipant(apiVersion, - currentUser.getBaseUrl(), - conversation.getToken(), - groupId); + retrofitBucket = ApiUtils.getRetrofitBucketForAddParticipantWithSource( + apiVersion, + currentUser.getBaseUrl(), + conversation.getToken(), + "groups", + groupId + ); ncApi.addParticipant(credentials, retrofitBucket.getUrl(), retrofitBucket.getQueryMap()) .subscribeOn(Schedulers.io()) diff --git a/app/src/main/java/com/nextcloud/talk/jobs/AddParticipantsToConversation.java b/app/src/main/java/com/nextcloud/talk/jobs/AddParticipantsToConversation.java index 947e9693a..bfc2391a5 100644 --- a/app/src/main/java/com/nextcloud/talk/jobs/AddParticipantsToConversation.java +++ b/app/src/main/java/com/nextcloud/talk/jobs/AddParticipantsToConversation.java @@ -64,6 +64,8 @@ public class AddParticipantsToConversation extends Worker { Data data = getInputData(); String[] selectedUserIds = data.getStringArray(BundleKeys.INSTANCE.getKEY_SELECTED_USERS()); String[] selectedGroupIds = data.getStringArray(BundleKeys.INSTANCE.getKEY_SELECTED_GROUPS()); + String[] selectedCircleIds = data.getStringArray(BundleKeys.INSTANCE.getKEY_SELECTED_CIRCLES()); + String[] selectedEmails = data.getStringArray(BundleKeys.INSTANCE.getKEY_SELECTED_EMAILS()); UserEntity user = userUtils.getUserWithInternalId(data.getLong(BundleKeys.INSTANCE.getKEY_INTERNAL_USER_ID(), -1)); int apiVersion = ApiUtils.getConversationApiVersion(user, new int[] {ApiUtils.APIv4, 1}); @@ -72,23 +74,64 @@ public class AddParticipantsToConversation extends Worker { String credentials = ApiUtils.getCredentials(user.getUsername(), user.getToken()); RetrofitBucket retrofitBucket; - for (String userId : selectedUserIds) { - retrofitBucket = ApiUtils.getRetrofitBucketForAddParticipant(apiVersion, user.getBaseUrl(), - conversationToken, - userId); + if (selectedUserIds != null) { + for (String userId : selectedUserIds) { + retrofitBucket = ApiUtils.getRetrofitBucketForAddParticipant(apiVersion, user.getBaseUrl(), + conversationToken, + userId); - ncApi.addParticipant(credentials, retrofitBucket.getUrl(), retrofitBucket.getQueryMap()) - .subscribeOn(Schedulers.io()) - .blockingSubscribe(); + ncApi.addParticipant(credentials, retrofitBucket.getUrl(), retrofitBucket.getQueryMap()) + .subscribeOn(Schedulers.io()) + .blockingSubscribe(); + } } - for (String groupId : selectedGroupIds) { - retrofitBucket = ApiUtils.getRetrofitBucketForAddGroupParticipant(apiVersion, user.getBaseUrl(), conversationToken, - groupId); + if (selectedGroupIds != null) { + for (String groupId : selectedGroupIds) { + retrofitBucket = ApiUtils.getRetrofitBucketForAddParticipantWithSource( + apiVersion, + user.getBaseUrl(), + conversationToken, + "groups", + groupId + ); - ncApi.addParticipant(credentials, retrofitBucket.getUrl(), retrofitBucket.getQueryMap()) - .subscribeOn(Schedulers.io()) - .blockingSubscribe(); + ncApi.addParticipant(credentials, retrofitBucket.getUrl(), retrofitBucket.getQueryMap()) + .subscribeOn(Schedulers.io()) + .blockingSubscribe(); + } + } + + if (selectedCircleIds != null) { + for (String circleId : selectedCircleIds) { + retrofitBucket = ApiUtils.getRetrofitBucketForAddParticipantWithSource( + apiVersion, + user.getBaseUrl(), + conversationToken, + "circles", + circleId + ); + + ncApi.addParticipant(credentials, retrofitBucket.getUrl(), retrofitBucket.getQueryMap()) + .subscribeOn(Schedulers.io()) + .blockingSubscribe(); + } + } + + if (selectedEmails != null) { + for (String email : selectedEmails) { + retrofitBucket = ApiUtils.getRetrofitBucketForAddParticipantWithSource( + apiVersion, + user.getBaseUrl(), + conversationToken, + "emails", + email + ); + + ncApi.addParticipant(credentials, retrofitBucket.getUrl(), retrofitBucket.getQueryMap()) + .subscribeOn(Schedulers.io()) + .blockingSubscribe(); + } } eventBus.post(new EventStatus(user.getId(), EventStatus.EventType.PARTICIPANTS_UPDATE, true)); diff --git a/app/src/main/java/com/nextcloud/talk/models/json/converters/EnumActorTypeConverter.kt b/app/src/main/java/com/nextcloud/talk/models/json/converters/EnumActorTypeConverter.kt index ca7407a36..0a7ff90b7 100644 --- a/app/src/main/java/com/nextcloud/talk/models/json/converters/EnumActorTypeConverter.kt +++ b/app/src/main/java/com/nextcloud/talk/models/json/converters/EnumActorTypeConverter.kt @@ -24,6 +24,7 @@ package com.nextcloud.talk.models.json.converters import com.bluelinelabs.logansquare.typeconverters.StringBasedTypeConverter import com.nextcloud.talk.models.json.participants.Participant +import com.nextcloud.talk.models.json.participants.Participant.ActorType.CIRCLES import com.nextcloud.talk.models.json.participants.Participant.ActorType.DUMMY import com.nextcloud.talk.models.json.participants.Participant.ActorType.EMAILS import com.nextcloud.talk.models.json.participants.Participant.ActorType.GROUPS @@ -37,6 +38,7 @@ class EnumActorTypeConverter : StringBasedTypeConverter() "groups" -> GROUPS "guests" -> GUESTS "users" -> USERS + "circles" -> CIRCLES else -> DUMMY } } @@ -52,6 +54,7 @@ class EnumActorTypeConverter : StringBasedTypeConverter() GROUPS -> "groups" GUESTS -> "guests" USERS -> "users" + CIRCLES -> "circles" else -> "" } } diff --git a/app/src/main/java/com/nextcloud/talk/models/json/participants/Participant.java b/app/src/main/java/com/nextcloud/talk/models/json/participants/Participant.java index 35bf9fb58..adeb9a344 100644 --- a/app/src/main/java/com/nextcloud/talk/models/json/participants/Participant.java +++ b/app/src/main/java/com/nextcloud/talk/models/json/participants/Participant.java @@ -326,6 +326,7 @@ public class Participant { GROUPS, GUESTS, USERS, + CIRCLES, } public enum ParticipantType { diff --git a/app/src/main/java/com/nextcloud/talk/utils/ApiUtils.java b/app/src/main/java/com/nextcloud/talk/utils/ApiUtils.java index c9e75f1af..5870a1114 100644 --- a/app/src/main/java/com/nextcloud/talk/utils/ApiUtils.java +++ b/app/src/main/java/com/nextcloud/talk/utils/ApiUtils.java @@ -255,6 +255,7 @@ public class ApiUtils { } public static RetrofitBucket getRetrofitBucketForCreateRoom(int version, String baseUrl, String roomType, + @Nullable String source, @Nullable String invite, @Nullable String conversationName) { RetrofitBucket retrofitBucket = new RetrofitBucket(); @@ -265,6 +266,9 @@ public class ApiUtils { if (invite != null) { queryMap.put("invite", invite); } + if (source != null) { + queryMap.put("source", source); + } if (conversationName != null) { queryMap.put("roomName", conversationName); @@ -289,15 +293,15 @@ public class ApiUtils { } - public static RetrofitBucket getRetrofitBucketForAddGroupParticipant(int version, String baseUrl, String token, String group) { - RetrofitBucket retrofitBucket = getRetrofitBucketForAddParticipant(version, baseUrl, token, group); - retrofitBucket.getQueryMap().put("source", "groups"); - return retrofitBucket; - } - - public static RetrofitBucket getRetrofitBucketForAddMailParticipant(int version, String baseUrl, String token, String mail) { - RetrofitBucket retrofitBucket = getRetrofitBucketForAddParticipant(version, baseUrl, token, mail); - retrofitBucket.getQueryMap().put("source", "emails"); + public static RetrofitBucket getRetrofitBucketForAddParticipantWithSource( + int version, + String baseUrl, + String token, + String source, + String id + ) { + RetrofitBucket retrofitBucket = getRetrofitBucketForAddParticipant(version, baseUrl, token, id); + retrofitBucket.getQueryMap().put("source", source); return retrofitBucket; } diff --git a/app/src/main/java/com/nextcloud/talk/utils/bundle/BundleKeys.kt b/app/src/main/java/com/nextcloud/talk/utils/bundle/BundleKeys.kt index 49c400ae7..bb8c6c42e 100644 --- a/app/src/main/java/com/nextcloud/talk/utils/bundle/BundleKeys.kt +++ b/app/src/main/java/com/nextcloud/talk/utils/bundle/BundleKeys.kt @@ -23,6 +23,8 @@ package com.nextcloud.talk.utils.bundle object BundleKeys { val KEY_SELECTED_USERS = "KEY_SELECTED_USERS" val KEY_SELECTED_GROUPS = "KEY_SELECTED_GROUPS" + val KEY_SELECTED_CIRCLES = "KEY_SELECTED_CIRCLES" + val KEY_SELECTED_EMAILS = "KEY_SELECTED_EMAILS" val KEY_USERNAME = "KEY_USERNAME" val KEY_TOKEN = "KEY_TOKEN" val KEY_BASE_URL = "KEY_BASE_URL" @@ -48,7 +50,9 @@ object BundleKeys { val KEY_INTERNAL_USER_ID = "KEY_INTERNAL_USER_ID" val KEY_CONVERSATION_TYPE = "KEY_CONVERSATION_TYPE" val KEY_INVITED_PARTICIPANTS = "KEY_INVITED_PARTICIPANTS" + val KEY_INVITED_CIRCLE = "KEY_INVITED_CIRCLE" val KEY_INVITED_GROUP = "KEY_INVITED_GROUP" + val KEY_INVITED_EMAIL = "KEY_INVITED_EMAIL" val KEY_CONVERSATION_NAME = "KEY_CONVERSATION_NAME" val KEY_CALL_VOICE_ONLY = "KEY_CALL_VOICE_ONLY" val KEY_ACTIVE_CONVERSATION = "KEY_ACTIVE_CONVERSATION" diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 9d93e797c..01cab76c9 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -190,7 +190,8 @@ Remove from favorites - Select contacts + Select participants + Add participants Done @@ -312,6 +313,7 @@ Email Group Groups + Circles Participants Add participants