react-native-netmera 1.7.11 → 1.8.0-beta01

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.
@@ -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
@@ -409,10 +409,15 @@ Therefore, before calling the method, make sure your project targets an API of 3
409
409
  Netmera.requestPushNotificationAuthorization();
410
410
  ```
411
411
 
412
- You can call the `areNotificationsEnabled()` method if you need to know the status of permissions.
412
+ You can call the `checkNotificationPermission()` method if you need to know the status of permissions.
413
413
 
414
414
  ```
415
- await Netmera.areNotificationsEnabled() // Use the enabled status of permission as boolean
415
+ Netmera.checkNotificationPermission().then(status => {
416
+ //NotificationPermissionStatus.NotDetermined
417
+ //NotificationPermissionStatus.Blocked
418
+ //NotificationPermissionStatus.Denied
419
+ //NotificationPermissionStatus.Granted
420
+ });
416
421
  ```
417
422
 
418
423
  ##### Netmera Inbox Examples
package/RNNetmera.podspec CHANGED
@@ -18,6 +18,6 @@ Pod::Spec.new do |s|
18
18
  s.requires_arc = true
19
19
 
20
20
  s.dependency 'React'
21
- s.dependency 'Netmera','3.23.16-WithoutDependency'
21
+ s.dependency 'Netmera','3.24.7-WithoutDependency'
22
22
  end
23
23
 
@@ -19,8 +19,8 @@ android {
19
19
  }
20
20
 
21
21
  dependencies {
22
- implementation 'com.netmera:nmcore:3.14.4'
23
- implementation 'com.netmera:nmfcm:3.13.0'
24
- implementation 'com.netmera:nmhms:3.12.0'
22
+ implementation 'com.netmera:nmcore:4.0.3'
23
+ implementation 'com.netmera:nmfcm:4.0.0'
24
+ implementation 'com.netmera:nmhms:4.0.0'
25
25
  implementation 'com.facebook.react:react-native:+'
26
26
  }
@@ -1,21 +1,16 @@
1
1
  package com.netmera.reactnativesdk;
2
2
 
3
+ import android.app.Application;
3
4
  import android.content.ContentValues;
4
- import android.content.Context;
5
-
6
- import androidx.startup.AppInitializer;
7
5
 
8
6
  import com.netmera.Netmera;
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;
7
+ import com.netmera.NMActivityLifecycleCallbacks;
14
8
 
15
9
  public class RNNetmera {
16
10
 
17
11
  public static void initNetmera(RNNetmeraConfiguration netmeraConfiguration) {
18
- checkNetmeraComponent(netmeraConfiguration.context);
12
+ Application application = (Application) netmeraConfiguration.context.getApplicationContext();
13
+ application.registerActivityLifecycleCallbacks(new NMActivityLifecycleCallbacks(application));
19
14
  Netmera.init(netmeraConfiguration.getNetmeraConfiguration());
20
15
  setNetmeraHeaders();
21
16
  }
@@ -23,15 +18,7 @@ public class RNNetmera {
23
18
  static void setNetmeraHeaders() {
24
19
  ContentValues headerValues = new ContentValues();
25
20
  headerValues.put("X-netmera-framework", "react");
26
- headerValues.put("X-netmera-frameworkV", "1.7.10");
21
+ headerValues.put("X-netmera-frameworkV", "1.8.0");
27
22
  Netmera.setNetmeraHeaders(headerValues);
28
23
  }
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
- }
37
24
  }
@@ -6,6 +6,11 @@ import com.netmera.NetmeraConfiguration;
6
6
  import com.netmera.callbacks.NMInAppMessageActionCallbacks;
7
7
  import com.netmera.callbacks.NMPushActionCallbacks;
8
8
  import com.netmera.callbacks.NMWebWidgetCallbacks;
9
+ import com.netmera.nmfcm.NMFCMProvider;
10
+ import com.netmera.nmhms.NMHMSProvider;
11
+
12
+ import java.util.Collections;
13
+ import java.util.List;
9
14
 
10
15
  public class RNNetmeraConfiguration {
11
16
 
@@ -18,6 +23,7 @@ public class RNNetmeraConfiguration {
18
23
  String apiKey;
19
24
  String firebaseSenderId;
20
25
  boolean logging;
26
+ List<String> sslPinKeys;
21
27
 
22
28
  private RNNetmeraConfiguration(Builder builder) {
23
29
  this.nmInAppMessageActionCallbacks = builder.nmInAppMessageActionCallbacks;
@@ -29,6 +35,7 @@ public class RNNetmeraConfiguration {
29
35
  this.apiKey = builder.apiKey;
30
36
  this.firebaseSenderId = builder.firebaseSenderId;
31
37
  this.logging = builder.logging;
38
+ this.sslPinKeys = builder.sslPinKeys;
32
39
  }
33
40
 
34
41
  NetmeraConfiguration getNetmeraConfiguration() {
@@ -64,8 +71,14 @@ public class RNNetmeraConfiguration {
64
71
  builder.nmInAppMessageActionCallbacks(nmInAppMessageActionCallbacks);
65
72
  }
66
73
 
74
+ if (sslPinKeys != null) {
75
+ builder.sslPinKeys(sslPinKeys);
76
+ }
77
+
67
78
  return builder.logging(logging)
68
79
  .disableSerializeRule(true)
80
+ .addProvider(new NMFCMProvider())
81
+ .addProvider(new NMHMSProvider())
69
82
  .nmPushActionCallbacks(nmPushActionCallbacks)
70
83
  .nmWebWidgetCallbacks(nmWebWidgetCallbacks)
71
84
  .build(context);
@@ -81,6 +94,7 @@ public class RNNetmeraConfiguration {
81
94
  private String apiKey;
82
95
  private String firebaseSenderId;
83
96
  private boolean logging;
97
+ private List<String> sslPinKeys;
84
98
 
85
99
  public Builder nmInAppMessageActionCallbacks(NMInAppMessageActionCallbacks nmInAppMessageActionCallbacks) {
86
100
  this.nmInAppMessageActionCallbacks = nmInAppMessageActionCallbacks;
@@ -122,6 +136,16 @@ public class RNNetmeraConfiguration {
122
136
  return this;
123
137
  }
124
138
 
139
+ public Builder sslPinKeys(String sslPinKey) {
140
+ this.sslPinKeys = Collections.singletonList(sslPinKey);
141
+ return this;
142
+ }
143
+
144
+ public Builder sslPinKeys(List<String> sslPinKeys) {
145
+ this.sslPinKeys = sslPinKeys;
146
+ return this;
147
+ }
148
+
125
149
  public RNNetmeraConfiguration build(Context context) {
126
150
  this.context = context;
127
151
  return new RNNetmeraConfiguration(this);
@@ -114,6 +114,17 @@ public class RNNetmeraModule extends ReactContextBaseJavaModule {
114
114
  return Netmera.areNotificationsEnabled();
115
115
  }
116
116
 
117
+ @ReactMethod(isBlockingSynchronousMethod = true)
118
+ public String checkNotificationPermission() {
119
+ Activity activity = getCurrentActivity();
120
+ if (activity != null) {
121
+ return Netmera.checkNotificationPermission(activity).toString();
122
+ } else {
123
+ Log.e("NETMERA", "Cannot call checkNotificationPermission because current ReactActivity is null");
124
+ return "null";
125
+ }
126
+ }
127
+
117
128
  @ReactMethod
118
129
  public void requestPushNotificationAuthorization() {
119
130
  Activity activity = getCurrentActivity();
package/index.ts CHANGED
@@ -12,6 +12,7 @@ import NetmeraInboxFilter from "./src/models/NetmeraInboxFilter";
12
12
  import NMInboxStatusCountFilter from "./src/models/NMInboxStatusCountFilter";
13
13
  import NMCategoryPreference from "./src/models/NMCategoryPreference";
14
14
  import { NMInboxStatus } from "./src/models/NMInboxStatus";
15
+ import { NotificationPermissionStatus } from "./src/models/NotificationPermissionStatus";
15
16
 
16
17
  export {
17
18
  Netmera,
@@ -27,4 +28,5 @@ export {
27
28
  NetmeraCategory,
28
29
  NetmeraCategoryFilter,
29
30
  NMCategoryPreference,
31
+ NotificationPermissionStatus,
30
32
  };
package/ios/RNNetmera.m CHANGED
@@ -55,7 +55,7 @@ NSString *const ERROR_MESSAGE_UPDATE_USER = @"Error occurred while updating user
55
55
 
56
56
  + (void)setNetmeraHeaders {
57
57
  [Netmera setFramework:@"react"];
58
- [Netmera setFrameworkVersion:@"1.7.10"];
58
+ [Netmera setFrameworkVersion:@"1.8.0"];
59
59
  }
60
60
 
61
61
  + (void)setPushDelegate:(NSObject<NetmeraPushDelegate> *)delegate {
@@ -104,6 +104,10 @@ RCT_EXPORT_METHOD(areNotificationsEnabled:(RCTPromiseResolveBlock)resolve reject
104
104
  resolve(@([Netmera isEnabledReceivingPushNotifications]));
105
105
  }
106
106
 
107
+ RCT_EXPORT_METHOD(checkNotificationPermission:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject) {
108
+ resolve([@([Netmera checkNotificationPermission]) stringValue]);
109
+ }
110
+
107
111
  RCT_EXPORT_METHOD(requestPermissionsForLocation) {
108
112
  [Netmera requestLocationAuthorization];
109
113
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-netmera",
3
- "version": "1.7.11",
3
+ "version": "1.8.0-beta01",
4
4
  "description": "Netmera React Native SDK",
5
5
  "main": "index.ts",
6
6
  "author": "netmera",
package/src/Netmera.ts CHANGED
@@ -21,6 +21,7 @@ import NMCategoryPreference from "./models/NMCategoryPreference";
21
21
  import { NMInboxStatus } from "./models/NMInboxStatus";
22
22
  import NetmeraCouponObject from "./models/NetmeraCouponObject";
23
23
  import { isAndroid, isIos } from "./utils/DeviceUtils";
24
+ import { NotificationPermissionStatus } from "./models/NotificationPermissionStatus";
24
25
 
25
26
  const { RNNetmera, RNNetmeraRCTEventEmitter }: NativeModulesStatic =
26
27
  NativeModules;
@@ -119,6 +120,24 @@ export default class Netmera {
119
120
  return RNNetmera.areNotificationsEnabled();
120
121
  };
121
122
 
123
+ static checkNotificationPermission =
124
+ async (): Promise<NotificationPermissionStatus> => {
125
+ let status: string = await RNNetmera.checkNotificationPermission();
126
+
127
+ const statusMap: Record<string, NotificationPermissionStatus> = {
128
+ "0": NotificationPermissionStatus.NotDetermined,
129
+ NOT_DETERMINED: NotificationPermissionStatus.NotDetermined,
130
+ "1": NotificationPermissionStatus.Blocked,
131
+ BLOCKED: NotificationPermissionStatus.Blocked,
132
+ "2": NotificationPermissionStatus.Denied,
133
+ DENIED: NotificationPermissionStatus.Denied,
134
+ "3": NotificationPermissionStatus.Granted,
135
+ GRANTED: NotificationPermissionStatus.Granted,
136
+ };
137
+
138
+ return statusMap[status];
139
+ };
140
+
122
141
  static requestPushNotificationAuthorization = () => {
123
142
  RNNetmera.requestPushNotificationAuthorization();
124
143
  };
@@ -0,0 +1,6 @@
1
+ export enum NotificationPermissionStatus {
2
+ NotDetermined = "notDetermined",
3
+ Blocked = "blocked",
4
+ Denied = "denied",
5
+ Granted = "granted",
6
+ }
@@ -1,53 +0,0 @@
1
- name: Sync Commits to Client Repo
2
-
3
- on:
4
- push:
5
- branches:
6
- - master
7
-
8
- jobs:
9
- sync_to_repo_a:
10
- runs-on: ubuntu-latest
11
-
12
- steps:
13
- - name: Checkout repository
14
- uses: actions/checkout@v2
15
- with:
16
- fetch-depth: 0 # fetch the entire history
17
-
18
- - name: Configure Git
19
- run: |
20
- git config --global user.email "engineering@initialcode.com.tr"
21
- git config --global user.name "Initial Code"
22
-
23
- - name: Add Repo A as remote
24
- run: |
25
- eval `ssh-agent -s`
26
- ssh-add - <<< '${{ secrets.SSH_PRIVATE_KEY }}'
27
- git remote add repo-a "git@github.com:Netmera/netmera-sdk-react-native.git"
28
- git fetch repo-a
29
-
30
- - name: Pull latest changes from Repo A
31
- run: |
32
- eval `ssh-agent -s`
33
- ssh-add - <<< '${{ secrets.SSH_PRIVATE_KEY }}'
34
- git pull repo-a master --rebase || git rebase --abort
35
-
36
- - name: Remove .github folder
37
- run: |
38
- rm -rf .github
39
- git add -A
40
- git commit -m "Remove .github folder before pushing" || true
41
-
42
- - name: Resolve conflicts if any and continue rebase
43
- if: failure()
44
- run: |
45
- eval `ssh-agent -s`
46
- ssh-add - <<< '${{ secrets.SSH_PRIVATE_KEY }}'
47
- git rebase --continue || git rebase --skip || true
48
-
49
- - name: Push to Repo A
50
- run: |
51
- eval `ssh-agent -s`
52
- ssh-add - <<< '${{ secrets.SSH_PRIVATE_KEY }}'
53
- git push repo-a master:master --force