react-native-netmera 1.3.4 → 1.3.5
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 +475 -17
- package/android/.gradle/4.10.1/fileHashes/fileHashes.bin +0 -0
- package/android/.gradle/4.10.1/fileHashes/fileHashes.lock +0 -0
- package/android/.idea/gradle.xml +1 -0
- package/android/build/.transforms/07da1e78aa5e2a23e865850e1fa31195/classes/classes.dex +0 -0
- package/android/build/.transforms/07da1e78aa5e2a23e865850e1fa31195.bin +1 -0
- package/android/build/.transforms/61070ab087fd3e8aaad4987d1cd9aeb2/classes/classes.dex +0 -0
- package/android/build/.transforms/61070ab087fd3e8aaad4987d1cd9aeb2.bin +1 -0
- package/android/build/.transforms/ae3b3ad311ea4fe5b0c3652f1d5b8a07/classes/classes.dex +0 -0
- package/android/build/.transforms/cc45f1af54894b49e3ec8f6b5a05a8d7/classes/classes.dex +0 -0
- package/android/build/.transforms/f58e3ec11746c18253c1a7a566c2609f/classes/classes.dex +0 -0
- package/android/build/.transforms/f58e3ec11746c18253c1a7a566c2609f.bin +1 -0
- package/android/build/intermediates/aapt_friendly_merged_manifests/debug/aapt/AndroidManifest.xml +1 -1
- package/android/build/intermediates/compile_library_classes_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 +13 -0
- package/android/build/intermediates/javac/debug/classes/com/netmera/reactnativesdk/RNNetmera.class +0 -0
- package/android/build/intermediates/javac/debug/classes/com/netmera/reactnativesdk/RNNetmeraCategoryObject.class +0 -0
- package/android/build/intermediates/javac/debug/classes/com/netmera/reactnativesdk/RNNetmeraConfiguration$1.class +0 -0
- package/android/build/intermediates/javac/debug/classes/com/netmera/reactnativesdk/RNNetmeraConfiguration$Builder.class +0 -0
- package/android/build/intermediates/javac/debug/classes/com/netmera/reactnativesdk/RNNetmeraConfiguration.class +0 -0
- package/android/build/intermediates/javac/debug/classes/com/netmera/reactnativesdk/RNNetmeraModule$1.class +0 -0
- package/android/build/intermediates/javac/debug/classes/com/netmera/reactnativesdk/RNNetmeraModule$2.class +0 -0
- package/android/build/intermediates/javac/debug/classes/com/netmera/reactnativesdk/RNNetmeraModule$3.class +0 -0
- package/android/build/intermediates/javac/debug/classes/com/netmera/reactnativesdk/RNNetmeraModule$4.class +0 -0
- package/android/build/intermediates/javac/debug/classes/com/netmera/reactnativesdk/RNNetmeraModule$5.class +0 -0
- package/android/build/intermediates/javac/debug/classes/com/netmera/reactnativesdk/RNNetmeraModule$6.class +0 -0
- package/android/build/intermediates/javac/debug/classes/com/netmera/reactnativesdk/RNNetmeraModule$7.class +0 -0
- package/android/build/intermediates/javac/debug/classes/com/netmera/reactnativesdk/RNNetmeraModule.class +0 -0
- package/android/build/intermediates/javac/debug/classes/com/netmera/reactnativesdk/RNNetmeraPushBroadcastReceiver.class +0 -0
- package/android/build/intermediates/javac/debug/classes/com/netmera/reactnativesdk/RNNetmeraUtil$1.class +0 -0
- package/android/build/intermediates/javac/debug/classes/com/netmera/reactnativesdk/RNNetmeraUtil.class +0 -0
- package/android/build/intermediates/library_manifest/debug/AndroidManifest.xml +1 -1
- package/android/build/intermediates/manifest_merge_blame_file/debug/manifest-merger-blame-debug-report.txt +1 -1
- package/android/build/intermediates/runtime_library_classes_jar/debug/classes.jar +0 -0
- package/android/build/intermediates/symbol_list_with_package_name/debug/package-aware-r.txt +13 -0
- package/android/build.gradle +4 -6
- package/android/src/main/java/com/netmera/reactnativesdk/RNNetmera.java +4 -8
- package/android/src/main/java/com/netmera/reactnativesdk/RNNetmeraCategoryObject.java +56 -0
- package/android/src/main/java/com/netmera/reactnativesdk/RNNetmeraConfiguration.java +128 -0
- package/android/src/main/java/com/netmera/reactnativesdk/RNNetmeraModule.java +146 -17
- package/android/src/main/java/com/netmera/reactnativesdk/RNNetmeraPushBroadcastReceiver.java +16 -38
- package/android/src/main/java/com/netmera/reactnativesdk/RNNetmeraUtil.java +68 -68
- package/index.js +116 -42
- package/ios/RNNetmera.h +6 -0
- package/ios/RNNetmera.m +212 -101
- package/ios/RNNetmeraCategoryObject.h +16 -0
- package/ios/RNNetmeraCategoryObject.m +59 -0
- package/ios/RNNetmeraRCTEventEmitter.h +4 -3
- package/ios/RNNetmeraRCTEventEmitter.m +9 -5
- package/ios/RNNetmeraUtils.m +45 -14
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
|
+
# Netmera React Native SDK
|
|
2
|
+
|
|
3
|
+
NETMERA is a Mobile Application Engagement Platform. We offer a series of development tools and app communication features to help your mobile business ignite and soar.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
1
6
|
|
|
2
|
-
# react-native-netmera
|
|
3
7
|
|
|
4
|
-
## Getting started
|
|
5
8
|
|
|
6
9
|
`$ npm install react-native-netmera --save`
|
|
7
10
|
|
|
@@ -17,28 +20,483 @@
|
|
|
17
20
|
1. In XCode, in the project navigator, right click `Libraries` ➜ `Add Files to [your project's name]`
|
|
18
21
|
2. Go to `node_modules` ➜ `react-native-netmera` and add `RNNetmera.xcodeproj`
|
|
19
22
|
3. In XCode, in the project navigator, select your project. Add `libRNNetmera.a` to your project's `Build Phases` ➜ `Link Binary With Libraries`
|
|
20
|
-
4. Run your project (`Cmd+R`)
|
|
23
|
+
4. Run your project (`Cmd+R`)
|
|
21
24
|
|
|
22
25
|
#### Android
|
|
23
26
|
|
|
24
27
|
1. Open up `android/app/src/main/java/[...]/MainActivity.java`
|
|
25
|
-
|
|
26
|
-
|
|
28
|
+
- Add `import com.netmera.reactnativesdk.RNNetmeraPackage;` to the imports at the top of the file
|
|
29
|
+
- Add `new RNNetmeraPackage()` to the list returned by the `getPackages()` method
|
|
27
30
|
2. Append the following lines to `android/settings.gradle`:
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
31
|
+
```
|
|
32
|
+
include ':react-native-netmera'
|
|
33
|
+
project(':react-native-netmera').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-netmera/android')
|
|
34
|
+
```
|
|
32
35
|
3. Insert the following lines inside the dependencies block in `android/app/build.gradle`:
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
+
```
|
|
37
|
+
compile project(':react-native-netmera')
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
For both native sides(Android & iOS) you don't have to include extra Netmera SDK libraries.
|
|
41
|
+
|
|
42
|
+
### Setup - Android Part
|
|
43
|
+
|
|
44
|
+
1) Create and register your app in [Firebase console](https://firebase.google.com/).
|
|
45
|
+
|
|
46
|
+
2) Download `google-services.json` file and place it into android/app/ folder.
|
|
47
|
+
|
|
48
|
+
3) In your project's build gradle file, add the following dependency.
|
|
49
|
+
|
|
50
|
+
```
|
|
51
|
+
buildscript {
|
|
52
|
+
repositories {
|
|
53
|
+
google()
|
|
54
|
+
jcenter()
|
|
55
|
+
maven {url 'http://developer.huawei.com/repo/'}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
dependencies {
|
|
59
|
+
classpath 'com.android.tools.build:gradle:4.1.3'
|
|
60
|
+
classpath 'com.google.gms:google-services:4.3.5'
|
|
61
|
+
classpath 'com.huawei.agconnect:agcp:1.4.2.300'
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
allprojects {
|
|
66
|
+
repositories {
|
|
67
|
+
google()
|
|
68
|
+
jcenter()
|
|
69
|
+
maven { url 'https://maven.google.com'}
|
|
70
|
+
maven {url 'http://developer.huawei.com/repo/'}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
4) In your app's build gradle file, add the following dependency.
|
|
76
|
+
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
dependencies {
|
|
80
|
+
|
|
81
|
+
implementation 'androidx.core:core:1.1.0'
|
|
82
|
+
|
|
83
|
+
}
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
5) Add the following into the bottom of app's buid.gradle file
|
|
87
|
+
|
|
88
|
+
```
|
|
89
|
+
apply plugin: 'com.google.gms.google-services'
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
6) Create an application class as shown below.
|
|
93
|
+
|
|
94
|
+
- Initialize Netmera SDK in your Application class.
|
|
95
|
+
|
|
96
|
+
```
|
|
97
|
+
public class MainApplication extends Application {
|
|
98
|
+
|
|
99
|
+
@Override
|
|
100
|
+
public void onCreate() {
|
|
101
|
+
super.onCreate();
|
|
102
|
+
RNNetmeraConfiguration netmeraConfiguration = new RNNetmeraConfiguration.Builder()
|
|
103
|
+
.firebaseSenderId(<YOUR GCM SENDER ID>)
|
|
104
|
+
.apiKey(<YOUR NETMERA API KEY>) // This is for enabling Netmera logs.
|
|
105
|
+
.logging(true)
|
|
106
|
+
.build(this);
|
|
107
|
+
RNNetmera.initNetmera(netmeraConfiguration);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
7) Create a new `NetmeraPushHeadlessTask.js` inside your React Native project.
|
|
36
113
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
114
|
+
```
|
|
115
|
+
export const onPushRegister = async (message) => {
|
|
116
|
+
console.log("onPushRegister: ", message);
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
export const onPushReceive = async (message) => {
|
|
120
|
+
console.log("onPushReceive: ", message);
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
export const onPushOpen = async (message) => {
|
|
124
|
+
console.log("onPushOpen: ", message);
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
export const onPushDismiss = async (message) => {
|
|
128
|
+
console.log("onPushDismiss: ", message);
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
export const onPushButtonClicked = async (message) => {
|
|
132
|
+
console.log("onPushButtonClicked: ", message);
|
|
133
|
+
};
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
8) Init `NetmeraBroadcastReceiver` inside your `index.js` file.
|
|
137
|
+
|
|
138
|
+
```
|
|
139
|
+
import { onPushButtonClicked,
|
|
140
|
+
onPushDismiss,
|
|
141
|
+
onPushOpen,
|
|
142
|
+
onPushReceive,
|
|
143
|
+
onPushRegister
|
|
144
|
+
} from "./NetmeraPushHeadlessTask";
|
|
145
|
+
|
|
146
|
+
Netmera.initBroadcastReceiver(
|
|
147
|
+
onPushRegister,
|
|
148
|
+
onPushReceive,
|
|
149
|
+
onPushOpen,
|
|
150
|
+
onPushDismiss,
|
|
151
|
+
onPushButtonClicked
|
|
152
|
+
)
|
|
153
|
+
|
|
154
|
+
// This should be called after Netmera.initBroadcastReceiver method.
|
|
155
|
+
AppRegistry.registerComponent(appName, () => App);
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
### Setup - iOS Part
|
|
159
|
+
|
|
160
|
+
1) Navigate to ios folder in your terminal and run the following command.
|
|
40
161
|
|
|
41
|
-
// TODO: What to do with the module?
|
|
42
|
-
Netmera;
|
|
43
162
|
```
|
|
163
|
+
$ pod install
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
2) If you want to use Android alike message sending from iOS to react native please consider shaping your AppDelegate class as following.
|
|
167
|
+
|
|
168
|
+
```
|
|
169
|
+
#import "AppDelegate.h"
|
|
170
|
+
|
|
171
|
+
#import <React/RCTBridge.h>
|
|
172
|
+
#import <React/RCTBundleURLProvider.h>
|
|
173
|
+
#import <React/RCTRootView.h>
|
|
174
|
+
#import <RNNetmera/RNNetmeraRCTEventEmitter.h>
|
|
175
|
+
#import <RNNetmera/RNNetmeraUtils.h>
|
|
176
|
+
#import <RNNetmera/RNNetmera.h>
|
|
177
|
+
|
|
178
|
+
@implementation AppDelegate
|
|
179
|
+
|
|
180
|
+
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
|
|
181
|
+
{
|
|
182
|
+
|
|
183
|
+
[UNUserNotificationCenter currentNotificationCenter].delegate = self;
|
|
184
|
+
|
|
185
|
+
RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions];
|
|
186
|
+
RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:bridge
|
|
187
|
+
moduleName:@"example"
|
|
188
|
+
initialProperties:nil];
|
|
189
|
+
|
|
190
|
+
rootView.backgroundColor = [[UIColor alloc] initWithRed:1.0f green:1.0f blue:1.0f alpha:1];
|
|
191
|
+
|
|
192
|
+
self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
|
|
193
|
+
UIViewController *rootViewController = [UIViewController new];
|
|
194
|
+
rootViewController.view = rootView;
|
|
195
|
+
self.window.rootViewController = rootViewController;
|
|
196
|
+
[self.window makeKeyAndVisible];
|
|
197
|
+
|
|
198
|
+
[RNNetmera logging: YES];
|
|
199
|
+
[RNNetmera initNetmera:@"<apiKey>"];
|
|
200
|
+
[RNNetmera requestPushNotificationAuthorization];
|
|
201
|
+
[RNNetmera setPushDelegate:self];
|
|
202
|
+
return YES;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
- (NSURL *)sourceURLForBridge:(RCTBridge *)bridge
|
|
206
|
+
{
|
|
207
|
+
#if DEBUG
|
|
208
|
+
return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil];
|
|
209
|
+
#else
|
|
210
|
+
return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];
|
|
211
|
+
#endif
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
// MARK: Push Delegate Methods
|
|
215
|
+
|
|
216
|
+
// Take push payload for Push clicked:
|
|
217
|
+
-(void)userNotificationCenter:(UNUserNotificationCenter *)center didReceiveNotificationResponse:(UNNotificationResponse *)response withCompletionHandler:(void (^)(void))completionHandler
|
|
218
|
+
{
|
|
219
|
+
if ([response.actionIdentifier isEqual:UNNotificationDismissActionIdentifier]) {
|
|
220
|
+
[RNNetmeraRCTEventEmitter onPushDismiss: @{@"userInfo" : response.notification.request.content.userInfo}];
|
|
221
|
+
} else if ([response.actionIdentifier isEqual:UNNotificationDefaultActionIdentifier]) {
|
|
222
|
+
[RNNetmeraRCTEventEmitter onPushOpen: @{@"userInfo" : response.notification.request.content.userInfo}];
|
|
223
|
+
}
|
|
224
|
+
completionHandler();
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
// Take push payload for push Received on application foreground:
|
|
228
|
+
-(void)userNotificationCenter:(UNUserNotificationCenter *)center willPresentNotification:(UNNotification *)notification withCompletionHandler:(void (^)(UNNotificationPresentationOptions))completionHandler
|
|
229
|
+
{
|
|
230
|
+
completionHandler(UNNotificationPresentationOptionAlert);
|
|
231
|
+
[RNNetmeraRCTEventEmitter onPushReceive: @{@"userInfo" : notification.request.content.userInfo}];
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken
|
|
235
|
+
{
|
|
236
|
+
if(deviceToken == nil) {
|
|
237
|
+
return;
|
|
238
|
+
}
|
|
239
|
+
[RNNetmeraRCTEventEmitter onPushRegister: @{@"pushToken" : deviceToken}];
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
@end
|
|
243
|
+
|
|
244
|
+
```
|
|
245
|
+
For example if you trigger `[RNNetmeraRCTEventEmitter onPushReceive: @{@"userInfo" : notification.request.content.userInfo}]` from AppDelegate, in the react native part the following method will be triggered.
|
|
246
|
+
```
|
|
247
|
+
export const onPushReceive = async (message) => {
|
|
248
|
+
console.log("onPushReceive: ", message);
|
|
249
|
+
};
|
|
250
|
+
```
|
|
251
|
+
Please take a look at `Setup-Android part 7`
|
|
252
|
+
|
|
253
|
+
|
|
254
|
+
### Calling React Native methods
|
|
255
|
+
|
|
256
|
+
##### Update User Example
|
|
257
|
+
|
|
258
|
+
```
|
|
259
|
+
updateUser() {
|
|
260
|
+
const user = new NetmeraUser();
|
|
261
|
+
user.userId = <userId>;
|
|
262
|
+
user.name = <name>;
|
|
263
|
+
user.surname = <surname>;
|
|
264
|
+
user.msisdn = <msisdn>;
|
|
265
|
+
user.gender = <gender>;
|
|
266
|
+
Netmera.updateUser(user)
|
|
267
|
+
}
|
|
268
|
+
```
|
|
269
|
+
|
|
270
|
+
##### Sending Event Examples
|
|
271
|
+
|
|
272
|
+
```
|
|
273
|
+
void sendLoginEvent() {
|
|
274
|
+
const loginEvent = new LoginEvent();
|
|
275
|
+
loginEvent.setUserId(<userId>);
|
|
276
|
+
Netmera.sendEvent(loginEvent)
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
void sendRegisterEvent() {
|
|
280
|
+
const registerEvent = new RegisterEvent();
|
|
281
|
+
Netmera.sendEvent(registerEvent)
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
void sendViewCartEvent() {
|
|
285
|
+
const viewCartEvent = new ViewCartEvent();
|
|
286
|
+
viewCartEvent.subTotal = <subTotal>;
|
|
287
|
+
viewCartEvent.itemCount = <itemCount>;
|
|
288
|
+
Netmera.sendEvent(viewCartEvent)
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
void purchaseEvent() {
|
|
292
|
+
const netmeraLineItem = new NetmeraLineItem();
|
|
293
|
+
netmeraLineItem.setBrandId(<brandId>);
|
|
294
|
+
netmeraLineItem.setBrandName(<brandName>);
|
|
295
|
+
netmeraLineItem.setCampaignId(<campaignId>);
|
|
296
|
+
netmeraLineItem.setCategoryIds(<categoryIds>);
|
|
297
|
+
netmeraLineItem.setCategoryNames(<categoryNames>);
|
|
298
|
+
netmeraLineItem.setKeywords(<keywords>);
|
|
299
|
+
netmeraLineItem.setCount(<count>);
|
|
300
|
+
netmeraLineItem.setId(<id>);
|
|
301
|
+
netmeraLineItem.setPrice(<price>);
|
|
302
|
+
|
|
303
|
+
const purchaseEvent = new CustomPurchaseEvent();
|
|
304
|
+
purchaseEvent.coupon = <coupon>;
|
|
305
|
+
purchaseEvent.discount = <discount>;
|
|
306
|
+
purchaseEvent.grandTotal = <grandTotal>;
|
|
307
|
+
purchaseEvent.itemCount = <itemCount>;
|
|
308
|
+
purchaseEvent.paymentMethod = <paymentMethod>;
|
|
309
|
+
purchaseEvent.subTotal = <subTotal>;
|
|
310
|
+
purchaseEvent.shippingCost = <shippingCost>;
|
|
311
|
+
purchaseEvent.purchaseLineItemEvent = [netmeraLineItem, netmeraLineItem];
|
|
312
|
+
purchaseEvent.userName = <userName>;
|
|
313
|
+
Netmera.sendEvent(purchaseEvent)
|
|
314
|
+
}
|
|
315
|
+
```
|
|
316
|
+
##### Netmera Inbox Examples
|
|
317
|
+
|
|
318
|
+
```
|
|
319
|
+
constructor() {
|
|
320
|
+
super();
|
|
321
|
+
this.state = {
|
|
322
|
+
inbox: [],
|
|
323
|
+
inboxState: Netmera.PUSH_OBJECT_STATUS_ALL,
|
|
324
|
+
countForStatus: 0
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
fetchInbox = async () => {
|
|
329
|
+
try {
|
|
330
|
+
const netmeraInboxFilter = new NetmeraInboxFilter();
|
|
331
|
+
netmeraInboxFilter.status = this.state.inboxState;
|
|
332
|
+
netmeraInboxFilter.pageSize = 2;
|
|
333
|
+
const inbox = await Netmera.fetchInbox(netmeraInboxFilter);
|
|
334
|
+
console.log("inbox", inbox);
|
|
335
|
+
this.setState({inbox: inbox});
|
|
336
|
+
} catch (e) {
|
|
337
|
+
console.log("error", e)
|
|
338
|
+
}
|
|
339
|
+
};
|
|
340
|
+
|
|
341
|
+
fetchNextPage = async () => {
|
|
342
|
+
try {
|
|
343
|
+
const inbox = await Netmera.fetchNextPage();
|
|
344
|
+
this.setState({inbox: inbox});
|
|
345
|
+
console.log("inbox", inbox)
|
|
346
|
+
} catch (e) {
|
|
347
|
+
console.log("error", e)
|
|
348
|
+
}
|
|
349
|
+
};
|
|
350
|
+
|
|
351
|
+
updateAll = async () => {
|
|
352
|
+
if (!this.state.inbox !== undefined) {
|
|
353
|
+
let updateStatus = this.state.inboxState;
|
|
354
|
+
if (updateStatus === Netmera.PUSH_OBJECT_STATUS_ALL) {
|
|
355
|
+
Alert.alert("Error", "Please select different status than all!!")
|
|
356
|
+
console.log("Please select different status than all!!");
|
|
357
|
+
return;
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
try {
|
|
361
|
+
Netmera.updateAll(this.state.inboxState).then(() => {
|
|
362
|
+
this.fetchInbox();
|
|
363
|
+
}).catch((error) => {
|
|
364
|
+
console.log("error: " + error)
|
|
365
|
+
})
|
|
366
|
+
} catch (error) {
|
|
367
|
+
console.log("error: " + error)
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
};
|
|
371
|
+
|
|
372
|
+
handlePushObject = async () => {
|
|
373
|
+
if (this.state.inbox !== undefined && this.state.inbox.length > 0) {
|
|
374
|
+
Netmera.handlePushObject(this.state.inbox[0].pushId)
|
|
375
|
+
}
|
|
376
|
+
};
|
|
377
|
+
|
|
378
|
+
handleInteractiveAction = async () => {
|
|
379
|
+
if (this.state.inbox !== undefined && this.state.inbox.length > 0) {
|
|
380
|
+
for (let i = 0; i < this.state.inbox.length; i++) {
|
|
381
|
+
const element = this.state.inbox[i];
|
|
382
|
+
if (element.interactiveActions !== undefined && element.interactiveActions.length > 0) {
|
|
383
|
+
const action = JSON.parse(element.interactiveActions)[0]
|
|
384
|
+
Netmera.handleInteractiveAction(action.id);
|
|
385
|
+
return;
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
};
|
|
390
|
+
|
|
391
|
+
countForStatus = async () => {
|
|
392
|
+
try {
|
|
393
|
+
const count = await Netmera.countForStatus(this.state.inboxState);
|
|
394
|
+
this.setState({countForStatus: count})
|
|
395
|
+
} catch (error) {
|
|
396
|
+
console.log("error: " + error)
|
|
397
|
+
}
|
|
398
|
+
};
|
|
399
|
+
|
|
400
|
+
inboxUpdateStatus = async () => {
|
|
401
|
+
if (this.state.inboxState === Netmera.PUSH_OBJECT_STATUS_ALL) {
|
|
402
|
+
Alert.alert("Error", "Please select different status than all!!")
|
|
403
|
+
console.log("Please select different status than all!!");
|
|
404
|
+
return;
|
|
405
|
+
}
|
|
406
|
+
if (this.state.inbox === undefined || this.state.inbox < 2) {
|
|
407
|
+
Alert.alert("Error", "Push objects count is less then 2!")
|
|
408
|
+
console.log("Push objects count is less then 2!");
|
|
409
|
+
return;
|
|
410
|
+
}
|
|
411
|
+
Netmera.inboxUpdateStatus(0, 2, this.state.inboxState).then(() => {
|
|
412
|
+
console.log("2 push object status was changed successfully.")
|
|
413
|
+
}).catch((error) => {
|
|
414
|
+
console.log("error: " + error)
|
|
415
|
+
});
|
|
416
|
+
};
|
|
417
|
+
|
|
418
|
+
updateInboxState = (value) => {
|
|
419
|
+
this.setState({inboxState: value})
|
|
420
|
+
};
|
|
421
|
+
|
|
422
|
+
```
|
|
423
|
+
|
|
424
|
+
##### Netmera Inbox Category Examples
|
|
425
|
+
|
|
426
|
+
```
|
|
427
|
+
constructor() {
|
|
428
|
+
super();
|
|
429
|
+
this.state = {
|
|
430
|
+
categories: [],
|
|
431
|
+
categoryState: Netmera.PUSH_OBJECT_STATUS_ALL,
|
|
432
|
+
}
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
fetchCategory = async () => {
|
|
436
|
+
try {
|
|
437
|
+
const netmeraCategoryFilter = new NetmeraCategoryFilter();
|
|
438
|
+
netmeraCategoryFilter.status = this.state.categoryState;
|
|
439
|
+
netmeraCategoryFilter.pageSize = 1;
|
|
440
|
+
const categories = await Netmera.fetchCategory(netmeraCategoryFilter);
|
|
441
|
+
console.log("categories", categories);
|
|
442
|
+
this.setState({categories: categories});
|
|
443
|
+
} catch (e) {
|
|
444
|
+
console.log("error", e)
|
|
445
|
+
}
|
|
446
|
+
};
|
|
447
|
+
|
|
448
|
+
fetchNextCategoryPage = async () => {
|
|
449
|
+
try {
|
|
450
|
+
const categories = await Netmera.fetchNextCategoryPage();
|
|
451
|
+
this.setState({categories: categories});
|
|
452
|
+
console.log("categories", categories)
|
|
453
|
+
} catch (e) {
|
|
454
|
+
console.log("error", e)
|
|
455
|
+
}
|
|
456
|
+
};
|
|
457
|
+
|
|
458
|
+
handlePushObject = async () => {
|
|
459
|
+
if (this.state.categories !== undefined && this.state.categories.length > 0) {
|
|
460
|
+
Netmera.handleLastMessage(this.state.categories[0].categoryName)
|
|
461
|
+
}
|
|
462
|
+
};
|
|
463
|
+
|
|
464
|
+
updateStatusCategories = async () => {
|
|
465
|
+
if (this.state.categoryState === Netmera.PUSH_OBJECT_STATUS_ALL) {
|
|
466
|
+
Alert.alert("Error", "Please select different status than all!!")
|
|
467
|
+
console.log("Please select different status than all!!");
|
|
468
|
+
return;
|
|
469
|
+
}
|
|
470
|
+
if (this.state.categories === undefined || this.state.categories < 1) {
|
|
471
|
+
Alert.alert("Error", "Category object not found!")
|
|
472
|
+
console.log("Category object not found!");
|
|
473
|
+
return;
|
|
474
|
+
}
|
|
475
|
+
|
|
476
|
+
const count = this.state.categories.length < 3 ? this.state.categories.length : 2;
|
|
477
|
+
|
|
478
|
+
Netmera.updateStatusByCategories(0, count, this.state.categoryState).then(() => {
|
|
479
|
+
console.log("Category object status was changed successfully.")
|
|
480
|
+
}).catch((error) => {
|
|
481
|
+
console.log("error: " + error)
|
|
482
|
+
});
|
|
483
|
+
};
|
|
484
|
+
|
|
485
|
+
updateCategoryState = (value) => {
|
|
486
|
+
this.setState({categoryState: value})
|
|
487
|
+
};
|
|
488
|
+
```
|
|
489
|
+
|
|
490
|
+
##### Netmera Getting ExternalId (if exists before)
|
|
491
|
+
|
|
492
|
+
```
|
|
493
|
+
Netmera.currentExternalId()
|
|
494
|
+
```
|
|
495
|
+
|
|
496
|
+
|
|
497
|
+
For detailed information please explore example folder in the Netmera sdk library.
|
|
498
|
+
|
|
499
|
+
|
|
500
|
+
|
|
501
|
+
|
|
44
502
|
|
|
Binary file
|
|
Binary file
|
package/android/.idea/gradle.xml
CHANGED
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
o/classes
|
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
o/classes
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
o/classes
|
|
Binary file
|
|
Binary file
|
|
@@ -739,6 +739,7 @@ int color emui_color_gray_10 0x0
|
|
|
739
739
|
int color emui_color_gray_7 0x0
|
|
740
740
|
int color error_color_material_dark 0x0
|
|
741
741
|
int color error_color_material_light 0x0
|
|
742
|
+
int color fcm_test_color 0x0
|
|
742
743
|
int color foreground_material_dark 0x0
|
|
743
744
|
int color foreground_material_light 0x0
|
|
744
745
|
int color highlighted_text_material_dark 0x0
|
|
@@ -1015,6 +1016,9 @@ int drawable abc_textfield_search_activated_mtrl_alpha 0x0
|
|
|
1015
1016
|
int drawable abc_textfield_search_default_mtrl_alpha 0x0
|
|
1016
1017
|
int drawable abc_textfield_search_material 0x0
|
|
1017
1018
|
int drawable abc_vector_test 0x0
|
|
1019
|
+
int drawable adaptive_icon 0x0
|
|
1020
|
+
int drawable adaptive_icon_background 0x0
|
|
1021
|
+
int drawable adaptive_icon_foreground 0x0
|
|
1018
1022
|
int drawable btn_checkbox_checked_mtrl 0x0
|
|
1019
1023
|
int drawable btn_checkbox_checked_to_unchecked_mtrl_animation 0x0
|
|
1020
1024
|
int drawable btn_checkbox_unchecked_mtrl 0x0
|
|
@@ -1042,11 +1046,14 @@ int drawable common_google_signin_btn_text_light 0x0
|
|
|
1042
1046
|
int drawable common_google_signin_btn_text_light_focused 0x0
|
|
1043
1047
|
int drawable common_google_signin_btn_text_light_normal 0x0
|
|
1044
1048
|
int drawable common_google_signin_btn_text_light_normal_background 0x0
|
|
1049
|
+
int drawable gcm_icon 0x0
|
|
1050
|
+
int drawable gcm_icon2 0x0
|
|
1045
1051
|
int drawable googleg_disabled_color_18 0x0
|
|
1046
1052
|
int drawable googleg_standard_color_18 0x0
|
|
1047
1053
|
int drawable ic_carousel_next_icon 0x0
|
|
1048
1054
|
int drawable ic_carousel_prev_icon 0x0
|
|
1049
1055
|
int drawable ic_umbrella_background 0x0
|
|
1056
|
+
int drawable icon_with_gradient 0x0
|
|
1050
1057
|
int drawable netmera_bg_in_app_message 0x0
|
|
1051
1058
|
int drawable netmera_ic_action_cancel 0x0
|
|
1052
1059
|
int drawable netmera_ic_action_transparent 0x0
|
|
@@ -1161,6 +1168,7 @@ int id blocking 0x0
|
|
|
1161
1168
|
int id bottom 0x0
|
|
1162
1169
|
int id bounce 0x0
|
|
1163
1170
|
int id buttonPanel 0x0
|
|
1171
|
+
int id callMeasure 0x0
|
|
1164
1172
|
int id cancel_action 0x0
|
|
1165
1173
|
int id cancel_bg 0x0
|
|
1166
1174
|
int id cancel_imageview 0x0
|
|
@@ -1514,6 +1522,8 @@ int layout select_dialog_singlechoice_material 0x0
|
|
|
1514
1522
|
int layout support_simple_spinner_dropdown_item 0x0
|
|
1515
1523
|
int layout upsdk_app_dl_progress_dialog 0x0
|
|
1516
1524
|
int layout upsdk_ota_update_view 0x0
|
|
1525
|
+
int raw gcm_bip 0x0
|
|
1526
|
+
int raw keep 0x0
|
|
1517
1527
|
int string abc_action_bar_home_description 0x0
|
|
1518
1528
|
int string abc_action_bar_up_description 0x0
|
|
1519
1529
|
int string abc_action_menu_overflow_description 0x0
|
|
@@ -1605,7 +1615,9 @@ int string common_google_play_services_wear_update_text 0x0
|
|
|
1605
1615
|
int string common_open_on_phone 0x0
|
|
1606
1616
|
int string common_signin_button_text 0x0
|
|
1607
1617
|
int string common_signin_button_text_long 0x0
|
|
1618
|
+
int string fcm_2_args 0x0
|
|
1608
1619
|
int string fcm_fallback_notification_channel_label 0x0
|
|
1620
|
+
int string fcm_no_args 0x0
|
|
1609
1621
|
int string header_description 0x0
|
|
1610
1622
|
int string hms_abort 0x0
|
|
1611
1623
|
int string hms_abort_message 0x0
|
|
@@ -1862,6 +1874,7 @@ int style NetmeraThemeAlertDialog 0x0
|
|
|
1862
1874
|
int style Netmera_Theme_Transparent 0x0
|
|
1863
1875
|
int style Netmera_Theme_Transparent_Dim 0x0
|
|
1864
1876
|
int style Netmera_Theme_Transparent_Dim_Dialog 0x0
|
|
1877
|
+
int style Netmera_Theme_Transparent_Webview 0x0
|
|
1865
1878
|
int style Platform_AppCompat 0x0
|
|
1866
1879
|
int style Platform_AppCompat_Light 0x0
|
|
1867
1880
|
int style Platform_ThemeOverlay_AppCompat 0x0
|
package/android/build/intermediates/javac/debug/classes/com/netmera/reactnativesdk/RNNetmera.class
CHANGED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|