[Bug] Fix Accessibility focus issue for call on hold overlay (#375)

This commit is contained in:
Peixin Liu 2022-07-18 11:10:49 -07:00 коммит произвёл Mohtasim
Родитель dcb7962fe5
Коммит 05b2d51512
8 изменённых файлов: 32 добавлений и 32 удалений

Просмотреть файл

@ -202,15 +202,15 @@ internal class CallingViewModel(
state.callState
)
}
updateLobbyOverlayDisplayedState(state.callState.callingStatus)
updateOverlayDisplayedState(state.callState.callingStatus)
}
private fun shouldUpdateRemoteParticipantsViewModels(state: ReduxState) =
state.callState.callingStatus == CallingStatus.CONNECTED
private fun updateLobbyOverlayDisplayedState(callingStatus: CallingStatus) {
floatingHeaderViewModel.updateIsLobbyOverlayDisplayed(callingStatus)
bannerViewModel.updateIsLobbyOverlayDisplayed(callingStatus)
localParticipantViewModel.updateIsLobbyOverlayDisplayed(callingStatus)
private fun updateOverlayDisplayedState(callingStatus: CallingStatus) {
floatingHeaderViewModel.updateIsOverlayDisplayed(callingStatus)
bannerViewModel.updateIsOverlayDisplayed(callingStatus)
localParticipantViewModel.updateIsOverlayDisplayed(callingStatus)
}
}

Просмотреть файл

@ -53,7 +53,7 @@ internal class BannerView : ConstraintLayout {
}
viewLifecycleOwner.lifecycleScope.launch {
viewModel.getIsLobbyOverlayDisplayedFlow().collect {
viewModel.getIsOverlayDisplayedFlow().collect {
if (it) {
ViewCompat.setImportantForAccessibility(bannerView, ViewCompat.IMPORTANT_FOR_ACCESSIBILITY_NO_HIDE_DESCENDANTS)
} else {

Просмотреть файл

@ -11,7 +11,7 @@ import kotlinx.coroutines.flow.StateFlow
internal class BannerViewModel {
private lateinit var bannerInfoTypeStateFlow: MutableStateFlow<BannerInfoType>
private lateinit var isLobbyOverlayDisplayedFlow: MutableStateFlow<Boolean>
private lateinit var isOverlayDisplayedFlow: MutableStateFlow<Boolean>
private var shouldShowBannerStateFlow = MutableStateFlow(false)
private var recordingState: ComplianceState = ComplianceState.OFF
@ -19,7 +19,7 @@ internal class BannerViewModel {
private var displayedBannerType: BannerInfoType = BannerInfoType.BLANK
fun getIsLobbyOverlayDisplayedFlow(): StateFlow<Boolean> = isLobbyOverlayDisplayedFlow
fun getIsOverlayDisplayedFlow(): StateFlow<Boolean> = isOverlayDisplayedFlow
fun getBannerInfoTypeStateFlow(): StateFlow<BannerInfoType> {
return bannerInfoTypeStateFlow
@ -35,11 +35,11 @@ internal class BannerViewModel {
bannerInfoTypeStateFlow = MutableStateFlow(
createBannerInfoType(callingState.isRecording, callingState.isTranscribing)
)
isLobbyOverlayDisplayedFlow = MutableStateFlow(isLobbyOverlayDisplayed(callingState.callingStatus))
isOverlayDisplayedFlow = MutableStateFlow(isOverlayDisplayed(callingState.callingStatus))
}
fun updateIsLobbyOverlayDisplayed(callingStatus: CallingStatus) {
isLobbyOverlayDisplayedFlow.value = isLobbyOverlayDisplayed(callingStatus)
fun updateIsOverlayDisplayed(callingStatus: CallingStatus) {
isOverlayDisplayedFlow.value = isOverlayDisplayed(callingStatus)
}
fun update(callingState: CallingState) {
@ -140,8 +140,8 @@ internal class BannerViewModel {
}
}
private fun isLobbyOverlayDisplayed(callingStatus: CallingStatus) =
callingStatus == CallingStatus.IN_LOBBY
private fun isOverlayDisplayed(callingStatus: CallingStatus) =
callingStatus == CallingStatus.IN_LOBBY || callingStatus == CallingStatus.LOCAL_HOLD
}
internal enum class ComplianceState {

Просмотреть файл

@ -75,7 +75,7 @@ internal class InfoHeaderView : ConstraintLayout {
}
viewLifecycleOwner.lifecycleScope.launch {
infoHeaderViewModel.getIsLobbyOverlayDisplayedFlow().collect {
infoHeaderViewModel.getIsOverlayDisplayedFlow().collect {
if (it) {
ViewCompat.setImportantForAccessibility(headerView, ViewCompat.IMPORTANT_FOR_ACCESSIBILITY_NO_HIDE_DESCENDANTS)
} else {

Просмотреть файл

@ -11,14 +11,14 @@ import java.util.TimerTask
internal class InfoHeaderViewModel {
private lateinit var displayFloatingHeaderFlow: MutableStateFlow<Boolean>
private lateinit var isLobbyOverlayDisplayedFlow: MutableStateFlow<Boolean>
private lateinit var isOverlayDisplayedFlow: MutableStateFlow<Boolean>
private lateinit var numberOfParticipantsFlow: MutableStateFlow<Int>
private lateinit var timer: Timer
private var displayedOnLaunch = false
fun getIsLobbyOverlayDisplayedFlow(): StateFlow<Boolean> = isLobbyOverlayDisplayedFlow
fun getIsOverlayDisplayedFlow(): StateFlow<Boolean> = isOverlayDisplayedFlow
fun getDisplayFloatingHeaderFlow(): StateFlow<Boolean> = displayFloatingHeaderFlow
@ -36,8 +36,8 @@ internal class InfoHeaderViewModel {
}
}
fun updateIsLobbyOverlayDisplayed(callingStatus: CallingStatus) {
isLobbyOverlayDisplayedFlow.value = isLobbyOverlayDisplayed(callingStatus)
fun updateIsOverlayDisplayed(callingStatus: CallingStatus) {
isOverlayDisplayedFlow.value = isOverlayDisplayed(callingStatus)
}
fun init(
@ -47,7 +47,7 @@ internal class InfoHeaderViewModel {
timer = Timer()
displayFloatingHeaderFlow = MutableStateFlow(false)
numberOfParticipantsFlow = MutableStateFlow(numberOfRemoteParticipants)
isLobbyOverlayDisplayedFlow = MutableStateFlow(isLobbyOverlayDisplayed(callingStatus))
isOverlayDisplayedFlow = MutableStateFlow(isOverlayDisplayed(callingStatus))
}
fun switchFloatingHeader() {
@ -76,6 +76,6 @@ internal class InfoHeaderViewModel {
}
}
private fun isLobbyOverlayDisplayed(callingStatus: CallingStatus) =
callingStatus == CallingStatus.IN_LOBBY
private fun isOverlayDisplayed(callingStatus: CallingStatus) =
callingStatus == CallingStatus.IN_LOBBY || callingStatus == CallingStatus.LOCAL_HOLD
}

Просмотреть файл

@ -165,7 +165,7 @@ internal class LocalParticipantView : ConstraintLayout {
}
viewLifecycleOwner.lifecycleScope.launch {
viewModel.getIsLobbyOverlayDisplayedFlow().collect {
viewModel.getIsOverlayDisplayedFlow().collect {
if (it) {
ViewCompat.setImportantForAccessibility(
switchCameraButton,

Просмотреть файл

@ -27,7 +27,7 @@ internal class LocalParticipantViewModel(
private lateinit var displayPipSwitchCameraButtonFlow: MutableStateFlow<Boolean>
private lateinit var enableCameraSwitchFlow: MutableStateFlow<Boolean>
private lateinit var cameraDeviceSelectionFlow: MutableStateFlow<CameraDeviceSelectionStatus>
private lateinit var isLobbyOverlayDisplayedFlow: MutableStateFlow<Boolean>
private lateinit var isOverlayDisplayedFlow: MutableStateFlow<Boolean>
private lateinit var numberOfRemoteParticipantsFlow: MutableStateFlow<Int>
fun getVideoStatusFlow(): StateFlow<VideoModel> = videoStatusFlow
@ -101,18 +101,18 @@ internal class LocalParticipantViewModel(
cameraDeviceSelectionStatus != CameraDeviceSelectionStatus.SWITCHING
)
cameraDeviceSelectionFlow = MutableStateFlow(cameraDeviceSelectionStatus)
isLobbyOverlayDisplayedFlow = MutableStateFlow(isLobbyOverlayDisplayed(callingState))
isOverlayDisplayedFlow = MutableStateFlow(isOverlayDisplayed(callingState))
numberOfRemoteParticipantsFlow = MutableStateFlow(numberOfRemoteParticipants)
}
fun switchCamera() = dispatch(LocalParticipantAction.CameraSwitchTriggered())
fun getIsLobbyOverlayDisplayedFlow(): StateFlow<Boolean> = isLobbyOverlayDisplayedFlow
fun getIsOverlayDisplayedFlow(): StateFlow<Boolean> = isOverlayDisplayedFlow
fun getNumberOfRemoteParticipantsFlow(): StateFlow<Int> = numberOfRemoteParticipantsFlow
fun updateIsLobbyOverlayDisplayed(callingStatus: CallingStatus) {
isLobbyOverlayDisplayedFlow.value = isLobbyOverlayDisplayed(callingStatus)
fun updateIsOverlayDisplayed(callingStatus: CallingStatus) {
isOverlayDisplayedFlow.value = isOverlayDisplayed(callingStatus)
}
private fun shouldDisplayVideo(videoStreamID: String?) = videoStreamID != null
@ -132,8 +132,8 @@ internal class LocalParticipantViewModel(
LocalParticipantViewMode.PIP else LocalParticipantViewMode.FULL_SCREEN
}
private fun isLobbyOverlayDisplayed(callingStatus: CallingStatus) =
callingStatus == CallingStatus.IN_LOBBY
private fun isOverlayDisplayed(callingStatus: CallingStatus) =
callingStatus == CallingStatus.IN_LOBBY || callingStatus == CallingStatus.LOCAL_HOLD
internal data class VideoModel(
val shouldDisplayVideo: Boolean,

Просмотреть файл

@ -115,13 +115,13 @@ internal class InfoHeaderViewModelUnitTest : ACSBaseTestCoroutine() {
mutableListOf<Boolean>()
val flowJob = launch {
floatingHeaderViewModel.getIsLobbyOverlayDisplayedFlow()
floatingHeaderViewModel.getIsOverlayDisplayedFlow()
.toList(resultListFromIsLobbyOverlayDisplayedFlow)
}
// act
floatingHeaderViewModel.updateIsLobbyOverlayDisplayed(CallingStatus.CONNECTED)
floatingHeaderViewModel.updateIsLobbyOverlayDisplayed(CallingStatus.IN_LOBBY)
floatingHeaderViewModel.updateIsOverlayDisplayed(CallingStatus.CONNECTED)
floatingHeaderViewModel.updateIsOverlayDisplayed(CallingStatus.IN_LOBBY)
// assert
Assert.assertEquals(