-
-
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
Show paste button in qr scanner dialog #4309
base: main
Are you sure you want to change the base?
Conversation
TODO: We have to adapt the e2e test for pasting the qr code! #4285 |
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.
This removes the "paste from clipboard" menu item from QrReader
, but QrReader
is also used in ReceiveBackupDialog
. Does it mean it's now impossible to paste the backup QR?
let's stay with the paste button. having that hidden at "import" again is not obvious, if is also about the balance copy/paste. there could be a three dot menu beside the paste button for the other options, but that is another effort, and maybe not needed. |
True, that's another use case not covered in the Issue since the left footer button is already set there. So maybe we should move the Troubleshoot link to another place? @r10s |
A simple hack would be to keep the "paste from clipboard" menu item just for the Backup dialog. I.e. to add a prop |
I'd say keep the paste button in the menu or move trouble shooting up to the description. |
let's keep the menu as is, and only add the button. that seems to be the easiest approach to fix the issue at hand. for the "experimental" hint: we're staying with that for so long, also for reasons, regarding backup/backup2 hickup. let's do not remove that last minute, it is fine. idk, what the exact state of iroh is, let's see that for 1.50 and maybe get it out of "experimental" on all platforms |
wouldn't we need to upgrade the version then or is the first iroh/backup(without the 2) still supported? |
i think it is fine, as long as desktop checks for DC_QR_BACKUP as well as DC_QR_BACKUP2 at all places, on android we forgot one place, and that resulted in a degradation, see deltachat/deltachat-android#3370 |
resolves #3936 move paste from clipboard from settings context menu to own button
cbc35bc
to
c83f013
Compare
Enables to trigger the handlePasteFromClipboard in QrReader child component
c83f013
to
68c8f42
Compare
I readded the "paste from clipboard" item to settings menu I also refactored the implementation to avoid duplicate code by using useImperativeHandle |
Done |
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.
With my non-nitpick comments addressed or dismissed, it's good to merge.
I tested it a bit, and looked at the code. It seems fine otherwise.
Though NGL, it's a bit hard to review, with refactoring changes and functional changes being mixed.
@r10s since I refactor this now anyway: when do we show the red alert (in our code is named "userFeedback") and when a normal warning dialog? the "AlertDialog" would look like that: which is not really what I would expect from a "AlertDialog" (but that is probably another issue) |
FYI that |
So maybe better improve the AlertDialog a bit and use that... |
c7cd9c8
to
2967b73
Compare
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.
So, there are a lot of changes in this MR, both functional and refactoring. Not all are strictly related to the title of the MR,
I have verified that the moved fileToBase64
and base64ToImageData
functions are unchanged. qrCodeFromClipboard
was moved from handlePasteFromClipboard
and it's also largely unchanged. The only thing different is that it errors out when the scan result's string is empty, which probably makes sense (but I'm not sure if this can happen).
About the removal of setError(true)
from handleError
, and the rename of it to setCameraAccessError
. I haven't checked what it does exactly.
But what I noticed is that we now handle all scanning errors in one place, in the parent component, which is probably good. But we also invoke the callback after an error is thrown in worker.postMessage(imageData)
, and postMessage
gets called every 250ms. But I guess this can't happen often.
Another things is as was said above, now an AlertDialog
is used instead of the userFeedback
toast, which is better (at least in common cases).
I have tested this MR a little bit. Works alright.
As to the rest of the changes (that is the "add 'paste' button"): they look good, apart from that one suggestion I left!
this error is set if startStream fails so I named it a bit more meaningful I think we won't merge this into the current release (which will be published tomorrow hopefully) |
@@ -158,47 +82,18 @@ export default function QrReader({ onError, onScan }: Props) { | |||
} else { | |||
onError(error.toString()) | |||
} | |||
|
|||
setError(true) |
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.
this error is set if startStream fails so I named it a bit more meaningful
But it was also removed from here.
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.
Yes but that resulted in showing the camera_access_failed error in the UI which I consider wrong since it's a generic errorHandler (for example after an error in handleFileInputChange)
resolves #3936
move "paste from clipboard" from settings context menu to own button
Another option would be: name the paste button "Import" and show the context menu onClick with the 2 options: 'load QR Code image' or 'paste from clipboard'
But buttons that show a context menu on click are a bit unusual