clevertap-react-native 0.7.0 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/android/.gradle/6.1.1/executionHistory/executionHistory.bin +0 -0
- package/android/.gradle/6.1.1/executionHistory/executionHistory.lock +0 -0
- package/android/.gradle/6.1.1/fileContent/fileContent.lock +0 -0
- package/android/.gradle/6.1.1/fileHashes/fileHashes.bin +0 -0
- package/android/.gradle/6.1.1/fileHashes/fileHashes.lock +0 -0
- package/android/.gradle/6.1.1/fileHashes/resourceHashesCache.bin +0 -0
- package/android/.gradle/6.1.1/javaCompile/classAnalysis.bin +0 -0
- package/android/.gradle/6.1.1/javaCompile/jarAnalysis.bin +0 -0
- package/android/.gradle/6.1.1/javaCompile/javaCompile.lock +0 -0
- package/android/.gradle/6.1.1/javaCompile/taskHistory.bin +0 -0
- package/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
- package/android/.gradle/buildOutputCleanup/cache.properties +1 -1
- package/android/.gradle/buildOutputCleanup/outputFiles.bin +0 -0
- package/android/.gradle/checksums/checksums.lock +0 -0
- package/android/.gradle/checksums/md5-checksums.bin +0 -0
- package/android/.gradle/checksums/sha1-checksums.bin +0 -0
- package/android/android.iml +5 -86
- package/android/build/generated/source/buildConfig/debug/com/clevertap/react/BuildConfig.java +2 -2
- package/android/build/intermediates/aapt_friendly_merged_manifests/debug/aapt/AndroidManifest.xml +3 -3
- package/android/build/intermediates/aapt_friendly_merged_manifests/debug/aapt/output.json +2 -2
- package/android/build/intermediates/aar_main_jar/debug/classes.jar +0 -0
- package/android/build/intermediates/compile_only_not_namespaced_r_class_jar/debug/R.jar +0 -0
- package/android/build/intermediates/compile_symbol_list/debug/R.txt +1785 -374
- package/android/build/intermediates/incremental/packageDebugResources/compile-file-map.properties +1 -1
- package/android/build/intermediates/javac/debug/classes/com/clevertap/react/BuildConfig.class +0 -0
- package/android/build/intermediates/javac/debug/classes/com/clevertap/react/CleverTapApplication$1$1.class +0 -0
- package/android/build/intermediates/javac/debug/classes/com/clevertap/react/CleverTapApplication$1.class +0 -0
- package/android/build/intermediates/javac/debug/classes/com/clevertap/react/CleverTapApplication.class +0 -0
- package/android/build/intermediates/javac/debug/classes/com/clevertap/react/CleverTapModule$1.class +0 -0
- package/android/build/intermediates/javac/debug/classes/com/clevertap/react/CleverTapModule$2.class +0 -0
- package/android/build/intermediates/javac/debug/classes/com/clevertap/react/CleverTapModule$ErrorMessages.class +0 -0
- package/android/build/intermediates/javac/debug/classes/com/clevertap/react/CleverTapModule$InBoxMessages.class +0 -0
- package/android/build/intermediates/javac/debug/classes/com/clevertap/react/CleverTapModule.class +0 -0
- package/android/build/intermediates/javac/debug/classes/com/clevertap/react/CleverTapUtils.class +0 -0
- package/android/build/intermediates/library_manifest/debug/AndroidManifest.xml +3 -3
- package/android/build/intermediates/manifest_merge_blame_file/debug/manifest-merger-blame-debug-report.txt +3 -3
- package/android/build/intermediates/merged_manifests/debug/output.json +2 -2
- package/android/build/intermediates/symbol_list_with_package_name/debug/package-aware-r.txt +772 -40
- package/android/build/outputs/aar/android-debug.aar +0 -0
- package/android/build.gradle +3 -3
- package/android/src/main/java/com/clevertap/react/CleverTapApplication.java +79 -0
- package/android/src/main/java/com/clevertap/react/CleverTapModule.java +2 -22
- package/android/src/main/java/com/clevertap/react/CleverTapUtils.java +36 -0
- package/clevertap-react-native.podspec +2 -2
- package/docs/install.md +2 -2
- package/docs/integration.md +15 -3
- package/docs/usage.md +6 -0
- package/index.d.ts +2 -1
- package/index.js +2 -1
- package/ios/CleverTapReact/CleverTapSDK.framework.zip +0 -0
- package/package.json +3 -3
|
Binary file
|
package/android/build.gradle
CHANGED
|
@@ -21,8 +21,8 @@ android {
|
|
|
21
21
|
defaultConfig {
|
|
22
22
|
minSdkVersion 16
|
|
23
23
|
targetSdkVersion 31
|
|
24
|
-
versionCode
|
|
25
|
-
versionName "0.
|
|
24
|
+
versionCode 90
|
|
25
|
+
versionName "0.9.0"
|
|
26
26
|
}
|
|
27
27
|
buildTypes {
|
|
28
28
|
release {
|
|
@@ -39,7 +39,7 @@ dependencies {
|
|
|
39
39
|
maven { url "$rootDir/../node_modules/react-native/android" }
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
-
api 'com.clevertap.android:clevertap-android-sdk:4.
|
|
42
|
+
api 'com.clevertap.android:clevertap-android-sdk:4.6.0'
|
|
43
43
|
implementation 'com.android.installreferrer:installreferrer:2.2'
|
|
44
44
|
//compile 'com.android.support:appcompat-v7:28.0.0'
|
|
45
45
|
implementation 'com.facebook.react:react-native:+'
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
package com.clevertap.react;
|
|
2
|
+
|
|
3
|
+
import static com.clevertap.react.CleverTapUtils.getWritableMapFromMap;
|
|
4
|
+
|
|
5
|
+
import android.os.Handler;
|
|
6
|
+
import android.os.Looper;
|
|
7
|
+
import android.util.Log;
|
|
8
|
+
import com.clevertap.android.sdk.Application;
|
|
9
|
+
import com.clevertap.android.sdk.CleverTapAPI;
|
|
10
|
+
import com.clevertap.android.sdk.pushnotification.CTPushNotificationListener;
|
|
11
|
+
import com.facebook.react.ReactApplication;
|
|
12
|
+
import com.facebook.react.ReactInstanceManager;
|
|
13
|
+
import com.facebook.react.bridge.Arguments;
|
|
14
|
+
import com.facebook.react.bridge.ReactContext;
|
|
15
|
+
import com.facebook.react.bridge.WritableMap;
|
|
16
|
+
import com.facebook.react.modules.core.DeviceEventManagerModule;
|
|
17
|
+
import java.util.HashMap;
|
|
18
|
+
import java.util.Iterator;
|
|
19
|
+
import java.util.Map;
|
|
20
|
+
import org.json.JSONObject;
|
|
21
|
+
|
|
22
|
+
public class CleverTapApplication extends Application implements CTPushNotificationListener {
|
|
23
|
+
private static final String TAG = "CleverTapApplication";
|
|
24
|
+
@Override
|
|
25
|
+
public void onCreate() {
|
|
26
|
+
super.onCreate();
|
|
27
|
+
CleverTapAPI.getDefaultInstance(this)
|
|
28
|
+
.setCTPushNotificationListener(this);// Workaround when app is in killed state
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
//Push Notification Clicked callback workaround when app is in killed state
|
|
32
|
+
@Override
|
|
33
|
+
public void onNotificationClickedPayloadReceived(final HashMap<String, Object> payload) {
|
|
34
|
+
Log.e(TAG, "onNotificationClickedPayloadReceived called");
|
|
35
|
+
final String CLEVERTAP_PUSH_NOTIFICATION_CLICKED = "CleverTapPushNotificationClicked";
|
|
36
|
+
|
|
37
|
+
Handler handler = new Handler(Looper.getMainLooper());
|
|
38
|
+
handler.post(new Runnable() {
|
|
39
|
+
public void run() {
|
|
40
|
+
|
|
41
|
+
// Construct and load our normal React JS code bundle
|
|
42
|
+
final ReactInstanceManager mReactInstanceManager = ((ReactApplication) getApplicationContext())
|
|
43
|
+
.getReactNativeHost().getReactInstanceManager();
|
|
44
|
+
ReactContext context = mReactInstanceManager.getCurrentReactContext();
|
|
45
|
+
// If it's constructed, send a notification
|
|
46
|
+
if (context != null) {
|
|
47
|
+
sendEvent(CLEVERTAP_PUSH_NOTIFICATION_CLICKED, getWritableMapFromMap(payload), context);
|
|
48
|
+
} else {
|
|
49
|
+
// Otherwise wait for construction, then send the notification
|
|
50
|
+
mReactInstanceManager
|
|
51
|
+
.addReactInstanceEventListener(new ReactInstanceManager.ReactInstanceEventListener() {
|
|
52
|
+
public void onReactContextInitialized(ReactContext context) {
|
|
53
|
+
sendEvent(CLEVERTAP_PUSH_NOTIFICATION_CLICKED, getWritableMapFromMap(payload),
|
|
54
|
+
context);
|
|
55
|
+
mReactInstanceManager.removeReactInstanceEventListener(this);
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
if (!mReactInstanceManager.hasStartedCreatingInitialContext()) {
|
|
59
|
+
// Construct it in the background
|
|
60
|
+
mReactInstanceManager.createReactContextInBackground();
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
private void sendEvent(String eventName, Object params, ReactContext context) {
|
|
70
|
+
try {
|
|
71
|
+
context.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class)
|
|
72
|
+
.emit(eventName, params);
|
|
73
|
+
Log.e(TAG, "Sending event "+eventName);
|
|
74
|
+
} catch (Throwable t) {
|
|
75
|
+
Log.e(TAG, t.getLocalizedMessage());
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
package com.clevertap.react;
|
|
2
2
|
|
|
3
|
+
import static com.clevertap.react.CleverTapUtils.getWritableMapFromMap;
|
|
4
|
+
|
|
3
5
|
import android.location.Location;
|
|
4
6
|
import android.net.Uri;
|
|
5
7
|
import android.os.Build.VERSION;
|
|
@@ -1406,28 +1408,6 @@ public class CleverTapModule extends ReactContextBaseJavaModule implements SyncL
|
|
|
1406
1408
|
return writableArray;
|
|
1407
1409
|
}
|
|
1408
1410
|
|
|
1409
|
-
@SuppressWarnings({"TypeParameterExplicitlyExtendsObject", "rawtypes"})
|
|
1410
|
-
private WritableMap getWritableMapFromMap(Map<String, ? extends Object> var1) {
|
|
1411
|
-
JSONObject extras = var1 != null ? new JSONObject(var1) : new JSONObject();
|
|
1412
|
-
WritableMap extrasParams = Arguments.createMap();
|
|
1413
|
-
Iterator extrasKeys = extras.keys();
|
|
1414
|
-
while (extrasKeys.hasNext()) {
|
|
1415
|
-
String key = null;
|
|
1416
|
-
String value = null;
|
|
1417
|
-
try {
|
|
1418
|
-
key = extrasKeys.next().toString();
|
|
1419
|
-
value = extras.get(key).toString();
|
|
1420
|
-
} catch (Throwable t) {
|
|
1421
|
-
Log.e(TAG, t.getLocalizedMessage());
|
|
1422
|
-
}
|
|
1423
|
-
|
|
1424
|
-
if (key != null && value != null) {
|
|
1425
|
-
extrasParams.putString(key, value);
|
|
1426
|
-
}
|
|
1427
|
-
}
|
|
1428
|
-
return extrasParams;
|
|
1429
|
-
}
|
|
1430
|
-
|
|
1431
1411
|
private HashMap<String, Object> profileFromReadableMap(ReadableMap profileMap) {
|
|
1432
1412
|
if (profileMap == null) {
|
|
1433
1413
|
return null;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
package com.clevertap.react;
|
|
2
|
+
|
|
3
|
+
import android.util.Log;
|
|
4
|
+
import com.facebook.react.bridge.Arguments;
|
|
5
|
+
import com.facebook.react.bridge.WritableMap;
|
|
6
|
+
import java.util.Iterator;
|
|
7
|
+
import java.util.Map;
|
|
8
|
+
import org.json.JSONObject;
|
|
9
|
+
|
|
10
|
+
public class CleverTapUtils {
|
|
11
|
+
|
|
12
|
+
private static final String TAG = "CleverTapUtils";
|
|
13
|
+
|
|
14
|
+
@SuppressWarnings({"TypeParameterExplicitlyExtendsObject", "rawtypes"})
|
|
15
|
+
public static WritableMap getWritableMapFromMap(Map<String, ? extends Object> var1) {
|
|
16
|
+
JSONObject extras = var1 != null ? new JSONObject(var1) : new JSONObject();
|
|
17
|
+
WritableMap extrasParams = Arguments.createMap();
|
|
18
|
+
Iterator extrasKeys = extras.keys();
|
|
19
|
+
while (extrasKeys.hasNext()) {
|
|
20
|
+
String key = null;
|
|
21
|
+
String value = null;
|
|
22
|
+
try {
|
|
23
|
+
key = extrasKeys.next().toString();
|
|
24
|
+
value = extras.get(key).toString();
|
|
25
|
+
} catch (Throwable t) {
|
|
26
|
+
Log.e(TAG, t.getLocalizedMessage());
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
if (key != null && value != null) {
|
|
30
|
+
extrasParams.putString(key, value);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
return extrasParams;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
}
|
|
@@ -18,6 +18,6 @@ Pod::Spec.new do |s|
|
|
|
18
18
|
s.preserve_paths = 'LICENSE.md', 'README.md', 'package.json', 'index.js'
|
|
19
19
|
s.source_files = 'ios/CleverTapReact/*.{h,m}'
|
|
20
20
|
|
|
21
|
-
s.dependency 'CleverTap-iOS-SDK', '
|
|
22
|
-
s.dependency 'React'
|
|
21
|
+
s.dependency 'CleverTap-iOS-SDK', '4.0.0'
|
|
22
|
+
s.dependency 'React-Core'
|
|
23
23
|
end
|
package/docs/install.md
CHANGED
|
@@ -60,9 +60,9 @@ If you're on RN 0.60 or your project configuration doesn't allow to add `use_fra
|
|
|
60
60
|
```gradle
|
|
61
61
|
dependencies {
|
|
62
62
|
...
|
|
63
|
-
implementation 'com.clevertap.android:clevertap-android-sdk:4.
|
|
63
|
+
implementation 'com.clevertap.android:clevertap-android-sdk:4.6.0'
|
|
64
64
|
implementation 'com.google.android.gms:play-services-base:17.6.0'
|
|
65
|
-
implementation 'com.google.firebase:firebase-messaging:
|
|
65
|
+
implementation 'com.google.firebase:firebase-messaging:21.0.0'
|
|
66
66
|
implementation 'com.google.android.exoplayer:exoplayer:2.15.1' //Optional for Audio/Video
|
|
67
67
|
implementation 'com.google.android.exoplayer:exoplayer-hls:2.15.1' //Optional for Audio/Video
|
|
68
68
|
implementation 'com.google.android.exoplayer:exoplayer-ui:2.15.1' //Optional for Audio/Video
|
package/docs/integration.md
CHANGED
|
@@ -11,11 +11,11 @@ After [install](./install.md), you will need to integrate the CleverTap SDK into
|
|
|
11
11
|
```
|
|
12
12
|
NOTE: Don't forget to add the CleverTap imports at the top of the file.
|
|
13
13
|
```objc
|
|
14
|
-
#import <
|
|
15
|
-
#import <
|
|
14
|
+
#import <CleverTap-iOS-SDK/CleverTap.h>
|
|
15
|
+
#import <clevertap-react-native/CleverTapReactManager.h>
|
|
16
16
|
```
|
|
17
17
|
|
|
18
|
-
Note: Need to use **@import CleverTapSDK;** instead of **#import <
|
|
18
|
+
Note: Need to use **@import CleverTapSDK;** instead of **#import <CleverTap-iOS-SDK/CleverTap.h>** and **@import CleverTapReact;** instead of **#import <clevertap-react-native/CleverTapReactManager.h>** in the AppDelegate class in case if using ```use_modular_headers!``` in the podfile.
|
|
19
19
|
|
|
20
20
|
[See the Example Project](/Example/ios/Example/AppDelegate.m).
|
|
21
21
|
|
|
@@ -71,5 +71,17 @@ Note: Need to use **@import CleverTapSDK;** instead of **#import <CleverTapSDK/C
|
|
|
71
71
|
// ...
|
|
72
72
|
}
|
|
73
73
|
```
|
|
74
|
+
4. From clevertap-react-native **v0.8.1** onwards developers can make their `Application` class extend `CleverTapApplication` to support Push Notification click callback out of the box and to register activity lifecycle events. Before v0.8.1 developers were forced to write logic for push click callback and register activity lifecycle to their `Application` class manually which is being abstract out in `CleverTapApplication` class.
|
|
75
|
+
|
|
76
|
+
```
|
|
77
|
+
import com.clevertap.react.CleverTapApplication;
|
|
78
|
+
// other imports
|
|
79
|
+
|
|
80
|
+
public class MainApplication extends CleverTapApplication
|
|
81
|
+
implements ActivityLifecycleCallbacks, ReactApplication
|
|
82
|
+
{
|
|
83
|
+
// ...
|
|
84
|
+
}
|
|
85
|
+
```
|
|
74
86
|
[see the included Example Project](/Example/App.js)
|
|
75
87
|
|
package/docs/usage.md
CHANGED
|
@@ -74,6 +74,12 @@ CleverTap.profileDecrementValueForKey(1, "score");
|
|
|
74
74
|
CleverTap.recordEvent('testEvent');
|
|
75
75
|
```
|
|
76
76
|
|
|
77
|
+
#### Record an event with event Properties
|
|
78
|
+
|
|
79
|
+
```javascript
|
|
80
|
+
CleverTap.recordEvent('Product Viewed', {'Product Name': 'Dairy Milk','Category': 'Chocolate','Amount': 20.00});
|
|
81
|
+
```
|
|
82
|
+
|
|
77
83
|
#### Record Charged event
|
|
78
84
|
|
|
79
85
|
```javascript
|
package/index.d.ts
CHANGED
|
@@ -295,7 +295,8 @@
|
|
|
295
295
|
export function getCleverTapID(callback: Callback): void;
|
|
296
296
|
|
|
297
297
|
/**
|
|
298
|
-
* Remove the property specified by key from the user profile
|
|
298
|
+
* Remove the property specified by key from the user profile. Alternatively this method
|
|
299
|
+
* can also be used to remove PII data (for eg. Email,Name,Phone), locally from database and shared prefs
|
|
299
300
|
* @param key {string}
|
|
300
301
|
*/
|
|
301
302
|
export function profileRemoveValueForKey(key: string): void;
|
package/index.js
CHANGED
|
@@ -379,7 +379,8 @@ var CleverTap = {
|
|
|
379
379
|
},
|
|
380
380
|
|
|
381
381
|
/**
|
|
382
|
-
* Remove a key-value from the user profile
|
|
382
|
+
* Remove a key-value from the user profile. Alternatively this method can also be used to remove PII data
|
|
383
|
+
* (for eg. Email,Name,Phone), locally from database and shared prefs
|
|
383
384
|
* @param {string} the key to remove
|
|
384
385
|
*/
|
|
385
386
|
profileRemoveValueForKey: function (key) {
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "clevertap-react-native",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.0",
|
|
4
4
|
"description": "CleverTap React Native SDK.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"extract-zip": "^1.6.6"
|
|
37
37
|
},
|
|
38
38
|
"peerDependencies": {
|
|
39
|
-
"react-native": ">=0.
|
|
39
|
+
"react-native": ">=0.63.3"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
42
|
"eslint": "^4.18.2",
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"eslint-plugin-react": "^6.2.0",
|
|
48
48
|
"eslint-plugin-standard": "^2.0.0",
|
|
49
49
|
"i": "^0.3.6",
|
|
50
|
-
"react": "^
|
|
50
|
+
"react": "^17.0.2",
|
|
51
51
|
"react-native": "^0.49.5"
|
|
52
52
|
}
|
|
53
53
|
}
|