Skip to content

Commit

Permalink
Merge pull request #59 from CleverTap/task/updateAndroidSDK(4.2.0)/SD…
Browse files Browse the repository at this point in the history
…K-957

Task/update android sdk(4.2.0)/sdk 957
  • Loading branch information
william-ct authored Jul 20, 2021
2 parents 3d3b5fd + b6a1d43 commit 5e77d3b
Show file tree
Hide file tree
Showing 12 changed files with 78 additions and 41 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
## CHANGE LOG

### Version 1.2.3 (July 20, 2021)
* Supports [CleverTap Android SDK v4.2.0](https://github.com/CleverTap/clevertap-android-sdk/releases/tag/core-v4.2.0)
* Adds fix for NPE [#58](https://github.com/CleverTap/clevertap-flutter/issues/58)
* Adds fix for `recordScreen` NPE [#54](https://github.com/CleverTap/clevertap-flutter/issues/54)

### Version 1.2.2 (May 21, 2021)
* Supports [CleverTap Android SDK v4.1.1](https://github.com/CleverTap/clevertap-android-sdk/releases/tag/core-v4.1.1)
* Supports [CleverTap iOS SDK v3.9.4](https://github.com/CleverTap/clevertap-ios-sdk/releases/tag/3.9.4)
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ To get started, sign up [here](https://clevertap.com/live-product-demo/)

```yaml
dependencies:
clevertap_plugin: 1.2.2
clevertap_plugin: 1.2.3
```
- Run `flutter packages get` to install the SDK
Expand Down
4 changes: 2 additions & 2 deletions android/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
group 'com.clevertap.clevertap_plugin'
version '1.2.2'
version '1.2.3'

buildscript {
repositories {
Expand Down Expand Up @@ -42,7 +42,7 @@ android {

dependencies {
testImplementation 'junit:junit:4.13'
implementation 'com.clevertap.android:clevertap-android-sdk:4.1.1'
implementation 'com.clevertap.android:clevertap-android-sdk:4.2.0'
implementation 'androidx.fragment:fragment:1.1.0'
implementation 'androidx.core:core:1.3.0'
}
Original file line number Diff line number Diff line change
Expand Up @@ -906,6 +906,10 @@ private void invokeMethodOnUiThread(final String methodName, final String clever

private void invokeMethodOnUiThread(final String methodName, final Map map) {
final MethodChannel channel = this.channel;
if (channel == null) {
Log.d(TAG, "methodChannel is null");
return;
}
runOnMainThread(() -> channel.invokeMethod(methodName, map));
}

Expand Down Expand Up @@ -1291,7 +1295,7 @@ private void setPersonalization(Result result, boolean enable) {
private void setPushToken(MethodCall call, Result result, PushType type) {
String token = call.argument("token");
if (isCleverTapNotNull(cleverTapAPI)) {
switch (type.toString()) {
switch (type.getType()) {
case "fcm":
cleverTapAPI.pushFcmRegistrationId(token, true);
break;
Expand Down
2 changes: 1 addition & 1 deletion example/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ flutter {
dependencies {
testImplementation 'junit:junit:4.13'
//implementation fileTree('libs')
implementation 'com.clevertap.android:clevertap-android-sdk:4.1.1'
implementation 'com.clevertap.android:clevertap-android-sdk:4.2.0'
implementation 'com.google.firebase:firebase-messaging:20.2.4'
implementation 'androidx.core:core:1.3.0'
implementation 'androidx.fragment:fragment:1.1.0'
Expand Down
4 changes: 2 additions & 2 deletions example/ios/Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PODS:
- CleverTap-iOS-SDK (3.9.4):
- SDWebImage (~> 5.1)
- clevertap_plugin (1.2.2):
- clevertap_plugin (1.2.3):
- CleverTap-iOS-SDK (= 3.9.4)
- Flutter
- Flutter (1.0.0)
Expand All @@ -26,7 +26,7 @@ EXTERNAL SOURCES:

SPEC CHECKSUMS:
CleverTap-iOS-SDK: 923e0a8829f4f8a16a8412f1e661d9b650d9633d
clevertap_plugin: 17da2e4fc60747aac275b91440722e0e23145781
clevertap_plugin: 00a8c28a82aedd75a16d93143f4c6738dad326e4
Flutter: 434fef37c0980e73bb6479ef766c45957d4b510c
SDWebImage: a7f831e1a65eb5e285e3fb046a23fcfbf08e696d

Expand Down
28 changes: 14 additions & 14 deletions example/ios/Runner.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; };
97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; };
97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; };
B4B797B60C63ACC2A30C4C7C /* libPods-Runner.a in Frameworks */ = {isa = PBXBuildFile; fileRef = A2E551018913B7400FA1650B /* libPods-Runner.a */; };
DE9F316D4885F9BE0CBD66EA /* libPods-Runner.a in Frameworks */ = {isa = PBXBuildFile; fileRef = B3C46A97E9CAD4128D2A0A73 /* libPods-Runner.a */; };
/* End PBXBuildFile section */

/* Begin PBXCopyFilesBuildPhase section */
Expand All @@ -32,18 +32,18 @@
/* End PBXCopyFilesBuildPhase section */

/* Begin PBXFileReference section */
10C0A1E4C71AC64BC7959BDB /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = "<group>"; };
1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = "<group>"; };
1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = "<group>"; };
2ED6E38453F1A5D41B0CDD01 /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = "<group>"; };
38988E2E3FCCDF34543B25EC /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = "<group>"; };
18A31F618917247F54AFBE78 /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = "<group>"; };
3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = "<group>"; };
49A81C5223D5E278006388A5 /* Runner.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = Runner.entitlements; sourceTree = "<group>"; };
49A81C5323D6EB1D006388A5 /* AdSupport.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AdSupport.framework; path = System/Library/Frameworks/AdSupport.framework; sourceTree = SDKROOT; };
49A81C5523D6FD0F006388A5 /* UserNotifications.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UserNotifications.framework; path = System/Library/Frameworks/UserNotifications.framework; sourceTree = SDKROOT; };
6C2F1937C1F5E61716C2BC4C /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = "<group>"; };
7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = "<group>"; };
7AFFD8ED1D35381100E5BB4D /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = "<group>"; };
7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = "<group>"; };
93847282920A03629649A560 /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = "<group>"; };
9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = "<group>"; };
9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = "<group>"; };
97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; };
Expand All @@ -52,7 +52,7 @@
97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
A2E551018913B7400FA1650B /* libPods-Runner.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-Runner.a"; sourceTree = BUILT_PRODUCTS_DIR; };
B3C46A97E9CAD4128D2A0A73 /* libPods-Runner.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-Runner.a"; sourceTree = BUILT_PRODUCTS_DIR; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
Expand All @@ -61,7 +61,7 @@
buildActionMask = 2147483647;
files = (
49A81C5623D6FD0F006388A5 /* UserNotifications.framework in Frameworks */,
B4B797B60C63ACC2A30C4C7C /* libPods-Runner.a in Frameworks */,
DE9F316D4885F9BE0CBD66EA /* libPods-Runner.a in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand All @@ -71,9 +71,9 @@
57EF2E58EE59B48415544B69 /* Pods */ = {
isa = PBXGroup;
children = (
2ED6E38453F1A5D41B0CDD01 /* Pods-Runner.debug.xcconfig */,
38988E2E3FCCDF34543B25EC /* Pods-Runner.release.xcconfig */,
6C2F1937C1F5E61716C2BC4C /* Pods-Runner.profile.xcconfig */,
10C0A1E4C71AC64BC7959BDB /* Pods-Runner.debug.xcconfig */,
18A31F618917247F54AFBE78 /* Pods-Runner.release.xcconfig */,
93847282920A03629649A560 /* Pods-Runner.profile.xcconfig */,
);
path = Pods;
sourceTree = "<group>";
Expand All @@ -83,7 +83,7 @@
children = (
49A81C5523D6FD0F006388A5 /* UserNotifications.framework */,
49A81C5323D6EB1D006388A5 /* AdSupport.framework */,
A2E551018913B7400FA1650B /* libPods-Runner.a */,
B3C46A97E9CAD4128D2A0A73 /* libPods-Runner.a */,
);
name = Frameworks;
sourceTree = "<group>";
Expand Down Expand Up @@ -150,14 +150,14 @@
isa = PBXNativeTarget;
buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */;
buildPhases = (
755700BCA92B646DA9F7F9C3 /* [CP] Check Pods Manifest.lock */,
4453C74191FCC9E7F35240A8 /* [CP] Check Pods Manifest.lock */,
9740EEB61CF901F6004384FC /* Run Script */,
97C146EA1CF9000F007C117D /* Sources */,
97C146EB1CF9000F007C117D /* Frameworks */,
97C146EC1CF9000F007C117D /* Resources */,
9705A1C41CF9048500538489 /* Embed Frameworks */,
3B06AD1E1E4923F5004D2608 /* Thin Binary */,
93B891758EF7C5C5D25CB988 /* [CP] Copy Pods Resources */,
47F4E531F18A76CBF0726BFB /* [CP] Copy Pods Resources */,
);
buildRules = (
);
Expand Down Expand Up @@ -229,7 +229,7 @@
shellPath = /bin/sh;
shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin";
};
755700BCA92B646DA9F7F9C3 /* [CP] Check Pods Manifest.lock */ = {
4453C74191FCC9E7F35240A8 /* [CP] Check Pods Manifest.lock */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
Expand All @@ -251,7 +251,7 @@
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
showEnvVarsInLog = 0;
};
93B891758EF7C5C5D25CB988 /* [CP] Copy Pods Resources */ = {
47F4E531F18A76CBF0726BFB /* [CP] Copy Pods Resources */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
Expand Down
35 changes: 34 additions & 1 deletion example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -758,15 +758,48 @@ class _MyAppState extends State<MyApp> {
}

void recordEvent() {
var now = new DateTime.now();
var eventData = {
// Key: Value
'first': 'partridge',
'second': 'turtledoves'
'second': 'turtledoves',
'date': CleverTapPlugin.getCleverTapDate(now),
'number': 1
};
CleverTapPlugin.recordEvent("Flutter Event", eventData);
showToast("Raised event - Flutter Event");
}

void recordNotificationClickedEvent() {
var eventData = {
/// Key: Value
'nm': 'Notification message',
'nt': 'Notification title',
'wzrk_id': '0_0',
'wzrk_cid': 'Notification Channel ID'

///other CleverTap Push Payload Key Values found in Step 3 of
///https://developer.clevertap.com/docs/android#section-custom-android-push-notifications-handling
};
CleverTapPlugin.pushNotificationClickedEvent(eventData);
showToast("Raised event - Notification Clicked");
}

void recordNotificationViewedEvent() {
var eventData = {
/// Key: Value
'nm': 'Notification message',
'nt': 'Notification title',
'wzrk_id': '0_0',
'wzrk_cid': 'Notification Channel ID'

///other CleverTap Push Payload Key Values found in Step 3 of
///https://developer.clevertap.com/docs/android#section-custom-android-push-notifications-handling
};
CleverTapPlugin.pushNotificationViewedEvent(eventData);
showToast("Raised event - Notification Viewed");
}

void recordChargedEvent() {
var item1 = {
// Key: Value
Expand Down
2 changes: 1 addition & 1 deletion example/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ packages:
path: ".."
relative: true
source: path
version: "1.2.2"
version: "1.2.3"
clock:
dependency: transitive
description:
Expand Down
2 changes: 1 addition & 1 deletion ios/clevertap_plugin.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#
Pod::Spec.new do |s|
s.name = 'clevertap_plugin'
s.version = '1.2.2'
s.version = '1.2.3'
s.summary = 'CleverTap Flutter plugin.'
s.description = 'The CleverTap iOS SDK for App Analytics and Engagement.'
s.homepage = 'https://github.com/CleverTap/clevertap-ios-sdk'
Expand Down
27 changes: 11 additions & 16 deletions lib/clevertap_plugin.dart
Original file line number Diff line number Diff line change
Expand Up @@ -348,15 +348,15 @@ class CleverTapPlugin {
///Record Notification Clicked event
static Future<void> pushNotificationClickedEvent(
Map<String, dynamic> extras) async {
return await _channel
.invokeMethod('pushNotificationClickedEvent', {'notificationData': extras});
return await _channel.invokeMethod(
'pushNotificationClickedEvent', {'notificationData': extras});
}

///Record Notification Viewed event
static Future<void> pushNotificationViewedEvent(
Map<String, dynamic> extras) async {
return await _channel
.invokeMethod('pushNotificationViewedEvent', {'notificationData': extras});
return await _channel.invokeMethod(
'pushNotificationViewedEvent', {'notificationData': extras});
}

/// Record a Screen View event
Expand Down Expand Up @@ -409,16 +409,14 @@ class CleverTapPlugin {
// and last time timestamp of the event.
static Future<Map<String, dynamic>> eventGetDetail(String eventName) async {
Map<dynamic, dynamic> response =
await (_channel.invokeMethod('eventGetDetail', {'eventName': eventName})
as FutureOr<Map<dynamic, dynamic>>);
await _channel.invokeMethod('eventGetDetail', {'eventName': eventName});
return response.cast<String, dynamic>();
}

/// Returns a Map of event names and corresponding event details of all the events raised
static Future<Map<String, dynamic>> getEventHistory(String eventName) async {
Map<dynamic, dynamic> response = await (_channel
.invokeMethod('getEventHistory', {'eventName': eventName})
as FutureOr<Map<dynamic, dynamic>>);
Map<dynamic, dynamic> response = await _channel
.invokeMethod('getEventHistory', {'eventName': eventName});
return response.cast<String, dynamic>();
}

Expand Down Expand Up @@ -566,8 +564,7 @@ class CleverTapPlugin {
/// Returns a Map of UTMDetail object which consists of UTM parameters like source, medium & campaign
static Future<Map<String, dynamic>> sessionGetUTMDetails() async {
Map<dynamic, dynamic> response =
await (_channel.invokeMethod('sessionGetUTMDetails', {})
as FutureOr<Map<dynamic, dynamic>>);
await _channel.invokeMethod('sessionGetUTMDetails', {});
return response.cast<String, dynamic>();
}

Expand Down Expand Up @@ -606,9 +603,8 @@ class CleverTapPlugin {
/// Returns a json string representation of CTInboxMessage for given messageId
static Future<Map<String, dynamic>> getInboxMessageForId(
String messageId) async {
Map<dynamic, dynamic> response = await (_channel
.invokeMethod('getInboxMessageForId', {'messageId': messageId})
as FutureOr<Map<dynamic, dynamic>>);
Map<dynamic, dynamic> response = await _channel
.invokeMethod('getInboxMessageForId', {'messageId': messageId});
return response.cast<String, dynamic>();
}

Expand Down Expand Up @@ -652,8 +648,7 @@ class CleverTapPlugin {
///Returns Display unit info as a Map
static Future<Map<String, dynamic>> getDisplayUnitForId(String unitId) async {
Map<dynamic, dynamic> response =
await (_channel.invokeMethod('getDisplayUnitForId', {'unitId': unitId})
as FutureOr<Map<dynamic, dynamic>>);
await _channel.invokeMethod('getDisplayUnitForId', {'unitId': unitId});
return response.cast<String, dynamic>();
}

Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: clevertap_plugin
description: The CleverTap Flutter SDK for Mobile Customer Engagement,Analytics and Retention solutions.
version: 1.2.2
version: 1.2.3
homepage: https://github.com/CleverTap/clevertap-flutter

environment:
Expand Down

0 comments on commit 5e77d3b

Please sign in to comment.