Skip to content

Commit

Permalink
Refactor PDFReaderState
Browse files Browse the repository at this point in the history
  • Loading branch information
mvasilak committed Jul 1, 2024
1 parent 16ffe81 commit 7d692d9
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions Zotero/Scenes/Detail/PDF/Models/PDFReaderState.swift
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ struct PDFReaderState: ViewModelState {
let key: String
let parentKey: String?
let document: PSPDFKit.Document
let activityTitle: String?
let title: String?
let previewCache: NSCache<NSString, UIImage>
let commentFont: UIFont
let userId: Int
Expand Down Expand Up @@ -131,7 +131,7 @@ struct PDFReaderState: ViewModelState {
url: URL,
key: String,
parentKey: String?,
activityTitle: String?,
title: String?,
libraryId: LibraryIdentifier,
initialPage: Int?,
preselectedAnnotationKey: String?,
Expand All @@ -146,7 +146,7 @@ struct PDFReaderState: ViewModelState {
self.parentKey = parentKey
self.document = Document(url: url)
document.overrideClass(PSPDFKit.AnnotationManager.self, with: AnnotationManager.self)
self.activityTitle = activityTitle
self.title = title
self.previewCache = NSCache()
self.commentFont = PDFReaderLayout.annotationLayout.font
self.userId = userId
Expand Down
2 changes: 1 addition & 1 deletion Zotero/Scenes/Detail/PDF/PDFCoordinator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ final class PDFCoordinator: Coordinator {
url: self.url,
key: self.key,
parentKey: self.parentKey,
activityTitle: try? controllers.userControllers?.dbStorage.perform(request: ReadFilenameDbRequest(libraryId: libraryId, key: key), on: .main),
title: try? controllers.userControllers?.dbStorage.perform(request: ReadFilenameDbRequest(libraryId: libraryId, key: key), on: .main),
libraryId: self.libraryId,
initialPage: self.page,
preselectedAnnotationKey: self.preselectedAnnotationKey,
Expand Down
4 changes: 2 additions & 2 deletions Zotero/Scenes/Detail/PDF/Views/PDFReaderViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ class PDFReaderViewController: UIViewController {
if changedCurrentItem {
close(dismiss: false)
} else if openItemsChanged {
openItemsController.setOpenItemsUserActivity(from: self, libraryId: viewModel.state.library.identifier, title: viewModel.state.activityTitle)
openItemsController.setOpenItemsUserActivity(from: self, libraryId: viewModel.state.library.identifier, title: viewModel.state.title)
}
}
)
Expand Down Expand Up @@ -231,7 +231,7 @@ class PDFReaderViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()

openItemsController.setOpenItemsUserActivity(from: self, libraryId: viewModel.state.library.identifier, title: viewModel.state.activityTitle)
openItemsController.setOpenItemsUserActivity(from: self, libraryId: viewModel.state.library.identifier, title: viewModel.state.title)
view.backgroundColor = .systemGray6
// Create intraDocumentNavigationHandler before setting up views, as it may be called by a child view controller, before view has finished loading.
intraDocumentNavigationHandler = IntraDocumentNavigationButtonsHandler(
Expand Down

0 comments on commit 7d692d9

Please sign in to comment.