Skip to content

Commit

Permalink
Merge branch 'master' into TIMOB-27350_1
Browse files Browse the repository at this point in the history
  • Loading branch information
vijaysingh-axway committed Dec 9, 2019
2 parents 0db4c5d + 2c84e30 commit 0838a86
Show file tree
Hide file tree
Showing 220 changed files with 1,237 additions and 1,626 deletions.
Binary file modified .github/logo-titanium.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
37 changes: 22 additions & 15 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,8 @@ def androidUnitTests(nodeVersion, npmVersion, testSuiteBranch, testOnDevices) {
try {
def zipName = setupTestSuite(testSuiteBranch)
// Now run the unit test suite
// FIXME: Use "npm run test:android -- -b ../../${zipName}" (and additional args based on device/emulator)
// We'd need some way to expose the gathering of crash reports/killing app via adb-all.sh in test suite repo!
dir('titanium-mobile-mocha-suite') {
nodejs(nodeJSInstallationName: "node ${nodeVersion}") {
ensureNPM(npmVersion)
Expand Down Expand Up @@ -171,6 +173,8 @@ def iosUnitTests(deviceFamily, nodeVersion, npmVersion, testSuiteBranch) {
try {
def zipName = setupTestSuite(testSuiteBranch)
// Now run the unit test suite
// FIXME: Use "npm run test:${deviceFamily} -- -D test -b ../../${zipName}"
// we'd need to not clone the suite and copy tests in "setupTestSuite"
dir('titanium-mobile-mocha-suite') {
nodejs(nodeJSInstallationName: "node ${nodeVersion}") {
ensureNPM(npmVersion)
Expand Down Expand Up @@ -320,26 +324,29 @@ timestamps {
basename = "dist/mobilesdk-${vtag}"
echo "BASENAME: ${basename}"

// TODO parallelize the iOS/Android/Mobileweb/Windows portions?
dir('build') {
// TODO parallelize the iOS/Android/Windows portions?
ansiColor('xterm') {
timeout(15) {
def buildCommand = "npm run build -- --android-ndk ${env.ANDROID_NDK_R16B} --android-sdk ${env.ANDROID_SDK}"
if (includeWindows) {
sh "node scons.js build --android-ndk ${env.ANDROID_NDK_R16B} --android-sdk ${env.ANDROID_SDK} --all"
} else {
sh "node scons.js build --android-ndk ${env.ANDROID_NDK_R16B} --android-sdk ${env.ANDROID_SDK}"
buildCommand += ' --all'
}
sh buildCommand
recordIssues(tools: [clang(), java()])
} // timeout
ansiColor('xterm') {
timeout(15) {
if (includeWindows) {
sh "node scons.js package --version-tag ${vtag} --all"
} else {
sh "node scons.js package android ios --version-tag ${vtag}"
}
} // timeout
} // ansiColor
} // dir
timeout(15) {
def packageCommand = "npm run package -- --version-tag ${vtag}"
if (includeWindows) {
// on mainline builds, include windows sdk, build for all 3 host OSes
packageCommand += ' --all'
} else {
// On PRs, just build android and ios for macOS
packageCommand += ' android ios'
}
sh packageCommand
} // timeout
} // ansiColor

archiveArtifacts artifacts: "${basename}-*.zip"
stash includes: 'dist/parity.html', name: 'parity'
stash includes: 'tests/', name: 'override-tests'
Expand Down
69 changes: 40 additions & 29 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,37 @@ see the LICENSE file for specific details.

[![Greenkeeper badge](https://badges.greenkeeper.io/appcelerator/titanium_mobile.svg)](https://greenkeeper.io/)

1. [Features](#features)
2. [Hyperloop](#hyperloop)
3. [Alloy](#alloy)
4. [Getting Help](#getting-help)
* [Official Documentation, Tutorials and Videos](#official-documentation-tutorials-and-videos)
* [Developer Community](#developer-community)
* [Video Tutorials](#video-tutorials)
* [Slack](#slack)
* [Twitter](#twitter)
* [Blog](#blog)
* [Commercial Support, Licensing](#commercial-support-licensing)
5. [Contributing](#contributing)
6. [Building Locally](#building-locally)
* [Unit Tests](#unit-tests)
7. [Legal Stuff](#legal-stuff)
- [Table of Contents](#table-of-contents)
- [Features](#features)
- [Hyperloop](#hyperloop)
- [Features](#features-1)
- [Cross-Platform Reuse](#cross-platform-reuse)
- [Direct API Access](#direct-api-access)
- [JavaScript Everywhere](#javascript-everywhere)
- [3rd-Party Libraries](#3rd-party-libraries)
- [Custom Animations](#custom-animations)
- [Run Native](#run-native)
- [Example](#example)
- [Getting Started](#getting-started)
- [Alloy](#alloy)
- [Example](#example-1)
- [Getting Help](#getting-help)
- [Official Documentation, Tutorials and Videos](#official-documentation-tutorials-and-videos)
- [Developer Community](#developer-community)
- [Video Tutorials](#video-tutorials)
- [Slack](#slack)
- [Twitter](#twitter)
- [Blog](#blog)
- [Commercial Support, Licensing](#commercial-support-licensing)
- [Contributing](#contributing)
- [Building Locally](#building-locally)
- [Unit tests](#unit-tests)
- [How it works](#how-it-works)
- [How to modify the tests locally and in your PRs](#how-to-modify-the-tests-locally-and-in-your-prs)
- [Adding a new test suite](#adding-a-new-test-suite)
- [Editing an existing test suite](#editing-an-existing-test-suite)
- [Merging the modified tests back to the common suite](#merging-the-modified-tests-back-to-the-common-suite)
- [Legal Stuff](#legal-stuff)

## Features

Expand Down Expand Up @@ -209,9 +225,8 @@ Previously Titanium used scons and python scripts to build the SDK.
If you'd like to build the SDK locally, we've replaced scons with some Node.JS scripts. Typical usage would be:

```bash
npm install
cd build
node scons.js cleanbuild --android-ndk /opt/android-ndk --android-sdk /opt/android-sdk
npm ci
npm run cleanbuild
```

The build and package commands will default to all target platforms on your host OS unless explicitly specified. (i.e. Android, iOS on macOS; Windows and Android on Windows). It will compile, package and install the locally-built SDK for you
Expand All @@ -222,20 +237,20 @@ The build command will look for Android NDK and SDK using $ANDROID_NDK and $ANDR
You can use the `-h` flag to display the full list of comands and options.

```bash
npm install
cd build
node scons.js cleanbuild [platform1] [platform2] --android-ndk /opt/android-ndk --android-sdk /opt/android-sdk /Users/build/android-sdk-macosx
npm ci
npm run cleanbuild -- [platform1] [platform2] --android-ndk /opt/android-ndk --android-sdk /opt/android-sdk /Users/build/android-sdk-macosx
```

### Unit tests

We have a [common unit test suite](https://github.com/appcelerator/titanium-mobile-mocha-suite) intended to run across all supported platforms.

To invoke the tests, you must create a local build of the sdk via the steps above and have an sdk zip in your `dist` directory. Then you'd run:
We have npm scripts set up to run a full clean, build, package, symlinked install, `ti sdk select` the built sdk, and then run the unit test suite:

```bash
cd build
node scons.js test [platform]
npm run test:android
npm run test:iphone
npm run test:ipad
```

#### How it works
Expand All @@ -250,13 +265,9 @@ The `tests` folder acts as an override folder for the common suite. Any files li

##### Adding a new test suite

In practical terms that means if we need to add new test files, you'd place the new file under `tests/Resources`, and then copy the `titanium-mobile-mocha-suite/Resources/app.js` to `tests/Resources/app.js` and editing the copy to require the new file(s).
We also have a mechanism in our test suite to auto load any files under `tests/Resources` with the suffix `.addontest.js`. So adding new tests, is simply a matter of creating a file named something like `tests/Resources/ti.namespace.addontest.j

For example, if we want to test a new `Ti.Foo` namespace, we'd create a new test file at `tests/Resources/ti.foo.test.js`. We'd then copy `titanium-mobile-mocha-suite/Resources/app.js` to `tests/Resources/app.js` and add the line:

```javascript
require('./ti.foo.test')
```

##### Editing an existing test suite

Expand Down
25 changes: 8 additions & 17 deletions android/cli/commands/_build.js
Original file line number Diff line number Diff line change
Expand Up @@ -2585,23 +2585,14 @@ 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) {
// 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();
});
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);
},

// Next, copy all files in the project's Resources directory,
Expand Down
Binary file modified android/dev/TitaniumTest/ic_launcher-web.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified android/modules/compat/res/drawable-hdpi-v4/notification_bg_low_pressed.9.png
100755 → 100644
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified android/modules/compat/res/drawable-hdpi-v4/notification_bg_normal_pressed.9.png
100755 → 100644
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified android/modules/compat/res/drawable-hdpi-v4/notify_panel_notification_icon_bg.png
100755 → 100644
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified android/modules/compat/res/drawable-xhdpi-v4/notification_bg_low_normal.9.png
100755 → 100644
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified android/modules/compat/res/drawable-xhdpi-v4/notification_bg_low_pressed.9.png
100755 → 100644
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified android/modules/compat/res/drawable-xhdpi-v4/notification_bg_normal.9.png
100755 → 100644
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified android/modules/compat/res/drawable-xhdpi-v4/notification_bg_normal_pressed.9.png
100755 → 100644
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified android/modules/compat/res/drawable-xhdpi-v4/notify_panel_notification_icon_bg.png
100755 → 100644
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -321,26 +321,18 @@ private KrollDict buildReverseGeocodeResponse(JSONObject jsonResponse) throws JS

private KrollDict buildAddress(JSONObject place)
{
Log.w(
TAG,
"GeocodedAddress properties country_code, displayAddress, and zipcode are deprecated in SDK 8.0.0 and will be removed in 9.0.0");
Log.w(TAG, "Please replace usage with the respective properties: countryCode, address, and postalCode");
KrollDict address = new KrollDict();
address.put(TiC.PROPERTY_STREET1, place.optString(TiC.PROPERTY_STREET, ""));
address.put(TiC.PROPERTY_STREET, place.optString(TiC.PROPERTY_STREET, ""));
address.put(TiC.PROPERTY_CITY, place.optString(TiC.PROPERTY_CITY, ""));
address.put(TiC.PROPERTY_REGION1, ""); // AdminArea
address.put(TiC.PROPERTY_REGION2, ""); // SubAdminArea
address.put("zipcode", place.optString("zipcode", "")); // TODO: To be removed in SDK 9.0.0!
address.put(TiC.PROPERTY_REGION1, ""); // AdminArea
address.put(TiC.PROPERTY_REGION2, ""); // SubAdminArea
address.put(TiC.PROPERTY_POSTAL_CODE, place.optString("zipcode", ""));
address.put(TiC.PROPERTY_COUNTRY, place.optString(TiC.PROPERTY_COUNTRY, ""));
address.put(TiC.PROPERTY_STATE, place.optString(TiC.PROPERTY_STATE, ""));
// Replace TiC.PROPERTY_COUNTRY_CODE value with "countryCode" in SDK 9.0.0
address.put("countryCode", place.optString(TiC.PROPERTY_COUNTRY_CODE, ""));
address.put(TiC.PROPERTY_COUNTRY_CODE, place.optString(TiC.PROPERTY_COUNTRY_CODE, ""));
address.put(TiC.PROPERTY_COUNTRY_CODE, place.optString("country_code", ""));
address.put(TiC.PROPERTY_LONGITUDE, place.optDouble(TiC.PROPERTY_LONGITUDE, 0.0d));
address.put(TiC.PROPERTY_LATITUDE, place.optDouble(TiC.PROPERTY_LATITUDE, 0.0d));
address.put(TiC.PROPERTY_DISPLAY_ADDRESS, place.optString(TiC.PROPERTY_ADDRESS));
address.put(TiC.PROPERTY_ADDRESS, place.optString(TiC.PROPERTY_ADDRESS));

return address;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,6 @@ private KrollDict buildErrorCallbackArgs(String error, int errorCode)
KrollDict callbackArgs = new KrollDict();
callbackArgs.put("socket", this);
callbackArgs.putCodeAndMessage(errorCode, error);
callbackArgs.put("errorCode", errorCode);

return callbackArgs;
}
Expand Down
Binary file modified android/modules/ui/res/drawable/btn_check_buttonless_on_144.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified android/modules/ui/res/drawable/btn_check_buttonless_on_192.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified android/modules/ui/res/drawable/btn_check_buttonless_on_36.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified android/modules/ui/res/drawable/btn_check_buttonless_on_48.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified android/modules/ui/res/drawable/btn_check_buttonless_on_72.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified android/modules/ui/res/drawable/btn_check_buttonless_on_96.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified android/modules/ui/res/drawable/btn_more_144.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified android/modules/ui/res/drawable/btn_more_192.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified android/modules/ui/res/drawable/btn_more_36.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified android/modules/ui/res/drawable/btn_more_48.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified android/modules/ui/res/drawable/btn_more_72.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified android/modules/ui/res/drawable/btn_more_96.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified android/modules/ui/res/drawable/disclosure_144.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified android/modules/ui/res/drawable/disclosure_192.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified android/modules/ui/res/drawable/disclosure_36.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified android/modules/ui/res/drawable/disclosure_48.png
Binary file modified android/modules/ui/res/drawable/disclosure_72.png
Binary file modified android/modules/ui/res/drawable/disclosure_96.png
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public TiUIView createView(Activity activity)
}

@Override
public TiBlob toImage()
protected TiBlob handleToImage()
{
return this.toBlob();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,17 +93,6 @@ public class AndroidModule extends KrollModule
@Kroll.constant
public static final int SOFT_KEYBOARD_SHOW_ON_FOCUS = TiUIView.SOFT_KEYBOARD_SHOW_ON_FOCUS;

@Kroll.constant
public static final int LINKIFY_ALL = Linkify.ALL;
@Kroll.constant
public static final int LINKIFY_EMAIL_ADDRESSES = Linkify.EMAIL_ADDRESSES;
@Kroll.constant
public static final int LINKIFY_MAP_ADDRESSES = Linkify.MAP_ADDRESSES;
@Kroll.constant
public static final int LINKIFY_PHONE_NUMBERS = Linkify.PHONE_NUMBERS;
@Kroll.constant
public static final int LINKIFY_WEB_URLS = Linkify.WEB_URLS;

@Kroll.constant
public static final int SWITCH_STYLE_CHECKBOX = 0;
@Kroll.constant
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,7 @@ public void onReceivedError(WebView view, int errorCode, String description, Str
}
KrollDict data = new KrollDict();
data.put("url", failingUrl);
data.put("errorCode", errorCode);
data.putCodeAndMessage(errorCode, description);
data.put("message", description);
proxy.fireEvent("error", data);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -769,6 +769,35 @@ public boolean isCoverageEnabled()
return false;
}

public static void launch()
{
final TiRootActivity rootActivity = TiApplication.getInstance().getRootActivity();
if (rootActivity == null) {
return;
}

// Fetch a path to the main script that was last loaded.
String appPath = rootActivity.getUrl();
if ((appPath == null) || appPath.isEmpty()) {
return;
}
appPath = "Resources/" + appPath;

final KrollRuntime runtime = KrollRuntime.getInstance();
final boolean hasSnapshot = runtime.evalString("global._startSnapshot") != null;
if (hasSnapshot) {

// Snapshot available, start snapshot.
runtime.doRunModule("global._startSnapshot(global)", appPath, rootActivity.getActivityProxy());

} else {

// Could not find snapshot, fallback to launch script.
runtime.doRunModuleBytes(KrollAssetHelper.readAssetBytes(appPath), appPath,
rootActivity.getActivityProxy());
}
}

public void softRestart()
{
// Fetch the root activity hosting the JavaScript runtime.
Expand All @@ -795,13 +824,6 @@ public void softRestart()
return;
}

// Fetch a path to the main script that was last loaded.
String appPath = rootActivity.getUrl();
if ((appPath == null) || appPath.isEmpty()) {
return;
}
appPath = "Resources/" + appPath;

// Prevent termination of root activity.
boolean canFinishRoot = TiBaseActivity.canFinishRoot;
TiBaseActivity.canFinishRoot = false;
Expand All @@ -820,15 +842,7 @@ public void softRestart()
runtime.initRuntime();

// manually re-launch app
if (KrollAssetHelper.assetExists(appPath)) {
runtime.doRunModuleBytes(KrollAssetHelper.readAssetBytes(appPath), appPath,
rootActivity.getActivityProxy());

// launch script does not exist, must be using snapshot
// execute startup method baked in snapshot
} else {
runtime.doRunModule("global._startSnapshot(global)", appPath, rootActivity.getActivityProxy());
}
TiApplication.launch();
}

@Override
Expand Down

0 comments on commit 0838a86

Please sign in to comment.