mirror of
https://github.com/nextcloud/talk-android
synced 2025-06-19 11:39:42 +01:00
Remove fallback code for "no-ping" not being available
The capability was introduces 2018 for Nextcloud 14 Signed-off-by: Joas Schilling <coding@schilljs.com>
This commit is contained in:
parent
6434630709
commit
61a2d389b4
@ -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;
|
||||
@ -260,7 +259,6 @@ public class CallController extends BaseController {
|
||||
private boolean audioOn = false;
|
||||
|
||||
private boolean isMultiSession = false;
|
||||
private boolean needsPing = true;
|
||||
|
||||
private boolean isVoiceOnlyCall;
|
||||
private boolean isIncomingCallFromNotification;
|
||||
@ -1207,15 +1205,6 @@ public class CallController extends BaseController {
|
||||
.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) {
|
||||
setupAndInitiateWebSocketsConnection();
|
||||
} else {
|
||||
@ -1313,45 +1302,13 @@ 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);
|
||||
}
|
||||
|
||||
@ -1482,12 +1439,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;
|
||||
|
@ -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);
|
||||
|
@ -844,7 +844,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 +854,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 +877,6 @@ class ChatController(args: Bundle) :
|
||||
}
|
||||
|
||||
if (conversationUser != null &&
|
||||
conversationUser.hasSpreedFeatureCapability("no-ping") &&
|
||||
activity != null &&
|
||||
!activity?.isChangingConfigurations!! &&
|
||||
!isLeavingForConversation
|
||||
@ -927,35 +921,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 +956,6 @@ class ChatController(args: Bundle) :
|
||||
|
||||
ApplicationWideCurrentRoomHolder.getInstance().session =
|
||||
currentConversation?.sessionId
|
||||
startPing()
|
||||
|
||||
setupWebsocket()
|
||||
checkLobbyState()
|
||||
@ -1029,7 +993,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