Do not show speaker hint in pip.

fork-5.53.8
Cody Henthorne 2020-12-08 17:18:22 -05:00 zatwierdzone przez Greyson Parrelli
rodzic 9f8e31db78
commit a564aae80a
3 zmienionych plików z 25 dodań i 22 usunięć

Wyświetl plik

@ -245,6 +245,7 @@ public class WebRtcCallActivity extends AppCompatActivity implements SafetyNumbe
viewModel.getCallParticipantListUpdate().observe(this, participantUpdateWindow::addCallParticipantListUpdate);
viewModel.getSafetyNumberChangeEvent().observe(this, this::handleSafetyNumberChangeEvent);
viewModel.getGroupMembers().observe(this, unused -> updateGroupMembersForGroupCall());
viewModel.shouldShowSpeakerHint().observe(this, this::updateSpeakerHint);
callScreen.getViewTreeObserver().addOnGlobalLayoutListener(() -> {
CallParticipantsState state = viewModel.getCallParticipantsState().getValue();
@ -286,10 +287,6 @@ public class WebRtcCallActivity extends AppCompatActivity implements SafetyNumbe
videoTooltip.dismiss();
videoTooltip = null;
}
} else if (event instanceof WebRtcCallViewModel.Event.ShowSpeakerViewHint) {
callScreen.showSpeakerViewHint();
} else if (event instanceof WebRtcCallViewModel.Event.HideSpeakerViewHint) {
callScreen.hideSpeakerViewHint();
} else {
throw new IllegalArgumentException("Unknown event: " + event);
}
@ -517,6 +514,14 @@ public class WebRtcCallActivity extends AppCompatActivity implements SafetyNumbe
startService(new Intent(this, WebRtcCallService.class).setAction(WebRtcCallService.ACTION_GROUP_REQUEST_UPDATE_MEMBERS));
}
private void updateSpeakerHint(boolean showSpeakerHint) {
if (showSpeakerHint) {
callScreen.showSpeakerViewHint();
} else {
callScreen.hideSpeakerViewHint();
}
}
@Override
public void onSendAnywayAfterSafetyNumberChange(@NonNull List<RecipientId> changedRecipients) {
CallParticipantsState state = viewModel.getCallParticipantsState().getValue();

Wyświetl plik

@ -517,7 +517,7 @@ public class WebRtcCallView extends FrameLayout {
}
public void showSpeakerViewHint() {
groupCallSpeakerHint.get();
groupCallSpeakerHint.get().setVisibility(View.VISIBLE);
}
public void hideSpeakerViewHint() {

Wyświetl plik

@ -47,6 +47,7 @@ public class WebRtcCallViewModel extends ViewModel {
private final LiveData<SafetyNumberChangeEvent> safetyNumberChangeEvent = LiveDataUtil.combineLatest(isInPipMode, identityChangedRecipients, SafetyNumberChangeEvent::new);
private final LiveData<Recipient> groupRecipient = LiveDataUtil.filter(Transformations.switchMap(liveRecipient, LiveRecipient::getLiveData), Recipient::isActiveGroup);
private final LiveData<List<GroupMemberEntry.FullMember>> groupMembers = LiveDataUtil.skip(Transformations.switchMap(groupRecipient, r -> Transformations.distinctUntilChanged(new LiveGroup(r.requireGroupId()).getFullMembers())), 1);
private final LiveData<Boolean> shouldShowSpeakerHint = Transformations.map(participantsState, this::shouldShowSpeakerHint);
private boolean canDisplayTooltipIfNeeded = true;
private boolean hasEnabledLocalVideo = false;
@ -100,6 +101,10 @@ public class WebRtcCallViewModel extends ViewModel {
return groupMembers;
}
public LiveData<Boolean> shouldShowSpeakerHint() {
return shouldShowSpeakerHint;
}
public boolean canEnterPipMode() {
return canEnterPipMode;
}
@ -122,12 +127,12 @@ public class WebRtcCallViewModel extends ViewModel {
@MainThread
public void setIsViewingFocusedParticipant(@NonNull CallParticipantsState.SelectedPage page) {
//noinspection ConstantConditions
participantsState.setValue(CallParticipantsState.update(participantsState.getValue(), page));
if (page == CallParticipantsState.SelectedPage.FOCUSED) {
SignalStore.tooltips().markGroupCallSpeakerViewSeen();
events.setValue(new Event.HideSpeakerViewHint());
}
//noinspection ConstantConditions
participantsState.setValue(CallParticipantsState.update(participantsState.getValue(), page));
}
public void onDismissedVideoTooltip() {
@ -187,14 +192,6 @@ public class WebRtcCallViewModel extends ViewModel {
canDisplayTooltipIfNeeded = false;
events.setValue(new Event.ShowVideoTooltip());
}
//noinspection ConstantConditions
if (!isInPipMode.getValue() &&
webRtcViewModel.getRemoteParticipants().size() > 1 &&
webRtcViewModel.getGroupState().isConnected() &&
!SignalStore.tooltips().hasSeenGroupCallSpeakerView()) {
events.setValue(new Event.ShowSpeakerViewHint());
}
}
private boolean containsPlaceholders(@NonNull List<CallParticipant> callParticipants) {
@ -276,6 +273,13 @@ public class WebRtcCallViewModel extends ViewModel {
return isInPipMode ? WebRtcControls.PIP : controls;
}
private boolean shouldShowSpeakerHint(@NonNull CallParticipantsState state) {
return !state.isInPipMode() &&
state.getRemoteDevicesCount() > 1 &&
state.getGroupCallState().isConnected() &&
!SignalStore.tooltips().hasSeenGroupCallSpeakerView();
}
private void startTimer() {
cancelTimer();
@ -332,12 +336,6 @@ public class WebRtcCallViewModel extends ViewModel {
public static class DismissVideoTooltip extends Event {
}
public static class ShowSpeakerViewHint extends Event {
}
public static class HideSpeakerViewHint extends Event {
}
public static class StartCall extends Event {
private final boolean isVideoCall;