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));
ArrayList<String> userIds = new ArrayList<>();
Set<Integer> selectedPositions = adapter.getSelectedPositionsAsSet();
String groupUserId;
ArrayList<String> groupIds = new ArrayList<>();
for (int selectedPosition : selectedPositions) {
if (adapter.getItem(selectedPosition) instanceof UserItem) {
UserItem userItem = (UserItem) adapter.getItem(selectedPosition);
if (!"groups".equals(userItem.getModel().getSource())) {
userIds.add(userItem.getModel().getUserId());
} else {
groupUserId = userItem.getModel().getUserId();
groupIds.add(userItem.getModel().getUserId());
}
}
}
bundle.putStringArrayList(BundleKeys.KEY_INVITED_PARTICIPANTS, userIds);
bundle.putStringArrayList(BundleKeys.KEY_INVITED_GROUP, groupIds);
bundle.putInt(BundleKeys.KEY_OPERATION_CODE, 11);
prepareAndShowBottomSheetWithBundle(bundle);
}

View File

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