-
Notifications
You must be signed in to change notification settings - Fork 111
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
base: master
Are you sure you want to change the base?
Conversation
refs: MBL-18069 affects: Student release note: PDF annotations is preserved even when cache is reset test plan: See PR description
Release Note:PDF annotations is preserved even when cache is reset Affected Apps: Student
|
@@ -35,7 +35,7 @@ extension LocalFileURLCreator { | |||
if mimeClass == "pdf" { | |||
// If the user already downloaded and modified the file locally, we don't want to download it again. | |||
// Instead, return the url pointing to the locally modified version. | |||
let docsURL = URL.Directories.documents.appendingPathComponent(fileName) | |||
let docsURL = URL.Directories.annotatedPDFs.appendingPathComponent(fileName) |
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.
Modifying the load url like this will break access to already existing annotated files in the documents directory when the user updates the app to this version. Let's check for the annotated file on the original url as well OR create a job that moves all annotated pdfs to their new directory.
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.
Oh, yes. That's correct!
Almost forgot about that.
Sure, will work on that.
@@ -72,6 +72,7 @@ open class AppEnvironment { | |||
OfflineModeAssembly.make() | |||
api = API(session) | |||
currentSession = session | |||
currentSession?.migrateSavedAnnotatedPDFs() |
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 chose to call this here, and do it per session so to be targeting those folders relevant to this specific feature & session. Thus we do it lazily if there are multiple sessions.
There was an attempt to do it on app launch for all sessions at once, but there was a difficulty fetching all sessions that have files saved to Documents
directory. Not all of them get persisted to Keychain as I was expecting.
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.
QA +1
Tested on iPhone 11, iOS 18.1
Core/Core/Login/LoginSession.swift
Outdated
guard let folderUrl = urls.first(where: { $0.hasDirectoryPath && $0.lastPathComponent == uniqueID }) | ||
else { return } | ||
|
||
print("Moving previously-saved documents folder for session (\(uniqueID)) ..") |
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.
A print
is left here
refs: MBL-18069
affects: Student
release note: PDF annotations is preserved even when cache is reset
Test Plan
Video Record
Recording covering PDF annotation persistence scenarios, which are:
pdf_annotations_saving.mov
Checklist