Skip to content
This repository was archived by the owner on Feb 22, 2023. It is now read-only.

Commit dec9fa2

Browse files
committed
fix formatting
1 parent 16ce3a6 commit dec9fa2

File tree

3 files changed

+33
-29
lines changed

3 files changed

+33
-29
lines changed

packages/firebase_messaging/android/src/main/java/io/flutter/plugins/firebasemessaging/FirebaseMessagingPlugin.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
import com.google.firebase.iid.InstanceIdResult;
2020
import com.google.firebase.messaging.FirebaseMessaging;
2121
import com.google.firebase.messaging.RemoteMessage;
22-
2322
import io.flutter.plugin.common.JSONMethodCodec;
2423
import io.flutter.plugin.common.MethodCall;
2524
import io.flutter.plugin.common.MethodChannel;
@@ -122,9 +121,12 @@ public void onMethodCall(final MethodCall call, final Result result) {
122121
Log.e(TAG, "There was an exception when getting callback handle from dart side");
123122
e.printStackTrace();
124123
}
125-
FlutterFirebaseMessagingService.setBackgroundSetupHandle(this.registrar.context(), callbackHandle);
126-
FlutterFirebaseMessagingService.startBackgroundIsolate(this.registrar.context(), callbackHandle);
127-
FlutterFirebaseMessagingService.setBackgroundMessageHandle(this.registrar.context(), onMessageHandle);
124+
FlutterFirebaseMessagingService.setBackgroundSetupHandle(
125+
this.registrar.context(), callbackHandle);
126+
FlutterFirebaseMessagingService.startBackgroundIsolate(
127+
this.registrar.context(), callbackHandle);
128+
FlutterFirebaseMessagingService.setBackgroundMessageHandle(
129+
this.registrar.context(), onMessageHandle);
128130
result.success(true);
129131
} else if ("FcmDartService.initialized".equals(call.method)) {
130132
FlutterFirebaseMessagingService.onInitialized();

packages/firebase_messaging/android/src/main/java/io/flutter/plugins/firebasemessaging/FlutterFirebaseMessagingService.java

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,15 @@
1212
import android.os.Handler;
1313
import android.os.Process;
1414
import android.util.Log;
15-
1615
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
1716
import com.google.firebase.messaging.FirebaseMessagingService;
1817
import com.google.firebase.messaging.RemoteMessage;
19-
18+
import io.flutter.plugin.common.MethodChannel;
19+
import io.flutter.plugin.common.PluginRegistry;
20+
import io.flutter.view.FlutterCallbackInformation;
21+
import io.flutter.view.FlutterMain;
22+
import io.flutter.view.FlutterNativeView;
23+
import io.flutter.view.FlutterRunArguments;
2024
import java.util.Collections;
2125
import java.util.HashMap;
2226
import java.util.Iterator;
@@ -26,13 +30,6 @@
2630
import java.util.concurrent.CountDownLatch;
2731
import java.util.concurrent.atomic.AtomicBoolean;
2832

29-
import io.flutter.plugin.common.MethodChannel;
30-
import io.flutter.plugin.common.PluginRegistry;
31-
import io.flutter.view.FlutterCallbackInformation;
32-
import io.flutter.view.FlutterMain;
33-
import io.flutter.view.FlutterNativeView;
34-
import io.flutter.view.FlutterRunArguments;
35-
3633
public class FlutterFirebaseMessagingService extends FirebaseMessagingService {
3734

3835
public static final String ACTION_REMOTE_MESSAGE =
@@ -44,7 +41,8 @@ public class FlutterFirebaseMessagingService extends FirebaseMessagingService {
4441

4542
private static final String SHARED_PREFERENCES_KEY = "io.flutter.android_fcm_plugin";
4643
private static final String BACKGROUND_SETUP_CALLBACK_HANDLE_KEY = "background_setup_callback";
47-
private static final String BACKGROUND_MESSAGE_CALLBACK_HANDLE_KEY = "background_message_callback";
44+
private static final String BACKGROUND_MESSAGE_CALLBACK_HANDLE_KEY =
45+
"background_message_callback";
4846

4947
// TODO(kroikie): make sIsIsolateRunning per-instance, not static.
5048
private static AtomicBoolean sIsIsolateRunning = new AtomicBoolean(false);
@@ -56,7 +54,8 @@ public class FlutterFirebaseMessagingService extends FirebaseMessagingService {
5654

5755
private static Long sBackgroundMessageHandle;
5856

59-
private static List<RemoteMessage> sBackgroundMessageQueue = Collections.synchronizedList(new LinkedList<RemoteMessage>());
57+
private static List<RemoteMessage> sBackgroundMessageQueue =
58+
Collections.synchronizedList(new LinkedList<RemoteMessage>());
6059

6160
private static PluginRegistry.PluginRegistrantCallback sPluginRegistrantCallback;
6261

@@ -105,8 +104,8 @@ public void onMessageReceived(final RemoteMessage remoteMessage) {
105104
new Runnable() {
106105
@Override
107106
public void run() {
108-
Log.d(TAG, "executing dart callback");
109-
executeDartCallbackInBackgroundIsolate(FlutterFirebaseMessagingService.this, remoteMessage, latch);
107+
executeDartCallbackInBackgroundIsolate(
108+
FlutterFirebaseMessagingService.this, remoteMessage, latch);
110109
}
111110
});
112111
try {
@@ -199,16 +198,15 @@ public static void setBackgroundSetupHandle(Context context, long callbackHandle
199198
}
200199

201200
public static Long getOnMessageCallbackHandle(Context context) {
202-
return context.getSharedPreferences(SHARED_PREFERENCES_KEY, 0)
201+
return context
202+
.getSharedPreferences(SHARED_PREFERENCES_KEY, 0)
203203
.getLong(BACKGROUND_MESSAGE_CALLBACK_HANDLE_KEY, 0);
204204
}
205205

206-
private static void executeDartCallbackInBackgroundIsolate(Context context,
207-
RemoteMessage remoteMessage, final CountDownLatch latch) {
206+
private static void executeDartCallbackInBackgroundIsolate(
207+
Context context, RemoteMessage remoteMessage, final CountDownLatch latch) {
208208
if (sBackgroundChannel == null) {
209-
Log.e(
210-
TAG,
211-
"setBackgroundChannel was not called before messages came in, exiting.");
209+
Log.e(TAG, "setBackgroundChannel was not called before messages came in, exiting.");
212210
return;
213211
}
214212

@@ -257,14 +255,16 @@ public void notImplemented() {
257255

258256
// TODO(kroikie): Find a better way to determine application state.
259257
public static boolean isApplicationForeground(Context context) {
260-
KeyguardManager keyguardManager = (KeyguardManager) context.getSystemService(Context.KEYGUARD_SERVICE);
258+
KeyguardManager keyguardManager =
259+
(KeyguardManager) context.getSystemService(Context.KEYGUARD_SERVICE);
261260

262261
if (keyguardManager.inKeyguardRestrictedInputMode()) {
263262
return false;
264263
}
265264
int myPid = Process.myPid();
266265

267-
ActivityManager activityManager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
266+
ActivityManager activityManager =
267+
(ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
268268

269269
List<ActivityManager.RunningAppProcessInfo> list;
270270

packages/firebase_messaging/lib/firebase_messaging.dart

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,10 @@ void _fcmSetupCallback() {
2525
// This is where the magic happens and we handle background events from the
2626
// native portion of the plugin.
2727
_channel.setMethodCallHandler((MethodCall call) async {
28-
final CallbackHandle handle = CallbackHandle.fromRawHandle(call.arguments['handle']);
29-
final Function handlerFunction = PluginUtilities.getCallbackFromHandle(handle);
28+
final CallbackHandle handle =
29+
CallbackHandle.fromRawHandle(call.arguments['handle']);
30+
final Function handlerFunction =
31+
PluginUtilities.getCallbackFromHandle(handle);
3032
await handlerFunction(call.arguments['message']);
3133
return Future<void>.value();
3234
});
@@ -98,9 +100,9 @@ class FirebaseMessaging {
98100
if (_onBackgroundMessage != null) {
99101
_onBackgroundMessage = onBackgroundMessage;
100102
final CallbackHandle backgroundSetupHandle =
101-
PluginUtilities.getCallbackHandle(_fcmSetupCallback);
103+
PluginUtilities.getCallbackHandle(_fcmSetupCallback);
102104
final CallbackHandle backgroundMessageHandle =
103-
PluginUtilities.getCallbackHandle(_onBackgroundMessage);
105+
PluginUtilities.getCallbackHandle(_onBackgroundMessage);
104106
_channel.invokeMethod<bool>(
105107
'FcmDartService.start',
106108
<dynamic>[

0 commit comments

Comments
 (0)