Skip to content

feat: integrate Web Learning courses, homework and materials - #6

Merged
meashgrey merged 27 commits into
mainfrom
feat/courses-info
Nov 19, 2026
Merged

meashgrey merged 27 commits into
mainfrom
feat/courses-info

Conversation

@meashgrey

@meashgrey meashgrey commented Nov 19, 2026 •

Copy link
Copy Markdown
Member

Summary

Integrate Tsinghua Web Learning (网络学堂) course data into Thulium's Study experience and extend the shared campus/auth infrastructure used by the Flutter application and Dart CLI.

The branch adds course catalog and course details, assignment/homework models and presentation, teaching materials and document preview/download support, secure course/homework caching, and a Study page with course navigation. It also introduces session recovery and device-trust authentication handling, CLI commands/formatters for Web Learning data, diagnostic logging and export, application preferences, and reusable Flutter navigation/UI components.

In addition, this branch adds a project-specific thulium-ui agent skill and AGENTS.md guidelines, and restructures a number of existing tests.

Related Issue

Refs #5

This PR implements substantial parts of the Web Learning integration described in #5. Course discussion/thread functionality is not evident from the branch's changed-file inventory and should be verified before considering the full issue complete; therefore this PR does not automatically close #5.

Type Of Change

  • Bug fix
  • Feature
  • UI/UX change
  • Authentication or security change
  • Documentation
  • CI/build tooling

User Impact

Users gain a dedicated Study entry point for Tsinghua Web Learning courses, with course information, homework overview/details, and course materials where available. Course and homework data can be cached securely and accessed through shared campus domain models. The CLI also gains Web Learning-related functionality and file download support.

The branch changes parts of the application's navigation, login/session handling, localization, and settings experience. Reviewers should inspect these cross-cutting changes separately from the course data integration.

Localization And Accessibility

Updated English and Chinese localization assets cover the new course, homework, study, settings, and diagnostic surfaces. New reusable UI widgets and page structure aim to keep navigation and component behavior consistent across screens.

Validation

The branch adds or updates unit and widget tests for authentication, session recovery, course catalog and details, homework parsing/caching, teaching materials, file downloads, diagnostics, preferences, and Study UI.

The following commands have not been executed as part of opening this PR:

  • flutter analyze
  • flutter test
  • dart analyze for changed Dart packages
  • Built or manually tested affected platforms

Screenshots Or Logs

N/A — screenshots and CI results can be attached during review.

Risks And Follow-Up

  • Upstream Web Learning data and authentication flows may change; parsing, session renewal, and download handling deserve particular review.
  • Verify that cached academic data and diagnostic logs do not leak credentials, cookies, or private student content.
  • The branch includes substantial authentication, navigation, CLI, and design-system changes beyond the core course information feature. Review them by subsystem.
  • Confirm whether course discussions and replies are included; if not, complete them in a follow-up PR before closing feat: integrate Tsinghua Web Learning #5.
  • Confirm CI and platform tests before merging.

Add `learn-courses --semester` to fetch course data and print a YAML summary.
Extract the learning platform session handling into the campus package, add
course formatting and tests, and document the command.
Retry schedule and learn-courses requests once after reconnecting with saved
credentials, with an interactive sign-in fallback. Detect rejected learning
platform sessions and document the recovery flow.
Add a Study section with course listings, refresh, loading, and stale-cache
states. Cache the current semester’s courses for 24 hours, use English course
titles in the calendar, and add CLI refresh support.
Move logic and storage tests under test/unit, and organize Flutter widget tests
by app, calendar, plans, and study. Document the test layout and reserve
integration_test for device-level end-to-end tests.
Add the learn-homework command to report per-course and semester totals
for unsubmitted, submitted-but-ungraded, and graded assignments.

Fetch counts from Learn’s total-record metadata, keep YAML output clean by
sending prompts and diagnostics to stderr, and document the command.
Fetch unsubmitted assignment totals for each course and display positive counts on Study cards.

Add localized labels and loading/error states, with tests for badges, zero counts, and failed requests.
Persist account- and semester-scoped assignment snapshots and refresh
them on app entry, resume, and manual refresh.

Show course-linked deadlines and urgency countdowns on the first tab,
with loading, stale-data, error, and empty states. Add localized labels,
theme-aware status colors, and UI coverage.
List course materials with semester, course, and result-limit options,
and format metadata as YAML.

Flag potentially truncated results without claiming a total count. Share
flat Forui tile styling between Study courses and the homework overview.
Add authenticated binary downloads for course materials and preserve
response metadata needed to save files.

Extend the Learn materials command with file download handling, and
cover byte responses and saved-file behavior with tests.
Move CLI command definitions into a CommandRunner and service operations
into CliRuntime.

Preserve existing commands and implicit material-list and cover-download
behavior, with command-runner tests.
Add secret-tool to the Linux development shell and document
NixOS Secret Service setup.
Provide Android API 35 and CMake 3.22.1 so Gradle does not attempt
to install missing components into the read-only Nix store.
Remove the surrounding borders from My courses and Upcoming
assignments while preserving separators between adjacent items.
…et opaque

Disable assignment row background highlights and give the actions
sheet a solid theme background.
Make courses in My courses selectable and open a course detail page
with teacher and schedule information, course files, and assignments.

Course content:
- Load file metadata through the existing authenticated Learn service.
- Display file titles, types, sizes, empty states, and list-limit warnings.
- Group assignments into unsubmitted, submitted awaiting grading, and
  graded sections.
- Expand each assignment list to its server-reported total instead of
  displaying only the first five entries.
- Add refresh controls, loading indicators, retry actions, and
  session-expiration messages.

Document previews:
- Add pdfx and render authenticated PDF bytes inside the app.
- Preview Word documents through Learn's PDF conversion endpoint.
- Support vertical page navigation, zooming, and page-count display.
- Release the PDF controller and native document when leaving preview.
- Show an unsupported-platform message on Linux.
- Register desktop plugins and configure the Windows PDFium version.

Authentication:
- Restore and check the account before requesting course content.
- Attempt one credential-based reconnection after session or CSRF errors.
- Keep the restored home and cached information visible when background
  course or homework refresh requires interactive two-factor verification.
- Show a localized Sign in prompt instead of immediately returning to
  Welcome, and clear the prompt after a successful refresh.

Add English, Simplified Chinese, and Traditional Chinese translations,
regenerate localization bindings, and document preview behavior and limits.

Validation:
- Flutter static analysis passed.
- Seven app startup/navigation tests and five course/study widget tests passed.
- Twenty homework and material-service tests passed.
- Five calendar export and plan-editing failures in the full Flutter suite
  were also reproduced on an unmodified HEAD checkout.

Limitations:
- Word preview requires an available PDF representation from Learn.
- Submitted and graded assignment GET endpoints need live-account verification.
- Android device rendering and a release APK build have not been verified.
Keep list backgrounds stable, remove redundant descriptions,
and standardize navigation, loading, and nested page chrome.
Document the UI conventions and preserve the calendar panel.
Serialize shared session operations to prevent stale cookie writes
and duplicate logins. Retry authenticated requests with saved
credentials while preserving trusted-device state, and coordinate
explicit sign-in and sign-out with background requests.
Collect trust consent before the initial credential submission,
persist browser consent independently of legacy tokens, and follow
trusted-browser forms during portal login and silent renewal.
Verify the main account before rebuilding an expired Learn session.
Retry Learn reads once without unnecessary credential login.
Keep saved-password recovery for expired university sessions.

Avoid treating file permission errors or quoted login markup as logout.
Include Learn CSRF tokens in PDF requests and handle obsolete landing URLs.
Preserve retry actions for temporary course service failures.

Add service recovery, concurrency and UI regression coverage.
Export filtered local diagnostics from settings and welcome screens.
Retain bounded logs across restarts with version and recovery stages.
Restore main-compatible login fields and trusted-token confirmation.
Persist theme and language preferences.
Add diagnostics, authentication and UI regression coverage.
Request device trust only after successful verification and reuse
the choice throughout the login attempt.

Show a clear warning when the trusted-device quota is reached,
then continue sign-in without marking the device as trusted.

Surface other registration failures instead of silently ignoring them.
Allow users to retry sign-in without device registration.

Record classified failure reasons and HTTP status codes in diagnostic
exports without retaining raw provider messages or sensitive values.

Add regression coverage for registration failures, quota warnings,
successful token persistence, and sign-in recovery.
@sourcery-ai

sourcery-ai Bot commented Nov 19, 2026

Copy link
Copy Markdown

Sorry @meashgrey, your pull request is larger than the review limit of 150,000 diff characters

@meashgrey meashgrey added enhancement New feature or request ui/ux ui/ux related problems and features auth Authentication problems and issues labels Nov 19, 2026
@meashgrey meashgrey self-assigned this Nov 19, 2026
Pin CI and release workflows to Flutter 3.47.4.
Update SDK constraints, lockfile and development documentation.
Limit the legacy semantics workaround to five functional tests.
Remove the hardcoded PDFium 4638 override whose download URL returns 404.
Allow pdfx to select its default PDFium version for the target architecture.
@meashgrey
meashgrey merged commit 68f2386 into main Nov 19, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

auth Authentication problems and issues enhancement New feature or request ui/ux ui/ux related problems and features

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: integrate Tsinghua Web Learning

1 participant