mirror of
https://github.com/nextcloud/talk-android
synced 2025-03-06 06:15:12 +00:00
Throw the exception up
Signed-off-by: Joas Schilling <coding@schilljs.com>
This commit is contained in:
parent
fb2fbf3152
commit
ee3dc43530
@ -305,11 +305,6 @@ class MagicFirebaseMessagingService : FirebaseMessagingService() {
|
||||
|
||||
val apiVersion = ApiUtils.getConversationApiVersion(signatureVerification.userEntity, intArrayOf(1))
|
||||
|
||||
if (apiVersion == null) {
|
||||
Log.e(TAG, "No supported API version found")
|
||||
return
|
||||
}
|
||||
|
||||
ncApi.getPeersForCall(
|
||||
ApiUtils.getCredentials(signatureVerification.userEntity.username, signatureVerification.userEntity.token),
|
||||
ApiUtils.getUrlForCall(
|
||||
|
@ -231,12 +231,6 @@ class MainActivity : BaseActivity(), ActionBarProvider {
|
||||
val currentUser = userUtils.currentUser ?: return
|
||||
|
||||
val apiVersion = ApiUtils.getConversationApiVersion(currentUser, intArrayOf(1))
|
||||
|
||||
if (apiVersion == null) {
|
||||
Log.e(TAG, "No supported API version found")
|
||||
return
|
||||
}
|
||||
|
||||
val credentials = ApiUtils.getCredentials(currentUser.username, currentUser.token)
|
||||
val retrofitBucket = ApiUtils.getRetrofitBucketForCreateRoom(
|
||||
apiVersion, currentUser.baseUrl, roomType,
|
||||
@ -257,13 +251,6 @@ class MainActivity : BaseActivity(), ActionBarProvider {
|
||||
bundle.putString(KEY_ROOM_TOKEN, roomOverall.ocs.data.token)
|
||||
bundle.putString(KEY_ROOM_ID, roomOverall.ocs.data.roomId)
|
||||
if (currentUser.hasSpreedFeatureCapability("chat-v2")) {
|
||||
val apiVersion = ApiUtils.getConversationApiVersion(currentUser, intArrayOf(1))
|
||||
|
||||
if (apiVersion == null) {
|
||||
Log.e(TAG, "No supported API version found")
|
||||
return
|
||||
}
|
||||
|
||||
ncApi.getRoom(
|
||||
credentials,
|
||||
ApiUtils.getUrlForRoom(
|
||||
|
@ -441,12 +441,7 @@ public class CallController extends BaseController {
|
||||
}
|
||||
|
||||
private void handleFromNotification() {
|
||||
Integer apiVersion = ApiUtils.getConversationApiVersion(conversationUser, new int[] {1});
|
||||
|
||||
if (apiVersion == null) {
|
||||
Log.e(TAG, "No supported API version found", new Exception("No supported API version found"));
|
||||
return;
|
||||
}
|
||||
int apiVersion = ApiUtils.getConversationApiVersion(conversationUser, new int[] {1});
|
||||
|
||||
ncApi.getRooms(credentials, ApiUtils.getUrlForRooms(apiVersion, baseUrl))
|
||||
.retry(3)
|
||||
@ -1104,12 +1099,7 @@ public class CallController extends BaseController {
|
||||
}
|
||||
|
||||
private void fetchSignalingSettings() {
|
||||
Integer apiVersion = ApiUtils.getSignalingApiVersion(conversationUser, new int[] {2, 1});
|
||||
|
||||
if (apiVersion == null) {
|
||||
Log.e(TAG, "No supported API version found", new Exception("No supported API version found"));
|
||||
return;
|
||||
}
|
||||
int apiVersion = ApiUtils.getSignalingApiVersion(conversationUser, new int[] {2, 1});
|
||||
|
||||
ncApi.getSignalingSettings(credentials, ApiUtils.getUrlForSignalingSettings(apiVersion, baseUrl))
|
||||
.subscribeOn(Schedulers.io())
|
||||
@ -1248,11 +1238,7 @@ public class CallController extends BaseController {
|
||||
private void joinRoomAndCall() {
|
||||
callSession = ApplicationWideCurrentRoomHolder.getInstance().getSession();
|
||||
|
||||
Integer apiVersion = ApiUtils.getConversationApiVersion(conversationUser, new int[] {1});
|
||||
if (apiVersion == null) {
|
||||
Log.e(TAG, "No supported API version found", new Exception("No supported API version found"));
|
||||
return;
|
||||
}
|
||||
int apiVersion = ApiUtils.getConversationApiVersion(conversationUser, new int[] {1});
|
||||
|
||||
if (TextUtils.isEmpty(callSession)) {
|
||||
ncApi.joinRoom(credentials, ApiUtils.getUrlForParticipantsActive(apiVersion, baseUrl, roomToken),
|
||||
@ -1308,12 +1294,7 @@ public class CallController extends BaseController {
|
||||
inCallFlag = (int) Participant.ParticipantFlags.IN_CALL_WITH_AUDIO_AND_VIDEO.getValue();
|
||||
}
|
||||
|
||||
Integer apiVersion = ApiUtils.getConversationApiVersion(conversationUser, new int[] {1});
|
||||
|
||||
if (apiVersion == null) {
|
||||
Log.e(TAG, "No supported API version found", new Exception("No supported API version found"));
|
||||
return;
|
||||
}
|
||||
int apiVersion = ApiUtils.getConversationApiVersion(conversationUser, new int[] {1});
|
||||
|
||||
ncApi.joinCall(credentials, ApiUtils.getUrlForCall(apiVersion, baseUrl, roomToken), inCallFlag)
|
||||
.subscribeOn(Schedulers.io())
|
||||
@ -1375,12 +1356,7 @@ public class CallController extends BaseController {
|
||||
}
|
||||
|
||||
if (!hasExternalSignalingServer) {
|
||||
Integer apiVersion = ApiUtils.getSignalingApiVersion(conversationUser, new int[] {2, 1});
|
||||
|
||||
if (apiVersion == null) {
|
||||
Log.e(TAG, "No supported API version found", new Exception("No supported API version found"));
|
||||
return;
|
||||
}
|
||||
int apiVersion = ApiUtils.getSignalingApiVersion(conversationUser, new int[] {2, 1});
|
||||
|
||||
ncApi.pullSignalingMessages(credentials, ApiUtils.getUrlForSignaling(apiVersion,
|
||||
baseUrl, urlToken))
|
||||
@ -1647,12 +1623,7 @@ public class CallController extends BaseController {
|
||||
}
|
||||
|
||||
private void hangupNetworkCalls(boolean shutDownView) {
|
||||
Integer apiVersion = ApiUtils.getConversationApiVersion(conversationUser, new int[] {1});
|
||||
|
||||
if (apiVersion == null) {
|
||||
Log.e(TAG, "No supported API version found", new Exception("No supported API version found"));
|
||||
return;
|
||||
}
|
||||
int apiVersion = ApiUtils.getConversationApiVersion(conversationUser, new int[] {1});
|
||||
|
||||
ncApi.leaveCall(credentials, ApiUtils.getUrlForCall(apiVersion, baseUrl, roomToken))
|
||||
.subscribeOn(Schedulers.io())
|
||||
@ -1689,11 +1660,7 @@ public class CallController extends BaseController {
|
||||
}
|
||||
|
||||
private void leaveRoom(boolean shutDownView) {
|
||||
Integer apiVersion = ApiUtils.getConversationApiVersion(conversationUser, new int[] {1});
|
||||
if (apiVersion == null) {
|
||||
Log.e(TAG, "No supported API version found", new Exception("No supported API version found"));
|
||||
return;
|
||||
}
|
||||
int apiVersion = ApiUtils.getConversationApiVersion(conversationUser, new int[] {1});
|
||||
|
||||
ncApi.leaveRoom(credentials, ApiUtils.getUrlForParticipantsActive(apiVersion, baseUrl, roomToken))
|
||||
.subscribeOn(Schedulers.io())
|
||||
@ -1788,12 +1755,7 @@ public class CallController extends BaseController {
|
||||
|
||||
private void getPeersForCall() {
|
||||
Log.d(TAG, "getPeersForCall");
|
||||
Integer apiVersion = ApiUtils.getConversationApiVersion(conversationUser, new int[] {1});
|
||||
|
||||
if (apiVersion == null) {
|
||||
Log.e(TAG, "No supported API version found", new Exception("No supported API version found"));
|
||||
return;
|
||||
}
|
||||
int apiVersion = ApiUtils.getConversationApiVersion(conversationUser, new int[] {1});
|
||||
|
||||
ncApi.getPeersForCall(credentials, ApiUtils.getUrlForCall(apiVersion, baseUrl, roomToken))
|
||||
.subscribeOn(Schedulers.io())
|
||||
@ -2099,12 +2061,7 @@ public class CallController extends BaseController {
|
||||
urlToken = roomToken;
|
||||
}
|
||||
|
||||
Integer apiVersion = ApiUtils.getSignalingApiVersion(conversationUser, new int[] {2, 1});
|
||||
|
||||
if (apiVersion == null) {
|
||||
Log.e(TAG, "No supported API version found", new Exception("No supported API version found"));
|
||||
return;
|
||||
}
|
||||
int apiVersion = ApiUtils.getSignalingApiVersion(conversationUser, new int[] {2, 1});
|
||||
|
||||
ncApi.sendSignalingMessages(credentials, ApiUtils.getUrlForSignaling(apiVersion, baseUrl, urlToken),
|
||||
strings.toString())
|
||||
|
@ -210,12 +210,7 @@ public class CallNotificationController extends BaseController {
|
||||
|
||||
@SuppressLint("LongLogTag")
|
||||
private void checkIfAnyParticipantsRemainInRoom() {
|
||||
Integer apiVersion = ApiUtils.getConversationApiVersion(userBeingCalled, new int[] {1});
|
||||
|
||||
if (apiVersion == null) {
|
||||
Log.e(TAG, "No supported API version found", new Exception("No supported API version found"));
|
||||
return;
|
||||
}
|
||||
int apiVersion = ApiUtils.getConversationApiVersion(userBeingCalled, new int[] {1});
|
||||
|
||||
ncApi.getPeersForCall(credentials, ApiUtils.getUrlForCall(apiVersion, userBeingCalled.getBaseUrl(),
|
||||
currentConversation.getToken()))
|
||||
@ -267,11 +262,7 @@ public class CallNotificationController extends BaseController {
|
||||
|
||||
@SuppressLint("LongLogTag")
|
||||
private void handleFromNotification() {
|
||||
Integer apiVersion = ApiUtils.getConversationApiVersion(userBeingCalled, new int[] {4, 3, 1});
|
||||
if (apiVersion == null) {
|
||||
Log.e(TAG, "No supported API version found", new Exception("No supported API version found"));
|
||||
return;
|
||||
}
|
||||
int apiVersion = ApiUtils.getConversationApiVersion(userBeingCalled, new int[] {4, 3, 1});
|
||||
|
||||
ncApi.getRoom(credentials, ApiUtils.getUrlForRoom(apiVersion, userBeingCalled.getBaseUrl(), roomId))
|
||||
.subscribeOn(Schedulers.io())
|
||||
|
@ -82,7 +82,6 @@ import com.facebook.imagepipeline.image.CloseableImage
|
||||
import com.google.android.flexbox.FlexboxLayout
|
||||
import com.nextcloud.talk.R
|
||||
import com.nextcloud.talk.activities.MagicCallActivity
|
||||
import com.nextcloud.talk.activities.MainActivity
|
||||
import com.nextcloud.talk.adapters.messages.MagicIncomingTextMessageViewHolder
|
||||
import com.nextcloud.talk.adapters.messages.MagicOutcomingTextMessageViewHolder
|
||||
import com.nextcloud.talk.adapters.messages.MagicPreviewMessageViewHolder
|
||||
@ -116,6 +115,7 @@ import com.nextcloud.talk.utils.DateUtils
|
||||
import com.nextcloud.talk.utils.DisplayUtils
|
||||
import com.nextcloud.talk.utils.KeyboardUtils
|
||||
import com.nextcloud.talk.utils.MagicCharPolicy
|
||||
import com.nextcloud.talk.utils.NoSupportedApiException
|
||||
import com.nextcloud.talk.utils.NotificationUtils
|
||||
import com.nextcloud.talk.utils.UriUtils
|
||||
import com.nextcloud.talk.utils.bundle.BundleKeys
|
||||
@ -296,11 +296,6 @@ class ChatController(args: Bundle) :
|
||||
if (conversationUser != null) {
|
||||
val apiVersion = ApiUtils.getConversationApiVersion(conversationUser, intArrayOf(1))
|
||||
|
||||
if (apiVersion == null) {
|
||||
Log.e(TAG, "No supported API version found")
|
||||
return
|
||||
}
|
||||
|
||||
ncApi?.getRoom(credentials, ApiUtils.getUrlForRoom(apiVersion, conversationUser.baseUrl, roomToken))
|
||||
?.subscribeOn(Schedulers.io())
|
||||
?.observeOn(AndroidSchedulers.mainThread())
|
||||
@ -346,11 +341,6 @@ class ChatController(args: Bundle) :
|
||||
|
||||
val apiVersion = ApiUtils.getConversationApiVersion(conversationUser, intArrayOf(1))
|
||||
|
||||
if (apiVersion == null) {
|
||||
Log.e(TAG, "No supported API version found")
|
||||
return
|
||||
}
|
||||
|
||||
ncApi?.getRooms(credentials, ApiUtils.getUrlForRooms(apiVersion, conversationUser?.baseUrl))
|
||||
?.subscribeOn(Schedulers.io())?.observeOn(AndroidSchedulers.mainThread())
|
||||
?.subscribe(object : Observer<RoomsOverall> {
|
||||
@ -979,11 +969,6 @@ class ChatController(args: Bundle) :
|
||||
) {
|
||||
val apiVersion = ApiUtils.getConversationApiVersion(conversationUser, intArrayOf(1))
|
||||
|
||||
if (apiVersion == null) {
|
||||
Log.e(TAG, "No supported API version found")
|
||||
return
|
||||
}
|
||||
|
||||
ncApi?.joinRoom(
|
||||
credentials,
|
||||
ApiUtils.getUrlForParticipantsActive(apiVersion, conversationUser?.baseUrl, roomToken),
|
||||
@ -1053,11 +1038,6 @@ class ChatController(args: Bundle) :
|
||||
private fun leaveRoom() {
|
||||
val apiVersion = ApiUtils.getConversationApiVersion(conversationUser, intArrayOf(1))
|
||||
|
||||
if (apiVersion == null) {
|
||||
Log.e(TAG, "No supported API version found")
|
||||
return
|
||||
}
|
||||
|
||||
ncApi?.leaveRoom(
|
||||
credentials,
|
||||
ApiUtils.getUrlForParticipantsActive(
|
||||
@ -1144,11 +1124,6 @@ class ChatController(args: Bundle) :
|
||||
if (conversationUser != null) {
|
||||
val apiVersion = ApiUtils.getChatApiVersion(conversationUser, intArrayOf(1))
|
||||
|
||||
if (apiVersion == null) {
|
||||
Log.e(TAG, "No supported API version found")
|
||||
return
|
||||
}
|
||||
|
||||
ncApi!!.sendChatMessage(
|
||||
credentials,
|
||||
ApiUtils.getUrlForChat(apiVersion, conversationUser.baseUrl, roomToken),
|
||||
@ -1251,16 +1226,11 @@ class ChatController(args: Bundle) :
|
||||
}
|
||||
|
||||
if (!wasDetached) {
|
||||
var apiVersion: Int?
|
||||
var apiVersion: Int
|
||||
// FIXME this is a best guess, guests would need to get the capabilities themselves
|
||||
apiVersion = 1
|
||||
if (conversationUser != null) {
|
||||
apiVersion = ApiUtils.getChatApiVersion(conversationUser, intArrayOf(1))
|
||||
|
||||
if (apiVersion == null) {
|
||||
Log.e(TAG, "No supported API version found")
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
if (lookIntoFuture > 0) {
|
||||
@ -1687,11 +1657,6 @@ class ChatController(args: Bundle) :
|
||||
}
|
||||
R.id.action_delete_message -> {
|
||||
val apiVersion = ApiUtils.getChatApiVersion(conversationUser, intArrayOf(1))
|
||||
|
||||
if (apiVersion == null) {
|
||||
Log.e(TAG, "No supported API version found")
|
||||
}
|
||||
|
||||
ncApi?.deleteChatMessage(
|
||||
credentials,
|
||||
ApiUtils.getUrlForChatMessage(apiVersion, conversationUser?.baseUrl, roomToken,
|
||||
@ -1807,11 +1772,6 @@ class ChatController(args: Bundle) :
|
||||
|
||||
val apiVersion = ApiUtils.getConversationApiVersion(conversationUser, intArrayOf(1))
|
||||
|
||||
if (apiVersion == null) {
|
||||
Log.e(TAG, "No supported API version found")
|
||||
return
|
||||
}
|
||||
|
||||
val retrofitBucket = ApiUtils.getRetrofitBucketForCreateRoom(
|
||||
apiVersion, conversationUser?.baseUrl, "1",
|
||||
userMentionClickEvent.userId, null
|
||||
|
@ -288,13 +288,7 @@ public class ContactsController extends BaseController implements SearchView.OnQ
|
||||
userId = selectedUserIds.iterator().next();
|
||||
}
|
||||
|
||||
Integer apiVersion = ApiUtils.getConversationApiVersion(currentUser, new int[] {1});
|
||||
|
||||
if (apiVersion == null) {
|
||||
Log.e(TAG, "No supported API version found", new Exception("No supported API version found"));
|
||||
return;
|
||||
}
|
||||
|
||||
int apiVersion = ApiUtils.getConversationApiVersion(currentUser, new int[] {1});
|
||||
RetrofitBucket retrofitBucket = ApiUtils.getRetrofitBucketForCreateRoom(apiVersion,
|
||||
currentUser.getBaseUrl(),
|
||||
roomType,
|
||||
@ -318,8 +312,8 @@ public class ContactsController extends BaseController implements SearchView.OnQ
|
||||
bundle.putString(BundleKeys.INSTANCE.getKEY_ROOM_TOKEN(), roomOverall.getOcs().getData().getToken());
|
||||
bundle.putString(BundleKeys.INSTANCE.getKEY_ROOM_ID(), roomOverall.getOcs().getData().getRoomId());
|
||||
|
||||
Integer apiVersion = ApiUtils.getConversationApiVersion(currentUser, new int[] {1});
|
||||
if (apiVersion != null && currentUser.hasSpreedFeatureCapability("chat-v2")) {
|
||||
int apiVersion = ApiUtils.getConversationApiVersion(currentUser, new int[] {1});
|
||||
if (currentUser.hasSpreedFeatureCapability("chat-v2")) {
|
||||
|
||||
ncApi.getRoom(credentials,
|
||||
ApiUtils.getUrlForRoom(apiVersion, currentUser.getBaseUrl(),
|
||||
@ -860,12 +854,7 @@ public class ContactsController extends BaseController implements SearchView.OnQ
|
||||
roomType = "2";
|
||||
}
|
||||
|
||||
Integer apiVersion = ApiUtils.getConversationApiVersion(currentUser, new int[] {1});
|
||||
|
||||
if (apiVersion == null) {
|
||||
Log.e(TAG, "No supported API version found", new Exception("No supported API version found"));
|
||||
return false;
|
||||
}
|
||||
int apiVersion = ApiUtils.getConversationApiVersion(currentUser, new int[] {1});
|
||||
|
||||
RetrofitBucket retrofitBucket = ApiUtils.getRetrofitBucketForCreateRoom(apiVersion,
|
||||
currentUser.getBaseUrl(),
|
||||
|
@ -312,11 +312,6 @@ class ConversationInfoController(args: Bundle) : BaseController(args), FlexibleA
|
||||
|
||||
val apiVersion = ApiUtils.getConversationApiVersion(conversationUser, intArrayOf(1))
|
||||
|
||||
if (apiVersion == null) {
|
||||
Log.e(TAG, "No supported API version found")
|
||||
return
|
||||
}
|
||||
|
||||
ncApi.setLobbyForConversation(
|
||||
ApiUtils.getCredentials(conversationUser!!.username, conversationUser.token),
|
||||
ApiUtils.getUrlForRoomWebinaryLobby(apiVersion, conversationUser.baseUrl, conversation!!.token),
|
||||
@ -452,11 +447,6 @@ class ConversationInfoController(args: Bundle) : BaseController(args), FlexibleA
|
||||
private fun getListOfParticipants() {
|
||||
val apiVersion = ApiUtils.getConversationApiVersion(conversationUser, intArrayOf(1))
|
||||
|
||||
if (apiVersion == null) {
|
||||
Log.e(TAG, "No supported API version found")
|
||||
return
|
||||
}
|
||||
|
||||
ncApi.getPeersForCall(
|
||||
credentials,
|
||||
ApiUtils.getUrlForParticipants(apiVersion, conversationUser!!.baseUrl, conversationToken)
|
||||
@ -549,11 +539,6 @@ class ConversationInfoController(args: Bundle) : BaseController(args), FlexibleA
|
||||
private fun fetchRoomInfo() {
|
||||
val apiVersion = ApiUtils.getConversationApiVersion(conversationUser, intArrayOf(1))
|
||||
|
||||
if (apiVersion == null) {
|
||||
Log.e(TAG, "No supported API version found")
|
||||
return
|
||||
}
|
||||
|
||||
ncApi.getRoom(credentials, ApiUtils.getUrlForRoom(apiVersion, conversationUser!!.baseUrl, conversationToken))
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
@ -731,10 +716,6 @@ class ConversationInfoController(args: Bundle) : BaseController(args), FlexibleA
|
||||
|
||||
val apiVersion = ApiUtils.getConversationApiVersion(conversationUser, intArrayOf(1))
|
||||
|
||||
if (apiVersion == null) {
|
||||
Log.e(TAG, "No supported API version found")
|
||||
}
|
||||
|
||||
if (index == 0) {
|
||||
if (participant.type == Participant.ParticipantType.MODERATOR) {
|
||||
ncApi.demoteModeratorToUser(
|
||||
|
@ -418,12 +418,7 @@ public class ConversationsListController extends BaseController implements Searc
|
||||
|
||||
callItems = new ArrayList<>();
|
||||
|
||||
Integer apiVersion = ApiUtils.getConversationApiVersion(currentUser, new int[] {4, 1});
|
||||
if (apiVersion == null) {
|
||||
Log.e(TAG, "No supported API version found", new Exception("No supported API version found"));
|
||||
return;
|
||||
}
|
||||
|
||||
int apiVersion = ApiUtils.getConversationApiVersion(currentUser, new int[] {4, 1});
|
||||
|
||||
roomsQueryDisposable = ncApi.getRooms(credentials, ApiUtils.getUrlForRooms(apiVersion,
|
||||
currentUser.getBaseUrl()))
|
||||
|
@ -193,12 +193,7 @@ public class OperationsMenuController extends BaseController {
|
||||
credentials = null;
|
||||
}
|
||||
|
||||
Integer apiVersion = ApiUtils.getConversationApiVersion(currentUser, new int[] {1});
|
||||
|
||||
if (apiVersion == null) {
|
||||
Log.e(TAG, "No supported API version found", new Exception("No supported API version found"));
|
||||
return;
|
||||
}
|
||||
int apiVersion = ApiUtils.getConversationApiVersion(currentUser, new int[] {1});
|
||||
|
||||
switch (operationCode) {
|
||||
case 2:
|
||||
@ -401,12 +396,7 @@ public class OperationsMenuController extends BaseController {
|
||||
@SuppressLint("LongLogTag")
|
||||
private void performGroupCallWorkaround(String credentials) {
|
||||
|
||||
Integer apiVersion = ApiUtils.getConversationApiVersion(currentUser, new int[] {1});
|
||||
|
||||
if (apiVersion == null) {
|
||||
Log.e(TAG, "No supported API version found", new Exception("No supported API version found"));
|
||||
return;
|
||||
}
|
||||
int apiVersion = ApiUtils.getConversationApiVersion(currentUser, new int[] {1});
|
||||
|
||||
ncApi.makeRoomPrivate(credentials, ApiUtils.getUrlForRoomPublic(apiVersion, currentUser.getBaseUrl(),
|
||||
conversation.getToken()))
|
||||
@ -565,12 +555,7 @@ public class OperationsMenuController extends BaseController {
|
||||
localInvitedGroups.remove(0);
|
||||
}
|
||||
|
||||
Integer apiVersion = ApiUtils.getConversationApiVersion(currentUser, new int[] {1});
|
||||
|
||||
if (apiVersion == null) {
|
||||
Log.e(TAG, "No supported API version found", new Exception("No supported API version found"));
|
||||
return;
|
||||
}
|
||||
int apiVersion = ApiUtils.getConversationApiVersion(currentUser, new int[] {1});
|
||||
|
||||
if (localInvitedUsers.size() > 0 || (localInvitedGroups.size() > 0 && currentUser.hasSpreedFeatureCapability("invite-groups-and-mails"))) {
|
||||
if ((localInvitedGroups.size() > 0 && currentUser.hasSpreedFeatureCapability("invite-groups-and-mails"))) {
|
||||
|
@ -73,12 +73,7 @@ public class AddParticipantsToConversation extends Worker {
|
||||
String[] selectedGroupIds = data.getStringArray(BundleKeys.INSTANCE.getKEY_SELECTED_GROUPS());
|
||||
UserEntity user = userUtils.getUserWithInternalId(data.getLong(BundleKeys.INSTANCE.getKEY_INTERNAL_USER_ID(), -1));
|
||||
|
||||
Integer apiVersion = ApiUtils.getConversationApiVersion(user, new int[] {1});
|
||||
|
||||
if (apiVersion == null) {
|
||||
Log.e(TAG, "No supported API version found", new Exception("No supported API version found"));
|
||||
return Result.failure();
|
||||
}
|
||||
int apiVersion = ApiUtils.getConversationApiVersion(user, new int[] {1});
|
||||
|
||||
String conversationToken = data.getString(BundleKeys.INSTANCE.getKEY_TOKEN());
|
||||
String credentials = ApiUtils.getCredentials(user.getUsername(), user.getToken());
|
||||
|
@ -80,12 +80,7 @@ public class DeleteConversationWorker extends Worker {
|
||||
UserEntity operationUser = userUtils.getUserWithId(operationUserId);
|
||||
|
||||
if (operationUser != null) {
|
||||
Integer apiVersion = ApiUtils.getConversationApiVersion(operationUser, new int[] {1});
|
||||
|
||||
if (apiVersion == null) {
|
||||
Log.e(TAG, "No supported API version found", new Exception("No supported API version found"));
|
||||
return Result.failure();
|
||||
}
|
||||
int apiVersion = ApiUtils.getConversationApiVersion(operationUser, new int[] {1});
|
||||
|
||||
String credentials = ApiUtils.getCredentials(operationUser.getUsername(), operationUser.getToken());
|
||||
ncApi = retrofit.newBuilder().client(okHttpClient.newBuilder().cookieJar(new
|
||||
|
@ -87,12 +87,7 @@ public class LeaveConversationWorker extends Worker {
|
||||
EventStatus eventStatus = new EventStatus(operationUser.getId(),
|
||||
EventStatus.EventType.CONVERSATION_UPDATE, true);
|
||||
|
||||
Integer apiVersion = ApiUtils.getConversationApiVersion(operationUser, new int[] {1});
|
||||
|
||||
if (apiVersion == null) {
|
||||
Log.e(TAG, "No supported API version found", new Exception("No supported API version found"));
|
||||
return Result.failure();
|
||||
}
|
||||
int apiVersion = ApiUtils.getConversationApiVersion(operationUser, new int[] {1});
|
||||
|
||||
ncApi.removeSelfFromRoom(credentials, ApiUtils.getUrlForParticipantsSelf(apiVersion,
|
||||
operationUser.getBaseUrl(),
|
||||
|
@ -152,13 +152,7 @@ public class NotificationWorker extends Worker {
|
||||
importantConversation = Boolean.parseBoolean(arbitraryStorageEntity.getValue());
|
||||
}
|
||||
|
||||
Integer apiVersion = ApiUtils.getConversationApiVersion(userEntity, new int[] {1});
|
||||
|
||||
if (apiVersion == null) {
|
||||
Log.e(TAG, "No supported API version found", new Exception("No supported API version found"));
|
||||
return;
|
||||
}
|
||||
|
||||
int apiVersion = ApiUtils.getConversationApiVersion(userEntity, new int[] {1});
|
||||
|
||||
ncApi.getRoom(credentials, ApiUtils.getUrlForRoom(apiVersion, userEntity.getBaseUrl(),
|
||||
intent.getExtras().getString(BundleKeys.INSTANCE.getKEY_ROOM_TOKEN())))
|
||||
|
@ -82,12 +82,7 @@ public class SignalingSettingsWorker extends Worker {
|
||||
userEntity = userEntityList.get(i);
|
||||
UserEntity finalUserEntity = userEntity;
|
||||
|
||||
Integer apiVersion = ApiUtils.getSignalingApiVersion(finalUserEntity, new int[] {2, 1});
|
||||
|
||||
if (apiVersion == null) {
|
||||
Log.e(TAG, "No supported API version found", new Exception("No supported API version found"));
|
||||
continue;
|
||||
}
|
||||
int apiVersion = ApiUtils.getSignalingApiVersion(finalUserEntity, new int[] {2, 1});
|
||||
|
||||
ncApi.getSignalingSettings(ApiUtils.getCredentials(userEntity.getUsername(), userEntity.getToken()),
|
||||
ApiUtils.getUrlForSignalingSettings(apiVersion, userEntity.getBaseUrl()))
|
||||
|
@ -95,12 +95,7 @@ public class MentionAutocompletePresenter extends RecyclerViewPresenter<Mention>
|
||||
queryString = "";
|
||||
}
|
||||
|
||||
Integer apiVersion = ApiUtils.getChatApiVersion(currentUser, new int[] {1});
|
||||
|
||||
if (apiVersion == null) {
|
||||
Log.e(TAG, "No supported API version found", new Exception("No supported API version found"));
|
||||
return;
|
||||
}
|
||||
int apiVersion = ApiUtils.getChatApiVersion(currentUser, new int[] {1});
|
||||
|
||||
adapter.setFilter(queryString);
|
||||
ncApi.getMentionAutocompleteSuggestions(
|
||||
|
@ -109,7 +109,7 @@ public class ApiUtils {
|
||||
return baseUrl + ocsApiVersion + "/cloud/capabilities";
|
||||
}
|
||||
|
||||
public static Integer getConversationApiVersion(UserEntity capabilities, int[] versions) {
|
||||
public static int getConversationApiVersion(UserEntity capabilities, int[] versions) throws NoSupportedApiException {
|
||||
boolean hasApiV4 = false;
|
||||
for (int version : versions) {
|
||||
hasApiV4 |= version == 4;
|
||||
@ -135,10 +135,10 @@ public class ApiUtils {
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
throw new NoSupportedApiException();
|
||||
}
|
||||
|
||||
public static Integer getSignalingApiVersion(UserEntity capabilities, int[] versions) {
|
||||
public static int getSignalingApiVersion(UserEntity capabilities, int[] versions) throws NoSupportedApiException {
|
||||
for (int version : versions) {
|
||||
if (version == 2 && capabilities.hasSpreedFeatureCapability("sip-support")) {
|
||||
return version;
|
||||
@ -149,17 +149,17 @@ public class ApiUtils {
|
||||
return version;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
throw new NoSupportedApiException();
|
||||
}
|
||||
|
||||
public static Integer getChatApiVersion(UserEntity capabilities, int[] versions) {
|
||||
public static int getChatApiVersion(UserEntity capabilities, int[] versions) throws NoSupportedApiException {
|
||||
for (int version : versions) {
|
||||
if (version == 1 && capabilities.hasSpreedFeatureCapability("chat-v2")) {
|
||||
// Do not question that chat-v2 capability shows the availability of api/v1/ endpoint *see no evil*
|
||||
return version;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
throw new NoSupportedApiException();
|
||||
}
|
||||
|
||||
protected static String getUrlForApi(int version, String baseUrl) {
|
||||
|
@ -0,0 +1,3 @@
|
||||
package com.nextcloud.talk.utils
|
||||
|
||||
class NoSupportedApiException : RuntimeException("No supported API version found")
|
@ -97,10 +97,7 @@ public class DatabaseStorageModule implements StorageModule {
|
||||
intValue = 0;
|
||||
}
|
||||
|
||||
Integer apiVersion = ApiUtils.getConversationApiVersion(conversationUser, new int[] {4, 1});
|
||||
if (apiVersion == null) {
|
||||
Log.e(TAG, "No supported API version found", new Exception("No supported API version found"));
|
||||
}
|
||||
int apiVersion = ApiUtils.getConversationApiVersion(conversationUser, new int[] {4, 1});
|
||||
|
||||
ncApi.setNotificationLevel(ApiUtils.getCredentials(conversationUser.getUsername(), conversationUser.getToken()),
|
||||
ApiUtils.getUrlForRoomNotificationLevel(apiVersion, conversationUser.getBaseUrl(),
|
||||
|
@ -94,12 +94,7 @@ public class WebSocketConnectionHelper {
|
||||
|
||||
@SuppressLint("LongLogTag")
|
||||
HelloOverallWebSocketMessage getAssembledHelloModel(UserEntity userEntity, String ticket) {
|
||||
Integer apiVersion = ApiUtils.getSignalingApiVersion(userEntity, new int[] {2, 1});
|
||||
|
||||
if (apiVersion == null) {
|
||||
Log.e(TAG, "No supported API version found", new Exception("No supported API version found"));
|
||||
return null;
|
||||
}
|
||||
int apiVersion = ApiUtils.getSignalingApiVersion(userEntity, new int[] {2, 1});
|
||||
|
||||
HelloOverallWebSocketMessage helloOverallWebSocketMessage = new HelloOverallWebSocketMessage();
|
||||
helloOverallWebSocketMessage.setType("hello");
|
||||
|
Loading…
Reference in New Issue
Block a user