Skip to content

Commit

Permalink
Refactor PDFReaderState
Browse files Browse the repository at this point in the history
  • Loading branch information
mvasilak committed Jul 29, 2024
1 parent 29eefad commit 9f2852f
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 textFont: UIFont
let commentFont: UIFont
Expand Down Expand Up @@ -133,7 +133,7 @@ struct PDFReaderState: ViewModelState {
url: URL,
key: String,
parentKey: String?,
activityTitle: String?,
title: String?,
libraryId: LibraryIdentifier,
initialPage: Int?,
preselectedAnnotationKey: String?,
Expand All @@ -148,7 +148,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.textFont = PDFReaderLayout.annotationLayout.font
self.commentFont = PDFReaderLayout.annotationLayout.font
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 @@ -123,7 +123,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 @@ -233,7 +233,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 9f2852f

Please sign in to comment.