react-native-mehery-event-sender 0.0.11 → 0.0.12

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 (84) hide show
  1. package/LICENSE +2 -1
  2. package/MeheryEventSender.podspec +1 -1
  3. package/README.md +114 -22
  4. package/android/build.gradle +26 -4
  5. package/android/src/main/AndroidManifest.xml +24 -1
  6. package/android/src/main/java/com/meheryeventsender/CarouselReceiver.kt +22 -0
  7. package/android/src/main/java/com/meheryeventsender/CustomNotificationService.kt +307 -133
  8. package/android/src/main/java/com/meheryeventsender/LiveActivityModule.kt +1 -1
  9. package/android/src/main/java/com/meheryeventsender/LiveActivityUtils.kt +29 -60
  10. package/android/src/main/java/com/meheryeventsender/MyFirebaseMessagingService.kt +133 -13
  11. package/android/src/main/res/drawable/ic_next.xml +9 -0
  12. package/android/src/main/res/drawable/ic_prev.xml +9 -0
  13. package/android/src/main/res/layout/carousel_notification_layout.xml +59 -0
  14. package/android/src/main/res/layout/custom_notification_big.xml +69 -0
  15. package/android/src/main/res/layout/rich_media_notification_layout.xml +42 -0
  16. package/android/src/main/res/values/styles.xml +8 -0
  17. package/lib/module/components/BannerPoll.js +101 -63
  18. package/lib/module/components/BannerPoll.js.map +1 -1
  19. package/lib/module/components/BottomSheetPoll.js +108 -27
  20. package/lib/module/components/BottomSheetPoll.js.map +1 -1
  21. package/lib/module/components/FloaterPoll.js +115 -3
  22. package/lib/module/components/FloaterPoll.js.map +1 -1
  23. package/lib/module/components/PipPoll.js +118 -4
  24. package/lib/module/components/PipPoll.js.map +1 -1
  25. package/lib/module/components/PollOverlay.js +5 -2
  26. package/lib/module/components/PollOverlay.js.map +1 -1
  27. package/lib/module/components/RenderInlinePoll.js +142 -49
  28. package/lib/module/components/RenderInlinePoll.js.map +1 -1
  29. package/lib/module/components/RoadblockPoll.js +84 -46
  30. package/lib/module/components/RoadblockPoll.js.map +1 -1
  31. package/lib/module/events/custom/CustomEvents.js +10 -3
  32. package/lib/module/events/custom/CustomEvents.js.map +1 -1
  33. package/lib/module/events/custom/ProfileUpdate.js +82 -0
  34. package/lib/module/events/custom/ProfileUpdate.js.map +1 -0
  35. package/lib/module/firebase/Fb.js +84 -25
  36. package/lib/module/firebase/Fb.js.map +1 -1
  37. package/lib/module/firebase/IosAPNS.js +29 -3
  38. package/lib/module/firebase/IosAPNS.js.map +1 -1
  39. package/lib/module/helpers/buildCommonHeaders.js +50 -0
  40. package/lib/module/helpers/buildCommonHeaders.js.map +1 -0
  41. package/lib/module/index.js +107 -0
  42. package/lib/module/index.js.map +1 -1
  43. package/lib/module/utils/deviceMetadata.js +13 -0
  44. package/lib/module/utils/deviceMetadata.js.map +1 -0
  45. package/lib/module/utils/user.js +28 -4
  46. package/lib/module/utils/user.js.map +1 -1
  47. package/lib/typescript/src/components/BannerPoll.d.ts.map +1 -1
  48. package/lib/typescript/src/components/BottomSheetPoll.d.ts.map +1 -1
  49. package/lib/typescript/src/components/FloaterPoll.d.ts +3 -1
  50. package/lib/typescript/src/components/FloaterPoll.d.ts.map +1 -1
  51. package/lib/typescript/src/components/PipPoll.d.ts +3 -1
  52. package/lib/typescript/src/components/PipPoll.d.ts.map +1 -1
  53. package/lib/typescript/src/components/PollOverlay.d.ts.map +1 -1
  54. package/lib/typescript/src/components/RenderInlinePoll.d.ts.map +1 -1
  55. package/lib/typescript/src/components/RoadblockPoll.d.ts.map +1 -1
  56. package/lib/typescript/src/events/custom/CustomEvents.d.ts.map +1 -1
  57. package/lib/typescript/src/events/custom/ProfileUpdate.d.ts +2 -0
  58. package/lib/typescript/src/events/custom/ProfileUpdate.d.ts.map +1 -0
  59. package/lib/typescript/src/firebase/Fb.d.ts +3 -2
  60. package/lib/typescript/src/firebase/Fb.d.ts.map +1 -1
  61. package/lib/typescript/src/firebase/IosAPNS.d.ts.map +1 -1
  62. package/lib/typescript/src/helpers/buildCommonHeaders.d.ts +4 -0
  63. package/lib/typescript/src/helpers/buildCommonHeaders.d.ts.map +1 -0
  64. package/lib/typescript/src/index.d.ts +3 -0
  65. package/lib/typescript/src/index.d.ts.map +1 -1
  66. package/lib/typescript/src/utils/deviceMetadata.d.ts +3 -0
  67. package/lib/typescript/src/utils/deviceMetadata.d.ts.map +1 -0
  68. package/lib/typescript/src/utils/user.d.ts.map +1 -1
  69. package/package.json +7 -5
  70. package/src/components/BannerPoll.tsx +103 -66
  71. package/src/components/BottomSheetPoll.tsx +97 -19
  72. package/src/components/FloaterPoll.tsx +122 -0
  73. package/src/components/PipPoll.tsx +129 -1
  74. package/src/components/PollOverlay.tsx +7 -2
  75. package/src/components/RenderInlinePoll.tsx +146 -42
  76. package/src/components/RoadblockPoll.tsx +84 -47
  77. package/src/events/custom/CustomEvents.tsx +14 -2
  78. package/src/events/custom/ProfileUpdate.tsx +112 -0
  79. package/src/firebase/Fb.ts +105 -31
  80. package/src/firebase/IosAPNS.ts +29 -2
  81. package/src/helpers/buildCommonHeaders.tsx +55 -0
  82. package/src/index.tsx +128 -0
  83. package/src/utils/deviceMetadata.ts +12 -0
  84. package/src/utils/user.ts +28 -3
package/LICENSE CHANGED
@@ -1,6 +1,7 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2025 Neil Carnac
3
+ Copyright (c) 2025 Ghost-ops721
4
+
4
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
5
6
  of this software and associated documentation files (the "Software"), to deal
6
7
  in the Software without restriction, including without limitation the rights
@@ -11,7 +11,7 @@ Pod::Spec.new do |s|
11
11
  s.authors = package["author"]
12
12
 
13
13
  s.platforms = { :ios => min_ios_version_supported }
14
- s.source = { :git => "https://github.com/neilcarnac/react-native-mehery-event-sender.git", :tag => "#{s.version}" }
14
+ s.source = { :git => "https://github.com/mehery-soccom/PushApp-React-Native.git", :tag => "#{s.version}" }
15
15
 
16
16
  s.source_files = "ios/**/*.{h,m,mm}"
17
17
 
package/README.md CHANGED
@@ -1,12 +1,14 @@
1
+ ````md
1
2
  # react-native-mehery-event-sender
2
3
 
3
- A lightweight React Native SDK to support push notifications, custom in-app messages (popup, banner, PiP), event tracking, and session handling for your apps.
4
+ A lightweight React Native SDK to support push notifications, custom in-app messages (popup, banner, PiP), event tracking, in-app polls, and session handling for your apps.
4
5
 
5
6
  ## Installation
6
7
 
7
8
  ```sh
8
9
  npm install react-native-mehery-event-sender
9
10
  ```
11
+ ````
10
12
 
11
13
  ## 🚀 Initialization
12
14
 
@@ -24,17 +26,17 @@ initSdk(
24
26
  );
25
27
  ```
26
28
 
27
- To login the user:
29
+ ### Login the user
28
30
 
29
31
  ```js
30
- import { onUserLogin } from 'react-native-mehery-event-sender';
32
+ import { OnUserLogin } from 'react-native-mehery-event-sender';
31
33
 
32
34
  // ...
33
35
 
34
36
  OnUserLogin('user_id');
35
37
  ```
36
38
 
37
- To Initialize Page Open Event
39
+ ### Initialize Page Open Event
38
40
 
39
41
  ```js
40
42
  import { OnPageOpen } from 'react-native-mehery-event-sender';
@@ -44,14 +46,14 @@ import { OnPageOpen } from 'react-native-mehery-event-sender';
44
46
  OnPageOpen('page_name');
45
47
  ```
46
48
 
49
+ ---
50
+
47
51
  ## 🎯 Event Tracking
48
52
 
49
53
  To track user actions or custom events:
50
54
 
51
55
  ```js
52
56
  import { sendCustomEvent } from 'react-native-mehery-event-sender';
53
-
54
- // ...
55
57
  // Send a simple event
56
58
  sendCustomEvent('login_clicked', { userId: '12345' });
57
59
 
@@ -63,37 +65,127 @@ sendCustomEvent('purchase_made', {
63
65
  });
64
66
  ```
65
67
 
68
+ ---
69
+
66
70
  ## 🔔 Notification Handling
67
71
 
68
- The SDK auto-registers FCM token and handles push notifications. Ensure you have Firebase configured.
72
+ The SDK auto-registers FCM token and handles push notifications.
73
+ Ensure you have Firebase configured.
74
+
75
+ ### iOS: 3-Button Notification Category
76
+
77
+ To show a notification with **3 action buttons** on iOS, include the `category` field in your APNs payload. The SDK registers `THREE_BUTTON_CATEGORY` with actions: **Action 1**, **Action 2**, **Action 3**.
78
+
79
+ **FCM payload example** (server-side):
80
+
81
+ ```json
82
+ {
83
+ "message": {
84
+ "token": "<device_token>",
85
+ "notification": { "title": "Title", "body": "Body" },
86
+ "apns": {
87
+ "payload": {
88
+ "aps": {
89
+ "category": "THREE_BUTTON_CATEGORY"
90
+ }
91
+ }
92
+ }
93
+ }
94
+ }
95
+ ```
69
96
 
70
- ## In-App Notifications
97
+ Action IDs sent to JS on tap: `PUSHAPP_ACTION_1`, `PUSHAPP_ACTION_2`, `PUSHAPP_ACTION_3`.
71
98
 
72
- The SDK handles: -- Popup full-screen . -- Banner with inline dismiss. -- PiP small floating view with expand logic to popup.
73
- No integration required from your side. The SDK renders them when triggered.
99
+ ---
74
100
 
75
- ## 📄 ProGuard
101
+ ## 🧩 In-App Polls (Inline & Tooltip)
76
102
 
77
- -keep class com.mehery.pushapp.\*_ { _; }
103
+ The SDK supports inline polls (banners/cards inside screen layout) and tooltip-style polls that attach to UI elements.
104
+ These require **no UI logic** from your side — they automatically render when triggered.
78
105
 
79
- ## 🏷️ Versions
106
+ ### 📌 Inline Poll Container
80
107
 
81
- Latest Version: 0.0.10 Hosted on npm.
108
+ Render polls inline within your layout:
82
109
 
83
- ## 💬 Support
110
+ ```tsx
111
+ import { InlinePollContainer } from 'react-native-mehery-event-sender';
84
112
 
85
- Raise issues or feature requests in GitHub Issues
113
+ export default function ExampleScreen() {
114
+ return (
115
+ <View style={{ marginTop: 20 }}>
116
+ <InlinePollContainer placeholderId="home_banner" />
117
+ <Text>Welcome to the Home Screen</Text>
118
+ </View>
119
+ );
120
+ }
121
+ ```
86
122
 
87
- <!-- ## Contributing
123
+ ### 📌 Tooltip Poll Container
124
+
125
+ Attach polls to any UI element (icon, button, floating element):
126
+
127
+ ```tsx
128
+ import { TooltipPollContainer } from 'react-native-mehery-event-sender';
129
+
130
+ export default function ExampleScreen() {
131
+ return (
132
+ <View style={{ flex: 1, justifyContent: 'center', alignItems: 'center' }}>
133
+ <TooltipPollContainer placeholderId="floating_tooltip">
134
+ <View
135
+ style={{
136
+ width: 40,
137
+ height: 40,
138
+ backgroundColor: 'blue',
139
+ borderRadius: 20,
140
+ }}
141
+ />
142
+ </TooltipPollContainer>
143
+ </View>
144
+ );
145
+ }
146
+ ```
147
+
148
+ ---
88
149
 
89
- See the [contributing guide](CONTRIBUTING.md) to learn how to contribute to the repository and the development workflow. -->
150
+ ## 📣 In-App Notifications
90
151
 
91
- <!-- ## License
152
+ The SDK handles:
92
153
 
93
- MIT
154
+ - Full-screen popup
155
+ - Banner with inline dismiss
156
+ - PiP floating widget with expand-to-popup
157
+
158
+ No integration required — rendered automatically when triggered.
94
159
 
95
160
  ---
96
161
 
97
- Made with [create-react-native-library](https://github.com/callstack/react-native-builder-bob) -->
162
+ ## 📄 ProGuard
98
163
 
99
- # react-native-mehery-event-sender
164
+ ```
165
+ -keep class com.mehery.pushapp.** { *; }
166
+ ```
167
+
168
+ ---
169
+
170
+ ## 🏷️ Versions
171
+
172
+ Latest Version: **0.0.10** hosted on npm.
173
+
174
+ ---
175
+
176
+ ## 💬 Support
177
+
178
+ Raise issues or feature requests in **GitHub Issues**.
179
+
180
+ ```
181
+
182
+ ---
183
+
184
+ If you want, I can also generate:
185
+
186
+ ✅ A cleaned-up npm-optimized README
187
+ ✅ A version with images/screenshots
188
+ ✅ A version with API docs & TypeScript definitions
189
+
190
+ Just tell me!
191
+ ```
@@ -30,9 +30,9 @@ allprojects {
30
30
  }
31
31
  }
32
32
 
33
-
34
33
  apply plugin: "com.android.library"
35
34
  apply plugin: "kotlin-android"
35
+ apply plugin: "kotlin-kapt"
36
36
 
37
37
 
38
38
  def getExtOrIntegerDefault(name) {
@@ -65,6 +65,8 @@ android {
65
65
  sourceSets {
66
66
  main {
67
67
  res.srcDirs = ['src/main/res']
68
+ java.srcDirs = ["src/main/java"]
69
+
68
70
  }
69
71
  }
70
72
  }
@@ -82,15 +84,25 @@ android {
82
84
  }
83
85
  }
84
86
 
85
- lintOptions {
86
- disable "GradleCompatible"
87
+ // AGP 8 compatibility — replace old lintOptions
88
+ lint {
89
+ baseline = file("lint-baseline.xml")
90
+ checkReleaseBuilds = false
87
91
  }
88
92
 
89
93
  compileOptions {
90
94
  sourceCompatibility JavaVersion.VERSION_1_8
91
95
  targetCompatibility JavaVersion.VERSION_1_8
92
96
  }
93
-
97
+
98
+ kotlinOptions {
99
+ jvmTarget = "17"
100
+ }
101
+ java {
102
+ toolchain {
103
+ languageVersion = JavaLanguageVersion.of(17)
104
+ }
105
+ }
94
106
  }
95
107
 
96
108
 
@@ -106,5 +118,15 @@ dependencies {
106
118
  implementation 'com.google.firebase:firebase-messaging:24.0.0'
107
119
 
108
120
  implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
121
+
122
+ // ⭐ Carousel support: ViewPager2
123
+ implementation "androidx.viewpager2:viewpager2:1.1.0"
124
+
125
+ // ⭐ Carousel image loader: Glide
126
+ implementation "com.github.bumptech.glide:glide:4.15.1"
127
+ kapt "com.github.bumptech.glide:compiler:4.15.1"
128
+
129
+ implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
130
+
109
131
  }
110
132
 
@@ -1,13 +1,36 @@
1
1
  <manifest xmlns:android="http://schemas.android.com/apk/res/android"
2
2
  package="com.meheryeventsender">
3
3
 
4
+ <uses-permission android:name="android.permission.INTERNET" />
5
+ <uses-permission android:name="android.permission.WAKE_LOCK" />
6
+ <uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
7
+
4
8
  <application>
9
+
10
+ <!-- Firebase Messaging Service -->
5
11
  <service
6
- android:name="com.meheryeventsender.MyFirebaseMessagingService"
12
+ android:name=".MyFirebaseMessagingService"
7
13
  android:exported="false">
8
14
  <intent-filter>
9
15
  <action android:name="com.google.firebase.MESSAGING_EVENT" />
10
16
  </intent-filter>
11
17
  </service>
18
+
19
+ <!-- Custom Notification Service -->
20
+ <service
21
+ android:name=".CustomNotificationService"
22
+ android:exported="false" />
23
+
24
+ <!-- Carousel Receiver (REQUIRED for next / prev buttons) -->
25
+ <receiver
26
+ android:name=".CarouselReceiver"
27
+ android:exported="true">
28
+ <intent-filter>
29
+ <action android:name="com.meheryeventsender.CAROUSEL_NEXT" />
30
+ <action android:name="com.meheryeventsender.CAROUSEL_PREV" />
31
+ </intent-filter>
32
+ </receiver>
33
+
12
34
  </application>
35
+
13
36
  </manifest>
@@ -0,0 +1,22 @@
1
+ package com.meheryeventsender
2
+
3
+ import android.content.BroadcastReceiver
4
+ import android.content.Context
5
+ import android.content.Intent
6
+
7
+ class CarouselReceiver : BroadcastReceiver() {
8
+ override fun onReceive(context: Context, intent: Intent) {
9
+ val id = intent.getIntExtra("id", -1)
10
+ if (id == -1) return
11
+
12
+ val service = CustomNotificationService(context)
13
+
14
+ when (intent.action) {
15
+ CustomNotificationService.ACTION_NEXT ->
16
+ service.changeImage(id, forward = true)
17
+
18
+ CustomNotificationService.ACTION_PREV ->
19
+ service.changeImage(id, forward = false)
20
+ }
21
+ }
22
+ }