clevertap-react-native 0.9.4 → 1.0.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 +8 -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/build/generated/source/buildConfig/debug/com/clevertap/react/BuildConfig.java +12 -0
- package/android/build/intermediates/aapt_friendly_merged_manifests/debug/aapt/AndroidManifest.xml +14 -0
- package/android/build/intermediates/aapt_friendly_merged_manifests/debug/aapt/output.json +27 -0
- package/android/build/intermediates/aar_main_jar/debug/classes.jar +0 -0
- package/android/build/intermediates/annotation_processor_list/debug/annotationProcessors.json +1 -0
- package/android/build/intermediates/annotations_typedef_file/debug/typedefs.txt +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 +5732 -0
- package/android/build/intermediates/incremental/debug-mergeJavaRes/merge-state +0 -0
- package/android/build/intermediates/incremental/debug-mergeNativeLibs/merge-state +0 -0
- package/android/build/intermediates/incremental/mergeDebugJniLibFolders/merger.xml +2 -0
- package/android/build/intermediates/incremental/mergeDebugShaders/merger.xml +2 -0
- package/android/build/intermediates/incremental/packageDebugAssets/merger.xml +2 -0
- package/android/build/intermediates/incremental/packageDebugResources/compile-file-map.properties +1 -0
- package/android/build/intermediates/incremental/packageDebugResources/merger.xml +2 -0
- 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/CleverTapPackage.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 +14 -0
- package/android/build/intermediates/local_only_symbol_list/debug/R-def.txt +2 -0
- package/android/build/intermediates/manifest_merge_blame_file/debug/manifest-merger-blame-debug-report.txt +17 -0
- package/android/build/intermediates/merged_java_res/debug/out.jar +0 -0
- package/android/build/intermediates/merged_manifests/debug/output.json +27 -0
- package/android/build/intermediates/symbol_list_with_package_name/debug/package-aware-r.txt +3965 -0
- package/android/build/outputs/aar/android-debug.aar +0 -0
- package/android/build/outputs/logs/manifest-merger-debug-report.txt +39 -0
- package/android/build.gradle +7 -7
- package/android/local.properties +8 -0
- package/android/src/main/java/com/clevertap/react/CleverTapModule.java +213 -1
- package/clevertap-react-native.podspec +1 -1
- package/docs/pushprimer.md +97 -0
- package/docs/usage.md +4 -0
- package/index.d.ts +39 -4
- package/index.js +32 -5
- package/ios/CleverTapReact/CleverTapReact.h +2 -0
- package/ios/CleverTapReact/CleverTapReact.m +110 -0
- package/ios/CleverTapReact/CleverTapReactEventEmitter.m +6 -1
- package/ios/CleverTapReact/CleverTapReactManager.m +12 -1
- package/package.json +1 -1
- package/ios/CleverTapReact.xcodeproj/project.xcworkspace/contents.xcworkspacedata +0 -7
- package/ios/CleverTapReact.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +0 -8
- package/ios/CleverTapReact.xcodeproj/project.xcworkspace/xcuserdata/akash.malhotra.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
- package/ios/CleverTapReact.xcodeproj/xcuserdata/akash.malhotra.xcuserdatad/xcschemes/xcschememanagement.plist +0 -14
|
@@ -15,6 +15,8 @@
|
|
|
15
15
|
#import "CleverTap+ProductConfig.h"
|
|
16
16
|
#import "CleverTap+InAppNotifications.h"
|
|
17
17
|
#import "CleverTapInstanceConfig.h"
|
|
18
|
+
#import "CTLocalInApp.h"
|
|
19
|
+
#import "Clevertap+PushPermission.h"
|
|
18
20
|
|
|
19
21
|
static NSDateFormatter *dateFormatter;
|
|
20
22
|
|
|
@@ -48,6 +50,8 @@ RCT_EXPORT_MODULE();
|
|
|
48
50
|
kCleverTapProductConfigDidActivate: kCleverTapProductConfigDidActivate,
|
|
49
51
|
kCleverTapProductConfigDidInitialize: kCleverTapProductConfigDidInitialize,
|
|
50
52
|
kCleverTapPushNotificationClicked: kCleverTapPushNotificationClicked,
|
|
53
|
+
kCleverTapPushPermissionResponseReceived: kCleverTapPushPermissionResponseReceived,
|
|
54
|
+
kCleverTapInAppNotificationShowed: kCleverTapInAppNotificationShowed,
|
|
51
55
|
kXPS: kXPS
|
|
52
56
|
};
|
|
53
57
|
}
|
|
@@ -769,4 +773,110 @@ RCT_EXPORT_METHOD(resumeInAppNotifications) {
|
|
|
769
773
|
[[self cleverTapInstance] resumeInAppNotifications];
|
|
770
774
|
}
|
|
771
775
|
|
|
776
|
+
#pragma mark - Push Permission
|
|
777
|
+
|
|
778
|
+
- (CTLocalInApp*)_localInAppConfigFromReadableMap: (NSDictionary *)json {
|
|
779
|
+
CTLocalInApp *inAppBuilder;
|
|
780
|
+
CTLocalInAppType inAppType = HALF_INTERSTITIAL;
|
|
781
|
+
//Required parameters
|
|
782
|
+
NSString *titleText = nil, *messageText = nil, *followDeviceOrientation = nil, *positiveBtnText = nil, *negativeBtnText = nil;
|
|
783
|
+
//Additional parameters
|
|
784
|
+
NSString *fallbackToSettings = nil, *backgroundColor = nil, *btnBorderColor = nil, *titleTextColor = nil, *messageTextColor = nil, *btnTextColor = nil, *imageUrl = nil, *btnBackgroundColor = nil, *btnBorderRadius = nil;
|
|
785
|
+
|
|
786
|
+
if ([json[@"inAppType"] isEqual: @"half-interstitial"]){
|
|
787
|
+
inAppType = HALF_INTERSTITIAL;
|
|
788
|
+
}
|
|
789
|
+
else {
|
|
790
|
+
inAppType = ALERT;
|
|
791
|
+
}
|
|
792
|
+
if (json[@"titleText"]) {
|
|
793
|
+
titleText = [json valueForKey:@"titleText"];
|
|
794
|
+
}
|
|
795
|
+
if (json[@"messageText"]) {
|
|
796
|
+
messageText = [json valueForKey:@"messageText"];
|
|
797
|
+
}
|
|
798
|
+
if (json[@"followDeviceOrientation"]) {
|
|
799
|
+
followDeviceOrientation = [json valueForKey:@"followDeviceOrientation"];
|
|
800
|
+
}
|
|
801
|
+
if (json[@"positiveBtnText"]) {
|
|
802
|
+
positiveBtnText = [json valueForKey:@"positiveBtnText"];
|
|
803
|
+
}
|
|
804
|
+
|
|
805
|
+
if (json[@"negativeBtnText"]) {
|
|
806
|
+
negativeBtnText = [json valueForKey:@"negativeBtnText"];
|
|
807
|
+
}
|
|
808
|
+
|
|
809
|
+
//creates the builder instance with all the required parameters
|
|
810
|
+
inAppBuilder = [[CTLocalInApp alloc] initWithInAppType:inAppType
|
|
811
|
+
titleText:titleText
|
|
812
|
+
messageText:messageText
|
|
813
|
+
followDeviceOrientation:followDeviceOrientation
|
|
814
|
+
positiveBtnText:positiveBtnText
|
|
815
|
+
negativeBtnText:negativeBtnText];
|
|
816
|
+
|
|
817
|
+
//adds optional parameters to the builder instance
|
|
818
|
+
if (json[@"fallbackToSettings"]) {
|
|
819
|
+
fallbackToSettings = [json valueForKey:@"fallbackToSettings"];
|
|
820
|
+
[inAppBuilder setFallbackToSettings:fallbackToSettings];
|
|
821
|
+
}
|
|
822
|
+
if (json[@"backgroundColor"]) {
|
|
823
|
+
backgroundColor = [json valueForKey:@"backgroundColor"];
|
|
824
|
+
[inAppBuilder setBackgroundColor:backgroundColor];
|
|
825
|
+
}
|
|
826
|
+
if (json[@"btnBorderColor"]) {
|
|
827
|
+
btnBorderColor = [json valueForKey:@"btnBorderColor"];
|
|
828
|
+
[inAppBuilder setBtnBorderColor:btnBorderColor];
|
|
829
|
+
}
|
|
830
|
+
if (json[@"titleTextColor"]) {
|
|
831
|
+
titleTextColor = [json valueForKey:@"titleTextColor"];
|
|
832
|
+
[inAppBuilder setTitleTextColor:titleTextColor];
|
|
833
|
+
}
|
|
834
|
+
if (json[@"messageTextColor"]) {
|
|
835
|
+
messageTextColor = [json valueForKey:@"messageTextColor"];
|
|
836
|
+
[inAppBuilder setMessageTextColor:messageTextColor];
|
|
837
|
+
}
|
|
838
|
+
if (json[@"btnTextColor"]) {
|
|
839
|
+
btnTextColor = [json valueForKey:@"btnTextColor"];
|
|
840
|
+
[inAppBuilder setBtnTextColor:btnTextColor];
|
|
841
|
+
}
|
|
842
|
+
if (json[@"imageUrl"]) {
|
|
843
|
+
imageUrl = [json valueForKey:@"imageUrl"];
|
|
844
|
+
[inAppBuilder setImageUrl:imageUrl];
|
|
845
|
+
}
|
|
846
|
+
if (json[@"btnBackgroundColor"]) {
|
|
847
|
+
btnBackgroundColor = [json valueForKey:@"btnBackgroundColor"];
|
|
848
|
+
[inAppBuilder setBtnBackgroundColor:btnBackgroundColor];
|
|
849
|
+
}
|
|
850
|
+
if (json[@"btnBorderRadius"]) {
|
|
851
|
+
btnBorderRadius = [json valueForKey:@"btnBorderRadius"];
|
|
852
|
+
[inAppBuilder setBtnBorderRadius:btnBorderRadius];
|
|
853
|
+
}
|
|
854
|
+
return inAppBuilder;
|
|
855
|
+
}
|
|
856
|
+
|
|
857
|
+
RCT_EXPORT_METHOD(promptForPushPermission:(BOOL)showFallbackSettings){
|
|
858
|
+
RCTLogInfo(@"[CleverTap promptForPushPermission: %i]", showFallbackSettings);
|
|
859
|
+
[[self cleverTapInstance] promptForPushPermission:showFallbackSettings];
|
|
860
|
+
}
|
|
861
|
+
|
|
862
|
+
RCT_EXPORT_METHOD(promptPushPrimer:(NSDictionary *_Nonnull)json){
|
|
863
|
+
RCTLogInfo(@"[CleverTap promptPushPrimer]");
|
|
864
|
+
CTLocalInApp *localInAppBuilder = [self _localInAppConfigFromReadableMap:json];
|
|
865
|
+
[[self cleverTapInstance] promptPushPrimer:localInAppBuilder.getLocalInAppSettings];
|
|
866
|
+
}
|
|
867
|
+
|
|
868
|
+
RCT_EXPORT_METHOD(isPushPermissionGranted:(RCTResponseSenderBlock)callback){
|
|
869
|
+
if (@available(iOS 10.0, *)) {
|
|
870
|
+
[[self cleverTapInstance] getNotificationPermissionStatusWithCompletionHandler:^(UNAuthorizationStatus status) {
|
|
871
|
+
BOOL result = (status == UNAuthorizationStatusAuthorized);
|
|
872
|
+
RCTLogInfo(@"[CleverTap isPushPermissionGranted: %i]", result);
|
|
873
|
+
[self returnResult:@(result) withCallback:callback andError:nil];
|
|
874
|
+
}];
|
|
875
|
+
} else {
|
|
876
|
+
// Fallback on earlier versions
|
|
877
|
+
RCTLogInfo(@"Push Notification is available from iOS v10.0 or later");
|
|
878
|
+
}
|
|
879
|
+
}
|
|
880
|
+
|
|
772
881
|
@end
|
|
882
|
+
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
RCT_EXPORT_MODULE();
|
|
9
9
|
|
|
10
10
|
- (NSArray<NSString *> *)supportedEvents {
|
|
11
|
-
return @[kCleverTapProfileDidInitialize, kCleverTapProfileSync, kCleverTapInAppNotificationDismissed, kCleverTapInboxDidInitialize, kCleverTapInboxMessagesDidUpdate, kCleverTapInAppNotificationButtonTapped, kCleverTapInboxMessageButtonTapped, kCleverTapInboxMessageTapped, kCleverTapDisplayUnitsLoaded, kCleverTapFeatureFlagsDidUpdate, kCleverTapProductConfigDidFetch, kCleverTapProductConfigDidActivate, kCleverTapProductConfigDidInitialize, kCleverTapPushNotificationClicked];
|
|
11
|
+
return @[kCleverTapProfileDidInitialize, kCleverTapProfileSync, kCleverTapInAppNotificationDismissed, kCleverTapInboxDidInitialize, kCleverTapInboxMessagesDidUpdate, kCleverTapInAppNotificationButtonTapped, kCleverTapInboxMessageButtonTapped, kCleverTapInboxMessageTapped, kCleverTapDisplayUnitsLoaded, kCleverTapFeatureFlagsDidUpdate, kCleverTapProductConfigDidFetch, kCleverTapProductConfigDidActivate, kCleverTapProductConfigDidInitialize, kCleverTapPushNotificationClicked, kCleverTapPushPermissionResponseReceived, kCleverTapInAppNotificationShowed];
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
|
|
@@ -83,6 +83,11 @@ RCT_EXPORT_MODULE();
|
|
|
83
83
|
name:kCleverTapPushNotificationClicked
|
|
84
84
|
object:nil];
|
|
85
85
|
|
|
86
|
+
[[NSNotificationCenter defaultCenter] addObserver:self
|
|
87
|
+
selector:@selector(emitEventInternal:)
|
|
88
|
+
name:kCleverTapPushPermissionResponseReceived
|
|
89
|
+
object:nil];
|
|
90
|
+
|
|
86
91
|
}
|
|
87
92
|
|
|
88
93
|
- (void)stopObserving {
|
|
@@ -13,8 +13,10 @@
|
|
|
13
13
|
#import "CleverTap+ProductConfig.h"
|
|
14
14
|
#import "CleverTapPushNotificationDelegate.h"
|
|
15
15
|
#import "CleverTapInAppNotificationDelegate.h"
|
|
16
|
+
#import "CleverTap+PushPermission.h"
|
|
16
17
|
|
|
17
|
-
|
|
18
|
+
|
|
19
|
+
@interface CleverTapReactManager() <CleverTapSyncDelegate, CleverTapInAppNotificationDelegate, CleverTapDisplayUnitDelegate, CleverTapFeatureFlagsDelegate, CleverTapProductConfigDelegate, CleverTapPushNotificationDelegate, CleverTapPushPermissionDelegate> {
|
|
18
20
|
}
|
|
19
21
|
|
|
20
22
|
@end
|
|
@@ -46,6 +48,7 @@
|
|
|
46
48
|
[cleverTapInstance setPushNotificationDelegate:self];
|
|
47
49
|
[[cleverTapInstance featureFlags] setDelegate:self];
|
|
48
50
|
[[cleverTapInstance productConfig] setDelegate:self];
|
|
51
|
+
[cleverTapInstance setPushPermissionDelegate:self];
|
|
49
52
|
[cleverTapInstance setLibrary:@"React-Native"];
|
|
50
53
|
}
|
|
51
54
|
|
|
@@ -149,4 +152,12 @@
|
|
|
149
152
|
[self postNotificationWithName:kCleverTapProductConfigDidInitialize andBody:nil];
|
|
150
153
|
}
|
|
151
154
|
|
|
155
|
+
#pragma mark - CleverTapPushPermissionDelegate
|
|
156
|
+
|
|
157
|
+
- (void)onPushPermissionResponse:(BOOL)accepted {
|
|
158
|
+
NSMutableDictionary *body = [NSMutableDictionary new];
|
|
159
|
+
body[@"isPermissionGranted"] = [NSNumber numberWithBool:accepted];
|
|
160
|
+
[self postNotificationWithName:kCleverTapPushPermissionResponseReceived andBody:body];
|
|
161
|
+
}
|
|
162
|
+
|
|
152
163
|
@end
|
package/package.json
CHANGED
|
Binary file
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
-
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
3
|
-
<plist version="1.0">
|
|
4
|
-
<dict>
|
|
5
|
-
<key>SchemeUserState</key>
|
|
6
|
-
<dict>
|
|
7
|
-
<key>CleverTapReact.xcscheme_^#shared#^_</key>
|
|
8
|
-
<dict>
|
|
9
|
-
<key>orderHint</key>
|
|
10
|
-
<integer>0</integer>
|
|
11
|
-
</dict>
|
|
12
|
-
</dict>
|
|
13
|
-
</dict>
|
|
14
|
-
</plist>
|