Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ dependencies {
implementation 'com.google.code.gson:gson:2.11.0'

// Courier Core SDK
api 'com.github.trycourier:courier-android:6.0.1'
api 'com.github.trycourier:courier-android:6.1.0'
api 'androidx.recyclerview:recyclerview:1.3.2'

// Firebase Messaging (needed to resolve RemoteMessage from Courier SDK APIs)
Expand Down
2 changes: 1 addition & 1 deletion android/src/main/java/com/courierreactnative/Utils.kt
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import com.facebook.react.modules.core.DeviceEventManagerModule
import com.google.gson.GsonBuilder

internal object Utils {
val COURIER_AGENT = CourierAgent.ReactNativeAndroid(version = "6.0.1")
val COURIER_AGENT = CourierAgent.ReactNativeAndroid(version = "6.0.2")
}

internal fun ReactContext.sendEvent(eventName: String, value: Any?) {
Expand Down
2 changes: 1 addition & 1 deletion example-085/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ android {
applicationId "com.courierreactnativeexample.app"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 43
versionCode 44
versionName "1.0"
}
signingConfigs {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,57 +20,50 @@ import com.google.firebase.messaging.RemoteMessage
// Courier React Native SDK — https://www.courier.com/docs/sdk-libraries/react-native/
// Courier Android SDK — https://www.courier.com/docs/sdk-libraries/android
// Android notifications — https://developer.android.com/develop/ui/views/notifications/build-notification
//
// Requires Firebase Messaging dependency in your app/build.gradle:
// implementation(platform("com.google.firebase:firebase-bom:<version>"))
// implementation("com.google.firebase:firebase-messaging")
class ExampleService : FirebaseMessagingService() {
class ExampleService: FirebaseMessagingService() {

override fun onMessageReceived(message: RemoteMessage) {
super.onMessageReceived(message)

// --- Demo notification code (replace with your own for production) -----------
//
// CourierPushNotificationIntent is a convenience wrapper that bundles the
// RemoteMessage into a PendingIntent. When the user taps the notification,
// Courier can fire onPushNotificationClicked and track a CLICKED event.
// In your own app you can build the PendingIntent yourself and call
// Courier.shared.client.tracking.postTrackingUrl(...) on tap instead.
val notificationIntent = CourierPushNotificationIntent(
context = this,
target = MainActivity::class.java,
payload = message
)

override fun onMessageReceived(message: RemoteMessage) {
super.onMessageReceived(message)
// presentNotification is a Courier helper that posts a basic notification
// via NotificationManagerCompat. It is fine for testing but not customizable
// enough for production — use NotificationCompat.Builder directly:
// https://developer.android.com/develop/ui/views/notifications/build-notification
notificationIntent.presentNotification(
title = message.data["title"] ?: message.notification?.title,
body = message.data["body"] ?: message.notification?.body,
)

// Required — Tells the Courier SDK a push was delivered.
// Behind the scenes this posts the trackingUrl from the FCM data payload
// as a DELIVERED event so delivery analytics appear in the Courier dashboard,
// and fires any onPushDelivered listeners registered from the JS layer.
Courier.onMessageReceived(message.data)
// Required — Tells the Courier SDK a push was delivered.
// Behind the scenes this posts the trackingUrl from the FCM data payload
// as a DELIVERED event so delivery analytics appear in the Courier dashboard,
// and fires any onPushDelivered listeners registered from the JS layer.
Courier.onMessageReceived(message.data)

// --- Demo notification code (replace with your own for production) -----------
//
// CourierPushNotificationIntent is a convenience wrapper that bundles the
// RemoteMessage into a PendingIntent. When the user taps the notification,
// Courier can fire onPushNotificationClicked and track a CLICKED event.
// In your own app you can build the PendingIntent yourself and call
// Courier.shared.client.tracking.postTrackingUrl(...) on tap instead.
val notificationIntent = CourierPushNotificationIntent(
this,
0,
MainActivity::class.java,
message
)
}

// presentNotification is a Courier helper that posts a basic notification
// via NotificationManagerCompat. It is fine for testing but not customizable
// enough for production — use NotificationCompat.Builder directly:
// https://developer.android.com/develop/ui/views/notifications/build-notification
val title = message.data["title"] ?: message.notification?.title
val body = message.data["body"] ?: message.notification?.body
override fun onNewToken(token: String) {
super.onNewToken(token)

notificationIntent.presentNotification(
title,
body,
android.R.drawable.ic_dialog_info,
"Notification Service"
)
}
// Required — Syncs this device's FCM token with Courier.
// Behind the scenes the SDK caches the token locally and uploads it to
// Courier linked to the currently signed-in user. If no user is signed in
// yet the token is held locally and synced on the next signIn() call.
Courier.onNewToken(token)

override fun onNewToken(token: String) {
super.onNewToken(token)
}

// Required — Syncs this device's FCM token with Courier.
// Behind the scenes the SDK caches the token locally and uploads it to
// Courier linked to the currently signed-in user. If no user is signed in
// yet the token is held locally and synced on the next signIn() call.
Courier.onNewToken(token)
}
}
2 changes: 1 addition & 1 deletion ios/CourierReactNativeDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ - (id)init {
if (self) {

// Set the user agent
Courier.agent = [CourierAgent reactNativeIOS:@"6.0.1"];
Courier.agent = [CourierAgent reactNativeIOS:@"6.0.2"];

// Register for remote notifications
UIApplication *app = [UIApplication sharedApplication];
Expand Down
2 changes: 1 addition & 1 deletion ios/CourierReactNativeEventEmitter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ internal class CourierReactNativeEventEmitter: RCTEventEmitter {

// Set the user agent
// Used to know the platform performing requests
Courier.agent = CourierAgent.reactNativeIOS("6.0.1")
Courier.agent = CourierAgent.reactNativeIOS("6.0.2")

}

Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@trycourier/courier-react-native",
"version": "6.0.1",
"version": "6.0.2",
"description": "Inbox, Push Notifications, and Preferences for React Native",
"main": "lib/commonjs/index",
"module": "lib/module/index",
Expand Down
Loading