Skip to content

Support multiple open items#829

Open
mvasilak wants to merge 76 commits intozotero:2.0from
mvasilak:new-multiple-open-items
Open

Support multiple open items#829
mvasilak wants to merge 76 commits intozotero:2.0from
mvasilak:new-multiple-open-items

Conversation

@mvasilak
Copy link
Contributor

@mvasilak mvasilak commented Jan 3, 2024

Adds support for multiple open items.

  • Keep track of open items in order of most recently opened
  • Show in items navigation bar button that restores last item and shows count of currently open items
  • Save/restore state of open items
  • Add support for PDF items
  • Add support for note items
  • Show in presented item navigation bar button menu that allows to quickly switch to another open item
  • Allow user to change order of presented open items (only move first & last currently)

In consideration

  • Support separate open items for multiple windows
  • Opening an already opened item in another window, should switch to that

Previously discussed in #782

@mvasilak mvasilak marked this pull request as draft January 3, 2024 12:42
@mvasilak mvasilak self-assigned this Jan 3, 2024
@mvasilak mvasilak force-pushed the new-multiple-open-items branch 2 times, most recently from cec3c1b to fcaffcf Compare January 16, 2024 09:28
@mvasilak mvasilak force-pushed the new-multiple-open-items branch 2 times, most recently from 33ad637 to b384d53 Compare February 22, 2024 10:21
@mvasilak mvasilak force-pushed the new-multiple-open-items branch 2 times, most recently from 1edc31b to 01da13a Compare February 26, 2024 13:55
@mvasilak mvasilak force-pushed the new-multiple-open-items branch from 01da13a to ec5a5b2 Compare March 11, 2024 15:17
@mvasilak mvasilak force-pushed the new-multiple-open-items branch 3 times, most recently from e918514 to 21deedc Compare April 15, 2024 11:02
@mvasilak mvasilak marked this pull request as ready for review April 18, 2024 12:57
@mvasilak mvasilak changed the title WIP Support multiple open items Support multiple open items Apr 18, 2024
@mvasilak
Copy link
Contributor Author

mvasilak commented Apr 18, 2024

@michalrentka @dstillman
this PR is ready for some more eyes and perhaps beta testing. It has the underlying facility to support:

  • multiple open items
  • switching between open items
  • opening new items
  • closing existing items
  • moving open items to another position (user index)
  • keeping track of last opened date for each item
  • opening an item in its corresponding window/scene if it's already open

It currently supports PDF documents and notes, and should be straight-forward to add support for e.g. web snapshots and ePubs.

UI-wise, it includes a bare minimum implementation using simple UIMenus, with these features:

  • In the items screen, a bar button appears with a number indicating the number of open items.
Screenshot 2024-04-18 at 16 10 00
  • Tapping the button, will open the last opened item.
  • Tapping and holding will show a menu that allows opening specific item, or closing all open items.
Screenshot 2024-04-18 at 16 13 57
  • Similar bar button appears in the PDF document/note screen.
Screenshot 2024-04-18 at 16 15 22 Screenshot 2024-04-18 at 16 16 01
  • Tapping the button will always show a menu. It contains all the open items as before, but also adds a sub-menu for the current item. Said sub-menu allows to close current item, move to start (if not already), move to end (if not already), close other items (if other items are open).
Screenshot 2024-04-18 at 16 18 24

Next (possible) steps (in separate PRs) are (a) an actual tab bar and (b) instead of using UIMenus create a custom view that allows e.g. closing any item and re-ordering.

Feedback regarding icons and copy used will be much appreciated.

@mvasilak mvasilak requested a review from michalrentka April 18, 2024 13:28
Copy link
Contributor

@michalrentka michalrentka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code-wise there are just some minor mostly style-related adjustments. After TO-DOs are resolved this looks good. I'll spend some more time testing this on device, but to me it looks good for at least internal user testing.

@michalrentka
Copy link
Contributor

Some bugs and smaller issues I caught:

  1. On iPhone, the square bar button item for tabs seems to have a lot of space around it
    bar button
  2. When I open multiple PDFs, then I scroll to some page on one, switch to another one and switch back to the original one, the original one is not on the page I scrolled to, but on page that it was when I opened it

@mvasilak mvasilak force-pushed the new-multiple-open-items branch from 0d7bd0d to 0ea653e Compare April 25, 2024 06:29
@mvasilak
Copy link
Contributor Author

@michalrentka

1. On iPhone, the square bar button item for tabs seems to have a lot of space around it

It's the standard spacing for bar button items created with an image, it just seems like that because is next to another such button. We can use a custom view button instead, to decrease the image insets. Maybe we should consider using UIBarButtonItemGroup to group related buttons when there are space constraints.
Screenshot 2024-04-25 at 16 37 42

2. When I open multiple PDFs, then I scroll to some page on one, switch to another one and switch back to the original one, the original one is not on the page I scrolled to, but on page that it was when I opened it

Good catch, fixed in 33b5f63

@mvasilak mvasilak requested a review from michalrentka April 25, 2024 14:07
@mvasilak mvasilak force-pushed the new-multiple-open-items branch from 22c148b to 3a1f3b2 Compare April 30, 2024 06:50
@michalrentka
Copy link
Contributor

Looks good to me now, I didn't find new bugs yet. We should probably make an internal build for others to test or push it to beta. There are a ton of changes, so we should definitely test this thoroughly. @dstillman can decide.

@mvasilak mvasilak force-pushed the new-multiple-open-items branch from 3a1f3b2 to 9a0d97b Compare May 8, 2024 08:06
@mvasilak
Copy link
Contributor Author

mvasilak commented May 8, 2024

@michalrentka rebased to master, to include the activity/scene title logic, and made some relevant improvements for the note editor.

@mvasilak mvasilak force-pushed the new-multiple-open-items branch from 0320358 to 6f32108 Compare May 16, 2024 08:06
@mvasilak mvasilak force-pushed the new-multiple-open-items branch from 6f32108 to 2925038 Compare June 3, 2024 07:40
@mvasilak mvasilak force-pushed the new-multiple-open-items branch from 55759a0 to a000386 Compare January 20, 2026 13:45
* Fix potential TagFilterActionHandler crash during logout

* Fix RemoteAttachmentDownloader memory leak

* Fix IdentifierLookupController memory leak

* Normalize http arxiv URLs when in looking up via identifier

* Remove unnecessary comment

* Improve IdentifierLookupController URL normalization
@mvasilak mvasilak force-pushed the new-multiple-open-items branch from a000386 to caec9b5 Compare February 18, 2026 12:35
* Fix sync error show item logic

* Ignore deleted attachments when reading them for upload

* Add tests for ignoring deleted attachments when reading them for upload
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
Improve DetailCoordinator presented item replacement for multiple items
Set user activity when new note is actually created
Show actions submenu for current item
Improve ItemsViewController right bar button items
Add icons item type icons to open items menu
Add close all action to open items menu
Simplify NoteEditorViewController open items button creation
Add PDFReaderViewController open items observer
Add close other items action to submenu for current item
Add getSessionIdentifier convenience property to UIViewController
Save user activity when open items change w/o current item change
Open items in their respective scene, if already open
Update copy
Improve NSUserActivity extension
Simplify DetailCoordinator
Improve open items bar button image creation
Improve open items bar button creation
Properly close PDF Reader when switching current open item
Properly close Note Editor when switching current open item
Improve note editor save callback for new notes
Improve note editor activity title update
Improve NoteEditorActionHandler
Refactor PDFReaderState
Improve PDFReaderActionHandler
Pass note title when showing note editor
Clarify NoteEditorState parameter names
Make OpenItemsController restoration methods asynchronous
In OpenItemsController download remote or local changed remotely PDFs
Use feature gate for multiple open items
Fix opening URLs with multiple open items
Refactor open items controller load presentation methods
Refactor custom URL controller
Open item from note editor link with multiple items support
Enable multiple open items feature gate
@mvasilak mvasilak force-pushed the new-multiple-open-items branch from caec9b5 to 1367bfb Compare February 20, 2026 19:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants