hangup call notification screen after 1 minute

Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
This commit is contained in:
Marcel Hibbe 2021-11-11 15:24:43 +01:00
parent ec40ca9b66
commit 5bb8de673e
No known key found for this signature in database
GPG key ID: C793F8B59F43CE7B

View file

@ -69,6 +69,7 @@ import org.parceler.Parcels;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.TimeUnit;
import javax.inject.Inject;
@ -76,6 +77,7 @@ import androidx.annotation.Nullable;
import androidx.annotation.RequiresApi;
import autodagger.AutoInjector;
import butterknife.OnClick;
import io.reactivex.Observable;
import io.reactivex.Observer;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.disposables.Disposable;
@ -217,7 +219,9 @@ public class CallNotificationActivity extends CallBaseActivity {
ncApi.getPeersForCall(credentials, ApiUtils.getUrlForCall(apiVersion, userBeingCalled.getBaseUrl(),
currentConversation.getToken()))
.subscribeOn(Schedulers.io())
.takeWhile(observable -> !leavingScreen)
.repeatWhen(completed -> completed.zipWith(Observable.range(1, 12), (n, i) -> i)
.flatMap(retryCount -> Observable.timer(5, TimeUnit.SECONDS))
.takeWhile(observable -> !leavingScreen))
.subscribe(new Observer<ParticipantsOverall>() {
@Override
public void onSubscribe(Disposable d) {
@ -253,9 +257,7 @@ public class CallNotificationActivity extends CallBaseActivity {
@Override
public void onComplete() {
if (!leavingScreen) {
handler.postDelayed(() -> checkIfAnyParticipantsRemainInRoom(), 5000);
}
runOnUiThread(() -> hangup());
}
});