Skip to content

Commit

Permalink
Merge pull request #392 from CleverTap/develop
Browse files Browse the repository at this point in the history
Release v2.2.1
  • Loading branch information
Anush-Shand authored Apr 12, 2024
2 parents 1b2f0db + 7876dc2 commit 1f0c213
Show file tree
Hide file tree
Showing 12 changed files with 98 additions and 95 deletions.
21 changes: 21 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,28 @@
Change Log
==========
Version 2.2.1 *(12 April 2024)*
-------------------------------------------
**What's new**

* **[Android Platform]**
* Supports [CleverTap Android SDK v6.2.1](https://github.com/CleverTap/clevertap-android-sdk/blob/master/docs/CTCORECHANGELOG.md#version-621-april-11-2024).

* **[iOS Platform]**
* Supports [CleverTap iOS SDK v6.2.1](https://github.com/CleverTap/clevertap-ios-sdk/blob/master/CHANGELOG.md#version-621-april-12-2024).

**Bug Fixes**
* **[Android Platform]**
* Fixes a crash due to `IllegalArgumentException` caused by allowedPushType `XPS` enum.

* **[iOS Platform]**
* Fixes a build error related to privacy manifests when statically linking the SDK using Cocoapods.


Version 2.2.0 *(5 April 2024)*
-------------------------------------------
> ⚠️ **NOTE**
2.2.0 produces a crash, please update to 2.2.1 and above.

**What's new**

* **[Android Platform]**
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 @@ -218,7 +218,7 @@ dependencies {


//clevertap
implementation 'com.clevertap.android:clevertap-android-sdk:6.2.0'
implementation 'com.clevertap.android:clevertap-android-sdk:6.2.1'
implementation "com.clevertap.android:push-templates:1.2.3"
implementation project(':clevertap-react-native')

Expand Down
6 changes: 3 additions & 3 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ android {
defaultConfig {
minSdkVersion 19
targetSdkVersion 34
versionCode 220
versionName "2.2.0"
versionCode 221
versionName "2.2.1"
}

namespace 'com.clevertap.react'
Expand All @@ -40,7 +40,7 @@ dependencies {
maven { url "$rootDir/../node_modules/react-native/android" }
}

api 'com.clevertap.android:clevertap-android-sdk:6.2.0'
api 'com.clevertap.android:clevertap-android-sdk:6.2.1'
implementation 'com.android.installreferrer:installreferrer:2.2'
//compile 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.facebook.react:react-native:+'
Expand Down
2 changes: 1 addition & 1 deletion clevertap-react-native.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@ Pod::Spec.new do |s|
s.preserve_paths = 'LICENSE.md', 'README.md', 'package.json', 'index.js'
s.source_files = 'ios/CleverTapReact/*.{h,m}'

s.dependency 'CleverTap-iOS-SDK', '6.2.0'
s.dependency 'CleverTap-iOS-SDK', '6.2.1'
s.dependency 'React-Core'
end
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const EventEmitter = NativeModules.CleverTapReactEventEmitter ? new NativeEventE
* @param {int} libVersion - The updated library version. If current version is 1.1.0 then pass as 10100
*/
const libName = 'React-Native';
const libVersion = 20200;
const libVersion = 20201;
CleverTapReact.setLibrary(libName,libVersion);

function defaultCallback(method, err, res) {
Expand Down
8 changes: 8 additions & 0 deletions ios/CleverTapReact.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
5266DAB91E4B9C16000008F5 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5266DAB61E4B9B8C000008F5 /* UIKit.framework */; };
5266DABA1E4B9C20000008F5 /* SystemConfiguration.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 52DFC6831E4B990A00EDC368 /* SystemConfiguration.framework */; };
5266DADB1E4BB5BD000008F5 /* CleverTapSDK.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5266DAD91E4BB598000008F5 /* CleverTapSDK.framework */; };
6B587A032BC02ECD0077493E /* CleverTapReactPendingEvent.m in Sources */ = {isa = PBXBuildFile; fileRef = 6B587A022BC02ECD0077493E /* CleverTapReactPendingEvent.m */; };
6B587A042BC02ECD0077493E /* CleverTapReactPendingEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = 6B587A012BC02ECD0077493E /* CleverTapReactPendingEvent.h */; };
/* End PBXBuildFile section */

/* Begin PBXCopyFilesBuildPhase section */
Expand Down Expand Up @@ -45,6 +47,8 @@
52DFC6831E4B990A00EDC368 /* SystemConfiguration.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SystemConfiguration.framework; path = System/Library/Frameworks/SystemConfiguration.framework; sourceTree = SDKROOT; };
52DFC6851E4B991000EDC368 /* CoreTelephony.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreTelephony.framework; path = System/Library/Frameworks/CoreTelephony.framework; sourceTree = SDKROOT; };
5D72D2E81C16249000E22EC1 /* libCleverTapReact.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libCleverTapReact.a; sourceTree = BUILT_PRODUCTS_DIR; };
6B587A012BC02ECD0077493E /* CleverTapReactPendingEvent.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CleverTapReactPendingEvent.h; sourceTree = "<group>"; };
6B587A022BC02ECD0077493E /* CleverTapReactPendingEvent.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = CleverTapReactPendingEvent.m; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
Expand All @@ -71,6 +75,8 @@
52344FBC1E4CE7F000661762 /* CleverTapReactManager.m */,
52344FDE1E4D0F3700661762 /* CleverTapReactEventEmitter.h */,
52344FDF1E4D0F3700661762 /* CleverTapReactEventEmitter.m */,
6B587A012BC02ECD0077493E /* CleverTapReactPendingEvent.h */,
6B587A022BC02ECD0077493E /* CleverTapReactPendingEvent.m */,
);
path = CleverTapReact;
sourceTree = "<group>";
Expand Down Expand Up @@ -111,6 +117,7 @@
buildActionMask = 2147483647;
files = (
52344FC21E4CEC3200661762 /* CleverTapReactManager.h in Headers */,
6B587A042BC02ECD0077493E /* CleverTapReactPendingEvent.h in Headers */,
52344FE01E4D0F3700661762 /* CleverTapReactEventEmitter.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand Down Expand Up @@ -176,6 +183,7 @@
52344FBF1E4CE7F000661762 /* CleverTapReactManager.m in Sources */,
52344FE11E4D0F3700661762 /* CleverTapReactEventEmitter.m in Sources */,
52344FBE1E4CE7F000661762 /* CleverTapReact.m in Sources */,
6B587A032BC02ECD0077493E /* CleverTapReactPendingEvent.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down
2 changes: 2 additions & 0 deletions ios/CleverTapReact/CleverTapReactEventEmitter.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@

@interface CleverTapReactEventEmitter : RCTEventEmitter

+ (void)sendEventOnObserving:(NSString *)name body:(id)body;

@end
116 changes: 30 additions & 86 deletions ios/CleverTapReact/CleverTapReactEventEmitter.m
Original file line number Diff line number Diff line change
@@ -1,102 +1,46 @@
#import "CleverTapReactEventEmitter.h"
#import "CleverTapReactPendingEvent.h"
#import "CleverTapReact.h"

#import <React/RCTLog.h>

static NSMutableArray<CleverTapReactPendingEvent *> *pendingEvents;
static BOOL isObserving;

@implementation CleverTapReactEventEmitter

RCT_EXPORT_MODULE();

+ (void)sendEventOnObserving:(NSString *)name body:(id)body {
if (isObserving) {
[[NSNotificationCenter defaultCenter] postNotificationName:name object:nil userInfo:body];
return;
}

if (!pendingEvents) {
pendingEvents = [NSMutableArray array];
}

CleverTapReactPendingEvent *event = [[CleverTapReactPendingEvent alloc] initWithName:name body:body];
[pendingEvents addObject:event];
}

- (NSArray<NSString *> *)supportedEvents {
return @[kCleverTapProfileDidInitialize, kCleverTapProfileSync, kCleverTapInAppNotificationDismissed, kCleverTapInboxDidInitialize, kCleverTapInboxMessagesDidUpdate, kCleverTapInAppNotificationButtonTapped, kCleverTapInboxMessageButtonTapped, kCleverTapInboxMessageTapped, kCleverTapDisplayUnitsLoaded, kCleverTapFeatureFlagsDidUpdate, kCleverTapProductConfigDidFetch, kCleverTapProductConfigDidActivate, kCleverTapProductConfigDidInitialize, kCleverTapPushNotificationClicked, kCleverTapPushPermissionResponseReceived, kCleverTapInAppNotificationShowed, kCleverTapOnVariablesChanged, kCleverTapOnValueChanged];
}


- (void)startObserving {

[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(emitEventInternal:)
name:kCleverTapProfileDidInitialize
object:nil];

[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(emitEventInternal:)
name:kCleverTapProfileSync
object:nil];

[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(emitEventInternal:)
name:kCleverTapInAppNotificationDismissed
object:nil];

[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(emitEventInternal:)
name:kCleverTapInboxDidInitialize
object:nil];

[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(emitEventInternal:)
name:kCleverTapInboxMessagesDidUpdate
object:nil];

[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(emitEventInternal:)
name:kCleverTapDisplayUnitsLoaded
object:nil];

[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(emitEventInternal:)
name:kCleverTapInAppNotificationButtonTapped
object:nil];

[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(emitEventInternal:)
name:kCleverTapInboxMessageButtonTapped
object:nil];

[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(emitEventInternal:)
name:kCleverTapInboxMessageTapped
object:nil];

[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(emitEventInternal:)
name:kCleverTapFeatureFlagsDidUpdate
object:nil];

[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(emitEventInternal:)
name:kCleverTapProductConfigDidFetch
object:nil];

[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(emitEventInternal:)
name:kCleverTapProductConfigDidActivate
object:nil];

[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(emitEventInternal:)
name:kCleverTapProductConfigDidInitialize
object:nil];

[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(emitEventInternal:)
name:kCleverTapPushNotificationClicked
object:nil];

[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(emitEventInternal:)
name:kCleverTapPushPermissionResponseReceived
object:nil];

[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(emitEventInternal:)
name:kCleverTapOnVariablesChanged
object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(emitEventInternal:)
name:kCleverTapOnValueChanged
object:nil];
NSArray *eventNames = [self supportedEvents];
for (NSString *eventName in eventNames) {
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(emitEventInternal:)
name:eventName
object:nil];
}

isObserving = YES;
for (CleverTapReactPendingEvent *ev in pendingEvents) {
[[NSNotificationCenter defaultCenter] postNotificationName:ev.name object:nil userInfo:ev.body];
}
}

- (void)stopObserving {
Expand Down
4 changes: 2 additions & 2 deletions ios/CleverTapReact/CleverTapReactManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
#import "CleverTapPushNotificationDelegate.h"
#import "CleverTapInAppNotificationDelegate.h"
#import "CleverTap+PushPermission.h"

#import "CleverTapReactEventEmitter.h"

@interface CleverTapReactManager() <CleverTapSyncDelegate, CleverTapInAppNotificationDelegate, CleverTapDisplayUnitDelegate, CleverTapFeatureFlagsDelegate, CleverTapProductConfigDelegate, CleverTapPushNotificationDelegate, CleverTapPushPermissionDelegate> {
}
Expand Down Expand Up @@ -75,7 +75,7 @@ - (void)applicationDidLaunchWithOptions:(NSDictionary *)options {
#pragma mark - Private

- (void)postNotificationWithName:(NSString *)name andBody:(NSDictionary *)body {
[[NSNotificationCenter defaultCenter] postNotificationName:name object:nil userInfo:body];
[CleverTapReactEventEmitter sendEventOnObserving:name body:body];
}


Expand Down
14 changes: 14 additions & 0 deletions ios/CleverTapReact/CleverTapReactPendingEvent.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#import <Foundation/Foundation.h>

NS_ASSUME_NONNULL_BEGIN

@interface CleverTapReactPendingEvent : NSObject

@property (nonatomic, strong) NSString *name;
@property (nonatomic, strong) id body;

- (instancetype)initWithName:(NSString *)name body:(id)body;

@end

NS_ASSUME_NONNULL_END
14 changes: 14 additions & 0 deletions ios/CleverTapReact/CleverTapReactPendingEvent.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#import "CleverTapReactPendingEvent.h"

@implementation CleverTapReactPendingEvent

- (instancetype)initWithName:(NSString *)name body:(id)body {
self = [super init];
if (self) {
_name = name;
_body = body;
}
return self;
}

@end
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "clevertap-react-native",
"version": "2.2.0",
"version": "2.2.1",
"description": "CleverTap React Native SDK.",
"main": "index.js",
"types": "index.d.ts",
Expand Down

0 comments on commit 1f0c213

Please sign in to comment.