Skip to content

Commit

Permalink
add all arecontentsame
Browse files Browse the repository at this point in the history
  • Loading branch information
subhajitxyz committed Jan 11, 2025
1 parent b66888a commit d7c1fd0
Show file tree
Hide file tree
Showing 9 changed files with 104 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -469,7 +469,9 @@ class StateFragmentPresenter @Inject constructor(
if (x.viewType != y.viewType) {
return false
}
x.areContentsTheSame(y)
val same = x.areContentsTheSame(y)
Log.d("testhint",same.toString())
return same
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,18 @@ class ContinueInteractionViewModel private constructor(
interactionAnswerReceiver.onAnswerReadyForSubmission(getPendingAnswer())
}

//subha hint
//approach 2 github
override fun areContentsTheSame(other: StateItemViewModel): Boolean {
if (this === other) return true
if (other !is ContinueInteractionViewModel) return false
return hasPreviousButton == other.hasConversationView &&
hasConversationView == other.hasConversationView &&
isSplitView == other.isSplitView &&
shouldAnimateContinueButton == other.shouldAnimateContinueButton &&
continueButtonAnimationTimestampMs == other.continueButtonAnimationTimestampMs
}

/** Implementation of [StateItemViewModel.InteractionItemFactory] for this view model. */
class FactoryImpl @Inject constructor(private val fragment: Fragment) : InteractionItemFactory {
override fun create(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,17 @@ class ContinueNavigationButtonViewModel(
val isSplitView: Boolean,
val shouldAnimateContinueButton: Boolean,
val continueButtonAnimationTimestampMs: Long
) : StateItemViewModel(ViewType.CONTINUE_NAVIGATION_BUTTON)
) : StateItemViewModel(ViewType.CONTINUE_NAVIGATION_BUTTON) {

//subha hint
//approach 2 github
override fun areContentsTheSame(other: StateItemViewModel): Boolean {
if (this === other) return true
if (other !is ContinueNavigationButtonViewModel) return false
return hasPreviousButton == other.hasConversationView &&
shouldAnimateContinueButton == other.shouldAnimateContinueButton &&
hasConversationView == other.hasConversationView &&
isSplitView == other.isSplitView &&
continueButtonAnimationTimestampMs == other.continueButtonAnimationTimestampMs
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,17 @@ class FeedbackViewModel(
val hasConversationView: Boolean,
val isSplitView: Boolean,
val supportsConceptCards: Boolean
) : StateItemViewModel(ViewType.FEEDBACK)
) : StateItemViewModel(ViewType.FEEDBACK) {

//subha hint
//approach 2 github
override fun areContentsTheSame(other: StateItemViewModel): Boolean {
if (this === other) return true
if (other !is FeedbackViewModel) return false
return htmlContent == other.htmlContent &&
gcsEntityId == other.gcsEntityId &&
hasConversationView == other.hasConversationView &&
isSplitView == other.isSplitView &&
supportsConceptCards == other.supportsConceptCards
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,15 @@ class NextButtonViewModel(
val previousNavigationButtonListener: PreviousNavigationButtonListener,
val nextNavigationButtonListener: NextNavigationButtonListener,
val isSplitView: Boolean
) : StateItemViewModel(ViewType.NEXT_NAVIGATION_BUTTON)
) : StateItemViewModel(ViewType.NEXT_NAVIGATION_BUTTON) {

//subha hint
//approach 2 github
override fun areContentsTheSame(other: StateItemViewModel): Boolean {
if (this === other) return true
if (other !is NextButtonViewModel) return false
return hasConversationView == other.hasConversationView &&
isSplitView == other.isSplitView &&
hasPreviousButton == other.hasPreviousButton
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,14 @@ class PreviousButtonViewModel(
val hasConversationView: Boolean,
val previousNavigationButtonListener: PreviousNavigationButtonListener,
val isSplitView: Boolean
) : StateItemViewModel(ViewType.PREVIOUS_NAVIGATION_BUTTON)
) : StateItemViewModel(ViewType.PREVIOUS_NAVIGATION_BUTTON) {

//subha hint
//approach 2 github
override fun areContentsTheSame(other: StateItemViewModel): Boolean {
if (this === other) return true
if (other !is PreviousButtonViewModel) return false
return hasConversationView == other.hasConversationView &&
isSplitView == other.isSplitView
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,14 @@ class ReplayButtonViewModel(
val hasConversationView: Boolean,
val replayButtonListener: ReplayButtonListener,
val isSplitView: Boolean
) : StateItemViewModel(ViewType.REPLAY_NAVIGATION_BUTTON)
) : StateItemViewModel(ViewType.REPLAY_NAVIGATION_BUTTON) {

//subha hint
//approach 2 github
override fun areContentsTheSame(other: StateItemViewModel): Boolean {
if (this === other) return true
if (other !is ReplayButtonViewModel) return false
return hasConversationView == other.hasConversationView &&
isSplitView == other.isSplitView
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,15 @@ class ReturnToTopicButtonViewModel(
val previousNavigationButtonListener: PreviousNavigationButtonListener,
val returnToTopicNavigationButtonListener: ReturnToTopicNavigationButtonListener,
val isSplitView: Boolean
) : StateItemViewModel(ViewType.RETURN_TO_TOPIC_NAVIGATION_BUTTON)
) : StateItemViewModel(ViewType.RETURN_TO_TOPIC_NAVIGATION_BUTTON) {

//subha hint
//approach 2 github
override fun areContentsTheSame(other: StateItemViewModel): Boolean {
if (this === other) return true
if (other !is ReturnToTopicButtonViewModel) return false
return hasPreviousButton == other.hasConversationView &&
hasConversationView == other.hasConversationView &&
isSplitView == other.isSplitView
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -68,4 +68,19 @@ class SubmittedAnswerViewModel(
private const val DEFAULT_SUBMITTED_ANSWER = ""
private val DEFAULT_ACCESSIBLE_ANSWER: String? = null
}

//subha hint
//approach 2 github
override fun areContentsTheSame(other: StateItemViewModel): Boolean {
if (this === other) return true
if (other !is SubmittedAnswerViewModel) return false
return (
isCorrectAnswer == other.isCorrectAnswer &&
submittedAnswer == other.submittedAnswer &&
isExtraInteractionAnswerCorrect.get() == other.isExtraInteractionAnswerCorrect.get() &&
submittedAnswerContentDescription.get() == other.submittedAnswerContentDescription.get() &&
isSplitView == other.isSplitView &&
hasConversationView == other.hasConversationView
)
}
}

0 comments on commit d7c1fd0

Please sign in to comment.