Skip to content

Commit

Permalink
Merge branch 'master' into resize
Browse files Browse the repository at this point in the history
  • Loading branch information
m1ga committed Dec 20, 2018
2 parents 95ead78 + 33498ae commit ab48da0
Show file tree
Hide file tree
Showing 215 changed files with 12,866 additions and 6,979 deletions.
16 changes: 16 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@
},
"globals": {
"Ti": false,
"Titanium": false,
"__filename": false,
"__dirname": false,
"kroll": false
},
"rules": {
"strict": ["error", "global"]
Expand All @@ -20,5 +22,19 @@
"sourceType": "module"
},
},
{
"files": [ "dangerfile.js" ],
"parserOptions": {
"ecmaVersion": 2017,
"sourceType": "module"
},
},
{
"files": [ "android/runtime/common/src/js/**/*.js", "android/modules/**/src/js/**/*.js" ],
"parserOptions": {
"ecmaVersion": 6,
"sourceType": "script"
}
}
]
}
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.
2 changes: 2 additions & 0 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ module.exports = function (grunt) {
'build/**/*.js',
'cli/!(locales)/**/*.js',
'android/cli/!(locales)/**/*.js',
'android/modules/**/src/js/**/*.js',
'android/runtime/common/src/js/**/*.js',
'iphone/cli/!(locales)/**/*.js',
'tests/Resources/**/*test.js'
]
Expand Down
2 changes: 1 addition & 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,npm_test.log,android/**/*.java', name: 'danger'
stash includes: 'node_modules/,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
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ Check out our [Hyperloop Sample App](https://github.com/appcelerator/hyperloop-e

## Alloy

[Alloy](http://docs.appcelerator.com/platform/latest/#!/guide/Alloy_Quick_Start) is the MVC application framework built
[Alloy](http://docs.appcelerator.com/platform/latest/#!/guide/Alloy_Getting_Started) is the MVC application framework built
on top of Titanium. It is optional. It rocks. Check it out if you're considering using Titanium.
It is also a separate [open source project](https://github.com/appcelerator/alloy) available under Apache Public License.

Expand Down Expand Up @@ -167,7 +167,7 @@ Please visit the official documentation site at [http://docs.appcelerator.com/](

### Developer Community

[Appcelerator Developer](http://developer.appcelerator.com) is our developer community.
[Appcelerator Developer](https://developer.axway.com/) is our developer community.

### Video Tutorials

Expand Down
2 changes: 1 addition & 1 deletion android/dependency.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"min_api_level": "16",
"min_api_level": "19",
"dependencies":
{
"appcompat":["compat","design"],
Expand Down
2 changes: 1 addition & 1 deletion android/dev/TitaniumTest/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.titanium.test" android:versionCode="1" android:versionName="1.0">
<uses-sdk android:minSdkVersion="16" android:targetSdkVersion="27"/>
<uses-sdk android:minSdkVersion="19" android:targetSdkVersion="28"/>
<application android:icon="@drawable/appicon" android:label="TitaniumTest" android:name=".TitaniumTestApplication" android:theme="@style/Theme.AppCompat">
<activity android:name=".TitaniumTestActivity" android:label="@string/app_name" android:theme="@style/Theme.Titanium" android:configChanges="keyboardHidden|orientation|screenSize">
<intent-filter>
Expand Down
2 changes: 1 addition & 1 deletion android/modules/accelerometer/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
package="ti.modules.titanium.accelerometer"
android:versionCode="1"
android:versionName="1.0">
<uses-sdk android:minSdkVersion="16" />
<uses-sdk android:minSdkVersion="19" />

<application android:label="@string/app_name">
</application>
Expand Down
2 changes: 1 addition & 1 deletion android/modules/analytics/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
android:versionCode="1"
android:versionName="1.0">

<uses-sdk android:minSdkVersion="16" />
<uses-sdk android:minSdkVersion="19" />

<application android:label="@string/app_name">
</application>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,9 @@ public String getLastEvent()
// clang-format on
{
if (TiApplication.getInstance().isAnalyticsEnabled()) {
return analytics.getLastEvent().toString();
if (analytics.getLastEvent() != null) {
return analytics.getLastEvent().toString();
}
} else {
Log.e(
TAG,
Expand Down
2 changes: 1 addition & 1 deletion android/modules/android/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
android:versionCode="1"
android:versionName="1.0">

<uses-sdk android:minSdkVersion="16" android:targetSdkVersion="28" />
<uses-sdk android:minSdkVersion="19" android:targetSdkVersion="28" />

<application android:label="@string/app_name">
</application>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
/**
* Appcelerator Titanium Mobile
* Copyright (c) 2009-2018 by Axway, Inc. All Rights Reserved.
* Copyright (c) 2009-Present by Axway, Inc. All Rights Reserved.
* Licensed under the terms of the Apache Public License
* Please see the LICENSE included with this distribution for details.
*/
package ti.modules.titanium.android;

import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;

import android.content.pm.PackageManager;
Expand Down Expand Up @@ -522,11 +523,29 @@ public class AndroidModule extends KrollModule
public static final int IMPORTANCE_UNSPECIFIED = NotificationManagerCompat.IMPORTANCE_UNSPECIFIED;

protected RProxy r;
private LinkedList<BroadcastReceiverProxy> registeredBroadcastReceiverProxyList = new LinkedList<>();

private static final int REQUEST_CODE = 99;

public AndroidModule()
{
super();

// Set up a listener to be invoked when the JavaScript runtime is about to be terminated/disposed.
KrollRuntime.addOnDisposingListener(new KrollRuntime.OnDisposingListener() {
@Override
public void onDisposing(KrollRuntime runtime)
{
// Remove this listener from the runtime's static collection.
KrollRuntime.removeOnDisposingListener(this);

// Unregister all currently registerd broadcast receviers.
// They can no longer be handled by the terminating JavaScript runtime.
while (registeredBroadcastReceiverProxyList.isEmpty() == false) {
unregisterBroadcastReceiver(registeredBroadcastReceiverProxyList.pollFirst());
}
}
});
}

@Kroll.method
Expand Down Expand Up @@ -701,8 +720,10 @@ public void registerBroadcastReceiver(BroadcastReceiverProxy receiverProxy, Obje
filter.addAction(TiConvert.toString(action));
}

TiApplication.getInstance().getApplicationContext().registerReceiver(receiverProxy.getBroadcastReceiver(),
filter);
TiApplication.getInstance().registerReceiver(receiverProxy.getBroadcastReceiver(), filter);
if (this.registeredBroadcastReceiverProxyList.contains(receiverProxy) == false) {
this.registeredBroadcastReceiverProxyList.add(receiverProxy);
}
KrollRuntime.incrementServiceReceiverRefCount();
}
}
Expand All @@ -712,8 +733,8 @@ public void unregisterBroadcastReceiver(BroadcastReceiverProxy receiverProxy)
{
if (receiverProxy != null) {
try {
TiApplication.getInstance().getApplicationContext().unregisterReceiver(
receiverProxy.getBroadcastReceiver());
TiApplication.getInstance().unregisterReceiver(receiverProxy.getBroadcastReceiver());
this.registeredBroadcastReceiverProxyList.remove(receiverProxy);
KrollRuntime.decrementServiceReceiverRefCount();
} catch (Exception e) {
Log.e(TAG, "Unable to unregister broadcast receiver: " + e.getMessage());
Expand Down
2 changes: 1 addition & 1 deletion android/modules/app/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
android:versionCode="1"
android:versionName="1.0">

<uses-sdk android:minSdkVersion="16" />
<uses-sdk android:minSdkVersion="19" />

<application android:label="@string/app_name">
</application>
Expand Down
17 changes: 9 additions & 8 deletions android/modules/app/src/js/properties.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
exports.bootstrap = function(Titanium) {
var TAG = "properties";
'use strict';

exports.bootstrap = function (Titanium) {
var Properties = Titanium.App.Properties;

function nullOrDefaultValue(defaultValue) {
Expand All @@ -10,27 +11,27 @@ exports.bootstrap = function(Titanium) {
}

function propertyGetter(delegate) {
return function(key, defaultValue) {
return function (key, defaultValue) {
if (!Properties.hasProperty(key)) {
return nullOrDefaultValue(defaultValue);
}
return delegate.call(Properties, key);
}
};
}

["getBool", "getDouble", "getInt", "getString"].forEach(function(getter) {
[ 'getBool', 'getDouble', 'getInt', 'getString' ].forEach(function (getter) {
Properties[getter] = propertyGetter(Properties[getter]);
});

Properties.getList = Properties.getObject = function(key, defaultValue) {
Properties.getList = Properties.getObject = function (key, defaultValue) {
if (!Properties.hasProperty(key)) {
return nullOrDefaultValue(defaultValue);
}

return JSON.parse(Properties.getString(key));
};

Properties.setList = Properties.setObject = function(key, val) {
Properties.setList = Properties.setObject = function (key, val) {
Properties.setString(key, JSON.stringify(val));
};
};
};
2 changes: 1 addition & 1 deletion android/modules/calendar/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
android:versionCode="1"
android:versionName="1.0">

<uses-sdk android:minSdkVersion="16" />
<uses-sdk android:minSdkVersion="19" />

<application android:label="@string/app_name">
</application>
Expand Down
2 changes: 1 addition & 1 deletion android/modules/contacts/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
android:versionCode="1"
android:versionName="1.0">

<uses-sdk android:minSdkVersion="16" />
<uses-sdk android:minSdkVersion="19" />

<application android:label="@string/app_name">
</application>
Expand Down
2 changes: 1 addition & 1 deletion android/modules/database/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
android:versionCode="1"
android:versionName="1.0">

<uses-sdk android:minSdkVersion="16" />
<uses-sdk android:minSdkVersion="19" />

<application android:label="@string/app_name">
</application>
Expand Down
2 changes: 1 addition & 1 deletion android/modules/filesystem/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
android:versionCode="1"
android:versionName="1.0">

<uses-sdk android:minSdkVersion="16" />
<uses-sdk android:minSdkVersion="19" />

<application android:label="@string/app_name">
</application>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import java.io.IOException;
import java.net.MalformedURLException;

import android.Manifest;
import android.app.Activity;
import android.content.Context;
import android.content.pm.PackageManager;
Expand Down Expand Up @@ -97,12 +98,13 @@ private boolean hasStoragePermissions()
if (Build.VERSION.SDK_INT < 23) {
return true;
}

Context context = TiApplication.getInstance().getApplicationContext();
if (context.checkSelfPermission(android.Manifest.permission.READ_EXTERNAL_STORAGE)
== PackageManager.PERMISSION_GRANTED) {
return true;
}
return false;

return ((context.checkSelfPermission(android.Manifest.permission.READ_EXTERNAL_STORAGE)
== PackageManager.PERMISSION_GRANTED)
&& (context.checkSelfPermission(Manifest.permission.WRITE_EXTERNAL_STORAGE)
== PackageManager.PERMISSION_GRANTED));
}

@Kroll.method
Expand All @@ -112,7 +114,8 @@ public void requestStoragePermissions(@Kroll.argument(optional = true) KrollFunc
return;
}

String[] permissions = new String[] { android.Manifest.permission.READ_EXTERNAL_STORAGE };
String[] permissions = new String[] { android.Manifest.permission.READ_EXTERNAL_STORAGE,
android.Manifest.permission.WRITE_EXTERNAL_STORAGE };
Activity currentActivity = TiApplication.getInstance().getCurrentActivity();
TiBaseActivity.registerPermissionRequestCallback(TiC.PERMISSION_CODE_EXTERNAL_STORAGE, permissionCallback,
getKrollObject());
Expand Down
2 changes: 1 addition & 1 deletion android/modules/geolocation/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
android:versionCode="1"
android:versionName="1.0">

<uses-sdk android:minSdkVersion="16" />
<uses-sdk android:minSdkVersion="19" />

<application android:label="@string/app_name">
</application>
Expand Down

0 comments on commit ab48da0

Please sign in to comment.