-
Notifications
You must be signed in to change notification settings - Fork 108
[MBL-19462][Student][Teacher] My Courses Widget Part 2 - Actions, customization, and reordering #3494
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
Open
kristofnemere
wants to merge
11
commits into
master
Choose a base branch
from
MBL-19462-my-courses-widget-part-2
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Added unit test coverage for the new course customization, announcement, and group messaging features: - SetCourseColorUseCaseTest with 4 tests for color change functionality - 11 new tests in CoursesWidgetViewModelTest for announcement loading, click handling, group messaging, and broadcast receiver behavior - Fixed existing broadcast receiver tests to properly mock Intent.getLongExtra - Added CustomizeCourseBehavior binding to parent app's DefaultBindingsModule to resolve Dagger injection error Tests verify: - Use cases correctly delegate to repositories and handle errors - Announcements are loaded, mapped, and filtered for unread status - Click handlers properly find courses/groups and delegate to behaviors - Broadcast receiver handles both COURSE_ID and COURSE_FAVORITES changes - Error scenarios are handled gracefully with crashlytics logging Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
…, announcements, and group messaging This commit implements the remaining features for the My Courses Widget: ## Course Customization - Added course customize screen allowing users to change course color and nickname - Implemented CustomizeCourseViewModel with color picker and nickname editing - Created CustomizeCourseBehavior interface with Student/Teacher implementations - Student app: color overlay visibility controlled by StudentPrefs - Teacher app: color overlay always visible - Router integration for navigation to customize screen from 3-dots menu - Added CourseNicknameAPI for setting/deleting course nicknames - Broadcasts COURSE_ID changes for single course updates ## Announcements - Implemented LoadCourseAnnouncementsUseCase to fetch unread announcements - Added announcement count badge to course cards - Announcement icon click routes to: - Single announcement: opens announcement details - Multiple announcements: opens announcement list - Graceful error handling with Crashlytics logging - Caches announcements in UI state to avoid redundant network calls ## Group Messaging - Added message icon to group cards - Click handler routes to inbox compose with group pre-selected - Integrated with existing inbox compose functionality ## Repository & API Changes - Extended UserRepository with course nickname and color operations - Added InboxComposeRepository.getGroups() returning empty list (not implemented) - Fixed InboxComposeRepository constructors across Student/Teacher/Parent apps - Enhanced ColorKeeper with cache management and hex conversion utilities ## Broadcast Receiver Improvements - Enhanced broadcast receiver to handle COURSE_ID for targeted updates - Supports COURSE_FAVORITES for full refresh scenarios - Single course reload reloads both course data and announcements ## Testing - SetCourseColorUseCaseTest: 4 tests for color persistence - SetCourseNicknameUseCaseTest: 4 tests for nickname operations - LoadCourseAnnouncementsUseCaseTest: 7 tests for filtering unread announcements - CustomizeCourseViewModelTest: 18 comprehensive tests for all customization flows - StudentCustomizeCourseBehaviorTest: 2 tests for color overlay preference - TeacherCustomizeCourseBehaviorTest: 1 test for always-visible overlay - CoursesWidgetViewModelTest: 11 new tests for announcement/messaging features - StudentCoursesWidgetBehaviorTest: 4 tests for routing logic - Fixed existing broadcast receiver tests with proper Intent mocking ## DI & Module Updates - Added CustomizeCourseBehavior bindings to Student/Teacher modules - Added parent app binding (NotImplementedError for unused features) - Registered CourseNicknameAPI in ApiModule Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Added visual indicators for offline sync status: - Show ic_offline_synced icon when course is synced for offline use - Icon appears next to course name, before announcements - Existing alpha fade (0.5f) and disabled clicks already handle unavailable courses Implementation matches old dashboard pattern from CourseViewHolder. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
- Add Compose instrumentation tests for CourseCard, GroupCard, and CustomizeCourseScreen with semantic test tags - Fix CoursesWidgetTest compilation errors (CourseCardItem parameter changes) - Add tests for ObserveWidgetConfigUseCase CoursesConfig support - Refactor InboxComposeRepository: isolate group messaging to StudentInboxComposeRepository only, remove GroupAPI dependency from base class and Teacher/Parent implementations - Add comprehensive tests for canSendToAll in StudentInboxComposeRepositoryTest (courses and groups) - Add tests for UserRepository new methods (setCourseNickname, deleteCourseNickname, setCourseColor) - Fix CourseBrowserFragment: cache feature flag, fix default values, prevent updateToolbarVisibility crash - Fix copyright year in RequireNetworkDialog.kt (2025 -> 2026) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
…ttern - Add messageGroup string resource for better accessibility - Update GroupCard icon content description from generic "Inbox" to specific "Message group" - Add announcement support to CourseRepository (getCourseAnnouncement, getCourseAnnouncements) - Refactor LoadCourseAnnouncementsUseCase to use CourseRepository instead of direct API dependency - Update CourseRepositoryImpl to include AnnouncementAPI with pagination support - Add comprehensive tests for new CourseRepository announcement methods - Update RepositoryModule DI to provide AnnouncementAPI to CourseRepository - Update all related tests to use CourseRepository mock This improves architecture by following proper repository pattern and enhances accessibility for screen readers with more descriptive content descriptions. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Move Params data classes inside their respective UseCase classes and rename them to just "Params" following the project convention: - LoadCourseAnnouncementsUseCase.Params (was LoadCourseAnnouncementsParams) - SetCourseColorUseCase.Params (was SetCourseColorParams) - SetCourseNicknameUseCase.Params (was SetCourseNicknameParams) Updated tests to reference the nested Params classes. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
- Create AnnouncementRepository for announcement-related operations - Create CourseNicknameRepository for course nickname operations - Remove announcement methods from CourseRepository - Remove course nickname methods from UserRepository - Update LoadCourseAnnouncementsUseCase to use AnnouncementRepository - Update SetCourseNicknameUseCase to use CourseNicknameRepository - Update RepositoryModule DI configuration for new repositories - Update all repository and use case tests - Refactor use case Params to be nested classes - Update all callers to use nested Params pattern - Fix cursor visibility in CustomizeCourseScreen for dark mode Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
- Add sh.calvin.reorderable library (v2.4.0) dependency - Convert courses NonLazyGrid to LazyVerticalGrid with reorderable support - Add long-press drag gesture for course cards - Implement onCourseMoved callback in ViewModel - Add updateDashboardPositions method to UserRepository - Persist course order to backend via UserAPI - Update CoursesWidgetUiState with onCourseMoved callback Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
- Implement drag and drop functionality using sh.calvin.reorderable library - Add onCourseMoved callback to handle reordering in ViewModel - Update UserRepository to persist dashboard positions and invalidate cache - Extract COURSE_CARD_HEIGHT constant to avoid duplication - Add comprehensive tests for reordering and cache invalidation Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
🧪 Unit Test Results✅ 📱 Student App
✅ 📱 Teacher App
✅ 🌅 Horizon
✅ 📦 Submodules
📊 Summary
Last updated: Tue, 27 Jan 2026 16:40:58 GMT |
Removed tests for observeGradeVisibility and observeColorOverlay methods that no longer exist in the CoursesWidgetBehavior interface. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
📊 Code Coverage Report
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Implements Part 2 of the My Courses Widget for the new dashboard, including:
Test Plan
Course Reordering
Announcement Actions
Group Messaging
Course/Group Customization (3-Dots Menu)
Offline Mode & Sync Status
Navigation Drawer Updates
Accessibility
refs: MBL-19462
affects: Student, Teacher
release note: Improved My Courses widget with drag-and-drop reordering, quick access to announcements and group messaging, course customization options, and enhanced offline support
Technical Details
Course Reordering
sh.calvin.reorderablelibrary (v2.4.0) for drag and drop supportonCourseMovedcallback inCoursesWidgetViewModelto handle reorderingUserRepository.updateDashboardPositionsto persist order and invalidate cache on successCOURSE_CARD_HEIGHTconstant to avoid duplicationRepository Separation
AnnouncementRepositoryandAnnouncementRepositoryImplfor announcement operationsCourseNicknameRepositoryandCourseNicknameRepositoryImplfor nickname managementLoadCourseAnnouncementsUseCasefor fetching course announcementsSetCourseColorUseCaseandSetCourseNicknameUseCasefor customizationUI Components
CustomizeCourseScreenwith nickname editing and color pickerCourseCardwith announcement icon and 3-dots menuGroupCardwith message/inbox iconOffline Support
Navigation Updates
announcementDetailsandannouncementListroutescustomizeCourserouteInboxComposeRepositoryto support group recipient pre-populationTesting
AnnouncementRepositoryandLoadCourseAnnouncementsUseCaseCourseNicknameRepositoryand nickname use casesCustomizeCourseViewModelwith all customization flowsFiles Changed
New Files:
AnnouncementRepository.kt/AnnouncementRepositoryImpl.ktCourseNicknameRepository.kt/CourseNicknameRepositoryImpl.ktLoadCourseAnnouncementsUseCase.ktSetCourseColorUseCase.kt/SetCourseNicknameUseCase.ktCustomizeCourseScreen.kt/CustomizeCourseViewModel.kt/CustomizeCourseUiState.ktModified Files:
CoursesWidgetViewModel.kt- Added reordering and announcement handlingCourseCard.kt- Added announcement icon and 3-dots menuGroupCard.kt- Added message iconUserRepositoryImpl.kt- Cache invalidation after position updatesChecklist