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

Improve QR Code scan ability #1036

Merged
merged 32 commits into from
Oct 2, 2019
Merged

Conversation

rohit-dua
Copy link
Contributor

Description

The QR scan library react-native-camera currently uses an old version 1.9.1. It is upgraded to 2.9.0. Also the function to scan QR codes is changed to the one that uses Google vision API.

The share QR code button downloads the QR code image as png. When viewed in the gallery it is viewed on a black background by default. The QR scanning is inefficient when the QR code is on a black background. Hence a white margin of 10px(each side) is added to the image

Tested

Scan Tested locally

Related issues

@rohit-dua rohit-dua requested a review from jmrossy September 18, 2019 11:38
@rohit-dua rohit-dua requested a review from cmcewen as a code owner September 18, 2019 11:38
@rohit-dua rohit-dua assigned jmrossy and unassigned jmrossy Sep 18, 2019
@codecov
Copy link

codecov bot commented Sep 18, 2019

Codecov Report

Merging #1036 into master will increase coverage by 0.1%.
The diff coverage is 80%.

Impacted file tree graph

@@            Coverage Diff            @@
##           master    #1036     +/-   ##
=========================================
+ Coverage   66.06%   66.16%   +0.1%     
=========================================
  Files         261      262      +1     
  Lines        7564     7610     +46     
  Branches      437      443      +6     
=========================================
+ Hits         4997     5035     +38     
- Misses       2471     2478      +7     
- Partials       96       97      +1
Flag Coverage Δ
#mobile 66.16% <80%> (+0.1%) ⬆️
Impacted Files Coverage Δ
packages/mobile/src/qrcode/QRScanner.tsx 0% <0%> (ø) ⬆️
packages/mobile/src/qrcode/QRCode.tsx 97.14% <100%> (ø) ⬆️
packages/mobile/src/qrcode/utils.ts 74.35% <100%> (+1.85%) ⬆️
packages/mobile/src/qrcode/QRGen.tsx 92.68% <92.68%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c80f755...4bd8d86. Read the comment docs.

Copy link
Contributor

@jmrossy jmrossy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good first pass, please see comments below :)

@@ -129,6 +129,7 @@ android {
testBuildType System.getProperty('testBuildType', 'debug')
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
resValue "string", "build_config_package", "org.celo.mobile"
missingDimensionStrategy 'react-native-camera', 'mlkit'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we get a rough estimate of how much this mlkit affects the apk size?
Here are the commands to build an apk, from the android folder:

./gradlew clean
./gradlew bundleReleaseJsAndAssets 
./gradlew assembleRelease -x bundleReleaseJsAndAssets

@@ -0,0 +1,117 @@
import _QRCode from 'qrcode'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add tests for this file.

packages/mobile/src/qrcode/QRScanner.tsx Outdated Show resolved Hide resolved
packages/mobile/src/qrcode/utils.ts Outdated Show resolved Hide resolved
@jmrossy jmrossy assigned rohit-dua and unassigned jmrossy Sep 19, 2019
@ashishb ashishb closed this Sep 24, 2019
@ashishb ashishb deleted the rohit-dua/upgrade-qr-code-scan branch September 24, 2019 01:28
@ashishb ashishb restored the rohit-dua/upgrade-qr-code-scan branch September 24, 2019 02:16
@ashishb ashishb reopened this Sep 24, 2019
packages/mobile/src/qrcode/QRScanner.tsx Outdated Show resolved Hide resolved
packages/mobile/src/qrcode/QRScanner.tsx Outdated Show resolved Hide resolved
@rohit-dua rohit-dua assigned jmrossy and unassigned rohit-dua Sep 30, 2019
packages/mobile/src/qrcode/QRGen/QRGen.test.tsx Outdated Show resolved Hide resolved
packages/mobile/src/qrcode/QRGen/QRGen.test.tsx Outdated Show resolved Hide resolved
@@ -0,0 +1,21 @@
import { genMatrix } from 'src/qrcode/QRGen'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need for a new file here, merge it with the QRGen.test.tsx file and put it under a separate describe block.
Also, if a file doesn't contain jsx code, the filename should be just .ts

}

onBardCodeDetected = (rawData: any) => {
if (rawData.type === BarcodeTypes.QR_CODE && this.state.qrSubmitted === false) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: Consider && !this.state.qrSubmitted

@jmrossy jmrossy assigned rohit-dua and unassigned jmrossy Oct 1, 2019
@@ -43,6 +43,15 @@ allprojects {
flatDir {
dirs celoClientDirectory
}
maven {
url "https://sdks.instabug.com/nexus/repository/instabug-cp"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This maven entry looks like a merge conflict, I removed this a few days ago

@rohit-dua rohit-dua merged commit 5961646 into master Oct 2, 2019
@rohit-dua rohit-dua deleted the rohit-dua/upgrade-qr-code-scan branch October 2, 2019 16:35
aaronmgdr added a commit that referenced this pull request Oct 4, 2019
* master:
  [Protocol] Fix network id for alfajores in truffle configs (#1211)
  When resetting and upgrading a VM testnet, new tx-nodes are included in the new instance group (#771)
  Upload static VM testnet nodes, add stackdriver logging (#750)
  Revert "Make packages depend on git vesrion (not npm)" (#1201)
  Make packages depend on git vesrion (not npm) (#1192)
  [contractkit] Document methods (#1195)
  [ck] consistent send tx object in kit (#1191)
  Move docker images to use node v10 (#1183)
  [ContractKit]Fill more fields before web3 signing (#1133)
  [codecov]Fix codecov errors (#1147)
  [Wallet] Add support for address pasting in send input field (#1180)
  Fix verification pool validation (#1176)
  Improve QR Code scan ability (#1036)
  Add CLI commands around identity metadata (#1167)
  [wallet]Run geth in an infura-like mode (#1108)

# Conflicts:
#	yarn.lock
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Some QR codes can't be scanned
3 participants