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

[Feature Request]: Introduce support for multiple classrooms (GSoC'24 4.2) #5344

Open
BenHenning opened this issue Feb 17, 2024 · 3 comments
Assignees
Labels
enhancement End user-perceivable enhancements.

Comments

@BenHenning
Copy link
Sponsor Member

BenHenning commented Feb 17, 2024

Is your feature request related to a problem? Please describe.

The app is currently limited to only showing basic numeracy lessons, and the broader team plans to introduce lessons of other types (such as financial literacy, science, and more).

Describe the solution you'd like

Suggested Milestones

  • Milestone 1: Introduce new UIs for classroom selection.
    • Deliverable 1: Introduce new feature flag for the multiple classrooms feature.
    • Deliverable 2: Update the model & domain layer to support the definition of classrooms, and specify a classroom per-topic.
    • Deliverable 3: Introduce a ClassroomController.
    • Deliverable 4: Introduce a new activity & related fragments/views/tests for a new classroom selection landing page (recommendations section should be faked out for now).
    • Deliverable 5: Update 'recently played' topic cards to include classroom information.
  • Milestone 2:
    • Deliverable 1: Update the asset download script (#4885) to support classrooms.
    • Deliverable 2: Implement new recommendations logic & UI support for the classroom selection
    • Deliverable 3: Gated by the feature flag, hook up the new classroom selection page to replace the existing home activity upon profile login.
    • Deliverable 4: Ensure the existing event logs are captured in the new screen and related tests in preparation for removal.
    • Deliverable 5: Test, iterate, and work with the tech lead to finalize and launch the feature.
    • Deliverable 6: Audit home activity/fragment & recommendation tests to ensure the new utilities cover the same behaviors. Remove the old home activity/fragment.
Technical hints / guidance

Top-level components needed for supporting multiple classrooms in the app

  • ClassroomListActivity.kt + presenter & layout: Top-level activity that has a row of available classrooms which is displayed as a carousel to facilitate addition of future classrooms.
    • The list of topics will be filtered based on the selected classroom.
    • The classrooms carousel shoud be sticky at the top when the topic list is scrolled.
    • When the home screen is resumed, the last classroom selection will be retained.
  • ClassroomListFragment.kt + presenter & layout: Top-level fragment for the available classrooms. The classrooms are displayed in a carousel(custom view as per existing patterns, see the "last played stories" carousel).
  • ClassroomController.kt: The new controller for providing classroom context and state.
  • TopicListController.kt: Existing controller that will be updated to no longer surface getTopicList since this is now implemented in ClassroomController. Existing use cases and tests will need to be migrated over to ClassroomController. For the home screen, suggest defaulting to the "math" classroom so that existing functionality is maintained.
  • FeatureFlagConstants.kt: Where the new feature flag for enabling multiple classrooms will be defined.
  • ProfileChooserFragmentPresenter.kt: Updated to navigate the user to ClassroomListActivity.kt instead of HomeActivity when the new feature flag is enabled.
  • Much of the classes under app/src/main/java/org/oppia/android/app/home: These will need to be moved to a new classroom package and generalized such that they can be used by both the home activity/fragment and new classroom views.
  • The rest of the classes under home/ (including HomeFragment & HomeActivity): These will be deleted at the end of the project in favor of the new structure. The home package will actually be completely removed.

Some key technical notes

  • All new components require new corresponding test files. All updated components will need their tests updated based on the changes to those components. Presenters and view models are typically exempted from testing, and are exempted from test file presence check via script/assets/test_file_exemptions.textproto.
  • All references to HomeActivity/Fragment will need to be updated throughout the codebase. This may require documentation and/or test updates.
  • Existing layout files will need to be updated, as needed, to support the different card tile changes.
  • The new activities & fragments aren't explicitly spec'd out since they are mostly boilerplate. Existing classes should be analyzed for a reference on spec'ing these out in the proposal.
  • New test textproto files should be added to demonstrate multiple classrooms in the base developer version of the app.
  • Existing exploration-related event logs should be updated to contain classroomId

Suggested files to add/change

ClassroomController.kt:

class ClassroomController {
  fun getClassroomList(profileId: ProfileId): DataProvider<List<ClassroomSummary>>
  fun getTopicList(profileId: ProfileId, classroomId: String): DataProvider<TopicList>
}

TODO: Others will be added soon.

Describe alternatives you've considered

No response

Additional context

This is the high-level tracking issue corresponding to https://github.com/oppia/oppia/wiki/Google-Summer-of-Code-2024#42-multiple-classrooms-support.

@BenHenning BenHenning added enhancement End user-perceivable enhancements. triage needed labels Feb 17, 2024
@oppia oppia locked and limited conversation to collaborators Feb 17, 2024
@BenHenning
Copy link
Sponsor Member Author

NB: This issue is locked to ensure that it only contains updates for requirements. If you have questions regarding this project, please use its corresponding discussion category: https://github.com/oppia/oppia-android/discussions/categories/gsoc-q-a-4-2-multiple-classrooms-support.

@BenHenning
Copy link
Sponsor Member Author

NB: The main issue comment has been updated to include the technical details directly rather than a link to a Gist (so that we can easily change this if needed). Please note that there are some small changes to the requirements to better align with the PRD for the feature (as some key UX confusions were cleared up that influenced the original technical design).

@theMr17
Copy link
Collaborator

theMr17 commented May 18, 2024

Milestone 1

✅ PR 1.1 - #5410

Introduce a new feature flag for the multiple classrooms feature.

Starting Date Creation Date Merge Date
27-05-2024 27-05-2024 28-05-2024
Tasks Due Dates
Introduce feature flag in FeatureFlagConstants.kt file. 27-05-2024
Add dagger providers for the new feature flag. 27-05-2024

⬜ PR 1.2 - #5418

Update the model & domain layer to support the definition of classrooms, and specify a classroom per-topic.

Starting Date Creation Date Merge Date
28-05-2024 31-05-2024 03-06-2024
Tasks Due Dates
Add ClassroomSummary & ClassroomIdList objects to topic.proto file. 29-05-2024
Update topic related objects to include classroomId & classroomTitle fields. 30-05-2024
Create test data json & textproto files for classrooms. 31-05-2024

⬜ PR 1.3 - #5419

Introduce ClassroomController and modify TopicListController & ProfileManagmentController.

Starting Date Creation Date Merge Date
04-06-2024 10-06-2024 14-06-2024
Tasks Due Dates
Introduce ClassroomController to surface getClassroomList function. 04-06-2024
Add tests for getClassroomList function. 05-06-2024
Migrate getTopicList from TopicListController to ClassroomController. 07-06-2024
Migrate tests for getTopicList function. 08-06-2024
Modify ProfileManagementController to track last selected classroom. 09-06-2024
Add tests for new functions in ProfileManagementController. 10-06-2024

⬜ PR 1.4

Introduce a new activity & related fragments/views/tests for a new classroom list page.

Starting Date Creation Date Merge Date
11-06-2024 21-06-2024 25-06-2024
Tasks Due Dates
Create ClassroomListActivity, ClassroomListFragment & ClassroomListViewModel. 12-06-2024
Gate the new ClassroomListActivity. 13-06-2024
Add tests to verify the gating. 14-06-2024
Introduce Jetpack Compose Dependencies. 16-06-2024
Implement the Sticky Header and other elements of the ComposeView. 17-06-2024
Implement the Topic List UI. 19-06-2024
Add tests for the Sticky Header and other elements of the ComposeView. 20-06-2024
Add tests for the Topic List UI. 21-06-2024

Milestone 2

⬜ PR 2.1

Update 'recently played' topic cards to include classroom information and update tests.

Starting Date Creation Date Merge Date
08-07-2024 11-07-2024 15-07-2024
Tasks Due Dates
Update topic cards UI. 09-07-2024
Update tests for the UI changes. 11-07-2024

⬜ PR 2.2

Implement new recommendations logic & UI support for the classroom selection and add tests.

Starting Date Creation Date Merge Date
13-07-2024 18-07-2024 20-07-2024
Tasks Due Dates
Update the recommendation logic to include classroom information. 16-07-2024
Update tests for the logic changes. 18-07-2024

⬜ PR 2.3

Ensure the existing event logs are captured in the new screen and related tests in preparation for removal & implement new event log.

Starting Date Creation Date Merge Date
21-07-2024 25-07-2024 28-07-2024
Tasks Due Dates
Ensure that the existing event logs are captured in the new screen. 21-07-2024
Add classroomId field in ExplorationContext object and update related tests. 22-07-2024
Implement logging of start_exploration event. 23-07-2024
Add tests to verify the behaviour of the new event. 25-07-2024

⬜ Task 2.4

Test, iterate, and work with the tech lead to finalize and launch the feature.

Starting Date Completion Date
29-07-2024 04-08-2024

⬜ PR 2.5

Audit home activity/fragment & recommendation tests to ensure the new utilities cover the same behaviors. Remove the old home activity/fragment.

Starting Date Creation Date Merge Date
02-08-2024 06-08-2024 09-08-2024
Tasks Due Dates
Verify that the new utilities cover the same behaviour. 04-08-2024
Enable the ENABLE_MULTIPLE_CLASSROOMS feature flag. 06-07-2024

BenHenning added a commit that referenced this issue May 29, 2024
<!-- READ ME FIRST: Please fill in the explanation section below and
check off every point from the Essential Checklist! -->
## Explanation
<!--
- Explain what your PR does. If this PR fixes an existing bug, please
include
- "Fixes #bugnum:" in the explanation so that GitHub can auto-close the
issue
  - when this PR is merged.
  -->

Fixes part of #5344

This PR introduces a feature flag `ENABLE_MULTIPLE_CLASSROOMS` which
will be used to gate the new multiple classrooms screens.

## Essential Checklist
<!-- Please tick the relevant boxes by putting an "x" in them. -->
- [x] The PR title and explanation each start with "Fix #bugnum: " (If
this PR fixes part of an issue, prefix the title with "Fix part of
#bugnum: ...".)
- [x] Any changes to
[scripts/assets](https://github.com/oppia/oppia-android/tree/develop/scripts/assets)
files have their rationale included in the PR explanation.
- [x] The PR follows the [style
guide](https://github.com/oppia/oppia-android/wiki/Coding-style-guide).
- [x] The PR does not contain any unnecessary code changes from Android
Studio
([reference](https://github.com/oppia/oppia-android/wiki/Guidance-on-submitting-a-PR#undo-unnecessary-changes)).
- [x] The PR is made from a branch that's **not** called "develop" and
is up-to-date with "develop".
- [x] The PR is **assigned** to the appropriate reviewers
([reference](https://github.com/oppia/oppia-android/wiki/Guidance-on-submitting-a-PR#clarification-regarding-assignees-and-reviewers-section)).

## For UI-specific PRs only
<!-- Delete these section if this PR does not include UI-related
changes. -->
If your PR includes UI-related changes, then:
- Add screenshots for portrait/landscape for both a tablet & phone of
the before & after UI changes
- For the screenshots above, include both English and pseudo-localized
(RTL) screenshots (see [RTL
guide](https://github.com/oppia/oppia-android/wiki/RTL-Guidelines))
- Add a video showing the full UX flow with a screen reader enabled (see
[accessibility
guide](https://github.com/oppia/oppia-android/wiki/Accessibility-A11y-Guide))
- For PRs introducing new UI elements or color changes, both light and
dark mode screenshots must be included
- Add a screenshot demonstrating that you ran affected Espresso tests
locally & that they're passing

Co-authored-by: Ben Henning <bhenning@google.com>
BenHenning added a commit that referenced this issue May 29, 2024
… for (multiple) classrooms & topic dependencies, and prepare for #4885 (#5398)

## 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:

```proto
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:
- The recommended topics structure has been updated to use this new
``topic_prerequisites`` value being loaded from classrooms. This will
also extend to production assets since the asset download script from
#4885 is also being updated to include support for this multiple
classrooms structure to address the remainder of #5365.
- To minimize domain changes, the new loading code assumes only **one**
classroom is present. TODOs have been added on #5344 to extend this to
support multiple classrooms.
- Current loading code (including for JSON) is ignoring all but:
``classrooms``, ``id``, and ``topic_prerequisites`` (including
``topic_ids``) from the protos above. These other fields are expected to
have supported added as part of #5344.
- There were some color simplifications made in ``TopicListController``.
These largely shouldn't have a major impact outside of developer assets.
These changes were made to ensure non-specificity to the previous lesson
classroom. In general, all of this should eventually be removed in favor
of loading colors from lesson assets, but that will need to wait until
the JSON pipeline is completely removed.

### 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:
- It required preloading everything upon first app open. Since it can
take a while for loading to occur, some robustness needed to be built in
for pausing, cancelling, and resuming. I'm not certain if these were
even 100% handled in the current implementation.
- It doesn't perform strong compatibility checks until you're in the app
which means lesson incompatibilities would just cause the app to get
stuck rather than addressing it during lesson import time (e.g. via an
asset downloader script).
- It required very significant workarounds to existing loading pipelines
that aren't ideal to keep in the codebase long-term (code smell).
- There's no guarantee the user even has enough disk space to download
all the needed assets (particularly audio), or if they'll have
sufficient internet connectivity & bandwidth to perform those downloads
upon first app open.

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):
- ``SplashActivityPresenter`` for enabling the downloader to start and
block the UI using a dialog box while the downloading occurred.
- ``AudioPlayerController` for removing the special loading logic for
primed audio files (the app now no longer supports loading audio files
from disk as we don't yet have a good long-term solution for
offline-available audio files due to their significant size).
- ``GlideImageLoader`` for removing support for loading locally cached
images (only through this flow; the flow we use for the asset download
script uses a different annotation and is still supported).

As alluded to above, two annotations were removed as part of this
cleanup:
- ``CacheAssetsLocally``: a boolean indicating whether the prime
download flow should be enabled.
- ``TopicListToCache``: this specified the list of topics to
pre-download if the flow was enabled.

### GAE structure cleanup & preparing for asset script

Preparing for #4885 included a few other changes, some of which were
nice-to-have:
- Introducing support for incorporating the protos from
https://github.com/oppia/oppia-proto-api (specifically
oppia/oppia-proto-api#1 since they are still a
work-in-progress).
- Adding ``java_proto`` versions for many of the app's proto structures
(since the download script runs in the JVM and doesn't use the javalite
proto environment).
- Removed all of the unused GAE services and models (addressing #1547 by
essentially making it obsolete), plus their mocks. These were never
hooked up, and they're never going to be: the long-term plan for the
codebase is to use new proto endpoints that will be added to Oppia web.
These Retrofit endpoints have actually been rebuilt and repurposed to be
used in the asset download script as a medium-term stop-gap until the
permanent proto endpoints can be added to Oppia web.
- ``RemoteAuthNetworkInterceptorTest`` was updated to use a different
example service since ``TopicService`` has been removed. The services
for platform parameters and user feedback are being kept.
- Some test file & KDoc exemptions have been removed since their
corresponding files have been deleted.

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
- [x] The PR title and explanation each start with "Fix #bugnum: " (If
this PR fixes part of an issue, prefix the title with "Fix part of
#bugnum: ...".)
- [x] Any changes to
[scripts/assets](https://github.com/oppia/oppia-android/tree/develop/scripts/assets)
files have their rationale included in the PR explanation.
- [x] The PR follows the [style
guide](https://github.com/oppia/oppia-android/wiki/Coding-style-guide).
- [x] The PR does not contain any unnecessary code changes from Android
Studio
([reference](https://github.com/oppia/oppia-android/wiki/Guidance-on-submitting-a-PR#undo-unnecessary-changes)).
- [x] The PR is made from a branch that's **not** called "develop" and
is up-to-date with "develop".
- [x] The PR is **assigned** to the appropriate reviewers
([reference](https://github.com/oppia/oppia-android/wiki/Guidance-on-submitting-a-PR#clarification-regarding-assignees-and-reviewers-section)).

## For UI-specific PRs only
This is essentially only data infrastructural except for a couple of
points:
- Topic loading is now happening through a classrooms structure rather
than a tropic ID list. Since there's only one test & one production
classroom, this shouldn't actually change the UX.
- An at-app-open flow for predownloading image & audio assets has been
removed. This hasn't been used since the very earliest alpha releases of
the app, so it won't actually affect any users.
- Some colors for developer lesson and topic thumbnails were
updated--see above.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement End user-perceivable enhancements.
Development

No branches or pull requests

4 participants