@entrig/react-native 0.0.1

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,31 @@
1
+ require 'json'
2
+
3
+ package = JSON.parse(File.read(File.join(__dir__, 'package.json')))
4
+
5
+ Pod::Spec.new do |s|
6
+ s.name = 'EntrigReactNative'
7
+ s.version = package['version']
8
+ s.summary = package['description']
9
+ s.description = package['description']
10
+ s.license = package['license']
11
+ s.author = package['author']
12
+ s.homepage = package['homepage']
13
+ s.platforms = {
14
+ :ios => '15.1'
15
+ }
16
+ s.swift_version = '5.9'
17
+ s.source = { path: '.' }
18
+ s.static_framework = true
19
+
20
+ s.dependency 'React-Core'
21
+ s.dependency 'EntrigSDK', '0.0.8-dev'
22
+
23
+ # Swift/Objective-C compatibility
24
+ s.pod_target_xcconfig = {
25
+ 'DEFINES_MODULE' => 'YES',
26
+ 'SWIFT_INCLUDE_PATHS' => '$(PODS_ROOT)/Headers/Public',
27
+ 'CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES' => 'YES',
28
+ }
29
+
30
+ s.source_files = "ios/**/*.{h,m,mm,swift,hpp,cpp}"
31
+ end
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Entrig
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,609 @@
1
+ # Entrig
2
+
3
+ **Push Notifications for Supabase**
4
+
5
+ Send push notifications to your React Native app, triggered by database events.
6
+
7
+ ---
8
+
9
+
10
+ ## Prerequisites
11
+
12
+ 1. **Create Entrig Account** - Sign up at [entrig.com](https://entrig.com)
13
+
14
+ 2. **Connect Supabase** - Authorize Entrig to access your Supabase project
15
+
16
+ <details>
17
+ <summary>How it works (click to expand)</summary>
18
+
19
+ During onboarding, you'll:
20
+ 1. Click the "Connect Supabase" button
21
+ 2. Sign in to your Supabase account (if not already signed in)
22
+ 3. Authorize Entrig to access your project
23
+ 4. Select which project to use (if you have multiple)
24
+
25
+ That's it! Entrig will automatically set up everything needed to send notifications. No manual SQL or configuration required.
26
+
27
+ </details>
28
+
29
+ 3. **Upload FCM Service Account** (Android) - Upload Service Account JSON and provide your Application ID
30
+
31
+ <details>
32
+ <summary>How to get FCM Service Account JSON (click to expand)</summary>
33
+
34
+ 1. Create a Firebase project at [console.firebase.google.com](https://console.firebase.google.com)
35
+ 2. Add your Android app to the project
36
+ 3. Go to Project Settings → Service Accounts
37
+ 4. Click "Firebase Admin SDK"
38
+ 5. Click "Generate new private key"
39
+ 6. Download the JSON file
40
+ 7. Upload this file to the Entrig dashboard
41
+
42
+ </details>
43
+
44
+ <details>
45
+ <summary>What is Application ID? (click to expand)</summary>
46
+
47
+ The Application ID is your Android app's package name (e.g., `com.example.myapp`). You can find it in:
48
+ - Your `android/app/build.gradle` file under `applicationId`
49
+ - Or in your `AndroidManifest.xml` under the `package` attribute
50
+
51
+ </details>
52
+
53
+ > **Note:** If you've configured iOS in your Firebase console, you can use FCM for both Android and iOS, which will skip the APNs setup step.
54
+
55
+ 4. **Upload APNs Key** (iOS) - Upload `.p8` key file with Team ID, Bundle ID, and Key ID to Entrig
56
+
57
+ <details>
58
+ <summary>How to get APNs Authentication Key (click to expand)</summary>
59
+
60
+ 1. Enroll in [Apple Developer Program](https://developer.apple.com/programs/)
61
+ 2. Go to [Certificates, Identifiers & Profiles](https://developer.apple.com/account/resources)
62
+ 3. Navigate to Keys → Click "+" to create a new key
63
+ 4. Enter a key name and enable "Apple Push Notifications service (APNs)"
64
+ 5. Click "Continue" then "Register"
65
+ 6. Download the `.p8` key file (you can only download this once!)
66
+ 7. Note your **Key ID** (shown on the confirmation page - 10 alphanumeric characters)
67
+ 8. Note your **Team ID** (found in Membership section of your Apple Developer account - 10 alphanumeric characters)
68
+ 9. Note your **Bundle ID** (found in your Xcode project settings or `Info.plist` - reverse domain format like `com.example.app`)
69
+ 10. Upload the `.p8` file along with Team ID, Bundle ID, and Key ID to the Entrig dashboard
70
+
71
+ </details>
72
+
73
+ <details>
74
+ <summary>Production vs Sandbox environments (click to expand)</summary>
75
+
76
+ Entrig supports configuring both APNs environments:
77
+ - **Production**: For App Store releases and TestFlight builds
78
+ - **Sandbox**: For development builds via Xcode
79
+
80
+ You can configure one or both environments during onboarding. Developers typically need Sandbox for testing and Production for live releases. You can use the same APNs key for both environments, but you'll need to provide the configuration separately for each.
81
+
82
+ </details>
83
+
84
+ ---
85
+
86
+ ## Installation
87
+
88
+ ```bash
89
+ npm install @entrig/react-native
90
+ ```
91
+
92
+ or
93
+
94
+ ```bash
95
+ yarn add @entrig/react-native
96
+ ```
97
+
98
+ ---
99
+
100
+ ## Platform Setup
101
+
102
+ ### Android
103
+
104
+ No setup required for Android. We'll take care of it.
105
+
106
+ ### iOS
107
+
108
+ #### Expo (Managed Workflow)
109
+
110
+ Add the plugin to your `app.json`:
111
+
112
+ ```json
113
+ {
114
+ "expo": {
115
+ "plugins": ["@entrig/react-native"]
116
+ }
117
+ }
118
+ ```
119
+
120
+ Then run prebuild:
121
+
122
+ ```bash
123
+ npx expo prebuild
124
+ ```
125
+
126
+ This automatically configures:
127
+ - AppDelegate with Entrig notification handlers
128
+ - Entitlements with push notification capabilities
129
+ - Info.plist with background modes
130
+
131
+ #### Bare React Native — Automatic Setup (Recommended)
132
+
133
+ Run this command in your project root:
134
+
135
+ ```bash
136
+ npx @entrig/react-native setup ios
137
+ ```
138
+
139
+ This automatically configures:
140
+ - AppDelegate.swift with Entrig notification handlers
141
+ - Entitlements with push notification capabilities (creates the file if it doesn't exist)
142
+ - Info.plist with background modes
143
+ - project.pbxproj with CODE_SIGN_ENTITLEMENTS reference
144
+
145
+ > **Note:** The command creates `.backup` files for safety. You can delete them after verifying everything works.
146
+
147
+ <details>
148
+ <summary>Manual AppDelegate setup (click to expand)</summary>
149
+
150
+ #### 1. Enable Push Notifications in Xcode
151
+
152
+ - Open `ios/YourApp.xcworkspace`
153
+ - Select your target → Signing & Capabilities
154
+ - Click `+ Capability` → Push Notifications
155
+ - Click `+ Capability` → Background Modes → Enable `Remote notifications`
156
+
157
+ #### 2. Update AppDelegate.swift
158
+
159
+ Add `import UserNotifications` and `import EntrigSDK`, add `UNUserNotificationCenterDelegate` conformance, then add the notification methods.
160
+
161
+ **RN 0.74+ (new style — `UIResponder, UIApplicationDelegate`)**
162
+
163
+ ```swift
164
+ import UIKit
165
+ import React
166
+ import React_RCTAppDelegate
167
+ import ReactAppDependencyProvider
168
+ import UserNotifications
169
+ import EntrigSDK
170
+
171
+ @main
172
+ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterDelegate {
173
+ var window: UIWindow?
174
+ var reactNativeDelegate: ReactNativeDelegate?
175
+ var reactNativeFactory: RCTReactNativeFactory?
176
+
177
+ func application(
178
+ _ application: UIApplication,
179
+ didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? = nil
180
+ ) -> Bool {
181
+ UNUserNotificationCenter.current().delegate = self
182
+ Entrig.checkLaunchNotification(launchOptions)
183
+
184
+ let delegate = ReactNativeDelegate()
185
+ let factory = RCTReactNativeFactory(delegate: delegate)
186
+ delegate.dependencyProvider = RCTAppDependencyProvider()
187
+ reactNativeDelegate = delegate
188
+ reactNativeFactory = factory
189
+ window = UIWindow(frame: UIScreen.main.bounds)
190
+ factory.startReactNative(withModuleName: "YourApp", in: window, launchOptions: launchOptions)
191
+ return true
192
+ }
193
+
194
+ func application(_ application: UIApplication,
195
+ didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {
196
+ Entrig.didRegisterForRemoteNotifications(deviceToken: deviceToken)
197
+ }
198
+
199
+ func application(_ application: UIApplication,
200
+ didFailToRegisterForRemoteNotificationsWithError error: Error) {
201
+ Entrig.didFailToRegisterForRemoteNotifications(error: error)
202
+ }
203
+
204
+ func userNotificationCenter(_ center: UNUserNotificationCenter,
205
+ willPresent notification: UNNotification,
206
+ withCompletionHandler completionHandler: @escaping (UNNotificationPresentationOptions) -> Void) {
207
+ Entrig.willPresentNotification(notification)
208
+ completionHandler(Entrig.getPresentationOptions())
209
+ }
210
+
211
+ func userNotificationCenter(_ center: UNUserNotificationCenter,
212
+ didReceive response: UNNotificationResponse,
213
+ withCompletionHandler completionHandler: @escaping () -> Void) {
214
+ Entrig.didReceiveNotification(response)
215
+ completionHandler()
216
+ }
217
+ }
218
+ ```
219
+
220
+ > Replace `"YourApp"` with your actual module name.
221
+
222
+ **RN 0.71–0.73 (old style — `RCTAppDelegate`)**
223
+
224
+ ```swift
225
+ import UIKit
226
+ import UserNotifications
227
+ import EntrigSDK
228
+
229
+ @main
230
+ class AppDelegate: RCTAppDelegate, UNUserNotificationCenterDelegate {
231
+ override func application(
232
+ _ application: UIApplication,
233
+ didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? = nil
234
+ ) -> Bool {
235
+ UNUserNotificationCenter.current().delegate = self
236
+ Entrig.checkLaunchNotification(launchOptions)
237
+ return super.application(application, didFinishLaunchingWithOptions: launchOptions)
238
+ }
239
+
240
+ override func application(_ application: UIApplication,
241
+ didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {
242
+ Entrig.didRegisterForRemoteNotifications(deviceToken: deviceToken)
243
+ super.application(application, didRegisterForRemoteNotificationsWithDeviceToken: deviceToken)
244
+ }
245
+
246
+ override func application(_ application: UIApplication,
247
+ didFailToRegisterForRemoteNotificationsWithError error: Error) {
248
+ Entrig.didFailToRegisterForRemoteNotifications(error: error)
249
+ super.application(application, didFailToRegisterForRemoteNotificationsWithError: error)
250
+ }
251
+
252
+ func userNotificationCenter(_ center: UNUserNotificationCenter,
253
+ willPresent notification: UNNotification,
254
+ withCompletionHandler completionHandler: @escaping (UNNotificationPresentationOptions) -> Void) {
255
+ Entrig.willPresentNotification(notification)
256
+ completionHandler(Entrig.getPresentationOptions())
257
+ }
258
+
259
+ func userNotificationCenter(_ center: UNUserNotificationCenter,
260
+ didReceive response: UNNotificationResponse,
261
+ withCompletionHandler completionHandler: @escaping () -> Void) {
262
+ Entrig.didReceiveNotification(response)
263
+ completionHandler()
264
+ }
265
+ }
266
+ ```
267
+
268
+ </details>
269
+
270
+ ---
271
+
272
+ ## Troubleshooting
273
+
274
+ <details>
275
+ <summary>Native Entrig module not found (iOS)</summary>
276
+
277
+ This means the `EntrigReactNative` pod was not installed. Run:
278
+
279
+ ```bash
280
+ cd ios && pod install
281
+ ```
282
+
283
+ Then rebuild the app. If the error persists, verify `EntrigReactNative` appears in `ios/Podfile.lock`:
284
+
285
+ ```bash
286
+ grep "EntrigReactNative" ios/Podfile.lock
287
+ ```
288
+
289
+ If it's missing, make sure you are on `@entrig/react-native` version that includes the root-level `EntrigReactNative.podspec` and re-run `pod install`.
290
+
291
+ </details>
292
+
293
+ <details>
294
+ <summary>Push token not generated (iOS)</summary>
295
+
296
+ The device token won't be generated if the AppDelegate is not configured. Run the setup command:
297
+
298
+ ```bash
299
+ npx @entrig/react-native setup ios
300
+ ```
301
+
302
+ Then rebuild. Also ensure:
303
+ - Push Notifications capability is added in Xcode (Target → Signing & Capabilities)
304
+ - You are testing on a **real device** (simulators cannot receive push notifications)
305
+ - The APNs key is uploaded to your Entrig dashboard
306
+
307
+ </details>
308
+
309
+ <details>
310
+ <summary>Cannot read Config / env variables undefined</summary>
311
+
312
+ `react-native-config` requires native setup on both platforms. The simplest alternative is [`react-native-dotenv`](https://github.com/goatandsheep/react-native-dotenv) (a Babel plugin — no native setup needed):
313
+
314
+ ```bash
315
+ npm install react-native-dotenv
316
+ ```
317
+
318
+ Add to `babel.config.js`:
319
+ ```js
320
+ module.exports = {
321
+ plugins: [['module:react-native-dotenv']]
322
+ };
323
+ ```
324
+
325
+ Then import:
326
+ ```ts
327
+ import { ENTRIG_API_KEY } from '@env';
328
+ ```
329
+
330
+ </details>
331
+
332
+ <details>
333
+ <summary>pod install CocoaPods dependency errors</summary>
334
+
335
+ Try cleaning and reinstalling:
336
+
337
+ ```bash
338
+ cd ios
339
+ rm Podfile.lock
340
+ rm -rf Pods
341
+ pod deintegrate
342
+ pod repo update
343
+ pod install
344
+ ```
345
+
346
+ </details>
347
+
348
+
349
+ ---
350
+
351
+ ## Usage
352
+
353
+ ### Initialize
354
+
355
+ ```typescript
356
+ import Entrig from '@entrig/react-native';
357
+
358
+ // Initialize Entrig (call once at app startup)
359
+ await Entrig.init({ apiKey: 'YOUR_ENTRIG_API_KEY' });
360
+ ```
361
+
362
+ <details>
363
+ <summary>How to get your Entrig API key (click to expand)</summary>
364
+
365
+ 1. Sign in to your Entrig account at [entrig.com](https://entrig.com)
366
+ 2. Go to your dashboard
367
+ 3. Navigate to your project settings
368
+ 4. Copy your **API Key** from the project settings page
369
+ 5. Use this API key in the `Entrig.init()` call above
370
+
371
+ </details>
372
+
373
+ ### Register/Unregister Devices
374
+
375
+ <details>
376
+ <summary>Automatic registration with Supabase Auth (Recommended - click to expand)</summary>
377
+
378
+ Listen to Supabase auth state changes and automatically register/unregister devices:
379
+
380
+ ```typescript
381
+ import { useEffect } from 'react';
382
+ import Entrig from '@entrig/react-native';
383
+ import { supabase } from './supabase'; // your Supabase client
384
+
385
+ function App() {
386
+ useEffect(() => {
387
+ const { data: { subscription } } = supabase.auth.onAuthStateChange(
388
+ async (event, session) => {
389
+ if (session?.user) {
390
+ // User signed in - register device
391
+ await Entrig.register(session.user.id);
392
+ } else {
393
+ // User signed out - unregister device
394
+ await Entrig.unregister();
395
+ }
396
+ }
397
+ );
398
+
399
+ return () => subscription.unsubscribe();
400
+ }, []);
401
+
402
+ return <YourApp />;
403
+ }
404
+ ```
405
+
406
+ > **Important:** Devices are registered with the **Supabase Auth user ID** (`auth.users.id`). When creating notifications, make sure the user identifier field you select contains this same Supabase Auth user ID to ensure notifications are delivered to the correct users.
407
+
408
+ </details>
409
+
410
+ <details>
411
+ <summary>Manual registration (click to expand)</summary>
412
+
413
+ **Register device:**
414
+ ```typescript
415
+ const { data: { user } } = await supabase.auth.getUser();
416
+ if (user) {
417
+ await Entrig.register(user.id);
418
+ }
419
+ ```
420
+
421
+ **Unregister device:**
422
+ ```typescript
423
+ await Entrig.unregister();
424
+ ```
425
+
426
+ > **Note:** `register()` automatically handles permission requests. The `userId` you pass here must match the user identifier field you select when creating notifications.
427
+
428
+ </details>
429
+
430
+ <details>
431
+ <summary>Custom permission handling (click to expand)</summary>
432
+
433
+ If you want to handle notification permissions yourself, disable automatic permission handling:
434
+
435
+ ```typescript
436
+ await Entrig.init({
437
+ apiKey: 'YOUR_ENTRIG_API_KEY',
438
+ handlePermission: false,
439
+ });
440
+ ```
441
+
442
+ Then request permissions manually before registering:
443
+
444
+ ```typescript
445
+ const granted = await Entrig.requestPermission();
446
+ ```
447
+
448
+ </details>
449
+
450
+ ### Listen to Notifications
451
+
452
+ **Using the `useEntrigEvent` hook** (Recommended):
453
+
454
+ ```typescript
455
+ import { useEntrigEvent } from '@entrig/react-native';
456
+
457
+ function MyComponent() {
458
+ // Foreground notifications (when app is open)
459
+ useEntrigEvent('foreground', (event) => {
460
+ console.log('Notification received:', event.title, event.body);
461
+ });
462
+
463
+ // Notification tap (when user taps a notification)
464
+ useEntrigEvent('opened', (event) => {
465
+ // Navigate to specific screen based on event.data
466
+ console.log('Notification opened:', event.data);
467
+ });
468
+
469
+ return <YourComponent />;
470
+ }
471
+ ```
472
+
473
+ **Using event listeners directly:**
474
+
475
+ ```typescript
476
+ import Entrig from '@entrig/react-native';
477
+
478
+ // Foreground notifications
479
+ const subscription = Entrig.onForegroundNotification((event) => {
480
+ console.log('Foreground:', event.title, event.body);
481
+ });
482
+
483
+ // Notification tap
484
+ const subscription2 = Entrig.onNotificationOpened((event) => {
485
+ console.log('Opened:', event.data);
486
+ });
487
+
488
+ // Clean up when done
489
+ subscription.remove();
490
+ subscription2.remove();
491
+ ```
492
+
493
+ **Get the notification that launched the app** (cold start):
494
+
495
+ ```typescript
496
+ const notification = await Entrig.getInitialNotification();
497
+ if (notification) {
498
+ // App was launched from a notification tap
499
+ console.log('Launched from notification:', notification.data);
500
+ }
501
+ ```
502
+
503
+ **NotificationEvent** contains:
504
+ - `title` - Notification title
505
+ - `body` - Notification body text
506
+ - `data` - Custom payload data from your database
507
+ - `isForeground` - Whether the notification was received in the foreground
508
+
509
+ ---
510
+
511
+ ## Creating Notifications
512
+
513
+ <details>
514
+ <summary>Learn how to create notification triggers in the dashboard (click to expand)</summary>
515
+
516
+ Create notification triggers in the Entrig dashboard. The notification creation form has two sections: configuring the trigger and composing the notification message.
517
+
518
+ ### Section 1: Configure Trigger
519
+
520
+ Set up when and to whom notifications should be sent.
521
+
522
+ #### 1. Select Table
523
+ Choose the database table where events will trigger notifications (e.g., `messages`, `orders`). This is the "trigger table" that activates the notification.
524
+
525
+ #### 2. Select Event
526
+ Choose which database operation triggers the notification:
527
+ - **INSERT** - When new rows are created
528
+ - **UPDATE** - When existing rows are modified
529
+ - **DELETE** - When rows are deleted
530
+
531
+ #### 3. Select User Identifier
532
+ Specify how to identify notification recipients. Toggle "Use join table" to switch between modes.
533
+
534
+ > **Important:** The user identifier field you select here must contain the same user ID that was used when registering the device. This should be the Supabase Auth user ID (`auth.users.id`).
535
+
536
+ **Single User Mode** (Default):
537
+ - Select a field that contains the user ID directly
538
+ - Supports foreign key navigation (e.g., navigate through `orders.customer_id` to reach `customers.user_id`)
539
+ - Example: For a `messages` table with `user_id` field, select `user_id`
540
+
541
+ **Multi-User Mode** (Join Table):
542
+ - Use when one database event should notify multiple users
543
+ - Requires configuring the relationship between tables:
544
+
545
+ **Event Table Section:**
546
+ - **Lookup Field**: Select a foreign key field that links to your join table
547
+ - Example: For notifying all room members when a message is sent, select `room_id` from the `messages` table
548
+
549
+ **Join Table Section:**
550
+ - **Join Table**: Select the table containing recipient records
551
+ - Example: `room_members` table that links rooms to users
552
+ - **Matching Field**: Field in the join table that matches your lookup field
553
+ - Usually auto-populated to match the lookup field name
554
+ - **User ID Field**: Field containing the actual user identifiers
555
+ - Supports foreign key navigation
556
+ - Should contain the same user ID used during device registration
557
+
558
+ #### 4. Event Conditions (Optional)
559
+ Filter when notifications are sent based on the trigger event data:
560
+ - Add conditions to control notification sending (e.g., only when `status = 'completed'`)
561
+ - Supports multiple conditions with AND/OR logic
562
+
563
+ #### 5. Recipient Filters (Optional, Multi-User only)
564
+ Filter which users receive the notification based on join table data:
565
+ - Example: Only notify users where `role = 'admin'` in the join table
566
+
567
+ ### Section 2: Compose Notification
568
+
569
+ Design the notification content that users will see.
570
+
571
+ #### 1. Payload Data (Optional)
572
+ Select database fields to use as dynamic placeholders:
573
+ - Click "Add Fields" to open the field selector
574
+ - Selected fields appear as clickable pills (e.g., `{{messages.content}}`)
575
+ - Click any pill to insert it at your cursor position in title or body
576
+
577
+ #### 2. Title & Body
578
+ Write your notification text using placeholders:
579
+ - Use double-brace format: `{{table.column}}`
580
+ - Example Title: `New message from {{users.name}}`
581
+ - Example Body: `{{messages.content}}`
582
+ - Placeholders are replaced with actual data when notifications are sent
583
+
584
+ ### Example Use Cases
585
+
586
+ **Single User Notification:**
587
+ - **Table**: `orders`, **Event**: `INSERT`
588
+ - **User ID**: `customer_id`
589
+ - **Title**: `Order Confirmed!`
590
+ - **Body**: `Your order #{{orders.id}} has been received`
591
+
592
+ **Multi-User Notification (Group Chat):**
593
+ - **Table**: `messages`, **Event**: `INSERT`
594
+ - **Lookup Field**: `room_id`
595
+ - **Join Table**: `room_members`
596
+ - **Matching Field in Join Table**: `room_id`
597
+ - **User ID**: `user_id`
598
+ - **Title**: `New message in {{rooms.name}}`
599
+ - **Body**: `{{users.name}}: {{messages.content}}`
600
+
601
+ </details>
602
+
603
+ ---
604
+
605
+ ## Support
606
+
607
+ - Email: team@entrig.com
608
+
609
+ ---
@@ -0,0 +1,47 @@
1
+ apply plugin: 'com.android.library'
2
+ apply plugin: 'kotlin-android'
3
+
4
+ android {
5
+ compileSdkVersion 36
6
+
7
+ defaultConfig {
8
+ minSdkVersion 24
9
+ targetSdkVersion 36
10
+ versionCode 1
11
+ versionName "0.0.1"
12
+ }
13
+
14
+ buildTypes {
15
+ release {
16
+ minifyEnabled false
17
+ }
18
+ }
19
+
20
+ compileOptions {
21
+ sourceCompatibility JavaVersion.VERSION_17
22
+ targetCompatibility JavaVersion.VERSION_17
23
+ }
24
+
25
+ kotlinOptions {
26
+ jvmTarget = '17'
27
+ }
28
+
29
+ lintOptions {
30
+ abortOnError false
31
+ }
32
+
33
+ namespace "com.entrig.reactnative"
34
+ }
35
+
36
+ dependencies {
37
+ // React Native
38
+ implementation "com.facebook.react:react-native:+"
39
+
40
+ // Entrig SDK from Maven Central
41
+ api 'com.entrig:entrig:0.0.10-dev'
42
+
43
+ // AndroidX
44
+ implementation "androidx.core:core:1.8.0"
45
+ implementation "androidx.appcompat:appcompat:1.4.2"
46
+ implementation "androidx.activity:activity-ktx:1.4.0"
47
+ }