Skip to content

Commit

Permalink
Merge branch 'develop' into audiofix
Browse files Browse the repository at this point in the history
  • Loading branch information
Vishwajith-Shettigar authored Oct 31, 2023
2 parents 4cdda77 + 6ac4f9c commit aa1ded8
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,10 @@ class StateFragmentPresenter @Inject constructor(

fun onSubmitButtonClicked() {
hideKeyboard()
handleSubmitAnswer(viewModel.getPendingAnswer(recyclerViewAssembler::getPendingAnswerHandler))
val answer = viewModel.getPendingAnswer(recyclerViewAssembler::getPendingAnswerHandler)
if (answer != null) {
handleSubmitAnswer(answer)
}
}

fun onResponsesHeaderClicked() {
Expand All @@ -215,7 +218,10 @@ class StateFragmentPresenter @Inject constructor(
fun handleKeyboardAction() {
hideKeyboard()
if (viewModel.getCanSubmitAnswer().get() == true) {
handleSubmitAnswer(viewModel.getPendingAnswer(recyclerViewAssembler::getPendingAnswerHandler))
val answer = viewModel.getPendingAnswer(recyclerViewAssembler::getPendingAnswerHandler)
if (answer != null) {
handleSubmitAnswer(answer)
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,12 +101,12 @@ class StateViewModel @Inject constructor(

fun getPendingAnswer(
retrieveAnswerHandler: (List<StateItemViewModel>) -> InteractionAnswerHandler?
): UserAnswer {
): UserAnswer? {
return getPendingAnswerWithoutError(
retrieveAnswerHandler(
getAnswerItemList()
)
) ?: UserAnswer.getDefaultInstance()
)
}

fun canQuicklyToggleBetweenSwahiliAndEnglish(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,11 +175,10 @@ class SurveyFragmentPresenter @Inject constructor(

private fun subscribeToCurrentQuestion() {
ephemeralQuestionLiveData.observe(
fragment,
{
processEphemeralQuestionResult(it)
}
)
fragment.viewLifecycleOwner
) {
processEphemeralQuestionResult(it)
}
}

private fun processEphemeralQuestionResult(result: AsyncResult<EphemeralSurveyQuestion>) {
Expand Down
9 changes: 6 additions & 3 deletions app/src/main/res/values-pcm-rNG/strings.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Authors:
* Busayo
* Confidence
* Osetiemoria
-->
<resources>
Expand All @@ -9,6 +10,7 @@
<string name="menu_my_downloads">My Downloads</string>
<string name="menu_help">Help</string>
<string name="exploration_activity_title">Lesson Player</string>
<string name="play_exploration_button_text">play exploration</string>
<string name="help_activity_title">Help</string>
<string name="bottom_sheet_options_menu_close">Close</string>
<string name="menu_switch_profile">Change Profile</string>
Expand All @@ -19,18 +21,19 @@
<string name="audio_play_description">Play di audio</string>
<string name="audio_pause_description">Pause di audio</string>
<string name="audio_unavailable_in_selected_language">%s audio no dey available.</string>
<string name="audio_language_select_dialog_okay_button" fuzzy="true">OK</string>
<string name="audio_language_select_dialog_okay_button">OK</string>
<string name="audio_language_select_dialog_cancel_button">Cancel am</string>
<string name="audio_language_select_dialog_title">Audio Language</string>
<string name="audio_dialog_offline_title">You dey offline</string>
<string name="audio_dialog_offline_message">Make sure sey Wi-Fi or mobile data dey on, den try am again.</string>
<string name="audio_dialog_offline_positive" fuzzy="true">OK</string>
<string name="cellular_data_alert_dialog_okay_button" fuzzy="true">OK</string>
<string name="audio_dialog_offline_positive">OK</string>
<string name="cellular_data_alert_dialog_okay_button">OK</string>
<string name="cellular_data_alert_dialog_cancel_button">Cancel am</string>
<string name="cellular_data_alert_dialog_title">Na your data you dey use now</string>
<string name="cellular_data_alert_dialog_description">Playing di audio go use plenti mobile data.</string>
<string name="cellular_data_alert_dialog_checkbox">No show this message again</string>
<string name="concept_card_toolbar_title">Concept Card</string>
<string name="concept_card_one_button_text">Concept Card 1</string>
<string name="revision_card_toolbar_title">Revision Card</string>
<string name="unsaved_exploration_dialog_title">Comot go the topic page?</string>
<string name="unsaved_exploration_dialog_description">Wetin you don do before no go save</string>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,24 @@ class StateFragmentTest {
}
}

@Test
@RunOn(TestPlatform.ESPRESSO) // Robolectric tests don't rotate like this to recreate activity
fun testStateFragment_loadExp_invalidAnswer_changeConfiguration_submitButtonIsDisplayed() {
setUpTestWithLanguageSwitchingFeatureOff()
launchForExploration(TEST_EXPLORATION_ID_2, shouldSavePartialProgress = false).use {
startPlayingExploration()
clickContinueInteractionButton()

typeFractionText("1/")

clickSubmitAnswerButton()

rotateToLandscape()

onView(withId(R.id.submit_answer_button)).check(matches(isDisplayed()))
}
}

@Test
fun testStateFragment_loadExp_secondState_invalidAnswer_updated_submitAnswerIsEnabled() {
setUpTestWithLanguageSwitchingFeatureOff()
Expand Down

0 comments on commit aa1ded8

Please sign in to comment.