oppia / oppia-android

A free, online & offline learning platform to make quality education accessible for all.
https://www.oppia.org
Apache License 2.0
311 stars 514 forks source link

Fix #1547, parts of #169, #5344, #5365, #5411: Add data layer support for (multiple) classrooms & topic dependencies, and prepare for #4885 #5398

Closed BenHenning closed 4 months ago

BenHenning commented 4 months ago

Explanation

Fixes #1547 Fixes part of #169 Fixes part of #5344 Fixes part of #5365 Fixes part of #5411

The main purpose of this PR is to introduce support for multiple classrooms in the data layer of the app (with minimal domain integration to avoid the change extending beyond the lesson structures). However, the PR is also doing a few more things including preparing the Android codebase for introducing an asset download script (#4885) and other peripheral cleanups of code (rather than updating it) that was noticed along the way.

Preparing for multiple classrooms

This addresses part of #5365.

5344 is introducing support for multiple classrooms in the app. To help prepare for those changes, this PR introduces the necessary data structure and domain loading changes to load a new proto structure:

message ClassroomList {
  repeated ClassroomRecord classrooms = 1;
}
message ClassroomRecord {
  string id = 1;
  map<string, TranslationMapping> written_translations = 2;
  SubtitledHtml translatable_title = 3;
  LessonThumbnail classroom_thumbnail = 4;
  map<string, TopicIdList> topic_prerequisites = 5;
  message TopicIdList {
    repeated string topic_ids = 1;
  }
}

Rather than just a flat topic list. Some important details to note:

Asset priming removal

This addresses part of #169.

PrimeTopicAssetsController and its implementation were responsible for hackily pre-loading all lesson images and audio to be on-device to enable offline support. This was the first attempt at offline support early in the app's development, but it had a few significant drawbacks:

This approach was abandoned after the earliest alpha releases for an asset download script (which is now being migrated over to this codebase per #5411.

This removal unfortunately required removing a module that was referenced in a lot of tests throughout the codebase. While the removal itself was fairly simple, it does affect a lot of files.

Other areas changed (but unaffected by tests since these flows didn't have automated tests):

As alluded to above, two annotations were removed as part of this cleanup:

GAE structure cleanup & preparing for asset script

Preparing for #4885 included a few other changes, some of which were nice-to-have:

Note that the new Java proto targets & oppia-proto-api targets aren't being used yet, but they will be in future PRs. This just provides the basis of support for the asset download script while also helping to split up the code to review across multiple PRs.

Essential Checklist

For UI-specific PRs only

This is essentially only data infrastructural except for a couple of points:

oppiabot[bot] commented 4 months ago

Hi @BenHenning, I'm going to mark this PR as stale because it hasn't had any updates for 7 days. If no further activity occurs within 7 days, it will be automatically closed so that others can take up the issue. If you are still working on this PR, please make a follow-up commit within 3 days (and submit it for review, if applicable). Please also let us know if you are stuck so we can help you!

BenHenning commented 4 months ago

Ah excellent. CI is now passing! @adhiamboperes PTAL.

oppiabot[bot] commented 4 months ago

Hi @BenHenning, this PR is ready to be merged. Please address any remaining comments prior to merging, and feel free to merge this PR once the CI checks pass and you're happy with it. Thanks!

BenHenning commented 4 months ago

Thanks @adhiamboperes! I really appreciate the review. :)

Updating to latest develop & enabling auto-merge.

BenHenning commented 4 months ago

Also @theMr17 I forgot to ask you to review this, so I suggest taking a look at it post-merge and let me know if there are any additions needed for multiple classrooms that won't already be included in your project.