Merge pull request #3758 from cmgustavo/feat/speedup-qr-code-scanner
Speed up QR code scanner for iOS
This commit is contained in:
commit
72b7ca7fb9
5 changed files with 43 additions and 31 deletions
3
Makefile
3
Makefile
|
|
@ -53,7 +53,6 @@ ios-debug:
|
|||
|
||||
android-prod:
|
||||
cordova/build.sh ANDROID --clear
|
||||
cp ./etc/beep.ogg ./cordova/project/plugins/phonegap-plugin-barcodescanner/src/android/LibraryProject/res/raw/beep.ogg
|
||||
cd cordova/project && cordova build android --release
|
||||
jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore ../copay.keystore -signedjar cordova/project/platforms/android/build/outputs/apk/android-release-signed.apk cordova/project/platforms/android/build/outputs/apk/android-release-unsigned.apk copay_play
|
||||
../android-sdk-macosx/build-tools/21.1.1/zipalign -v 4 cordova/project/platforms/android/build/outputs/apk/android-release-signed.apk cordova/project/platforms/android/build/outputs/apk/android-release-signed-aligned.apk
|
||||
|
|
@ -61,10 +60,8 @@ android-prod:
|
|||
|
||||
android-debug:
|
||||
cordova/build.sh ANDROID --dbgjs --clear
|
||||
cp ./etc/beep.ogg ./cordova/project/plugins/phonegap-plugin-barcodescanner/src/android/LibraryProject/res/raw/beep.ogg
|
||||
cd cordova/project && cordova run android
|
||||
|
||||
android-debug-fast:
|
||||
cordova/build.sh ANDROID --dbgjs
|
||||
cp ./etc/beep.ogg ./cordova/project/plugins/phonegap-plugin-barcodescanner/src/android/LibraryProject/res/raw/beep.ogg
|
||||
cd cordova/project && cordova run android
|
||||
|
|
|
|||
|
|
@ -84,8 +84,15 @@ if [ ! -d $PROJECT ]; then
|
|||
cordova plugin add https://github.com/florentvaldelievre/virtualartifacts-webIntent.git
|
||||
checkOK
|
||||
|
||||
cordova plugin add https://github.com/phonegap/phonegap-plugin-barcodescanner.git
|
||||
checkOK
|
||||
if [ $CURRENT_OS != "WP8" ]
|
||||
then
|
||||
cordova plugin add https://github.com/tjwoon/csZBar.git
|
||||
checkOK
|
||||
else
|
||||
echo "${OpenColor}${Green}* Using plugin phonegap-plugin-barcodescanner for Windows Phone 8 ${CloseColor}"
|
||||
cordova plugin add https://github.com/phonegap/phonegap-plugin-barcodescanner.git
|
||||
checkOK
|
||||
fi
|
||||
|
||||
cordova plugin add cordova-plugin-splashscreen
|
||||
checkOK
|
||||
|
|
@ -138,6 +145,9 @@ if [ ! -d $PROJECT ]; then
|
|||
cordova plugin add cordova-ios-requires-fullscreen
|
||||
checkOK
|
||||
|
||||
cordova plugin add cordova-plugin-disable-bitcode
|
||||
checkOK
|
||||
|
||||
fi
|
||||
|
||||
if $DBGJS
|
||||
|
|
|
|||
|
|
@ -64,6 +64,7 @@
|
|||
"angular": "^1.3.14",
|
||||
"angular-mocks": "^1.3.14",
|
||||
"bhttp": "^1.2.1",
|
||||
"cordova": "^5.4.1",
|
||||
"grunt-karma": "^0.10.1",
|
||||
"grunt-karma-coveralls": "^2.5.3",
|
||||
"grunt-node-webkit-builder": "^1.0.2",
|
||||
|
|
@ -71,6 +72,7 @@
|
|||
"karma-cli": "0.0.4",
|
||||
"karma-coverage": "^0.2.7",
|
||||
"karma-jasmine": "^0.3.5",
|
||||
"karma-phantomjs-launcher": "^0.1.4"
|
||||
"karma-phantomjs-launcher": "^0.1.4",
|
||||
"xcode": "^0.8.2"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.controllers').controller('walletHomeController', function($scope, $rootScope, $timeout, $filter, $modal, $log, notification, txStatus, isCordova, profileService, lodash, configService, rateService, storageService, bitcore, isChromeApp, gettext, gettextCatalog, nodeWebkit, addressService, ledger, bwsError, confirmDialog, txFormatService, animationService, addressbookService, go, feeService) {
|
||||
angular.module('copayApp.controllers').controller('walletHomeController', function($scope, $rootScope, $timeout, $filter, $modal, $log, notification, txStatus, isCordova, isMobile, profileService, lodash, configService, rateService, storageService, bitcore, isChromeApp, gettext, gettextCatalog, nodeWebkit, addressService, ledger, bwsError, confirmDialog, txFormatService, animationService, addressbookService, go, feeService) {
|
||||
|
||||
var self = this;
|
||||
window.ignoreMobilePause = false;
|
||||
|
|
@ -25,7 +25,6 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi
|
|||
this.blockUx = false;
|
||||
this.isRateAvailable = false;
|
||||
this.showScanner = false;
|
||||
this.isMobile = isMobile.any();
|
||||
this.addr = {};
|
||||
this.lockedCurrentFeePerKb = null;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,36 +1,40 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.directives')
|
||||
.directive('qrScanner', ['$rootScope', '$timeout', '$modal', 'isCordova', 'gettextCatalog',
|
||||
function($rootScope, $timeout, $modal, isCordova, gettextCatalog) {
|
||||
.directive('qrScanner', ['$rootScope', '$timeout', '$modal', 'isCordova', 'gettextCatalog', 'isMobile',
|
||||
function($rootScope, $timeout, $modal, isCordova, gettextCatalog, isMobile) {
|
||||
|
||||
var controller = function($scope) {
|
||||
|
||||
var onSuccess = function(result) {
|
||||
$timeout(function() {
|
||||
window.plugins.spinnerDialog.hide();
|
||||
window.ignoreMobilePause = false;
|
||||
}, 100);
|
||||
if (isMobile.Windows() && result.cancelled) return;
|
||||
|
||||
$timeout(function() {
|
||||
var data = isMobile.Windows() ? result.text : result;
|
||||
$scope.onScan({ data: data });
|
||||
}, 1000);
|
||||
};
|
||||
|
||||
var onError = function(error) {
|
||||
$timeout(function() {
|
||||
window.ignoreMobilePause = false;
|
||||
window.plugins.spinnerDialog.hide();
|
||||
}, 100);
|
||||
};
|
||||
|
||||
$scope.cordovaOpenScanner = function() {
|
||||
window.ignoreMobilePause = true;
|
||||
window.plugins.spinnerDialog.show(null, gettextCatalog.getString('Preparing camera...'), true);
|
||||
$timeout(function() {
|
||||
cordova.plugins.barcodeScanner.scan(
|
||||
function onSuccess(result) {
|
||||
$timeout(function() {
|
||||
window.plugins.spinnerDialog.hide();
|
||||
window.ignoreMobilePause = false;
|
||||
}, 100);
|
||||
if (result.cancelled) return;
|
||||
|
||||
$timeout(function() {
|
||||
var data = result.text;
|
||||
$scope.onScan({ data: data });
|
||||
}, 1000);
|
||||
},
|
||||
function onError(error) {
|
||||
$timeout(function() {
|
||||
window.ignoreMobilePause = false;
|
||||
window.plugins.spinnerDialog.hide();
|
||||
}, 100);
|
||||
alert('Scanning error');
|
||||
}
|
||||
);
|
||||
if (!isMobile.Windows()) {
|
||||
cloudSky.zBar.scan({}, onSuccess, onError);
|
||||
} else {
|
||||
cordova.plugins.barcodeScanner.scan(onSuccess, onError);
|
||||
}
|
||||
if ($scope.beforeScan) {
|
||||
$scope.beforeScan();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue