Skip to content

Commit

Permalink
Merge branch 'master' into TIMOB-25953
Browse files Browse the repository at this point in the history
  • Loading branch information
lokeshchdhry committed Jan 4, 2019
2 parents c6232bc + b2b3e32 commit f69d186
Show file tree
Hide file tree
Showing 87 changed files with 6,263 additions and 3,048 deletions.
11 changes: 9 additions & 2 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,21 @@
"parserOptions": {
"ecmaVersion": 2015,
"sourceType": "module"
},
}
},
{
"files": [ "dangerfile.js" ],
"parserOptions": {
"ecmaVersion": 2017,
"sourceType": "module"
},
}
},
{
"files": [ "build/**/*.js" ],
"parserOptions": {
"ecmaVersion": 2017,
"sourceType": "script"
}
},
{
"files": [ "android/runtime/common/src/js/**/*.js", "android/modules/**/src/js/**/*.js" ],
Expand Down
3 changes: 2 additions & 1 deletion Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ timestamps {
}
def npmTestResult = sh(returnStatus: true, script: 'npm test &> npm_test.log')
if (runDanger) { // Stash files for danger.js later
stash includes: 'node_modules/,package.json,package-lock.json,dangerfile.js,.eslintignore,.eslintrc,npm_test.log,android/**/*.java', name: 'danger'
stash includes: 'package.json,package-lock.json,dangerfile.js,.eslintignore,.eslintrc,npm_test.log,android/**/*.java', name: 'danger'
}
// was it a failure?
if (npmTestResult != 0) {
Expand Down Expand Up @@ -452,6 +452,7 @@ timestamps {
unstash 'test-report-android' // junit.android.report.xml
} catch (e) {}
ensureNPM(npmVersion)
sh 'npm ci'
// FIXME We need to hack the env vars for Danger.JS because it assumes Github Pull Request Builder plugin only
// We use Github branch source plugin implicitly through pipeline job
// See https://github.com/danger/danger-js/issues/379
Expand Down
2 changes: 1 addition & 1 deletion android/cli/commands/_build.js
Original file line number Diff line number Diff line change
Expand Up @@ -919,7 +919,7 @@ AndroidBuilder.prototype.validate = function validate(logger, config, cli) {
this.dxMaxIdxNumber = cli.tiapp.properties['android.dx.maxIdxNumber'] && cli.tiapp.properties['android.dx.maxIdxNumber'].value || config.get('android.dx.maxIdxNumber', '65536');

// Transpilation details
this.transpile = cli.tiapp['transpile'] === true; // Transpiling is an opt-in process for now
this.transpile = cli.tiapp['transpile'] !== false; // Transpiling is an opt-out process now
this.sourceMaps = cli.tiapp['source-maps'] === true; // opt-in to generate inline source maps
// We get a string here like 6.2.414.36, we need to convert it to 62 (integer)
const v8Version = this.packageJson.v8.version;
Expand Down
15 changes: 14 additions & 1 deletion android/cli/lib/AndroidManifest.js
Original file line number Diff line number Diff line change
Expand Up @@ -482,11 +482,24 @@ function AndroidManifest(filename) {
}, this);
break;

case 'uses-feature':
this[tag] || (this[tag] = []);
src[tag].forEach(function (tagItem) {
// Check for already added features.
let duplicateItem = this[tag].find(function (nextItem) {
// Compare them directly or by name.
return (nextItem === tagItem) || (nextItem.name === tagItem.name);
});
if (!duplicateItem) {
this[tag].push(tagItem);
}
}, this);
break;

case 'instrumentation':
case 'permission':
case 'permission-group':
case 'permission-tree':
case 'uses-feature':
case 'uses-library':
this[tag] || (this[tag] = {});
Object.keys(src[tag]).forEach(function (name) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -606,6 +606,19 @@ public ActivityProxy getCurrentActivity()
return null;
}

// clang-format off
@Kroll.method
@Kroll.getProperty
public ActivityProxy getRootActivity()
// clang-format on
{
TiBaseActivity activity = TiApplication.getInstance().getRootActivity();
if (activity != null) {
return activity.getActivityProxy();
}
return null;
}

@Kroll.method
public void startService(IntentProxy intentProxy)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,90 +6,10 @@
*/
package ti.modules.titanium.android;

import org.appcelerator.titanium.TiC;
import org.appcelerator.titanium.TiLaunchActivity;
import org.appcelerator.titanium.proxy.ActivityProxy;
import org.appcelerator.titanium.proxy.TiActivityWindowProxy;
import org.appcelerator.titanium.util.TiConvert;
import org.appcelerator.titanium.view.TiUIActivityWindow;

import android.content.Intent;
import android.os.Bundle;

@SuppressWarnings("deprecation")
public abstract class TiJSActivity extends TiLaunchActivity
{
protected String url;
protected TiUIActivityWindow activityWindow;

public TiJSActivity(ActivityProxy proxy)
{
proxy.setActivity(this);
activityProxy = proxy;
if (proxy.hasProperty(TiC.PROPERTY_URL)) {
this.url = TiConvert.toString(proxy.getProperty(TiC.PROPERTY_URL));
}
}

public TiJSActivity(String url)
{
this.url = url;
}

@Override
protected void onResume()
{
super.onResume();

// launched alloy activity from intent
// finish to prevent redundant activity
if (this.alloyIntent) {
this.finish();
}
}

@Override
public String getUrl()
{
if (url == null) {
Intent intent = getIntent();
if (intent != null && intent.getDataString() != null) {
url = intent.getDataString();
} else {
throw new IllegalStateException("Activity url required.");
}
}
return url;
}

@Override
protected void contextCreated()
{
super.contextCreated();
TiActivityWindowProxy window = new TiActivityWindowProxy();
window.setActivity(this);
setWindowProxy(window);
setLayoutProxy(window);
}

@Override
protected void scriptLoaded()
{
super.scriptLoaded();
activityWindow.open();
}

@Override
protected void windowCreated(Bundle savedInstanceState)
{
// Set the layout proxy here since it's not ready when we indirectly call it inside contextCreated()
setLayoutProxy(window);

// The UIWindow needs to be created before we run the script
activityWindow = new TiUIActivityWindow((TiActivityWindowProxy) window, this, getLayout());
super.windowCreated(savedInstanceState);
}

@Override
public boolean isJSActivity()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,6 @@ public ActivityProxy getTopActivity()
}
TiApplication tiApp = TiApplication.getInstance();
Activity activity = tiApp.getCurrentActivity();
if (activity == null || !(activity instanceof TiBaseActivity)) {
try {
tiApp.rootActivityLatch.await();
activity = tiApp.getRootActivity();
} catch (InterruptedException e) {
Log.e(TAG, "Interrupted awaiting rootActivityLatch");
}
}

if (activity instanceof TiBaseActivity) {
return ((TiBaseActivity) activity).getActivityProxy();
} else {
Expand All @@ -88,14 +79,11 @@ public int getAppVersionCode()
public IntentProxy getLaunchIntent()
// clang-format on
{
TiApplication app = TiApplication.getInstance();
if (app != null) {
TiBaseActivity rootActivity = app.getRootActivity();
if (rootActivity != null) {
Intent intent = rootActivity.getIntent();
if (intent != null) {
return new IntentProxy(intent);
}
TiBaseActivity rootActivity = TiApplication.getInstance().getRootActivity();
if (rootActivity != null) {
Intent intent = rootActivity.getLaunchIntent();
if (intent != null) {
return new IntentProxy(intent);
}
}
return null;
Expand Down

0 comments on commit f69d186

Please sign in to comment.