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

QR Code Scanner #4897

Merged
merged 39 commits into from
Aug 10, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
2e50348
added instascan pkg
brunobar79 Jul 23, 2018
0940ecd
added camera snippet injection to inpage.js
brunobar79 Jul 23, 2018
0209148
fixes
brunobar79 Jul 23, 2018
f7ad978
camera working back and forth
brunobar79 Jul 24, 2018
d5929e5
added qr code scanner icon in send transaction
brunobar79 Jul 24, 2018
74fd6d1
working without injection
brunobar79 Jul 25, 2018
eeb902d
decent UI
brunobar79 Jul 25, 2018
4759915
fix spinner and qr icon
brunobar79 Jul 25, 2018
6cd4bc9
working without permission issues
brunobar79 Jul 27, 2018
ea028e7
fully working without tweaking ext. permission
brunobar79 Jul 27, 2018
d4a15f2
added webrtc-adapter for browser compat
brunobar79 Jul 27, 2018
69f4c8c
fix merge conflicts
brunobar79 Jul 27, 2018
d65d018
restore platform/extension.js
brunobar79 Jul 27, 2018
bea1cf3
clean up
brunobar79 Jul 27, 2018
6886429
fix linting errors
brunobar79 Jul 27, 2018
4de8f5b
fix dependencies
brunobar79 Jul 27, 2018
acfcdf5
fix unit tests
brunobar79 Jul 27, 2018
b6592ba
Merge branch 'develop' of github.com:MetaMask/metamask-extension into…
brunobar79 Jul 30, 2018
4339f04
use existing modals
brunobar79 Jul 30, 2018
d2368d6
clean up css
brunobar79 Jul 30, 2018
34617a2
copy
brunobar79 Jul 30, 2018
b673a7a
kill camera stream when unmouting
brunobar79 Jul 30, 2018
edb1547
send to fullscreen if no permission from popup
brunobar79 Jul 31, 2018
710b4e2
added crossbrowser support and error handling
brunobar79 Jul 31, 2018
caa9e20
lint
brunobar79 Jul 31, 2018
7a40072
lint
brunobar79 Jul 31, 2018
94a8979
fix
brunobar79 Jul 31, 2018
71ef4d8
design complete
brunobar79 Aug 3, 2018
af97ba1
clear qr code data before scanning
brunobar79 Aug 3, 2018
e9a0feb
fixed issue with input
brunobar79 Aug 4, 2018
b1ddaaf
lint
brunobar79 Aug 4, 2018
ef9435e
restore qr
brunobar79 Aug 4, 2018
2e0916d
fix merge conflicts
brunobar79 Aug 8, 2018
c6b7e46
code review changes
brunobar79 Aug 8, 2018
a46cf39
update package-lock.json
brunobar79 Aug 8, 2018
cbbd0d3
lint
brunobar79 Aug 8, 2018
f269021
add submit button type
brunobar79 Aug 8, 2018
656afee
fix merge conflicts
brunobar79 Aug 8, 2018
d0ccc59
add comment
brunobar79 Aug 8, 2018
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
30 changes: 30 additions & 0 deletions app/_locales/en/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
"accept": {
"message": "Accept"
},
"accessingYourCamera": {
"message": "Accesing your camera..."
},
"account": {
"message": "Account"
},
Expand Down Expand Up @@ -656,6 +659,12 @@
"notStarted": {
"message": "Not Started"
},
"noWebcamFoundTitle": {
"message": "Webcam not found"
},
"noWebcamFound": {
"message": "Your computer's webcam was not found. Please try again."
},
"oldUI": {
"message": "Old UI"
},
Expand Down Expand Up @@ -940,6 +949,12 @@
"info": {
"message": "Info"
},
"scanInstructions": {
"message": "Place the QR code in front of your camera"
},
"scanQrCode": {
"message": "Scan QR Code"
},
"shapeshiftBuy": {
"message": "Buy with Shapeshift"
},
Expand Down Expand Up @@ -1059,6 +1074,9 @@
"message": "We had trouble loading your token balances. You can view them ",
"description": "Followed by a link (here) to view token balances"
},
"tryAgain": {
"message": "Try again"
},
"twelveWords": {
"message": "These 12 words are the only way to restore your MetaMask accounts.\nSave them somewhere safe and secret."
},
Expand Down Expand Up @@ -1089,6 +1107,15 @@
"unknownNetworkId": {
"message": "Unknown network ID"
},
"unknownQrCode": {
"message": "Error: We couldn't identify that QR code"
},
"unknownCameraErrorTitle": {
"message": "Ooops! Something went wrong...."
},
"unknownCameraError": {
"message": "There was an error while trying to access you camera. Please try again..."
},
"unlock": {
"message": "Unlock"
},
Expand Down Expand Up @@ -1135,6 +1162,9 @@
"whatsThis": {
"message": "What's this?"
},
"youNeedToAllowCameraAccess": {
"message": "You need to allow camera access to use this feature."
},
"yourSigRequested": {
"message": "Your signature is being requested"
},
Expand Down
18 changes: 18 additions & 0 deletions app/images/webcam.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion app/scripts/contentscript.js
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,6 @@ function blacklistedDomainCheck () {
*/
function redirectToPhishingWarning () {
console.log('MetaMask - routing to Phishing Warning component')
let extensionURL = extension.runtime.getURL('phishing.html')
const extensionURL = extension.runtime.getURL('phishing.html')
window.location.href = extensionURL
}
11 changes: 11 additions & 0 deletions app/scripts/lib/enums.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,19 @@ const ENVIRONMENT_TYPE_POPUP = 'popup'
const ENVIRONMENT_TYPE_NOTIFICATION = 'notification'
const ENVIRONMENT_TYPE_FULLSCREEN = 'fullscreen'

const PLATFORM_BRAVE = 'Brave'
const PLATFORM_CHROME = 'Chrome'
const PLATFORM_EDGE = 'Edge'
const PLATFORM_FIREFOX = 'Firefox'
const PLATFORM_OPERA = 'Opera'

module.exports = {
ENVIRONMENT_TYPE_POPUP,
ENVIRONMENT_TYPE_NOTIFICATION,
ENVIRONMENT_TYPE_FULLSCREEN,
PLATFORM_BRAVE,
PLATFORM_CHROME,
PLATFORM_EDGE,
PLATFORM_FIREFOX,
PLATFORM_OPERA,
}
29 changes: 29 additions & 0 deletions app/scripts/lib/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ const {
ENVIRONMENT_TYPE_POPUP,
ENVIRONMENT_TYPE_NOTIFICATION,
ENVIRONMENT_TYPE_FULLSCREEN,
PLATFORM_FIREFOX,
PLATFORM_OPERA,
PLATFORM_CHROME,
PLATFORM_EDGE,
PLATFORM_BRAVE,
} = require('./enums')

/**
Expand Down Expand Up @@ -37,6 +42,29 @@ const getEnvironmentType = (url = window.location.href) => {
}
}

/**
* Returns the platform (browser) where the extension is running.
*
* @returns {string} the platform ENUM
*
*/
const getPlatform = _ => {
const ua = navigator.userAgent
if (ua.search('Firefox') !== -1) {
return PLATFORM_FIREFOX
} else {
if (window && window.chrome && window.chrome.ipcRenderer) {
return PLATFORM_BRAVE
} else if (ua.search('Edge') !== -1) {
return PLATFORM_EDGE
} else if (ua.search('OPR') !== -1) {
return PLATFORM_OPERA
} else {
return PLATFORM_CHROME
}
}
}

/**
* Checks whether a given balance of ETH, represented as a hex string, is sufficient to pay a value plus a gas fee
*
Expand Down Expand Up @@ -100,6 +128,7 @@ function BnMultiplyByFraction (targetBN, numerator, denominator) {
}

module.exports = {
getPlatform,
getStack,
getEnvironmentType,
sufficientBalance,
Expand Down
7 changes: 6 additions & 1 deletion app/scripts/platforms/extension.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,13 @@ class ExtensionPlatform {
return extension.runtime.getManifest().version
}

openExtensionInBrowser (route = null) {
openExtensionInBrowser (route = null, queryString = null) {
let extensionURL = extension.runtime.getURL('home.html')

if (queryString) {
extensionURL += `?${queryString}`
}

if (route) {
extensionURL += `#${route}`
}
Expand Down
2 changes: 1 addition & 1 deletion old-ui/app/components/transaction-list-item.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ TransactionListItem.prototype.showRetryButton = function () {
const currentNonce = txParams.nonce
const currentNonceTxs = transactions.filter(tx => tx.txParams.nonce === currentNonce)
const currentNonceSubmittedTxs = currentNonceTxs.filter(tx => tx.status === 'submitted')
const currentSubmittedTxs = transactions.filter(tx => tx.status === 'submitted')
const currentSubmittedTxs = transactions.filter(tx => tx.status === 'submitted')
const lastSubmittedTxWithCurrentNonce = currentNonceSubmittedTxs[0]
const currentTxIsLatestWithNonce = lastSubmittedTxWithCurrentNonce &&
lastSubmittedTxWithCurrentNonce.id === transaction.id
Expand Down
66 changes: 53 additions & 13 deletions package-lock.json

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

3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@
},
"dependencies": {
"@material-ui/core": "1.0.0",
"@zxing/library": "^0.7.0",
"abi-decoder": "^1.0.9",
"asmcrypto.js": "0.22.0",
"async": "^2.5.0",
Expand All @@ -97,6 +98,7 @@
"debounce-stream": "^2.0.0",
"deep-extend": "^0.5.1",
"detect-node": "^2.0.3",
"detectrtc": "^1.3.6",
"disc": "^1.3.2",
"dnode": "^1.2.2",
"end-of-stream": "^1.1.0",
Expand Down Expand Up @@ -206,6 +208,7 @@
"web3": "^0.20.1",
"web3-provider-engine": "^14.0.5",
"web3-stream-provider": "^3.0.1",
"webrtc-adapter": "^6.3.0",
"xtend": "^4.0.1"
},
"devDependencies": {
Expand Down
Loading