[MOD-2478] iOS: Cancel does not work on ti.barcode when scanning
GitHub Issue | n/a |
Type | Bug |
Priority | Critical |
Status | Closed |
Resolution | Cannot Reproduce |
Resolution Date | 2020-04-03T14:58:23.000+0000 |
Affected Version/s | n/a |
Fix Version/s | n/a |
Components | n/a |
Labels | 2020-Q2, ios |
Reporter | andy@asamicros.com |
Assignee | Vikas Goyal |
Created | 2018-04-04T09:02:07.000+0000 |
Updated | 2020-04-03T14:58:27.000+0000 |
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.
This is very easy to recreate using the example supplied with the module.
Attachments
[~andy@asamicros.com] attached is a video I just created using the sample provided. Cancel works immediately as you can see. This is on an iPhone 8 device, using TiSDK 7.1.0.GA and Alloy 1.11 and ti.barcode 1.10.1 Can you give me more info?
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.
5C and 6C reporting same issue, although I don't know iOS version on these devices.
[~andy@asamicros.com] can you perhaps show a video of what exactly you see?
OK. Working on it. Is there a file size limit?
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.
Hello [~andy@asamicros.com], Can you please provide a sample code/project for us to test the issue in our end? Thanks.
Sharif, As I said in the description: 'This is very easy to recreate using the example supplied with the module.' ...Andy
Hello, Are you experiencing the issue now? Please let us know if you need more help on this. Thanks
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?
[~andy@asamicros.com], Can you please test it using latest SDK and let us know how it goes. Thanks
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.
Hello [~andy@asamicros.com], Whats the status of your issue?
Guys, Please 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? What versions of SDK does the barcode module support? It will take a week or so to factor this into my current schedule. As 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?
[~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. Also we've never been able to reproduce the issue, therefore we're asking you to check it.
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? It would be helpful to know why you can't replicate the issue, indeed, it may be a pointer for moving forwards.
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).
Hello [~andy@asamicros.com], What's the status of your issue? Did you try the above solutions?
I will be testing this in the coming week.
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.
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.
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. This 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.
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. If showRectangle : false, then no rectangle, the LED works, no rectangle, BUT no displayedMessage. My 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. There is also a rendering issue is the device is in landscape when the barcode.capture call is made. It corrects on rotation. Hope this helps.
Any news on the cancel bug I mentioned for 2.0.2 as it still exists in 2.0.3 i.e. My 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.
[~andy@asamicros.com] Can you check out this version v2.0.4. It has added functionality to prevent rotation of scanner - https://github.com/appcelerator-modules/ti.barcode/releases Thanks!
Have you addressed any of the other issues I have mentioned?
The cancel button behaviour is as before. Barcode.allowRotation = false appears not to do anything.
Using the app.js shipped with the module. Setup as follows: Barcode.allowRotation = false; Barcode.displayedMessage = 'Barcode in the box'; Barcode.allowMenu = false; Barcode.allowInstructions = false; Barcode.useLED = true; Using: Barcode.capture({ animate: true, overlay: overlay, showCancel: true, showRectangle: true, keepOpen: false /*, acceptedFormats: [ Barcode.FORMAT_QR_CODE ]*/ }); Barcode is scanned irrespective of orientation. I have tried both orientations of iphone as well as orientation of the barcode. Also, change the orientation of the device, and the LED goes out. The cancel button controlled by: showCancel: true does not work. Previous versions worked after device was rotated, now it just does not work. This is iOS 12.1 (16B92)
Where is the correct place to add an alert to the user after a scan? If you add an alert in the success callback, you get a black screen which hides the alert. My 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. Or is there a better place to do this?
Add alert in success block after a time delay. See the following example. Especially line no 205 to 225 -
Closing ticket, able to cancel scanning when running on Sim and device (note sometimes device scans quickly before user gets chance to cancel).