diff --git a/Docs/3_PushNotifications.md b/Docs/3_PushNotifications.md index 15e019f..23876e6 100644 --- a/Docs/3_PushNotifications.md +++ b/Docs/3_PushNotifications.md @@ -323,9 +323,6 @@ class YourNotificationService : FirebaseMessagingService() { override fun onMessageReceived(message: RemoteMessage) { super.onMessageReceived(message) - // Notify the Courier SDK that a push was delivered - Courier.onMessageReceived(message.data) - // Create the PendingIntent that runs when the user taps the notification // This intent targets your Activity and carries the original message payload // TODO: Remove this if you'd like. This is mostly useful for demo purposes. @@ -343,7 +340,10 @@ class YourNotificationService : FirebaseMessagingService() { title = message.data["title"] ?: message.notification?.title, body = message.data["body"] ?: message.notification?.body, ) - + + // Notify the Courier SDK that a push was delivered + Courier.onMessageReceived(message.data) + } override fun onNewToken(token: String) { diff --git a/android/build.gradle b/android/build.gradle index 9f8d571..a0dfea4 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -56,7 +56,7 @@ dependencies { implementation 'com.google.code.gson:gson:2.11.0' // Courier Core SDK - api 'com.github.trycourier:courier-android:6.0.0' + api 'com.github.trycourier:courier-android:6.1.0' // Firebase Messaging (needed to resolve RemoteMessage from Courier SDK APIs) compileOnly 'com.google.firebase:firebase-messaging:23.4.1' diff --git a/android/src/main/kotlin/com/courier/courier_flutter/CourierFlutterActivity.kt b/android/src/main/kotlin/com/courier/courier_flutter/CourierFlutterActivity.kt index fac96c5..484dfa3 100644 --- a/android/src/main/kotlin/com/courier/courier_flutter/CourierFlutterActivity.kt +++ b/android/src/main/kotlin/com/courier/courier_flutter/CourierFlutterActivity.kt @@ -20,7 +20,7 @@ open class CourierFlutterActivity : FlutterActivity() { super.onCreate(savedInstanceState) // Setup and run the agent - Courier.agent = CourierAgent.FlutterAndroid(version = "5.0.0") + Courier.agent = CourierAgent.FlutterAndroid(version = "5.0.1") Courier.initialize(context) // Handle system events diff --git a/android/src/main/kotlin/com/courier/courier_flutter/CourierFlutterFragmentActivity.kt b/android/src/main/kotlin/com/courier/courier_flutter/CourierFlutterFragmentActivity.kt index a6b7e87..19eaa53 100644 --- a/android/src/main/kotlin/com/courier/courier_flutter/CourierFlutterFragmentActivity.kt +++ b/android/src/main/kotlin/com/courier/courier_flutter/CourierFlutterFragmentActivity.kt @@ -20,7 +20,7 @@ open class CourierFlutterFragmentActivity : FlutterFragmentActivity() { super.onCreate(savedInstanceState) // Setup and run the agent - Courier.agent = CourierAgent.FlutterAndroid(version = "5.0.0") + Courier.agent = CourierAgent.FlutterAndroid(version = "5.0.1") Courier.initialize(this) // Handle system events diff --git a/android/src/main/kotlin/com/courier/courier_flutter/CourierPlugin.kt b/android/src/main/kotlin/com/courier/courier_flutter/CourierPlugin.kt index 8376a19..9c31fcb 100644 --- a/android/src/main/kotlin/com/courier/courier_flutter/CourierPlugin.kt +++ b/android/src/main/kotlin/com/courier/courier_flutter/CourierPlugin.kt @@ -13,7 +13,7 @@ internal class CourierPlugin : FlutterPlugin { } init { - Courier.agent = CourierAgent.FlutterAndroid(version = "5.0.0") + Courier.agent = CourierAgent.FlutterAndroid(version = "5.0.1") } override fun onAttachedToEngine(flutterPluginBinding: FlutterPlugin.FlutterPluginBinding) { diff --git a/example/android/app/src/main/kotlin/com/courier/courier_flutter/ExampleService.kt b/example/android/app/src/main/kotlin/com/courier/courier_flutter/ExampleService.kt index b91dd5b..e72f21f 100644 --- a/example/android/app/src/main/kotlin/com/courier/courier_flutter/ExampleService.kt +++ b/example/android/app/src/main/kotlin/com/courier/courier_flutter/ExampleService.kt @@ -26,12 +26,6 @@ class ExampleService : FirebaseMessagingService() { override fun onMessageReceived(message: RemoteMessage) { super.onMessageReceived(message) - // 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 Dart layer. - Courier.onMessageReceived(message.data) - // --- Demo notification code (replace with your own for production) ----------- // // CourierPushNotificationIntent is a convenience wrapper that bundles the @@ -54,6 +48,12 @@ class ExampleService : FirebaseMessagingService() { 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 Dart layer. + Courier.onMessageReceived(message.data) + } override fun onNewToken(token: String) { diff --git a/example/pubspec.yaml b/example/pubspec.yaml index 2d84fce..967a732 100644 --- a/example/pubspec.yaml +++ b/example/pubspec.yaml @@ -5,7 +5,7 @@ description: Demonstrates how to use the courier_flutter plugin. # pub.dev using `flutter pub publish`. This is preferred for private packages. publish_to: 'none' # Remove this line if you wish to publish to pub.dev -version: 1.0.0+30 +version: 1.0.0+33 environment: sdk: '>=3.3.0 <4.0.0' diff --git a/ios/Classes/CourierFlutterDelegate.swift b/ios/Classes/CourierFlutterDelegate.swift index 8b08564..8bfd66e 100644 --- a/ios/Classes/CourierFlutterDelegate.swift +++ b/ios/Classes/CourierFlutterDelegate.swift @@ -41,7 +41,7 @@ open class CourierFlutterDelegate: FlutterAppDelegate { super.init() // Set the api agent version - Courier.agent = CourierAgent.flutterIOS("5.0.0") + Courier.agent = CourierAgent.flutterIOS("5.0.1") // Handle notification registration app.registerForRemoteNotifications() diff --git a/ios/Classes/CourierFlutterMethodHandler.swift b/ios/Classes/CourierFlutterMethodHandler.swift index fc6e36a..c8ab8bf 100644 --- a/ios/Classes/CourierFlutterMethodHandler.swift +++ b/ios/Classes/CourierFlutterMethodHandler.swift @@ -14,7 +14,7 @@ public class CourierFlutterMethodHandler: NSObject { // Set the flutter ios user agent // This ensures all the requests are tagged with this agent - Courier.agent = CourierAgent.flutterIOS("5.0.0") + Courier.agent = CourierAgent.flutterIOS("5.0.1") } diff --git a/pubspec.yaml b/pubspec.yaml index e518cc2..94c1e25 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: courier_flutter description: Inbox, Push Notifications and Preferences for Flutter -version: 5.0.0 +version: 5.0.1 homepage: https://courier.com environment: