{ "id": "172092", "key": "MOD-2453", "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": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2020-12-16T18:32:14.000+0000", "created": "2018-08-20T04:55:31.000+0000", "priority": { "name": "None", "id": "6" }, "labels": [ "iOS" ], "versions": [], "issuelinks": [], "assignee": { "name": "vijaysingh", "key": "vijaysingh", "displayName": "Vijay Singh", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2020-12-16T18:32:14.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": [ { "id": "14511", "name": "Barcode" } ], "description": " As discussed [here|https://github.com/appcelerator-modules/ti.barcode/issues/79] custom displayedMessage string it is no longer displayed.\r\nThe default message is displayed: \"Place the barcode inside the rectangle to scan it.\"", "attachment": [], "flagged": false, "summary": "ti.barcode iOS : displayedMessage property is not working ", "creator": { "name": "vijaysingh", "key": "vijaysingh", "displayName": "Vijay Singh", "active": true, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "vijaysingh", "key": "vijaysingh", "displayName": "Vijay Singh", "active": true, "timeZone": "America/Los_Angeles" }, "environment": null, "comment": { "comments": [ { "id": "440905", "author": { "name": "vijaysingh", "key": "vijaysingh", "displayName": "Vijay Singh", "active": true, "timeZone": "America/Los_Angeles" }, "body": "https://github.com/appcelerator-modules/ti.barcode/pull/80\r\n\r\n\r\n{code:java}\r\n/**\r\n * In this example, we'll use the Barcode module to display some information about\r\n * the scanned barcode.\r\n */\r\nvar Barcode = require('ti.barcode');\r\nBarcode.displayedMessage = 'Custom Barcode message';\r\n\r\nvar window = Ti.UI.createWindow({\r\n backgroundColor: 'white'\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, right: 0, bottom: 0, left: 0\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', backgroundColor: '#fff', style: 0,\r\n font: { fontWeight: 'bold', fontSize: 16 },\r\n borderColor: '#000', borderRadius: 10, borderWidth: 1,\r\n opacity: 0.5,\r\n width: 220, height: 30,\r\n bottom: 10\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\noverlay.add(switchButton);\r\n\r\nvar toggleLEDButton = Ti.UI.createButton({\r\n title: Barcode.useLED ? 'LED is On' : 'LED is Off',\r\n textAlign: 'center',\r\n color: '#000', backgroundColor: '#fff', style: 0,\r\n font: { fontWeight: 'bold', fontSize: 16 },\r\n borderColor: '#000', borderRadius: 10, borderWidth: 1,\r\n opacity: 0.5,\r\n width: 220, height: 30,\r\n bottom: 40\r\n});\r\ntoggleLEDButton.addEventListener('click', function () {\r\n Barcode.useLED = !Barcode.useLED;\r\n toggleLEDButton.title = Barcode.useLED ? 'LED is On' : 'LED is Off';\r\n});\r\noverlay.add(toggleLEDButton);\r\n\r\nvar cancelButton = Ti.UI.createButton({\r\n title: 'Cancel', textAlign: 'center',\r\n color: '#000', backgroundColor: '#fff', style: 0,\r\n font: { fontWeight: 'bold', fontSize: 16 },\r\n borderColor: '#000', borderRadius: 10, borderWidth: 1,\r\n opacity: 0.5,\r\n width: 220, 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 Code1',\r\n width: 200,\r\n height: 60,\r\n top: 20\r\n});\r\nscanCode.addEventListener('click', function () {\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: true,\r\n keepOpen: true/*,\r\n acceptedFormats: [\r\n Barcode.FORMAT_QR_CODE\r\n ]*/\r\n });\r\n});\r\nscrollView.add(scanCode);\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: 200, height: 60, top: 20\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 acceptedFormats: [\r\n Barcode.FORMAT_QR_CODE\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\nvar scannedBarcodes = {}, scannedBarcodesCount = 0;\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 scanParsed.text = ' ';\r\n}\r\nBarcode.addEventListener('error', function (e) {\r\n scanContentType.text = ' ';\r\n scanParsed.text = ' ';\r\n scanResult.text = e.message;\r\n});\r\nBarcode.addEventListener('cancel', function (e) {\r\n Ti.API.info('Cancel received');\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 scanParsed.text += parseResult(e) + ' ';\r\n }\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', width: Ti.UI.SIZE || 'auto'\r\n}));\r\n\r\nscrollView.add(Ti.UI.createLabel({\r\n text: 'Result: ', textAlign: 'left',\r\n top: 10, left: 10,\r\n color: 'black',\r\n height: Ti.UI.SIZE || 'auto'\r\n}));\r\nvar scanResult = Ti.UI.createLabel({\r\n text: ' ', textAlign: 'left',\r\n top: 10, left: 10,\r\n color: 'black',\r\n height: Ti.UI.SIZE || 'auto'\r\n});\r\nscrollView.add(scanResult);\r\n\r\nscrollView.add(Ti.UI.createLabel({\r\n text: 'Content Type: ',\r\n top: 10, left: 10,\r\n textAlign: 'left',\r\n color: 'black',\r\n height: Ti.UI.SIZE || 'auto'\r\n}));\r\nvar scanContentType = Ti.UI.createLabel({\r\n text: ' ', textAlign: 'left',\r\n top: 10, left: 10,\r\n color: 'black',\r\n height: Ti.UI.SIZE || 'auto'\r\n});\r\nscrollView.add(scanContentType);\r\n\r\nscrollView.add(Ti.UI.createLabel({\r\n text: 'Parsed: ', textAlign: 'left',\r\n top: 10, left: 10,\r\n color: 'black',\r\n height: Ti.UI.SIZE || 'auto'\r\n}));\r\nvar scanParsed = Ti.UI.createLabel({\r\n text: ' ', textAlign: 'left',\r\n top: 10, left: 10,\r\n color: 'black',\r\n height: Ti.UI.SIZE || 'auto'\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 = 'Latitude = ' + event.data.latitude + '\\nLongitude = ' + event.data.longitude;\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\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": "2018-08-21T04:48:48.000+0000", "updated": "2018-08-21T04:54:19.000+0000" } ], "maxResults": 2, "total": 2, "startAt": 0 } } }