mirror of
https://github.com/nextcloud/talk-android
synced 2025-06-23 13:40:43 +01: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 hasParticipantsInCall = false
|
||||||
var inCallOnDifferentDevice = 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(
|
ncApi.getPeersForCall(
|
||||||
ApiUtils.getCredentials(signatureVerification.userEntity.username, signatureVerification.userEntity.token),
|
ApiUtils.getCredentials(signatureVerification.userEntity.username, signatureVerification.userEntity.token),
|
||||||
ApiUtils.getUrlForCall(
|
ApiUtils.getUrlForCall(
|
||||||
|
apiVersion,
|
||||||
signatureVerification.userEntity.baseUrl,
|
signatureVerification.userEntity.baseUrl,
|
||||||
decryptedPushMessage.id
|
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();
|
inCallFlag = (int) Participant.ParticipantFlags.IN_CALL_WITH_AUDIO_AND_VIDEO.getValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
ncApi.joinCall(credentials,
|
Integer apiVersion = ApiUtils.getApiVersion(conversationUser, "conversation", new int[] {1});
|
||||||
ApiUtils.getUrlForCall(baseUrl, roomToken), inCallFlag)
|
|
||||||
|
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())
|
.subscribeOn(Schedulers.io())
|
||||||
.retry(3)
|
.retry(3)
|
||||||
.observeOn(AndroidSchedulers.mainThread())
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
@ -1627,7 +1633,14 @@ public class CallController extends BaseController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void hangupNetworkCalls(boolean shutDownView) {
|
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())
|
.subscribeOn(Schedulers.io())
|
||||||
.observeOn(AndroidSchedulers.mainThread())
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
.subscribe(new Observer<GenericOverall>() {
|
.subscribe(new Observer<GenericOverall>() {
|
||||||
@ -1762,7 +1775,14 @@ public class CallController extends BaseController {
|
|||||||
|
|
||||||
private void getPeersForCall() {
|
private void getPeersForCall() {
|
||||||
Log.d(TAG, "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())
|
.subscribeOn(Schedulers.io())
|
||||||
.subscribe(new Observer<ParticipantsOverall>() {
|
.subscribe(new Observer<ParticipantsOverall>() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -208,8 +208,16 @@ public class CallNotificationController extends BaseController {
|
|||||||
.pushChangeHandler(new HorizontalChangeHandler()));
|
.pushChangeHandler(new HorizontalChangeHandler()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressLint("LongLogTag")
|
||||||
private void checkIfAnyParticipantsRemainInRoom() {
|
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()))
|
currentConversation.getToken()))
|
||||||
.subscribeOn(Schedulers.io())
|
.subscribeOn(Schedulers.io())
|
||||||
.takeWhile(observable -> !leavingScreen)
|
.takeWhile(observable -> !leavingScreen)
|
||||||
|
@ -196,6 +196,10 @@ public class ApiUtils {
|
|||||||
return getUrlForRoom(version, baseUrl, token) + "/webinary/lobby";
|
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,
|
public static RetrofitBucket getRetrofitBucketForCreateRoom(int version, String baseUrl, String roomType,
|
||||||
@Nullable String invite,
|
@Nullable String invite,
|
||||||
@Nullable String conversationName) {
|
@Nullable String conversationName) {
|
||||||
@ -243,15 +247,12 @@ public class ApiUtils {
|
|||||||
return retrofitBucket;
|
return retrofitBucket;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getUrlForCall(String baseUrl, String token) {
|
/**
|
||||||
// FIXME Introduce API version
|
* @deprecated Method is only needed before Talk 4 which is from 2018 => todrop
|
||||||
return baseUrl + ocsApiVersion + spreedApiVersion + "/call/" + token;
|
*/
|
||||||
|
@Deprecated
|
||||||
}
|
|
||||||
|
|
||||||
public static String getUrlForCallPing(String baseUrl, String token) {
|
public static String getUrlForCallPing(String baseUrl, String token) {
|
||||||
// FIXME Introduce API version
|
return getUrlForCall(1, baseUrl, token) + "/ping";
|
||||||
return getUrlForCall(baseUrl, token) + "/ping";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getUrlForChat(String baseUrl, String token) {
|
public static String getUrlForChat(String baseUrl, String token) {
|
||||||
|
Loading…
Reference in New Issue
Block a user