mirror of
https://github.com/nextcloud/talk-android
synced 2025-01-19 13:41:26 +00:00
Inject api version in call api
Signed-off-by: Joas Schilling <coding@schilljs.com>
This commit is contained in:
parent
33de3ed330
commit
f0eb3fec37
@ -302,9 +302,18 @@ class MagicFirebaseMessagingService : FirebaseMessagingService() {
|
||||
var hasParticipantsInCall = false
|
||||
var inCallOnDifferentDevice = false
|
||||
|
||||
|
||||
val apiVersion = ApiUtils.getApiVersion(signatureVerification.userEntity, "conversation", 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(
|
||||
apiVersion,
|
||||
signatureVerification.userEntity.baseUrl,
|
||||
decryptedPushMessage.id
|
||||
)
|
||||
@ -347,4 +356,10 @@ class MagicFirebaseMessagingService : FirebaseMessagingService() {
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
companion object {
|
||||
|
||||
private val TAG = "MagicFirebaseMessagingService"
|
||||
private const val ID_DELETE_CONVERSATION_DIALOG = 0
|
||||
}
|
||||
}
|
||||
|
@ -1302,8 +1302,14 @@ public class CallController extends BaseController {
|
||||
inCallFlag = (int) Participant.ParticipantFlags.IN_CALL_WITH_AUDIO_AND_VIDEO.getValue();
|
||||
}
|
||||
|
||||
ncApi.joinCall(credentials,
|
||||
ApiUtils.getUrlForCall(baseUrl, roomToken), inCallFlag)
|
||||
Integer apiVersion = ApiUtils.getApiVersion(conversationUser, "conversation", new int[] {1});
|
||||
|
||||
if (apiVersion == null) {
|
||||
Log.e(TAG, "No supported API version found", new Exception("No supported API version found"));
|
||||
return;
|
||||
}
|
||||
|
||||
ncApi.joinCall(credentials, ApiUtils.getUrlForCall(apiVersion, baseUrl, roomToken), inCallFlag)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.retry(3)
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
@ -1627,7 +1633,14 @@ public class CallController extends BaseController {
|
||||
}
|
||||
|
||||
private void hangupNetworkCalls(boolean shutDownView) {
|
||||
ncApi.leaveCall(credentials, ApiUtils.getUrlForCall(baseUrl, roomToken))
|
||||
Integer apiVersion = ApiUtils.getApiVersion(conversationUser, "conversation", new int[] {1});
|
||||
|
||||
if (apiVersion == null) {
|
||||
Log.e(TAG, "No supported API version found", new Exception("No supported API version found"));
|
||||
return;
|
||||
}
|
||||
|
||||
ncApi.leaveCall(credentials, ApiUtils.getUrlForCall(apiVersion, baseUrl, roomToken))
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Observer<GenericOverall>() {
|
||||
@ -1762,7 +1775,14 @@ public class CallController extends BaseController {
|
||||
|
||||
private void getPeersForCall() {
|
||||
Log.d(TAG, "getPeersForCall");
|
||||
ncApi.getPeersForCall(credentials, ApiUtils.getUrlForCall(baseUrl, roomToken))
|
||||
Integer apiVersion = ApiUtils.getApiVersion(conversationUser, "conversation", new int[] {1});
|
||||
|
||||
if (apiVersion == null) {
|
||||
Log.e(TAG, "No supported API version found", new Exception("No supported API version found"));
|
||||
return;
|
||||
}
|
||||
|
||||
ncApi.getPeersForCall(credentials, ApiUtils.getUrlForCall(apiVersion, baseUrl, roomToken))
|
||||
.subscribeOn(Schedulers.io())
|
||||
.subscribe(new Observer<ParticipantsOverall>() {
|
||||
@Override
|
||||
|
@ -208,8 +208,16 @@ public class CallNotificationController extends BaseController {
|
||||
.pushChangeHandler(new HorizontalChangeHandler()));
|
||||
}
|
||||
|
||||
@SuppressLint("LongLogTag")
|
||||
private void checkIfAnyParticipantsRemainInRoom() {
|
||||
ncApi.getPeersForCall(credentials, ApiUtils.getUrlForCall(userBeingCalled.getBaseUrl(),
|
||||
Integer apiVersion = ApiUtils.getApiVersion(userBeingCalled, "conversation", new int[] {1});
|
||||
|
||||
if (apiVersion == null) {
|
||||
Log.e(TAG, "No supported API version found", new Exception("No supported API version found"));
|
||||
return;
|
||||
}
|
||||
|
||||
ncApi.getPeersForCall(credentials, ApiUtils.getUrlForCall(apiVersion, userBeingCalled.getBaseUrl(),
|
||||
currentConversation.getToken()))
|
||||
.subscribeOn(Schedulers.io())
|
||||
.takeWhile(observable -> !leavingScreen)
|
||||
|
@ -196,6 +196,10 @@ public class ApiUtils {
|
||||
return getUrlForRoom(version, baseUrl, token) + "/webinary/lobby";
|
||||
}
|
||||
|
||||
public static String getUrlForCall(int version, String baseUrl, String token) {
|
||||
return getUrlForApi(version, baseUrl) + "/call/" + token;
|
||||
}
|
||||
|
||||
public static RetrofitBucket getRetrofitBucketForCreateRoom(int version, String baseUrl, String roomType,
|
||||
@Nullable String invite,
|
||||
@Nullable String conversationName) {
|
||||
@ -243,15 +247,12 @@ public class ApiUtils {
|
||||
return retrofitBucket;
|
||||
}
|
||||
|
||||
public static String getUrlForCall(String baseUrl, String token) {
|
||||
// FIXME Introduce API version
|
||||
return baseUrl + ocsApiVersion + spreedApiVersion + "/call/" + token;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Method is only needed before Talk 4 which is from 2018 => todrop
|
||||
*/
|
||||
@Deprecated
|
||||
public static String getUrlForCallPing(String baseUrl, String token) {
|
||||
// FIXME Introduce API version
|
||||
return getUrlForCall(baseUrl, token) + "/ping";
|
||||
return getUrlForCall(1, baseUrl, token) + "/ping";
|
||||
}
|
||||
|
||||
public static String getUrlForChat(String baseUrl, String token) {
|
||||
|
Loading…
Reference in New Issue
Block a user