Fix issue where call name would not update.

This commit is contained in:
Alex Hart
2024-10-15 13:12:22 -03:00
committed by Greyson Parrelli
parent dcbf0315c0
commit 40bf7a021a
3 changed files with 8 additions and 3 deletions

View File

@@ -518,6 +518,7 @@ public class WebRtcCallActivity extends BaseActivity implements SafetyNumberChan
viewModel.getEvents().observe(this, this::handleViewModelEvent);
lifecycleDisposable.add(viewModel.getInCallstatus().subscribe(this::handleInCallStatus));
lifecycleDisposable.add(viewModel.getRecipientFlowable().subscribe(callScreen::setRecipient));
boolean isStartedFromCallLink = getCallIntent().isStartedFromCallLink();
LiveDataUtil.combineLatest(LiveDataReactiveStreams.fromPublisher(viewModel.getCallParticipantsState().toFlowable(BackpressureStrategy.LATEST)),
@@ -922,7 +923,6 @@ public class WebRtcCallActivity extends BaseActivity implements SafetyNumberChan
previousEvent = event;
viewModel.setRecipient(event.getRecipient());
callScreen.setRecipient(event.getRecipient());
controlsAndInfoViewModel.setRecipient(event.getRecipient());
switch (event.getState()) {

View File

@@ -622,14 +622,15 @@ public class WebRtcCallView extends InsetAwareConstraintLayout {
}
public void setRecipient(@NonNull Recipient recipient) {
collapsedToolbar.setTitle(recipient.getDisplayName(getContext()));
recipientName.setText(recipient.getDisplayName(getContext()));
if (recipient.getId() == recipientId) {
return;
}
recipientId = recipient.getId();
largeHeaderAvatar.setRecipient(recipient, false);
collapsedToolbar.setTitle(recipient.getDisplayName(getContext()));
recipientName.setText(recipient.getDisplayName(getContext()));
}
public void setStatus(@Nullable String status) {

View File

@@ -116,6 +116,10 @@ public class WebRtcCallViewModel extends ViewModel {
return liveRecipient.getValue();
}
public Flowable<Recipient> getRecipientFlowable() {
return recipientId.switchMap(id -> Recipient.observable(id).toFlowable(BackpressureStrategy.LATEST)).observeOn(AndroidSchedulers.mainThread());
}
public void setRecipient(@NonNull Recipient recipient) {
recipientId.onNext(recipient.getId());
liveRecipient.setValue(recipient.live());