Skip to content

Commit 0c4d596

Browse files
committed
Improve Android QR readability
Update the lib so we can explicitly set the level (not actually sure if it's different from the default, good to update regardless) and use SVG more (sharper), and then just make it bigger.
1 parent a8e6ef1 commit 0c4d596

File tree

3 files changed

+20
-34
lines changed

3 files changed

+20
-34
lines changed

package-lock.json

Lines changed: 9 additions & 28 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@
120120
"openapi3-ts": "^1.3.0",
121121
"polished": "^4.3.1",
122122
"posthog-js": "^1.57.2",
123-
"qrcode.react": "^1.0.0",
123+
"qrcode.react": "^4.2.0",
124124
"randexp": "^0.5.3",
125125
"rawprotoparse": "^0.0.9",
126126
"react": "^18.2.0",

src/components/intercept/config/android-device-config.tsx

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import * as _ from 'lodash';
22
import * as React from 'react';
33
import { when } from 'mobx';
44
import { observer, inject } from 'mobx-react';
5-
import * as QRCode from 'qrcode.react';
5+
import { QRCodeSVG } from 'qrcode.react';
66
import {
77
matchers,
88
completionCheckers
@@ -43,7 +43,8 @@ const ConfigContainer = styled.div`
4343
}
4444
}
4545
46-
> canvas {
46+
> svg {
47+
flex: 1 1 200px;
4748
margin: 0 auto;
4849
/* Without white padding, the QR code sometimes isn't scannable */
4950
padding: 5px;
@@ -60,7 +61,7 @@ const ConfigContainer = styled.div`
6061
`;
6162

6263
const Spacer = styled.div`
63-
flex: 1 1 100%;
64+
flex: 1 1 20px;
6465
`;
6566

6667
function urlSafeBase64(content: string) {
@@ -206,8 +207,12 @@ class AndroidConfig extends React.Component<{
206207
</p>
207208

208209
<Spacer />
209-
<QRCode
210-
size={160}
210+
<QRCodeSVG
211+
// Delegate sizing to CSS:
212+
height={""}
213+
width={""}
214+
// Minimum error correction - shouldn't really be required
215+
level='L'
211216
value={
212217
`https://android.httptoolkit.tech/connect/?data=${serializedSetupParams}`
213218
}

0 commit comments

Comments
 (0)