pushwoosh-react-native-plugin 1.2.5 → 2.2.17

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.
Files changed (66) hide show
  1. package/.github/ISSUE_TEMPLATE/bug_report.yml +135 -0
  2. package/.github/ISSUE_TEMPLATE/feature_request.yml +31 -0
  3. package/.github/ISSUE_TEMPLATE/question.yml +28 -0
  4. package/InlineInApp.js +71 -0
  5. package/README.md +35 -85
  6. package/docs/README.md +230 -11
  7. package/index.d.ts +91 -0
  8. package/index.js +536 -154
  9. package/package.json +12 -1
  10. package/pushwoosh-react-native-plugin.podspec +20 -0
  11. package/react-native.config.js +9 -0
  12. package/scripts/add_inbox_ios_resources.js +42 -0
  13. package/src/android/build.gradle +40 -10
  14. package/src/android/gradle/wrapper/gradle-wrapper.jar +0 -0
  15. package/src/android/gradle/wrapper/gradle-wrapper.properties +6 -0
  16. package/src/android/gradlew +160 -0
  17. package/src/android/gradlew.bat +90 -0
  18. package/src/android/src/main/AndroidManifest.xml +19 -54
  19. package/src/android/src/main/java/com/pushwoosh/reactnativeplugin/ConversionUtil.java +214 -148
  20. package/src/android/src/main/java/com/pushwoosh/reactnativeplugin/CustomFirebaseMessagingService.java +29 -0
  21. package/src/android/src/main/java/com/pushwoosh/reactnativeplugin/EventDispatcher.java +10 -2
  22. package/src/android/src/main/java/com/pushwoosh/reactnativeplugin/InboxUiStyleManager.java +162 -0
  23. package/src/android/src/main/java/com/pushwoosh/reactnativeplugin/InlineInAppManager.java +48 -0
  24. package/src/android/src/main/java/com/pushwoosh/reactnativeplugin/PushwooshNotificationServiceExtension.java +44 -0
  25. package/src/android/src/main/java/com/pushwoosh/reactnativeplugin/PushwooshPackage.java +4 -2
  26. package/src/android/src/main/java/com/pushwoosh/reactnativeplugin/PushwooshPlugin.java +608 -297
  27. package/src/android/src/main/java/com/pushwoosh/reactnativeplugin/RCTInlineInAppView.java +75 -0
  28. package/src/android/src/main/java/com/pushwoosh/reactnativeplugin/internal/ReactNativePluginProvider.java +15 -0
  29. package/src/ios/PWAppDelegate.h +20 -0
  30. package/src/ios/PWGDPRManager.h +46 -0
  31. package/src/ios/PWIInboxStyle.h +122 -0
  32. package/src/ios/PWIInboxUI.h +39 -0
  33. package/src/ios/PWInAppManager.h +176 -0
  34. package/src/ios/PWInbox.h +147 -0
  35. package/src/ios/PWInlineInAppView.h +26 -0
  36. package/src/ios/PWLog.h +23 -0
  37. package/src/ios/PWMessaging.h +20 -0
  38. package/src/ios/PWNotificationExtensionManager.h +46 -0
  39. package/src/ios/PWRichMediaManager.h +123 -0
  40. package/src/ios/PWRichMediaStyle.h +122 -0
  41. package/src/ios/PushNotificationManager.h +234 -111
  42. package/src/ios/Pushwoosh.h +623 -0
  43. package/src/ios/PushwooshInboxBundle.bundle/Info.plist +0 -0
  44. package/src/ios/PushwooshInboxBundle.bundle/PWIInboxAttachmentViewController.nib +0 -0
  45. package/src/ios/PushwooshInboxBundle.bundle/PWIInboxMessageViewCell.nib +0 -0
  46. package/src/ios/PushwooshInboxBundle.bundle/PWIInboxViewController.nib +0 -0
  47. package/src/ios/PushwooshInboxBundle.bundle/errorMessage@2x.png +0 -0
  48. package/src/ios/PushwooshInboxBundle.bundle/inbox_icon.png +0 -0
  49. package/src/ios/PushwooshInboxBundle.bundle/noMessage@2x.png +0 -0
  50. package/src/ios/PushwooshInboxBundle.bundle/unread.png +0 -0
  51. package/src/ios/PushwooshInboxUI.h +19 -0
  52. package/src/ios/PushwooshPlugin/PWEventDispatcher.h +1 -1
  53. package/src/ios/PushwooshPlugin/PWInlineInAppManager.h +17 -0
  54. package/src/ios/PushwooshPlugin/PWInlineInAppManager.m +54 -0
  55. package/src/ios/PushwooshPlugin/Pushwoosh.h +19 -2
  56. package/src/ios/PushwooshPlugin/Pushwoosh.m +552 -75
  57. package/src/ios/PushwooshPlugin.xcodeproj/project.pbxproj +27 -6
  58. package/src/ios/libPushwoosh.a +0 -0
  59. package/src/ios/libPushwooshInboxUI.a +0 -0
  60. package/.npmignore +0 -3
  61. package/src/android/.npmignore +0 -1
  62. package/src/android/pushwooshplugin.iml +0 -145
  63. package/src/android/src/main/java/com/pushwoosh/reactnativeplugin/NotificationReceiver.java +0 -42
  64. package/src/android/src/main/java/com/pushwoosh/reactnativeplugin/PostEventActivity.java +0 -45
  65. package/src/ios/Pushwoosh.a +0 -0
  66. package/src/ios/PushwooshPlugin.xcodeproj/project.xcworkspace/contents.xcworkspacedata +0 -7
@@ -0,0 +1,135 @@
1
+ name: "🐞 Bug Report"
2
+ description: "Report us a bug"
3
+ title: "[Bug]: "
4
+ labels: ["bug"]
5
+ body:
6
+ - type: markdown
7
+ attributes:
8
+ value: |
9
+ Thank you for taking the time to create this issue.
10
+
11
+ The more detailed information filled below will help us to investigate the root cause of the issue faster and fix it.
12
+ This form is for React Native Plugin only. If this is a bug for another platform or framework — please create the issue in the corresponded [repository](https://github.com/orgs/Pushwoosh/repositories). We appreciate your cooperation!
13
+ - type: checkboxes
14
+ id: rtfm
15
+ attributes:
16
+ label: Documentation
17
+ description: "Have you checked the relevant integration guide: [Integrating React Native Plugin](https://docs.pushwoosh.com/platform-docs/pushwoosh-sdk/cross-platform-frameworks/react-native/integrating-react-native-plugin) which describes implementation process of the Pushwoosh SDK to your app and follow all the necessary steps?"
18
+ options:
19
+ - label: I've checked the guide, but it doesn't help me to resolve the issue.
20
+ required: true
21
+ - type: textarea
22
+ id: description
23
+ attributes:
24
+ label: Description
25
+ description: Short description of the issue. You can add screenshots and screencast to illustrate it.
26
+ placeholder: "Example: When receiving a push with Rich Media in a closed app, Rich Media is not shown."
27
+ validations:
28
+ required: true
29
+ - type: dropdown
30
+ id: severity
31
+ attributes:
32
+ label: Bug severity
33
+ description: |
34
+ How do you rate the severity of this bug?
35
+ For an objective assessment, please take into account how often this bug occurs in everyday app interaction, how serious the consequences of its occurrence (crash, warning, etc.), number of affected users, enviroment where it occurs (stage, production. etc.).
36
+ options:
37
+ - Low
38
+ - Normal
39
+ - High
40
+ - Urgent
41
+ validations:
42
+ required: true
43
+ - type: textarea
44
+ id: repro-steps
45
+ attributes:
46
+ label: Steps to Reproduce
47
+ description: Describe all the steps needed to reproduce the issue. If an issue is only reproducible under particular circumstances, put all required details here. E.g., if a push is not shown only for a specific API request, provide the full request body. Or, if an issue is reproducible with a particular Rich Media, deep link, etc. — specify it.
48
+ placeholder: |
49
+ 1. Open the app;
50
+ 2. Switch it to the background;
51
+ 3. Received notification with "root_params" causes the app to crash.
52
+ This happens only if dependency XYZ v.1.2.3 is installed
53
+ validations:
54
+ required: true
55
+ - type: dropdown
56
+ id: affected-version
57
+ attributes:
58
+ label: Your Pushwoosh React Native Plugin version
59
+ description: Your React Native Plugin version which was integrated to the app. You may find it on the [releases page](https://github.com/Pushwoosh/pushwoosh-react-native-plugin/releases)
60
+ options:
61
+ - 6.1.25
62
+ - 6.1.23
63
+ - 6.1.22
64
+ - 6.1.21
65
+ - 6.1.20
66
+ - 6.1.19
67
+ - 6.1.18
68
+ - 6.1.17
69
+ - 6.1.16
70
+ - 6.1.15
71
+ - 6.1.14
72
+ - 6.1.13
73
+ - 6.1.12
74
+ - 6.1.11
75
+ - 6.1.10
76
+ - 6.1.9
77
+ - 6.1.8
78
+ - 6.1.7
79
+ - 6.1.6
80
+ - 6.1.5
81
+ - 6.1.4
82
+ - 6.1.3
83
+ - 6.1.2
84
+ - 6.1.1
85
+ - 6.0.10
86
+ - 6.0.9
87
+ - 6.0.8
88
+ - 6.0.7
89
+ - 6.0.6
90
+ - 6.0.5
91
+ - 6.0.4
92
+ - 6.0.3
93
+ - 6.0.2
94
+ - 6.0.1
95
+ - 6.0.0
96
+ - Other — specify it in the description
97
+ validations:
98
+ required: true
99
+ - type: input
100
+ id: last-worked
101
+ attributes:
102
+ label: Last worked Pushwoosh React Native Plugin version (if any)
103
+ description: Is there a version that worked well? If so, please specify.
104
+ - type: checkboxes
105
+ id: platforms-affected
106
+ attributes:
107
+ label: Affected platforms
108
+ description: Select the platforms on which the issue occurs. This helps us determine whether the root cause is core plugin or platform specific.
109
+ options:
110
+ - label: Android
111
+ - label: iOS
112
+ validations:
113
+ required: true
114
+ - type: textarea
115
+ id: platform-versions
116
+ attributes:
117
+ label: Affected OS versions and/or devices
118
+ description: Please specify device models and custom distributions (if any) on which this issue occurs. If the issue occurs when building, then specify the target platform.
119
+ placeholder: |
120
+ E.g. Android 13 on a Google Pixel 3a XL,
121
+ iOS 17.0.3 on an iPhone 14
122
+ MIUI 14.0.8.0 on Xiaomi 13 Ultra, etc.
123
+ validations:
124
+ required: true
125
+ - type: textarea
126
+ id: workaround
127
+ attributes:
128
+ label: Workaround
129
+ description: Have you found a workaround for this issue? Please tell us — this may help other people to continue their work while waiting for this issue to be resolved.
130
+ - type: textarea
131
+ id: logs
132
+ attributes:
133
+ label: Relevant log output
134
+ description: After reproducing the issue, copy device console logs and paste them here "as is". This code block will be formatted automatically, so no additional formatting is needed. If the issue occurs when building, then provide us building logs here.
135
+ render: shell
@@ -0,0 +1,31 @@
1
+ name: "💡 Feature request"
2
+ description: "Suggest us a good idea or improvement"
3
+ title: "[Feature]: "
4
+ labels: ["feature"]
5
+ body:
6
+ - type: markdown
7
+ attributes:
8
+ value: |
9
+ Thank you for taking the time to create this request.
10
+
11
+ This form is for React Native Plugin only. If this is a feature for another platform or framework — please create it in the corresponded [repository](https://github.com/orgs/Pushwoosh/repositories). We appreciate your cooperation!
12
+
13
+ - type: textarea
14
+ id: description
15
+ attributes:
16
+ label: Description
17
+ description: Please tell us what's on your mind. You can add screenshots and screencast to illustrate your request.
18
+ validations:
19
+ required: true
20
+
21
+ - type: textarea
22
+ id: suggestions
23
+ attributes:
24
+ label: Sugeestions
25
+ description: |
26
+ If you know how you can achieve what you want or you have any information that may help us to achieve this, you can add it here.
27
+ For example, links to repositories, discussion threads, documentation, code samples, etc.
28
+
29
+ - type: markdown
30
+ attributes:
31
+ value: Thank you for your feedback!
@@ -0,0 +1,28 @@
1
+ name: "❓ Question"
2
+ description: "Ask us a question"
3
+ title: "[Question]: "
4
+ labels: ["question"]
5
+ body:
6
+ - type: markdown
7
+ attributes:
8
+ value: |
9
+ Thank you for your question!
10
+
11
+ This form is for React Native Plugin only. If this is a question for another platform or framework — please create it in the corresponded [repository](https://github.com/orgs/Pushwoosh/repositories). We appreciate your cooperation!
12
+
13
+ - type: checkboxes
14
+ id: rtfm
15
+ attributes:
16
+ label: Documentation
17
+ description: "Have you checked the relevant integration guide: [Integrating React Native Plugin](https://docs.pushwoosh.com/platform-docs/pushwoosh-sdk/cross-platform-frameworks/react-native/integrating-react-native-plugin) which describes implementation process of the Pushwoosh SDK to your app and follow all the necessary steps?"
18
+ options:
19
+ - label: I've checked the guide, but I didn't find the information I needed there.
20
+ required: true
21
+
22
+ - type: textarea
23
+ id: question
24
+ attributes:
25
+ label: Question
26
+ description: How can we help you? Do you have any questions about the integration of the SDK or how it works? You can add screenshots and screencast to illustrate your request.
27
+ validations:
28
+ required: true
package/InlineInApp.js ADDED
@@ -0,0 +1,71 @@
1
+ import PropTypes from 'prop-types';
2
+ import React from 'react';
3
+ import {requireNativeComponent} from 'react-native';
4
+
5
+ class InlineInAppView extends React.Component {
6
+ _onLoaded = (event) => {
7
+ if (!this.props.onLoaded) {
8
+ return;
9
+ }
10
+
11
+ // process raw event...
12
+ this.props.onLoaded(event.nativeEvent);
13
+ }
14
+
15
+ _onClosed = (event) => {
16
+ if (!this.props.onClosed) {
17
+ return;
18
+ }
19
+
20
+ // process raw event...
21
+ this.props.onClosed(event.nativeEvent);
22
+ }
23
+
24
+ _onSizeChanged = (event) => {
25
+ if (!this.props.onSizeChanged) {
26
+ return;
27
+ }
28
+
29
+ // process raw event...
30
+ this.props.onSizeChanged(event.nativeEvent);
31
+ }
32
+
33
+ render() {
34
+ return (
35
+ <PWInlineInAppView
36
+ {...this.props}
37
+ onLoaded = {this._onLoaded}
38
+ onClosed = {this._onClosed}
39
+ onSizeChanged = {this._onSizeChanged}
40
+ />
41
+ );
42
+ }
43
+ }
44
+
45
+ InlineInAppView.propTypes = {
46
+ /**
47
+ * Value of the identifier property must be equal to the
48
+ * identifier attribute value of the in-app message you've
49
+ * created in Pushwoosh Control Panel
50
+ */
51
+ identifier: PropTypes.string,
52
+ /**
53
+ * This event is called to notify you that an inline in-app
54
+ * was loaded and has been added to the view
55
+ */
56
+ onLoaded: PropTypes.func,
57
+ /**
58
+ * This event is called to notify you that an inline in-app
59
+ * view has been closed by the user
60
+ */
61
+ onClosed: PropTypes.func,
62
+ /**
63
+ * This event is called to notify you that an inline in-app
64
+ * view size has been changed
65
+ */
66
+ onSizeChanged: PropTypes.func,
67
+ };
68
+
69
+ var PWInlineInAppView = requireNativeComponent('PWInlineInAppView', InlineInAppView)
70
+
71
+ export default InlineInAppView
package/README.md CHANGED
@@ -7,116 +7,66 @@ React Native Pushwoosh Push Notifications module
7
7
 
8
8
  ![platforms](https://img.shields.io/badge/platforms-Android%20%7C%20iOS-yellowgreen.svg)
9
9
 
10
- | [Guide](http://docs.pushwoosh.com/docs/react-native-pushwoosh-push-notifications-module-for-android) | [Documentation](docs/README.md) | [Sample](https://github.com/Pushwoosh/pushwoosh-react-native-sample) |
11
- | ------------------------------------------------------------- | ---------------------------------------- | ------------------------------------- |
10
+ | [Guide](https://www.pushwoosh.com/platform-docs/pushwoosh-sdk/cross-platform-frameworks/react-native/integrating-react-native-plugin) | [Documentation](docs/README.md) | [Sample](https://github.com/Pushwoosh/pushwoosh-react-native-sample) |
11
+ | ----------------------------------------------------------- | ------------------------------- | -------------------------------------------------------------------- |
12
12
 
13
13
 
14
- ## Android Setup
15
-
16
- ### Step 1 - Install plugin
17
-
14
+ ### Installation
18
15
  ```
19
16
  npm install pushwoosh-react-native-plugin --save
17
+ react-native link pushwoosh-react-native-plugin
20
18
  ```
21
19
 
22
- ### Step 2 - Include pushwooshplugin library project
23
-
24
- In **android/settings.gradle** file, make the following changes:
20
+ For Android platform, also add the following lines to your project's build.gradle:
25
21
 
26
- ```gradle
27
- ...
28
- include ':pushwooshplugin'
29
- project(':pushwooshplugin').projectDir = new File(rootProject.projectDir, '../node_modules/pushwoosh-react-native-plugin/src/android')
30
22
  ```
31
-
32
- In **android/app/build.gradle** add pushwooshplugin dependency:
33
-
34
- ```gradle
35
- dependencies {
36
- ...
37
- compile project(':pushwooshplugin')
23
+ //you should already have buildscript and dependencies blocks in your project's build.gradle so just put the classpath line there
24
+ buildscript {
25
+ dependencies {
26
+ classpath 'com.google.gms:google-services:4.3.3'
27
+ }
38
28
  }
39
- ```
40
29
 
41
- Optional: To use non-default `play-service-gcm` version (the plugin uses 8.4.0), modify your `android/app/build.gradle` dependencies.
42
- This might be required in case of conflicts with other react-native plugins.
43
- ```gradle
44
- ...
45
-
46
- dependencies {
47
- ...
48
- compile project(':pushwooshplugin')
49
- compile ('com.google.android.gms:play-services-gcm:9.+') {force = true;}
50
- compile ('com.google.android.gms:play-services-location:9.+') {force = true;}
30
+ //add these lines to the very end of your build.gradle
31
+ apply {
32
+ plugin com.google.gms.googleservices.GoogleServicesPlugin
51
33
  }
52
34
  ```
53
35
 
54
- For RN < v.0.29.0 In **MainActivity.java** add:
55
-
56
- ```java
57
- ...
58
- import com.pushwoosh.reactnativeplugin.PushwooshPackage;
59
-
60
- public class MainActivity extends ReactActivity {
61
-
62
- ...
63
-
64
- @Override
65
- protected List<ReactPackage> getPackages() {
66
- return Arrays.<ReactPackage>asList(
67
- new MainReactPackage(),
68
- new PushwooshPackage() // register Pushwoosh plugin here
69
- );
70
- }
71
- }
72
- ```
73
- For RN >= v.0.29.0 In **MainApplication.java** add:
74
-
75
- ```java
76
- ...
77
- import com.pushwoosh.reactnativeplugin.PushwooshPackage;
78
-
79
- public class MainApplication extends Application implements ReactApplication {
80
- ...
81
-
82
- @Override
83
- protected List<ReactPackage> getPackages() {
84
- return Arrays.<ReactPackage>asList(
85
- new MainReactPackage(),
86
- new PushwooshPackage() // register Pushwoosh plugin here
87
- );
88
- }
89
- }
90
- ```
91
-
92
- ### Step 3 - Use module
36
+ ### Usage
93
37
 
94
38
  ```js
95
- var Pushwoosh = require('pushwoosh-react-native-plugin');
39
+ import Pushwoosh from 'pushwoosh-react-native-plugin';
96
40
 
97
- Pushwoosh.init({ "pw_appid" : "YOUR_PUSHWOOSH_PROJECT_ID" , "project_number" : "YOUR_GCM_PROJECT_NUMBER" });
41
+ Pushwoosh.init({
42
+ "pw_appid" : "YOUR_PUSHWOOSH_PROJECT_ID" ,
43
+ "project_number" : "YOUR_GCM_PROJECT_NUMBER"
44
+ });
98
45
  Pushwoosh.register();
99
46
  ```
100
47
 
48
+ In order to use custom notification handling on iOS specify the parameter "pw_notification_handling" to "CUSTOM" when initializing the plugin(If no value specified Pushwoosh notification handler is used):
101
49
 
102
- ## iOS Setup
103
-
104
- ### Step 1 - Install plugin
50
+ ```js
51
+ import Pushwoosh from 'pushwoosh-react-native-plugin';
105
52
 
53
+ Pushwoosh.init({
54
+ "pw_appid" : "YOUR_PUSHWOOSH_PROJECT_ID" ,
55
+ "project_number" : "YOUR_GCM_PROJECT_NUMBER",
56
+ "pw_notification_handling" : "CUSTOM"
57
+ });
58
+ Pushwoosh.register();
106
59
  ```
107
- npm install pushwoosh-react-native-plugin --save
108
- ```
109
-
110
- ### Step 2 - Include PushwooshPlugin project
111
-
112
- Drag the **PushwooshPlugin.xcodeproj** (located in **node_modules/pushwoosh-react-native-plugin/src/ios**) as a dependency project into your React Native XCode project.
113
- Link your project with **libPushwooshPlugin.a**, **libstdc++** and **libz** libraries.
114
60
 
115
- ### Step 3 - Use module
61
+ In order to use reverse proxy to connect to pushwoosh servers specify the parameter "reverse_proxy_url" with the url to your reverse proxy when initializing the plugin:
116
62
 
117
63
  ```js
118
- var Pushwoosh = require('pushwoosh-react-native-plugin');
64
+ import Pushwoosh from 'pushwoosh-react-native-plugin';
119
65
 
120
- Pushwoosh.init({ "pw_appid" : "YOUR_PUSHWOOSH_PROJECT_ID" });
66
+ Pushwoosh.init({
67
+ "pw_appid" : "YOUR_PUSHWOOSH_PROJECT_ID" ,
68
+ "project_number" : "YOUR_GCM_PROJECT_NUMBER",
69
+ "reverse_proxy_url" : "URL_TO_YOUR_REVERSE_PROXY"
70
+ });
121
71
  Pushwoosh.register();
122
72
  ```