[MBL-19650][Student][Teacher] Update PSPDFKit to 11.1.1#3556
[MBL-19650][Student][Teacher] Update PSPDFKit to 11.1.1#3556tamaskozmer wants to merge 8 commits intomasterfrom
Conversation
Removed popup menu from PdfSubmissionView.
Removed popup menu from PdfSubmissionView.
There was a problem hiding this comment.
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.ktline 105:lifecycleScope.launchinonDestroy()is unreliable for async cleanup. The lifecycle scope is cancelled when the lifecycle transitions toDESTROYED(triggered during thesuper.onDestroy()call chain). SincegetAllAnnotationsOfTypeis 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 inwithContext(NonCancellable) { ... }or moving this logic toonStop()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
CandroidPSPDFActivitycorrectly accessesdocumentbefore callingsuper.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.
apps/student/src/main/java/com/instructure/student/activity/CandroidPSPDFActivity.kt
Outdated
Show resolved
Hide resolved
🧪 Unit Test Results✅ 📱 Student App
✅ 📱 Teacher App
✅ 🌅 Horizon
✅ 📦 Submodules
📊 Summary
Last updated: Tue, 03 Mar 2026 13:38:18 GMT |
📊 Code Coverage Report
|
…n after the Activity is destroyed.
There was a problem hiding this comment.
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-levelOnAnnotation*ModeChangeListenerinterfaces;PSPDFKitclass →Nutrient - Coroutine migration:
tryWeave→viewScope.tryLaunchthroughoutPdfSubmissionView(good lifecycle practice) - Performance fix:
loadCustomAppearanceGeneratorsAsync()now offloads 10 PDF asset reads toDispatchers.IO(fixes potential ANR) - Lifecycle improvement: Removed
delay(200)workaround, addedonAnnotationDeselectedcallback - Cleanup: Removed
DocumentListenerSimpleDelegate, removed unused extension functionsfindAnnotationById/removeAnnotation/addAnnotation, replaced wildcard imports - UI fix:
StampPickerStylepspdf__maxWidthincreased from100dp→200dp - Config additions:
contentEditingEnabled(false)andannotationPopupToolbarEnabled(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
tryWeavetoviewScope.tryLaunch— proper lifecycle-scoped coroutines - ✅
loadCustomAppearanceGeneratorsAsync()— asset I/O offloaded toDispatchers.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>inAnnotationConverter.kt— more general API - ✅ Explicit imports replacing wildcard import in
CanvaPdfAnnotation.kt - ✅
DocumentListenerSimpleDelegateremoved in favor of directDocumentListenerimplementation
apps/student/src/main/java/com/instructure/student/activity/CandroidPSPDFActivity.kt
Show resolved
Hide resolved
libs/annotations/src/main/java/com/instructure/annotations/CanvaPdfAnnotation.kt
Show resolved
Hide resolved
libs/annotations/src/main/java/com/instructure/annotations/CanvaPdfAnnotation.kt
Show resolved
Hide resolved
kdeakinstructure
left a comment
There was a problem hiding this comment.
QA 👍 (But MBL-19687 still an issue so it should be investigated).
Summary
Test plan
refs: MBL-19650
affects: Student, Teacher
release note: Updated PDF annotation library for improved stability and performance
🤖 Generated with Claude Code
Co-Authored-By: Claude noreply@anthropic.com