[MOD-2445] ti.barcode iOS : Camera overlay view randomly disappear after a period of time if you leave the scanner open but don't scan a code
| GitHub Issue | n/a |
|---|---|
| Type | Bug |
| Priority | None |
| Status | Resolved |
| Resolution | Fixed |
| Resolution Date | 2018-08-13T07:05:51.000+0000 |
| Affected Version/s | n/a |
| Fix Version/s | Ti.Barcode iOS 2.0.1 |
| Components | Barcode |
| Labels | iOS |
| Reporter | Vijay Singh |
| Assignee | Vijay Singh |
| Created | 2018-08-06T09:58:00.000+0000 |
| Updated | 2018-08-13T07:05:51.000+0000 |
Description
As discussed [here| https://github.com/appcelerator-modules/ti.barcode/issues/77] camera overlay view randomly disappear after a period of time if you leave the scanner open but don't scan a code.
Sometimes 5 seconds after opening, other times up to a minute, very random. Thought it might have been to do with touch or orientation, but have been unable to reproduce it reliably.
var Barcode = require('ti.barcode'); Barcode.allowRotation = false; Barcode.useLED = false; var $ = this; $.capture = function() { var overlay = Ti.UI.createView({ backgroundColor: 'red', opacity: 0.4 }); Barcode.capture({ animate: false, overlay: overlay, showCancel: false, showRectangle: false, keepOpen: false, allowMenu: false, allowInstructions: false }); }; $.openScanner = function() { $.capture(); }; $.closeScanner = function() { Barcode.cancel(); }; $.showResult = function(e) { console.log(JSON.stringify(e)); }; Barcode.addEventListener('success', $.showResult); $.openScanner();It is probably GC'd, so we need to retain it's proxy status with
rememberProxyandforgetProxy(later) in [here](https://github.com/appcelerator-modules/ti.barcode/blob/master/ios/Classes/TiBarcodeModule.m#L81), similar to overlays in [Ti.Media.showCamera(args)](https://github.com/appcelerator/titanium_mobile/blob/master/iphone/Classes/MediaModule.m#L938).You are right [~hknoechel]. PR - https://github.com/appcelerator-modules/ti.barcode/pull/78 [~jfinnigan] Can you please verify using [Pre-release 2.0.1| https://github.com/appcelerator-modules/ti.barcode/releases/tag/ios-2.0.1]
Overlays are no longer disappearing! However, any onClick events on the overlays aren't firing, these were working previously, however may have been pre-2.0.0 rather than an new bug introduced with this fix?
Click event on any button on overlay view is firing. But it is not firing from overlay itself. It is not due to this change but it is from 2.0.0. Before 2.0.0 it's working fine. I'll look in this. Thanks for reporting [~jfinnigan].
Fixed the overlay 'click' event issue and updated the [Pre-release 2.0.1](https://github.com/appcelerator-modules/ti.barcode/releases/tag/ios-2.0.1) .