Skip to content

Commit

Permalink
Merge branch 'master' into TIMOB-27413
Browse files Browse the repository at this point in the history
  • Loading branch information
ssekhri committed Sep 27, 2019
2 parents 1f3b415 + 1c07f0a commit a243c2d
Show file tree
Hide file tree
Showing 31 changed files with 643 additions and 137 deletions.
2 changes: 1 addition & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
{
"files": [ "build/**/*.js" ],
"parserOptions": {
"ecmaVersion": 2017,
"ecmaVersion": 2018,
"sourceType": "script"
}
},
Expand Down
56 changes: 56 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# [8.3.0](https://github.com/appcelerator/titanium_mobile/compare/8_2_X...8.3.0) (2019-09-20)


## Bug Fixes

### Android platform

* allow requestLegacyExternalStorage attribute ([097c5af](https://github.com/appcelerator/titanium_mobile/commit/097c5af442fdd278db87246fbd8640460f23e6ca))
* call WebView.stopLoading() from main thread ([438a43a](https://github.com/appcelerator/titanium_mobile/commit/438a43a9ec8d244f358af347b44bb7bb0d28fc5b))
* exclude JS in HTML files from processing ([bc45db4](https://github.com/appcelerator/titanium_mobile/commit/bc45db4d43dc763282b5bf6a6710be362c205b82))
* fix dialog without selectedIndex reusage ([a2a048f](https://github.com/appcelerator/titanium_mobile/commit/a2a048fda702bfaee61e2e0f6f9dc85aed9983f5))
* fix reusing a dialog with a new "parent" window ([a8d06c3](https://github.com/appcelerator/titanium_mobile/commit/a8d06c35a02d77698ac6fca71e7f118e19108906))
* fixes background color animation with borders ([86b3699](https://github.com/appcelerator/titanium_mobile/commit/86b3699667d89077e38f7ebf60aaef867ff95b7e))
* [TIMOB-27302](https://jira.appcelerator.org/browse/TIMOB-27302) - guard for tab counts limit for bottom style ([6a2aa4d](https://github.com/appcelerator/titanium_mobile/commit/6a2aa4d7d5101824741fe79a77ffa2e0e48fe904))
* [TIMOB-27108](https://jira.appcelerator.org/browse/TIMOB-27108) - HTTPClient "responseData" blob returns 0 width/height for images over 512kb ([722d6bc](https://github.com/appcelerator/titanium_mobile/commit/722d6bc04c79b7831f4fa1ae239d7fb54398e75c))
* prevent conflict with TextField.isSingleLine() ([20ae5fd](https://github.com/appcelerator/titanium_mobile/commit/20ae5fde99a0d8d29b7721d15fccd2b3faf88fcf))
* [TIMOB-27118](https://jira.appcelerator.org/browse/TIMOB-27118) - prevents TabGroup duplicate close event firing ([34714b8](https://github.com/appcelerator/titanium_mobile/commit/34714b854c6faf47d85730ca15e02edcdd5b1eb0))
* [TIMOB-27177](https://jira.appcelerator.org/browse/TIMOB-27177) - regression where closing root window from child window causes app exit issues as of 8.0.1 ([be7b776](https://github.com/appcelerator/titanium_mobile/commit/be7b77663bd5312a38b025ef70d6870312060d2d))
* release string ([0e21a4f](https://github.com/appcelerator/titanium_mobile/commit/0e21a4f634008eaffd0b0263d5740fcfdc84fcf0))
* [TIMOB-27271](https://jira.appcelerator.org/browse/TIMOB-27271) - resuming with intent "FLAG_ACTIVITY_MULTIPLE_TASK" can hang the app ([632c439](https://github.com/appcelerator/titanium_mobile/commit/632c4398bc71c56be81ffff47422b5686fbb14d1))
* ui module dependency path ([3b9bac8](https://github.com/appcelerator/titanium_mobile/commit/3b9bac8db0f802825c6ff32848cc4289a3551168))
* [TIMOB-27190](https://jira.appcelerator.org/browse/TIMOB-27190) - up button flickering when clicked in NavigationWindow ([69dfda5](https://github.com/appcelerator/titanium_mobile/commit/69dfda5ef5eba65df20cbe979d0bfa912bd4aaa6))
* [TIMOB-27314](https://jira.appcelerator.org/browse/TIMOB-27314) - update titanium_prep windows binaries ([978d625](https://github.com/appcelerator/titanium_mobile/commit/978d625b7b1fb730b53ba8c15929f64b868e91d8))

### Multiple platforms

* update Hyperloop to v4.0.4 for iOS 13 compatibility ([d1cc406](https://github.com/appcelerator/titanium_mobile/commit/d1cc406abd29662e4e6e1b674caa95a73e8dc95f))

### iOS platform

* [TIMOB-27403](https://jira.appcelerator.org/browse/TIMOB-27403) - also lookup semnantic colors in correct location for classic ([8ecfb1e](https://github.com/appcelerator/titanium_mobile/commit/8ecfb1e95397c7257c5f2ec71446b2ecb2a3e7fe))
* console.log does not log properly if it has multiple arguments ([a57701d](https://github.com/appcelerator/titanium_mobile/commit/a57701dafdc34e65470cb3921cc9302c5273dcd4))
* [TIMOB-27386](https://jira.appcelerator.org/browse/TIMOB-27386) - correctly decode device token for ios 13 compatability ([715ef61](https://github.com/appcelerator/titanium_mobile/commit/715ef612ac3bfe6ece73bdfd8dc80b4fe4867765))
* [TIMOB-27395](https://jira.appcelerator.org/browse/TIMOB-27395) - include new iphone models into os extension ([b3a720a](https://github.com/appcelerator/titanium_mobile/commit/b3a720a415e577d1a93f5d49b3ad4498bdd67a53))
* [TIMOB-27165](https://jira.appcelerator.org/browse/TIMOB-27165) - localnotificationaction event contains notification id instead of the action id ([11956d2](https://github.com/appcelerator/titanium_mobile/commit/11956d2a7364f5900f43f68736b333bc1e40dc04))
* non large title navigation bars show default navigation bar ([11aef9c](https://github.com/appcelerator/titanium_mobile/commit/11aef9cc1069c395e8f9a45570633e40dd80f76e))


## Features

### Android platform

* [TIMOB-26463](https://jira.appcelerator.org/browse/TIMOB-26463) - add accessibility properties to MenuItem ([9f3c6b7](https://github.com/appcelerator/titanium_mobile/commit/9f3c6b75c3d71dd65ca7cd33383bc90d3e565d6f))
* [TIMOB-27283](https://jira.appcelerator.org/browse/TIMOB-27283) - add contentSize to Ti.UI.ScrollView scroll event ([6ffd9d4](https://github.com/appcelerator/titanium_mobile/commit/6ffd9d4ce217839017ef66ccf7bc10e9f494e399))
* add new constants for video scaling ([16f04c5](https://github.com/appcelerator/titanium_mobile/commit/16f04c5a2437a948b6cbd3895421035a4c180983))
* [TIMOB-26542](https://jira.appcelerator.org/browse/TIMOB-26542) - Added Ti.App "close" event support ([44a5968](https://github.com/appcelerator/titanium_mobile/commit/44a596834c3be1f2c4725461901584a195e861ba))

### iOS platform

* [MOD-2534](https://jira.appcelerator.org/browse/MOD-2534) - update facebook module to 7.0.0 ([16f4d19](https://github.com/appcelerator/titanium_mobile/commit/16f4d190c1c5bbf02d07f8e528ab6c019addb15e))

### Multiple platforms

* [TIMOB-27286](https://jira.appcelerator.org/browse/TIMOB-27286) - add string_decoder module ([4c5ac3d](https://github.com/appcelerator/titanium_mobile/commit/4c5ac3df760c2cfe9b244374582ab329b8f90fd3))


25 changes: 17 additions & 8 deletions android/cli/commands/_build.js
Original file line number Diff line number Diff line change
Expand Up @@ -2575,14 +2575,23 @@ AndroidBuilder.prototype.copyResources = function copyResources(next) {
const tasks = [
// First copy all of the Titanium SDK's core JS files shared by all platforms.
function (cb) {
const src = path.join(this.titaniumSdkPath, 'common', 'Resources');
warnDupeDrawableFolders.call(this, src);
_t.logger.debug(__('Copying %s', src.cyan));
copyDir.call(this, {
src: src,
dest: this.buildBinAssetsResourcesDir,
ignoreRootDirs: ti.allPlatformNames
}, cb);
// Check if a snapshot has been generated.
fs.stat(path.join(this.platformPath, 'native', 'include', 'V8Snapshots.h'), (error, stat) => {
// 'V8Snapshot.h' will always exists, check size to determin if a snapshot was generated.
if (error || stat.size <= 64) {
const src = path.join(this.titaniumSdkPath, 'common', 'Resources', 'android');
warnDupeDrawableFolders.call(this, src);
_t.logger.debug(__('Copying %s', src.cyan));
copyDir.call(this, {
src: src,
dest: this.buildBinAssetsResourcesDir,
ignoreRootDirs: ti.allPlatformNames
}, cb);
return;
}
// Do not copy 'common' bundle over, as it is included in our snapshot.
return cb();
});
},

// Next, copy all files in the project's Resources directory,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,8 @@ public static void updateActivityTransitionState(boolean state)
}
}

public static long START_TIME_MS = 0;

public TiApplication()
{
Log.checkpoint(TAG, "checkpoint, app created.");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
* Appcelerator Titanium Mobile
* Copyright (c) 2011-2018 by Appcelerator, Inc. All Rights Reserved.
* Copyright (c) 2011-2019 by Appcelerator, Inc. All Rights Reserved.
* Licensed under the terms of the Apache Public License
* Please see the LICENSE included with this distribution for details.
*/
Expand Down Expand Up @@ -169,11 +169,6 @@ public boolean createDirectory(@Kroll.argument(optional = true) Object arg)
@Kroll.method
public boolean createFile()
{
Context context = TiApplication.getInstance().getApplicationContext();
ContextWrapper contextWrapper = new ContextWrapper(context);
tbf = new TiFile(
new File(contextWrapper.getDir("data", Context.MODE_PRIVATE) + "/" + tbf.getNativeFile().getName()), path,
getExecutable());
return tbf.createFile();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.os.SystemClock;

/**
* Titanium launch activities have a single TiContext and launch an associated
Expand Down Expand Up @@ -96,7 +97,14 @@ protected void loadScript()
{
try {
String fullUrl = resolveUrl(this.url);
KrollRuntime.getInstance().runModule(KrollAssetHelper.readAsset(fullUrl), fullUrl, activityProxy);
if (KrollAssetHelper.assetExists(fullUrl)) {
KrollRuntime.getInstance().runModule(KrollAssetHelper.readAsset(fullUrl), fullUrl, activityProxy);

// launch script does not exist, must be using snapshot
// execute startup method baked in snapshot
} else {
KrollRuntime.getInstance().runModule("global.startSnapshot(global)", fullUrl, activityProxy);
}
} finally {
Log.d(TAG, "Signal JS loaded", Log.DEBUG_MODE);
}
Expand All @@ -105,6 +113,9 @@ protected void loadScript()
@Override
protected void onCreate(Bundle savedInstanceState)
{
// set start time
TiApplication.START_TIME_MS = SystemClock.uptimeMillis();

TiApplication tiApp = getTiApp();

// If this is a TiJSActivity derived class created via "tiapp.xml" <activity/> tags,
Expand Down Expand Up @@ -181,6 +192,7 @@ protected void onResume()
if (!hasLoadedScript) {
hasLoadedScript = true;
loadScript();
Log.d(TAG, "Launched in " + (SystemClock.uptimeMillis() - TiApplication.START_TIME_MS) + " ms");
}
super.onResume();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2050,7 +2050,8 @@ public boolean onLongClick(View view)
protected void disableHWAcceleration()
{
if (borderView == null
|| (Build.VERSION.SDK_INT > Build.VERSION_CODES.JELLY_BEAN && !borderView.isHardwareAccelerated())) {
|| (Build.VERSION.SDK_INT > Build.VERSION_CODES.JELLY_BEAN && borderView.isAttachedToWindow()
&& !borderView.isHardwareAccelerated())) {
return;
}
Log.d(TAG, "Disabling hardware acceleration for instance of " + borderView.getClass().getSimpleName(),
Expand Down
4 changes: 3 additions & 1 deletion apidoc/Titanium/UI/iOS/ApplicationShortcuts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,8 @@ properties:
The recommended size for image files is 35dp (@2px: 70dp, @3x: 105dp). Also check the [Apple documentation](https://developer.apple.com/documentation/uikit/uiapplicationshortcuticon)
for more information on shortcut icons.
On iOS 13 and higher, with SDK 8.2.1 or higher, you can pass in the Ti.Blob instance returned from <Ti.UI.iOS.systemImage>.
type: [Number,String,Titanium.Contacts.Person]
constants: Titanium.UI.iOS.SHORTCUT_ICON_TYPE_*
Expand All @@ -323,4 +325,4 @@ properties:
description: |
The userInfo is an object containing information about the shortcut like an ID or details about it.
type: Object
optional: true
optional: true
15 changes: 15 additions & 0 deletions build/lib/android/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@ const copyFiles = utils.copyFiles;
const copyAndModifyFile = utils.copyAndModifyFile;
const globCopy = utils.globCopy;

const ROOT_DIR = path.join(__dirname, '..', '..', '..');

const ANDROID_BUILD_XML = path.join(__dirname, '../../../android/build.xml');
const V8_STRING_VERSION_REGEXP = /(\d+)\.(\d+)\.\d+\.\d+/;

class Android {
/**
Expand Down Expand Up @@ -41,6 +44,18 @@ class Android {
};
}

babelOptions() {
const v8Version = require(path.join(ROOT_DIR, 'android', 'package.json')).v8.version; // eslint-disable-line security/detect-non-literal-require
const v8VersionGroup = v8Version.match(V8_STRING_VERSION_REGEXP);
const version = parseInt(v8VersionGroup[1] + v8VersionGroup[2]);

return {
targets: {
chrome: version
}
};
}

async clean() {
return ant.build(ANDROID_BUILD_XML, [ 'clean' ], this.antProperties);
}
Expand Down
22 changes: 19 additions & 3 deletions build/lib/android/snapshot.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ const path = require('path');
const ejs = require('ejs');

const ROOT_DIR = path.join(__dirname, '..', '..', '..');
const DIST_DIR = path.join(ROOT_DIR, 'dist');
const TMP_DIR = path.join(DIST_DIR, 'tmp');
const ANDROID_DIR = path.join(ROOT_DIR, 'android');
const ANDROID_PROPS = require(path.join(ANDROID_DIR, 'package.json')); // eslint-disable-line security/detect-non-literal-require
const V8_PROPS = ANDROID_PROPS.v8;
Expand All @@ -34,16 +36,30 @@ async function generateBlob(target) {
const V8_LIB_TARGET_DIR = path.resolve(V8_LIB_DIR, target);
const MKSNAPSHOT_PATH = path.join(V8_LIB_TARGET_DIR, 'mksnapshot');
const BLOB_PATH = path.join(V8_LIB_TARGET_DIR, 'blob.bin');
const STARTUP_PATH = path.join(TMP_DIR, 'startup.js');
const TI_MAIN_PATH = path.join(ROOT_DIR, 'common', 'Resources', 'ti.main.js');
const TI_MAIN_PLATFORM_PATH = path.join(TMP_DIR, 'common', 'android', 'ti.main.js');
const args = [
'--startup_blob=' + BLOB_PATH
'--startup_blob=' + BLOB_PATH,
STARTUP_PATH,
'--print-all-exceptions'
];

// Snapshot already exists, skip...
if (await fs.exists(BLOB_PATH)) {
console.warn(`Snapshot blob for ${target} already exists, skipping...`);
return;
const { blobStat, commonStat } = await Promise.all([ fs.stat(BLOB_PATH), fs.stat(TI_MAIN_PATH) ]);
if (commonStat && blobStat && commonStat.mtime < blobStat.mtime) {
return;
}
}

// Load platform optimized 'common' bundle
const commonBundle = await fs.readFile(TI_MAIN_PLATFORM_PATH);

// Generate 'startup.js'
const output = await promisify(ejs.renderFile)(path.join(__dirname, 'startup.ejs'), { script: commonBundle }, {});
await fs.writeFile(STARTUP_PATH, output);

// Set correct permissions for 'mksnapshot'
await fs.chmod(MKSNAPSHOT_PATH, 0o755);

Expand Down
4 changes: 4 additions & 0 deletions build/lib/android/startup.ejs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
this.startSnapshot = function (global) {
delete global.startSnapshot;
<%- script %>
}
64 changes: 63 additions & 1 deletion build/lib/builder.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,19 @@
const os = require('os');
const path = require('path');
const fs = require('fs-extra');
const rollup = require('rollup').rollup;
const babel = require('rollup-plugin-babel');
const resolve = require('rollup-plugin-node-resolve');
const commonjs = require('rollup-plugin-commonjs');

const git = require('./git');
const utils = require('./utils');
const copyPackageAndDependencies = utils.copyPackageAndDependencies;
const Packager = require('./packager');

const ROOT_DIR = path.join(__dirname, '../..');
const ROOT_DIR = path.join(__dirname, '..', '..');
const DIST_DIR = path.join(ROOT_DIR, 'dist');
const TMP_DIR = path.join(DIST_DIR, 'tmp');

// platforms/OS mappings
const ALL_OSES = [ 'win32', 'linux', 'osx' ];
Expand All @@ -28,6 +34,21 @@ function thisOS() {
return osName;
}

function determineBabelOptions(babelOptions) {
const options = {
...babelOptions,
useBuiltIns: 'entry',
// DO NOT include web polyfills!
exclude: [ 'web.dom.iterable', 'web.immediate', 'web.timers' ],
corejs: 2
};

return {
presets: [ [ '@babel/env', options ] ],
exclude: 'node_modules/**'
};
}

class Builder {
constructor(program) {
this.hostOS = thisOS();
Expand Down Expand Up @@ -82,13 +103,54 @@ class Builder {
this.program.gitHash = hash || 'n/a';
}

async transpile(platform, babelOptions) {
// Copy over common dir, @babel/polyfill, etc into some temp dir
// Then run rollup/babel on it, then just copy the resulting bundle to our real destination!
// The temporary location we'll assembled the transpiled bundle
const TMP_COMMON_DIR = path.join(TMP_DIR, '_common');
const TMP_COMMON_PLAFORM_DIR = path.join(TMP_DIR, '_common', platform);

console.log(`Creating temporary 'common' directory...`); // eslint-disable-line quotes
await fs.copy(path.join(ROOT_DIR, 'common'), TMP_COMMON_PLAFORM_DIR);

// copy over polyfill and its dependencies
console.log('Copying polyfills...');
const modulesDir = path.join(TMP_COMMON_PLAFORM_DIR, 'Resources/node_modules');
// make sure our 'node_modules' directory exists
await fs.ensureDir(modulesDir);
copyPackageAndDependencies('@babel/polyfill', modulesDir);

// create a bundle
console.log('Transpile and run rollup...');
const bundle = await rollup({
input: `${TMP_COMMON_PLAFORM_DIR}/Resources/ti.main.js`,
plugins: [
resolve(),
commonjs(),
babel(determineBabelOptions(babelOptions))
],
external: [ './app', 'com.appcelerator.aca' ]
});

console.log(`Writing 'common' bundle...`); // eslint-disable-line quotes
await bundle.write({ format: 'cjs', file: path.join(TMP_DIR, 'common', platform, 'ti.main.js') });

// We used to have to copy over ti.internal, but it is now bundled into ti.main.js
// if we ever have files there that cannot be bundled or are not hooked up properly, we'll need to copy them here manually.

console.log(`Removing temporary 'common' directory...`); // eslint-disable-line quotes
await fs.remove(TMP_COMMON_DIR);
}

async build() {
await this.ensureGitHash();
console.log('Building MobileSDK version %s, githash %s', this.program.sdkVersion, this.program.gitHash);

// TODO: build platforms in parallel
for (const item of this.platforms) {
const Platform = require(`./${item}`); // eslint-disable-line security/detect-non-literal-require
const platform = new Platform(this.program);
await this.transpile(item, platform.babelOptions());
await platform.build();
}
}
Expand Down
11 changes: 11 additions & 0 deletions build/lib/ios.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,17 @@ class IOS {
this.timestamp = options.timestamp;
}

babelOptions() {
// eslint-disable-next-line security/detect-non-literal-require
const { minIosVersion } = require(path.join(ROOT_DIR, 'iphone/package.json'));

return {
targets: {
ios: minIosVersion
}
};
}

async clean() {
return fs.remove(path.join(IOS_ROOT, 'TitaniumKit/build'));
}
Expand Down

0 comments on commit a243c2d

Please sign in to comment.