From 53f114c74760dfb1ba840347b063ccc2f0df81d5 Mon Sep 17 00:00:00 2001 From: Kosta Korenkov <7r0ggy@gmail.com> Date: Mon, 31 Aug 2015 08:55:30 +0300 Subject: [PATCH] Double check for QR scanner Now QR scanner returns only if two consecutive scans return the same result. --- src/js/directives/qrScanner.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/js/directives/qrScanner.js b/src/js/directives/qrScanner.js index dfb840435..ac4ed7b80 100644 --- a/src/js/directives/qrScanner.js +++ b/src/js/directives/qrScanner.js @@ -46,6 +46,7 @@ angular.module('copayApp.directives') var $video; var context; var localMediaStream; + var prevResult; var _scan = function(evt) { if (localMediaStream) { @@ -56,7 +57,7 @@ angular.module('copayApp.directives') //qrcodeError(e); } } - $timeout(_scan, 500); + $timeout(_scan, 800); }; var _scanStop = function() { @@ -66,6 +67,10 @@ angular.module('copayApp.directives') }; qrcode.callback = function(data) { + if (prevResult != data) { + prevResult = data; + return; + } _scanStop(); $modalInstance.close(data); };