Skip to content

Commit

Permalink
Merge pull request #231 from CleverTap/develop
Browse files Browse the repository at this point in the history
Support iOS 5.2.2 and Android 5.2.1
  • Loading branch information
Anush-Shand authored Dec 5, 2023
2 parents 2346c8a + 1c388c8 commit 250df52
Show file tree
Hide file tree
Showing 17 changed files with 1,030 additions and 71 deletions.
17 changes: 17 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,22 @@
Change Log
==========
Version 2.7.2 *(December 5, 2023)*
-------------------------------------------
#### New Features

**Android specific**
* Supports [CleverTap Android SDK v5.2.1](https://github.com/CleverTap/clevertap-android-sdk/releases/tag/corev5.2.1_xpsv1.5.4). This supported version includes support for Custom Proxy Domain functionality. Check usage for cordova android [here](docs/Integrate-Android.md#integrate-custom-proxy-domain).

**iOS specific**
* Supports [CleverTap iOS SDK v5.2.2](https://github.com/CleverTap/clevertap-ios-sdk/releases/tag/5.2.2). This supported version includes support for Custom Proxy Domain functionality. Check usage for cordova ios [here](docs/Integrate-iOS.md#integrate-custom-proxy-domain).

#### Bug Fixes
* Fixes a crash in iOS 17/Xcode 15 related to alert inapps.

**Common for both android and iOS**
* Adds new public API `setLocale(String locale)` for in-built support to send the custom locale(i.e.language and country) data to the dashboard.
* Adds support for Integration Debugger to view errors and events on the dashboard when the debugLevel is set to 3.

Version 2.7.1 *(August 17, 2023)*
-------------------------------------------
#### New Features
Expand Down
4 changes: 2 additions & 2 deletions Samples/Cordova/ExampleProject/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
<allow-intent href="itms-apps:*" />
</platform>
<preference name="AndroidXEnabled" value="true" />
<preference name="android-targetSdkVersion" value="32" />
<preference name="android-maxSdkVersion" value="32"/>
<preference name="android-targetSdkVersion" value="33" />
<preference name="android-maxSdkVersion" value="33"/>
<preference name="android-minSdkVersion" value="21"/>
<preference name="GradlePluginGoogleServicesEnabled" value="true" />
</widget>
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,73 @@ function log(param){
}

function setupButtons() {
let variables = {
'cordova_var_string': 'cordova_var_string_value',
'cordova_var_map': {
cordova_var_map_string: 'cordova_var_map_value',
cordova_var_map_float: 10.11,
cordova_var_map_nested:{
cordova_var_map_nested_float:3.14
}
},
'cordova_var_int': 6,
'cordova_var_float': 6.9,
'cordova_var_boolean': true
};


let eventsMap = [

["title","Android 13 Push Primer"],
["promptPushPrimer",()=> CleverTap.promptPushPrimer({
inAppType: 'alert',
titleText: 'Get Notified',
messageText:
'Please enable notifications on your device to use Push Notifications.',
followDeviceOrientation: true,
positiveBtnText: 'Allow',
negativeBtnText: 'Cancel',
backgroundColor: '#FFFFFF',
btnBorderColor: '#FF0000',
titleTextColor: '#0000FF',
messageTextColor: '#000000',
btnTextColor: '#FFFFFF',
btnBackgroundColor: '#0000FF',
btnBorderRadius: '5',
imageUrl:"https://icons.iconarchive.com/icons/treetog/junior/64/camera-icon.png",
fallbackToSettings: true
})
],
["promptForPushPermission",()=> CleverTap.promptForPushPermission(true)],
["isPushPermissionGranted",()=> CleverTap.isPushPermissionGranted(val => log("isPushPermissionGranted value is " + val))],

["title","Product Experiences"],
["defineVariables", () => CleverTap.defineVariables(variables)],
["syncVariables", () => CleverTap.syncVariables()],
["syncVariablesinProd", () => CleverTap.syncVariablesinProd()],
["fetchVariables", () => CleverTap.fetchVariables(success => log("fetchVariables success = " + success))],
["getVariable", () => {
let key = prompt("Please enter key", "cordova_var_string");
CleverTap.getVariable(key,val => log(key+" value is "+JSON.stringify(val)));
}
],
["getVariables", () => {
CleverTap.getVariables(val => log("getVariables value is "+val.cordova_var_map.cordova_var_map_nested.cordova_var_map_nested_float));
}
],
["onVariablesChanged", () => {
CleverTap.onVariablesChanged(val => log("onVariablesChanged value is "+JSON.stringify(val)));
}
],
["onValueChanged", () => {
let key = prompt("Please enter key", "cordova_var_string");
CleverTap.onValueChanged(key,val => log("onValueChanged value is "+JSON.stringify(val)));
}
],

["title","Events"],
["record Event With Name", () => CleverTap.recordEventWithName("foo")],
["set Locale", () => CleverTap.setLocale("en_IN")],
["record Event With NameAndProps", () => CleverTap.recordEventWithNameAndProps("boo", {"bar": "zoo"})],
["record Charged Event With Details And Items", () => CleverTap.recordChargedEventWithDetailsAndItems({
"amount": 300,
Expand Down Expand Up @@ -94,14 +158,7 @@ function setupButtons() {

["title","Feature flag"],
["get Feature Flag", () => CleverTap.getFeatureFlag("test", true, val => log("Value is " + val))],

["title","Product Experiences"],
["get Feature Flag", () => CleverTap.getFeatureFlag("test", true, val => log("Value is " + val))],

// defineVariables({
// "cordova_var_string": "cordova_var_string_value"
// })],


["title","Device Identifiers"],
["get CleverTap ID", () => CleverTap.getCleverTapID(val => log("getCleverTapID is " + val))],

Expand Down Expand Up @@ -290,8 +347,10 @@ function initListeners() {
CleverTap.deleteInboxMessageForId("messageId")
CleverTap.deleteInboxMessagesForIds(["id1", "id2"])
CleverTap.markReadInboxMessageForId("messageId")
CleverTap.markReadInboxMessagesForIds(["id1", "id2"])
CleverTap.pushInboxNotificationViewedEventForId("messageId")
CleverTap.pushInboxNotificationClickedEventForId("messageId")
CleverTap.dismissInbox()
}
)
document.addEventListener('onCleverTapInboxMessagesDidUpdate', () => {
Expand All @@ -306,7 +365,7 @@ function initListeners() {
)
document.addEventListener('onCleverTapInboxItemClick', e => {
log("onCleverTapInboxItemClick")
log(e.customExtras)
log(JSON.stringify(e))
}
)

Expand Down Expand Up @@ -338,6 +397,15 @@ function initListeners() {
log(e.customExtras)
}
)
document.addEventListener('onCleverTapPushPermissionResponseReceived', e => {
log("onCleverTapPushPermissionResponseReceived")
log(e.accepted)
})

document.addEventListener('onCleverTapInAppNotificationShow', e => {
log("onCleverTapInAppNotificationShow")
log(e.customExtras)
})
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ cordova.define("clevertap-cordova.CleverTap", function(require, exports, module)
//

var CleverTap = function () {
const libName = 'Cordova';
const libVersion = 20702;
cordova.exec(null, null, "CleverTapPlugin", "setLibrary", [libName, libVersion]);
}

/*******************
Expand Down Expand Up @@ -74,11 +77,6 @@ CleverTap.prototype.setPushHuaweiToken = function (token) {
cordova.exec(null, null, "CleverTapPlugin", "setPushHuaweiTokenAsString", [token]);
}

// Change xiaomiCredentials
CleverTap.prototype.changeXiaomiCredentials = function (xiaomiAppID, xiaomiAppKey) {
cordova.exec(null, null, "CleverTapPlugin", "changeXiaomiCredentials", [xiaomiAppID, xiaomiAppKey]);
}

//Create Notification Channel for Android O

CleverTap.prototype.createNotification = function (extras) {
Expand Down Expand Up @@ -455,10 +453,22 @@ CleverTap.prototype.deleteInboxMessageForId = function (messageId) {
cordova.exec(null, null, "CleverTapPlugin", "deleteInboxMessageForId", [messageId]);
}

CleverTap.prototype.deleteInboxMessagesForIds = function (messageIds) {
cordova.exec(null, null, "CleverTapPlugin", "deleteInboxMessagesForIds", [messageIds]);
}

CleverTap.prototype.markReadInboxMessageForId = function (messageId) {
cordova.exec(null, null, "CleverTapPlugin", "markReadInboxMessageForId", [messageId]);
}

CleverTap.prototype.markReadInboxMessagesForIds = function (messageIds) {
cordova.exec(null, null, "CleverTapPlugin", "markReadInboxMessagesForIds", [messageIds]);
}

CleverTap.prototype.dismissInbox= function () {
cordova.exec(null, null, "CleverTapPlugin", "dismissInbox", []);
}

CleverTap.prototype.pushInboxNotificationViewedEventForId = function (messageId) {
cordova.exec(null, null, "CleverTapPlugin", "pushInboxNotificationViewedEventForId", [messageId]);
}
Expand Down Expand Up @@ -514,61 +524,189 @@ CleverTap.prototype.pushDisplayUnitClickedEventForID = function(unitId){
/****************************
* Feature Flag methods
****************************/
/**
* @deprecated - Since version 2.7.0 and will be removed in the future versions of this SDK.
*/
CleverTap.prototype.getFeatureFlag = function(name,defaultValue,successCallback){
cordova.exec(successCallback, null, "CleverTapPlugin", "getFeatureFlag", [name,defaultValue]);
}

/****************************
* Product Config methods
****************************/
/**
* @deprecated - Since version 2.7.0 and will be removed in the future versions of this SDK.
*/
CleverTap.prototype.setDefaultsMap = function(jsonMap){
cordova.exec(null, null, "CleverTapPlugin", "setDefaultsMap", [jsonMap]);
}

/**
* @deprecated - Since version 2.7.0 and will be removed in the future versions of this SDK.
*/
CleverTap.prototype.fetch = function(){
cordova.exec(null, null, "CleverTapPlugin", "fetch", []);
}

/**
* @deprecated - Since version 2.7.0 and will be removed in the future versions of this SDK.
*/
CleverTap.prototype.fetchWithMinimumFetchIntervalInSeconds = function(interval){
cordova.exec(null, null, "CleverTapPlugin", "fetchWithMinimumFetchIntervalInSeconds", [interval]);
}

/**
* @deprecated - Since version 2.7.0 and will be removed in the future versions of this SDK.
*/
CleverTap.prototype.activate = function(){
cordova.exec(null, null, "CleverTapPlugin", "activate", []);
}

/**
* @deprecated - Since version 2.7.0 and will be removed in the future versions of this SDK.
*/
CleverTap.prototype.fetchAndActivate = function(){
cordova.exec(null, null, "CleverTapPlugin", "fetchAndActivate", []);
}

/**
* @deprecated - Since version 2.7.0 and will be removed in the future versions of this SDK.
*/
CleverTap.prototype.setMinimumFetchIntervalInSeconds = function(interval){
cordova.exec(null, null, "CleverTapPlugin", "setMinimumFetchIntervalInSeconds", [interval]);
}

/**
* @deprecated - Since version 2.7.0 and will be removed in the future versions of this SDK.
*/
CleverTap.prototype.getLastFetchTimeStampInMillis = function(successCallback){
cordova.exec(successCallback, null, "CleverTapPlugin", "getLastFetchTimeStampInMillis", []);
}

/**
* @deprecated - Since version 2.7.0 and will be removed in the future versions of this SDK.
*/
CleverTap.prototype.getString = function(key,successCallback){
cordova.exec(successCallback, null, "CleverTapPlugin", "getString", [key]);
}

/**
* @deprecated - Since version 2.7.0 and will be removed in the future versions of this SDK.
*/
CleverTap.prototype.getBoolean = function(key,successCallback){
cordova.exec(successCallback, null, "CleverTapPlugin", "getBoolean", [key]);
}

/**
* @deprecated - Since version 2.7.0 and will be removed in the future versions of this SDK.
*/
CleverTap.prototype.getLong = function(key,successCallback){
cordova.exec(successCallback, null, "CleverTapPlugin", "getLong", [key]);
}

/**
* @deprecated - Since version 2.7.0 and will be removed in the future versions of this SDK.
*/
CleverTap.prototype.getDouble = function(key,successCallback){
cordova.exec(successCallback, null, "CleverTapPlugin", "getDouble", [key]);
}

/**
* @deprecated - Since version 2.7.0 and will be removed in the future versions of this SDK.
*/
CleverTap.prototype.reset = function(){
cordova.exec(null, null, "CleverTapPlugin", "reset", []);
}


/****************************
* Product Experiences methods
****************************/

/**
Uploads variables to the server. Requires Development/Debug build/configuration.
*/
CleverTap.prototype.syncVariables = function(){
cordova.exec(null, null, "CleverTapPlugin", "syncVariables", []);
}

/**
Uploads variables to the server.
@param {boolean} isProduction Provide `true` if variables must be sync in Productuon build/configuration.
*/
CleverTap.prototype.syncVariablesinProd = function(isProduction){
cordova.exec(null, null, "CleverTapPlugin", "syncVariablesinProd", [isProduction]);
}

/**
Forces variables to update from the server.
*/
CleverTap.prototype.fetchVariables = function(successCallback){
cordova.exec(successCallback, null, "CleverTapPlugin", "fetchVariables", []);
}

/**
Create variables.
@param {object} variables The JSON Object specifying the varibles to be created.
*/
CleverTap.prototype.defineVariables = function (variables) {
cordova.exec(null, null, "CleverTapPlugin", "defineVariables", [variables]);
}

/**
Get a variable or a group for the specified name.
@param {string} name - name.
*/
CleverTap.prototype.getVariable = function (name, successCallback) {
cordova.exec(successCallback, null, "CleverTapPlugin", "getVariable", [name]);
}

/**
Get all variables via a JSON object.
*/
CleverTap.prototype.getVariables = function (successCallback) {
cordova.exec(successCallback, null, "CleverTapPlugin", "getVariables", []);
}

/**
Adds a callback to be invoked when variables are initialised with server values. Will be called each time new values are fetched.
@param {function} handler The callback to add
*/
CleverTap.prototype.onVariablesChanged = function (handler) {
cordova.exec(handler, null, "CleverTapPlugin", "onVariablesChanged", []);
}

/**
Called when the value of the variable changes.
@param {name} string the name of the variable
@param {function} handler The callback to add
*/
CleverTap.prototype.onValueChanged = function (name, handler) {
cordova.exec(handler, null, "CleverTapPlugin", "onValueChanged", [name]);
}

/****************************
* Android 13 Push Primer
****************************/

CleverTap.prototype.promptPushPrimer = function(localInAppObject){
cordova.exec(null, null, "CleverTapPlugin", "promptPushPrimer", [localInAppObject]);
}

CleverTap.prototype.promptForPushPermission = function(showFallbackSettings){
cordova.exec(null, null, "CleverTapPlugin", "promptForPushPermission", [showFallbackSettings]);
}

CleverTap.prototype.isPushPermissionGranted = function(successCallback){
cordova.exec(successCallback, null, "CleverTapPlugin", "isPushPermissionGranted", []);
}

// Set Locale
// locale = string
CleverTap.prototype.setLocale = function (locale) {
cordova.exec(null, null, "CleverTapPlugin", "setLocale", [locale]);
}

function convertDateToEpochInProperties(items){
//Conversion of date object in suitable CleverTap format

Expand Down
Loading

0 comments on commit 250df52

Please sign in to comment.