Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
6328db1
Migrate exploration and progress controllers to use ProfileId (#6203)
Kishan8548 Jun 28, 2026
253d272
Address code review feedback for ProfileId migration
Kishan8548 Jun 28, 2026
7a519d7
Fix ktlint formatting issues in test files
Kishan8548 Jun 28, 2026
ae45242
Fix domain compilation errors for ProfileId migration
Kishan8548 Jun 28, 2026
c932af1
Fix ktlint formatting issues in domain controllers
Kishan8548 Jun 28, 2026
c394d4d
Fix remaining ProfileId type mismatches across domain and app layers
Kishan8548 Jun 28, 2026
80b1630
Fix final ProfileId type mismatches across test helpers and presenters
Kishan8548 Jun 29, 2026
52a9384
Fix ProfileId type mismatch in SurveyGatingControllerTest
Kishan8548 Jun 29, 2026
5faa843
Fix unstaged ProfileId parameters in ExplorationActiveTimeControllerT…
Kishan8548 Jun 29, 2026
7ff4ad4
Fix ktlint line length violations
Kishan8548 Jun 29, 2026
5356364
Fix remaining startPlayingNewExploration ProfileId type mismatches
Kishan8548 Jun 29, 2026
1232668
Fix ktlint import order in ExplorationProgressControllerLessonProgres…
Kishan8548 Jun 29, 2026
bcbee0c
Add missing KDoc to LegacyProfileId overloads in ExplorationCheckpoin…
Kishan8548 Jun 30, 2026
39b950e
Fix type mismatch in LearnerAnalyticsLoggerTest: use ProfileId for ge…
Kishan8548 Jun 30, 2026
f620714
Address reviewer feedback: fix KDocs, use ProfileId directly, extract…
Kishan8548 Jul 10, 2026
616871a
Migrate arguments.proto exploration fields from LegacyProfileId to Pr…
Kishan8548 Jul 10, 2026
dfac246
Fix profileId proto assignment bug in intent param builders
Kishan8548 Jul 10, 2026
eecc783
Fix ktlint import errors
Kishan8548 Jul 10, 2026
7182db0
Address reviewer feedback: update KDocs and remove unused parameter
Kishan8548 Jul 12, 2026
5bf60c5
Fix ProfileId type mismatch in ExplorationCheckpointTestHelperTest
Kishan8548 Jul 12, 2026
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 @@ -26,6 +26,7 @@ import org.oppia.android.domain.exploration.lightweightcheckpointing.Exploration
import org.oppia.android.domain.oppialogger.OppiaLogger
import org.oppia.android.util.data.AsyncResult
import org.oppia.android.util.data.DataProviders.Companion.toLiveData
import org.oppia.android.util.profile.toProfileIdPreservingZero
import javax.inject.Inject

/** The presenter for [RecentlyPlayedFragment]. */
Expand Down Expand Up @@ -97,7 +98,7 @@ class RecentlyPlayedFragmentPresenter @Inject constructor(
if (promotedStory.chapterPlayState == ChapterPlayState.IN_PROGRESS_SAVED) {
val explorationCheckpointLiveData =
explorationCheckpointController.retrieveExplorationCheckpoint(
profileId, promotedStory.explorationId
profileId.toProfileIdPreservingZero(), promotedStory.explorationId
).toLiveData()

explorationCheckpointLiveData.observe(
Expand Down Expand Up @@ -178,13 +179,13 @@ class RecentlyPlayedFragmentPresenter @Inject constructor(
// cases, lessons played from this fragment are known to be in progress, and that progress
// can't be resumed here (hence the restart).
explorationDataController.restartExploration(
profileId.internalId, classroomId, topicId, storyId, explorationId
profileId.toProfileIdPreservingZero(), classroomId, topicId, storyId, explorationId
)
} else {
// The only lessons that can't have their progress saved are those that were already
// completed.
explorationDataController.replayExploration(
profileId.internalId, classroomId, topicId, storyId, explorationId
profileId.toProfileIdPreservingZero(), classroomId, topicId, storyId, explorationId
)
}
startPlayingProvider.toLiveData().observe(fragment) { result ->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ import org.oppia.android.app.topic.conceptcard.ConceptCardListener
import org.oppia.android.util.extensions.getProtoExtra
import org.oppia.android.util.extensions.putProtoExtra
import org.oppia.android.util.logging.CurrentAppScreenNameIntentDecorator.decorateWithScreenName
import org.oppia.android.util.profile.toLegacyProfileId
import org.oppia.android.util.profile.toProfileIdPreservingZero
import javax.inject.Inject

const val TAG_HINTS_AND_SOLUTION_DIALOG = "HINTS_AND_SOLUTION_DIALOG"
Expand Down Expand Up @@ -65,7 +67,7 @@ class ExplorationActivity :
val params = intent.extractParams()
explorationActivityPresenter.handleOnCreate(
this,
params.profileId,
params.profileId.toLegacyProfileId(),
params.classroomId,
params.topicId,
params.storyId,
Expand Down Expand Up @@ -102,7 +104,7 @@ class ExplorationActivity :
isCheckpointingEnabled: Boolean
): Intent {
val params = ExplorationActivityParams.newBuilder().apply {
this.profileId = profileId
this.profileId = profileId.toProfileIdPreservingZero()
this.classroomId = classroomId
this.topicId = topicId
this.storyId = storyId
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ import org.oppia.android.domain.translation.TranslationController
import org.oppia.android.util.accessibility.AccessibilityService
import org.oppia.android.util.data.AsyncResult
import org.oppia.android.util.data.DataProviders.Companion.toLiveData
import org.oppia.android.util.profile.toProfileIdPreservingZero
import javax.inject.Inject

private const val TAG_UNSAVED_EXPLORATION_DIALOG = "UNSAVED_EXPLORATION_DIALOG"
Expand Down Expand Up @@ -276,7 +277,9 @@ class ExplorationActivityPresenter @Inject constructor(

/** Deletes the saved progress for the current exploration and then stops the exploration. */
fun deleteCurrentProgressAndStopExploration(isCompletion: Boolean) {
explorationDataController.deleteExplorationProgressById(profileId, explorationId)
explorationDataController.deleteExplorationProgressById(
profileId.toProfileIdPreservingZero(), explorationId
)
stopExploration(isCompletion)
}

Expand All @@ -287,7 +290,7 @@ class ExplorationActivityPresenter @Inject constructor(
// without deleting any checkpoints.
if (::oldestCheckpointExplorationId.isInitialized) {
explorationDataController.deleteExplorationProgressById(
profileId,
profileId.toProfileIdPreservingZero(),
oldestCheckpointExplorationId
)
}
Expand Down Expand Up @@ -351,7 +354,9 @@ class ExplorationActivityPresenter @Inject constructor(

private fun updateToolbarTitle(explorationId: String) {
subscribeToExploration(
explorationDataController.getExplorationById(profileId, explorationId).toLiveData()
explorationDataController.getExplorationById(
profileId.toProfileIdPreservingZero(), explorationId
).toLiveData()
)
}

Expand Down Expand Up @@ -504,7 +509,7 @@ class ExplorationActivityPresenter @Inject constructor(
*/
private fun subscribeToOldestSavedExplorationDetails() {
explorationDataController.getOldestExplorationDetailsDataProvider(
profileId
profileId.toProfileIdPreservingZero()
).toLiveData().observe(activity) {
when (it) {
is AsyncResult.Success -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import org.oppia.android.app.model.ExplorationFragmentArguments
import org.oppia.android.app.model.LegacyProfileId
import org.oppia.android.app.model.ReadingTextSize
import org.oppia.android.util.extensions.putProto
import org.oppia.android.util.profile.toProfileIdPreservingZero
import javax.inject.Inject

/** Fragment that contains displays single exploration. */
Expand All @@ -29,7 +30,7 @@ class ExplorationFragment : InjectableFragment() {
readingTextSize: ReadingTextSize
): ExplorationFragment {
val args = ExplorationFragmentArguments.newBuilder().apply {
this.profileId = profileId
this.profileId = profileId.toProfileIdPreservingZero()
this.classroomId = classroomId
this.topicId = topicId
this.storyId = storyId
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ import org.oppia.android.util.data.AsyncResult
import org.oppia.android.util.data.DataProviders.Companion.toLiveData
import org.oppia.android.util.extensions.getProto
import org.oppia.android.util.extensions.putProto
import org.oppia.android.util.profile.toProfileIdPreservingZero
import javax.inject.Inject

/** The presenter for [ExplorationFragment]. */
Expand Down Expand Up @@ -72,7 +71,7 @@ class ExplorationFragmentPresenter @Inject constructor(
/** Handles the [Fragment.onViewCreated] portion of [ExplorationFragment]'s lifecycle. */
fun handleViewCreated() {
val profileDataProvider = profileManagementController.getProfile(
retrieveArguments().profileId.toProfileIdPreservingZero()
retrieveArguments().profileId
)
profileDataProvider.toLiveData().observe(
fragment
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ 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.profile.toProfileIdPreservingZero
import org.oppia.android.util.system.OppiaClock
import javax.inject.Inject

Expand Down Expand Up @@ -493,7 +494,7 @@ class StateFragmentPresenter @Inject constructor(

private fun markExplorationCompleted() {
val markStoryCompletedLivedata = storyProgressController.recordCompletedChapter(
profileId,
profileId.toProfileIdPreservingZero(),
topicId,
storyId,
explorationId,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ class StateViewModel @Inject constructor(
}.build()
val updateResultProvider =
explorationProgressController.updateWrittenTranslationContentLanguageMidLesson(
profileId, languageSelection
profileId.toProfileIdPreservingZero(), languageSelection
)
val updateResultLiveData = updateResultProvider.toLiveData()
updateResultLiveData.observe(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import androidx.appcompat.app.AppCompatActivity
import androidx.databinding.DataBindingUtil
import org.oppia.android.app.activity.ActivityScope
import org.oppia.android.app.databinding.databinding.StateFragmentTestActivityBinding
import org.oppia.android.app.model.LegacyProfileId
import org.oppia.android.app.model.ProfileId
import org.oppia.android.app.model.StateFragmentTestActivityParams
import org.oppia.android.app.player.exploration.HintsAndSolutionExplorationManagerFragment
import org.oppia.android.app.player.exploration.TAG_HINTS_AND_SOLUTION_EXPLORATION_MANAGER
Expand Down Expand Up @@ -35,6 +35,7 @@ class StateFragmentTestActivityPresenter @Inject constructor(
) {

private var profileId: Int = 1
private val profileIdProto get() = ProfileId.newBuilder().setInternalId(profileId).build()
private lateinit var classroomId: String
private lateinit var topicId: String
private lateinit var storyId: String
Expand Down Expand Up @@ -87,7 +88,7 @@ class StateFragmentTestActivityPresenter @Inject constructor(

fun deleteCurrentProgressAndStopExploration(isCompletion: Boolean) {
explorationDataController.deleteExplorationProgressById(
LegacyProfileId.newBuilder().setInternalId(profileId).build(),
profileIdProto,
explorationId
)
stopExploration(isCompletion)
Expand All @@ -106,11 +107,13 @@ class StateFragmentTestActivityPresenter @Inject constructor(
explorationDataController.stopPlayingExploration(isCompletion = false)
val startPlayingProvider = if (shouldSavePartialProgress) {
explorationDataController.startPlayingNewExploration(
profileId, classroomId, topicId, storyId, explorationId
profileIdProto,
classroomId, topicId, storyId, explorationId
)
} else {
explorationDataController.replayExploration(
profileId, classroomId, topicId, storyId, explorationId
profileIdProto,
classroomId, topicId, storyId, explorationId
)
}
startPlayingProvider.toLiveData().observe(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ import org.oppia.android.app.player.exploration.ExplorationActivity
import org.oppia.android.util.extensions.getProtoExtra
import org.oppia.android.util.extensions.putProtoExtra
import org.oppia.android.util.logging.CurrentAppScreenNameIntentDecorator.decorateWithScreenName
import org.oppia.android.util.profile.toLegacyProfileId
import org.oppia.android.util.profile.toProfileIdPreservingZero
import javax.inject.Inject

/** Activity that allows the user to resume a saved exploration. */
Expand All @@ -34,7 +36,7 @@ class ResumeLessonActivity :

val params = intent.getProtoExtra(PARAMS_KEY, ResumeLessonActivityParams.getDefaultInstance())
resumeLessonActivityPresenter.handleOnCreate(
params.profileId,
params.profileId.toLegacyProfileId(),
params.classroomId,
params.topicId,
params.storyId,
Expand Down Expand Up @@ -72,7 +74,7 @@ class ResumeLessonActivity :
checkpoint: ExplorationCheckpoint
): Intent {
val params = ResumeLessonActivityParams.newBuilder().apply {
this.profileId = profileId
this.profileId = profileId.toProfileIdPreservingZero()
this.classroomId = classroomId
this.topicId = topicId
this.storyId = storyId
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ import org.oppia.android.app.model.ReadingTextSize
import org.oppia.android.app.model.ResumeLessonFragmentArguments
import org.oppia.android.util.extensions.getProto
import org.oppia.android.util.extensions.putProto
import org.oppia.android.util.profile.toLegacyProfileId
import org.oppia.android.util.profile.toProfileIdPreservingZero
import javax.inject.Inject

/** Fragment that allows the user to resume a saved exploration. */
Expand All @@ -35,7 +37,7 @@ class ResumeLessonFragment : InjectableFragment() {
readingTextSize: ReadingTextSize
): ResumeLessonFragment {
val args = ResumeLessonFragmentArguments.newBuilder().apply {
this.profileId = profileId
this.profileId = profileId.toProfileIdPreservingZero()
this.classroomId = classroomId
this.topicId = topicId
this.storyId = storyId
Expand Down Expand Up @@ -75,7 +77,7 @@ class ResumeLessonFragment : InjectableFragment() {
return resumeLessonFragmentPresenter.handleOnCreate(
inflater,
container,
args.profileId,
args.profileId.toLegacyProfileId(),
args.classroomId,
args.topicId,
args.storyId,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import org.oppia.android.util.data.DataProviders.Companion.toLiveData
import org.oppia.android.util.extensions.getProto
import org.oppia.android.util.gcsresource.DefaultResourceBucketName
import org.oppia.android.util.parser.html.HtmlParser
import org.oppia.android.util.profile.toProfileIdPreservingZero
import javax.inject.Inject

/** The presenter for [ResumeLessonFragment]. */
Expand Down Expand Up @@ -198,11 +199,16 @@ class ResumeLessonFragmentPresenter @Inject constructor(
) {
val startPlayingProvider = if (checkpoint == ExplorationCheckpoint.getDefaultInstance()) {
explorationDataController.restartExploration(
profileId.internalId, classroomId, topicId, storyId, explorationId
profileId.toProfileIdPreservingZero(), classroomId, topicId, storyId, explorationId
)
} else {
explorationDataController.resumeExploration(
profileId.internalId, classroomId, topicId, storyId, explorationId, checkpoint
profileId.toProfileIdPreservingZero(),
classroomId,
topicId,
storyId,
explorationId,
checkpoint
)
}
startPlayingProvider.toLiveData().observe(fragment) { result ->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ import org.oppia.android.util.data.DataProviders.Companion.toLiveData
import org.oppia.android.util.gcsresource.DefaultResourceBucketName
import org.oppia.android.util.parser.html.HtmlParser
import org.oppia.android.util.parser.html.TopicHtmlParserEntityType
import org.oppia.android.util.profile.toProfileIdPreservingZero
import javax.inject.Inject

/** The presenter for [StoryFragment]. */
Expand Down Expand Up @@ -272,15 +273,15 @@ class StoryFragmentPresenter @Inject constructor(
// one.
val startPlayingProvider = if (canHavePartialProgressSaved) {
explorationDataController.startPlayingNewExploration(
profileId.internalId,
profileId.toProfileIdPreservingZero(),
classroomId,
topicId,
storyId,
explorationId
)
} else {
explorationDataController.replayExploration(
profileId.internalId,
profileId.toProfileIdPreservingZero(),
classroomId,
topicId,
storyId,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import org.oppia.android.domain.exploration.lightweightcheckpointing.Exploration
import org.oppia.android.domain.translation.TranslationController
import org.oppia.android.util.data.AsyncResult
import org.oppia.android.util.data.DataProviders.Companion.toLiveData
import org.oppia.android.util.profile.toProfileIdPreservingZero

/** Chapter summary view model for the recycler view in [StoryFragment]. */
class StoryChapterSummaryViewModel(
Expand Down Expand Up @@ -63,9 +64,7 @@ class StoryChapterSummaryViewModel(
if (chapterPlayState == ChapterPlayState.IN_PROGRESS_SAVED) {
val explorationCheckpointLiveData =
explorationCheckpointController.retrieveExplorationCheckpoint(
LegacyProfileId.newBuilder().apply {
internalId = internalProfileId
}.build(),
profileId.toProfileIdPreservingZero(),
explorationId
).toLiveData()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import org.oppia.android.app.fragment.InjectableFragment
import org.oppia.android.app.home.RouteToExplorationListener
import org.oppia.android.app.model.ExplorationActivityParams
import org.oppia.android.app.model.LegacyProfileId
import org.oppia.android.app.model.ProfileId
import org.oppia.android.app.ui.R
import org.oppia.android.app.utility.SplitScreenManager
import org.oppia.android.domain.classroom.TEST_CLASSROOM_ID_0
Expand Down Expand Up @@ -53,7 +54,7 @@ class ExplorationTestActivityPresenter @Inject constructor(
private fun playExplorationButton() {
explorationDataController.stopPlayingExploration(isCompletion = false)
explorationDataController.replayExploration(
INTERNAL_PROFILE_ID,
ProfileId.newBuilder().setInternalId(INTERNAL_PROFILE_ID).build(),
CLASSROOM_ID,
TOPIC_ID,
STORY_ID,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import org.oppia.android.util.accessibility.AccessibilityService
import org.oppia.android.util.data.AsyncResult
import org.oppia.android.util.data.DataProviders.Companion.toLiveData
import org.oppia.android.util.enumfilter.filterByEnumCondition
import org.oppia.android.util.profile.toProfileIdPreservingZero
import javax.inject.Inject

/** The presenter for [TopicLessonsFragment]. */
Expand Down Expand Up @@ -298,7 +299,7 @@ class TopicLessonsFragmentPresenter @Inject constructor(
ChapterPlayState.IN_PROGRESS_SAVED -> {
val explorationCheckpointLiveData =
explorationCheckpointController.retrieveExplorationCheckpoint(
profileId, explorationId
profileId.toProfileIdPreservingZero(), explorationId
).toLiveData()
explorationCheckpointLiveData.observe(
fragment,
Expand Down Expand Up @@ -369,21 +370,21 @@ class TopicLessonsFragmentPresenter @Inject constructor(
!canHavePartialProgressSaved -> {
// Only explorations that have been completed can't be saved, so replay the lesson.
explorationDataController.replayExploration(
profileId.internalId, classroomId, topicId, storyId, explorationId
profileId.toProfileIdPreservingZero(), classroomId, topicId, storyId, explorationId
)
}
hadProgress -> {
// If there was progress, either the checkpoint was never saved, failed to save, or failed
// to be retrieved. In all cases, this is a restart.
explorationDataController.restartExploration(
profileId.internalId, classroomId, topicId, storyId, explorationId
profileId.toProfileIdPreservingZero(), classroomId, topicId, storyId, explorationId
)
}
else -> {
// If there's no progress and it was never completed, then it's a new play through (or the
// user is very low on device memory).
explorationDataController.startPlayingNewExploration(
profileId.internalId, classroomId, topicId, storyId, explorationId
profileId.toProfileIdPreservingZero(), classroomId, topicId, storyId, explorationId
)
}
}
Expand Down
Loading
Loading