Skip to content
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

Preserve PDF annotations even when cache is reset #2965

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

suhaibabsi-inst
Copy link
Contributor

@suhaibabsi-inst suhaibabsi-inst commented Nov 11, 2024

refs: MBL-18069
affects: Student
release note: PDF annotations is preserved even when cache is reset

Test Plan

  • Login to Student app
  • Open a PDF file and make some annotations to it, then go back.
  • Close the app entirely.
  • Go to the App's page on Settings app.
  • Turn on "Reset cache on next launch" toggle.
  • Launch the app, then login back to the same user.
  • Open the PDF file that was annotated in step 2.
  • You should see the previously saved annotations on that file.

Video Record

Recording covering PDF annotation persistence scenarios, which are:

  • On logout
  • On cache reset.
pdf_annotations_saving.mov

Checklist

  • Follow-up e2e test ticket created
  • A11y checked
  • Tested on phone
  • Tested on tablet
  • Tested in dark mode
  • Tested in light mode
  • Approve from product

refs: MBL-18069
affects: Student
release note: PDF annotations is preserved even when cache is reset

test plan: See PR description
@inst-danger
Copy link
Contributor

inst-danger commented Nov 11, 2024

Student Build QR Code:

@inst-danger
Copy link
Contributor

inst-danger commented Nov 11, 2024

Warnings
⚠️ One or more files are below the minimum test coverage 50%

Release Note:

PDF annotations is preserved even when cache is reset

Affected Apps: Student

MBL-18069

Coverage New % Master % Delta
Canvas iOS 91.43% 91.43% -0%
Core/Core/Assignments/AssignmentList/ViewModel/AssignmentListViewModel.swift 47.8% 47.8% 0%

Generated by 🚫 dangerJS against ba30d73

@suhaibabsi-inst suhaibabsi-inst marked this pull request as ready for review November 13, 2024 08:55
ndrsszsz
ndrsszsz previously approved these changes Nov 14, 2024
Copy link
Contributor

@ndrsszsz ndrsszsz left a comment

Choose a reason for hiding this comment

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

QA +1
Tested on iPhone 11, iOS 18.1

guard let folderUrl = urls.first(where: { $0.hasDirectoryPath && $0.lastPathComponent == uniqueID })
else { return }

print("Moving previously-saved documents folder for session (\(uniqueID)) ..")
Copy link
Contributor

Choose a reason for hiding this comment

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

A print is left here

try? fileManager
.contentsOfDirectory(at: folderUrl, includingPropertiesForKeys: nil)
.forEach({ content in
try fileManager.moveItem(at: content, to: dest.appending(component: content.lastPathComponent))
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's add a filter here because at the moment this will move the Offline folder as well which we don't want for multiple reasons. I think a filter that moves only folders that contain only numbers (the file id) would be enough.

}

} catch {
Logger.shared.error("Failure moving previously saved PDFs to AnnotatedPDFs folder: \(error.localizedDescription)")
Copy link
Contributor

Choose a reason for hiding this comment

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

We could utilize the new RemoteLogger to get feedback on this error from real users.

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.

5 participants