what-the-bank/sources/io/flutter/plugins/urllauncher/UrlLauncherPlugin.java

63 lines
2.7 KiB
Java

package io.flutter.plugins.urllauncher;
import io.flutter.embedding.engine.plugins.FlutterPlugin;
import io.flutter.embedding.engine.plugins.activity.ActivityAware;
import io.flutter.embedding.engine.plugins.activity.ActivityPluginBinding;
import io.flutter.plugin.common.PluginRegistry;
/* loaded from: classes6.dex */
public final class UrlLauncherPlugin implements FlutterPlugin, ActivityAware {
private static final String TAG = "UrlLauncherPlugin";
private MethodCallHandlerImpl methodCallHandler;
private UrlLauncher urlLauncher;
public static void registerWith(PluginRegistry.Registrar registrar) {
new MethodCallHandlerImpl(new UrlLauncher(registrar.context(), registrar.activity())).startListening(registrar.messenger());
}
@Override // io.flutter.embedding.engine.plugins.FlutterPlugin
public final void onAttachedToEngine(FlutterPlugin.FlutterPluginBinding flutterPluginBinding) {
this.urlLauncher = new UrlLauncher(flutterPluginBinding.getApplicationContext(), null);
MethodCallHandlerImpl methodCallHandlerImpl = new MethodCallHandlerImpl(this.urlLauncher);
this.methodCallHandler = methodCallHandlerImpl;
methodCallHandlerImpl.startListening(flutterPluginBinding.getBinaryMessenger());
}
@Override // io.flutter.embedding.engine.plugins.FlutterPlugin
public final void onDetachedFromEngine(FlutterPlugin.FlutterPluginBinding flutterPluginBinding) {
MethodCallHandlerImpl methodCallHandlerImpl = this.methodCallHandler;
if (methodCallHandlerImpl == null) {
return;
}
methodCallHandlerImpl.stopListening();
this.methodCallHandler = null;
this.urlLauncher = null;
}
@Override // io.flutter.embedding.engine.plugins.activity.ActivityAware
public final void onAttachedToActivity(ActivityPluginBinding activityPluginBinding) {
if (this.methodCallHandler == null) {
return;
}
this.urlLauncher.setActivity(activityPluginBinding.getActivity());
}
@Override // io.flutter.embedding.engine.plugins.activity.ActivityAware
public final void onDetachedFromActivity() {
if (this.methodCallHandler == null) {
return;
}
this.urlLauncher.setActivity(null);
}
@Override // io.flutter.embedding.engine.plugins.activity.ActivityAware
public final void onDetachedFromActivityForConfigChanges() {
onDetachedFromActivity();
}
@Override // io.flutter.embedding.engine.plugins.activity.ActivityAware
public final void onReattachedToActivityForConfigChanges(ActivityPluginBinding activityPluginBinding) {
onAttachedToActivity(activityPluginBinding);
}
}