-
Notifications
You must be signed in to change notification settings - Fork 107
[MBL-19455][Student] Implement Welcome Widget with time-based greetings #3404
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
Conversation
- Add time-based greeting logic (Morning/Afternoon/Evening/Night) - Implement personalized greetings with user's first name - Add 88 motivational messages (52 generic + 36 time-specific) - Support pull-to-refresh to update greeting and message - Add TalkBack accessibility support - Move implementation to pandautils for cross-app reusability - Use MVVM architecture with Use Cases and Hilt DI Implements time-of-day detection: - Morning: before 12pm - Afternoon: 12pm - 5pm - Evening: 5pm - 9pm - Night: after 9pm 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
- Update time boundaries: Night 9pm-4am, Morning 4am-12pm - Add comprehensive unit tests for TimeOfDayCalculator - Add unit tests for GetWelcomeGreetingUseCase (with/without user name) - Add unit tests for GetWelcomeMessageUseCase (message pool validation) - All tests passing Time period definitions: - Morning: 4am - 12pm - Afternoon: 12pm - 5pm - Evening: 5pm - 9pm - Night: 9pm - 4am (wraps around midnight) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
- Add comprehensive ViewModel tests (9 test cases) - Test init loads greeting and message correctly - Test all time periods (morning, afternoon, evening, night) - Test refresh functionality updates greeting and message - Test greeting changes when time period changes - Test multiple refresh calls work correctly - All tests passing Test coverage: - Initial state loading - Greeting with/without user name - All 4 time periods - Refresh mechanism - State updates on time changes 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Welcome Widget Implementation Review
This PR implements a new Welcome Widget feature for the dashboard with personalized greetings and motivational messages. The implementation follows good architectural patterns with proper separation of concerns, dependency injection, and comprehensive test coverage.
✅ Strengths
- Excellent architecture: Clean separation with use cases, dependency injection via Hilt, and testable components
- Comprehensive testing: All core components have unit tests with good coverage (TimeOfDayCalculator, ViewModel, and both use cases)
- Proper dependency injection: TimeProvider abstraction allows for easy testing and follows SOLID principles
- Good accessibility: Content description properly implemented for screen readers
- Code organization: Files properly moved to pandautils library for sharing across apps
- Internationalization: Proper use of string resources with time-appropriate messages
Issues Found
- Missing newlines at end of files: All 9 new Kotlin files are missing the trailing newline character (see inline comments on each file). This violates Kotlin coding standards and may cause issues with some tools.
🔍 Minor Suggestions
- Random testability (libs/pandautils/src/main/java/com/instructure/pandautils/features/dashboard/widget/welcome/usecase/GetWelcomeMessageUseCase.kt:43): Consider injecting a
Randominstance via DI to make the random message selection more testable, though the current test approach of verifying "contains one of expected messages" works fine.
📝 Code Quality Assessment
Architecture: ⭐⭐⭐⭐⭐ Exemplary use of MVVM, use cases, and dependency injection
Testing: ⭐⭐⭐⭐⭐ Comprehensive unit test coverage with proper mocking
Compose: ⭐⭐⭐⭐⭐ Clean composable structure with proper state management and accessibility
Kotlin Style: ⭐⭐⭐⭐ Good, but missing trailing newlines
Performance: ⭐⭐⭐⭐⭐ No performance concerns; lightweight and efficient
Summary
This is a well-crafted implementation with excellent architecture and testing. The main issue is a formatting concern (missing trailing newlines) that should be addressed before merging. Once the newlines are added, this will be ready to merge.
Recommendation: Approve pending the trailing newline fixes.
...tils/src/main/java/com/instructure/pandautils/features/dashboard/widget/welcome/TimeOfDay.kt
Outdated
Show resolved
Hide resolved
...ain/java/com/instructure/pandautils/features/dashboard/widget/welcome/TimeOfDayCalculator.kt
Outdated
Show resolved
Hide resolved
...s/src/main/java/com/instructure/pandautils/features/dashboard/widget/welcome/TimeProvider.kt
Outdated
Show resolved
Hide resolved
.../src/main/java/com/instructure/pandautils/features/dashboard/widget/welcome/WelcomeWidget.kt
Outdated
Show resolved
Hide resolved
.../java/com/instructure/pandautils/features/dashboard/widget/welcome/WelcomeWidgetViewModel.kt
Show resolved
Hide resolved
.../java/com/instructure/pandautils/features/dashboard/widget/welcome/di/WelcomeWidgetModule.kt
Outdated
Show resolved
Hide resolved
...nstructure/pandautils/features/dashboard/widget/welcome/usecase/GetWelcomeGreetingUseCase.kt
Outdated
Show resolved
Hide resolved
...instructure/pandautils/features/dashboard/widget/welcome/usecase/GetWelcomeMessageUseCase.kt
Outdated
Show resolved
Hide resolved
...instructure/pandautils/features/dashboard/widget/welcome/usecase/GetWelcomeMessageUseCase.kt
Outdated
Show resolved
Hide resolved
📊 Code Coverage Report✅ Student
✅ Teacher
✅ Pandautils
📈 Overall Average
|
...com/instructure/pandautils/features/dashboard/widget/welcome/GetWelcomeMessageUseCaseTest.kt
Outdated
Show resolved
Hide resolved
adamNagy56
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- I think it would be good to have an automatic refresh on the dashboard after the user changes their username.
…idget # Conflicts: # apps/student/src/main/java/com/instructure/student/features/dashboard/compose/DashboardScreen.kt # libs/pandares/src/main/res/values/strings.xml
- Add trailing newline to TimeOfDay.kt - Add trailing newline to TimeOfDayCalculator.kt - Add trailing newline to TimeProvider.kt - Add trailing newline to WelcomeWidget.kt - Add trailing newline to WelcomeWidgetUiState.kt - Add trailing newline to WelcomeWidgetViewModel.kt - Add trailing newline to WelcomeWidgetModule.kt - Add trailing newline to GetWelcomeGreetingUseCase.kt - Add trailing newline to GetWelcomeMessageUseCase.kt Addresses PR review feedback - all Kotlin files should end with a newline per coding standards.
- Add Random parameter to GetWelcomeMessageUseCase constructor - Provide Random instance via ApplicationModule in pandautils - Update tests to mock Random and verify exact message selection - Improves test quality by removing circular logic Addresses PR review feedback from kristofnemere: tests now verify specific message selection instead of just checking if result is in the message pool.
Summary
Implements the Welcome Widget for the Student app dashboard with time-based personalized greetings and motivational messages.
Key Features:
Architecture:
pandautilsfor cross-app reusabilityTest Plan
./gradle/gradlew -p apps :pandautils:testDebugUnitTest --tests "com.instructure.pandautils.features.dashboard.widget.welcome.*"refs: MBL-19455
affects: Student
release note: Added personalized welcome widget with time-based greetings and motivational messages
Checklist