Skip to content

Commit

Permalink
Merge pull request #243 from CleverTap/develop
Browse files Browse the repository at this point in the history
Release v2.3.0
  • Loading branch information
Anush-Shand authored Aug 12, 2024
2 parents 0743ce0 + 2fdb329 commit 3984cfa
Show file tree
Hide file tree
Showing 62 changed files with 3,349 additions and 405 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ Samples/Cordova/ExampleProject/plugins/clevertap-cordova/ExampleProject/platform
Samples/Cordova/ExampleProject/plugins/clevertap-cordova/ExampleProject/platforms/android/CordovaLib/build
Samples/Cordova/ExampleProject/plugins/clevertap-cordova/ExampleProject/platforms/ios/Pods
Samples/Cordova/ExampleProject/plugins/clevertap-cordova/ExampleProject/platforms/ios/Podfile.lock
src/android/google-services.json
Samples/Cordova/ExampleProject/platforms/android/app/src/main/google-services.json

Samples/IonicCapacitor/IonicCapReactProject/.project
Samples/IonicCapacitor/IonicCapReactProject/.idea
Expand Down
24 changes: 24 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,29 @@
Change Log
==========

Version 3.2.0 *(August 12, 2024)*
-------------------------------------------
#### New Features
**Android Specific**
* Supports [CleverTap Android SDK v6.2.1](https://github.com/CleverTap/clevertap-android-sdk/releases/tag/corev6.2.1).
* Supports Android 14, made it compliant with Android 14 requirements. Details [here](https://developer.android.com/about/versions/14/summary).
* Extends the push primer callback to notify permission denial when cancel button is clicked on `PromptForSettings` alert dialog.
* Adds Accessibility ids for UI components of SDK.
* Migrates `JobScheduler` to `WorkManager` for [Pull Notifications](https://developer.clevertap.com/docs/android-push#pull-notification).

#### Bug Fixes
**Android Specific**
* Fixes [#239](https://github.com/CleverTap/clevertap-cordova/issues/239), an issue where the `onPushNotification` callback was not triggered when notification was tapped from the `killed` state on `capacitor` apps.
* Fixes InApps crash in a rare activity destroyed race condition.
* Fixes Potential ANR in a race condition of SDK initialisation in multithreaded setup.
* Fixes a bug in Client Side InApps with regards to frequency limits.
* Fixes a crash due to `NullPointerException` related to `deviceInfo.deviceId`.
* Fixes an ANR related to `isMainProcess` check.
* Fixes an ANR due to eager initialisation of `CtApi` triggered by DeviceId generation.

#### Breaking API Changes
* Removes all `Xiaomi` related public methods as the `Xiaomi` SDK has been discontinued. Details [here](https://developer.clevertap.com/docs/discontinuation-of-xiaomi-push-service).

Version 3.1.0 *(April 27, 2024)*
-------------------------------------------
#### New Features
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ To get started, sign up [here](https://clevertap.com/live-product-demo/).

## ✅ Supported Versions

- [CleverTap Android SDK version 6.0.0](https://github.com/CleverTap/clevertap-android-sdk/releases/tag/corev6.0.0_ptv1.2.2)
- [CleverTap Android SDK version 6.2.1](https://github.com/CleverTap/clevertap-android-sdk/releases/tag/corev6.2.1)
- [CleverTap iOS SDK version 6.2.1](https://github.com/CleverTap/clevertap-ios-sdk/releases/tag/6.2.1)

## 🚀 Installation and Quick Start
Expand Down
2 changes: 1 addition & 1 deletion Samples/Cordova/ExampleProject/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"license": "Apache-2.0",
"devDependencies": {
"clevertap-cordova": "file:../../..",
"cordova-android": "^12.0.1",
"cordova-android": "^13.0.0",
"cordova-android-support-gradle-release": "^3.0.1",
"cordova-ios": "^7.0.0",
"ios": "0.0.1"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,6 @@
under the License.
-->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.apache.cordova" android:versionName="1.0" android:versionCode="1">
android:versionName="1.0"
android:versionCode="1">
</manifest>
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,14 @@ allprojects {
apply plugin: 'com.android.library'

android {
namespace 'org.apache.cordova'

compileSdkVersion cordovaConfig.COMPILE_SDK_VERSION
buildToolsVersion cordovaConfig.BUILD_TOOLS_VERSION

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
sourceCompatibility JavaLanguageVersion.of(cordovaConfig.JAVA_SOURCE_COMPATIBILITY)
targetCompatibility JavaLanguageVersion.of(cordovaConfig.JAVA_TARGET_COMPATIBILITY)
}

// For the Android Cordova Lib, we allow changing the minSdkVersion, but it is at the users own risk
Expand All @@ -75,10 +77,16 @@ android {
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/NOTICE'
}

publishing {
singleVariant('release') {
withSourcesJar()
}
}
}

dependencies {
implementation "androidx.appcompat:appcompat:${cordovaConfig.ANDROIDX_APP_COMPAT_VERSION}"
api "androidx.appcompat:appcompat:${cordovaConfig.ANDROIDX_APP_COMPAT_VERSION}"
implementation "androidx.webkit:webkit:${cordovaConfig.ANDROIDX_WEBKIT_VERSION}"
implementation "androidx.core:core-splashscreen:${cordovaConfig.ANDROIDX_CORE_SPLASHSCREEN_VERSION}"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ Boolean isVersionValid(version) {
return !(new Version(version)).isEqual('0.0.0')
}

Boolean isVersionGreaterThanEqual(versionX, versionY) {
return (new Version(versionX)) >= (new Version(versionY))
}

String doFindLatestInstalledBuildTools(String minBuildToolsVersionString) {
def buildToolsDirContents
try {
Expand Down Expand Up @@ -83,9 +87,9 @@ String doFindLatestInstalledBuildTools(String minBuildToolsVersionString) {
String getAndroidSdkDir() {
def rootDir = project.rootDir
def androidSdkDir = null
String envVar = System.getenv("ANDROID_SDK_ROOT")
String envVar = System.getenv("ANDROID_HOME")
if (envVar == null) {
envVar = System.getenv("ANDROID_HOME")
envVar = System.getenv("ANDROID_SDK_ROOT")
}

def localProperties = new File(rootDir, 'local.properties')
Expand Down Expand Up @@ -125,14 +129,6 @@ def doExtractIntFromManifest(name) {
return new BigInteger(matcher.group(1))
}

def doExtractStringFromManifest(name) {
def manifestFile = file(android.sourceSets.main.manifest.srcFile)
def pattern = Pattern.compile(name + "=\"(\\S+)\"")
def matcher = pattern.matcher(manifestFile.getText())
matcher.find()
return matcher.group(1)
}

def doGetConfigXml() {
def xml = file("src/main/res/xml/config.xml").getText()
// Disable namespace awareness since Cordova doesn't use them properly
Expand Down Expand Up @@ -231,7 +227,6 @@ ext {
privateHelpers.getProjectTarget = { doGetProjectTarget() }
privateHelpers.applyCordovaConfigCustomization = { doApplyCordovaConfigCustomization() }
privateHelpers.extractIntFromManifest = { name -> doExtractIntFromManifest(name) }
privateHelpers.extractStringFromManifest = { name -> doExtractStringFromManifest(name) }
privateHelpers.ensureValueExists = { filePath, props, key -> doEnsureValueExists(filePath, props, key) }

// These helpers can be used by plugins / projects and will not change.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.

# GENERATED FILE! DO NOT EDIT!

# This file was originally created by the Android Tools, but is now
Expand All @@ -10,4 +27,4 @@ split.density=false
apk-configurations=
renderscript.opt.level=O0
android.library=true
target=android-32
target=android-34
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ public static Object getBuildConfigValue(Context ctx, String key)
{
try
{
Class<?> clazz = Class.forName(ctx.getClass().getPackage().getName() + ".BuildConfig");
String packageName = ctx.getApplicationInfo().packageName;
Class<?> clazz = Class.forName(packageName + ".BuildConfig");
Field field = clazz.getField(key);
return field.get(null);
} catch (ClassNotFoundException e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ public class ConfigXmlParser {
private static String SCHEME_HTTP = "http";
private static String SCHEME_HTTPS = "https";
private static String DEFAULT_HOSTNAME = "localhost";
private static final String DEFAULT_CONTENT_SRC = "index.html";

private String launchUrl;
private String contentSrc;
Expand Down Expand Up @@ -110,6 +111,18 @@ else if (eventType == XmlPullParser.END_TAG)
e.printStackTrace();
}
}

onPostParse();
}

private void onPostParse() {
// After parsing, if contentSrc is still null, it signals
// that <content> tag was completely missing. In this case,
// default it.
// https://github.com/apache/cordova-android/issues/1432
if (contentSrc == null) {
contentSrc = DEFAULT_CONTENT_SRC;
}
}

public void handleStartTag(XmlPullParser xml) {
Expand Down Expand Up @@ -140,7 +153,7 @@ else if (strNode.equals("content")) {
contentSrc = src;
} else {
// Default
contentSrc = "index.html";
contentSrc = DEFAULT_CONTENT_SRC;
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -391,6 +391,7 @@ public void onReceivedError(final int errorCode, final String description, final
if ((errorUrl != null) && (!failingUrl.equals(errorUrl)) && (appView != null)) {
// Load URL on UI thread
me.runOnUiThread(new Runnable() {
@Override
public void run() {
me.appView.showWebPage(errorUrl, false, true, null);
}
Expand All @@ -400,6 +401,7 @@ public void run() {
else {
final boolean exit = !(errorCode == WebViewClient.ERROR_HOST_LOOKUP);
me.runOnUiThread(new Runnable() {
@Override
public void run() {
if (exit) {
me.appView.getView().setVisibility(View.GONE);
Expand All @@ -416,6 +418,7 @@ public void run() {
public void displayError(final String title, final String message, final String button, final boolean exit) {
final CordovaActivity me = this;
me.runOnUiThread(new Runnable() {
@Override
public void run() {
try {
AlertDialog.Builder dlg = new AlertDialog.Builder(me);
Expand All @@ -424,6 +427,7 @@ public void run() {
dlg.setCancelable(false);
dlg.setPositiveButton(button,
new AlertDialog.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
if (exit) {
Expand Down Expand Up @@ -488,6 +492,7 @@ public Object onMessage(String id, Object data) {
return null;
}

@Override
protected void onSaveInstanceState(Bundle outState) {
cordovaInterface.onSaveInstanceState(outState);
super.onSaveInstanceState(outState);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ public CordovaClientCertRequest(ClientCertRequest request) {
* Cancel this request
*/
@SuppressLint("NewApi")
@Override
public void cancel()
{
request.cancel();
Expand All @@ -50,6 +51,7 @@ public void cancel()
* Returns the host name of the server requesting the certificate.
*/
@SuppressLint("NewApi")
@Override
public String getHost()
{
return request.getHost();
Expand All @@ -59,6 +61,7 @@ public String getHost()
* Returns the acceptable types of asymmetric keys (can be null).
*/
@SuppressLint("NewApi")
@Override
public String[] getKeyTypes()
{
return request.getKeyTypes();
Expand All @@ -68,6 +71,7 @@ public String[] getKeyTypes()
* Returns the port number of the server requesting the certificate.
*/
@SuppressLint("NewApi")
@Override
public int getPort()
{
return request.getPort();
Expand All @@ -77,6 +81,7 @@ public int getPort()
* Returns the acceptable certificate issuers for the certificate matching the private key (can be null).
*/
@SuppressLint("NewApi")
@Override
public Principal[] getPrincipals()
{
return request.getPrincipals();
Expand All @@ -86,6 +91,7 @@ public Principal[] getPrincipals()
* Ignore the request for now. Do not remember user's choice.
*/
@SuppressLint("NewApi")
@Override
public void ignore()
{
request.ignore();
Expand All @@ -98,6 +104,7 @@ public void ignore()
* @param chain The certificate chain
*/
@SuppressLint("NewApi")
@Override
public void proceed(PrivateKey privateKey, X509Certificate[] chain)
{
request.proceed(privateKey, chain);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,18 +43,21 @@ public void showAlert(String message, final Result result) {
dlg.setCancelable(true);
dlg.setPositiveButton(android.R.string.ok,
new AlertDialog.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
result.gotResult(true, null);
}
});
dlg.setOnCancelListener(
new DialogInterface.OnCancelListener() {
@Override
public void onCancel(DialogInterface dialog) {
result.gotResult(false, null);
}
});
dlg.setOnKeyListener(new DialogInterface.OnKeyListener() {
//DO NOTHING
@Override
public boolean onKey(DialogInterface dialog, int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_BACK)
{
Expand All @@ -75,24 +78,28 @@ public void showConfirm(String message, final Result result) {
dlg.setCancelable(true);
dlg.setPositiveButton(android.R.string.ok,
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
result.gotResult(true, null);
}
});
dlg.setNegativeButton(android.R.string.cancel,
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
result.gotResult(false, null);
}
});
dlg.setOnCancelListener(
new DialogInterface.OnCancelListener() {
@Override
public void onCancel(DialogInterface dialog) {
result.gotResult(false, null);
}
});
dlg.setOnKeyListener(new DialogInterface.OnKeyListener() {
//DO NOTHING
@Override
public boolean onKey(DialogInterface dialog, int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_BACK)
{
Expand Down Expand Up @@ -126,13 +133,15 @@ public void showPrompt(String message, String defaultValue, final Result result)
dlg.setCancelable(false);
dlg.setPositiveButton(android.R.string.ok,
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
String userText = input.getText().toString();
result.gotResult(true, userText);
}
});
dlg.setNegativeButton(android.R.string.cancel,
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
result.gotResult(false, null);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ public CordovaHttpAuthHandler(HttpAuthHandler handler) {
/**
* Instructs the WebView to cancel the authentication request.
*/
@Override
public void cancel () {
this.handler.cancel();
}
Expand All @@ -45,6 +46,7 @@ public void cancel () {
* @param username
* @param password
*/
@Override
public void proceed (String username, String password) {
this.handler.proceed(username, password);
}
Expand Down
Loading

0 comments on commit 3984cfa

Please sign in to comment.