[TIMOB-23213] Hyperloop: Android doesn't convert char/char[]/Character
| GitHub Issue | n/a |
|---|---|
| Type | Bug |
| Priority | Critical |
| Status | Closed |
| Resolution | Fixed |
| Resolution Date | 2016-04-27T16:18:35.000+0000 |
| Affected Version/s | n/a |
| Fix Version/s | Release 5.4.0 |
| Components | Hyperloop |
| Labels | android, hyperloop |
| Reporter | Hans Knöchel |
| Assignee | Christopher Williams |
| Created | 2016-04-14T14:53:48.000+0000 |
| Updated | 2016-08-03T00:05:46.000+0000 |
Description
We have no conversion of char/char[]/Character in our Kroll/V8 bridge - and we don't handle this special in our hyperloop code - so I assume right now it'll try to wrap in a hyperloop proxy and fail miserably.
From discussion on https://github.com/appcelerator/hyperloop.next/pull/16
Ideally I think we should:
- accept a JS String for any argument/field that accepts Character/char/char[]
- if the string is for a single char/Character and has more than one character, we should take the first char of the string and spit out a nasty warning in the log.
- When a method/field returns a char/char[]/Character, convert it into a Java String and the bridge will convert that to a JS string for us.
Closing ticket as fixed. Verified Hyperloop with Android is able to convert char/char[]/Character. Use the following Alloy code:
Tested on: Appc CLI NPM: 4.2.7 Appc CLI Core: 5.4.0-37 Arrow: 1.8.2 SDK: 5.4.0.v20160801022303 Node: v4.4.7 OS: Mac OS X (10.11.6) Device: Genymotion Emulator (5.1.0)var String = require('java.lang.String'), Character = require('java.lang.Character'); var single = new String('d'), longString = new String('monkey lord'), arrayOfChars = new String(['b', 'o', 'b']); function doClick(e) { Ti.API.info('### ' + single.charAt(0)); Ti.API.info('### ' + longString.toCharArray()); Ti.API.info('### ' + arrayOfChars.toUpperCase()); Ti.API.info('### ' + Character.valueOf('B')); Ti.API.info('### ' + Character.toUpperCase('z')); Ti.API.info('### ' + Character.toLowerCase('BOB')); // spits out error } $.index.open();