Skip to content

Commit

Permalink
Merge branch 'master' into TIMOB-27383
Browse files Browse the repository at this point in the history
  • Loading branch information
keerthi1032 committed Sep 20, 2019
2 parents 21f94b6 + eaabddc commit ca3b99c
Show file tree
Hide file tree
Showing 25 changed files with 931 additions and 68 deletions.
1 change: 1 addition & 0 deletions android/cli/commands/_build.js
Original file line number Diff line number Diff line change
Expand Up @@ -2722,6 +2722,7 @@ AndroidBuilder.prototype.copyResources = function copyResources(next) {
const from = jsFiles[relPath];
const to = path.join(this.buildBinAssetsResourcesDir, relPath);
copyFile.call(this, from, to, next);
this.unmarkBuildDirFile(to);
};
}), done);

Expand Down
2 changes: 1 addition & 1 deletion android/cli/lib/AndroidManifest.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const appc = require('node-appc'),
},

tagAttrs = {
application: /^(allowTaskReparenting|allowBackup|allowClearUserData|backupAgent|backupInForeground|banner|debuggable|description|directBootAware|enabled|extractNativeLibs|fullBackupContent|fullBackupOnly|hasCode|hardwareAccelerated|icon|isGame|killAfterRestore|largeHeap|label|logo|manageSpaceActivity|name|networkSecurityConfig|permission|persistent|process|restoreAnyVersion|requiredAccountType|resizeableActivity|restrictedAccountType|roundIcon|supportsRtl|taskAffinity|testOnly|theme|uiOptions|usesCleartextTraffic|vmSafeMode)$/, // eslint-disable-line max-len
application: /^(allowTaskReparenting|allowBackup|allowClearUserData|backupAgent|backupInForeground|banner|debuggable|description|directBootAware|enabled|extractNativeLibs|fullBackupContent|fullBackupOnly|hasCode|hardwareAccelerated|icon|isGame|killAfterRestore|largeHeap|label|logo|manageSpaceActivity|name|networkSecurityConfig|permission|persistent|process|restoreAnyVersion|requiredAccountType|resizeableActivity|restrictedAccountType|requestLegacyExternalStorage|roundIcon|supportsRtl|taskAffinity|testOnly|theme|uiOptions|usesCleartextTraffic|vmSafeMode)$/, // eslint-disable-line max-len
activity: /^(allowEmbedded|allowTaskReparenting|alwaysRetainTaskState|autoRemoveFromRecents|banner|clearTaskOnLaunch|colorMode|configChanges|density|directBootAware|documentLaunchMode|enabled|excludeFromRecents|exported|finishOnTaskLaunch|hardwareAccelerated|icon|immersive|label|launchMode|lockTaskMode|maxRecents|maxAspectRatio|multiprocess|name|noHistory|parentActivityName|permission|persistableMode|process|relinquishTaskIdentity|resizeableActivity|screenOrientation|showForAllUsers|stateNotNeeded|supportsPictureInPicture|taskAffinity|theme|uiOptions|windowSoftInputMode)$/, // eslint-disable-line max-len
'activity-alias': /^(enabled|exported|icon|label|name|permission|targetActivity)$/,
data: /^(host|mimeType|path|pathPattern|pathPrefix|port|scheme)$/,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,7 @@ public void release()
{
TiSound s = getSound();
if (s != null) {
s.reset();
s.release();
snd = null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -371,6 +371,7 @@ public void release()
mp.setOnBufferingUpdateListener(null);
mp.setOnInfoListener(null);

mp.reset();
mp.release();
mp = null;
Log.d(TAG, "Native resources released.", Log.DEBUG_MODE);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ public class NetworkModule extends KrollModule
public static final int TLS_VERSION_1_1 = 2;
@Kroll.constant
public static final int TLS_VERSION_1_2 = 3;
@Kroll.constant
public static final int TLS_VERSION_1_3 = 4;

@Kroll.constant
public static final int PROGRESS_UNKNOWN = -1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@ public class TiSocketFactory extends SSLSocketFactory
private SSLContext sslContext;
private String tlsVersion;
private static final String TAG = "TiSocketFactory";
private static final boolean JELLYBEAN_OR_GREATER = (Build.VERSION.SDK_INT >= 16);
private static final boolean JELLYBEAN_OR_GREATER = Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN;
private static final boolean Q_OR_GREATER = Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q;
private static final String TLS_VERSION_1_3_PROTOCOL = "TLSv1.3";
private static final String TLS_VERSION_1_2_PROTOCOL = "TLSv1.2";
private static final String TLS_VERSION_1_1_PROTOCOL = "TLSv1.1";
private static final String TLS_VERSION_1_0_PROTOCOL = "TLSv1";
Expand All @@ -43,9 +45,17 @@ public TiSocketFactory(KeyManager[] keyManagers, TrustManager[] trustManagers, i
throws NoSuchAlgorithmException, KeyManagementException, KeyStoreException, UnrecoverableKeyException
{
super();
//super(null,null,null,null,null,null);
switch (protocol) {

// Select appropriate default based on Android version.
if (protocol == NetworkModule.TLS_DEFAULT) {
if (Q_OR_GREATER) {
protocol = NetworkModule.TLS_VERSION_1_3;
} else if (JELLYBEAN_OR_GREATER) {
protocol = NetworkModule.TLS_VERSION_1_2;
}
}

switch (protocol) {
case NetworkModule.TLS_VERSION_1_0:
tlsVersion = TLS_VERSION_1_0_PROTOCOL;
enabledProtocols = new String[] { TLS_VERSION_1_0_PROTOCOL };
Expand All @@ -59,18 +69,17 @@ public TiSocketFactory(KeyManager[] keyManagers, TrustManager[] trustManagers, i
enabledProtocols =
new String[] { TLS_VERSION_1_0_PROTOCOL, TLS_VERSION_1_1_PROTOCOL, TLS_VERSION_1_2_PROTOCOL };
break;
case NetworkModule.TLS_VERSION_1_3:
tlsVersion = TLS_VERSION_1_3_PROTOCOL;
enabledProtocols = new String[] { TLS_VERSION_1_0_PROTOCOL, TLS_VERSION_1_1_PROTOCOL,
TLS_VERSION_1_2_PROTOCOL, TLS_VERSION_1_3_PROTOCOL };
break;
default:
Log.e(TAG, "Incorrect TLS version was set in HTTPClient. Reverting to default TLS version.");
case NetworkModule.TLS_DEFAULT:
if (JELLYBEAN_OR_GREATER) {
tlsVersion = TLS_VERSION_1_2_PROTOCOL;
enabledProtocols =
new String[] { TLS_VERSION_1_0_PROTOCOL, TLS_VERSION_1_1_PROTOCOL, TLS_VERSION_1_2_PROTOCOL };
} else {
tlsVersion = TLS_VERSION_1_0_PROTOCOL;
enabledProtocols = new String[] { TLS_VERSION_1_0_PROTOCOL };
Log.i(TAG, tlsVersion + " protocol is being used. It is a less-secure version.");
}
tlsVersion = TLS_VERSION_1_0_PROTOCOL;
enabledProtocols = new String[] { TLS_VERSION_1_0_PROTOCOL };
Log.i(TAG, tlsVersion + " protocol is being used. It is a less-secure version.");
break;
}

Expand Down
9 changes: 9 additions & 0 deletions android/modules/ui/ui.iml
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,14 @@
<orderEntry type="module" module-name="kroll-apt" />
<orderEntry type="module" module-name="appcompat" />
<orderEntry type="module" module-name="cardview" />
<orderEntry type="module-library">
<library>
<CLASSES>
<root url="jar://$MODULE_DIR$/lib/WebViewClient.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
</component>
</module>
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
*/
package org.appcelerator.titanium.proxy;

import org.appcelerator.kroll.KrollDict;
import org.appcelerator.kroll.KrollProxy;
import org.appcelerator.kroll.annotations.Kroll;
import org.appcelerator.kroll.common.AsyncResult;
Expand All @@ -17,6 +18,7 @@
import org.appcelerator.titanium.util.TiFileHelper;
import org.appcelerator.titanium.util.TiUIHelper;
import org.appcelerator.titanium.util.TiUrl;
import org.appcelerator.titanium.view.TiUIView;

import android.graphics.drawable.Drawable;
import android.os.Build;
Expand Down Expand Up @@ -143,6 +145,102 @@ public boolean isVisible()
return item.isVisible();
}

// clang-format off
@Kroll.method
@Kroll.getProperty
public String getAccessibilityLabel()
// clang-format on
{
return TiConvert.toString(properties, TiC.PROPERTY_ACCESSIBILITY_LABEL);
}

// clang-format off
@Kroll.method
@Kroll.getProperty
public String getAccessibilityHint()
// clang-format on
{
return TiConvert.toString(properties, TiC.PROPERTY_ACCESSIBILITY_HINT);
}

// clang-format off
@Kroll.method
@Kroll.getProperty
public String getAccessibilityValue()
// clang-format on
{
return TiConvert.toString(properties, TiC.PROPERTY_ACCESSIBILITY_VALUE);
}

private void updateContentDescription()
{
String contentDescription = composeContentDescription();
MenuItemCompat.setContentDescription(item, contentDescription);
}

public void setContentDescription(KrollDict d)
{
if (d.containsKeyAndNotNull(TiC.PROPERTY_ACCESSIBILITY_LABEL)) {
properties.put(TiC.PROPERTY_ACCESSIBILITY_LABEL, d.get(TiC.PROPERTY_ACCESSIBILITY_LABEL));
} else {
properties.remove(TiC.PROPERTY_ACCESSIBILITY_LABEL);
}
if (d.containsKey(TiC.PROPERTY_ACCESSIBILITY_HINT)) {
properties.put(TiC.PROPERTY_ACCESSIBILITY_HINT, d.get(TiC.PROPERTY_ACCESSIBILITY_HINT));
} else {
properties.remove(TiC.PROPERTY_ACCESSIBILITY_HINT);
}
if (d.containsKey(TiC.PROPERTY_ACCESSIBILITY_VALUE)) {
properties.put(TiC.PROPERTY_ACCESSIBILITY_VALUE, d.get(TiC.PROPERTY_ACCESSIBILITY_VALUE));
} else {
properties.remove(TiC.PROPERTY_ACCESSIBILITY_VALUE);
}
updateContentDescription();
}

// clang-format off
@Kroll.method
@Kroll.setProperty
public void setAccessibilityLabel(String label)
// clang-format on
{
if (label != null && label.length() != 0) {
properties.put(TiC.PROPERTY_ACCESSIBILITY_LABEL, label);
} else {
properties.remove(TiC.PROPERTY_ACCESSIBILITY_LABEL);
}
updateContentDescription();
}

// clang-format off
@Kroll.method
@Kroll.setProperty
public void setAccessibilityHint(String hint)
// clang-format on
{
if (hint != null && hint.length() != 0) {
properties.put(TiC.PROPERTY_ACCESSIBILITY_HINT, hint);
} else {
properties.remove(TiC.PROPERTY_ACCESSIBILITY_HINT);
}
updateContentDescription();
}

// clang-format off
@Kroll.method
@Kroll.setProperty
public void setAccessibilityValue(String value)
// clang-format on
{
if (value != null && value.length() != 0) {
properties.put(TiC.PROPERTY_ACCESSIBILITY_VALUE, value);
} else {
properties.remove(TiC.PROPERTY_ACCESSIBILITY_VALUE);
}

updateContentDescription();
}

// clang-format off
@Kroll.method
@Kroll.setProperty
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,8 @@ public MenuItemProxy handleAdd(KrollDict d)
if (d.containsKey(TiC.PROPERTY_VISIBLE)) {
mip.setVisible(TiConvert.toBoolean(d, TiC.PROPERTY_VISIBLE));
}

mip.setContentDescription(d);
return mip;
}

Expand Down
32 changes: 32 additions & 0 deletions apidoc/Titanium/Android/MenuItem.yml
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,38 @@ events:
since: "3.0.0"

properties:
- name: accessibilityHint
summary: Briefly describes what performing an action (such as a click) on the view will do.
description: |
Value of this property is concatenated together with
<Titanium.Android.MenuItem.accessibilityLabel> and <Titanium.Android.MenuItem.accessibilityValue> in the order: `accessibilityLabel`,
`accessibilityValue`, `accessibilityHint`. The concatenated value is then passed as the
argument to the native [MenuItemCompat.setContentDescription](https://developer.android.com/reference/android/support/v4/view/MenuItemCompat#setContentDescription(android.view.MenuItem,%20java.lang.CharSequence)) method.
type: String
since: "8.3.0"
default: null

- name: accessibilityLabel
summary: A succint label identifying the view for the device's accessibility service.
description: |
Value of this property is concatenated together with
<Titanium.Android.MenuItem.accessibilityValue> and <Titanium.Android.MenuItem.accessibilityHint> in the order: `accessibilityLabel`,
`accessibilityValue`, `accessibilityHint`. The concatenated value is then passed as the
argument to the native [MenuItemCompat.setContentDescription](https://developer.android.com/reference/android/support/v4/view/MenuItemCompat#setContentDescription(android.view.MenuItem,%20java.lang.CharSequence)) method.
since: "8.3.0"
type: String
default: null

- name: accessibilityValue
summary: A string describing the value (if any) of the view for the device's accessibility service.
description: |
Value of this property is concatenated together with
<Titanium.Android.MenuItem.accessibilityLabel> and <Titanium.Android.MenuItem.accessibilityHint> in the order: `accessibilityLabel`,
`accessibilityValue`, `accessibilityHint`. The concatenated value is then passed as the
argument to the native [MenuItemCompat.setContentDescription](https://developer.android.com/reference/android/support/v4/view/MenuItemCompat#setContentDescription(android.view.MenuItem,%20java.lang.CharSequence)) method.
since: "8.3.0"
type: String
default: null

- name: actionView
summary: Custom view that replaces the default menu item button.
Expand Down
5 changes: 5 additions & 0 deletions apidoc/Titanium/Network/HTTPClient.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,11 @@ description: |
<td>4.1+</td>
<td>5.0+</td>
</tr>
<tr>
<th align="left">TLS 1.3</th>
<td>10.0+</td>
<td>12.2+</td>
</tr>
</tbody>
</table>
Expand Down
8 changes: 8 additions & 0 deletions apidoc/Titanium/Network/Network.yml
Original file line number Diff line number Diff line change
Expand Up @@ -648,6 +648,14 @@ properties:
platforms: [android, iphone, ipad]
osver: {android: {min: "4.1"}, ios: {min: "5.0"}}

- name: TLS_VERSION_1_3
summary: Constant value specifying TLS version 1.3 for SSL.
type: Number
permission: read-only
since: {android: "8.3.0", iphone: "8.3.0", ipad: "8.3.0"}
platforms: [android, iphone, ipad]
osver: {android: {min: "10.0"}, ios: {min: "12.2"}}

- name: PROGRESS_UNKNOWN
summary: Constant value specifying that the progress of a download can not be calculated.
type: Number
Expand Down
22 changes: 11 additions & 11 deletions cli/lib/tasks/process-js-task.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ const { IncrementalFileTask } = require('appc-tasks');
const crypto = require('crypto');
const fs = require('fs-extra');
const jsanalyze = require('node-titanium-sdk/lib/jsanalyze');
const nodeify = require('nodeify');
const path = require('path');
const pLimit = require('p-limit');
const { promisify } = require('util');
Expand Down Expand Up @@ -116,9 +117,7 @@ class ProcessJsTask extends IncrementalFileTask {

this.jsFiles = this.data.jsFiles;
this.jsBootstrapFiles.splice(0, 0, ...this.data.jsBootstrapFiles);
return Promise.all(Object.keys(this.jsFiles).map(relPath => {
return limit(() => this.processJsFile(this.jsFiles[relPath].src));
}));
return Promise.all(Array.from(this.inputFiles).map(filePath => limit(() => this.processJsFile(filePath))));
}

/**
Expand Down Expand Up @@ -153,16 +152,17 @@ class ProcessJsTask extends IncrementalFileTask {
return done();
}

this.transformAndCopy(source, from, to).then(() => {
this.data.contentHashes[from] = currentHash;
return done();
}).catch(e => {
// if we have a nicely formatted pointer to syntax error from babel, print it!
if (e.codeFrame) {
this.logger.error(e.codeFrame);
nodeify(this.transformAndCopy(source, from, to), (e) => {
if (e) {
// if we have a nicely formatted pointer to syntax error from babel, print it!
if (e.codeFrame) {
this.logger.error(e.codeFrame);
}
done(e);
}

done(e);
this.data.contentHashes[from] = currentHash;
return done();
});
});

Expand Down
2 changes: 2 additions & 0 deletions common/Resources/ti.internal/extensions/node/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import util from './util';
import assert from './assert';
import events from './events';
import BufferModule from './buffer';
import StringDecoder from './string_decoder';

// hook our implementations to get loaded by require
import { register } from '../binding';
Expand All @@ -17,6 +18,7 @@ register('util', util);
register('assert', assert);
register('events', events);
register('buffer', BufferModule);
register('string_decoder', StringDecoder);

// Register require('buffer').Buffer as global
global.Buffer = BufferModule.Buffer;

0 comments on commit ca3b99c

Please sign in to comment.