Skip to content

Commit

Permalink
Merge branch 'master' into TIMOB-27895
Browse files Browse the repository at this point in the history
  • Loading branch information
sgtcoolguy committed May 26, 2020
2 parents 3bae9bc + 18b5afb commit 7434575
Show file tree
Hide file tree
Showing 31 changed files with 1,694 additions and 543 deletions.
65 changes: 65 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,68 @@
## [9.0.2](https://github.com/appcelerator/titanium_mobile/compare/9_0_1_GA...9.0.2) (2020-05-19)

## About this release

Titanium SDK 9.0.2 is a patch release of the SDK, addressing high-priority issues from previous releases.

As of this GA release, the previous Titanium SDK patch release (9.0.1) is no longer supported. End of support for this version will be 2020-11-19 or until the next patch release. Note: major and minor releases continue to be supported according to their nominal lifetime.
See [Axway Appcelerator Deprecation Policy](https://docs.axway.com/bundle/AMPLIFY_Appcelerator_Services_Overview_allOS_en/page/axway_appcelerator_deprecation_policy.html) and [Nominal Lifetimes](https://docs.axway.com/bundle/AMPLIFY_Appcelerator_Services_Overview_allOS_en/page/axway_appcelerator_product_lifecycle.html#AxwayAppceleratorProductLifecycle-NominalLifetimes) documents for details.

:warning: With the release of Titanium SDK 9.0.0, we no longer support Node.js 8.X. Node 10.13.0 is the new minimum supported version.

## Community Credits

* Hans Knöchel
* [TIMOB-27721](https://jira.appcelerator.org/browse/TIMOB-27721) - properly set ImageView tintColor ([f3e9507](https://github.com/appcelerator/titanium_mobile/commit/f3e9507b1357d7981c509872f3d524c7cbea2cf4))

* Sergey Volkov
* [TIMOB-27505](https://jira.appcelerator.org/browse/TIMOB-27505) - configuration change not saved in current context ([ddeafd7](https://github.com/appcelerator/titanium_mobile/commit/ddeafd740949a343e3863b89b77a6dc505632244))

## Bug Fixes

### Android platform

* [TIMOB-27505](https://jira.appcelerator.org/browse/TIMOB-27505) - Configuration change not saved in context for API < 26
* [TIMOB-27513](https://jira.appcelerator.org/browse/TIMOB-27513) - TabGroup bottom navigation style fires redundant event ([5cd74a5](https://github.com/appcelerator/titanium_mobile/commit/5cd74a5f47915cd52571a067aace298e265ab6c3))
* [TIMOB-27625](https://jira.appcelerator.org/browse/TIMOB-27625) - Setting picker's minDate/maxDate after opening window not correctly applied ([8e8bcc6](https://github.com/appcelerator/titanium_mobile/commit/8e8bcc64263e787d264b3e8dfb62ea4dcb1561b6))
* [TIMOB-27721](https://jira.appcelerator.org/browse/TIMOB-27721) - Ti.UI.ImageView#tintColor is multiplied, not replaced (like iOS)
* [TIMOB-27774](https://jira.appcelerator.org/browse/TIMOB-27774) - Ti.Blob.imageAsResized() not working for JPEG with exif rotation as of 8.1.0 ([cf4cc22](https://github.com/appcelerator/titanium_mobile/commit/cf4cc22ce0342584a735dc101858bd9cd4964a3c))
* [TIMOB-27769](https://jira.appcelerator.org/browse/TIMOB-27769) - Textfield inputs not setting in focused textfield and Keyboard not showing (sometimes) on a textfields which is focused ([2afd818](https://github.com/appcelerator/titanium_mobile/commit/2afd8186e8561056a7ec08b65d3d338edf2a44d6))
* [TIMOB-27798](https://jira.appcelerator.org/browse/TIMOB-27798) - module build to download ndk with gradle tool 3.5.0+ ([7545627](https://github.com/appcelerator/titanium_mobile/commit/75456275f1765db5ef13ecf730e3c878cb6acfbc))
* [TIMOB-27849](https://jira.appcelerator.org/browse/TIMOB-27849) - Ti.version returns long version format when transpiled, short when not
* [TIMOB-27850](https://jira.appcelerator.org/browse/TIMOB-27850) - App/Module builds fail with JDK 14 as of 9.0.0 ([ba456bf](https://github.com/appcelerator/titanium_mobile/commit/ba456bf0c0e2098d35f4ce37f74c09785ae6c7a2))
* [TIMOB-27852](https://jira.appcelerator.org/browse/TIMOB-27852) - Production builds no longer copy AAB to distribution folder as of 9.0.1 ([1ca5f70](https://github.com/appcelerator/titanium_mobile/commit/1ca5f70029729e1c378671886fea22a836dd176e))
* [TIMOB-27881](https://jira.appcelerator.org/browse/TIMOB-27881) - ImageView tintColor has no effect ([e025e3b](https://github.com/appcelerator/titanium_mobile/commit/e025e3b3dbe670eedcaff3682ee741f0c66de81c))

### iOS platform

* [TIMOB-27851](https://jira.appcelerator.org/browse/TIMOB-27851) - Ti.Network.createHTTPClient memory leak
* [TIMOB-27861](https://jira.appcelerator.org/browse/TIMOB-27861) - Ti.Platform.openURL() callback not invoked if missing options dictionary as of 8.1.0 ([19fc45d](https://github.com/appcelerator/titanium_mobile/commit/19fc45d85b3084ffc4e9a33b33b3fc9142eaf12f))
* [TIMOB-27868](https://jira.appcelerator.org/browse/TIMOB-27868) - Ti.UI.Window.barColor cannot be changed after it was appeared ([707259b](https://github.com/appcelerator/titanium_mobile/commit/707259b14bbd301ebfffe88c8fa5d2d504cdf797))
* [TIMOB-27894](https://jira.appcelerator.org/browse/TIMOB-27894) - Navigation bar flickers on open (SDK 9.0.2 regression, iOS 13+) ([71eabb2](https://github.com/appcelerator/titanium_mobile/commit/71eabb20d3b20017daf491cc287430a9889e2347))
* [TIMOB-27839](https://jira.appcelerator.org/browse/TIMOB-27839) - Orientationchange Stops Firing on iPadOS ([bc67f73](https://github.com/appcelerator/titanium_mobile/commit/bc67f733e443ce2b40606c37e5d84398207d679b))

## Features

### iOS platform

* add list of new iPhone/iPad models for os module ([29795a7](https://github.com/appcelerator/titanium_mobile/commit/29795a7213fe8a35437e17d8b1572bc0acc0cfb9))

## SDK Module Versions

| Module | Android version | iOS Version |
| ----------- | --------------- | ----------- |
| facebook | 9.0.0 | 7.0.1 |
| ti.cloudpush | 7.0.0 | n/a |
| ti.map | 5.0.1 | 3.3.0 |
| ti.webdialog | 2.0.0 | 1.1.0 |
| ti.playservices | 17.1.1 | n/a |
| ti.identity | 3.0.1 | 1.1.0 |
| urlSession | n/a | 2.2.0 |
| ti.coremotion | n/a | 2.1.0 |
| ti.applesignin | n/a | 1.1.1 |
| ti.cloud | 3.2.11 | 3.2.11 |
| hyperloop | 5.0.3 | 5.0.3 |

## [9.0.1](https://github.com/appcelerator/titanium_mobile/compare/9_0_0_GA...9.0.1) (2020-04-15)

## About this release
Expand Down
31 changes: 3 additions & 28 deletions android/cli/commands/_build.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ const ADB = require('node-titanium-sdk/lib/adb'),
Builder = require('node-titanium-sdk/lib/builder'),
GradleWrapper = require('../lib/gradle-wrapper'),
ProcessJsTask = require('../../../cli/lib/tasks/process-js-task'),
Color = require('../../../common/lib/color'),
CleanCSS = require('clean-css'),
DOMParser = require('xmldom').DOMParser,
ejs = require('ejs'),
Expand Down Expand Up @@ -3340,37 +3341,11 @@ AndroidBuilder.prototype.generateSemanticColors = async function generateSemanti
return;
}

const shorthandRegex = /^#?([a-f\d])([a-f\d])([a-f\d])$/i;

function hexToRgb(hex) {
let alphaHex = 'ff';
let color = hex;
if (hex.color) {
color = hex.color;
let alpha = Math.round(255 * parseFloat(hex.alpha) / 100);
if (alpha <= 255) {
alphaHex = alpha.toString(16);
if (alpha < 16) {
alphaHex = '0' + alphaHex;
}
}
}
// Expand shorthand form (e.g. "03F") to full form (e.g. "0033FF")
color = color.replace(shorthandRegex, (m, r, g, b) => r + r + g + g + b + b);

var result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(color);
if (alphaHex === 'ff') {
return `#${result[1]}${result[2]}${result[3]}`;
} else {
return `#${alphaHex}${result[1]}${result[2]}${result[3]}`;
}
}

function appendToXml(dom, root, color, colorValue) {
const appnameNode = dom.createElement('color');

appnameNode.setAttribute('name', `${color}`);
appnameNode.appendChild(dom.createTextNode(hexToRgb(colorValue)));
const colorObj = Color.fromSemanticColorsEntry(colorValue);
appnameNode.appendChild(dom.createTextNode(colorObj.toARGBHexString()));
root.appendChild(dom.createTextNode('\n\t'));
root.appendChild(appnameNode);
}
Expand Down
3 changes: 2 additions & 1 deletion android/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@
"v8": {
"version": "7.9.317.32",
"mode": "release",
"checksum": "4fd238e9e22dda0a6d67cf132d95ac6b874cf82bec28769e25672877b3cca09ef9ef268be9482e2cc0ca20227f495e5d3ad038c83a9b90f72ad9d5e6a7bad77d"
"checksum": "4fd238e9e22dda0a6d67cf132d95ac6b874cf82bec28769e25672877b3cca09ef9ef268be9482e2cc0ca20227f495e5d3ad038c83a9b90f72ad9d5e6a7bad77d",
"integrity": "sha512-T9I46eIt2gptZ88TLZWsa4dM+CvsKHaeJWcod7PMoJ757yaL6UguLMDKICJ/SV5dOtA4yDqbkPcq2dXmp7rXfQ=="
},
"minSDKVersion": "19",
"compileSDKVersion": "29",
Expand Down
4 changes: 2 additions & 2 deletions android/runtime/v8/tools/bootstrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@
"""

JS_DEFINE_TOP_LEVEL = \
""" global.%(name)s = function() {
return %(namespace)s.%(mapping)s.apply(%(namespace)s, arguments);
""" global.%(name)s = function(...args) {
return %(namespace)s.%(mapping)s.apply(%(namespace)s, args);
}
"""

Expand Down
2 changes: 1 addition & 1 deletion android/titanium/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ task updateV8Library() {
def v8MakeFilePath = "${projectDir}/../runtime/v8/src/ndk-modules/libv8/V8Settings.mk"
inputs.property 'v8.version', packageJson.v8.version
inputs.property 'v8.mode', packageJson.v8.mode
inputs.property 'v8.checksum', packageJson.v8.checksum
inputs.property 'v8.integrity', packageJson.v8.integrity
outputs.file v8MakeFilePath
outputs.files fileTree("${projectDir}/../../dist/android/libv8/${packageJson.v8.version}/${packageJson.v8.mode}")
doLast {
Expand Down
136 changes: 36 additions & 100 deletions android/titanium/libv8-services.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
* Appcelerator Titanium Mobile
* Copyright (c) 2009-2019 by Axway. All Rights Reserved.
* Copyright (c) 2009-2020 by Axway. All Rights Reserved.
* Licensed under the terms of the Apache Public License.
* Please see the LICENSE included with this distribution for details.
*/
Expand All @@ -9,9 +9,9 @@

const AndroidBuilder = require('../../build/lib/android');
const Builder = require('../../build/lib/builder');
const BuildUtils = require('../../build/lib/utils');
const util = require('util');
const exec = util.promisify(require('child_process').exec); // eslint-disable-line security/detect-child-process
const crypto = require('crypto');
const fs = require('fs-extra');
const path = require('path');
const request = require('request-promise-native');
Expand All @@ -34,39 +34,12 @@ function quotePath(filePath) {
return `"${filePath}"`;
}

/**
* Reads all of the bytes of the given file and returns a hash using the given algorithm.
* @param {String} filePath Path to the file to read the bytes of and calculate a hash. Cannot be null.
* @param {String} hashingAlgorithm Hashing algorithm to use such as 'md5', 'sha256', etc. Cannot be null.
* @param {String} [hashEncoding]
* Optional argument indicating how to encode the returned hash result.
* Can be set to 'hex', 'base64, or 'ascii', 'utf8'. Defaults to 'hex' if argument is null or undefined.
*/
async function fetchFileHash(filePath, hashingAlgorithm, hashEncoding) {
return await new Promise((resolve, reject) => {
const hash = crypto.createHash(hashingAlgorithm);
const readStream = fs.createReadStream(filePath);
readStream.on('data', (data) => {
hash.update(data);
});
readStream.on('end', () => {
if (!hashEncoding) {
hashEncoding = 'hex';
}
resolve(hash.digest(hashEncoding));
});
readStream.on('error', reject);
});
}

/**
* Async loads the "titanium_mobile/android/package.json" file and returns it as a dictionary.
* @returns {Promise<Object>} Dictionary of the parsed JSON file if loaded successfully.
*/
async function loadPackageJson() {
const filePath = path.join(__dirname, '..', 'package.json');
const fileContent = await fs.readFile(filePath, 'utf8');
return JSON.parse(fileContent);
return fs.readJson('../package.json');
}

/**
Expand All @@ -79,9 +52,16 @@ async function createSnapshot() {
const rollupOutputDirPath = path.join(__dirname, 'build', 'outputs', 'ti-assets', 'Resources');
const rollupOutputFilePath = path.join(rollupOutputDirPath, 'ti.main.js');
await fs.ensureDir(rollupOutputDirPath);
const mainBuilder = new Builder({ args: [ 'android' ] });
const androidBuilder = new AndroidBuilder({});
await mainBuilder.transpile('android', androidBuilder.babelOptions, rollupOutputFilePath);

const program = { args: [ 'ios' ] };
const mainBuilder = new Builder(program);
await mainBuilder.ensureGitHash();
const androidBuilder = new AndroidBuilder({
sdkVersion: require('../package.json').version,
gitHash: program.gitHash,
timestamp: program.timestamp
});
await mainBuilder.transpile('android', androidBuilder.babelOptions(), rollupOutputFilePath);
const rollupFileContent = (await fs.readFile(rollupOutputFilePath)).toString();

// Create the C++ directory we'll be generating the snapshot header file to.
Expand Down Expand Up @@ -153,83 +133,39 @@ async function createSnapshot() {

/**
* Checks if the V8 library referenced by the "titanium_mobile/android/package.json" file is installed.
* If not, then this function will automatically download/install it. Function will do nothing if alredy installed.
* If not, then this function will automatically download/install it. Function will do nothing if already installed.
*/
async function updateLibrary() {
// Fetch info about the V8 library we should be building with.
// This info is stored in our "package.json" under "titanium_mobile/android" folder.
const packageJsonData = await loadPackageJson();
const v8TargetVersion = packageJsonData.v8.version;
const v8TargetMode = packageJsonData.v8.mode;
const v8TargetChecksum = packageJsonData.v8.checksum;

// Check if the targeted V8 version is already installed.
let isV8Installed = false;
const integrity = packageJsonData.v8.integrity;
const v8ArchiveFileName = `libv8-${v8TargetVersion}-${v8TargetMode}.tar.bz2`;
const installedLibV8DirPath = path.join(
__dirname, '..', '..', 'dist', 'android', 'libv8', v8TargetVersion, v8TargetMode);
const installedLibV8ArchiveFilePath = path.join(installedLibV8DirPath, v8ArchiveFileName);
const installedLibV8JsonFilePath = path.join(installedLibV8DirPath, 'libv8.json');
if (await fs.exists(installedLibV8JsonFilePath)) {
// Check if targetd V8 version folder exists.
const v8InstalledVersion = JSON.parse(await fs.readFile(installedLibV8JsonFilePath, 'utf8')).version;
if (v8InstalledVersion === v8TargetVersion) {
// Check if a tarball of the V8 library exists.
if (await fs.exists(installedLibV8ArchiveFilePath)) {
// Check if the V8 tarball file's hash matches what is in our package JSON.
const v8InstalledChecksum = await fetchFileHash(installedLibV8ArchiveFilePath, 'sha512', 'hex');
if (v8InstalledChecksum === v8TargetChecksum) {
// Yes, the targeted V8 library version is installed and it's checksum/hash is correct.
isV8Installed = true;
}
}
}
}

// Do not continue if targeted V8 library is already downloaded/installed. We're good to go.
if (isV8Installed) {
return;
}

// Download a tarball of the targeted V8 library version.
console.log(`Downloading V8 library: ${v8ArchiveFileName}`);
await fs.mkdirs(installedLibV8DirPath);
await new Promise((resolve, reject) => {
const writeStream = fs.createWriteStream(installedLibV8ArchiveFilePath);
writeStream.on('error', reject);
writeStream.on('finish', resolve);
const request = require('request');
const downloadUrl = `http://timobile.appcelerator.com.s3.amazonaws.com/libv8/${v8ArchiveFileName}`;
const requestHandler = request({ url: downloadUrl });
requestHandler.on('error', reject);
requestHandler.on('response', (response) => {
const statusCode = response.statusCode;
if (statusCode === 200) {
requestHandler.pipe(writeStream);
} else {
reject(`Failed to download V8 library. Received status code ${statusCode} from: ${downloadUrl}`);
}
});
__dirname, '../../dist/android/libv8', v8TargetVersion, v8TargetMode);

// Download V8 archive (downloads to temp dir, which helps CI server avoid re-downloading between builds generally)
const downloadUrl = `http://timobile.appcelerator.com.s3.amazonaws.com/libv8/${v8ArchiveFileName}`;
// FIXME: Can we skip the download if the ultimate destination exists?!
const downloadedTarball = await BuildUtils.downloadURL(downloadUrl, integrity, { progress: false });
let tmpExtractDir = BuildUtils.cachedDownloadPath(downloadUrl); // store alongside the place we store the tar.bz2, just drop the extension
tmpExtractDir = tmpExtractDir.substring(0, tmpExtractDir.length - '.tar.bz2'.length); // drop .tar.bz2
// Now extract to tmp dir and "cache" it for later builds
await BuildUtils.cacheExtract(downloadedTarball, integrity, tmpExtractDir, async function (inFile, outDir) {
// Extract the downloaded V8 archive's files.
console.log(`Decompressing downloaded V8 file: ${inFile}`);
const untarCommandLine
= quotePath(path.join(__dirname, '..', isWindows ? 'gradlew.bat' : 'gradlew'))
+ ' -b ' + quotePath(path.join(__dirname, '..', 'untar.gradle'))
+ ' -Pcompression=bzip2'
+ ' -Psrc=' + quotePath(inFile)
+ ' -Pdest=' + quotePath(outDir);
return exec(untarCommandLine);
});

// Verify that the hash of the download V8 tarball matches what is in our package JSON.
const v8DownloadedChecksum = await fetchFileHash(installedLibV8ArchiveFilePath, 'sha512', 'hex');
if (v8DownloadedChecksum !== v8TargetChecksum) {
const errorMessage
= 'Checksum for downloaded libv8 does not match what is defined in "package.json". '
+ 'Expected: ' + v8TargetChecksum + ', Received: ' + v8DownloadedChecksum;
throw new Error(errorMessage);
}

// Extract the downloaded V8 archive's files.
console.log(`Decompressing downloaded V8 file: ${installedLibV8ArchiveFilePath}`);
const untarCommandLine
= quotePath(path.join(__dirname, '..', isWindows ? 'gradlew.bat' : 'gradlew'))
+ ' -b ' + quotePath(path.join(__dirname, '..', 'untar.gradle'))
+ ' -Pcompression=bzip2'
+ ' -Psrc=' + quotePath(installedLibV8ArchiveFilePath)
+ ' -Pdest=' + quotePath(installedLibV8DirPath);
await exec(untarCommandLine);
// Now copy from tmp dir to ultimate destination
return fs.copy(tmpExtractDir, installedLibV8DirPath);
}

/**
Expand Down

0 comments on commit 7434575

Please sign in to comment.