Double check for QR scanner
Now QR scanner returns only if two consecutive scans return the same result.
This commit is contained in:
parent
496b88cc0e
commit
53f114c747
1 changed files with 6 additions and 1 deletions
|
|
@ -46,6 +46,7 @@ angular.module('copayApp.directives')
|
||||||
var $video;
|
var $video;
|
||||||
var context;
|
var context;
|
||||||
var localMediaStream;
|
var localMediaStream;
|
||||||
|
var prevResult;
|
||||||
|
|
||||||
var _scan = function(evt) {
|
var _scan = function(evt) {
|
||||||
if (localMediaStream) {
|
if (localMediaStream) {
|
||||||
|
|
@ -56,7 +57,7 @@ angular.module('copayApp.directives')
|
||||||
//qrcodeError(e);
|
//qrcodeError(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$timeout(_scan, 500);
|
$timeout(_scan, 800);
|
||||||
};
|
};
|
||||||
|
|
||||||
var _scanStop = function() {
|
var _scanStop = function() {
|
||||||
|
|
@ -66,6 +67,10 @@ angular.module('copayApp.directives')
|
||||||
};
|
};
|
||||||
|
|
||||||
qrcode.callback = function(data) {
|
qrcode.callback = function(data) {
|
||||||
|
if (prevResult != data) {
|
||||||
|
prevResult = data;
|
||||||
|
return;
|
||||||
|
}
|
||||||
_scanStop();
|
_scanStop();
|
||||||
$modalInstance.close(data);
|
$modalInstance.close(data);
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue