Skip to content

Commit

Permalink
I ran the command "dart format ."
Browse files Browse the repository at this point in the history
  • Loading branch information
asoap committed Dec 6, 2023
1 parent 8f67802 commit 483e25d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
18 changes: 12 additions & 6 deletions lib/src/platform/src/background_android_isolate_platform.dart
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,14 @@ class BackgroundIsolateAndroidPlatform {
case PlatformMethod.pushOnBackgroundMessage:
return _onPushBackgroundMessage(call.arguments as RemoteMessage);
default:
throw PlatformException(code: 'invalid_method', message: 'No such method ${call.method}');
throw PlatformException(
code: 'invalid_method', message: 'No such method ${call.method}');
}
});
}

static final BackgroundIsolateAndroidPlatform _platform = BackgroundIsolateAndroidPlatform._internal();
static final BackgroundIsolateAndroidPlatform _platform =
BackgroundIsolateAndroidPlatform._internal();

/// @nodoc
/// Singleton instance of BackgroundIsolateAndroidPlatform
Expand All @@ -37,15 +39,19 @@ class BackgroundIsolateAndroidPlatform {
/// A method channel used to communicate with the user's app isolate
/// we explicitly launched when a RemoteMessage is received.
/// Used only on Android.
final MethodChannel _methodChannel = MethodChannel('io.ably.flutter.plugin.background', StandardMethodCodec(Codec()));
final MethodChannel _methodChannel = MethodChannel(
'io.ably.flutter.plugin.background', StandardMethodCodec(Codec()));

final PushNotificationEventsInternal _pushNotificationEvents = Push.notificationEvents as PushNotificationEventsInternal;
final PushNotificationEventsInternal _pushNotificationEvents =
Push.notificationEvents as PushNotificationEventsInternal;

Future<void> _onPushBackgroundMessage(RemoteMessage remoteMessage) async => _pushNotificationEvents.handleBackgroundMessage(remoteMessage);
Future<void> _onPushBackgroundMessage(RemoteMessage remoteMessage) async =>
_pushNotificationEvents.handleBackgroundMessage(remoteMessage);

/// @nodoc
/// Equivalent of [Platform.invokePlatformMethod] which cannot be used here
/// because we may not be able to acquire [Platform] instance here, so we
/// need to use a raw [MethodChannel] communication
Future<T?> invokeMethod<T>(String method, [dynamic arguments]) async => _methodChannel.invokeMethod<T>(method, arguments);
Future<T?> invokeMethod<T>(String method, [dynamic arguments]) async =>
_methodChannel.invokeMethod<T>(method, arguments);
}
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ class PushNotificationEventsInternal implements PushNotificationEvents {
if (_onBackgroundMessage != null) {
dynamic onBackgroundMessageResult = _onBackgroundMessage!(remoteMessage);
// ^^^ _onBackgroundMessage() can return void or Future<void>
if (onBackgroundMessageResult is Future) {
if (onBackgroundMessageResult is Future) {
await onBackgroundMessageResult; // if it returns a Future we await on it.
}
} else {
Expand Down

0 comments on commit 483e25d

Please sign in to comment.