Skip to content

Commit

Permalink
Drop registerWith in Android plugin (#1745)
Browse files Browse the repository at this point in the history
registerWith() is a relic from Flutter embedding v1.
  • Loading branch information
emersion committed Oct 23, 2022
1 parent 341fa58 commit 2a4f898
Showing 1 changed file with 3 additions and 16 deletions.
Expand Up @@ -191,15 +191,6 @@ public class FlutterLocalNotificationsPlugin
private PermissionRequestListener callback;
private boolean permissionRequestInProgress = false;

@SuppressWarnings("deprecation")
public static void registerWith(io.flutter.plugin.common.PluginRegistry.Registrar registrar) {
FlutterLocalNotificationsPlugin plugin = new FlutterLocalNotificationsPlugin();
plugin.setActivity(registrar.activity());
registrar.addNewIntentListener(plugin);
registrar.addRequestPermissionsResultListener(plugin);
plugin.onAttachedToEngine(registrar.context(), registrar.messenger());
}

static void rescheduleNotifications(Context context) {
ArrayList<NotificationDetails> scheduledNotifications = loadScheduledNotifications(context);
for (NotificationDetails scheduledNotification : scheduledNotifications) {
Expand Down Expand Up @@ -1248,15 +1239,11 @@ private void setActivity(Activity flutterActivity) {
this.mainActivity = flutterActivity;
}

private void onAttachedToEngine(Context context, BinaryMessenger binaryMessenger) {
this.applicationContext = context;
this.channel = new MethodChannel(binaryMessenger, METHOD_CHANNEL);
this.channel.setMethodCallHandler(this);
}

@Override
public void onAttachedToEngine(FlutterPluginBinding binding) {
onAttachedToEngine(binding.getApplicationContext(), binding.getBinaryMessenger());
this.applicationContext = binding.getApplicationContext();
this.channel = new MethodChannel(binding.getBinaryMessenger(), METHOD_CHANNEL);
this.channel.setMethodCallHandler(this);
}

@Override
Expand Down

0 comments on commit 2a4f898

Please sign in to comment.