This commit is contained in:
Mario Danic 2018-10-23 22:56:37 +02:00
parent b3baf4cdf2
commit f2b9303cc4
3 changed files with 22 additions and 6 deletions

View File

@ -313,18 +313,20 @@ public class ContactsController extends BaseController implements SearchView.OnQ
bundle.putParcelable(BundleKeys.KEY_CONVERSATION_TYPE, Parcels.wrap(roomType)); bundle.putParcelable(BundleKeys.KEY_CONVERSATION_TYPE, Parcels.wrap(roomType));
ArrayList<String> userIds = new ArrayList<>(); ArrayList<String> userIds = new ArrayList<>();
Set<Integer> selectedPositions = adapter.getSelectedPositionsAsSet(); Set<Integer> selectedPositions = adapter.getSelectedPositionsAsSet();
String groupUserId; ArrayList<String> groupIds = new ArrayList<>();
for (int selectedPosition : selectedPositions) { for (int selectedPosition : selectedPositions) {
if (adapter.getItem(selectedPosition) instanceof UserItem) { if (adapter.getItem(selectedPosition) instanceof UserItem) {
UserItem userItem = (UserItem) adapter.getItem(selectedPosition); UserItem userItem = (UserItem) adapter.getItem(selectedPosition);
if (!"groups".equals(userItem.getModel().getSource())) { if (!"groups".equals(userItem.getModel().getSource())) {
userIds.add(userItem.getModel().getUserId()); userIds.add(userItem.getModel().getUserId());
} else { } else {
groupUserId = userItem.getModel().getUserId(); groupIds.add(userItem.getModel().getUserId());
} }
} }
} }
bundle.putStringArrayList(BundleKeys.KEY_INVITED_PARTICIPANTS, userIds); bundle.putStringArrayList(BundleKeys.KEY_INVITED_PARTICIPANTS, userIds);
bundle.putStringArrayList(BundleKeys.KEY_INVITED_GROUP, groupIds);
bundle.putInt(BundleKeys.KEY_OPERATION_CODE, 11); bundle.putInt(BundleKeys.KEY_OPERATION_CODE, 11);
prepareAndShowBottomSheetWithBundle(bundle); prepareAndShowBottomSheetWithBundle(bundle);
} }

View File

@ -26,6 +26,7 @@ import android.net.Uri;
import android.os.Bundle; import android.os.Bundle;
import android.os.Handler; import android.os.Handler;
import android.text.TextUtils; import android.text.TextUtils;
import android.util.Log;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
@ -119,6 +120,7 @@ public class OperationsMenuController extends BaseController {
private Conversation.RoomType conversationType; private Conversation.RoomType conversationType;
private ArrayList<String> invitedUsers = new ArrayList<>(); private ArrayList<String> invitedUsers = new ArrayList<>();
private ArrayList<String> invitedGroup = new ArrayList<>();
private List<String> spreedCapabilities; private List<String> spreedCapabilities;
private String credentials; private String credentials;
@ -137,6 +139,10 @@ public class OperationsMenuController extends BaseController {
this.invitedUsers = args.getStringArrayList(BundleKeys.KEY_INVITED_PARTICIPANTS); this.invitedUsers = args.getStringArrayList(BundleKeys.KEY_INVITED_PARTICIPANTS);
} }
if (args.containsKey(BundleKeys.KEY_INVITED_GROUP)) {
this.invitedGroup = args.getStringArrayList(BundleKeys.KEY_INVITED_GROUP);
}
if (args.containsKey(BundleKeys.KEY_CONVERSATION_TYPE)) { if (args.containsKey(BundleKeys.KEY_CONVERSATION_TYPE)) {
this.conversationType = Parcels.unwrap(args.getParcelable(BundleKeys.KEY_CONVERSATION_TYPE)); this.conversationType = Parcels.unwrap(args.getParcelable(BundleKeys.KEY_CONVERSATION_TYPE));
} }
@ -268,18 +274,25 @@ public class OperationsMenuController extends BaseController {
case 11: case 11:
RetrofitBucket retrofitBucket; RetrofitBucket retrofitBucket;
boolean isGroupCallWorkaround = false; boolean isGroupCallWorkaround = false;
String invite = null;
if (invitedGroup.size() > 0) {
invite = invitedGroup.get(0);
}
if (conversationType.equals(Conversation.RoomType.ROOM_PUBLIC_CALL) || if (conversationType.equals(Conversation.RoomType.ROOM_PUBLIC_CALL) ||
!currentUser.hasSpreedCapabilityWithName("empty-group-conversation")) { !currentUser.hasSpreedCapabilityWithName("empty-group-room")) {
retrofitBucket = ApiUtils.getRetrofitBucketForCreateRoom(currentUser.getBaseUrl(), retrofitBucket = ApiUtils.getRetrofitBucketForCreateRoom(currentUser.getBaseUrl(),
"3", null, null); "3", invite, null);
} else { } else {
String roomType = "2"; String roomType = "2";
if (!currentUser.hasSpreedCapabilityWithName("empty-group-conversation")) { if (!currentUser.hasSpreedCapabilityWithName("empty-group-room")) {
isGroupCallWorkaround = true; isGroupCallWorkaround = true;
roomType = "3"; roomType = "3";
} }
retrofitBucket = ApiUtils.getRetrofitBucketForCreateRoom(currentUser.getBaseUrl(), retrofitBucket = ApiUtils.getRetrofitBucketForCreateRoom(currentUser.getBaseUrl(),
roomType, null, null); roomType, invite, null);
} }
final boolean isGroupCallWorkaroundFinal = isGroupCallWorkaround; final boolean isGroupCallWorkaroundFinal = isGroupCallWorkaround;

View File

@ -44,6 +44,7 @@ public class BundleKeys {
public static final String KEY_INTERNAL_USER_ID = "KEY_INTERNAL_USER_ID"; public static final String KEY_INTERNAL_USER_ID = "KEY_INTERNAL_USER_ID";
public static final String KEY_CONVERSATION_TYPE = "KEY_CONVERSATION_TYPE"; public static final String KEY_CONVERSATION_TYPE = "KEY_CONVERSATION_TYPE";
public static final String KEY_INVITED_PARTICIPANTS = "KEY_INVITED_PARTICIPANTS"; public static final String KEY_INVITED_PARTICIPANTS = "KEY_INVITED_PARTICIPANTS";
public static final String KEY_INVITED_GROUP = "KEY_INVITED_GROUP";
public static final String KEY_CONVERSATION_NAME = "KEY_CONVERSATION_NAME"; public static final String KEY_CONVERSATION_NAME = "KEY_CONVERSATION_NAME";
public static final String KEY_CALL_VOICE_ONLY = "KEY_CALL_VOICE_ONLY"; public static final String KEY_CALL_VOICE_ONLY = "KEY_CALL_VOICE_ONLY";
public static final String KEY_ACTIVE_CONVERSATION = "KEY_ACTIVE_CONVERSATION"; public static final String KEY_ACTIVE_CONVERSATION = "KEY_ACTIVE_CONVERSATION";