Skip to content

Commit

Permalink
Merge branch 'develop' into comparable-operation-subject-test
Browse files Browse the repository at this point in the history
  • Loading branch information
theayushyadav11 authored Feb 20, 2025
2 parents 0637e38 + 958def5 commit 101b1e6
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,7 @@ class WalkthroughActivity :

companion object {

fun createWalkthroughActivityIntent(context: Context, internalProfileId: Int): Intent {
val profileId = ProfileId.newBuilder().setInternalId(internalProfileId).build()
fun createWalkthroughActivityIntent(context: Context, profileId: ProfileId): Intent {
return Intent(context, WalkthroughActivity::class.java).apply {
decorateWithUserProfileId(profileId)
decorateWithScreenName(WALKTHROUGH_ACTIVITY)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,7 @@ class WalkthroughFinalFragmentPresenter @Inject constructor(
/* attachToRoot= */ false
)
this.topicId = topicId
val internalProfileId = activity.intent?.extractCurrentUserProfileId()?.internalId ?: -1
profileId = ProfileId.newBuilder().setInternalId(internalProfileId).build()
profileId = activity.intent?.extractCurrentUserProfileId() ?: ProfileId.getDefaultInstance()

walkthroughFinalViewModel = WalkthroughFinalViewModel()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ class WalkthroughWelcomeFragmentPresenter @Inject constructor(
private lateinit var binding: WalkthroughWelcomeFragmentBinding
private val routeToNextPage = activity as WalkthroughFragmentChangeListener
private lateinit var walkthroughWelcomeViewModel: WalkthroughWelcomeViewModel
private var internalProfileId: Int = -1
private lateinit var profileId: ProfileId
private lateinit var profileName: String

Expand All @@ -48,8 +47,7 @@ class WalkthroughWelcomeFragmentPresenter @Inject constructor(
/* attachToRoot= */ false
)

internalProfileId = activity.intent?.extractCurrentUserProfileId()?.internalId ?: -1
profileId = ProfileId.newBuilder().setInternalId(internalProfileId).build()
profileId = activity.intent?.extractCurrentUserProfileId() ?: ProfileId.getDefaultInstance()
walkthroughWelcomeViewModel = WalkthroughWelcomeViewModel()

binding.let {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ import org.oppia.android.app.application.ApplicationStartupListenerModule
import org.oppia.android.app.application.testing.TestingBuildFlavorModule
import org.oppia.android.app.devoptions.DeveloperOptionsModule
import org.oppia.android.app.devoptions.DeveloperOptionsStarterModule
import org.oppia.android.app.model.ProfileId
import org.oppia.android.app.model.ScreenName
import org.oppia.android.app.player.state.itemviewmodel.SplitScreenInteractionModule
import org.oppia.android.app.shim.ViewBindingShimModule
Expand Down Expand Up @@ -127,8 +128,10 @@ class WalkthroughActivityTest {

@Test
fun testActivity_createIntent_verifyScreenNameInIntent() {
val profileId = ProfileId.newBuilder().setInternalId(1).build()

val currentScreenName = WalkthroughActivity.createWalkthroughActivityIntent(
context, 1
context, profileId
).extractCurrentAppScreenName()

assertThat(currentScreenName).isEqualTo(ScreenName.WALKTHROUGH_ACTIVITY)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ import org.oppia.android.app.application.ApplicationStartupListenerModule
import org.oppia.android.app.application.testing.TestingBuildFlavorModule
import org.oppia.android.app.devoptions.DeveloperOptionsModule
import org.oppia.android.app.devoptions.DeveloperOptionsStarterModule
import org.oppia.android.app.model.ProfileId
import org.oppia.android.app.model.WalkthroughFinalFragmentArguments
import org.oppia.android.app.player.state.itemviewmodel.SplitScreenInteractionModule
import org.oppia.android.app.recyclerview.RecyclerViewMatcher.Companion.atPositionOnView
Expand Down Expand Up @@ -138,7 +139,9 @@ class WalkthroughFinalFragmentTest {
Intents.release()
}

private fun createWalkthroughActivityIntent(profileId: Int): Intent {
private fun createWalkthroughActivityIntent(internalProfileId: Int): Intent {
val profileId = ProfileId.newBuilder().setInternalId(internalProfileId).build()

return WalkthroughActivity.createWalkthroughActivityIntent(
context,
profileId
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ import org.oppia.android.app.application.ApplicationStartupListenerModule
import org.oppia.android.app.application.testing.TestingBuildFlavorModule
import org.oppia.android.app.devoptions.DeveloperOptionsModule
import org.oppia.android.app.devoptions.DeveloperOptionsStarterModule
import org.oppia.android.app.model.ProfileId
import org.oppia.android.app.player.state.itemviewmodel.SplitScreenInteractionModule
import org.oppia.android.app.recyclerview.RecyclerViewMatcher.Companion.atPositionOnView
import org.oppia.android.app.shim.ViewBindingShimModule
Expand Down Expand Up @@ -138,7 +139,8 @@ class WalkthroughTopicListFragmentTest {
Intents.release()
}

private fun createWalkthroughActivityIntent(profileId: Int): Intent {
private fun createWalkthroughActivityIntent(internalProfileId: Int): Intent {
val profileId = ProfileId.newBuilder().setInternalId(internalProfileId).build()
return WalkthroughActivity.createWalkthroughActivityIntent(
context,
profileId
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,8 @@ class WalkthroughWelcomeFragmentTest {
ApplicationProvider.getApplicationContext<TestApplication>().inject(this)
}

private fun createWalkthroughActivityIntent(profileId: Int): Intent {
private fun createWalkthroughActivityIntent(internalProfileId: Int): Intent {
val profileId = ProfileId.newBuilder().setInternalId(internalProfileId).build()
return WalkthroughActivity.createWalkthroughActivityIntent(
context,
profileId
Expand Down

0 comments on commit 101b1e6

Please sign in to comment.