Skip to content

Commit

Permalink
Add support for multiple open items
Browse files Browse the repository at this point in the history
Improve AppCoordinator code
Keep track of open items count in items navigation bar
Add ability to restore most recently opened item
Implement state restoration for open items
Allow switch to another open item via bar button menu
Use instant presenter to switch between open items
Maintain user order of open items
Add support for notes in open items
Validate open items when set on app launch
Observe open items for deletions
Add support for different open items per session
  • Loading branch information
mvasilak committed Feb 26, 2024
1 parent a2e0fd6 commit 8f7d999
Show file tree
Hide file tree
Showing 22 changed files with 797 additions and 140 deletions.
4 changes: 4 additions & 0 deletions Zotero.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
61ABA7512A6137D1002A4219 /* ShareableImage.swift in Sources */ = {isa = PBXBuildFile; fileRef = 61ABA7502A6137D1002A4219 /* ShareableImage.swift */; };
61BD13952A5831EF008A0704 /* TextKit1TextView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 61BD13942A5831EF008A0704 /* TextKit1TextView.swift */; };
61C817F22A49B5D30085B1E6 /* CollectionResponseSpec.swift in Sources */ = {isa = PBXBuildFile; fileRef = B3B1EDEE250242E700D8BC1E /* CollectionResponseSpec.swift */; };
61E24DCC2ABB385E00D75F50 /* OpenItemsController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 61E24DCB2ABB385E00D75F50 /* OpenItemsController.swift */; };
61FA14CE2B05081D00E7D423 /* TextConverter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 61FA14CD2B05081D00E7D423 /* TextConverter.swift */; };
61FA14D02B08E24A00E7D423 /* ColorPickerStackView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 61FA14CF2B08E24A00E7D423 /* ColorPickerStackView.swift */; };
B300B33324291C8D00C1FE1E /* RTranslatorMetadata.swift in Sources */ = {isa = PBXBuildFile; fileRef = B300B33224291C8D00C1FE1E /* RTranslatorMetadata.swift */; };
Expand Down Expand Up @@ -1238,6 +1239,7 @@
618404252A4456A9005AAF22 /* IdentifierLookupController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = IdentifierLookupController.swift; sourceTree = "<group>"; };
61ABA7502A6137D1002A4219 /* ShareableImage.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ShareableImage.swift; sourceTree = "<group>"; };
61BD13942A5831EF008A0704 /* TextKit1TextView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TextKit1TextView.swift; sourceTree = "<group>"; };
61E24DCB2ABB385E00D75F50 /* OpenItemsController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OpenItemsController.swift; sourceTree = "<group>"; };
61FA14CD2B05081D00E7D423 /* TextConverter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TextConverter.swift; sourceTree = "<group>"; };
61FA14CF2B08E24A00E7D423 /* ColorPickerStackView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ColorPickerStackView.swift; sourceTree = "<group>"; };
B300B33224291C8D00C1FE1E /* RTranslatorMetadata.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RTranslatorMetadata.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -2246,6 +2248,7 @@
B305646C23FC051E003304F2 /* ObjectUserChangeObserver.swift */,
B34A9F6325BF1ABB007C9A4A /* PDFDocumentExporter.swift */,
B32B8A562B18A08900A9A741 /* PDFThumbnailController.swift */,
61E24DCB2ABB385E00D75F50 /* OpenItemsController.swift */,
B3C6D551261C9F2E0068B9FE /* PlaceholderTextViewDelegate.swift */,
B378F4CC242CD45700B88A05 /* RepoParserDelegate.swift */,
B305646A23FC051E003304F2 /* RItemLocaleController.swift */,
Expand Down Expand Up @@ -4943,6 +4946,7 @@
B36181EC24C96B0500B30D56 /* SearchableCollection.swift in Sources */,
B3830CDB255451AB00910FE0 /* TagPickerAction.swift in Sources */,
B3593F40241A61C700760E20 /* ItemCell.swift in Sources */,
61E24DCC2ABB385E00D75F50 /* OpenItemsController.swift in Sources */,
B305679023FC1D9B003304F2 /* CollectionDifference+Separated.swift in Sources */,
B3F6AA3A2AB30663005BC22E /* AnnotationTool.swift in Sources */,
B34ACC7A2514EAAB00040C17 /* AnnotationColorGenerator.swift in Sources */,
Expand Down
2 changes: 2 additions & 0 deletions Zotero/Assets/en.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@
"items.generating_bib" = "Generating Bibliography";
"items.creator_summary.and" = "%@ and %@";
"items.creator_summary.etal" = "%@ et al.";
"items.restore_open" = "Restore Open Items";

"lookup.title" = "Enter ISBNs, DOls, PMIDs, arXiv IDs, or ADS Bibcodes to add to your library:";

Expand Down Expand Up @@ -541,3 +542,4 @@
"accessibility.pdf.undo" = "Undo";
"accessibility.pdf.toggle_annotation_toolbar" = "Toggle annotation toolbar";
"accessibility.pdf.show_more_tools" = "Show more";
"accessibility.pdf.open_items" = "Open Items";
2 changes: 2 additions & 0 deletions Zotero/Controllers/Controllers.swift
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,7 @@ final class UserControllers {
let citationController: CitationController
let webDavController: WebDavController
let customUrlController: CustomURLController
let openItemsController: OpenItemsController
private let isFirstLaunch: Bool
private let lastBuildNumber: Int?
private unowned let translatorsAndStylesController: TranslatorsAndStylesController
Expand Down Expand Up @@ -386,6 +387,7 @@ final class UserControllers {
self.translatorsAndStylesController = controllers.translatorsAndStylesController
self.idleTimerController = controllers.idleTimerController
self.customUrlController = CustomURLController(dbStorage: dbStorage, fileStorage: controllers.fileStorage)
openItemsController = OpenItemsController(dbStorage: dbStorage, fileStorage: controllers.fileStorage)
self.lastBuildNumber = controllers.lastBuildNumber
self.disposeBag = DisposeBag()
}
Expand Down
12 changes: 12 additions & 0 deletions Zotero/Controllers/Database/Requests/ReadItemsDbRequest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -86,3 +86,15 @@ struct ReadItemsWithKeysDbRequest: DbResponseRequest {
return database.objects(RItem.self).filter(.keys(self.keys, in: self.libraryId))
}
}

struct ReadItemsWithKeysFromMultipleLibrariesDbRequest: DbResponseRequest {
typealias Response = Results<RItem>

let keysByLibraryIdentifier: [LibraryIdentifier: Set<String>]

var needsWrite: Bool { return false }

func process(in database: Realm) throws -> Results<RItem> {
database.objects(RItem.self).filter(.keysByLibraryIdentifier(keysByLibraryIdentifier))
}
}
Loading

0 comments on commit 8f7d999

Please sign in to comment.