[ALOY-1720] Version string comparison will break for SDK 10.0.0
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | High |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2020-08-13T15:36:10.000+0000 |
Affected Version/s | n/a |
Fix Version/s | CLI Release 8.1.0 |
Components | n/a |
Labels | alloy, sdk, version |
Reporter | Joshua Quick |
Assignee | Ewan Harris |
Created | 2020-02-15T02:52:02.000+0000 |
Updated | 2020-08-13T15:36:10.000+0000 |
Description
*Summary:*
There are places in Alloy's code which compares Titanium SDK versions by string. While this works for now, this will eventually break when the Titanium version has been update to 10.0.0.
*Example:*
if (Ti.version >= '8.0.0') {
// Will NOT land here if version is 10.0.0 or higher. (This is the bug.)
}
*Areas To Be Fixed:*
https://github.com/appcelerator/alloy/blob/master/Alloy/template/lib/alloy.js
var MW320_CHECK = OS_MOBILEWEB && TI_VERSION >= '3.2.0';
var IDENTITY_TRANSFORM = OS_ANDROID ? (Ti.version >= '8.0.0' ? Ti.UI.createMatrix2D() : Ti.UI.create2DMatrix()) : undefined;
https://github.com/appcelerator/alloy/blob/master/Alloy/builtins/animation.js
const create3DMatrix = Ti.version >= '8.0.0' ? Ti.UI.createMatrix3D : Ti.UI.create3DMatrix;
const create2DMatrix = Ti.version >= '8.0.0' ? Ti.UI.createMatrix2D : Ti.UI.create2DMatrix;
*Solution:*
Use semver gte()
method instead.
PR: https://github.com/appcelerator/alloy/pull/960
Test steps: Use the [builtins sample](https://github.com/appcelerator/alloy/tree/master/samples/apps/basics/builtins) and make sure the functionality still works, if you're feeling adventurous bump the SDK version to 10.0.0 and create a build via the build scripts, it should still work on that SDK
Closing ticket, using CLI version 8.1.0-master.11, Tested using the instructions above. NOTE* once a SDK Branch exists this can be retested.