-
Notifications
You must be signed in to change notification settings - Fork 33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Handle lookup item & attachment creation in IdentifierLookupController #707
Handle lookup item & attachment creation in IdentifierLookupController #707
Conversation
b22f4c5
to
eaeb31a
Compare
Code-wise it's fine, it moved existing functionality to background so that things can finish even if the UI is closed.
@mvasilak I think that
@dstillman a little explanation and question: currently translation happens, item(s) are created for the main (parent) items, then files are downloaded and if individual downloads succeed then their attachment items are created. Which means if you're on slow internet you'll first see parent item(s) without attachments and only when those files are downloaded attachments start showing up. As @mvasilak hinted, would it be better to create all items immediately and then start all downloads (and show their progress the same way as if downloading them from our server)? This approach would be more complicated just because you'd have to handle interruptions and retry downloads (if users just close the app, downloads are interrupted and will have to be restarted after the app starts again). Also if people don't really download that many big papers at once, you most likely won't even notice the difference, because smaller papers are downloaded quickly and they just show up after few seconds. So I'm not sure whether it's worth it. |
Is the question about showing pending downloads in the lookup progress dialog or in the items list itself? For the former, we know immediately from the translator whether there's an attachment, and we know the name to use. That's how we show the attachment line right away in the Zotero Connector save popup (and maybe the share extension?). So at least for that, we can show attachment progress without creating the attachment item first. Maybe we're already doing that? If the question is about the items list, and we're talking about switching to a Close button once items are created but before downloads are done, could we hook into the lookup controller for the items list progress indicator, and also queue an 'open' action so that it opens the file once it exists? Seems very complicated, but I don't think we want to create an attachment item first, because that seems very likely to lead to attachment items with missing files, attachment items being synced before files are available, etc. For a simpler option, could we just add an indicator/button somewhere that would reopen the lookup dialog to show progress? We do something similar for multi-item PDF metadata retrieval in the desktop app. |
The former is already implemented, it was the latter. I agree it's probably unnecessarily overcomplicated and we can create attachments only after they download and just ignore them if they don't.
That's a good idea. We could have a progress bar on bottom, same as when we're downloading multiple files (screenshot below) with a button to re-open the lookup popup. That way you'd know you're currently downloading and can view state as well. It could say "Lookup x/y" with progress bar below and "Open" to the right. |
👍 |
"Lookup" is an internal term for the feature. Can it not just say "Downloaded x/y"? |
Sure, I thought we might want to distinguish attachment downloads from lookup downloads. But I guess we can even combine them if both are in progress then. |
eaeb31a
to
db49f50
Compare
@dstillman there's one more usability issue probably. When you add multiple identifiers, downloads are now in background, but translation happens sequentially. Translation could be moved to background too (by moving the underlying webview to parent controller). Do we want to do that? Or is it fine like this? |
What would the usability issue be? That translation stops if you close the app? |
Currently yes. The popup says "Cancel" while translations are in progress, so when you close the popup currently running translations are stopped. Started downloads finish in background. |
That seems fine. |
For me personally those translations took longer than file downloads, so I can't really close the window and see background downloads as we initially intended. This will only be visible for bigger file downloads. I guess that's not a problem. But if you add a lot of identifiers you'll have to wait for all of them to translate which can take some time. But it's still faster than adding them 1 by 1 through share extension. |
Ah, I see. So the question is if we want to change it to process them in the background with a Close button instead of (or in addition to) Cancel? And we added something to reopen the progress dialog, right? Does that button stick around after completion so you can view results? |
I guess we could add cancel to individual translations instead of general cancel and we'd keep |
The re-opening is still in development (PR is still WIP), but that is the goal. We can modify the items toolbar to say both |
Why? Because some network request might be hanging? Maybe we want that, but seems weird not to also give the option to cancel the whole process if we have any cancel options.
"Saved z/w" |
@mvasilak got it. Some other issues:
|
I thought cancel would make sense when the translation finishes and you see the resulted item is not what you wanted. But we can add cancel (all) and individual cancels or just cancel option. |
@michalrentka I'd noticed that as well. Probably needs an initial event w/ 0 progress, similar to what |
The latter could be useful, but it should probably be an (x) delete button. And I guess that'd be fine for cancelling while in progress too. |
New specs, from the discussion, please verify:
A few things not commented already:
|
db49f50
to
452678f
Compare
@michalrentka regarding the sole download not appearing, it also happens for normal downloads of attachments, due to this guard
What is the reasoning behind this? |
Yeah it made sense when it was used just for downloads. When you tap a single attachment which needs to download, you already see the download progress in the icon, so I ignored it. I guess just remove the |
b4e0be0
to
153856b
Compare
Add Cancel All button to lookup window that cancels pending items/attachments and trashes already stored items/attachments Fix bug in RemoteAttachmentDownloader
Make access to batch data & current lookup data synchronous
Improve ItemsToolbarController progress view update when switching collections
Simplify observation of IdentifierLookupController by LookupActionHandler
Ignore adding identifiers that have ongoing lookup Cleanup web views when all current lookups finish Dismiss lookup controller after canceling all lookups
e5e0291
to
a79a6f0
Compare
closes #683
Moves item & attachment creation from identifier lookup to a separate user controller, that is guarranted to fulfill ongoing lookups, if lookup window is closed.
With this change, perhaps we should label the button as
Close
, instead ofCancel
. Furthermore, the items added for this identifier, perhaps should indicate that they might have pending downloads.--
TODO:
Downloaded x/y
.Saved x/y
.Cancel all
button in lookup window, that will cancel all downloads and trash items/attachments already fetched.Cancel
button in lookup window toClose
, that dismisses window and continues lookup in the background.