react-native-netmera 1.4.8-hms → 1.4.9
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/.github/ISSUE_TEMPLATE/bug_report.md +23 -0
- package/.github/ISSUE_TEMPLATE/feature.md +17 -0
- package/.github/ISSUE_TEMPLATE/release.md +19 -0
- package/.github/PULL_REQUEST_TEMPLATE.md +28 -0
- package/README.md +52 -46
- package/android/.gradle/4.10.1/fileHashes/fileHashes.bin +0 -0
- package/android/.gradle/4.10.1/fileHashes/fileHashes.lock +0 -0
- package/android/build.gradle +3 -3
- package/android/src/main/java/com/netmera/reactnativesdk/RNNetmera.java +16 -1
- package/android/src/main/java/com/netmera/reactnativesdk/RNNetmeraModule.java +10 -0
- package/ios/RNNetmera.m +5 -1
- package/package.json +1 -1
- package/src/Netmera.js +5 -3
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: Bug report
|
|
3
|
+
about: Describe a bug that needs to be fixed
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
**Describe the bug**
|
|
8
|
+
<!--- A clear and concise description of what the bug is. -->
|
|
9
|
+
|
|
10
|
+
**To Reproduce**
|
|
11
|
+
Steps to reproduce the behavior:
|
|
12
|
+
|
|
13
|
+
**Expected behavior**
|
|
14
|
+
<!--- A clear and concise description of what you expected to happen. -->
|
|
15
|
+
|
|
16
|
+
**Testing**
|
|
17
|
+
<!--- A clear and concise description of how to test the fix. -->
|
|
18
|
+
|
|
19
|
+
**Screenshots**
|
|
20
|
+
<!--- If applicable, add screenshots to help explain your problem. -->
|
|
21
|
+
|
|
22
|
+
**Additional context**
|
|
23
|
+
<!--- Add any other context about the problem here. -->
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: Feature
|
|
3
|
+
about: Describe a feature for this project
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
**Is your feature related to a problem? Please describe.**
|
|
7
|
+
<!--- A clear and concise description of what the problem is. -->
|
|
8
|
+
<!--- Ex. I'm always frustrated when [...] -->
|
|
9
|
+
|
|
10
|
+
**Testing**
|
|
11
|
+
<!--- A clear and concise description of how to test the fix. -->
|
|
12
|
+
|
|
13
|
+
**Additional context**
|
|
14
|
+
<!--- Add any other context or screenshots about the feature here. -->
|
|
15
|
+
|
|
16
|
+
**Acceptance criteria**
|
|
17
|
+
<!--- A list of the conditions that a software product must meet to be accepted by a user, a customer, or other system. -->
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: Release
|
|
3
|
+
about: Describe a mobile app release.
|
|
4
|
+
---
|
|
5
|
+
**Type of release.**
|
|
6
|
+
<!--- Is this a Pre Release or a Prod release? -->
|
|
7
|
+
|
|
8
|
+
**New features**
|
|
9
|
+
<!-- Replace ADD_TIME_PERIOD_HERE with the scope of the release -->
|
|
10
|
+
<!-- Add new release features below. -->
|
|
11
|
+
We have completed the mobile dev worked the platform team had scoped out for the month of ADD_TIME_PERIOD_HERE and now it is time to deploy a new release.
|
|
12
|
+
Details for this build are as follows:
|
|
13
|
+
|
|
14
|
+
**Additional context**
|
|
15
|
+
<!--- Add any other context or screenshots about the feature here. -->
|
|
16
|
+
|
|
17
|
+
**Acceptance criteria**
|
|
18
|
+
<!--- A list of the conditions that a software product must meet to be accepted by a user, a customer, or other system. -->
|
|
19
|
+
Testers report no issues.
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
## Related Issue
|
|
2
|
+
<!--- PRs should be related to open issues. -->
|
|
3
|
+
<!--- If suggesting a new feature or change, please discuss it in an issue first. -->
|
|
4
|
+
<!--- If fixing a bug, there should be an issue describing it with steps to reproduce it. -->
|
|
5
|
+
|
|
6
|
+
<!--- Link to the issue here: -->
|
|
7
|
+
ISSUE LINK: https://app.asana.com/0/1203144541549209/ISSUE_NUMBER
|
|
8
|
+
|
|
9
|
+
## Description
|
|
10
|
+
<!--- Describe your changes in detail -->
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
## Types of changes
|
|
14
|
+
<!--- What types of changes does your code introduce? Delete options that are not relevant: -->
|
|
15
|
+
|
|
16
|
+
- [ ] Bug fix (non-breaking change which fixes an issue)
|
|
17
|
+
- [ ] New feature (non-breaking change which adds functionality)
|
|
18
|
+
- [ ] Breaking change (fix or feature that would cause existing functionality to change)
|
|
19
|
+
|
|
20
|
+
## How Has This Been Tested?
|
|
21
|
+
<!--- Describe in detail how you tested your changes. -->
|
|
22
|
+
<!--- Include details of your testing environment, and the tests you ran to -->
|
|
23
|
+
<!--- see how your change affects other areas of the code, etc. -->
|
|
24
|
+
|
|
25
|
+
## Screenshots or Sample Output
|
|
26
|
+
~~~
|
|
27
|
+
PASTE_OUTPUT_HERE
|
|
28
|
+
~~~
|
package/README.md
CHANGED
|
@@ -4,38 +4,13 @@ NETMERA is a Mobile Application Engagement Platform. We offer a series of develo
|
|
|
4
4
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
`yarn add react-native-netmera`
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
or
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
`npm install react-native-netmera`
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
#### iOS
|
|
17
|
-
|
|
18
|
-
1. In XCode, in the project navigator, right click `Libraries` ➜ `Add Files to [your project's name]`
|
|
19
|
-
2. Go to `node_modules` ➜ `react-native-netmera` and add `RNNetmera.xcodeproj`
|
|
20
|
-
3. In XCode, in the project navigator, select your project. Add `libRNNetmera.a` to your project's `Build Phases` ➜ `Link Binary With Libraries`
|
|
21
|
-
4. Run your project (`Cmd+R`)
|
|
22
|
-
|
|
23
|
-
#### Android
|
|
24
|
-
|
|
25
|
-
1. Open up `android/app/src/main/java/[...]/MainActivity.java`
|
|
26
|
-
- Add `import com.netmera.reactnativesdk.RNNetmeraPackage;` to the imports at the top of the file
|
|
27
|
-
- Add `new RNNetmeraPackage()` to the list returned by the `getPackages()` method
|
|
28
|
-
2. Append the following lines to `android/settings.gradle`:
|
|
29
|
-
```
|
|
30
|
-
include ':react-native-netmera'
|
|
31
|
-
project(':react-native-netmera').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-netmera/android')
|
|
32
|
-
```
|
|
33
|
-
3. Insert the following lines inside the dependencies block in `android/app/build.gradle`:
|
|
34
|
-
```
|
|
35
|
-
implementation project(':react-native-netmera')
|
|
36
|
-
```
|
|
37
|
-
|
|
38
|
-
For both native sides(Android & iOS) you don't have to include extra Netmera SDK libraries.
|
|
13
|
+
For both native sides (Android & iOS) you don't have to include extra Netmera SDK libraries.
|
|
39
14
|
|
|
40
15
|
### Setup - Android Part
|
|
41
16
|
|
|
@@ -43,7 +18,7 @@ For both native sides(Android & iOS) you don't have to include extra Netmera SDK
|
|
|
43
18
|
|
|
44
19
|
2) Download `google-services.json` file and place it into android/app/ folder.
|
|
45
20
|
|
|
46
|
-
3) In your project's build gradle file, add the following
|
|
21
|
+
3) In your project's build gradle file, add the following dependencies.
|
|
47
22
|
|
|
48
23
|
```
|
|
49
24
|
buildscript {
|
|
@@ -76,13 +51,12 @@ allprojects {
|
|
|
76
51
|
```
|
|
77
52
|
|
|
78
53
|
dependencies {
|
|
79
|
-
|
|
54
|
+
|
|
80
55
|
implementation 'androidx.core:core:1.1.0'
|
|
81
|
-
|
|
82
56
|
}
|
|
83
57
|
```
|
|
84
58
|
|
|
85
|
-
5) Add the following into the top of app's build.gradle file
|
|
59
|
+
5) Add the following into the top of app's build.gradle file.
|
|
86
60
|
|
|
87
61
|
```
|
|
88
62
|
apply plugin: 'com.google.gms.google-services'
|
|
@@ -102,8 +76,8 @@ apply plugin: 'com.huawei.agconnect'
|
|
|
102
76
|
RNNetmeraConfiguration netmeraConfiguration = new RNNetmeraConfiguration.Builder()
|
|
103
77
|
.firebaseSenderId(<YOUR GCM SENDER ID>)
|
|
104
78
|
.huaweiSenderId(<YOUR HMS SENDER ID>)
|
|
105
|
-
.apiKey(<YOUR NETMERA API KEY>)
|
|
106
|
-
.logging(true)
|
|
79
|
+
.apiKey(<YOUR NETMERA API KEY>)
|
|
80
|
+
.logging(true) // This is for enabling Netmera logs.
|
|
107
81
|
.build(this);
|
|
108
82
|
RNNetmera.initNetmera(netmeraConfiguration);
|
|
109
83
|
}
|
|
@@ -138,7 +112,7 @@ export const onCarouselObjectSelected = async (message) => {
|
|
|
138
112
|
};
|
|
139
113
|
```
|
|
140
114
|
|
|
141
|
-
8) Init `NetmeraBroadcastReceiver` inside your `index.js` file.
|
|
115
|
+
8) Init `NetmeraBroadcastReceiver` inside your `index.js` file.
|
|
142
116
|
|
|
143
117
|
```
|
|
144
118
|
import {
|
|
@@ -206,24 +180,40 @@ $ pod install
|
|
|
206
180
|
```
|
|
207
181
|
|
|
208
182
|
2) If you want to use Android alike message sending from iOS to react native please consider shaping your AppDelegate class as following.
|
|
183
|
+
- `AppDelegate.h`
|
|
184
|
+
```
|
|
185
|
+
#import <React/RCTBridgeDelegate.h>
|
|
186
|
+
#import <UIKit/UIKit.h>
|
|
187
|
+
#import <Netmera/Netmera.h>
|
|
188
|
+
#import <NetmeraCore/NetmeraPushObject.h>
|
|
189
|
+
#import <UserNotifications/UserNotifications.h>
|
|
209
190
|
|
|
191
|
+
@interface AppDelegate : UIResponder <UIApplicationDelegate, RCTBridgeDelegate, UNUserNotificationCenterDelegate, NetmeraPushDelegate>
|
|
192
|
+
|
|
193
|
+
@property (nonatomic, strong) UIWindow *window;
|
|
194
|
+
|
|
195
|
+
@end
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
- `AppDelegate.m`
|
|
210
199
|
```
|
|
211
200
|
#import "AppDelegate.h"
|
|
212
201
|
|
|
213
202
|
#import <RNNetmera/RNNetmeraRCTEventEmitter.h>
|
|
203
|
+
#import <RNNetmera/RNNetmeraUtils.h>
|
|
214
204
|
#import <RNNetmera/RNNetmera.h>
|
|
215
205
|
|
|
216
206
|
@implementation AppDelegate
|
|
217
207
|
|
|
218
208
|
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
|
|
219
209
|
{
|
|
220
|
-
|
|
221
|
-
//
|
|
222
|
-
[RNNetmera logging: YES];
|
|
223
|
-
[RNNetmera initNetmera:[
|
|
210
|
+
|
|
211
|
+
// Add these lines to init Netmera
|
|
212
|
+
[RNNetmera logging: YES]; // This is for enabling Netmera logs.
|
|
213
|
+
[RNNetmera initNetmera:[<YOUR NETMERA API KEY>]]; // Replace this with your own NETMERA API KEY.
|
|
224
214
|
[RNNetmera requestPushNotificationAuthorization];
|
|
225
215
|
[RNNetmera setPushDelegate:self];
|
|
226
|
-
[Netmera setAppGroupName
|
|
216
|
+
[Netmera setAppGroupName:<YOUR APP GROUP NAME>]; // Set your app group name
|
|
227
217
|
|
|
228
218
|
return YES;
|
|
229
219
|
}
|
|
@@ -267,7 +257,7 @@ export const onPushReceive = async (message) => {
|
|
|
267
257
|
3) In order to use iOS10 Media Push, follow the instructions in [Netmera Product Hub.](https://developer.netmera.com/en/IOS/Push-Notifications#using-ios10-media-push)
|
|
268
258
|
|
|
269
259
|
```
|
|
270
|
-
// For receiving Media Push, you must add Netmera pods to top of your Podfile
|
|
260
|
+
// For receiving Media Push, you must add Netmera pods to top of your Podfile.
|
|
271
261
|
pod "Netmera", "3.14.10-WithoutDependency"
|
|
272
262
|
pod "Netmera/NotificationServiceExtension", "3.14.10-WithoutDependency"
|
|
273
263
|
pod "Netmera/NotificationContentExtension", "3.14.10-WithoutDependency"
|
|
@@ -335,6 +325,23 @@ updateUser() {
|
|
|
335
325
|
Netmera.sendEvent(purchaseEvent)
|
|
336
326
|
}
|
|
337
327
|
```
|
|
328
|
+
|
|
329
|
+
##### Push Notification Permissions
|
|
330
|
+
|
|
331
|
+
If you don't request notification permission at runtime, you can request it by calling the `requestPushNotificationAuthorization()` method.
|
|
332
|
+
Note: Notification runtime permissions are required on Android 13 (API 33) or higher.
|
|
333
|
+
Therefore, before calling the method, make sure your project targets an API of 33 and above.
|
|
334
|
+
|
|
335
|
+
```
|
|
336
|
+
Netmera.requestPushNotificationAuthorization();
|
|
337
|
+
```
|
|
338
|
+
|
|
339
|
+
You can call the `areNotificationsEnabled()` method if you need to know the status of permissions.
|
|
340
|
+
|
|
341
|
+
```
|
|
342
|
+
await Netmera.areNotificationsEnabled() // Use the enabled status of permission as boolean
|
|
343
|
+
```
|
|
344
|
+
|
|
338
345
|
##### Netmera Inbox Examples
|
|
339
346
|
|
|
340
347
|
```
|
|
@@ -447,10 +454,9 @@ updateUser() {
|
|
|
447
454
|
filter.includeExpired = true;
|
|
448
455
|
const nmInboxStatusCount = await Netmera.getInboxCountForStatus(filter);
|
|
449
456
|
|
|
450
|
-
let countStatusText =
|
|
457
|
+
let countStatusText =
|
|
451
458
|
"READ: " + nmInboxStatusCount[NMInboxStatus.STATUS_READ] + ", " +
|
|
452
|
-
"UNREAD: " + nmInboxStatusCount[NMInboxStatus.STATUS_UNREAD]
|
|
453
|
-
"DELETED: " + nmInboxStatusCount[NMInboxStatus.STATUS_DELETED]
|
|
459
|
+
"UNREAD: " + nmInboxStatusCount[NMInboxStatus.STATUS_UNREAD]
|
|
454
460
|
|
|
455
461
|
this.setState({countForStatus: countStatusText})
|
|
456
462
|
console.log("nmInboxStatusCount: ", countStatusText);
|
|
@@ -554,4 +560,4 @@ updateUser() {
|
|
|
554
560
|
Netmera.currentExternalId()
|
|
555
561
|
```
|
|
556
562
|
|
|
557
|
-
Please explore example
|
|
563
|
+
Please explore [our example project](https://github.com/Netmera/Netmera-React-Native-Example) for detailed information.
|
|
Binary file
|
|
Binary file
|
package/android/build.gradle
CHANGED
|
@@ -16,8 +16,8 @@ android {
|
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
dependencies {
|
|
19
|
-
implementation 'com.netmera:nmcore:3.9.
|
|
20
|
-
implementation 'com.netmera:nmfcm:3.9.
|
|
21
|
-
implementation 'com.netmera:nmhms:3.9.
|
|
19
|
+
implementation 'com.netmera:nmcore:3.9.12'
|
|
20
|
+
implementation 'com.netmera:nmfcm:3.9.4'
|
|
21
|
+
implementation 'com.netmera:nmhms:3.9.5'
|
|
22
22
|
implementation 'com.facebook.react:react-native:+'
|
|
23
23
|
}
|
|
@@ -3,12 +3,19 @@ package com.netmera.reactnativesdk;
|
|
|
3
3
|
import android.content.ContentValues;
|
|
4
4
|
import android.content.Context;
|
|
5
5
|
|
|
6
|
+
import androidx.startup.AppInitializer;
|
|
7
|
+
|
|
6
8
|
import com.netmera.Netmera;
|
|
7
9
|
import com.netmera.NetmeraConfiguration;
|
|
10
|
+
import com.netmera.NMInitializer;
|
|
11
|
+
import com.netmera.NMMainModule;
|
|
12
|
+
import com.netmera.nmfcm.NMFCMProviderInitializer;
|
|
13
|
+
import com.netmera.nmhms.NMHMSProviderInitializer;
|
|
8
14
|
|
|
9
15
|
public class RNNetmera {
|
|
10
16
|
|
|
11
17
|
public static void initNetmera(RNNetmeraConfiguration netmeraConfiguration) {
|
|
18
|
+
checkNetmeraComponent(netmeraConfiguration.context);
|
|
12
19
|
Netmera.init(netmeraConfiguration.getNetmeraConfiguration());
|
|
13
20
|
setNetmeraHeaders();
|
|
14
21
|
}
|
|
@@ -16,7 +23,15 @@ public class RNNetmera {
|
|
|
16
23
|
static void setNetmeraHeaders() {
|
|
17
24
|
ContentValues headerValues = new ContentValues();
|
|
18
25
|
headerValues.put("X-netmera-framework", "react");
|
|
19
|
-
headerValues.put("X-netmera-frameworkV", "1.4.
|
|
26
|
+
headerValues.put("X-netmera-frameworkV", "1.4.9");
|
|
20
27
|
Netmera.setNetmeraHeaders(headerValues);
|
|
21
28
|
}
|
|
29
|
+
|
|
30
|
+
private static void checkNetmeraComponent(Context context) {
|
|
31
|
+
if (NMMainModule.context == null) {
|
|
32
|
+
NMInitializer.initializeComponents(context);
|
|
33
|
+
AppInitializer.getInstance(context).initializeComponent(NMFCMProviderInitializer.class);
|
|
34
|
+
AppInitializer.getInstance(context).initializeComponent(NMHMSProviderInitializer.class);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
22
37
|
}
|
|
@@ -92,6 +92,16 @@ public class RNNetmeraModule extends ReactContextBaseJavaModule {
|
|
|
92
92
|
Netmera.setBaseUrl(baseUrl);
|
|
93
93
|
}
|
|
94
94
|
|
|
95
|
+
@ReactMethod(isBlockingSynchronousMethod = true)
|
|
96
|
+
public Boolean areNotificationsEnabled() {
|
|
97
|
+
return Netmera.areNotificationsEnabled();
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
@ReactMethod
|
|
101
|
+
public void requestPushNotificationAuthorization() {
|
|
102
|
+
Netmera.requestNotificationPermissions(reactContext.getCurrentActivity());
|
|
103
|
+
}
|
|
104
|
+
|
|
95
105
|
@ReactMethod
|
|
96
106
|
public void requestPermissionsForLocation() {
|
|
97
107
|
Netmera.requestPermissionsForLocation();
|
package/ios/RNNetmera.m
CHANGED
|
@@ -46,7 +46,7 @@ NSString *const ERROR_MESSAGE_SET_CATEGORY_PREFERENCE = @"Error occurred while s
|
|
|
46
46
|
|
|
47
47
|
+ (void)setNetmeraHeaders {
|
|
48
48
|
[Netmera setFramework:@"react"];
|
|
49
|
-
[Netmera setFrameworkVersion:@"1.4.
|
|
49
|
+
[Netmera setFrameworkVersion:@"1.4.9"];
|
|
50
50
|
}
|
|
51
51
|
|
|
52
52
|
+ (void)setPushDelegate:(NSObject<NetmeraPushDelegate> *)delegate {
|
|
@@ -91,6 +91,10 @@ RCT_EXPORT_METHOD(requestPushNotificationAuthorization) {
|
|
|
91
91
|
[Netmera requestPushNotificationAuthorizationForTypes:UIUserNotificationTypeAlert | UIUserNotificationTypeBadge | UIUserNotificationTypeSound];
|
|
92
92
|
}
|
|
93
93
|
|
|
94
|
+
RCT_EXPORT_METHOD(areNotificationsEnabled:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject) {
|
|
95
|
+
resolve(@([Netmera isEnabledReceivingPushNotifications]));
|
|
96
|
+
}
|
|
97
|
+
|
|
94
98
|
RCT_EXPORT_METHOD(requestPermissionsForLocation) {
|
|
95
99
|
[Netmera requestLocationAuthorization];
|
|
96
100
|
}
|
package/package.json
CHANGED
package/src/Netmera.js
CHANGED
|
@@ -87,10 +87,12 @@ export default class Netmera {
|
|
|
87
87
|
RNNetmera.setBaseUrl(baseUrl)
|
|
88
88
|
}
|
|
89
89
|
|
|
90
|
+
static async areNotificationsEnabled(): Promise<boolean> {
|
|
91
|
+
return RNNetmera.areNotificationsEnabled()
|
|
92
|
+
}
|
|
93
|
+
|
|
90
94
|
static requestPushNotificationAuthorization() {
|
|
91
|
-
|
|
92
|
-
RNNetmera.requestPushNotificationAuthorization()
|
|
93
|
-
}
|
|
95
|
+
RNNetmera.requestPushNotificationAuthorization()
|
|
94
96
|
}
|
|
95
97
|
|
|
96
98
|
static requestPermissionsForLocation() {
|