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
|
||||
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
|
||||
Observable<SignalingSettingsOverall> getSignalingSettings(@Nullable @Header("Authorization") String authorization,
|
||||
@Url String url);
|
||||
|
@ -244,7 +244,6 @@ public class CallController extends BaseController {
|
||||
private VideoCapturer videoCapturer;
|
||||
private EglBase rootEglBase;
|
||||
private Disposable signalingDisposable;
|
||||
private Disposable pingDisposable;
|
||||
private List<PeerConnection.IceServer> iceServers;
|
||||
private CameraEnumerator cameraEnumerator;
|
||||
private String roomToken;
|
||||
@ -259,9 +258,6 @@ public class CallController extends BaseController {
|
||||
private boolean videoOn = false;
|
||||
private boolean audioOn = false;
|
||||
|
||||
private boolean isMultiSession = false;
|
||||
private boolean needsPing = true;
|
||||
|
||||
private boolean isVoiceOnlyCall;
|
||||
private boolean isIncomingCallFromNotification;
|
||||
private Handler callControlHandler = new Handler();
|
||||
@ -1198,24 +1194,7 @@ public class CallController extends BaseController {
|
||||
|
||||
@Override
|
||||
public void onNext(CapabilitiesOverall capabilitiesOverall) {
|
||||
isMultiSession = 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("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"));
|
||||
|
||||
// FIXME check for compatible Call API version
|
||||
if (hasExternalSignalingServer) {
|
||||
setupAndInitiateWebSocketsConnection();
|
||||
} else {
|
||||
@ -1225,7 +1204,7 @@ public class CallController extends BaseController {
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
isMultiSession = false;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -1313,45 +1292,7 @@ public class CallController extends BaseController {
|
||||
|
||||
ApplicationWideCurrentRoomHolder.getInstance().setInCall(true);
|
||||
|
||||
if (needsPing) {
|
||||
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)) {
|
||||
if (!TextUtils.isEmpty(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});
|
||||
|
||||
ncApi.pullSignalingMessages(credentials, ApiUtils.getUrlForSignaling(apiVersion,
|
||||
baseUrl, urlToken))
|
||||
baseUrl, roomToken))
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.repeatWhen(observable -> observable)
|
||||
@ -1482,12 +1423,6 @@ public class CallController extends BaseController {
|
||||
if (disposable != null && !disposable.isDisposed()) {
|
||||
disposable.dispose();
|
||||
} else if (disposable == null) {
|
||||
|
||||
if (pingDisposable != null && !pingDisposable.isDisposed()) {
|
||||
pingDisposable.dispose();
|
||||
pingDisposable = null;
|
||||
}
|
||||
|
||||
if (signalingDisposable != null && !signalingDisposable.isDisposed()) {
|
||||
signalingDisposable.dispose();
|
||||
signalingDisposable = null;
|
||||
@ -1636,14 +1571,10 @@ public class CallController extends BaseController {
|
||||
|
||||
@Override
|
||||
public void onNext(GenericOverall genericOverall) {
|
||||
if (isMultiSession) {
|
||||
if (shutDownView && getActivity() != null) {
|
||||
getActivity().finish();
|
||||
} else if (!shutDownView && (currentCallStatus.equals(CallStatus.RECONNECTING) || currentCallStatus.equals(CallStatus.PUBLISHER_FAILED))) {
|
||||
initiateCall();
|
||||
}
|
||||
} else {
|
||||
leaveRoom(shutDownView);
|
||||
if (shutDownView && getActivity() != null) {
|
||||
getActivity().finish();
|
||||
} else if (!shutDownView && (currentCallStatus.equals(CallStatus.RECONNECTING) || currentCallStatus.equals(CallStatus.PUBLISHER_FAILED))) {
|
||||
initiateCall();
|
||||
}
|
||||
}
|
||||
|
||||
@ -2056,14 +1987,9 @@ public class CallController extends BaseController {
|
||||
String stringToSend = stringBuilder.toString();
|
||||
strings.add(stringToSend);
|
||||
|
||||
String urlToken = null;
|
||||
if (isMultiSession) {
|
||||
urlToken = roomToken;
|
||||
}
|
||||
|
||||
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())
|
||||
.retry(3)
|
||||
.subscribeOn(Schedulers.io())
|
||||
|
@ -403,8 +403,7 @@ public class CallNotificationController extends BaseController {
|
||||
.incoming_gradient));
|
||||
}
|
||||
|
||||
if ((AvatarStatusCodeHolder.getInstance().getStatusCode() == 200 || AvatarStatusCodeHolder.getInstance().getStatusCode() == 0) &&
|
||||
userBeingCalled.hasSpreedFeatureCapability("no-ping")) {
|
||||
if (AvatarStatusCodeHolder.getInstance().getStatusCode() == 200 || AvatarStatusCodeHolder.getInstance().getStatusCode() == 0) {
|
||||
if (getActivity() != null) {
|
||||
Bitmap backgroundBitmap = bitmap.copy(bitmap.getConfig(), true);
|
||||
new BlurPostProcessor(5, getActivity()).process(backgroundBitmap);
|
||||
|
@ -150,7 +150,6 @@ import java.util.ArrayList
|
||||
import java.util.Date
|
||||
import java.util.HashMap
|
||||
import java.util.Objects
|
||||
import java.util.concurrent.TimeUnit
|
||||
import javax.inject.Inject
|
||||
|
||||
@AutoInjector(NextcloudTalkApplication::class)
|
||||
@ -844,7 +843,7 @@ class ChatController(args: Bundle) :
|
||||
cancelNotificationsForCurrentConversation()
|
||||
|
||||
if (inConversation) {
|
||||
if (wasDetached && conversationUser?.hasSpreedFeatureCapability("no-ping") ?: false) {
|
||||
if (wasDetached) {
|
||||
currentConversation?.sessionId = "0"
|
||||
wasDetached = false
|
||||
joinRoomWithPassword()
|
||||
@ -854,12 +853,7 @@ class ChatController(args: Bundle) :
|
||||
|
||||
private fun cancelNotificationsForCurrentConversation() {
|
||||
if (conversationUser != null) {
|
||||
if (!conversationUser.hasSpreedFeatureCapability("no-ping") && !TextUtils.isEmpty(roomId)) {
|
||||
NotificationUtils.cancelExistingNotificationsForRoom(
|
||||
applicationContext,
|
||||
conversationUser, roomId
|
||||
)
|
||||
} else if (!TextUtils.isEmpty(roomToken)) {
|
||||
if (!TextUtils.isEmpty(roomToken)) {
|
||||
NotificationUtils.cancelExistingNotificationsForRoom(
|
||||
applicationContext,
|
||||
conversationUser, roomToken!!
|
||||
@ -882,7 +876,6 @@ class ChatController(args: Bundle) :
|
||||
}
|
||||
|
||||
if (conversationUser != null &&
|
||||
conversationUser.hasSpreedFeatureCapability("no-ping") &&
|
||||
activity != null &&
|
||||
!activity?.isChangingConfigurations!! &&
|
||||
!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)
|
||||
internal fun onSmileyClick() {
|
||||
emojiPopup?.toggle()
|
||||
@ -991,7 +955,6 @@ class ChatController(args: Bundle) :
|
||||
|
||||
ApplicationWideCurrentRoomHolder.getInstance().session =
|
||||
currentConversation?.sessionId
|
||||
startPing()
|
||||
|
||||
setupWebsocket()
|
||||
checkLobbyState()
|
||||
@ -1029,7 +992,6 @@ class ChatController(args: Bundle) :
|
||||
currentConversation?.sessionId
|
||||
)
|
||||
}
|
||||
startPing()
|
||||
if (isFirstMessagesProcessing) {
|
||||
pullChatMessages(0)
|
||||
} else {
|
||||
|
@ -617,12 +617,7 @@ public class NotificationWorker extends Worker {
|
||||
|
||||
intent.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP | Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
|
||||
if (!signatureVerification.getUserEntity().hasSpreedFeatureCapability
|
||||
("no-ping")) {
|
||||
bundle.putString(BundleKeys.INSTANCE.getKEY_ROOM_ID(), decryptedPushMessage.getId());
|
||||
} else {
|
||||
bundle.putString(BundleKeys.INSTANCE.getKEY_ROOM_TOKEN(), decryptedPushMessage.getId());
|
||||
}
|
||||
bundle.putString(BundleKeys.INSTANCE.getKEY_ROOM_TOKEN(), decryptedPushMessage.getId());
|
||||
|
||||
bundle.putParcelable(BundleKeys.INSTANCE.getKEY_USER_ENTITY(), signatureVerification.getUserEntity());
|
||||
|
||||
@ -633,9 +628,7 @@ public class NotificationWorker extends Worker {
|
||||
|
||||
switch (decryptedPushMessage.getType()) {
|
||||
case "call":
|
||||
if (!bundle.containsKey(BundleKeys.INSTANCE.getKEY_ROOM_TOKEN())) {
|
||||
context.startActivity(intent);
|
||||
} else {
|
||||
if (bundle.containsKey(BundleKeys.INSTANCE.getKEY_ROOM_TOKEN())) {
|
||||
showNotificationForCallWithNoPing(intent);
|
||||
}
|
||||
break;
|
||||
|
@ -295,14 +295,6 @@ public class ApiUtils {
|
||||
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) {
|
||||
return baseUrl + ocsApiVersion + "/cloud/user";
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user