Skip to content

Commit c3e76a9

Browse files
committed
Add support for multiple open items
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
1 parent 2344d3f commit c3e76a9

22 files changed

+797
-140
lines changed

Zotero.xcodeproj/project.pbxproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
61C817F22A49B5D30085B1E6 /* CollectionResponseSpec.swift in Sources */ = {isa = PBXBuildFile; fileRef = B3B1EDEE250242E700D8BC1E /* CollectionResponseSpec.swift */; };
3535
61FA14CE2B05081D00E7D423 /* TextConverter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 61FA14CD2B05081D00E7D423 /* TextConverter.swift */; };
3636
61FA14D02B08E24A00E7D423 /* ColorPickerStackView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 61FA14CF2B08E24A00E7D423 /* ColorPickerStackView.swift */; };
37+
61E24DCC2ABB385E00D75F50 /* OpenItemsController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 61E24DCB2ABB385E00D75F50 /* OpenItemsController.swift */; };
3738
B300B33324291C8D00C1FE1E /* RTranslatorMetadata.swift in Sources */ = {isa = PBXBuildFile; fileRef = B300B33224291C8D00C1FE1E /* RTranslatorMetadata.swift */; };
3839
B300B3352429222B00C1FE1E /* TranslatorMetadata.swift in Sources */ = {isa = PBXBuildFile; fileRef = B300B3342429222B00C1FE1E /* TranslatorMetadata.swift */; };
3940
B300B3362429234C00C1FE1E /* TranslatorMetadata.swift in Sources */ = {isa = PBXBuildFile; fileRef = B300B3342429222B00C1FE1E /* TranslatorMetadata.swift */; };
@@ -1240,6 +1241,7 @@
12401241
61BD13942A5831EF008A0704 /* TextKit1TextView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TextKit1TextView.swift; sourceTree = "<group>"; };
12411242
61FA14CD2B05081D00E7D423 /* TextConverter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TextConverter.swift; sourceTree = "<group>"; };
12421243
61FA14CF2B08E24A00E7D423 /* ColorPickerStackView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ColorPickerStackView.swift; sourceTree = "<group>"; };
1244+
61E24DCB2ABB385E00D75F50 /* OpenItemsController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OpenItemsController.swift; sourceTree = "<group>"; };
12431245
B300B33224291C8D00C1FE1E /* RTranslatorMetadata.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RTranslatorMetadata.swift; sourceTree = "<group>"; };
12441246
B300B3342429222B00C1FE1E /* TranslatorMetadata.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TranslatorMetadata.swift; sourceTree = "<group>"; };
12451247
B300B3372429254900C1FE1E /* SyncTranslatorsDbRequest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SyncTranslatorsDbRequest.swift; sourceTree = "<group>"; };
@@ -2246,6 +2248,7 @@
22462248
B305646C23FC051E003304F2 /* ObjectUserChangeObserver.swift */,
22472249
B34A9F6325BF1ABB007C9A4A /* PDFDocumentExporter.swift */,
22482250
B32B8A562B18A08900A9A741 /* PDFThumbnailController.swift */,
2251+
61E24DCB2ABB385E00D75F50 /* OpenItemsController.swift */,
22492252
B3C6D551261C9F2E0068B9FE /* PlaceholderTextViewDelegate.swift */,
22502253
B378F4CC242CD45700B88A05 /* RepoParserDelegate.swift */,
22512254
B305646A23FC051E003304F2 /* RItemLocaleController.swift */,
@@ -4943,6 +4946,7 @@
49434946
B36181EC24C96B0500B30D56 /* SearchableCollection.swift in Sources */,
49444947
B3830CDB255451AB00910FE0 /* TagPickerAction.swift in Sources */,
49454948
B3593F40241A61C700760E20 /* ItemCell.swift in Sources */,
4949+
61E24DCC2ABB385E00D75F50 /* OpenItemsController.swift in Sources */,
49464950
B305679023FC1D9B003304F2 /* CollectionDifference+Separated.swift in Sources */,
49474951
B3F6AA3A2AB30663005BC22E /* AnnotationTool.swift in Sources */,
49484952
B34ACC7A2514EAAB00040C17 /* AnnotationColorGenerator.swift in Sources */,

Zotero/Assets/en.lproj/Localizable.strings

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,7 @@
142142
"items.generating_bib" = "Generating Bibliography";
143143
"items.creator_summary.and" = "%@ and %@";
144144
"items.creator_summary.etal" = "%@ et al.";
145+
"items.restore_open" = "Restore Open Items";
145146

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

@@ -541,3 +542,4 @@
541542
"accessibility.pdf.undo" = "Undo";
542543
"accessibility.pdf.toggle_annotation_toolbar" = "Toggle annotation toolbar";
543544
"accessibility.pdf.show_more_tools" = "Show more";
545+
"accessibility.pdf.open_items" = "Open Items";

Zotero/Controllers/Controllers.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -310,6 +310,7 @@ final class UserControllers {
310310
let citationController: CitationController
311311
let webDavController: WebDavController
312312
let customUrlController: CustomURLController
313+
let openItemsController: OpenItemsController
313314
private let isFirstLaunch: Bool
314315
private let lastBuildNumber: Int?
315316
private unowned let translatorsAndStylesController: TranslatorsAndStylesController
@@ -386,6 +387,7 @@ final class UserControllers {
386387
self.translatorsAndStylesController = controllers.translatorsAndStylesController
387388
self.idleTimerController = controllers.idleTimerController
388389
self.customUrlController = CustomURLController(dbStorage: dbStorage, fileStorage: controllers.fileStorage)
390+
openItemsController = OpenItemsController(dbStorage: dbStorage, fileStorage: controllers.fileStorage)
389391
self.lastBuildNumber = controllers.lastBuildNumber
390392
self.disposeBag = DisposeBag()
391393
}

Zotero/Controllers/Database/Requests/ReadItemsDbRequest.swift

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,3 +86,15 @@ struct ReadItemsWithKeysDbRequest: DbResponseRequest {
8686
return database.objects(RItem.self).filter(.keys(self.keys, in: self.libraryId))
8787
}
8888
}
89+
90+
struct ReadItemsWithKeysFromMultipleLibrariesDbRequest: DbResponseRequest {
91+
typealias Response = Results<RItem>
92+
93+
let keysByLibraryIdentifier: [LibraryIdentifier: Set<String>]
94+
95+
var needsWrite: Bool { return false }
96+
97+
func process(in database: Realm) throws -> Results<RItem> {
98+
database.objects(RItem.self).filter(.keysByLibraryIdentifier(keysByLibraryIdentifier))
99+
}
100+
}

0 commit comments

Comments
 (0)