Fix cleanups

Signed-off-by: Mario Danic <mario@lovelyhq.com>
This commit is contained in:
Mario Danic 2018-01-19 19:54:49 +01:00
parent 01482ce8a6
commit ecc46c301e

View file

@ -127,7 +127,6 @@ import butterknife.OnLongClick;
import io.reactivex.Observer; import io.reactivex.Observer;
import io.reactivex.android.schedulers.AndroidSchedulers; import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.disposables.Disposable; import io.reactivex.disposables.Disposable;
import io.reactivex.functions.BooleanSupplier;
import io.reactivex.schedulers.Schedulers; import io.reactivex.schedulers.Schedulers;
import me.zhanghai.android.effortlesspermissions.AfterPermissionDenied; import me.zhanghai.android.effortlesspermissions.AfterPermissionDenied;
import me.zhanghai.android.effortlesspermissions.EffortlessPermissions; import me.zhanghai.android.effortlesspermissions.EffortlessPermissions;
@ -189,7 +188,6 @@ public class CallActivity extends AppCompatActivity {
EglBase rootEglBase; EglBase rootEglBase;
boolean leavingCall = false; boolean leavingCall = false;
boolean inCall = false; boolean inCall = false;
BooleanSupplier booleanSupplier = () -> leavingCall;
Disposable signalingDisposable; Disposable signalingDisposable;
Disposable pingDisposable; Disposable pingDisposable;
List<PeerConnection.IceServer> iceServers; List<PeerConnection.IceServer> iceServers;
@ -691,7 +689,6 @@ public class CallActivity extends AppCompatActivity {
} }
private void startCall() { private void startCall() {
inCall = true;
if (!isPTTActive) { if (!isPTTActive) {
animateCallControls(false, 7500); animateCallControls(false, 7500);
} }
@ -800,6 +797,8 @@ public class CallActivity extends AppCompatActivity {
@Override @Override
public void onNext(GenericOverall genericOverall) { public void onNext(GenericOverall genericOverall) {
inCall = true;
callSession = callOverall.getOcs().getData().getSessionId(); callSession = callOverall.getOcs().getData().getSessionId();
// start pinging the call // start pinging the call
@ -807,8 +806,8 @@ public class CallActivity extends AppCompatActivity {
ApiHelper.getUrlForCallPing(userEntity.getBaseUrl(), roomToken)) ApiHelper.getUrlForCallPing(userEntity.getBaseUrl(), roomToken))
.subscribeOn(Schedulers.newThread()) .subscribeOn(Schedulers.newThread())
.observeOn(AndroidSchedulers.mainThread()) .observeOn(AndroidSchedulers.mainThread())
.repeatWhen(completed -> completed.delay(5000, TimeUnit.MILLISECONDS)) .repeatWhen(observable -> observable.delay(5000, TimeUnit.MILLISECONDS))
.repeatUntil(booleanSupplier) .takeWhile(observable -> inCall)
.retry(3) .retry(3)
.subscribe(new Observer<GenericOverall>() { .subscribe(new Observer<GenericOverall>() {
@Override @Override
@ -837,7 +836,7 @@ public class CallActivity extends AppCompatActivity {
userEntity.getToken()), ApiHelper.getUrlForSignaling(userEntity.getBaseUrl())) userEntity.getToken()), ApiHelper.getUrlForSignaling(userEntity.getBaseUrl()))
.subscribeOn(Schedulers.newThread()) .subscribeOn(Schedulers.newThread())
.observeOn(AndroidSchedulers.mainThread()) .observeOn(AndroidSchedulers.mainThread())
.repeatUntil(booleanSupplier) .takeWhile(observable -> inCall)
.retry(3) .retry(3)
.subscribe(new Observer<SignalingOverall>() { .subscribe(new Observer<SignalingOverall>() {
@Override @Override