-
-
Notifications
You must be signed in to change notification settings - Fork 166
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
Refactor QR code reader #3762
Refactor QR code reader #3762
Conversation
Hello there. I see you are trying to add this with WASM. Isn't it better to use native? It has better performance for sure. Not that it really matters since QR code scanning is not compute intensive nor the user would scan 100 codes a day. Just asking. |
Good question! It would totally make sense to do that at one point. I think for now the low hanging fruit is to fix these bugs which would already be a large improvement and just being able to pull this library in is less work than looking into integration into the core. The call to quircs (via Wasm) is roughly 2 lines of code, replacing this with a future RPC etc. call would not be a biggie, so I definitely think there's a path of using a fully native version in the future. |
Could make sense to make a hybrid solution of also still using
Whatever we do we should not use the library that we use on android, as that has detection problems sometimes (see https://support.delta.chat/t/error-qr-code-could-not-be-decoded/2923 and deltachat/deltachat-core-rust#5256). Also we thought about integrating |
Thank you for these insights @Simon-Laux! What was the reasoning to not use |
dc android uses Better ask some android people if that is still a problem and about their experience with |
Ah, interesting. This must have been at the point where you've forked it because in upstream it also uses The QR library doesn't seem to be the main issue of this refactoring, I'll keep that in the background and maybe just use what we have already in case that's just fine. |
86cde6e
to
725d89e
Compare
I've integrated |
I've introduced an Camera and Facing selector to some sort of "Settings" menu which floats over the video image. How do you feel about adding the functionality for "Paste from Clipboard" and "Upload image" somewhere there as well, either in the same menu or in separate buttons? This is currently how it looks like (not happy with it): How about we have two buttons, one "Camera" icon for selecting Camera and Facing, one "Upload" icon for pasting from clipboard and uploading an image? Or even three separate buttons, one for settings, and then one for clipboard and one for uploading an image? Pinging @Simon-Laux and @r10s |
I imagined it as a rounded square button in the top left corner with white background (in darkmode maybe different bg). why 3 menu items instead of 4? because I believe we can combine facing mode and cameras to make the interface simpler to understand. |
f7f40f9
to
4a0a2cb
Compare
I don't completely agree with the "advanced" term here yet, the invite links work most of the time on mobile directly, but on desktop the situation is not as good yet, see #3657.
not fitting if someone only has one camera and/or is looking for the other options. |
but even then: the browser opens and you tap "Open Chat" with the to be clear: maybe the term i've chosen is confusing. i meant, that for most users, switching camera is probably needed more often than the other options. and therefore, make them first, and not hidden in a submenu. i do not suggest to hide or remove paste/load further for the icon: maybe just stay with the cogwheel then, just make it a bit larger |
I wouldn't trust it too much there are many platforms (I recently fixed sth about file/url association in the flatpak package for example) and there are also different browsers like people using the tor browser which on purpose does not integrate with the system.
I think it is the opposite, I do think it's not that often that you are a Mac user with connected iPhone, a live-streamed with multiple connected cameras or a linux phone user that managed to install dc desktop on their phone. Though I still agree with your conclusion that it would be nice to not have an extra menu for the camera |
d1298af
to
6824dbd
Compare
bc19415
to
d543cb8
Compare
thanks for sharing thoughts, very interesting! tbh, when we discussed the menu ordering, i did not expect that this raises a discussion :) so: note, that the now recommended workflow is scanning QR codes and sharing invite links. the camera options belong to the recommended workflow. despite tor or broken systems, it is unquestionable also on desktop that load/paste, as supported fallback, plays less a role with the new invite links. ordering recommending workflow options first makes sense even if we assume for a moment, that there are more ppl using tor or have a broken system than ppl having two webcams 1 honestly, these are all weak arguments, but they sum up. and at the end, one has to make a decision to move forward :) if the decision is wrong, we can correct that easily. again: we're discussing ordering of 3 options, not functionality as such
good point, i agree Footnotes
|
I think this is ready for review now, some testing with different devices / cameras etc. would be appreciated! Thank you 💖 Happy to also work further on the design if there's any ideas. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
very nice! also the new, direct camera selection
i leave code review to the experts, functionality-wise, i can say it works nicely on my mac.
for the UI, some minors, not blocking or so:
- if possible, add a separator line after the camera selection. in general, it is best-practise to group radio items in menus that way
- maybe sort "Load QR code as image" very last - these images are not very well supported on the platforms - where "Paste" has a direct pendent already on desktop
- also, the menu flows out of screen when close to the edge - this would not happen easily when using a a left-hand corner, which is maybe is nicer in general
and when on that: "Hold your camera over the QR code." is often not practical on desktop - when on that, we could add a more fitting string à la "Move the QR code to the camera" - if you agree, i can do a PR on android to get the string in
our context menu implementation does not support seperators nor radio buttons yet, so we would have to add the functionality there first:
I don't care much about the ordering. Though I believe the last and first menu options are the easiest to click quickly, but that will not matter once there is a separator line both items will again be similarly easy to click.
I still favour the top left corner. maybe with a background to look like a real button.
+1 |
k, if there is no separator possible currently, then it's that. as said, no blocker or so :)
agree. i was referring to "radio buttons" only for functionality, not for design |
b8b74e9
to
63fcfb0
Compare
i think, the camera is not freed when closing the scanning dialog by tapping outside; this was not the case before (on mac, open camera is very visible by led and an icon in the menu bar) (i am not totally sure, currently i cannot double check as i cannot build desktop for $reasons currently) |
I couldn't reproduce this as it probably was something else than the tapping outside (that just regularly should unwind the component), but looked at the logic again and found some cases where it might have been stuck in edge error cases. I made the logic more robust now. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we can merge this and then do the remaining changes in a follow up pr (namely to remove blueprint usage), I think it makes sense to get more people to test the new scanner and all the serious problems that I found are already solved now.
Co-authored-by: Simon Laux <Simon-Laux@users.noreply.github.com>
This PR tackles a couple of issues around scanning QR codes:
QrReader
an independent React component which can be re-used in other places in the futurejsqr
library with inlined WebWorker (before it was wrapped in https://github.com/deltachat/react-qr-reader)Preview