Skip to content

[MBL-19650][Student][Teacher] Update PSPDFKit to 11.1.1#3556

Open
tamaskozmer wants to merge 8 commits intomasterfrom
MBL-19650-update-pspdfkit
Open

[MBL-19650][Student][Teacher] Update PSPDFKit to 11.1.1#3556
tamaskozmer wants to merge 8 commits intomasterfrom
MBL-19650-update-pspdfkit

Conversation

@tamaskozmer
Copy link
Contributor

@tamaskozmer tamaskozmer commented Mar 3, 2026

Summary

  • Updated PSPDFKit (Nutrient) dependency from previous version to 11.1.1
  • Added coroutines for API calls that became suspend functions in the new version
  • Removed edit content option from CandroidPSPDFActivity and popup menu from PdfSubmissionView
  • Fixed stamps and comments button functionality
  • Fixed creation/edit toolbar edge-to-edge issue

Test plan

  1. Open Student app and navigate to a course with PDF submissions
  2. Open a PDF document with annotation permissions
  3. Test annotation creation tools (ink, highlight, strikeout, square, stamp, freetext, eraser)
  4. Verify stamps appear correctly and can be placed
  5. Verify comments button appears when selecting annotations
  6. Test annotation editing and deletion
  7. Verify toolbar displays correctly without edge-to-edge issues
  8. Repeat tests in Teacher app for SpeedGrader PDF submissions
  9. Test in both light and dark mode
  10. Test the PDF editing functionality from the Student files screen

refs: MBL-19650
affects: Student, Teacher
release note: Updated PDF annotation library for improved stability and performance

  • Follow-up e2e test ticket created or not needed
  • Tested in dark mode
  • Tested in light mode
  • Test in landscape mode and/or tablet
  • A11y checked
  • Approve from product

🤖 Generated with Claude Code

Co-Authored-By: Claude noreply@anthropic.com

Copy link

@claude claude bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nutrient SDK 10.7.0 → 11.1.1 Version Bump

This PR updates the Nutrient (PSPDFKit) dependency from 10.7.0 to 11.1.1 and adapts CandroidPSPDFActivity to the new async API for getAllAnnotationsOfType.

Issues Found

  • CandroidPSPDFActivity.kt line 105: lifecycleScope.launch in onDestroy() is unreliable for async cleanup. The lifecycle scope is cancelled when the lifecycle transitions to DESTROYED (triggered during the super.onDestroy() call chain). Since getAllAnnotationsOfType is now a suspend function in Nutrient 11.x, the coroutine will suspend at that call and likely be cancelled before it can resume, meaning the temporary PDF file may never be cleaned up. Wrapping the block in withContext(NonCancellable) { ... } or moving this logic to onStop() would make it reliable.

Positive Notes

  • The version bump itself looks clean — only the minimal necessary change was made to GlobalDependencies.kt.
  • The coroutine-based adaptation in CandroidPSPDFActivity correctly accesses document before calling super.onDestroy(), which is the right ordering to avoid NPEs from PSPDFKit cleaning up its state.
  • The rest of the codebase (PdfSubmissionView, AnnotationConverter, etc.) appears unaffected by this SDK upgrade, suggesting the Nutrient 11.x API is otherwise backward-compatible for the usages here.

@github-actions
Copy link

github-actions bot commented Mar 3, 2026

🧪 Unit Test Results

✅ 📱 Student App

  • Tests: 1252 total, 0 failed, 0 skipped
  • Duration: 0.000s
  • Success Rate: 100%

✅ 📱 Teacher App

  • Tests: 373 total, 0 failed, 0 skipped
  • Duration: 34.056s
  • Success Rate: 100%

✅ 🌅 Horizon

  • Tests: 623 total, 0 failed, 0 skipped
  • Duration: 36.922s
  • Success Rate: 100%

✅ 📦 Submodules

  • Tests: 3143 total, 0 failed, 0 skipped
  • Duration: 52.333s
  • Success Rate: 100%

📊 Summary

  • Total Tests: 5391
  • Failed: 0
  • Skipped: 0
  • Status: ✅ All tests passed!

Last updated: Tue, 03 Mar 2026 13:38:18 GMT

@github-actions
Copy link

github-actions bot commented Mar 3, 2026

📊 Code Coverage Report

⚠️ Student

  • PR Coverage: 42.97%
  • Master Coverage: 42.98%
  • Delta: -0.00%

✅ Teacher

  • PR Coverage: 25.35%
  • Master Coverage: 25.35%
  • Delta: +0.00%

✅ Pandautils

  • PR Coverage: 23.69%
  • Master Coverage: 23.69%
  • Delta: +0.00%

📈 Overall Average

  • PR Coverage: 30.67%
  • Master Coverage: 30.67%
  • Delta: -0.00%

@github-actions
Copy link

github-actions bot commented Mar 3, 2026

Teacher Install Page

@github-actions
Copy link

github-actions bot commented Mar 3, 2026

Student Install Page

Copy link

@claude claude bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR Review Progress Update

Reviewing the latest synchronize push for this Nutrient (PSPDFKit) 10.7.0 → 11.1.1 upgrade PR.


What Changed in This Update

This push adapts the codebase to the breaking API changes in PSPDFKit 11.x:

  • API migration: AnnotationManager.OnAnnotation*ModeChangeListener → top-level OnAnnotation*ModeChangeListener interfaces; PSPDFKit class → Nutrient
  • Coroutine migration: tryWeaveviewScope.tryLaunch throughout PdfSubmissionView (good lifecycle practice)
  • Performance fix: loadCustomAppearanceGeneratorsAsync() now offloads 10 PDF asset reads to Dispatchers.IO (fixes potential ANR)
  • Lifecycle improvement: Removed delay(200) workaround, added onAnnotationDeselected callback
  • Cleanup: Removed DocumentListenerSimpleDelegate, removed unused extension functions findAnnotationById/removeAnnotation/addAnnotation, replaced wildcard imports
  • UI fix: StampPickerStyle pspdf__maxWidth increased from 100dp200dp
  • Config additions: contentEditingEnabled(false) and annotationPopupToolbarEnabled(false) added to PDF configurations
  • Window insets: Status bar insets consumed at layout level to prevent overlap with annotation toolbar

Issues Requiring Attention

🔴 GlobalScope.launch in CandroidPSPDFActivity.onDestroy() (new inline comment added)

lifecycleScope is imported but unused, while GlobalScope is used instead — this should use lifecycleScope.launch.

🟡 Magic string "#CustomAp" in CanvaPdfAnnotation.kt (new inline comment added)

Should be a named constant with documentation explaining the format requirement.

🟡 @file:Suppress("CONFLICTING_INHERITED_JVM_DECLARATIONS") in CanvaPdfAnnotation.kt (new inline comment added)

Needs a comment explaining why this suppression is necessary for PSPDFKit 11.x.


Positive Changes

  • ✅ Migration from tryWeave to viewScope.tryLaunch — proper lifecycle-scoped coroutines
  • loadCustomAppearanceGeneratorsAsync() — asset I/O offloaded to Dispatchers.IO
  • ✅ Removed delay(200) workaround — replaced with proper async approach
  • contentEditingEnabled(false) added to prevent accidental content editing
  • ✅ Window insets handling prevents status bar overlap in annotation toolbar
  • MutableList<RectF>List<RectF> in AnnotationConverter.kt — more general API
  • ✅ Explicit imports replacing wildcard import in CanvaPdfAnnotation.kt
  • DocumentListenerSimpleDelegate removed in favor of direct DocumentListener implementation

Copy link
Contributor

@kdeakinstructure kdeakinstructure left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

QA 👍 (But MBL-19687 still an issue so it should be investigated).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants