Titanium JIRA Archive
Appcelerator Modules (MOD)

[MOD-1909] iOS: Ti.Barcode Rotation issue

GitHub Issuen/a
TypeBug
PriorityCritical
StatusClosed
ResolutionFixed
Resolution Date2017-08-10T06:24:30.000+0000
Affected Version/sn/a
Fix Version/sTi.Barcode 1.10.1
ComponentsBarcode
LabelsTCSupport
ReporterIsaac Payne
AssigneeVijay Singh
Created2014-06-12T00:02:20.000+0000
Updated2018-08-06T17:49:30.000+0000

Description

Problem Description

I'm having an issue with the Ti.Barcode module where when the device is rotated the barcode scanning screen rotates also, even though device orientation is set to Ti.UI.PORTRAIT in the tiapp.xml file

TESTING ENVIRONMENT

Ti CLI 3.3.0 Titanium SDK: 3.3.0.GA and 3.2.X.GA iPhone and iPad Device

TEST CODE

  
 var Barcode = require('ti.barcode');
Barcode.allowRotation = true;
Barcode.displayedMessage = '';
Barcode.useLED = true;

var window = Ti.UI.createWindow({
	backgroundColor : 'white'
});
var scrollView = Ti.UI.createScrollView({
	contentWidth : 'auto',
	contentHeight : 'auto',
	top : 0,
	showVerticalScrollIndicator : true,
	layout : 'vertical'
});

var scanCode = Ti.UI.createButton({
	title : 'Scan Code',
	width : 200,
	height : 60,
	top : 20
});

scanCode.addEventListener('click', function() {

	Barcode.capture({
		animate : true,
		showCancel : false,
		showRectangle : false,
		keepOpen : true
	});
});
scrollView.add(scanCode);



window.add(scrollView);
window.open(); 
 
 ~~~~~~~~~~~~~~~~~~
<iphone>
<orientations device="iphone">
<orientation>Ti.UI.PORTRAIT</orientation>
</orientations>
<orientations device="ipad">
<orientation>Ti.UI.PORTRAIT</orientation>
</orientations>
</iphone>
 
<modules>
<module platform="iphone">ti.barcode</module>
</modules>
 ~~~~~~~~~~~

STEP TO TEST

- Create a new project - Update "app.js" file with "app.js" code segment given above. - Download the barcode module zip file [ti.barcode-iphone-1.8.3.zip](https://github.com/appcelerator/titanium_modules/blob/master/barcode/mobile/ios/ti.barcode-iphone-1.8.3.zip?raw=true) - Extract the zip file, copy the module folder to your app - Include "tiapp.xml" code segment given above to the "tiapp.xml" file - Run the app in iPhone or iPad device. - Touch "scan Code" to see the barcode scanning screen - Rotate the device and see problem

OBSERVED RESULT

Rotating the device is causing the rotation of barcode scanning screen, even though the orientation was fixed to portrait.

Attachments

FileDateSize
BarcodeBug.png2014-06-12T00:02:20.000+0000281359
Scanner_rotation.png2014-10-20T16:13:53.000+0000245626

Comments

  1. Isaac Payne 2014-06-26

    Any updates here? It's been over 2 weeks with no reply.
  2. Mauro Parra-Miranda 2014-07-21

    Thanks for your report! The MOD team will set the priority here.
  3. Jon Alter 2014-10-20

    It looks like this issue is in the ZXing lib and may be solved by updating to the latest version via TIMODOPEN-219
  4. Hector Santos 2014-10-28

    Anybody knows how solve this problem? I have it too.
  5. benjamin 2014-12-14

    Hello, I found a correction for this problem : http://exygy.com/how-to-modify-ti-barcode-to-correct-two-annoying-behaviors-in-ios-and-android/ If it can be help ! Regards.
  6. John V Pataki 2015-01-30

    This rotation issue has a very good chance at being a problem that exists and needs to be solved within the glue between the lib and titanium vs being something that is solved just by an upgrade to the lib version. Jon Alter, what is your source / reference for your comment about thinking it is a problem with the ZXing lib so we can better understand this?
  7. Zsombor Papp 2015-02-25

    I can confirm that this problem still exists with the latest version, 1.9.1. In addition, I noticed three other, even more severe issues: 1) When an overlay is not specified, the camera preview comes solid black the first time the app is started. If I put the app into the background and immediately bring it back up, the camera preview works as expected. 2) Overlay touch events and orientation change events are only processed when there is a barcode in front of the camera. This means that the buttons on the overlay as well as the overlay orientation seem to be frozen until a barcode comes into focus of the camera, at which point they are retroactively processed. 3) When the camera preview and overlay are rotated into landscape mode, their dimensions don't update to landscape mode so part of the screen will be black and part of the overlay will be off screen. I am not sure if these are all new problems; you can see problem #3 in the screenshots attached to the description back in June so obviously that's not a new problem. Considering these problems, it seems to me fixing just the rotation issue is not going to make this module useable. Are we being asked to fix all these problems? If so, I would like to update the description of this JIRA ticket, or perhaps other one, MOD-1998, to make this objective clear. Also, with regards to problem #3, is disabling orientation changes altogether an acceptable solution, or do we expect the module to support landscape orientation depending on configuration?
  8. John V Pataki 2015-03-21

    [~egomez], [~rblalock] Please review Zsombor's comments made on the 24th of Feb and provide your response along with direction, expectations and priority.
  9. Motiur Rahman 2016-05-31

    Hello!, [~cng], I have tested that module and getting the same behaviour as like [~zpapp] (previous comment). My testing env: Appc CLI 5.2.2 Module Version: 1.9.1 Titanium SDK: 5.2.2.GA iPhone device version: v 9.3.2 Any updates or workaround for this issue?
  10. Hans Knöchel 2017-04-10

    [~vijaysingh] Ti.Barcode was revived from the archive, do you want to take a look into this issue? Looks *very* related to the camera overlay issue on Ti.Media recently, so a quick fix. Thanks!
  11. Vijay Singh 2017-04-12

    I tried with latest ti.barcode (1.10.0) module. It is working fine to me . [~ewieber] Can you please verify once and let me know , if issue is still reproducible at your end. Thanks.
  12. Hans Knöchel 2017-04-14

    I am able to reproduce it with latest master (1.10.0), see the [attached example](https://www.dropbox.com/s/cs08b3xhabmivqz/test_barcode.zip?dl=1) project for details.
  13. Vijay Singh 2017-04-18

    PR: https://github.com/appcelerator-modules/ti.barcode/pull/53 Test Case :
        var Barcode = require('ti.barcode');
        
        var window = Ti.UI.createWindow({
           backgroundColor : 'white'
        });
        var scrollView = Ti.UI.createScrollView({
           contentWidth : 'auto',
           contentHeight : 'auto',
           top : 0,
           showVerticalScrollIndicator : true,
           layout : 'vertical'
        });
        
        var scanCode = Ti.UI.createButton({
           title : 'Scan Code',
           width : 200,
           height : 60,
           top : 20
        });
        
        scanCode.addEventListener('click', function() {
        
           Barcode.capture();
        });
        scrollView.add(scanCode);
        
        window.add(scrollView);
        window.open(); 
        
  14. Hans Knöchel 2017-08-10

    [~vijaysingh] Please also draft the new release 1.10.1 on Github.
  15. Vijay Singh 2017-08-22

    In addition to above PR there is minor fix for build in PR - https://github.com/appcelerator-modules/ti.barcode/pull/54 [~hknoechel] Can you please review the same. Thanks.
  16. Eric Merriman 2018-08-06

    Cleaning up older fixed issues. If this issue should not have been closed as fixed, please reopen.

JSON Source