@selligent-marketing-cloud/selligent-react-native 3.3.1 → 3.3.2
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.
|
@@ -17,7 +17,7 @@ class Settings {
|
|
|
17
17
|
private Boolean doNotListenToThePush = false;
|
|
18
18
|
private Boolean loadCacheAsynchronously = false;
|
|
19
19
|
private ClearCacheIntervalValue clearCacheIntervalValue;
|
|
20
|
-
private InAppMessageRefreshType inAppMessageRefreshType;
|
|
20
|
+
private InAppMessageRefreshType inAppMessageRefreshType = InAppMessageRefreshType.NONE;
|
|
21
21
|
private RemoteMessageDisplayType remoteMessageDisplayType;
|
|
22
22
|
private String notificationChannelId = "SMChannel001";
|
|
23
23
|
private String notificationChannelName = "SMDefaultChannel";
|
package/documentation/README.md
CHANGED
|
@@ -93,41 +93,46 @@ The following properties can be used in the `selligent.json` to further configur
|
|
|
93
93
|
Follow the [iOS](https://github.com/SelligentMarketingCloud/MobileSDK-iOS/tree/master/Documentation#create-an-apns-key) & [Android](https://github.com/SelligentMarketingCloud/MobileSDK-Android/tree/master/Documentation#creating-an-application) native SDKs guides in order to optin for push notifications in Apple & Google.
|
|
94
94
|
|
|
95
95
|
**For Android**, if targeting API level 33 and above:
|
|
96
|
-
1. Add
|
|
97
|
-
```
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
public class MainActivity extends ReactActivity {
|
|
101
|
-
final int NOTIFICATION_PERMISSION_REQUEST_CODE = 1111;
|
|
96
|
+
1. Add the following line to AndroidManifest.xml:
|
|
97
|
+
```xml
|
|
98
|
+
<uses-permission android:name="android.permission.POST_NOTIFICATIONS"/>
|
|
99
|
+
```
|
|
102
100
|
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
{
|
|
108
|
-
|
|
101
|
+
2. Add this native code to request the push permission and let the SDK know when it is accepted, in the activity where you want to:
|
|
102
|
+
```java
|
|
103
|
+
import com.selligent.RNSelligent;
|
|
104
|
+
|
|
105
|
+
public class MainActivity extends ReactActivity {
|
|
106
|
+
final int NOTIFICATION_PERMISSION_REQUEST_CODE = 1111;
|
|
107
|
+
|
|
108
|
+
@Override
|
|
109
|
+
public void onStart()
|
|
109
110
|
{
|
|
110
|
-
|
|
111
|
+
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.S_V2)
|
|
112
|
+
{
|
|
113
|
+
if (ContextCompat.checkSelfPermission(this, Manifest.permission.POST_NOTIFICATIONS) != PackageManager.PERMISSION_GRANTED)
|
|
114
|
+
{
|
|
115
|
+
ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.POST_NOTIFICATIONS}, NOTIFICATION_PERMISSION_REQUEST_CODE);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
super.onStart();
|
|
111
120
|
}
|
|
112
|
-
}
|
|
113
121
|
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
@Override
|
|
118
|
-
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults)
|
|
119
|
-
{
|
|
120
|
-
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
|
|
121
|
-
|
|
122
|
-
if (requestCode == NOTIFICATION_PERMISSION_REQUEST_CODE)
|
|
122
|
+
@Override
|
|
123
|
+
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults)
|
|
123
124
|
{
|
|
124
|
-
|
|
125
|
+
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
|
|
126
|
+
|
|
127
|
+
if (requestCode == NOTIFICATION_PERMISSION_REQUEST_CODE)
|
|
125
128
|
{
|
|
126
|
-
|
|
129
|
+
if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED)
|
|
130
|
+
{
|
|
131
|
+
RNSelligent.enableNotifications();
|
|
132
|
+
}
|
|
127
133
|
}
|
|
128
134
|
}
|
|
129
|
-
|
|
130
|
-
```
|
|
135
|
+
```
|
|
131
136
|
|
|
132
137
|
**For iOS**:
|
|
133
138
|
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
},
|
|
5
5
|
"name": "@selligent-marketing-cloud/selligent-react-native",
|
|
6
6
|
"title": "Selligent React Native",
|
|
7
|
-
"version": "3.3.
|
|
7
|
+
"version": "3.3.2",
|
|
8
8
|
"description": "React Native wrapper for the Selligent Marketing Cloud Android and iOS SDKs",
|
|
9
9
|
"main": "index.js",
|
|
10
10
|
"repository": {
|