diff --git a/android/src/main/java/io/ably/flutter/plugin/BackgroundMethodCallHandler.java b/android/src/main/java/io/ably/flutter/plugin/BackgroundMethodCallHandler.java index 92848a0c5..d364de09a 100644 --- a/android/src/main/java/io/ably/flutter/plugin/BackgroundMethodCallHandler.java +++ b/android/src/main/java/io/ably/flutter/plugin/BackgroundMethodCallHandler.java @@ -1,6 +1,6 @@ package io.ably.flutter.plugin; -import static io.ably.flutter.plugin.generated.PlatformConstants.PlatformMethod.pushSetOnBackgroundMessage; +import static io.ably.flutter.plugin.generated.PlatformConstants.PlatformMethod.pushBackgroundFlutterApplicationReadyOnAndroid; import android.util.Log; @@ -15,7 +15,7 @@ * Receives method calls on the background method channel from the Dart side's * BackgroundIsolateAndroidPlatform to avoid exceptions being thrown in the case * where an Isolate doesn't need to be manually launched (App is already running), - * so `pushSetOnBackgroundMessage` platform method call doesn't need to be called. + * so `pushBackgroundFlutterApplicationReadyOnAndroid` platform method call doesn't need to be called. */ public class BackgroundMethodCallHandler implements MethodChannel.MethodCallHandler { private static final String TAG = AblyFlutterPlugin.class.getName(); @@ -27,8 +27,8 @@ public BackgroundMethodCallHandler(BinaryMessenger messenger, MethodCodec codec) @Override public void onMethodCall(@NonNull MethodCall call, @NonNull MethodChannel.Result result) { - if (call.method.equals(pushSetOnBackgroundMessage)) { - Log.v(TAG, "Ignoring pushSetOnBackgroundMessage because it doesn't need to be called, " + + if (call.method.equals(pushBackgroundFlutterApplicationReadyOnAndroid)) { + Log.v(TAG, "Ignoring pushBackgroundFlutterApplicationReadyOnAndroid because it doesn't need to be called, " + "since the user's Flutter app (default DartEntrypoint) is already running."); } else { result.notImplemented(); diff --git a/android/src/main/java/io/ably/flutter/plugin/generated/PlatformConstants.java b/android/src/main/java/io/ably/flutter/plugin/generated/PlatformConstants.java index c31d14379..e7d85e75c 100644 --- a/android/src/main/java/io/ably/flutter/plugin/generated/PlatformConstants.java +++ b/android/src/main/java/io/ably/flutter/plugin/generated/PlatformConstants.java @@ -84,7 +84,7 @@ static final public class PlatformMethod { public static final String pushOnMessage = "pushOnMessage"; public static final String pushOnBackgroundMessage = "pushOnBackgroundMessage"; public static final String pushOnNotificationTap = "pushOnNotificationTap"; - public static final String pushSetOnBackgroundMessage = "pushSetOnBackgroundMessage"; + public static final String pushBackgroundFlutterApplicationReadyOnAndroid = "pushBackgroundFlutterApplicationReadyOnAndroid"; public static final String onRealtimeConnectionStateChanged = "onRealtimeConnectionStateChanged"; public static final String onRealtimeChannelStateChanged = "onRealtimeChannelStateChanged"; public static final String onRealtimeChannelMessage = "onRealtimeChannelMessage"; diff --git a/android/src/main/java/io/ably/flutter/plugin/push/ManualFlutterApplicationRunner.java b/android/src/main/java/io/ably/flutter/plugin/push/ManualFlutterApplicationRunner.java index 335dc2ef9..93d974a72 100644 --- a/android/src/main/java/io/ably/flutter/plugin/push/ManualFlutterApplicationRunner.java +++ b/android/src/main/java/io/ably/flutter/plugin/push/ManualFlutterApplicationRunner.java @@ -1,7 +1,7 @@ package io.ably.flutter.plugin.push; import static io.ably.flutter.plugin.generated.PlatformConstants.PlatformMethod.pushOnBackgroundMessage; -import static io.ably.flutter.plugin.generated.PlatformConstants.PlatformMethod.pushSetOnBackgroundMessage; +import static io.ably.flutter.plugin.generated.PlatformConstants.PlatformMethod.pushBackgroundFlutterApplicationReadyOnAndroid; import android.content.Context; import android.content.Intent; @@ -63,7 +63,7 @@ public ManualFlutterApplicationRunner(@NonNull final Context context, @Override public void onMethodCall(@NonNull final MethodCall call, @NonNull final MethodChannel.Result result) { - if (call.method.equals(pushSetOnBackgroundMessage)) { + if (call.method.equals(pushBackgroundFlutterApplicationReadyOnAndroid)) { // This signals that the manually spawned app is ready to receive a message to handle. // We ask the user to set the background message handler early on. backgroundMethodChannel.invokeMethod(pushOnBackgroundMessage, remoteMessage, new MethodChannel.Result() { diff --git a/bin/codegen_context.dart b/bin/codegen_context.dart index 75adaa382..32d925cbc 100644 --- a/bin/codegen_context.dart +++ b/bin/codegen_context.dart @@ -129,7 +129,10 @@ const List> _platformMethods = [ {'name': 'pushOnBackgroundMessage', 'value': 'pushOnBackgroundMessage'}, {'name': 'pushOnNotificationTap', 'value': 'pushOnNotificationTap'}, // Used only on Android - {'name': 'pushSetOnBackgroundMessage', 'value': 'pushSetOnBackgroundMessage'}, + { + 'name': 'pushBackgroundFlutterApplicationReadyOnAndroid', + 'value': 'pushBackgroundFlutterApplicationReadyOnAndroid' + }, // Realtime events { diff --git a/ios/Classes/codec/AblyPlatformConstants.h b/ios/Classes/codec/AblyPlatformConstants.h index cb9ff4f40..fd5898e59 100644 --- a/ios/Classes/codec/AblyPlatformConstants.h +++ b/ios/Classes/codec/AblyPlatformConstants.h @@ -82,7 +82,7 @@ extern NSString *const AblyPlatformMethod_pushOnShowNotificationInForeground; extern NSString *const AblyPlatformMethod_pushOnMessage; extern NSString *const AblyPlatformMethod_pushOnBackgroundMessage; extern NSString *const AblyPlatformMethod_pushOnNotificationTap; -extern NSString *const AblyPlatformMethod_pushSetOnBackgroundMessage; +extern NSString *const AblyPlatformMethod_pushBackgroundFlutterApplicationReadyOnAndroid; extern NSString *const AblyPlatformMethod_onRealtimeConnectionStateChanged; extern NSString *const AblyPlatformMethod_onRealtimeChannelStateChanged; extern NSString *const AblyPlatformMethod_onRealtimeChannelMessage; diff --git a/ios/Classes/codec/AblyPlatformConstants.m b/ios/Classes/codec/AblyPlatformConstants.m index 6393e0100..dbf20374e 100644 --- a/ios/Classes/codec/AblyPlatformConstants.m +++ b/ios/Classes/codec/AblyPlatformConstants.m @@ -53,7 +53,7 @@ NSString *const AblyPlatformMethod_pushOnMessage= @"pushOnMessage"; NSString *const AblyPlatformMethod_pushOnBackgroundMessage= @"pushOnBackgroundMessage"; NSString *const AblyPlatformMethod_pushOnNotificationTap= @"pushOnNotificationTap"; -NSString *const AblyPlatformMethod_pushSetOnBackgroundMessage= @"pushSetOnBackgroundMessage"; +NSString *const AblyPlatformMethod_pushBackgroundFlutterApplicationReadyOnAndroid= @"pushBackgroundFlutterApplicationReadyOnAndroid"; NSString *const AblyPlatformMethod_onRealtimeConnectionStateChanged= @"onRealtimeConnectionStateChanged"; NSString *const AblyPlatformMethod_onRealtimeChannelStateChanged= @"onRealtimeChannelStateChanged"; NSString *const AblyPlatformMethod_onRealtimeChannelMessage= @"onRealtimeChannelMessage"; diff --git a/lib/src/generated/platform_constants.dart b/lib/src/generated/platform_constants.dart index e6a6b196c..1fbc8deac 100644 --- a/lib/src/generated/platform_constants.dart +++ b/lib/src/generated/platform_constants.dart @@ -85,7 +85,8 @@ class PlatformMethod { static const String pushOnMessage = 'pushOnMessage'; static const String pushOnBackgroundMessage = 'pushOnBackgroundMessage'; static const String pushOnNotificationTap = 'pushOnNotificationTap'; - static const String pushSetOnBackgroundMessage = 'pushSetOnBackgroundMessage'; + static const String pushBackgroundFlutterApplicationReadyOnAndroid = + 'pushBackgroundFlutterApplicationReadyOnAndroid'; static const String onRealtimeConnectionStateChanged = 'onRealtimeConnectionStateChanged'; static const String onRealtimeChannelStateChanged = diff --git a/lib/src/platform/src/push_notification_events_native.dart b/lib/src/platform/src/push_notification_events_native.dart index 487295574..d59ebf067 100644 --- a/lib/src/platform/src/push_notification_events_native.dart +++ b/lib/src/platform/src/push_notification_events_native.dart @@ -56,8 +56,8 @@ class PushNotificationEventsNative implements PushNotificationEvents { Future setOnBackgroundMessage(BackgroundMessageHandler handler) async { _onBackgroundMessage = handler; if (io.Platform.isAndroid) { - await BackgroundIsolateAndroidPlatform.methodChannel - .invokeMethod(PlatformMethod.pushSetOnBackgroundMessage); + await BackgroundIsolateAndroidPlatform.methodChannel.invokeMethod( + PlatformMethod.pushBackgroundFlutterApplicationReadyOnAndroid); } }