Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #4470, #4471, #4472, #4473, #4474, #4708: Handle configuration change using on saved instance #4668

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
98 commits
Select commit Hold shift + click to select a range
9a7da9a
RawUserAnswer added
vrajdesai78 Oct 19, 2022
20280f1
Imports optimized
vrajdesai78 Oct 19, 2022
3625a63
Optimized import
vrajdesai78 Oct 19, 2022
6f64dcc
rawUserAnswer added to constructor of StateItemViewModel
vrajdesai78 Oct 21, 2022
002b500
Merge branch 'develop' of https://github.com/vrajdesai78/oppia-androi…
vrajdesai78 Oct 21, 2022
f4c93f6
Merge branch 'develop' of https://github.com/vrajdesai78/oppia-androi…
vrajdesai78 Oct 21, 2022
c4293c5
Platform parameter added
vrajdesai78 Oct 21, 2022
e8863a6
Optimized code
vrajdesai78 Oct 21, 2022
cf4f093
Kdoc added
vrajdesai78 Oct 24, 2022
1f0d530
added platformparameter in bazel
vrajdesai78 Oct 24, 2022
4de5907
Updated bazel
vrajdesai78 Oct 24, 2022
d9a79bf
Improved data pipeline and nit changes
vrajdesai78 Oct 25, 2022
dbd3d55
code optimized
vrajdesai78 Oct 25, 2022
e151b9a
Updated imageRegionSelectionInteractionViewModel
vrajdesai78 Oct 25, 2022
c47ef46
retained state in Selection Interaction
vrajdesai78 Oct 26, 2022
aa6bd6d
Made rawUserAnwer to non-null and other nit changes
vrajdesai78 Oct 27, 2022
b0706c0
optimized code
vrajdesai78 Oct 27, 2022
a99e9fb
Fixed null value of rawUserAnswer
vrajdesai78 Oct 27, 2022
79442b7
optimized imports
vrajdesai78 Oct 27, 2022
84457fa
DragAndDrop added
vrajdesai78 Oct 28, 2022
4d63aac
optimized code
vrajdesai78 Oct 28, 2022
313bb92
ImageRegion made working
vrajdesai78 Oct 28, 2022
59993af
Optimized code ImageRegionSelection
vrajdesai78 Oct 28, 2022
5a36788
Optimized code
vrajdesai78 Oct 28, 2022
de7aa69
Merge branch 'develop' into handle-configuration-change-using-onSaved…
vrajdesai78 Oct 29, 2022
c8587f9
Optimized code
vrajdesai78 Oct 29, 2022
a0c7f3e
Merge branch 'handle-configuration-change-using-onSavedInstance' of h…
vrajdesai78 Oct 29, 2022
959877c
Added tests for selection and drag and drop interaction
vrajdesai78 Oct 30, 2022
9d3d27c
optimized code
vrajdesai78 Oct 30, 2022
d271f85
Added proto to store dragAndDrop sort
vrajdesai78 Oct 31, 2022
6910fb7
Optimized code
vrajdesai78 Oct 31, 2022
3d4cc10
SelectionInteraction bug fixed of clearing selection
vrajdesai78 Nov 1, 2022
69a4181
Updated proto for DragAndDrop and added more tests
vrajdesai78 Nov 2, 2022
102da7b
Merge branch 'develop' into handle-configuration-change-using-onSaved…
vrajdesai78 Nov 2, 2022
db30ea2
Optimized code
vrajdesai78 Nov 3, 2022
a6d1cf7
Merge branch 'handle-configuration-change-using-onSavedInstance' of h…
vrajdesai78 Nov 3, 2022
c8ec8ee
Fixed static checks
vrajdesai78 Nov 3, 2022
031b5a5
Seperated text-based interactions
vrajdesai78 Nov 3, 2022
42987e6
Enabled platform parameter and optimized code
vrajdesai78 Nov 3, 2022
10a91bd
Added ToDo
vrajdesai78 Nov 3, 2022
427898b
Removed extra line
vrajdesai78 Nov 3, 2022
45bafdd
Fixed issue with DragAndDropSortInteraction
vrajdesai78 Nov 4, 2022
c56dd5b
Code optimized
vrajdesai78 Nov 4, 2022
4dc8b78
Merge branch 'develop' into handle-configuration-change-using-onSaved…
vrajdesai78 Nov 6, 2022
bae52d0
Merge branch 'develop' into handle-configuration-change-using-onSaved…
vrajdesai78 Nov 6, 2022
7c5f714
New tests added and handled edge cases
vrajdesai78 Nov 6, 2022
55e6605
Merge branch 'handle-configuration-change-using-onSavedInstance' of h…
vrajdesai78 Nov 6, 2022
69ef676
improved code
vrajdesai78 Nov 6, 2022
bb77a93
Nit changes and added KDoC
vrajdesai78 Nov 7, 2022
b0da173
Added new test to check responseHeader
vrajdesai78 Nov 7, 2022
23b5c69
Merge branch 'develop' into handle-configuration-change-using-onSaved…
vrajdesai78 Nov 7, 2022
47d8a44
optimized code
vrajdesai78 Nov 7, 2022
06a0b3d
Nit changes
vrajdesai78 Nov 7, 2022
0529d79
Code optimized
vrajdesai78 Nov 7, 2022
9a2aeca
Merge branch 'handle-configuration-change-using-onSavedInstance' of h…
vrajdesai78 Nov 7, 2022
13a6e18
Merge branch 'develop' into handle-configuration-change-using-onSaved…
vrajdesai78 Nov 8, 2022
bb94042
Updated tests and nit changes
vrajdesai78 Nov 8, 2022
5c227fd
Added KDocs
vrajdesai78 Nov 8, 2022
9936736
Merge branch 'handle-configuration-change-using-onSavedInstance' of h…
vrajdesai78 Nov 8, 2022
4be01c4
Nit changes and fixed issue with mathInputInteraction
vrajdesai78 Nov 9, 2022
afc35b6
Merge branch 'develop' into handle-configuration-change-using-onSaved…
vrajdesai78 Nov 9, 2022
fd0eb62
Updated comments
vrajdesai78 Nov 9, 2022
6d9e73a
Merge branch 'handle-configuration-change-using-onSavedInstance' of h…
vrajdesai78 Nov 9, 2022
4c1b677
removed extra space
vrajdesai78 Nov 9, 2022
2f8f8b2
Updated computer error
vrajdesai78 Nov 9, 2022
a5a2496
Removed test to check Real time error is disabled
vrajdesai78 Nov 9, 2022
175d1b2
Updated tests
vrajdesai78 Nov 9, 2022
54d6f47
Removed comment
vrajdesai78 Nov 9, 2022
679b30c
Merge branch 'develop' into handle-configuration-change-using-onSaved…
vrajdesai78 Nov 9, 2022
78ea425
Re-run CI checks
vrajdesai78 Nov 10, 2022
cca3fb2
Nit changes
vrajdesai78 Nov 10, 2022
d08a7cc
Fixed app crash error
vrajdesai78 Nov 10, 2022
bc0f45d
reverted back changes in tests
vrajdesai78 Nov 10, 2022
412c71c
Updated resetRawUserAnswer
vrajdesai78 Nov 10, 2022
79454cc
Merge to latest develop
vrajdesai78 Nov 10, 2022
ad91869
Fixed nit changes
vrajdesai78 Nov 10, 2022
f5acc86
.replace() used
vrajdesai78 Nov 11, 2022
99e087e
ToDo added
vrajdesai78 Nov 12, 2022
12495d5
added space
vrajdesai78 Nov 12, 2022
55c0d7b
Merge branch 'develop' into handle-configuration-change-using-onSaved…
vrajdesai78 Nov 12, 2022
d23e82d
removed math interaction tests
vrajdesai78 Nov 12, 2022
23e99e5
Imports optimized
vrajdesai78 Nov 12, 2022
e235b4b
Merge branch 'handle-configuration-change-using-onSavedInstance' of h…
vrajdesai78 Nov 12, 2022
802e0e1
Removed unnecessary import
vrajdesai78 Nov 12, 2022
9d5df29
Merge branch 'develop' into handle-configuration-change-using-onSaved…
vrajdesai78 Nov 12, 2022
d79221e
Added new test fixed submit time error issue
vrajdesai78 Nov 12, 2022
5c353ee
Merge branch 'develop' into handle-configuration-change-using-onSaved…
vrajdesai78 Nov 12, 2022
4725a77
Added new tests
vrajdesai78 Nov 13, 2022
cf93543
Merge branch 'handle-configuration-change-using-onSavedInstance' of h…
vrajdesai78 Nov 13, 2022
6b59e1a
Removed unncessary changes
vrajdesai78 Nov 13, 2022
343d46a
Fixed 100 characters limit
vrajdesai78 Nov 13, 2022
6fcffc9
updated test
vrajdesai78 Nov 13, 2022
a360f59
Re-run ci checks
vrajdesai78 Nov 13, 2022
650fdab
Removed animation
vrajdesai78 Nov 13, 2022
444406c
Optimized code
vrajdesai78 Nov 13, 2022
992c479
Reverted back changes for selection interaction
vrajdesai78 Nov 14, 2022
37f59fd
added coordinates param
vrajdesai78 Nov 14, 2022
ab533b6
Updated Kdoc
vrajdesai78 Nov 14, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ class ImageRegionSelectionInteractionView @JvmOverloads constructor(
private lateinit var onRegionClicked: OnClickableAreaClickedListener
private lateinit var imageUrl: String
private lateinit var clickableAreas: List<ImageWithRegions.LabeledRegion>
private lateinit var lastSelectedRegion: ImageWithRegions.LabeledRegion

/**
* Sets the URL for the image & initiates loading it. This is intended to be called via
Expand All @@ -66,6 +67,11 @@ class ImageRegionSelectionInteractionView @JvmOverloads constructor(
maybeInitializeClickableAreas()
}

fun setLastSelectedRegion(lastSelectedRegion: ImageWithRegions.LabeledRegion) {
this.lastSelectedRegion = lastSelectedRegion
maybeInitializeClickableAreas()
}

fun setClickableAreas(clickableAreas: List<ImageWithRegions.LabeledRegion>) {
this.clickableAreas = clickableAreas
// Resets the backgrounds for all regions if any have been loaded. This ensures the backgrounds
Expand Down Expand Up @@ -120,6 +126,9 @@ class ImageRegionSelectionInteractionView @JvmOverloads constructor(
clickableAreas
)
areasImage.addRegionViews()
if (::lastSelectedRegion.isInitialized && lastSelectedRegion.hasRegion()) {
areasImage.toggleRegion(lastSelectedRegion, view = null)
}
performAttachment(areasImage)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import android.view.ViewGroup
import org.oppia.android.app.fragment.FragmentComponentImpl
import org.oppia.android.app.fragment.InjectableFragment
import org.oppia.android.app.model.HelpIndex
import org.oppia.android.app.model.RawUserAnswer
import org.oppia.android.app.model.UserAnswer
import org.oppia.android.app.player.state.answerhandling.InteractionAnswerErrorOrAvailabilityCheckReceiver
import org.oppia.android.app.player.state.answerhandling.InteractionAnswerHandler
Expand All @@ -19,9 +20,15 @@ import org.oppia.android.app.player.state.listener.PreviousResponsesHeaderClickL
import org.oppia.android.app.player.state.listener.ReturnToTopicNavigationButtonListener
import org.oppia.android.app.player.state.listener.ShowHintAvailabilityListener
import org.oppia.android.app.player.state.listener.SubmitNavigationButtonListener
import org.oppia.android.util.extensions.getProto
import org.oppia.android.util.extensions.getStringFromBundle
import org.oppia.android.util.extensions.putProto
import javax.inject.Inject

private const val STATE_FRAGMENT_RAW_USER_ANSWER_KEY = "StateFragment.raw_user_answer"
private const val STATE_FRAGMENT_ARE_PREVIOUS_RESPONSES_HEADER_EXPANDED_KEY =
"StateFragment.are_previous_responses_header_expanded"

/** Fragment that represents the current state of an exploration. */
class StateFragment :
InjectableFragment(),
Expand Down Expand Up @@ -79,12 +86,20 @@ class StateFragment :
val storyId = arguments!!.getStringFromBundle(STATE_FRAGMENT_STORY_ID_ARGUMENT_KEY)!!
val explorationId =
arguments!!.getStringFromBundle(STATE_FRAGMENT_EXPLORATION_ID_ARGUMENT_KEY)!!
val rawUserAnswer = savedInstanceState?.getProto(
STATE_FRAGMENT_RAW_USER_ANSWER_KEY, RawUserAnswer.getDefaultInstance()
) ?: RawUserAnswer.getDefaultInstance()
BenHenning marked this conversation as resolved.
Show resolved Hide resolved
val arePreviousResponsesExpanded =
savedInstanceState?.getBoolean(STATE_FRAGMENT_ARE_PREVIOUS_RESPONSES_HEADER_EXPANDED_KEY)
?: false
return stateFragmentPresenter.handleCreateView(
inflater,
container,
internalProfileId,
topicId,
storyId,
rawUserAnswer,
arePreviousResponsesExpanded,
explorationId
)
}
Expand Down Expand Up @@ -129,6 +144,18 @@ class StateFragment :
stateFragmentPresenter.revealHint(hintIndex)
}

override fun onSaveInstanceState(outState: Bundle) {
super.onSaveInstanceState(outState)
outState.putProto(
STATE_FRAGMENT_RAW_USER_ANSWER_KEY,
stateFragmentPresenter.getRawUserAnswer()
)
outState.putBoolean(
STATE_FRAGMENT_ARE_PREVIOUS_RESPONSES_HEADER_EXPANDED_KEY,
stateFragmentPresenter.getArePreviousResponsesExpanded()
)
}

fun revealSolution() = stateFragmentPresenter.revealSolution()

fun dismissConceptCard() = stateFragmentPresenter.dismissConceptCard()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import org.oppia.android.app.model.CheckpointState
import org.oppia.android.app.model.EphemeralState
import org.oppia.android.app.model.HelpIndex
import org.oppia.android.app.model.ProfileId
import org.oppia.android.app.model.RawUserAnswer
import org.oppia.android.app.model.State
import org.oppia.android.app.model.UserAnswer
import org.oppia.android.app.player.audio.AudioButtonListener
Expand All @@ -47,6 +48,9 @@ import org.oppia.android.util.data.DataProvider
import org.oppia.android.util.data.DataProviders.Companion.toLiveData
import org.oppia.android.util.gcsresource.DefaultResourceBucketName
import org.oppia.android.util.parser.html.ExplorationHtmlParserEntityType
import org.oppia.android.util.platformparameter.EnableHintBulbAnimation
import org.oppia.android.util.platformparameter.EnableInteractionConfigChangeStateRetention
import org.oppia.android.util.platformparameter.PlatformParameterValue
import org.oppia.android.util.system.OppiaClock
import javax.inject.Inject

Expand All @@ -71,6 +75,10 @@ class StateFragmentPresenter @Inject constructor(
private val storyProgressController: StoryProgressController,
private val oppiaLogger: OppiaLogger,
@DefaultResourceBucketName private val resourceBucketName: String,
@EnableInteractionConfigChangeStateRetention
private val isConfigChangeStateRetentionEnabled: PlatformParameterValue<Boolean>,
@EnableHintBulbAnimation
private val isHintBulbAnimationEnabled: PlatformParameterValue<Boolean>,
private val assemblerBuilderFactory: StatePlayerRecyclerViewAssembler.Builder.Factory,
private val splitScreenManager: SplitScreenManager,
private val oppiaClock: OppiaClock
Expand Down Expand Up @@ -105,6 +113,8 @@ class StateFragmentPresenter @Inject constructor(
internalProfileId: Int,
topicId: String,
storyId: String,
rawUserAnswer: RawUserAnswer,
arePreviousResponsesExpanded: Boolean,
explorationId: String
): View? {
profileId = ProfileId.newBuilder().setInternalId(internalProfileId).build()
Expand All @@ -118,7 +128,13 @@ class StateFragmentPresenter @Inject constructor(
/* attachToRoot= */ false
)
recyclerViewAssembler = createRecyclerViewAssembler(
assemblerBuilderFactory.create(resourceBucketName, entityType, profileId),
assemblerBuilderFactory.create(
resourceBucketName,
entityType,
profileId,
rawUserAnswer,
arePreviousResponsesExpanded
),
binding.congratulationsTextView,
binding.congratulationsTextConfettiView,
binding.fullScreenConfettiView
Expand Down Expand Up @@ -164,7 +180,7 @@ class StateFragmentPresenter @Inject constructor(

fun handleAnswerReadyForSubmission(answer: UserAnswer) {
// An interaction has indicated that an answer is ready for submission.
handleSubmitAnswer(answer)
handleSubmitAnswer(answer, canSubmitAnswer = true)
}

fun onContinueButtonClicked() {
Expand Down Expand Up @@ -208,9 +224,7 @@ class StateFragmentPresenter @Inject constructor(

fun handleKeyboardAction() {
hideKeyboard()
if (viewModel.getCanSubmitAnswer().get() == true) {
handleSubmitAnswer(viewModel.getPendingAnswer(recyclerViewAssembler::getPendingAnswerHandler))
}
handleSubmitAnswer(viewModel.getPendingAnswer(recyclerViewAssembler::getPendingAnswerHandler))
}

fun onHintAvailable(helpIndex: HelpIndex, isCurrentStatePendingState: Boolean) {
Expand Down Expand Up @@ -261,6 +275,11 @@ class StateFragmentPresenter @Inject constructor(
subscribeToHintSolution(explorationProgressController.submitSolutionIsRevealed())
}

/** Returns whether previously submitted wrong answers are currently expanded. */
fun getArePreviousResponsesExpanded(): Boolean {
return recyclerViewAssembler.arePreviousResponsesExpanded
}

private fun getStateViewModel(): StateViewModel {
return viewModelProvider.getForFragment(fragment, StateViewModel::class.java)
}
Expand Down Expand Up @@ -358,6 +377,9 @@ class StateFragmentPresenter @Inject constructor(
private fun subscribeToAnswerOutcome(
answerOutcomeResultLiveData: LiveData<AsyncResult<AnswerOutcome>>
) {
if (viewModel.getCanSubmitAnswer().get() == true) {
BenHenning marked this conversation as resolved.
Show resolved Hide resolved
recyclerViewAssembler.resetRawUserAnswer()
}
val answerOutcomeLiveData = getAnswerOutcome(answerOutcomeResultLiveData)
answerOutcomeLiveData.observe(
fragment,
Expand Down Expand Up @@ -401,8 +423,15 @@ class StateFragmentPresenter @Inject constructor(
}
}

private fun handleSubmitAnswer(answer: UserAnswer) {
subscribeToAnswerOutcome(explorationProgressController.submitAnswer(answer).toLiveData())
private fun handleSubmitAnswer(
answer: UserAnswer,
canSubmitAnswer: Boolean = viewModel.getCanSubmitAnswer().get() ?: false
) {
// This check seems to avoid a crash on configuration change when attempting to resubmit answers
// after encountering a submit-time error, but it's also more correct to keep it.
if (canSubmitAnswer) {
subscribeToAnswerOutcome(explorationProgressController.submitAnswer(answer).toLiveData())
}
}

fun dismissConceptCard() {
Expand Down Expand Up @@ -451,6 +480,13 @@ class StateFragmentPresenter @Inject constructor(
/** Returns the checkpoint state for the current exploration. */
fun getExplorationCheckpointState() = explorationCheckpointState

/** Returns the [RawUserAnswer] representing the user's current pending answer. */
fun getRawUserAnswer(): RawUserAnswer {
return if (isConfigChangeStateRetentionEnabled.value) {
viewModel.getRawUserAnswer(recyclerViewAssembler::getPendingAnswerHandler)
} else RawUserAnswer.getDefaultInstance()
}

private fun markExplorationCompleted() {
storyProgressController.recordCompletedChapter(
profileId,
Expand Down Expand Up @@ -494,6 +530,8 @@ class StateFragmentPresenter @Inject constructor(

private fun setHintOpenedAndUnRevealed(isHintUnrevealed: Boolean) {
viewModel.setHintOpenedAndUnRevealedVisibility(isHintUnrevealed)
if (!isHintBulbAnimationEnabled.value) return

if (isHintUnrevealed) {
val hintBulbAnimation = AnimationUtils.loadAnimation(
context,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import org.oppia.android.app.model.EphemeralState.StateTypeCase
import org.oppia.android.app.model.HelpIndex
import org.oppia.android.app.model.Interaction
import org.oppia.android.app.model.ProfileId
import org.oppia.android.app.model.RawUserAnswer
import org.oppia.android.app.model.StringList
import org.oppia.android.app.model.SubtitledHtml
import org.oppia.android.app.model.UserAnswer
Expand Down Expand Up @@ -144,7 +145,9 @@ class StatePlayerRecyclerViewAssembler private constructor(
backgroundCoroutineDispatcher: CoroutineDispatcher,
private val hasConversationView: Boolean,
private val resourceHandler: AppLanguageResourceHandler,
private val translationController: TranslationController
private val translationController: TranslationController,
private var rawUserAnswer: RawUserAnswer,
arePreviousResponsesExpanded: Boolean
) : HtmlParser.CustomOppiaTagActionListener {
/**
* A list of view models corresponding to past view models that are hidden by default. These are
Expand All @@ -158,7 +161,8 @@ class StatePlayerRecyclerViewAssembler private constructor(
* Whether the previously submitted wrong answers should be expanded. This value is intentionally
* not retained upon configuration changes since the user can just re-expand the list.
*/
private var hasPreviousResponsesExpanded: Boolean = false
var arePreviousResponsesExpanded: Boolean = arePreviousResponsesExpanded
private set

private val lifecycleSafeTimerFactory = LifecycleSafeTimerFactory(backgroundCoroutineDispatcher)

Expand Down Expand Up @@ -300,6 +304,13 @@ class StatePlayerRecyclerViewAssembler private constructor(
return Pair(conversationPendingItemList, extraInteractionPendingItemList)
}

/**
* Resets rawUserAnswer to it's default instance.
*/
fun resetRawUserAnswer() {
rawUserAnswer = RawUserAnswer.getDefaultInstance()
}

private fun addInteractionForPendingState(
pendingItemList: MutableList<StateItemViewModel>,
interaction: Interaction,
Expand All @@ -311,13 +322,17 @@ class StatePlayerRecyclerViewAssembler private constructor(
pendingItemList += interactionViewModelFactory.create(
gcsEntityId,
hasConversationView,
rawUserAnswer,
interaction,
fragment as InteractionAnswerReceiver,
fragment as InteractionAnswerErrorOrAvailabilityCheckReceiver,
hasPreviousButton,
isSplitView.get()!!,
writtenTranslationContext
)
).also {
// Ensure that potential errors are re-detected in cases of configuration changes.
(it as? InteractionAnswerHandler)?.checkPendingAnswerError(rawUserAnswer.lastErrorCategory)
}
}

private fun addContentItem(
Expand Down Expand Up @@ -353,7 +368,7 @@ class StatePlayerRecyclerViewAssembler private constructor(
PreviousResponsesHeaderViewModel(
answersAndResponses.size - 1,
hasConversationView,
ObservableBoolean(hasPreviousResponsesExpanded),
ObservableBoolean(arePreviousResponsesExpanded),
fragment as PreviousResponsesHeaderClickListener,
isSplitView.get()!!,
resourceHandler
Expand All @@ -364,7 +379,7 @@ class StatePlayerRecyclerViewAssembler private constructor(
}
// Only add previous answers if current responses are expanded, or if collapsing is disabled.
val showPreviousAnswers = !playerFeatureSet.wrongAnswerCollapsing ||
hasPreviousResponsesExpanded
arePreviousResponsesExpanded
for (answerAndResponse in answersAndResponses.take(answersAndResponses.size - 1)) {
if (playerFeatureSet.pastAnswerSupport) {
// Earlier answers can't be correct (since otherwise new answers wouldn't be able to be
Expand Down Expand Up @@ -442,7 +457,7 @@ class StatePlayerRecyclerViewAssembler private constructor(
}
// Ensure the header matches the updated state.
headerModel.isExpanded.set(expandPreviousAnswers)
hasPreviousResponsesExpanded = expandPreviousAnswers
arePreviousResponsesExpanded = expandPreviousAnswers
}

/**
Expand All @@ -454,7 +469,7 @@ class StatePlayerRecyclerViewAssembler private constructor(
check(playerFeatureSet.wrongAnswerCollapsing) {
"Cannot collapse previous answers for assembler that doesn't support wrong answer collapsing"
}
hasPreviousResponsesExpanded = false
arePreviousResponsesExpanded = false
}

/**
Expand Down Expand Up @@ -889,7 +904,9 @@ class StatePlayerRecyclerViewAssembler private constructor(
private val resourceHandler: AppLanguageResourceHandler,
private val translationController: TranslationController,
private val multiTypeBuilderFactory: BindableAdapter.MultiTypeBuilder.Factory,
private val singleTypeBuilderFactory: BindableAdapter.SingleTypeBuilder.Factory
private val singleTypeBuilderFactory: BindableAdapter.SingleTypeBuilder.Factory,
private val rawUserAnswer: RawUserAnswer,
private val arePreviousResponsesExpanded: Boolean
) {

private val adapterBuilder: BindableAdapter.MultiTypeBuilder<StateItemViewModel,
Expand Down Expand Up @@ -1375,7 +1392,9 @@ class StatePlayerRecyclerViewAssembler private constructor(
backgroundCoroutineDispatcher,
hasConversationView,
resourceHandler,
translationController
translationController,
rawUserAnswer,
arePreviousResponsesExpanded
)
if (playerFeatureSet.conceptCardSupport) {
customTagListener.proxyListener = assembler
Expand All @@ -1395,13 +1414,19 @@ class StatePlayerRecyclerViewAssembler private constructor(
private val resourceHandler: AppLanguageResourceHandler,
private val translationController: TranslationController,
private val multiAdapterBuilderFactory: BindableAdapter.MultiTypeBuilder.Factory,
private val singleAdapterFactory: BindableAdapter.SingleTypeBuilder.Factory
private val singleAdapterFactory: BindableAdapter.SingleTypeBuilder.Factory,
) {
/**
* Returns a new [Builder] for the specified GCS resource bucket information for loading
* assets, and the current logged in [ProfileId].
*/
fun create(resourceBucketName: String, entityType: String, profileId: ProfileId): Builder {
fun create(
resourceBucketName: String,
entityType: String,
profileId: ProfileId,
rawUserAnswer: RawUserAnswer,
arePreviousResponsesExpanded: Boolean
): Builder {
return Builder(
accessibilityService,
htmlParserFactory,
Expand All @@ -1415,7 +1440,9 @@ class StatePlayerRecyclerViewAssembler private constructor(
resourceHandler,
translationController,
multiAdapterBuilderFactory,
singleAdapterFactory
singleAdapterFactory,
rawUserAnswer,
arePreviousResponsesExpanded
)
}
}
Expand Down
Loading