{ "id": "171451", "key": "MOD-2478", "fields": { "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false }, "project": { "id": "10034", "key": "MOD", "name": "Appcelerator Modules", "projectCategory": { "id": "10100", "description": "Titanium and related SDKs used in application development", "name": "Client" } }, "fixVersions": [], "resolution": { "id": "5", "description": "All attempts at reproducing this issue failed, or not enough information was available to reproduce the issue. Reading the code produces no clues as to why this behavior would occur. If more information appears later, please reopen the issue.", "name": "Cannot Reproduce" }, "resolutiondate": "2020-04-03T14:58:23.000+0000", "created": "2018-04-04T09:02:07.000+0000", "priority": { "name": "Critical", "id": "1" }, "labels": [ "2020-Q2", "ios" ], "versions": [], "issuelinks": [], "assignee": { "name": "vgoyal", "key": "vgoyal", "displayName": "Vikas Goyal", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2020-04-03T14:58:27.000+0000", "status": { "description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.", "name": "Closed", "id": "6", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "components": [], "description": "Previous issues like this have been reported, but closed when the problem could not be replicated. It appears that testing was done in the simulator, which produces a black image when calling to use the scanner. In this situation, cancel WILL work. However, in the real world, with a real iOS device, when the camera is capturing an image, cancel WILL NOT work immediately. The cancel event is registered, but only actioned when the camera image is made to go black.\r\n\r\nThis is very easy to recreate using the example supplied with the module.", "attachment": [ { "id": "65020", "filename": "IMG_1073.TRIM.MOV", "author": { "name": "topener", "key": "topener", "displayName": "Rene Pot", "active": true, "timeZone": "Europe/Berlin" }, "created": "2018-04-04T13:52:01.000+0000", "size": 1257201, "mimeType": "video/quicktime" }, { "id": "67316", "filename": "qrcode_scan.mov", "author": { "name": "vgoyal", "key": "vgoyal", "displayName": "Vikas Goyal", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2020-04-01T12:42:13.000+0000", "size": 3392164, "mimeType": "video/quicktime" }, { "id": "65031", "filename": "VID_20180406_115332.mp4", "author": { "name": "andy@asamicros.com", "key": "andy@asamicros.com", "displayName": "andy@asamicros.com", "active": true, "timeZone": "Europe/London" }, "created": "2018-04-06T18:31:10.000+0000", "size": 3073645, "mimeType": "video/mp4" } ], "flagged": false, "summary": "iOS: Cancel does not work on ti.barcode when scanning ", "creator": { "name": "andy@asamicros.com", "key": "andy@asamicros.com", "displayName": "andy@asamicros.com", "active": true, "timeZone": "Europe/London" }, "subtasks": [], "reporter": { "name": "andy@asamicros.com", "key": "andy@asamicros.com", "displayName": "andy@asamicros.com", "active": true, "timeZone": "Europe/London" }, "environment": "Ti SDK 7.1.0GA and earlier, example from ti.barcode module install", "closedSprints": [ { "id": 1190, "state": "closed", "name": "2020 Sprint 7", "startDate": "2020-03-27T16:30:21.583Z", "endDate": "2020-04-10T16:30:00.000Z", "completeDate": "2020-04-10T17:43:27.544Z", "originBoardId": 114 } ], "comment": { "comments": [ { "id": "436280", "author": { "name": "topener", "key": "topener", "displayName": "Rene Pot", "active": true, "timeZone": "Europe/Berlin" }, "body": "[~andy@asamicros.com] attached is a video I just created using the sample provided. Cancel works immediately as you can see. \r\n\r\nThis is on an iPhone 8 device, using TiSDK 7.1.0.GA and Alloy 1.11 and ti.barcode 1.10.1\r\n\r\nCan you give me more info?", "updateAuthor": { "name": "topener", "key": "topener", "displayName": "Rene Pot", "active": true, "timeZone": "Europe/Berlin" }, "created": "2018-04-04T13:52:59.000+0000", "updated": "2018-04-04T13:56:16.000+0000" }, { "id": "436282", "author": { "name": "andy@asamicros.com", "key": "andy@asamicros.com", "displayName": "andy@asamicros.com", "active": true, "timeZone": "Europe/London" }, "body": "iPhone 4S, ver 9.3.5 for my development unit. I used the app.js example, so alloy not relevant? I'm using ti SDK 7.1.0GA as previously mentioned. I did not see an alloy example to test.", "updateAuthor": { "name": "andy@asamicros.com", "key": "andy@asamicros.com", "displayName": "andy@asamicros.com", "active": true, "timeZone": "Europe/London" }, "created": "2018-04-04T14:29:57.000+0000", "updated": "2018-04-04T14:29:57.000+0000" }, { "id": "436283", "author": { "name": "andy@asamicros.com", "key": "andy@asamicros.com", "displayName": "andy@asamicros.com", "active": true, "timeZone": "Europe/London" }, "body": "5C and 6C reporting same issue, although I don't know iOS version on these devices.", "updateAuthor": { "name": "andy@asamicros.com", "key": "andy@asamicros.com", "displayName": "andy@asamicros.com", "active": true, "timeZone": "Europe/London" }, "created": "2018-04-04T15:02:12.000+0000", "updated": "2018-04-04T15:02:12.000+0000" }, { "id": "436535", "author": { "name": "topener", "key": "topener", "displayName": "Rene Pot", "active": true, "timeZone": "Europe/Berlin" }, "body": "[~andy@asamicros.com] can you perhaps show a video of what exactly you see?", "updateAuthor": { "name": "topener", "key": "topener", "displayName": "Rene Pot", "active": true, "timeZone": "Europe/Berlin" }, "created": "2018-04-05T13:10:23.000+0000", "updated": "2018-04-05T13:10:23.000+0000" }, { "id": "436570", "author": { "name": "andy@asamicros.com", "key": "andy@asamicros.com", "displayName": "andy@asamicros.com", "active": true, "timeZone": "Europe/London" }, "body": "OK. Working on it. Is there a file size limit?", "updateAuthor": { "name": "andy@asamicros.com", "key": "andy@asamicros.com", "displayName": "andy@asamicros.com", "active": true, "timeZone": "Europe/London" }, "created": "2018-04-06T10:58:57.000+0000", "updated": "2018-04-06T10:58:57.000+0000" }, { "id": "436583", "author": { "name": "andy@asamicros.com", "key": "andy@asamicros.com", "displayName": "andy@asamicros.com", "active": true, "timeZone": "Europe/London" }, "body": "Attached a video. Yo can see that I have the modules cancel button, as well as the overlay button. Neither respond until the image is made to go black.", "updateAuthor": { "name": "andy@asamicros.com", "key": "andy@asamicros.com", "displayName": "andy@asamicros.com", "active": true, "timeZone": "Europe/London" }, "created": "2018-04-06T18:31:56.000+0000", "updated": "2018-04-06T18:31:56.000+0000" }, { "id": "437796", "author": { "name": "sdarda", "key": "sdarda", "displayName": "Sharif AbuDarda", "active": false, "timeZone": "Asia/Dhaka" }, "body": "Hello [~andy@asamicros.com], Can you please provide a sample code/project for us to test the issue in our end? Thanks.", "updateAuthor": { "name": "sdarda", "key": "sdarda", "displayName": "Sharif AbuDarda", "active": false, "timeZone": "Asia/Dhaka" }, "created": "2018-05-20T06:39:51.000+0000", "updated": "2018-05-20T06:39:51.000+0000" }, { "id": "437797", "author": { "name": "andy@asamicros.com", "key": "andy@asamicros.com", "displayName": "andy@asamicros.com", "active": true, "timeZone": "Europe/London" }, "body": "Sharif,\r\n\r\nAs I said in the description:\r\n'This is very easy to recreate using the example supplied with the module.'\r\n\r\n...Andy", "updateAuthor": { "name": "andy@asamicros.com", "key": "andy@asamicros.com", "displayName": "andy@asamicros.com", "active": true, "timeZone": "Europe/London" }, "created": "2018-05-20T08:33:49.000+0000", "updated": "2018-05-20T08:33:49.000+0000" }, { "id": "440604", "author": { "name": "rmitro", "key": "rmitro", "displayName": "Rakhi Mitro", "active": false, "timeZone": "America/Los_Angeles" }, "body": "Hello,\r\n\r\nAre you experiencing the issue now? Please let us know if you need more help on this.\r\n\r\nThanks", "updateAuthor": { "name": "rmitro", "key": "rmitro", "displayName": "Rakhi Mitro", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2018-08-09T10:47:58.000+0000", "updated": "2018-08-09T10:47:58.000+0000" }, { "id": "440608", "author": { "name": "andy@asamicros.com", "key": "andy@asamicros.com", "displayName": "andy@asamicros.com", "active": true, "timeZone": "Europe/London" }, "body": "I was not aware that there has been any changes done to this module, so I have not revisited this issue. I have been looking at alternative frameworks. Are you saying that this issue has been fixed and an update issued?", "updateAuthor": { "name": "andy@asamicros.com", "key": "andy@asamicros.com", "displayName": "andy@asamicros.com", "active": true, "timeZone": "Europe/London" }, "created": "2018-08-09T11:40:45.000+0000", "updated": "2018-08-09T11:40:45.000+0000" }, { "id": "440610", "author": { "name": "rmitro", "key": "rmitro", "displayName": "Rakhi Mitro", "active": false, "timeZone": "America/Los_Angeles" }, "body": "[~andy@asamicros.com],\r\nCan you please test it using latest SDK and let us know how it goes.\r\nThanks", "updateAuthor": { "name": "rmitro", "key": "rmitro", "displayName": "Rakhi Mitro", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2018-08-09T12:00:10.000+0000", "updated": "2018-08-09T12:00:10.000+0000" }, { "id": "440665", "author": { "name": "sdarda", "key": "sdarda", "displayName": "Sharif AbuDarda", "active": false, "timeZone": "Asia/Dhaka" }, "body": "Hello, Can you try with the latest module 2.0.1 version? There has a huge change in this. This was a iOS-only issue. Let us know. Thanks.", "updateAuthor": { "name": "sdarda", "key": "sdarda", "displayName": "Sharif AbuDarda", "active": false, "timeZone": "Asia/Dhaka" }, "created": "2018-08-11T16:57:36.000+0000", "updated": "2018-08-11T16:57:36.000+0000" }, { "id": "440709", "author": { "name": "sdarda", "key": "sdarda", "displayName": "Sharif AbuDarda", "active": false, "timeZone": "Asia/Dhaka" }, "body": "Hello [~andy@asamicros.com], Whats the status of your issue?", "updateAuthor": { "name": "sdarda", "key": "sdarda", "displayName": "Sharif AbuDarda", "active": false, "timeZone": "Asia/Dhaka" }, "created": "2018-08-13T19:18:50.000+0000", "updated": "2018-08-13T19:18:50.000+0000" }, { "id": "440732", "author": { "name": "andy@asamicros.com", "key": "andy@asamicros.com", "displayName": "andy@asamicros.com", "active": true, "timeZone": "Europe/London" }, "body": "Guys,\r\n\r\nPlease clarify what I'm testing here. Am I testing the latest SDK as per Rakhi Mitro comment, or am I testing an updated ti.barcode module?\r\nWhat versions of SDK does the barcode module support?\r\n\r\nIt will take a week or so to factor this into my current schedule.\r\n\r\nAs you are pressing me, does this mean that you guts have tested on iPhone 4,5,6 devices and have determined that all is OK?", "updateAuthor": { "name": "andy@asamicros.com", "key": "andy@asamicros.com", "displayName": "andy@asamicros.com", "active": true, "timeZone": "Europe/London" }, "created": "2018-08-14T08:46:00.000+0000", "updated": "2018-08-14T08:46:00.000+0000" }, { "id": "440738", "author": { "name": "topener", "key": "topener", "displayName": "Rene Pot", "active": true, "timeZone": "Europe/Berlin" }, "body": "[~andy@asamicros.com] we're asking if you still have the same issue with the latest ti.barcode release. There has been a big refactor.\r\n\r\nAlso we've never been able to reproduce the issue, therefore we're asking you to check it.", "updateAuthor": { "name": "topener", "key": "topener", "displayName": "Rene Pot", "active": true, "timeZone": "Europe/Berlin" }, "created": "2018-08-14T09:00:57.000+0000", "updated": "2018-08-14T09:06:55.000+0000" }, { "id": "440740", "author": { "name": "andy@asamicros.com", "key": "andy@asamicros.com", "displayName": "andy@asamicros.com", "active": true, "timeZone": "Europe/London" }, "body": "Is this because you have not tested on a real iPhone 4, 5, 6 or that using the exact same software versions that I have indicated works for you on these devices?\r\n\r\nIt would be helpful to know why you can't replicate the issue, indeed, it may be a pointer for moving forwards.", "updateAuthor": { "name": "andy@asamicros.com", "key": "andy@asamicros.com", "displayName": "andy@asamicros.com", "active": true, "timeZone": "Europe/London" }, "created": "2018-08-14T09:26:13.000+0000", "updated": "2018-08-14T09:26:13.000+0000" }, { "id": "440746", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "Quick interception here: We recently (last week) released a new version of Ti.Barcode that was rewritten from the scratch. Would you mind checking that version? You can download v2.0.1 [here|https://github.com/appcelerator-modules/ti.barcode/releases/tag/ios-2.0.1].", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2018-08-14T11:16:22.000+0000", "updated": "2018-08-14T11:16:22.000+0000" }, { "id": "441421", "author": { "name": "sdarda", "key": "sdarda", "displayName": "Sharif AbuDarda", "active": false, "timeZone": "Asia/Dhaka" }, "body": "Hello [~andy@asamicros.com], What's the status of your issue? Did you try the above solutions?", "updateAuthor": { "name": "sdarda", "key": "sdarda", "displayName": "Sharif AbuDarda", "active": false, "timeZone": "Asia/Dhaka" }, "created": "2018-09-08T16:09:25.000+0000", "updated": "2018-09-08T16:10:53.000+0000" }, { "id": "441422", "author": { "name": "andy@asamicros.com", "key": "andy@asamicros.com", "displayName": "andy@asamicros.com", "active": true, "timeZone": "Europe/London" }, "body": "I will be testing this in the coming week.", "updateAuthor": { "name": "andy@asamicros.com", "key": "andy@asamicros.com", "displayName": "andy@asamicros.com", "active": true, "timeZone": "Europe/London" }, "created": "2018-09-09T08:05:40.000+0000", "updated": "2018-09-09T08:05:40.000+0000" }, { "id": "441437", "author": { "name": "andy@asamicros.com", "key": "andy@asamicros.com", "displayName": "andy@asamicros.com", "active": true, "timeZone": "Europe/London" }, "body": "I can confirm that the module built with 7.3.1.GA has a working canvel button on the iOS device I am using (4S). We should be testing on a range of devices in a couple of weeks time.\r\n\r\n", "updateAuthor": { "name": "andy@asamicros.com", "key": "andy@asamicros.com", "displayName": "andy@asamicros.com", "active": true, "timeZone": "Europe/London" }, "created": "2018-09-10T10:39:07.000+0000", "updated": "2018-09-10T10:39:07.000+0000" }, { "id": "441469", "author": { "name": "andy@asamicros.com", "key": "andy@asamicros.com", "displayName": "andy@asamicros.com", "active": true, "timeZone": "Europe/London" }, "body": "The use of the switch camera button in the suppled demo on iOS causes the image to freeze on my 4S, hence no longer works. Can still works though.", "updateAuthor": { "name": "andy@asamicros.com", "key": "andy@asamicros.com", "displayName": "andy@asamicros.com", "active": true, "timeZone": "Europe/London" }, "created": "2018-09-11T09:06:54.000+0000", "updated": "2018-09-11T09:06:54.000+0000" }, { "id": "441470", "author": { "name": "andy@asamicros.com", "key": "andy@asamicros.com", "displayName": "andy@asamicros.com", "active": true, "timeZone": "Europe/London" }, "body": "On a Moto G running Android 7, the app freezes when a barcode is captured and keepOpen is false. If keepOpen is true, the capture is quite slow compared to iOS, but again freezes when the back button is pressed. If showCancel is true, no button is displayed.\r\nThis test and the prevous comment on iOS are using the latest versions, as far as i know. Android 4.0.1, and iOS 2.0.2, with ti 7.3.1.GA.\r\n", "updateAuthor": { "name": "andy@asamicros.com", "key": "andy@asamicros.com", "displayName": "andy@asamicros.com", "active": true, "timeZone": "Europe/London" }, "created": "2018-09-11T09:25:12.000+0000", "updated": "2018-09-11T09:25:12.000+0000" }, { "id": "441471", "author": { "name": "andy@asamicros.com", "key": "andy@asamicros.com", "displayName": "andy@asamicros.com", "active": true, "timeZone": "Europe/London" }, "body": "On my 4S, if the object passed to capture() has showRectangle : true, then the displayedMessage value is shown along with the rectangle, BUT the LED does not work - having set useLED : true. The LED flashes briefly.\r\n\r\nIf showRectangle : false, then no rectangle, the LED works, no rectangle, BUT no displayedMessage.\r\n\r\nMy previous comments on cancel are only valid for Barcode.cancel() calls. If showCancel is true, there is a problem. When capture is called and the device is in portrait orientation, the inbuilt cancel button does not respond UNTIL the device is rotated to landscape. If the device is rotated back to portrait, the button will respond.\r\n\r\nThere is also a rendering issue is the device is in landscape when the barcode.capture call is made. It corrects on rotation.\r\n\r\nHope this helps.\r\n", "updateAuthor": { "name": "andy@asamicros.com", "key": "andy@asamicros.com", "displayName": "andy@asamicros.com", "active": true, "timeZone": "Europe/London" }, "created": "2018-09-11T10:50:32.000+0000", "updated": "2018-09-11T10:50:32.000+0000" }, { "id": "442192", "author": { "name": "andy@asamicros.com", "key": "andy@asamicros.com", "displayName": "andy@asamicros.com", "active": true, "timeZone": "Europe/London" }, "body": "Any news on the cancel bug I mentioned for 2.0.2 as it still exists in 2.0.3\r\ni.e.\r\nMy previous comments on cancel are only valid for Barcode.cancel() calls. If showCancel is true, there is a problem. When capture is called and the device is in portrait orientation, the inbuilt cancel button does not respond UNTIL the device is rotated to landscape. If the device is rotated back to portrait, the button will respond.\r\n\r\n", "updateAuthor": { "name": "andy@asamicros.com", "key": "andy@asamicros.com", "displayName": "andy@asamicros.com", "active": true, "timeZone": "Europe/London" }, "created": "2018-10-01T09:50:24.000+0000", "updated": "2018-10-01T09:50:24.000+0000" }, { "id": "444188", "author": { "name": "morahman", "key": "morahman", "displayName": "Motiur Rahman", "active": true, "timeZone": "Asia/Dhaka" }, "body": "[~andy@asamicros.com] Can you check out this version v2.0.4. It has added functionality to prevent rotation of scanner\r\n- https://github.com/appcelerator-modules/ti.barcode/releases\r\n\r\nThanks!", "updateAuthor": { "name": "morahman", "key": "morahman", "displayName": "Motiur Rahman", "active": true, "timeZone": "Asia/Dhaka" }, "created": "2018-12-04T02:57:57.000+0000", "updated": "2018-12-04T02:57:57.000+0000" }, { "id": "444264", "author": { "name": "andy@asamicros.com", "key": "andy@asamicros.com", "displayName": "andy@asamicros.com", "active": true, "timeZone": "Europe/London" }, "body": "Have you addressed any of the other issues I have mentioned?", "updateAuthor": { "name": "andy@asamicros.com", "key": "andy@asamicros.com", "displayName": "andy@asamicros.com", "active": true, "timeZone": "Europe/London" }, "created": "2018-12-05T09:11:06.000+0000", "updated": "2018-12-05T09:11:06.000+0000" }, { "id": "444347", "author": { "name": "andy@asamicros.com", "key": "andy@asamicros.com", "displayName": "andy@asamicros.com", "active": true, "timeZone": "Europe/London" }, "body": "The cancel button behaviour is as before.\r\nBarcode.allowRotation = false appears not to do anything.", "updateAuthor": { "name": "andy@asamicros.com", "key": "andy@asamicros.com", "displayName": "andy@asamicros.com", "active": true, "timeZone": "Europe/London" }, "created": "2018-12-08T18:04:20.000+0000", "updated": "2018-12-08T18:04:20.000+0000" }, { "id": "444394", "author": { "name": "andy@asamicros.com", "key": "andy@asamicros.com", "displayName": "andy@asamicros.com", "active": true, "timeZone": "Europe/London" }, "body": "Using the app.js shipped with the module.\r\n\r\nSetup as follows:\r\nBarcode.allowRotation = false;\r\nBarcode.displayedMessage = 'Barcode in the box';\r\nBarcode.allowMenu = false;\r\nBarcode.allowInstructions = false;\r\nBarcode.useLED = true;\r\n\r\nUsing:\r\n\r\n Barcode.capture({\r\n animate: true,\r\n overlay: overlay,\r\n showCancel: true,\r\n showRectangle: true,\r\n keepOpen: false\r\n /*,\r\n acceptedFormats: [\r\n Barcode.FORMAT_QR_CODE\r\n ]*/\r\n });\r\n\r\nBarcode is scanned irrespective of orientation. I have tried both orientations of iphone as well as orientation of the barcode.\r\n\r\nAlso, change the orientation of the device, and the LED goes out.\r\n\r\nThe cancel button controlled by: showCancel: true does not work.\r\nPrevious versions worked after device was rotated, now it just does not work.\r\nThis is iOS 12.1 (16B92)", "updateAuthor": { "name": "andy@asamicros.com", "key": "andy@asamicros.com", "displayName": "andy@asamicros.com", "active": true, "timeZone": "Europe/London" }, "created": "2018-12-10T10:08:35.000+0000", "updated": "2018-12-10T10:24:58.000+0000" }, { "id": "444425", "author": { "name": "andy@asamicros.com", "key": "andy@asamicros.com", "displayName": "andy@asamicros.com", "active": true, "timeZone": "Europe/London" }, "body": "Where is the correct place to add an alert to the user after a scan?\r\n\r\nIf you add an alert in the success callback, you get a black screen which hides the alert.\r\n\r\nMy work around at the moment is the create a gotScan boolean value set to false before you call capture. Set gotScan = true in the success callback. Then check this gotScan value in the window focus event. This is based on the example code supplied with the module, and keepOpen set to false.\r\n\r\nOr is there a better place to do this?", "updateAuthor": { "name": "andy@asamicros.com", "key": "andy@asamicros.com", "displayName": "andy@asamicros.com", "active": true, "timeZone": "Europe/London" }, "created": "2018-12-10T16:09:45.000+0000", "updated": "2018-12-10T16:09:45.000+0000" }, { "id": "445184", "author": { "name": "vijaysingh", "key": "vijaysingh", "displayName": "Vijay Singh", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Add alert in success block after a time delay. \r\nSee the following example. Especially line no 205 to 225 -\r\n\r\n\r\n{code:java}\r\nvar Barcode = require('ti.barcode');\r\n \r\nBarcode.allowRotation = true;\r\nBarcode.displayedMessage = 'Place barcode inside rectangle';\r\nBarcode.allowMenu = false;\r\nBarcode.allowInstructions = true;\r\nBarcode.useLED = true;\r\n \r\nvar isiOS = Ti.Platform.osname === 'iphone' || Ti.Platform.osname === 'android';\r\nvar isAndroid = Ti.Platform.osname === 'android';\r\n \r\nvar window = Ti.UI.createWindow({\r\n backgroundColor: 'white'\r\n});\r\n \r\nvar scrollView = Ti.UI.createScrollView({\r\n contentWidth: 'auto',\r\n contentHeight: 'auto',\r\n top: 0,\r\n showVerticalScrollIndicator: true,\r\n layout: 'vertical'\r\n});\r\n \r\n/**\r\n * Create a chrome for the barcode scanner.\r\n */\r\nvar overlay = Ti.UI.createView({\r\n backgroundColor: 'transparent',\r\n top: 0,\r\n right: 0,\r\n bottom: 0,\r\n left: 0\r\n});\r\n \r\nvar switchButton = Ti.UI.createButton({\r\n title: Barcode.useFrontCamera ? 'Back Camera' : 'Front Camera',\r\n textAlign: 'center',\r\n color: '#000',\r\n backgroundColor: '#fff',\r\n style: 0,\r\n font: {\r\n fontWeight: 'bold',\r\n fontSize: 16\r\n },\r\n borderColor: '#000',\r\n borderRadius: 10,\r\n borderWidth: 1,\r\n opacity: 0.5,\r\n width: 220,\r\n height: 30,\r\n bottom: 10\r\n});\r\n \r\nswitchButton.addEventListener('click', function() {\r\n Barcode.useFrontCamera = !Barcode.useFrontCamera;\r\n switchButton.title = Barcode.useFrontCamera ? 'Back Camera' : 'Front Camera';\r\n});\r\n \r\noverlay.add(switchButton);\r\n \r\nvar cancelButton = Ti.UI.createButton({\r\n title: 'Cancel',\r\n textAlign: 'center',\r\n color: '#000',\r\n backgroundColor: '#fff',\r\n style: 0,\r\n font: {\r\n fontWeight: 'bold',\r\n fontSize: 16\r\n },\r\n borderColor: '#000',\r\n borderRadius: 10,\r\n borderWidth: 1,\r\n opacity: 0.5,\r\n width: 220,\r\n height: 30,\r\n top: 20\r\n});\r\ncancelButton.addEventListener('click', function() {\r\n Barcode.cancel();\r\n});\r\noverlay.add(cancelButton);\r\n \r\n/**\r\n * Create a button that will trigger the barcode scanner.\r\n */\r\nvar scanCode = Ti.UI.createButton({\r\n title: 'Scan the Code',\r\n width: 150,\r\n height: 60,\r\n top: 20\r\n});\r\n \r\nvar cameraPermission = function(callback) {\r\n if (isAndroid) {\r\n if (Ti.Media.hasCameraPermissions()) {\r\n if (callback) {\r\n callback(true);\r\n }\r\n } else {\r\n Ti.Media.requestCameraPermissions(function(e) {\r\n if (e.success) {\r\n if (callback) {\r\n callback(true);\r\n }\r\n } else {\r\n if (callback) {\r\n callback(false);\r\n }\r\n alert('No camera permission');\r\n }\r\n });\r\n }\r\n }\r\n \r\n if (isiOS) {\r\n if (callback) {\r\n callback(true);\r\n }\r\n }\r\n};\r\n \r\nscanCode.addEventListener('click', function() {\r\n cameraPermission(function(re) {\r\n reset();\r\n // Note: while the simulator will NOT show a camera stream in the simulator, you may still call \"Barcode.capture\"\r\n // to test your barcode scanning overlay.\r\n Barcode.capture({\r\n animate: true,\r\n overlay: overlay,\r\n showCancel: false,\r\n showRectangle: false,\r\n keepOpen: false\r\n /*,\r\n acceptedFormats: [\r\n Barcode.FORMAT_QR_CODE\r\n ]*/\r\n });\r\n });\r\n});\r\nscrollView.add(scanCode);\r\n \r\n \r\n/**\r\n * Create a button that will show the gallery picker.\r\n */\r\nvar scanImage = Ti.UI.createButton({\r\n title: 'Scan Image from Gallery',\r\n width: 150,\r\n height: 60,\r\n top: 20\r\n});\r\n \r\nscanImage.addEventListener('click', function() {\r\n reset();\r\n Ti.Media.openPhotoGallery({\r\n success: function(evt) {\r\n Barcode.parse({\r\n image: evt.media\r\n /*,\r\n acceptedFormats: [\r\n Barcode.FORMAT_QR_CODE\r\n ]*/\r\n });\r\n }\r\n });\r\n});\r\n \r\nscrollView.add(scanImage);\r\n \r\n/**\r\n * Now listen for various events from the Barcode module. This is the module's way of communicating with us.\r\n */\r\n \r\nvar scannedBarcodes = {},\r\n scannedBarcodesCount = 0;\r\n \r\nfunction reset() {\r\n scannedBarcodes = {};\r\n scannedBarcodesCount = 0;\r\n cancelButton.title = 'Cancel';\r\n \r\n scanResult.text = ' ';\r\n scanContentType.text = ' ';\r\n scanFormat.text = ' ';\r\n scanParsed.text = ' ';\r\n}\r\n \r\nBarcode.addEventListener('error', function(e) {\r\n scanContentType.text = ' ';\r\n scanFormat.text = ' ';\r\n scanParsed.text = ' ';\r\n scanResult.text = e.message;\r\n console.log('An Error occured: ' + e);\r\n});\r\n \r\nBarcode.addEventListener('cancel', function(e) {\r\n Ti.API.info('Cancel received');\r\n});\r\n \r\nvar alert = Ti.UI.createAlertDialog();\r\n\r\nBarcode.addEventListener('success', function(e) {\r\n Ti.API.info('Success called with barcode: ' + e.result);\r\n if (!scannedBarcodes['' + e.result]) {\r\n scannedBarcodes[e.result] = true;\r\n scannedBarcodesCount += 1;\r\n cancelButton.title = 'Finished (' + scannedBarcodesCount + ' Scanned)';\r\n \r\n scanResult.text += e.result + ' ';\r\n scanContentType.text += parseContentType(e.contentType) + ' ';\r\n scanFormat.text += e.format + ' ';\r\n scanParsed.text += parseResult(e) + ' ';\r\n }\r\n // break it with an alert\r\n var message = 'Found barcode as ' + e.result;\r\n setTimeout(function(e){ \r\n alert['title'] = message;\r\n alert.show();\r\n }, 1000);\r\n});\r\n \r\n/**\r\n * Finally, we'll add a couple labels to the window. When the user scans a barcode, we'll stick information about it in\r\n * to these labels.\r\n */\r\nscrollView.add(Ti.UI.createLabel({\r\n text: 'You may need to rotate the device',\r\n top: 10,\r\n height: Ti.UI.SIZE || 'auto',\r\n width: Ti.UI.SIZE || 'auto'\r\n}));\r\n \r\nscrollView.add(Ti.UI.createLabel({\r\n text: 'Result: ',\r\n textAlign: 'left',\r\n top: 10,\r\n left: 10,\r\n color: 'black',\r\n height: Ti.UI.SIZE || 'auto'\r\n}));\r\n \r\nvar scanResult = Ti.UI.createLabel({\r\n text: ' ',\r\n textAlign: 'left',\r\n top: 10,\r\n left: 10,\r\n color: 'black',\r\n height: Ti.UI.SIZE || 'auto'\r\n});\r\n \r\nscrollView.add(scanResult);\r\n \r\nscrollView.add(Ti.UI.createLabel({\r\n text: 'Content Type: ',\r\n top: 10,\r\n left: 10,\r\n textAlign: 'left',\r\n color: 'black',\r\n height: Ti.UI.SIZE || 'auto'\r\n}));\r\n \r\nvar scanContentType = Ti.UI.createLabel({\r\n text: ' ',\r\n textAlign: 'left',\r\n top: 10,\r\n left: 10,\r\n color: 'black',\r\n height: Ti.UI.SIZE || 'auto'\r\n});\r\n \r\nscrollView.add(scanContentType);\r\n \r\nscrollView.add(Ti.UI.createLabel({\r\n text: 'Format: ',\r\n textAlign: 'left',\r\n top: 10,\r\n left: 10,\r\n color: 'black',\r\n height: Ti.UI.SIZE || 'auto'\r\n}));\r\n \r\nvar scanFormat = Ti.UI.createLabel({\r\n text: ' ',\r\n textAlign: 'left',\r\n top: 10,\r\n left: 10,\r\n color: 'black',\r\n height: Ti.UI.SIZE || 'auto'\r\n});\r\n \r\nscrollView.add(scanFormat);\r\n \r\nscrollView.add(Ti.UI.createLabel({\r\n text: 'Parsed: ',\r\n textAlign: 'left',\r\n top: 10,\r\n left: 10,\r\n color: 'black',\r\n height: Ti.UI.SIZE || 'auto'\r\n}));\r\n \r\nvar scanParsed = Ti.UI.createLabel({\r\n text: ' ',\r\n textAlign: 'left',\r\n top: 10,\r\n left: 10,\r\n color: 'black',\r\n height: Ti.UI.SIZE || 'auto'\r\n});\r\n \r\nscrollView.add(scanParsed);\r\n \r\nfunction parseContentType(contentType) {\r\n switch (contentType) {\r\n case Barcode.URL:\r\n return 'URL';\r\n case Barcode.SMS:\r\n return 'SMS';\r\n case Barcode.TELEPHONE:\r\n return 'TELEPHONE';\r\n case Barcode.TEXT:\r\n return 'TEXT';\r\n case Barcode.CALENDAR:\r\n return 'CALENDAR';\r\n case Barcode.GEOLOCATION:\r\n return 'GEOLOCATION';\r\n case Barcode.EMAIL:\r\n return 'EMAIL';\r\n case Barcode.CONTACT:\r\n return 'CONTACT';\r\n case Barcode.BOOKMARK:\r\n return 'BOOKMARK';\r\n case Barcode.WIFI:\r\n return 'WIFI';\r\n default:\r\n return 'UNKNOWN';\r\n }\r\n}\r\n \r\nfunction parseResult(event) {\r\n var msg = '';\r\n switch (event.contentType) {\r\n case Barcode.URL:\r\n msg = 'URL = ' + event.result;\r\n break;\r\n case Barcode.SMS:\r\n msg = 'SMS = ' + JSON.stringify(event.data);\r\n break;\r\n case Barcode.TELEPHONE:\r\n msg = 'Telephone = ' + event.data.phonenumber;\r\n break;\r\n case Barcode.TEXT:\r\n msg = 'Text = ' + event.result;\r\n break;\r\n case Barcode.CALENDAR:\r\n msg = 'Calendar = ' + JSON.stringify(event.data);\r\n break;\r\n case Barcode.GEOLOCATION:\r\n msg = 'Geo = ' + JSON.stringify(event.data);\r\n break;\r\n case Barcode.EMAIL:\r\n msg = 'Email = ' + event.data.email + '\\nSubject = ' + event.data.subject + '\\nMessage = ' + event.data.message;\r\n break;\r\n case Barcode.CONTACT:\r\n msg = 'Contact = ' + JSON.stringify(event.data);\r\n break;\r\n case Barcode.BOOKMARK:\r\n msg = 'Bookmark = ' + JSON.stringify(event.data);\r\n break;\r\n case Barcode.WIFI:\r\n return 'WIFI = ' + JSON.stringify(event.data);\r\n default:\r\n msg = 'unknown content type';\r\n break;\r\n }\r\n return msg;\r\n}\r\nwindow.add(scrollView);\r\nwindow.open();\r\n\r\n{code}\r\n", "updateAuthor": { "name": "vijaysingh", "key": "vijaysingh", "displayName": "Vijay Singh", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2019-01-10T15:59:19.000+0000", "updated": "2019-01-10T15:59:19.000+0000" }, { "id": "454928", "author": { "name": "vgoyal", "key": "vgoyal", "displayName": "Vikas Goyal", "active": true, "timeZone": "America/Los_Angeles" }, "updateAuthor": { "name": "vgoyal", "key": "vgoyal", "displayName": "Vikas Goyal", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2020-04-01T12:43:16.000+0000", "updated": "2020-04-01T12:43:45.000+0000" }, { "id": "454965", "author": { "name": "smohammed", "key": "smohammed", "displayName": "Samir Mohammed", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Closing ticket, able to cancel scanning when running on Sim and device (note sometimes device scans quickly before user gets chance to cancel). ", "updateAuthor": { "name": "smohammed", "key": "smohammed", "displayName": "Samir Mohammed", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2020-04-03T14:58:02.000+0000", "updated": "2020-04-03T14:58:02.000+0000" } ], "maxResults": 42, "total": 42, "startAt": 0 } } }