mirror of
https://github.com/nextcloud/talk-android
synced 2025-03-06 14:27:24 +00:00
Remove unsupported !"empty-group-room" case and finish conversation support for apiv4
Signed-off-by: Joas Schilling <coding@schilljs.com>
This commit is contained in:
parent
8e80c9fb99
commit
875c66ea8a
@ -270,29 +270,20 @@ public class OperationsMenuController extends BaseController {
|
|||||||
break;
|
break;
|
||||||
case 11:
|
case 11:
|
||||||
RetrofitBucket retrofitBucket;
|
RetrofitBucket retrofitBucket;
|
||||||
boolean isGroupCallWorkaround = false;
|
|
||||||
String invite = null;
|
String invite = null;
|
||||||
|
|
||||||
if (invitedGroups.size() > 0) {
|
if (invitedGroups.size() > 0) {
|
||||||
invite = invitedGroups.get(0);
|
invite = invitedGroups.get(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (conversationType.equals(Conversation.ConversationType.ROOM_PUBLIC_CALL) ||
|
if (conversationType.equals(Conversation.ConversationType.ROOM_PUBLIC_CALL)) {
|
||||||
!currentUser.hasSpreedFeatureCapability("empty-group-room")) {
|
|
||||||
retrofitBucket = ApiUtils.getRetrofitBucketForCreateRoom(apiVersion, currentUser.getBaseUrl(),
|
retrofitBucket = ApiUtils.getRetrofitBucketForCreateRoom(apiVersion, currentUser.getBaseUrl(),
|
||||||
"3", invite, conversationName);
|
"3", invite, conversationName);
|
||||||
} else {
|
} else {
|
||||||
String roomType = "2";
|
|
||||||
if (!currentUser.hasSpreedFeatureCapability("empty-group-room")) {
|
|
||||||
isGroupCallWorkaround = true;
|
|
||||||
roomType = "3";
|
|
||||||
}
|
|
||||||
|
|
||||||
retrofitBucket = ApiUtils.getRetrofitBucketForCreateRoom(apiVersion, currentUser.getBaseUrl(),
|
retrofitBucket = ApiUtils.getRetrofitBucketForCreateRoom(apiVersion, currentUser.getBaseUrl(),
|
||||||
roomType, invite, conversationName);
|
"2", invite, conversationName);
|
||||||
}
|
}
|
||||||
|
|
||||||
final boolean isGroupCallWorkaroundFinal = isGroupCallWorkaround;
|
|
||||||
ncApi.createRoom(credentials, retrofitBucket.getUrl(), retrofitBucket.getQueryMap())
|
ncApi.createRoom(credentials, retrofitBucket.getUrl(), retrofitBucket.getQueryMap())
|
||||||
.subscribeOn(Schedulers.io())
|
.subscribeOn(Schedulers.io())
|
||||||
.observeOn(AndroidSchedulers.mainThread())
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
@ -321,12 +312,8 @@ public class OperationsMenuController extends BaseController {
|
|||||||
@Override
|
@Override
|
||||||
public void onNext(RoomOverall roomOverall) {
|
public void onNext(RoomOverall roomOverall) {
|
||||||
conversation = roomOverall.getOcs().getData();
|
conversation = roomOverall.getOcs().getData();
|
||||||
if (conversationType.equals(Conversation.ConversationType.ROOM_PUBLIC_CALL) && isGroupCallWorkaroundFinal) {
|
|
||||||
performGroupCallWorkaround(credentials);
|
|
||||||
} else {
|
|
||||||
inviteUsersToAConversation();
|
inviteUsersToAConversation();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onError(Throwable e) {
|
public void onError(Throwable e) {
|
||||||
@ -393,40 +380,6 @@ public class OperationsMenuController extends BaseController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void performGroupCallWorkaround(String credentials) {
|
|
||||||
int apiVersion = ApiUtils.getConversationApiVersion(currentUser, new int[] {ApiUtils.APIv4, 1});
|
|
||||||
|
|
||||||
ncApi.makeRoomPrivate(credentials, ApiUtils.getUrlForRoomPublic(apiVersion, currentUser.getBaseUrl(),
|
|
||||||
conversation.getToken()))
|
|
||||||
.subscribeOn(Schedulers.io())
|
|
||||||
.observeOn(AndroidSchedulers.mainThread())
|
|
||||||
.retry(1)
|
|
||||||
.subscribe(new Observer<GenericOverall>() {
|
|
||||||
@Override
|
|
||||||
public void onSubscribe(Disposable d) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onNext(GenericOverall genericOverall) {
|
|
||||||
inviteUsersToAConversation();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onError(Throwable e) {
|
|
||||||
showResultImage(false, false);
|
|
||||||
dispose();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onComplete() {
|
|
||||||
dispose();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private void showResultImage(boolean everythingOK, boolean isGuestSupportError) {
|
private void showResultImage(boolean everythingOK, boolean isGuestSupportError) {
|
||||||
progressBar.setVisibility(View.GONE);
|
progressBar.setVisibility(View.GONE);
|
||||||
|
|
||||||
@ -552,7 +505,7 @@ public class OperationsMenuController extends BaseController {
|
|||||||
localInvitedGroups.remove(0);
|
localInvitedGroups.remove(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
int apiVersion = ApiUtils.getConversationApiVersion(currentUser, new int[] {1});
|
int apiVersion = ApiUtils.getConversationApiVersion(currentUser, new int[] {4, 1});
|
||||||
|
|
||||||
if (localInvitedUsers.size() > 0 || (localInvitedGroups.size() > 0 && currentUser.hasSpreedFeatureCapability("invite-groups-and-mails"))) {
|
if (localInvitedUsers.size() > 0 || (localInvitedGroups.size() > 0 && currentUser.hasSpreedFeatureCapability("invite-groups-and-mails"))) {
|
||||||
if ((localInvitedGroups.size() > 0 && currentUser.hasSpreedFeatureCapability("invite-groups-and-mails"))) {
|
if ((localInvitedGroups.size() > 0 && currentUser.hasSpreedFeatureCapability("invite-groups-and-mails"))) {
|
||||||
|
Loading…
Reference in New Issue
Block a user