mirror of
https://github.com/nextcloud/talk-android.git
synced 2024-11-24 05:55:39 +03:00
Make signaling db updates use a subscribing consumer
Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
This commit is contained in:
parent
7593efd43f
commit
285b9cff03
1 changed files with 26 additions and 10 deletions
|
@ -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,17 +115,32 @@ 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
|
||||
}
|
||||
|
||||
if (rows > 0) {
|
||||
eventBus.post(new EventStatus(UserIdUtils.INSTANCE.getIdForUser(user),
|
||||
EventStatus.EventType.SIGNALING_SETTINGS,
|
||||
true));
|
||||
} else {
|
||||
eventBus.post(new EventStatus(UserIdUtils.INSTANCE.getIdForUser(user),
|
||||
EventStatus.EventType.SIGNALING_SETTINGS,
|
||||
false));
|
||||
}
|
||||
@Override
|
||||
public void onSuccess(Integer rows) {
|
||||
if (rows > 0) {
|
||||
eventBus.post(new EventStatus(UserIdUtils.INSTANCE.getIdForUser(user),
|
||||
EventStatus.EventType.SIGNALING_SETTINGS,
|
||||
true));
|
||||
} else {
|
||||
eventBus.post(new EventStatus(UserIdUtils.INSTANCE.getIdForUser(user),
|
||||
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
|
||||
|
|
Loading…
Reference in a new issue