@bubblsdk/react-native-sdk 3.0.0
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.
- package/BubblReactNativeSdk.podspec +17 -0
- package/CHANGELOG.md +7 -0
- package/LICENSE +1 -0
- package/README.md +97 -0
- package/android/build.gradle +46 -0
- package/android/src/main/AndroidManifest.xml +1 -0
- package/android/src/main/kotlin/tech/bubbl/reactnative/BubblSdkModule.kt +643 -0
- package/android/src/main/kotlin/tech/bubbl/reactnative/BubblSdkNotificationIntents.kt +32 -0
- package/android/src/main/kotlin/tech/bubbl/reactnative/BubblSdkPackage.kt +14 -0
- package/ios/BubblSdk.swift +677 -0
- package/ios/BubblSdkBridge.m +83 -0
- package/package.json +48 -0
- package/react-native.config.js +11 -0
- package/src/index.ts +292 -0
- package/src/specs/NativeBubblSdk.ts +52 -0
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
Pod::Spec.new do |s|
|
|
2
|
+
s.name = 'BubblReactNativeSdk'
|
|
3
|
+
s.version = '3.0.0'
|
|
4
|
+
s.summary = 'React Native wrapper for Bubbl SDK v3 native Android and iOS cores.'
|
|
5
|
+
s.homepage = 'https://bubbl.tech'
|
|
6
|
+
s.license = { :type => 'Commercial', :text => 'Copyright Bubbl. All rights reserved.' }
|
|
7
|
+
s.author = { 'Bubbl' => 'engineering@bubbl.tech' }
|
|
8
|
+
s.source = { :git => 'https://devops.bubbl.tech/bubbl/renewed-sdk.git', :tag => s.version.to_s }
|
|
9
|
+
|
|
10
|
+
s.platform = :ios, '15.0'
|
|
11
|
+
s.swift_version = '5.9'
|
|
12
|
+
s.source_files = 'ios/**/*.{h,m,mm,swift}'
|
|
13
|
+
s.static_framework = true
|
|
14
|
+
|
|
15
|
+
s.dependency 'React-Core'
|
|
16
|
+
s.dependency 'BubblSDK', '3.0.0'
|
|
17
|
+
end
|
package/CHANGELOG.md
ADDED
package/LICENSE
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Copyright Bubbl. All rights reserved.
|
package/README.md
ADDED
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
# Bubbl React Native SDK
|
|
2
|
+
|
|
3
|
+
React Native wrapper for Bubbl SDK v3.
|
|
4
|
+
|
|
5
|
+
The JavaScript facade forwards calls to the native Android and iOS SDK cores. Native runtime behavior, durable ingest queues, geofence transitions, notification triggering, Firebase/APNs payload handling, and diagnostics are owned by the platform SDKs.
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install @bubblsdk/react-native-sdk
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Boot
|
|
14
|
+
|
|
15
|
+
```ts
|
|
16
|
+
import { Bubbl } from '@bubblsdk/react-native-sdk';
|
|
17
|
+
|
|
18
|
+
await Bubbl.boot({ apiKey: '...' });
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
For apps that render their own in-app notification modal while still letting
|
|
22
|
+
the native SDK trigger device notifications:
|
|
23
|
+
|
|
24
|
+
```ts
|
|
25
|
+
await Bubbl.boot({
|
|
26
|
+
apiKey: '...',
|
|
27
|
+
notificationRenderingMode: 'sdkDefault',
|
|
28
|
+
enableDefaultNotificationModal: false,
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
// Or toggle it after boot.
|
|
32
|
+
await Bubbl.disableDefaultNotificationModal();
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
Apps with their own notification inbox/history can still ask the SDK to show
|
|
36
|
+
the bundled detail UI for a stored payload:
|
|
37
|
+
|
|
38
|
+
```ts
|
|
39
|
+
await Bubbl.openNotificationModal(payload);
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
This opens the default modal/detail UI without posting another device
|
|
43
|
+
notification.
|
|
44
|
+
|
|
45
|
+
## Android Notification Taps
|
|
46
|
+
|
|
47
|
+
Firebase auto-rendered notifications launch the app's `MainActivity` with the
|
|
48
|
+
notification payload as intent extras. Forward those launcher intents into the
|
|
49
|
+
SDK so notification taps open the app and route to the right modal.
|
|
50
|
+
|
|
51
|
+
Use `openDefaultModal(...)` when the SDK should show the bundled modal:
|
|
52
|
+
|
|
53
|
+
```kotlin
|
|
54
|
+
import android.content.Intent
|
|
55
|
+
import android.os.Bundle
|
|
56
|
+
import com.facebook.react.ReactActivity
|
|
57
|
+
import tech.bubbl.reactnative.BubblSdkNotificationIntents
|
|
58
|
+
|
|
59
|
+
class MainActivity : ReactActivity() {
|
|
60
|
+
override fun onCreate(savedInstanceState: Bundle?) {
|
|
61
|
+
super.onCreate(savedInstanceState)
|
|
62
|
+
BubblSdkNotificationIntents.openDefaultModal(this, intent)
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
override fun onNewIntent(intent: Intent) {
|
|
66
|
+
super.onNewIntent(intent)
|
|
67
|
+
setIntent(intent)
|
|
68
|
+
BubblSdkNotificationIntents.openDefaultModal(this, intent)
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
Use `openHostModal(...)` when the app renders its own modal. The SDK records
|
|
74
|
+
the tap, keeps the payload pending across cold start, and emits
|
|
75
|
+
`notificationTapped` once the React Native bridge subscribes:
|
|
76
|
+
|
|
77
|
+
```kotlin
|
|
78
|
+
BubblSdkNotificationIntents.openHostModal(this, intent)
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
## Events
|
|
82
|
+
|
|
83
|
+
```ts
|
|
84
|
+
const subscription = Bubbl.events.addListener((event) => {
|
|
85
|
+
if (event.type === 'notificationReceived') {
|
|
86
|
+
// Host apps can inspect or custom-render notification payloads here.
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
subscription.remove();
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
## Notes
|
|
94
|
+
|
|
95
|
+
- Android depends on `tech.bubbl.sdk:bubbl-sdk` and requires `minSdkVersion 27` or higher.
|
|
96
|
+
- iOS depends on the `BubblSDK` CocoaPods/Swift package release and requires iOS 15 or higher.
|
|
97
|
+
- Host apps still need the usual platform permissions for push notifications and location tracking.
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
plugins {
|
|
2
|
+
id "com.android.library"
|
|
3
|
+
id "org.jetbrains.kotlin.android"
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
group = "tech.bubbl.reactnative"
|
|
7
|
+
version = "3.0.0"
|
|
8
|
+
|
|
9
|
+
def isNewArchitectureEnabled() {
|
|
10
|
+
project.hasProperty("newArchEnabled") && project.newArchEnabled == "true"
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
if (isNewArchitectureEnabled()) {
|
|
14
|
+
apply plugin: "com.facebook.react"
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
def safeExtGet(prop, fallback) {
|
|
18
|
+
rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
def reactNativeVersion = safeExtGet("reactNativeVersion", "0.76.9")
|
|
22
|
+
|
|
23
|
+
android {
|
|
24
|
+
namespace = "tech.bubbl.reactnative"
|
|
25
|
+
compileSdk = safeExtGet("compileSdkVersion", 35)
|
|
26
|
+
|
|
27
|
+
defaultConfig {
|
|
28
|
+
minSdk = safeExtGet("minSdkVersion", 27)
|
|
29
|
+
buildConfigField "boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled().toString()
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
compileOptions {
|
|
33
|
+
sourceCompatibility = JavaVersion.VERSION_17
|
|
34
|
+
targetCompatibility = JavaVersion.VERSION_17
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
kotlinOptions {
|
|
38
|
+
jvmTarget = "17"
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
dependencies {
|
|
43
|
+
implementation "com.facebook.react:react-android:${reactNativeVersion}"
|
|
44
|
+
implementation "tech.bubbl.sdk:bubbl-sdk:3.0.0"
|
|
45
|
+
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.8.1"
|
|
46
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<manifest xmlns:android="http://schemas.android.com/apk/res/android" />
|