reactnative-plugin-appice 1.5.9 → 1.6.1
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/README.md +37 -37
- package/android/README.md +14 -14
- package/android/android.iml +150 -150
- package/android/build.gradle +152 -152
- package/android/gitignore +47 -47
- package/android/src/main/AndroidManifest.xml +234 -234
- package/android/src/main/java/com/reactlibrary/AppICEUtils.java +38 -38
- package/android/src/main/java/com/reactlibrary/AppIceReactPluginModule.java +473 -473
- package/android/src/main/java/com/reactlibrary/AppIceReactPluginPackage.java +28 -28
- package/android/src/main/java/com/reactlibrary/CampaignCampsReceiver.java +73 -73
- package/android/src/main/java/com/reactlibrary/InAppWebView.java +67 -67
- package/android/src/main/java/com/reactlibrary/NotificationEventService.java +62 -62
- package/example/App.js +148 -148
- package/example/Gemfile +6 -6
- package/example/__tests__/App-test.js +14 -14
- package/example/android/app/_BUCK +55 -55
- package/example/android/app/build.gradle +320 -320
- package/example/android/app/build_defs.bzl +19 -19
- package/example/android/app/proguard-rules.pro +10 -10
- package/example/android/app/src/debug/AndroidManifest.xml +13 -13
- package/example/android/app/src/debug/java/com/example/ReactNativeFlipper.java +73 -73
- package/example/android/app/src/main/AndroidManifest.xml +72 -72
- package/example/android/app/src/main/java/com/example/MainActivity.java +48 -48
- package/example/android/app/src/main/java/com/example/MainApplication.java +91 -91
- package/example/android/app/src/main/java/com/example/newarchitecture/MainApplicationReactNativeHost.java +116 -116
- package/example/android/app/src/main/java/com/example/newarchitecture/components/MainComponentsRegistry.java +36 -36
- package/example/android/app/src/main/java/com/example/newarchitecture/modules/MainApplicationTurboModuleManagerDelegate.java +48 -48
- package/example/android/app/src/main/jni/Android.mk +48 -48
- package/example/android/app/src/main/jni/MainApplicationModuleProvider.cpp +24 -24
- package/example/android/app/src/main/jni/MainApplicationModuleProvider.h +16 -16
- package/example/android/app/src/main/jni/MainApplicationTurboModuleManagerDelegate.cpp +45 -45
- package/example/android/app/src/main/jni/MainApplicationTurboModuleManagerDelegate.h +38 -38
- package/example/android/app/src/main/jni/MainComponentsRegistry.cpp +61 -61
- package/example/android/app/src/main/jni/MainComponentsRegistry.h +32 -32
- package/example/android/app/src/main/jni/OnLoad.cpp +11 -11
- package/example/android/app/src/main/res/drawable/rn_edit_text_material.xml +36 -36
- package/example/android/app/src/main/res/values/strings.xml +3 -3
- package/example/android/app/src/main/res/values/styles.xml +9 -9
- package/example/android/build.gradle +53 -53
- package/example/android/gradle/wrapper/gradle-wrapper.properties +5 -5
- package/example/android/gradle.properties +40 -40
- package/example/android/gradlew +234 -234
- package/example/android/settings.gradle +11 -11
- package/example/app.json +3 -3
- package/example/babel.config.js +3 -3
- package/example/index.js +9 -9
- package/example/ios/Podfile +44 -44
- package/example/ios/Podfile.lock +561 -561
- package/example/ios/_xcode.env +11 -11
- package/example/ios/example/AppDelegate.h +8 -8
- package/example/ios/example/AppDelegate.mm +174 -174
- package/example/ios/example/Images.xcassets/AppIcon.appiconset/Contents.json +53 -53
- package/example/ios/example/Images.xcassets/Contents.json +6 -6
- package/example/ios/example/Info.plist +62 -62
- package/example/ios/example/LaunchScreen.storyboard +47 -47
- package/example/ios/example/example.entitlements +8 -8
- package/example/ios/example/main.m +10 -10
- package/example/ios/example.xcodeproj/project.pbxproj +712 -712
- package/example/ios/example.xcodeproj/xcshareddata/xcschemes/example.xcscheme +88 -88
- package/example/ios/example.xcworkspace/contents.xcworkspacedata +10 -10
- package/example/ios/example.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -8
- package/example/ios/exampleTests/Info.plist +24 -24
- package/example/ios/exampleTests/exampleTests.m +66 -66
- package/example/metro.config.js +17 -17
- package/example/package.json +34 -34
- package/index.js +124 -124
- package/ios/AppICEReactEvent.h +23 -23
- package/ios/AppICEReactEvent.m +86 -77
- package/ios/AppIceReactPlugin.h +22 -22
- package/ios/AppIceReactPlugin.m +190 -191
- package/ios/AppIceReactPlugin.xcodeproj/project.pbxproj +364 -434
- package/ios/AppIceReactPlugin.xcodeproj/project.xcworkspace/contents.xcworkspacedata +4 -4
- package/ios/AppIceReactPlugin.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -8
- package/ios/AppIceReactPlugin.xcodeproj/xcuserdata/Adi.xcuserdatad/xcschemes/xcschememanagement.plist +14 -14
- package/ios/AppIceReactPlugin.xcworkspace/contents.xcworkspacedata +10 -10
- package/ios/AppIceReactPlugin.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -8
- package/ios/Podfile +10 -10
- package/ios/Podfile.lock +3 -3
- package/ios/Pods/Manifest.lock +3 -3
- package/ios/Pods/Pods.xcodeproj/project.pbxproj +395 -395
- package/ios/Pods/Pods.xcodeproj/xcuserdata/Adi.xcuserdatad/xcschemes/Pods-AppIceReactPlugin.xcscheme +58 -58
- package/ios/Pods/Pods.xcodeproj/xcuserdata/Adi.xcuserdatad/xcschemes/xcschememanagement.plist +18 -18
- package/ios/Pods/Target Support Files/Pods-AppIceReactPlugin/Pods-AppIceReactPlugin-Info.plist +26 -26
- package/ios/Pods/Target Support Files/Pods-AppIceReactPlugin/Pods-AppIceReactPlugin-acknowledgements.markdown +3 -3
- package/ios/Pods/Target Support Files/Pods-AppIceReactPlugin/Pods-AppIceReactPlugin-acknowledgements.plist +29 -29
- package/ios/Pods/Target Support Files/Pods-AppIceReactPlugin/Pods-AppIceReactPlugin-dummy.m +5 -5
- package/ios/Pods/Target Support Files/Pods-AppIceReactPlugin/Pods-AppIceReactPlugin-umbrella.h +16 -16
- package/ios/Pods/Target Support Files/Pods-AppIceReactPlugin/Pods-AppIceReactPlugin.debug.xcconfig +6 -6
- package/ios/Pods/Target Support Files/Pods-AppIceReactPlugin/Pods-AppIceReactPlugin.modulemap +6 -6
- package/ios/Pods/Target Support Files/Pods-AppIceReactPlugin/Pods-AppIceReactPlugin.release.xcconfig +6 -6
- package/package.json +40 -40
- package/reactnative-plugin-appice.podspec +30 -30
- package/ios/AppICESDK/appICE.momd/VersionInfo.plist +0 -0
- package/ios/AppICESDK/appICE.momd/appICE 2.mom +0 -0
- package/ios/AppICESDK/appICE.momd/appICE 3.mom +0 -0
- package/ios/AppICESDK/appICE.momd/appICE 4.mom +0 -0
- package/ios/AppICESDK/appICE.momd/appICE 4.omo +0 -0
- package/ios/AppICESDK/appICE.momd/appICE.mom +0 -0
- package/ios/AppICESDK/appICE.momd/appICE2.mom +0 -0
- package/ios/AppICESDK/appICEBundle.bundle/APPChildViewController.nib +0 -0
- package/ios/AppICESDK/appICEBundle.bundle/AppICE_btn.png +0 -0
- package/ios/AppICESDK/appICEBundle.bundle/Black button.png +0 -0
- package/ios/AppICESDK/appICEBundle.bundle/HAlfFooterNOTINAppViewController.nib +0 -0
- package/ios/AppICESDK/appICEBundle.bundle/HAlfHeaderINAppViewController.nib +0 -0
- package/ios/AppICESDK/appICEBundle.bundle/HAlfINAppViewController.nib +0 -0
- package/ios/AppICESDK/appICEBundle.bundle/INAppViewController.nib/objects-11.0+.nib +0 -0
- package/ios/AppICESDK/appICEBundle.bundle/INAppViewController.nib/runtime.nib +0 -0
- package/ios/AppICESDK/appICEBundle.bundle/Info.plist +0 -0
- package/ios/AppICESDK/appICEBundle.bundle/RatingViewController.nib +0 -0
- package/ios/AppICESDK/appICEBundle.bundle/SurveyViewController.nib +0 -0
- package/ios/AppICESDK/appICEBundle.bundle/checked.png +0 -0
- package/ios/AppICESDK/appICEBundle.bundle/close-button.png +0 -0
- package/ios/AppICESDK/appICEBundle.bundle/sound2.caf +0 -0
- package/ios/AppICESDK/appICEBundle.bundle/unchecked.png +0 -0
- package/ios/AppICESDK/include/iosAppiceSDK/AppICEInboxMessage.h +0 -43
- package/ios/AppICESDK/include/iosAppiceSDK/AppICEJSInterface.h +0 -21
- package/ios/AppICESDK/include/iosAppiceSDK/appICE.h +0 -190
- package/ios/AppICESDK/include/iosAppiceSDK/appICEUserDetails.h +0 -87
- package/ios/AppICESDK/include/iosAppiceSDK/isrgrootx1.der +0 -0
- package/ios/AppICESDK/include/iosAppiceSDK/lets-encrypt-r3.der +0 -0
- package/ios/AppICESDK/libiosAppiceSDK_v1.7.56.a +0 -0
package/index.js
CHANGED
|
@@ -1,124 +1,124 @@
|
|
|
1
|
-
import { DeviceEventEmitter, NativeEventEmitter, NativeModules } from 'react-native';
|
|
2
|
-
import { Platform, Component } from 'react-native';
|
|
3
|
-
|
|
4
|
-
const AppIceReactPlugin = NativeModules.AppIceReactPlugin;
|
|
5
|
-
var eventEmitter;
|
|
6
|
-
if(Platform.OS === 'ios')
|
|
7
|
-
{
|
|
8
|
-
eventEmitter = NativeModules.AppICEReactEvent ? new NativeEventEmitter(NativeModules.AppICEReactEvent) : DeviceEventEmitter;
|
|
9
|
-
}
|
|
10
|
-
else
|
|
11
|
-
{
|
|
12
|
-
eventEmitter = new NativeEventEmitter(NativeModules.AppIceReactPlugin);
|
|
13
|
-
}
|
|
14
|
-
var AppICEReact = {
|
|
15
|
-
AppICEPushNotificationClicked: AppIceReactPlugin.AppICEPushNotificationClicked,
|
|
16
|
-
AppICEInAppClicked: AppIceReactPlugin.AppICEInAppClicked,
|
|
17
|
-
name: AppIceReactPlugin.n,
|
|
18
|
-
email: AppIceReactPlugin.em,
|
|
19
|
-
phone: AppIceReactPlugin.ph,
|
|
20
|
-
age: AppIceReactPlugin.a,
|
|
21
|
-
gender: AppIceReactPlugin.g,
|
|
22
|
-
educationType: AppIceReactPlugin.ed,
|
|
23
|
-
employmentType: AppIceReactPlugin.et,
|
|
24
|
-
married: AppIceReactPlugin.m,
|
|
25
|
-
isEmployed: AppIceReactPlugin.is_emp,
|
|
26
|
-
validateIntegration: AppIceReactPlugin.validateIntegration,
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* add all of the registered listeners for given eventName.
|
|
31
|
-
*
|
|
32
|
-
* @param {string} eventName - name of the event whose registered listeners to remove
|
|
33
|
-
* @param {callback} handler - handler for events
|
|
34
|
-
*/
|
|
35
|
-
addListener: function (eventName, handler) {
|
|
36
|
-
if (eventEmitter) {
|
|
37
|
-
eventEmitter.addListener(eventName, handler);
|
|
38
|
-
}
|
|
39
|
-
},
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
* Removes all of the registered listeners for given eventName.
|
|
43
|
-
*
|
|
44
|
-
* @param {string} eventName - name of the event whose registered listeners to remove
|
|
45
|
-
*/
|
|
46
|
-
removeListener: function (eventName) {
|
|
47
|
-
if (eventEmitter) {
|
|
48
|
-
eventEmitter.removeAllListeners(eventName);
|
|
49
|
-
}
|
|
50
|
-
},
|
|
51
|
-
|
|
52
|
-
/**
|
|
53
|
-
* Meta data of the apps that is needed for sdk setting
|
|
54
|
-
* @param {string} appID - meta key
|
|
55
|
-
* @param {string} appKey - meta key
|
|
56
|
-
* @param {string} apiKey - meta key
|
|
57
|
-
* @param {string} deviceID - unique value to idetify the data from panel
|
|
58
|
-
* @param {string} region - e.i. US/GCC/IND
|
|
59
|
-
* @param {string} baseUrl -
|
|
60
|
-
* @param {object} certs - arrays of certificate paths
|
|
61
|
-
* keys are strings and values can be string, number or boolean.
|
|
62
|
-
*/
|
|
63
|
-
startContext: function (appID, appKey, apiKey, deviceID, region, baseUrl, certs){
|
|
64
|
-
AppIceReactPlugin.startContext(appID, appKey, apiKey, deviceID, region, baseUrl, certs)
|
|
65
|
-
},
|
|
66
|
-
|
|
67
|
-
/**
|
|
68
|
-
* Record an event with optional event properties
|
|
69
|
-
* @param {string} eventName - the name of the event
|
|
70
|
-
* @param {object} props - the key-value properties of the event.
|
|
71
|
-
* keys are strings and values can be string, number or boolean.
|
|
72
|
-
*/
|
|
73
|
-
tagEvent: function (eventName, props) {
|
|
74
|
-
AppIceReactPlugin.tagEvent(eventName, props);
|
|
75
|
-
},
|
|
76
|
-
|
|
77
|
-
/**
|
|
78
|
-
* Record an click event
|
|
79
|
-
* @param {string} eventName - the name of the event
|
|
80
|
-
*/
|
|
81
|
-
pushNotificationClicked: function (payload) {
|
|
82
|
-
AppIceReactPlugin.pushNotificationClicked(payload);
|
|
83
|
-
},
|
|
84
|
-
|
|
85
|
-
/**
|
|
86
|
-
* to store custom varibles like fcm token..
|
|
87
|
-
* @param {string} eventName - the name of the event
|
|
88
|
-
* @param {string} props - the name of the event
|
|
89
|
-
*/
|
|
90
|
-
setCustomVariable: function (eventName, props) {
|
|
91
|
-
AppIceReactPlugin.setCustomVariable(eventName, props);
|
|
92
|
-
},
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
/**
|
|
96
|
-
* Set key-value properties on a user profile
|
|
97
|
-
* @param {object} profile - key-value profile properties. keys are strings and values can be string, number or boolean.
|
|
98
|
-
*/
|
|
99
|
-
setUser: function (profile) {
|
|
100
|
-
console.log(profile);
|
|
101
|
-
AppIceReactPlugin.setUser(profile);
|
|
102
|
-
},
|
|
103
|
-
|
|
104
|
-
/**
|
|
105
|
-
* Set unique user id
|
|
106
|
-
* @param {object} values - array of userids
|
|
107
|
-
*/
|
|
108
|
-
setUserId: function (values) {
|
|
109
|
-
AppIceReactPlugin.setUserId(values);
|
|
110
|
-
},
|
|
111
|
-
|
|
112
|
-
getCustomDataFromPayload: function (object) {
|
|
113
|
-
let userObj = JSON.parse(object, (key, value) => {
|
|
114
|
-
return value;
|
|
115
|
-
});
|
|
116
|
-
|
|
117
|
-
let map = new Map(Object.entries(userObj.cdata));
|
|
118
|
-
|
|
119
|
-
return map;
|
|
120
|
-
},
|
|
121
|
-
};
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
module.exports = AppICEReact;
|
|
1
|
+
import { DeviceEventEmitter, NativeEventEmitter, NativeModules } from 'react-native';
|
|
2
|
+
import { Platform, Component } from 'react-native';
|
|
3
|
+
|
|
4
|
+
const AppIceReactPlugin = NativeModules.AppIceReactPlugin;
|
|
5
|
+
var eventEmitter;
|
|
6
|
+
if(Platform.OS === 'ios')
|
|
7
|
+
{
|
|
8
|
+
eventEmitter = NativeModules.AppICEReactEvent ? new NativeEventEmitter(NativeModules.AppICEReactEvent) : DeviceEventEmitter;
|
|
9
|
+
}
|
|
10
|
+
else
|
|
11
|
+
{
|
|
12
|
+
eventEmitter = new NativeEventEmitter(NativeModules.AppIceReactPlugin);
|
|
13
|
+
}
|
|
14
|
+
var AppICEReact = {
|
|
15
|
+
AppICEPushNotificationClicked: AppIceReactPlugin.AppICEPushNotificationClicked,
|
|
16
|
+
AppICEInAppClicked: AppIceReactPlugin.AppICEInAppClicked,
|
|
17
|
+
name: AppIceReactPlugin.n,
|
|
18
|
+
email: AppIceReactPlugin.em,
|
|
19
|
+
phone: AppIceReactPlugin.ph,
|
|
20
|
+
age: AppIceReactPlugin.a,
|
|
21
|
+
gender: AppIceReactPlugin.g,
|
|
22
|
+
educationType: AppIceReactPlugin.ed,
|
|
23
|
+
employmentType: AppIceReactPlugin.et,
|
|
24
|
+
married: AppIceReactPlugin.m,
|
|
25
|
+
isEmployed: AppIceReactPlugin.is_emp,
|
|
26
|
+
validateIntegration: AppIceReactPlugin.validateIntegration,
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* add all of the registered listeners for given eventName.
|
|
31
|
+
*
|
|
32
|
+
* @param {string} eventName - name of the event whose registered listeners to remove
|
|
33
|
+
* @param {callback} handler - handler for events
|
|
34
|
+
*/
|
|
35
|
+
addListener: function (eventName, handler) {
|
|
36
|
+
if (eventEmitter) {
|
|
37
|
+
eventEmitter.addListener(eventName, handler);
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Removes all of the registered listeners for given eventName.
|
|
43
|
+
*
|
|
44
|
+
* @param {string} eventName - name of the event whose registered listeners to remove
|
|
45
|
+
*/
|
|
46
|
+
removeListener: function (eventName) {
|
|
47
|
+
if (eventEmitter) {
|
|
48
|
+
eventEmitter.removeAllListeners(eventName);
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Meta data of the apps that is needed for sdk setting
|
|
54
|
+
* @param {string} appID - meta key
|
|
55
|
+
* @param {string} appKey - meta key
|
|
56
|
+
* @param {string} apiKey - meta key
|
|
57
|
+
* @param {string} deviceID - unique value to idetify the data from panel
|
|
58
|
+
* @param {string} region - e.i. US/GCC/IND
|
|
59
|
+
* @param {string} baseUrl -
|
|
60
|
+
* @param {object} certs - arrays of certificate paths
|
|
61
|
+
* keys are strings and values can be string, number or boolean.
|
|
62
|
+
*/
|
|
63
|
+
startContext: function (appID, appKey, apiKey, deviceID, region, baseUrl, certs){
|
|
64
|
+
AppIceReactPlugin.startContext(appID, appKey, apiKey, deviceID, region, baseUrl, certs)
|
|
65
|
+
},
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Record an event with optional event properties
|
|
69
|
+
* @param {string} eventName - the name of the event
|
|
70
|
+
* @param {object} props - the key-value properties of the event.
|
|
71
|
+
* keys are strings and values can be string, number or boolean.
|
|
72
|
+
*/
|
|
73
|
+
tagEvent: function (eventName, props) {
|
|
74
|
+
AppIceReactPlugin.tagEvent(eventName, props);
|
|
75
|
+
},
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Record an click event
|
|
79
|
+
* @param {string} eventName - the name of the event
|
|
80
|
+
*/
|
|
81
|
+
pushNotificationClicked: function (payload) {
|
|
82
|
+
AppIceReactPlugin.pushNotificationClicked(payload);
|
|
83
|
+
},
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* to store custom varibles like fcm token..
|
|
87
|
+
* @param {string} eventName - the name of the event
|
|
88
|
+
* @param {string} props - the name of the event
|
|
89
|
+
*/
|
|
90
|
+
setCustomVariable: function (eventName, props) {
|
|
91
|
+
AppIceReactPlugin.setCustomVariable(eventName, props);
|
|
92
|
+
},
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* Set key-value properties on a user profile
|
|
97
|
+
* @param {object} profile - key-value profile properties. keys are strings and values can be string, number or boolean.
|
|
98
|
+
*/
|
|
99
|
+
setUser: function (profile) {
|
|
100
|
+
console.log(profile);
|
|
101
|
+
AppIceReactPlugin.setUser(profile);
|
|
102
|
+
},
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* Set unique user id
|
|
106
|
+
* @param {object} values - array of userids
|
|
107
|
+
*/
|
|
108
|
+
setUserId: function (values) {
|
|
109
|
+
AppIceReactPlugin.setUserId(values);
|
|
110
|
+
},
|
|
111
|
+
|
|
112
|
+
getCustomDataFromPayload: function (object) {
|
|
113
|
+
let userObj = JSON.parse(object, (key, value) => {
|
|
114
|
+
return value;
|
|
115
|
+
});
|
|
116
|
+
|
|
117
|
+
let map = new Map(Object.entries(userObj.cdata));
|
|
118
|
+
|
|
119
|
+
return map;
|
|
120
|
+
},
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
module.exports = AppICEReact;
|
package/ios/AppICEReactEvent.h
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
//
|
|
2
|
-
// AppICEReactEvent.h
|
|
3
|
-
// AppIceReactPlugin
|
|
4
|
-
//
|
|
5
|
-
// Created by Garima Paliwal on 09/08/22.
|
|
6
|
-
// Copyright © 2022 Facebook. All rights reserved.
|
|
7
|
-
//
|
|
8
|
-
|
|
9
|
-
#import <Foundation/Foundation.h>
|
|
10
|
-
#import <React/RCTBridgeModule.h>
|
|
11
|
-
#import <React/RCTEventEmitter.h>
|
|
12
|
-
#import <UserNotifications/UserNotifications.h>
|
|
13
|
-
|
|
14
|
-
NS_ASSUME_NONNULL_BEGIN
|
|
15
|
-
|
|
16
|
-
@interface AppICEReactEvent : RCTEventEmitter <RCTBridgeModule, UNUserNotificationCenterDelegate>
|
|
17
|
-
-(void)didReceiveNotificationResponse:(NSNotification *)event;
|
|
18
|
-
+ (id)allocWithZone:(NSZone *)zone;
|
|
19
|
-
-(void)InAppCallback:(NSNotification *)event;
|
|
20
|
-
|
|
21
|
-
@end
|
|
22
|
-
|
|
23
|
-
NS_ASSUME_NONNULL_END
|
|
1
|
+
//
|
|
2
|
+
// AppICEReactEvent.h
|
|
3
|
+
// AppIceReactPlugin
|
|
4
|
+
//
|
|
5
|
+
// Created by Garima Paliwal on 09/08/22.
|
|
6
|
+
// Copyright © 2022 Facebook. All rights reserved.
|
|
7
|
+
//
|
|
8
|
+
|
|
9
|
+
#import <Foundation/Foundation.h>
|
|
10
|
+
#import <React/RCTBridgeModule.h>
|
|
11
|
+
#import <React/RCTEventEmitter.h>
|
|
12
|
+
#import <UserNotifications/UserNotifications.h>
|
|
13
|
+
|
|
14
|
+
NS_ASSUME_NONNULL_BEGIN
|
|
15
|
+
|
|
16
|
+
@interface AppICEReactEvent : RCTEventEmitter <RCTBridgeModule, UNUserNotificationCenterDelegate>
|
|
17
|
+
-(void)didReceiveNotificationResponse:(NSNotification *)event;
|
|
18
|
+
+ (id)allocWithZone:(NSZone *)zone;
|
|
19
|
+
-(void)InAppCallback:(NSNotification *)event;
|
|
20
|
+
|
|
21
|
+
@end
|
|
22
|
+
|
|
23
|
+
NS_ASSUME_NONNULL_END
|
package/ios/AppICEReactEvent.m
CHANGED
|
@@ -1,77 +1,86 @@
|
|
|
1
|
-
#import "AppICEReactEvent.h"
|
|
2
|
-
#import <React/RCTEventEmitter.h>
|
|
3
|
-
#import <UserNotifications/UserNotifications.h>
|
|
4
|
-
#import "AppIceReactPlugin.h"
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
static
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
//
|
|
31
|
-
//
|
|
32
|
-
//
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
@
|
|
77
|
-
|
|
1
|
+
#import "AppICEReactEvent.h"
|
|
2
|
+
#import <React/RCTEventEmitter.h>
|
|
3
|
+
#import <UserNotifications/UserNotifications.h>
|
|
4
|
+
#import "AppIceReactPlugin.h"
|
|
5
|
+
#import <React/RCTLog.h>
|
|
6
|
+
@implementation AppICEReactEvent
|
|
7
|
+
|
|
8
|
+
RCT_EXPORT_MODULE();
|
|
9
|
+
|
|
10
|
+
+ (BOOL)requiresMainQueueSetup {
|
|
11
|
+
return NO;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
- (dispatch_queue_t)methodQueue {
|
|
15
|
+
return dispatch_get_main_queue();
|
|
16
|
+
}
|
|
17
|
+
+ (id)allocWithZone:(NSZone *)zone {
|
|
18
|
+
static AppICEReactEvent *sharedInstance = nil;
|
|
19
|
+
static dispatch_once_t onceToken;
|
|
20
|
+
dispatch_once(&onceToken, ^{
|
|
21
|
+
sharedInstance = [super allocWithZone:zone];
|
|
22
|
+
// [sharedInstance startObserving];
|
|
23
|
+
});
|
|
24
|
+
return sharedInstance;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
- (instancetype)init
|
|
29
|
+
{
|
|
30
|
+
// if ((self = [super init]))
|
|
31
|
+
// {
|
|
32
|
+
// [self startObserving];
|
|
33
|
+
// }
|
|
34
|
+
return self;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
- (NSArray<NSString *> *)supportedEvents
|
|
38
|
+
{
|
|
39
|
+
return @[kAppICEPushNotificationClicked, kAppICEInAppClicked];
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
- (void)startObserving {
|
|
44
|
+
[[NSNotificationCenter defaultCenter] addObserver:self
|
|
45
|
+
selector:@selector(didReceiveNotificationResponse:)
|
|
46
|
+
name:kAppICEPushNotificationClicked
|
|
47
|
+
object:nil];
|
|
48
|
+
|
|
49
|
+
[[NSNotificationCenter defaultCenter] addObserver:self
|
|
50
|
+
selector:@selector(InAppCallback:)
|
|
51
|
+
name:kAppICEInAppClicked
|
|
52
|
+
object:nil];
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
- (void)stopObserving {
|
|
59
|
+
[[NSNotificationCenter defaultCenter] removeObserver:self];
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
-(void)didReceiveNotificationResponse:(NSNotification *)event{
|
|
67
|
+
[self sendEventWithName:kAppICEPushNotificationClicked body:event.userInfo];
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/** InAppCallback with Arguments NSNotification
|
|
71
|
+
* Converts userInfo property of NSNotification oject to a JSON string
|
|
72
|
+
* Setting a Value in the Dictionary
|
|
73
|
+
* Sending an Event */
|
|
74
|
+
|
|
75
|
+
-(void)InAppCallback:(NSNotification *)event{
|
|
76
|
+
RCTLog(@"from InAppCallback %@",event);
|
|
77
|
+
NSError * err;
|
|
78
|
+
NSData * jsonUserInfo = [NSJSONSerialization dataWithJSONObject:event.userInfo options:0 error:&err];
|
|
79
|
+
NSMutableDictionary * eventDict = [[NSMutableDictionary alloc]init];
|
|
80
|
+
[eventDict setObject:[[NSString alloc] initWithData:jsonUserInfo encoding:NSUTF8StringEncoding] forKey:kAppICEInAppClicked];
|
|
81
|
+
RCTLog(@"eventDict %@",eventDict);
|
|
82
|
+
[self sendEventWithName:kAppICEInAppClicked body:eventDict];
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
@end
|
|
86
|
+
|
package/ios/AppIceReactPlugin.h
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
#import <React/RCTBridgeModule.h>
|
|
2
|
-
#import <UserNotifications/UserNotifications.h>
|
|
3
|
-
static NSString *const kAppICEPushNotificationClicked = @"AppICEPushNotificationClicked";
|
|
4
|
-
static NSString *const kAppICEInAppClicked = @"AppICEInAppClicked";
|
|
5
|
-
|
|
6
|
-
static NSString *const kn = @"n";
|
|
7
|
-
static NSString *const kem = @"em";
|
|
8
|
-
static NSString *const kph = @"ph";
|
|
9
|
-
static NSString *const ka = @"a";
|
|
10
|
-
static NSString *const kg = @"g";
|
|
11
|
-
static NSString *const ked = @"ed";
|
|
12
|
-
static NSString *const ket = @"et";
|
|
13
|
-
static NSString *const km = @"m";
|
|
14
|
-
static NSString *const kis_emp = @"is_emp";
|
|
15
|
-
static NSString *const kappICEToken = @"appICEToken";
|
|
16
|
-
|
|
17
|
-
@interface AppIceReactPlugin : NSObject <RCTBridgeModule,UNUserNotificationCenterDelegate>
|
|
18
|
-
+(void)didRegisterForRemoteNotificationsWithDeviceToken:(NSData*)deviceToken;
|
|
19
|
-
+ (void)pushNotificationClicked:(NSDictionary *)userInfo;
|
|
20
|
-
+ (void)pushNotificationReceived:(NSDictionary *)userInfo;
|
|
21
|
-
@end
|
|
22
|
-
|
|
1
|
+
#import <React/RCTBridgeModule.h>
|
|
2
|
+
#import <UserNotifications/UserNotifications.h>
|
|
3
|
+
static NSString *const kAppICEPushNotificationClicked = @"AppICEPushNotificationClicked";
|
|
4
|
+
static NSString *const kAppICEInAppClicked = @"AppICEInAppClicked";
|
|
5
|
+
|
|
6
|
+
static NSString *const kn = @"n";
|
|
7
|
+
static NSString *const kem = @"em";
|
|
8
|
+
static NSString *const kph = @"ph";
|
|
9
|
+
static NSString *const ka = @"a";
|
|
10
|
+
static NSString *const kg = @"g";
|
|
11
|
+
static NSString *const ked = @"ed";
|
|
12
|
+
static NSString *const ket = @"et";
|
|
13
|
+
static NSString *const km = @"m";
|
|
14
|
+
static NSString *const kis_emp = @"is_emp";
|
|
15
|
+
static NSString *const kappICEToken = @"appICEToken";
|
|
16
|
+
|
|
17
|
+
@interface AppIceReactPlugin : NSObject <RCTBridgeModule,UNUserNotificationCenterDelegate>
|
|
18
|
+
+(void)didRegisterForRemoteNotificationsWithDeviceToken:(NSData*)deviceToken;
|
|
19
|
+
+ (void)pushNotificationClicked:(NSDictionary *)userInfo;
|
|
20
|
+
+ (void)pushNotificationReceived:(NSDictionary *)userInfo;
|
|
21
|
+
@end
|
|
22
|
+
|