Make signaling db updates use a subscribing consumer

Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
This commit is contained in:
Andy Scherzinger 2022-07-23 16:21:03 +02:00
parent 7593efd43f
commit 285b9cff03
No known key found for this signature in database
GPG key ID: 6CADC7E3523C308B

View file

@ -48,6 +48,7 @@ import androidx.work.Worker;
import androidx.work.WorkerParameters;
import autodagger.AutoInjector;
import io.reactivex.Observer;
import io.reactivex.SingleObserver;
import io.reactivex.disposables.Disposable;
@AutoInjector(NextcloudTalkApplication.class)
@ -114,8 +115,14 @@ public class SignalingSettingsWorker extends Worker {
.getExternalSignalingTicket());
}
int rows = userManager.saveUser(user).blockingGet();
userManager.saveUser(user).subscribe(new SingleObserver<Integer>() {
@Override
public void onSubscribe(Disposable d) {
// unused atm
}
@Override
public void onSuccess(Integer rows) {
if (rows > 0) {
eventBus.post(new EventStatus(UserIdUtils.INSTANCE.getIdForUser(user),
EventStatus.EventType.SIGNALING_SETTINGS,
@ -133,6 +140,15 @@ public class SignalingSettingsWorker extends Worker {
EventStatus.EventType.SIGNALING_SETTINGS,
false));
}
});
}
@Override
public void onError(Throwable e) {
eventBus.post(new EventStatus(UserIdUtils.INSTANCE.getIdForUser(user),
EventStatus.EventType.SIGNALING_SETTINGS,
false));
}
@Override
public void onComplete() {