mirror of
https://github.com/nextcloud/talk-android
synced 2025-07-14 16:25:05 +01:00
Restructuring
Signed-off-by: Mario Danic <mario@lovelyhq.com>
This commit is contained in:
parent
eb9d7ec0d7
commit
3b447ee7d5
@ -485,7 +485,7 @@ public class CallActivity extends AppCompatActivity {
|
||||
|
||||
for (String sessionId : newSessions) {
|
||||
if (getPeerConnectionWrapperForSessionId(sessionId) == null) {
|
||||
if (sessionId.compareTo(callSession) < 0 ) {
|
||||
if (sessionId.compareTo(callSession) < 0) {
|
||||
PeerConnectionWrapper connectionWrapper = alwaysGetPeerConnectionWrapperForSessionId(sessionId,
|
||||
false);
|
||||
connectionWrapper.getPeerConnection().createAnswer(connectionWrapper.getMagicSdpObserver(), sdpConstraints);
|
||||
@ -632,7 +632,7 @@ public class CallActivity extends AppCompatActivity {
|
||||
}
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.BACKGROUND)
|
||||
public void onMessageEvent(SessionDescriptionSendEvent sessionDescriptionSend) throws IOException {
|
||||
public void onMessageEvent(SessionDescriptionSendEvent sessionDescriptionSend) {
|
||||
Log.d("MARIO_123", "SENDING " + sessionDescriptionSend.getType());
|
||||
String credentials = ApiHelper.getCredentials(userEntity.getUsername(), userEntity.getToken());
|
||||
NCMessageWrapper ncMessageWrapper = new NCMessageWrapper();
|
||||
@ -656,22 +656,22 @@ public class CallActivity extends AppCompatActivity {
|
||||
ncSignalingMessage.setPayload(ncMessagePayload);
|
||||
ncMessageWrapper.setSignalingMessage(ncSignalingMessage);
|
||||
|
||||
List<NCMessageWrapper> ncMessageWrappers = new ArrayList<>();
|
||||
ncMessageWrappers.add(ncMessageWrapper);
|
||||
|
||||
Log.d("MARIO_123", LoganSquare.serialize(ncMessageWrappers));
|
||||
List<String> awesomeJson = new ArrayList<>();
|
||||
try {
|
||||
awesomeJson.add(LoganSquare.serialize(ncMessageWrapper));
|
||||
|
||||
Log.d("MARIO_JSON", LoganSquare.serialize(ncMessageWrapper));
|
||||
ncApi.sendSignalingMessages(credentials, ApiHelper.getUrlForSignaling(userEntity.getBaseUrl()),
|
||||
ncMessageWrappers)
|
||||
awesomeJson)
|
||||
.subscribeOn(Schedulers.newThread())
|
||||
.subscribe(new Observer<Integer>() {
|
||||
.subscribe(new Observer<GenericOverall>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(Integer integer) {
|
||||
public void onNext(GenericOverall genericOverall) {
|
||||
|
||||
}
|
||||
|
||||
@ -685,6 +685,12 @@ public class CallActivity extends AppCompatActivity {
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
} catch (IOException exception) {
|
||||
Log.d(TAG, exception.getLocalizedMessage());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -29,7 +29,6 @@ import com.nextcloud.talk.api.models.json.push.PushRegistrationOverall;
|
||||
import com.nextcloud.talk.api.models.json.rooms.RoomOverall;
|
||||
import com.nextcloud.talk.api.models.json.rooms.RoomsOverall;
|
||||
import com.nextcloud.talk.api.models.json.sharees.ShareesOverall;
|
||||
import com.nextcloud.talk.api.models.json.signaling.NCMessageWrapper;
|
||||
import com.nextcloud.talk.api.models.json.signaling.SignalingOverall;
|
||||
import com.nextcloud.talk.api.models.json.userprofile.UserProfileOverall;
|
||||
|
||||
@ -168,8 +167,8 @@ public interface NcApi {
|
||||
Server URL is: baseUrl + ocsApiVersion + spreedApiVersion + /signaling
|
||||
*/
|
||||
@POST
|
||||
Observable<Integer> sendSignalingMessages(@Header("Authorization") String authorization, @Url String url,
|
||||
@Body List<NCMessageWrapper> ncMessageWrapper);
|
||||
Observable<GenericOverall> sendSignalingMessages(@Header("Authorization") String authorization, @Url String url,
|
||||
@Body List<String> message);
|
||||
|
||||
/*
|
||||
Server URL is: baseUrl + ocsApiVersion + spreedApiVersion + /signaling
|
||||
|
@ -30,10 +30,12 @@ import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class SessionDescriptionSendEvent {
|
||||
@Nullable private final SessionDescription sessionDescription;
|
||||
@Nullable
|
||||
private final SessionDescription sessionDescription;
|
||||
private final String peerId;
|
||||
private final String type;
|
||||
@Nullable private final NCIceCandidate ncIceCandidate;
|
||||
@Nullable
|
||||
private final NCIceCandidate ncIceCandidate;
|
||||
|
||||
public SessionDescriptionSendEvent(@Nullable SessionDescription sessionDescription, String peerId, String type,
|
||||
@Nullable NCIceCandidate ncIceCandidate) {
|
||||
|
@ -46,6 +46,9 @@ public class PeerConnectionWrapper {
|
||||
List<IceCandidate> iceCandidates = new ArrayList<>();
|
||||
List<PeerConnection.IceServer> iceServers;
|
||||
List<IceCandidate> candidatesToSend = new ArrayList<>();
|
||||
List<SessionDescription> sessionDescriptionsQueue = new ArrayList<>();
|
||||
List<NCIceCandidate> localCandidates = new ArrayList<>();
|
||||
List<SessionDescriptionSendEvent> sessionDescriptionSendEvents = new ArrayList<>();
|
||||
private String sessionId;
|
||||
private String callToken;
|
||||
private String nick;
|
||||
@ -55,10 +58,7 @@ public class PeerConnectionWrapper {
|
||||
private MagicSdpObserver magicSdpObserver;
|
||||
private MagicPeerConnectionObserver magicPeerConnectionObserver;
|
||||
private boolean isInitiator;
|
||||
List<SessionDescription> sessionDescriptionsQueue = new ArrayList<>();
|
||||
|
||||
List<NCIceCandidate> localCandidates = new ArrayList<>();
|
||||
List<SessionDescriptionSendEvent> sessionDescriptionSendEvents = new ArrayList<>();
|
||||
public PeerConnectionWrapper(PeerConnectionFactory peerConnectionFactory,
|
||||
List<PeerConnection.IceServer> iceServerList,
|
||||
MediaConstraints mediaConstraints,
|
||||
@ -97,7 +97,6 @@ public class PeerConnectionWrapper {
|
||||
|
||||
@Override
|
||||
public void onIceCandidate(IceCandidate iceCandidate) {
|
||||
Log.d("MARIO_GENERT", "BLA");
|
||||
NCIceCandidate ncIceCandidate = new NCIceCandidate();
|
||||
ncIceCandidate.setSdpMid(iceCandidate.sdpMid);
|
||||
ncIceCandidate.setSdpMLineIndex(iceCandidate.sdpMLineIndex);
|
||||
@ -150,23 +149,15 @@ public class PeerConnectionWrapper {
|
||||
// For anwering peer connection we set remote SDP and then
|
||||
// create answer and set local SDP.
|
||||
if (peerConnection.getLocalDescription() != null) {
|
||||
// We've just set our local SDP so time to send it, drain
|
||||
// remote and send local ICE candidates.
|
||||
Log.d("MARIO", "SENDING ANSWER FROM OBSERVER");
|
||||
EventBus.getDefault().post(new SessionDescriptionSendEvent(peerConnection.getLocalDescription
|
||||
(),
|
||||
sessionId,
|
||||
"answer", null));
|
||||
// We've just set our local SDP so time to send it, drain
|
||||
// remote and send local ICE candidates.
|
||||
|
||||
} else {
|
||||
peerConnection.createAnswer(new MagicSdpObserver() {
|
||||
@Override
|
||||
public void onCreateSuccess(SessionDescription sessionDescription) {
|
||||
super.onCreateSuccess(sessionDescription);
|
||||
peerConnection.setLocalDescription(magicSdpObserver, sessionDescription);
|
||||
}
|
||||
|
||||
}, mediaConstraints);
|
||||
peerConnection.createAnswer(magicSdpObserver, mediaConstraints);
|
||||
|
||||
// We've just set remote SDP - do nothing for now -
|
||||
// answer will be created soon.
|
||||
@ -183,9 +174,7 @@ public class PeerConnectionWrapper {
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void sendLocalCandidates() {
|
||||
Log.d("MARIO", "SENDING LOCAL");
|
||||
for (NCIceCandidate ncIceCandidate : localCandidates) {
|
||||
EventBus.getDefault().post(new SessionDescriptionSendEvent(null, sessionId,
|
||||
"candidate", ncIceCandidate));
|
||||
|
Loading…
Reference in New Issue
Block a user