viewModel.scan = function () { barcodescanner.scan({ // iOS only, default 'Close' cancelLabel: "Stop scanning", // Android only, default is 'Place a barcode inside the viewfinder rectangle to scan it.' message: "Scan your referral barcode using the camera", // Start with the front cam, if available. Android only, default false preferFrontCamera: false, // Render a button to switch between front and back cam. Android only, default false (on iOS it's always available) showFlipCameraButton: true }).then( function(result) { console.log("Scan format: " + result.format); console.log("Scan text: " + result.text); }, function(error) { console.log("No scan: " + error); } ) };
viewModel.scan = function () { barcodescanner.scan({ // iOS only, default 'Close' cancelLabel: "Stop scanning", // Android only, default is 'Place a barcode inside the viewfinder rectangle to scan it.' message: "Scan your referral barcode using the camera", // Start with the front cam, if available. Android only, default false preferFrontCamera: false, // Render a button to switch between front and back cam. Android only, default false (on iOS it's always available) showFlipCameraButton: false }).then( function (result) { refCode = result.text; //that.set("scanCode", refCode); //if (result.format !== 'UPC_A') { // var context = { // title: "Referral Code Error", // message: "We were unable to find referral code " + result.text + ". Please try again.", // okButtonText: "Try Again", // cancelButtonText: "Contact UH" // } // utility.launchPopup("acknowledge", function (data) { // // callback // }, null, context); //} else { // refCode = result.text; // that.set("scanCode", refCode); // //that.page.getViewById("submitBtn").isEnabled = true; // //topmost.navigate({ // // moduleName: 'views/verify/verify-user', // // context: { // //providerId: providerId // // } // //}); // console.log("topmost"); //} //console.log("Scan format: " + result.format); //console.log("Scan text: " + result.text); }, function(error) { //console.log("No scan: " + error); } ) };