Skip to content
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

Merged
merged 46 commits into from
Apr 23, 2024
Merged
Show file tree
Hide file tree
Changes from 45 commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
d6c9d11
Introduce new QrReader component with quircs
adzialocha Apr 9, 2024
8d7bc18
Try zxing-wasm library
adzialocha Apr 11, 2024
43dee16
Allow selecting different cameras and modes
adzialocha Apr 11, 2024
83ad538
Add options to scan from image or clipboard
adzialocha Apr 11, 2024
00a8849
Remove handleError from camera to avoid reloading
adzialocha Apr 11, 2024
234ad9d
Use pointer cursor on qr code dialog tabs
adzialocha Apr 11, 2024
812a9a9
Use zbar-wasm
adzialocha Apr 12, 2024
431e895
Add CHANGELOG.md entry
adzialocha Apr 12, 2024
d79763b
Make icon a little larger, improve styling
adzialocha Apr 16, 2024
8a7501a
Remove selecting facing mode, bring cameras into root of context menu
adzialocha Apr 16, 2024
20bdf64
Read image from clipboard
adzialocha Apr 16, 2024
27e2f91
Move handling scan results into own method
adzialocha Apr 16, 2024
2c87ade
Use translation strings
adzialocha Apr 16, 2024
d15ef23
Hide camera selection when only one camera is given
adzialocha Apr 16, 2024
836dcd9
Update CHANGELOG.md
adzialocha Apr 16, 2024
7e442a6
Bring back former styling
adzialocha Apr 16, 2024
e07dfcf
Adjust button position a little
adzialocha Apr 16, 2024
2c0b404
Do not show hint on error
adzialocha Apr 16, 2024
462c1bb
Remove unused npm dependency
adzialocha Apr 16, 2024
5389a4f
Improve error message
adzialocha Apr 17, 2024
c14da78
Handle empty base64 string when reading clipboard image from electron
adzialocha Apr 17, 2024
a942405
Remove duplicate button
adzialocha Apr 17, 2024
a04ed95
Docstring for readClipboardImage method
adzialocha Apr 17, 2024
90b4d6f
Use checkmark icon which works in darkmode as well
adzialocha Apr 17, 2024
d600218
Flip video horizontally
adzialocha Apr 17, 2024
3696c46
Improve styling for longer error message
adzialocha Apr 17, 2024
c4358a3
Add a whole bunch of comments
adzialocha Apr 17, 2024
919bffa
Automatically select first available video device
adzialocha Apr 17, 2024
655eff1
Reset input element to still receive onChange when selecting same image
adzialocha Apr 17, 2024
edaba32
Always flip processing flag, in error or success cases
adzialocha Apr 17, 2024
67fe777
Fix removed subtitle prop in other components
adzialocha Apr 17, 2024
31c0955
Fix confirm dialog not returning callback on ESC-key events
adzialocha Apr 17, 2024
db005ec
Use isEmpty method on NativeImage
adzialocha Apr 17, 2024
399e192
Show error when no data was found in selected image file
adzialocha Apr 17, 2024
db1294d
Leave a note to change translation string
adzialocha Apr 18, 2024
5f2663e
Correct JSX comment syntax
adzialocha Apr 18, 2024
63fcfb0
Use jsqr for now as zbar-wasm seems to be too unstable
adzialocha Apr 19, 2024
09ecf86
Already use untranslated string
adzialocha Apr 19, 2024
7229f83
Increase scan interval to 250ms
adzialocha Apr 20, 2024
d150792
Close dialog after cancelling
adzialocha Apr 20, 2024
b73d329
Better name for method
adzialocha Apr 20, 2024
67c4792
Make stopping stream logic more robust for different cases
adzialocha Apr 20, 2024
eb6ffbe
Use worker
adzialocha Apr 20, 2024
8ffe6e3
Keep showing QR reader when cancelling dialogs
adzialocha Apr 20, 2024
cebe9ef
Do not display progress bar when processing code
adzialocha Apr 20, 2024
b80e73b
Update src/renderer/components/QrReader/index.tsx
adzialocha Apr 22, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
- add quick-key CtrlOrCmd+q for submenu quit #3758
- add window titlebar for html_email- and help window #3770 #3778
- add quick key `Cmd+W`/`Ctrl+W` to close webxdc-, html_email- and help-window #3770 #3778

- Accept images from clipboard in QR reader #3762

### Changed
- Update translations (2024-04-04) #3746
Expand All @@ -18,6 +18,7 @@
- Improve security: restrict file protocol #3769
- Update `deltachat-node` and `deltachat/jsonrpc-client` to `v1.137.3`
- Change chatlist to use new chatlist changed event from core #3268
- Refactor QR code reader #3762

### Fixed
- fix chat audit dialog was going out of viewport on smaller screens #3736
Expand All @@ -31,6 +32,7 @@
- fix translation keys in keybindings cheat sheet dialog #3779
- fix random scroll position and missing redraws when opening "Archive" #3268
- fix: clear notifications for a contact request when blocking it #3268
- Unmount QR scanner and disable camera correctly on abort or exit #3762

<a id="1_44_1"></a>

Expand Down
6 changes: 6 additions & 0 deletions _locales/_untranslated_en.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,11 @@
},
"pref_current_account": {
"message": "Current Account"
},
"qrscan_hint_desktop": {
"message": "Move the QR code to the camera"
},
"camera_access_failed": {
"message": "Could not access video camera. You might want to check your video permissions or if the camera is used already by another program"
}
}
3 changes: 2 additions & 1 deletion bin/build-frontend-ts.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import path from 'path'
import { copyFile, readFile } from 'fs/promises'

import esbuild from 'esbuild'
import inlineWorkerPlugin from 'esbuild-plugin-inline-worker'
import { ESLint } from 'eslint'
import { compile } from 'sass'

Expand All @@ -12,7 +13,7 @@ import { compile } from 'sass'
function config(options) {
const { isProduction, isMinify, isWatch } = options

const plugins = [wasmPlugin, sassPlugin]
const plugins = [wasmPlugin, sassPlugin, inlineWorkerPlugin()]
if (isWatch || isProduction) {
// Make eslint optional as it affects build times significantly
plugins.push(eslintPlugin)
Expand Down
168 changes: 123 additions & 45 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@
"@blueprintjs/core": "^4.1.2",
"@deltachat/jsonrpc-client": "^1.137.3",
"@deltachat/message_parser_wasm": "^0.9.0",
"@deltachat/react-qr-reader": "^4.0.0",
"@emoji-mart/data": "1.1.2",
"@emoji-mart/react": "1.1.1",
"@mapbox/geojson-extent": "^1.0.0",
Expand All @@ -92,6 +91,7 @@
"error-stack-parser": "^2.0.7",
"filesize": "^10.1.0",
"immutable": "^4.0.0",
"jsqr": "^1.4.0",
"mapbox-gl": "^1.12.0",
"mime-types": "^2.1.31",
"moment": "^2.29.2",
Expand Down Expand Up @@ -132,6 +132,7 @@
"electron": "^28.2.3",
"electron-builder": "^24.6.4",
"esbuild": "^0.19.8",
"esbuild-plugin-inline-worker": "^0.1.1",
"eslint": "^8.54.0",
"eslint-config-prettier": "^9.0.0",
"eslint-plugin-prettier": "^5.0.1",
Expand Down
43 changes: 1 addition & 42 deletions scss/dialogs/_qr-code.scss
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

p {
width: 50%;
cursor: pointer;

margin: 0;
padding: 17px 0px;
Expand All @@ -24,45 +25,3 @@
}
}
}

.scan-qr-description {
position: relative;
z-index: map-get($z-index, import-qr-code-dialog-scope-scan-qr-description);
top: -18px;
margin-top: -18px;
margin: 0;
color: #fff;
}

.scan-qr-red-line {
@keyframes scan-qr-red-line {
from {
opacity: 1;
}
to {
opacity: 0;
}
}

position: relative;
top: -225px;
margin-top: -225px;
margin: 0;

border-bottom-color: #ff00005c;
border-bottom-style: solid;
border-bottom-width: 1px;

margin: 0px 50px;

animation-name: scan-qr-red-line;
animation-duration: 0.6s;
animation-iteration-count: infinite;
animation-direction: alternate;
animation-timing-function: ease-in;
}

.import-qr-code-dialog > div > div > section > section > div {
border: 50px solid rgba(0, 0, 0, 0.2);
box-shadow: unset !important;
}
Loading
Loading