mirror of
https://github.com/nextcloud/talk-android
synced 2025-06-21 12:39:58 +01:00
Merge pull request #1214 from nextcloud/techdebt/noid/drop-ping-functionality
🧹 Drop ping functionality
This commit is contained in:
commit
5d7d9e70bb
@ -194,12 +194,6 @@ public interface NcApi {
|
|||||||
@DELETE
|
@DELETE
|
||||||
Observable<GenericOverall> leaveCall(@Nullable @Header("Authorization") String authorization, @Url String url);
|
Observable<GenericOverall> leaveCall(@Nullable @Header("Authorization") String authorization, @Url String url);
|
||||||
|
|
||||||
/*
|
|
||||||
Server URL is: baseUrl + ocsApiVersion + spreedApiVersion + /call/callToken/ping
|
|
||||||
*/
|
|
||||||
@POST
|
|
||||||
Observable<GenericOverall> pingCall(@Nullable @Header("Authorization") String authorization, @Url String url);
|
|
||||||
|
|
||||||
@GET
|
@GET
|
||||||
Observable<SignalingSettingsOverall> getSignalingSettings(@Nullable @Header("Authorization") String authorization,
|
Observable<SignalingSettingsOverall> getSignalingSettings(@Nullable @Header("Authorization") String authorization,
|
||||||
@Url String url);
|
@Url String url);
|
||||||
|
@ -244,7 +244,6 @@ public class CallController extends BaseController {
|
|||||||
private VideoCapturer videoCapturer;
|
private VideoCapturer videoCapturer;
|
||||||
private EglBase rootEglBase;
|
private EglBase rootEglBase;
|
||||||
private Disposable signalingDisposable;
|
private Disposable signalingDisposable;
|
||||||
private Disposable pingDisposable;
|
|
||||||
private List<PeerConnection.IceServer> iceServers;
|
private List<PeerConnection.IceServer> iceServers;
|
||||||
private CameraEnumerator cameraEnumerator;
|
private CameraEnumerator cameraEnumerator;
|
||||||
private String roomToken;
|
private String roomToken;
|
||||||
@ -259,9 +258,6 @@ public class CallController extends BaseController {
|
|||||||
private boolean videoOn = false;
|
private boolean videoOn = false;
|
||||||
private boolean audioOn = false;
|
private boolean audioOn = false;
|
||||||
|
|
||||||
private boolean isMultiSession = false;
|
|
||||||
private boolean needsPing = true;
|
|
||||||
|
|
||||||
private boolean isVoiceOnlyCall;
|
private boolean isVoiceOnlyCall;
|
||||||
private boolean isIncomingCallFromNotification;
|
private boolean isIncomingCallFromNotification;
|
||||||
private Handler callControlHandler = new Handler();
|
private Handler callControlHandler = new Handler();
|
||||||
@ -1198,24 +1194,7 @@ public class CallController extends BaseController {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onNext(CapabilitiesOverall capabilitiesOverall) {
|
public void onNext(CapabilitiesOverall capabilitiesOverall) {
|
||||||
isMultiSession = capabilitiesOverall.getOcs().getData()
|
// FIXME check for compatible Call API version
|
||||||
.getCapabilities() != null && capabilitiesOverall.getOcs().getData()
|
|
||||||
.getCapabilities().getSpreedCapability() != null &&
|
|
||||||
capabilitiesOverall.getOcs().getData()
|
|
||||||
.getCapabilities().getSpreedCapability()
|
|
||||||
.getFeatures() != null && capabilitiesOverall.getOcs().getData()
|
|
||||||
.getCapabilities().getSpreedCapability()
|
|
||||||
.getFeatures().contains("multi-room-users");
|
|
||||||
|
|
||||||
needsPing = !(capabilitiesOverall.getOcs().getData()
|
|
||||||
.getCapabilities() != null && capabilitiesOverall.getOcs().getData()
|
|
||||||
.getCapabilities().getSpreedCapability() != null &&
|
|
||||||
capabilitiesOverall.getOcs().getData()
|
|
||||||
.getCapabilities().getSpreedCapability()
|
|
||||||
.getFeatures() != null && capabilitiesOverall.getOcs().getData()
|
|
||||||
.getCapabilities().getSpreedCapability()
|
|
||||||
.getFeatures().contains("no-ping"));
|
|
||||||
|
|
||||||
if (hasExternalSignalingServer) {
|
if (hasExternalSignalingServer) {
|
||||||
setupAndInitiateWebSocketsConnection();
|
setupAndInitiateWebSocketsConnection();
|
||||||
} else {
|
} else {
|
||||||
@ -1225,7 +1204,7 @@ public class CallController extends BaseController {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onError(Throwable e) {
|
public void onError(Throwable e) {
|
||||||
isMultiSession = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -1313,45 +1292,7 @@ public class CallController extends BaseController {
|
|||||||
|
|
||||||
ApplicationWideCurrentRoomHolder.getInstance().setInCall(true);
|
ApplicationWideCurrentRoomHolder.getInstance().setInCall(true);
|
||||||
|
|
||||||
if (needsPing) {
|
if (!TextUtils.isEmpty(roomToken)) {
|
||||||
ncApi.pingCall(credentials, ApiUtils.getUrlForCallPing(baseUrl, roomToken))
|
|
||||||
.subscribeOn(Schedulers.io())
|
|
||||||
.observeOn(AndroidSchedulers.mainThread())
|
|
||||||
.repeatWhen(observable -> observable.delay(5000, TimeUnit.MILLISECONDS))
|
|
||||||
.takeWhile(observable -> isConnectionEstablished())
|
|
||||||
.retry(3, observable -> isConnectionEstablished())
|
|
||||||
.subscribe(new Observer<GenericOverall>() {
|
|
||||||
@Override
|
|
||||||
public void onSubscribe(Disposable d) {
|
|
||||||
pingDisposable = d;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onNext(GenericOverall genericOverall) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onError(Throwable e) {
|
|
||||||
dispose(pingDisposable);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onComplete() {
|
|
||||||
dispose(pingDisposable);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
// Start pulling signaling messages
|
|
||||||
String urlToken = null;
|
|
||||||
if (isMultiSession) {
|
|
||||||
urlToken = roomToken;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!conversationUser.hasSpreedFeatureCapability("no-ping") && !TextUtils.isEmpty(roomId)) {
|
|
||||||
NotificationUtils.INSTANCE.cancelExistingNotificationsForRoom(getApplicationContext(), conversationUser, roomId);
|
|
||||||
} else if (!TextUtils.isEmpty(roomToken)) {
|
|
||||||
NotificationUtils.INSTANCE.cancelExistingNotificationsForRoom(getApplicationContext(), conversationUser, roomToken);
|
NotificationUtils.INSTANCE.cancelExistingNotificationsForRoom(getApplicationContext(), conversationUser, roomToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1359,7 +1300,7 @@ public class CallController extends BaseController {
|
|||||||
int apiVersion = ApiUtils.getSignalingApiVersion(conversationUser, new int[] {2, 1});
|
int apiVersion = ApiUtils.getSignalingApiVersion(conversationUser, new int[] {2, 1});
|
||||||
|
|
||||||
ncApi.pullSignalingMessages(credentials, ApiUtils.getUrlForSignaling(apiVersion,
|
ncApi.pullSignalingMessages(credentials, ApiUtils.getUrlForSignaling(apiVersion,
|
||||||
baseUrl, urlToken))
|
baseUrl, roomToken))
|
||||||
.subscribeOn(Schedulers.io())
|
.subscribeOn(Schedulers.io())
|
||||||
.observeOn(AndroidSchedulers.mainThread())
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
.repeatWhen(observable -> observable)
|
.repeatWhen(observable -> observable)
|
||||||
@ -1482,12 +1423,6 @@ public class CallController extends BaseController {
|
|||||||
if (disposable != null && !disposable.isDisposed()) {
|
if (disposable != null && !disposable.isDisposed()) {
|
||||||
disposable.dispose();
|
disposable.dispose();
|
||||||
} else if (disposable == null) {
|
} else if (disposable == null) {
|
||||||
|
|
||||||
if (pingDisposable != null && !pingDisposable.isDisposed()) {
|
|
||||||
pingDisposable.dispose();
|
|
||||||
pingDisposable = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (signalingDisposable != null && !signalingDisposable.isDisposed()) {
|
if (signalingDisposable != null && !signalingDisposable.isDisposed()) {
|
||||||
signalingDisposable.dispose();
|
signalingDisposable.dispose();
|
||||||
signalingDisposable = null;
|
signalingDisposable = null;
|
||||||
@ -1636,14 +1571,10 @@ public class CallController extends BaseController {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onNext(GenericOverall genericOverall) {
|
public void onNext(GenericOverall genericOverall) {
|
||||||
if (isMultiSession) {
|
if (shutDownView && getActivity() != null) {
|
||||||
if (shutDownView && getActivity() != null) {
|
getActivity().finish();
|
||||||
getActivity().finish();
|
} else if (!shutDownView && (currentCallStatus.equals(CallStatus.RECONNECTING) || currentCallStatus.equals(CallStatus.PUBLISHER_FAILED))) {
|
||||||
} else if (!shutDownView && (currentCallStatus.equals(CallStatus.RECONNECTING) || currentCallStatus.equals(CallStatus.PUBLISHER_FAILED))) {
|
initiateCall();
|
||||||
initiateCall();
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
leaveRoom(shutDownView);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2056,14 +1987,9 @@ public class CallController extends BaseController {
|
|||||||
String stringToSend = stringBuilder.toString();
|
String stringToSend = stringBuilder.toString();
|
||||||
strings.add(stringToSend);
|
strings.add(stringToSend);
|
||||||
|
|
||||||
String urlToken = null;
|
|
||||||
if (isMultiSession) {
|
|
||||||
urlToken = roomToken;
|
|
||||||
}
|
|
||||||
|
|
||||||
int apiVersion = ApiUtils.getSignalingApiVersion(conversationUser, new int[] {2, 1});
|
int apiVersion = ApiUtils.getSignalingApiVersion(conversationUser, new int[] {2, 1});
|
||||||
|
|
||||||
ncApi.sendSignalingMessages(credentials, ApiUtils.getUrlForSignaling(apiVersion, baseUrl, urlToken),
|
ncApi.sendSignalingMessages(credentials, ApiUtils.getUrlForSignaling(apiVersion, baseUrl, roomToken),
|
||||||
strings.toString())
|
strings.toString())
|
||||||
.retry(3)
|
.retry(3)
|
||||||
.subscribeOn(Schedulers.io())
|
.subscribeOn(Schedulers.io())
|
||||||
|
@ -403,8 +403,7 @@ public class CallNotificationController extends BaseController {
|
|||||||
.incoming_gradient));
|
.incoming_gradient));
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((AvatarStatusCodeHolder.getInstance().getStatusCode() == 200 || AvatarStatusCodeHolder.getInstance().getStatusCode() == 0) &&
|
if (AvatarStatusCodeHolder.getInstance().getStatusCode() == 200 || AvatarStatusCodeHolder.getInstance().getStatusCode() == 0) {
|
||||||
userBeingCalled.hasSpreedFeatureCapability("no-ping")) {
|
|
||||||
if (getActivity() != null) {
|
if (getActivity() != null) {
|
||||||
Bitmap backgroundBitmap = bitmap.copy(bitmap.getConfig(), true);
|
Bitmap backgroundBitmap = bitmap.copy(bitmap.getConfig(), true);
|
||||||
new BlurPostProcessor(5, getActivity()).process(backgroundBitmap);
|
new BlurPostProcessor(5, getActivity()).process(backgroundBitmap);
|
||||||
|
@ -150,7 +150,6 @@ import java.util.ArrayList
|
|||||||
import java.util.Date
|
import java.util.Date
|
||||||
import java.util.HashMap
|
import java.util.HashMap
|
||||||
import java.util.Objects
|
import java.util.Objects
|
||||||
import java.util.concurrent.TimeUnit
|
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
@AutoInjector(NextcloudTalkApplication::class)
|
@AutoInjector(NextcloudTalkApplication::class)
|
||||||
@ -844,7 +843,7 @@ class ChatController(args: Bundle) :
|
|||||||
cancelNotificationsForCurrentConversation()
|
cancelNotificationsForCurrentConversation()
|
||||||
|
|
||||||
if (inConversation) {
|
if (inConversation) {
|
||||||
if (wasDetached && conversationUser?.hasSpreedFeatureCapability("no-ping") ?: false) {
|
if (wasDetached) {
|
||||||
currentConversation?.sessionId = "0"
|
currentConversation?.sessionId = "0"
|
||||||
wasDetached = false
|
wasDetached = false
|
||||||
joinRoomWithPassword()
|
joinRoomWithPassword()
|
||||||
@ -854,12 +853,7 @@ class ChatController(args: Bundle) :
|
|||||||
|
|
||||||
private fun cancelNotificationsForCurrentConversation() {
|
private fun cancelNotificationsForCurrentConversation() {
|
||||||
if (conversationUser != null) {
|
if (conversationUser != null) {
|
||||||
if (!conversationUser.hasSpreedFeatureCapability("no-ping") && !TextUtils.isEmpty(roomId)) {
|
if (!TextUtils.isEmpty(roomToken)) {
|
||||||
NotificationUtils.cancelExistingNotificationsForRoom(
|
|
||||||
applicationContext,
|
|
||||||
conversationUser, roomId
|
|
||||||
)
|
|
||||||
} else if (!TextUtils.isEmpty(roomToken)) {
|
|
||||||
NotificationUtils.cancelExistingNotificationsForRoom(
|
NotificationUtils.cancelExistingNotificationsForRoom(
|
||||||
applicationContext,
|
applicationContext,
|
||||||
conversationUser, roomToken!!
|
conversationUser, roomToken!!
|
||||||
@ -882,7 +876,6 @@ class ChatController(args: Bundle) :
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (conversationUser != null &&
|
if (conversationUser != null &&
|
||||||
conversationUser.hasSpreedFeatureCapability("no-ping") &&
|
|
||||||
activity != null &&
|
activity != null &&
|
||||||
!activity?.isChangingConfigurations!! &&
|
!activity?.isChangingConfigurations!! &&
|
||||||
!isLeavingForConversation
|
!isLeavingForConversation
|
||||||
@ -927,35 +920,6 @@ class ChatController(args: Bundle) :
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun startPing() {
|
|
||||||
if (conversationUser != null && !conversationUser.hasSpreedFeatureCapability("no-ping")) {
|
|
||||||
ncApi?.pingCall(
|
|
||||||
credentials,
|
|
||||||
ApiUtils.getUrlForCallPing(
|
|
||||||
conversationUser.baseUrl,
|
|
||||||
roomToken
|
|
||||||
)
|
|
||||||
)
|
|
||||||
?.subscribeOn(Schedulers.io())
|
|
||||||
?.observeOn(AndroidSchedulers.mainThread())
|
|
||||||
?.repeatWhen { observable -> observable.delay(5000, TimeUnit.MILLISECONDS) }
|
|
||||||
?.takeWhile { observable -> inConversation }
|
|
||||||
?.retry(3) { observable -> inConversation }
|
|
||||||
?.subscribe(object : Observer<GenericOverall> {
|
|
||||||
override fun onSubscribe(d: Disposable) {
|
|
||||||
disposableList.add(d)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onNext(genericOverall: GenericOverall) {
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onError(e: Throwable) {}
|
|
||||||
|
|
||||||
override fun onComplete() {}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@OnClick(R.id.smileyButton)
|
@OnClick(R.id.smileyButton)
|
||||||
internal fun onSmileyClick() {
|
internal fun onSmileyClick() {
|
||||||
emojiPopup?.toggle()
|
emojiPopup?.toggle()
|
||||||
@ -991,7 +955,6 @@ class ChatController(args: Bundle) :
|
|||||||
|
|
||||||
ApplicationWideCurrentRoomHolder.getInstance().session =
|
ApplicationWideCurrentRoomHolder.getInstance().session =
|
||||||
currentConversation?.sessionId
|
currentConversation?.sessionId
|
||||||
startPing()
|
|
||||||
|
|
||||||
setupWebsocket()
|
setupWebsocket()
|
||||||
checkLobbyState()
|
checkLobbyState()
|
||||||
@ -1029,7 +992,6 @@ class ChatController(args: Bundle) :
|
|||||||
currentConversation?.sessionId
|
currentConversation?.sessionId
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
startPing()
|
|
||||||
if (isFirstMessagesProcessing) {
|
if (isFirstMessagesProcessing) {
|
||||||
pullChatMessages(0)
|
pullChatMessages(0)
|
||||||
} else {
|
} else {
|
||||||
|
@ -617,12 +617,7 @@ public class NotificationWorker extends Worker {
|
|||||||
|
|
||||||
intent.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP | Intent.FLAG_ACTIVITY_NEW_TASK);
|
intent.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP | Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||||
|
|
||||||
if (!signatureVerification.getUserEntity().hasSpreedFeatureCapability
|
bundle.putString(BundleKeys.INSTANCE.getKEY_ROOM_TOKEN(), decryptedPushMessage.getId());
|
||||||
("no-ping")) {
|
|
||||||
bundle.putString(BundleKeys.INSTANCE.getKEY_ROOM_ID(), decryptedPushMessage.getId());
|
|
||||||
} else {
|
|
||||||
bundle.putString(BundleKeys.INSTANCE.getKEY_ROOM_TOKEN(), decryptedPushMessage.getId());
|
|
||||||
}
|
|
||||||
|
|
||||||
bundle.putParcelable(BundleKeys.INSTANCE.getKEY_USER_ENTITY(), signatureVerification.getUserEntity());
|
bundle.putParcelable(BundleKeys.INSTANCE.getKEY_USER_ENTITY(), signatureVerification.getUserEntity());
|
||||||
|
|
||||||
@ -633,9 +628,7 @@ public class NotificationWorker extends Worker {
|
|||||||
|
|
||||||
switch (decryptedPushMessage.getType()) {
|
switch (decryptedPushMessage.getType()) {
|
||||||
case "call":
|
case "call":
|
||||||
if (!bundle.containsKey(BundleKeys.INSTANCE.getKEY_ROOM_TOKEN())) {
|
if (bundle.containsKey(BundleKeys.INSTANCE.getKEY_ROOM_TOKEN())) {
|
||||||
context.startActivity(intent);
|
|
||||||
} else {
|
|
||||||
showNotificationForCallWithNoPing(intent);
|
showNotificationForCallWithNoPing(intent);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -295,14 +295,6 @@ public class ApiUtils {
|
|||||||
return retrofitBucket;
|
return retrofitBucket;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated Method is only needed before Talk 4 which is from 2018 => todrop
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
public static String getUrlForCallPing(String baseUrl, String token) {
|
|
||||||
return getUrlForCall(1, baseUrl, token) + "/ping";
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String getUrlForUserProfile(String baseUrl) {
|
public static String getUrlForUserProfile(String baseUrl) {
|
||||||
return baseUrl + ocsApiVersion + "/cloud/user";
|
return baseUrl + ocsApiVersion + "/cloud/user";
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user