99 lines
3.0 KiB
Java
99 lines
3.0 KiB
Java
package o;
|
|
|
|
import android.content.BroadcastReceiver;
|
|
import android.content.Context;
|
|
import android.content.Intent;
|
|
import android.net.ConnectivityManager;
|
|
import android.net.Network;
|
|
import android.os.Handler;
|
|
import android.os.Looper;
|
|
import io.flutter.plugin.common.EventChannel;
|
|
|
|
/* renamed from: o.fPO, reason: case insensitive filesystem */
|
|
/* loaded from: classes5.dex */
|
|
public final class C13052fPO extends BroadcastReceiver implements EventChannel.StreamHandler {
|
|
private final Context a;
|
|
private ConnectivityManager.NetworkCallback b;
|
|
final C13050fPI c;
|
|
private final Handler d = new Handler(Looper.getMainLooper());
|
|
EventChannel.EventSink e;
|
|
|
|
public C13052fPO(Context context, C13050fPI c13050fPI) {
|
|
this.a = context;
|
|
this.c = c13050fPI;
|
|
}
|
|
|
|
@Override // io.flutter.plugin.common.EventChannel.StreamHandler
|
|
public final void onListen(Object obj, EventChannel.EventSink eventSink) {
|
|
this.e = eventSink;
|
|
this.b = new ConnectivityManager.NetworkCallback(this) { // from class: o.fPO.5
|
|
private C13052fPO a;
|
|
|
|
{
|
|
this.a = this;
|
|
}
|
|
|
|
@Override // android.net.ConnectivityManager.NetworkCallback
|
|
public final void onAvailable(Network network) {
|
|
C13052fPO.a(this.a);
|
|
}
|
|
|
|
@Override // android.net.ConnectivityManager.NetworkCallback
|
|
public final void onLost(Network network) {
|
|
C13052fPO.d(this.a, "none");
|
|
}
|
|
};
|
|
this.c.d.registerDefaultNetworkCallback(this.b);
|
|
}
|
|
|
|
@Override // android.content.BroadcastReceiver
|
|
public final void onReceive(Context context, Intent intent) {
|
|
EventChannel.EventSink eventSink = this.e;
|
|
if (eventSink != null) {
|
|
eventSink.success(this.c.e());
|
|
}
|
|
}
|
|
|
|
static /* synthetic */ void a(final C13052fPO c13052fPO) {
|
|
c13052fPO.d.post(new Runnable(c13052fPO) { // from class: o.fPN
|
|
private C13052fPO a;
|
|
|
|
@Override // java.lang.Runnable
|
|
public final void run() {
|
|
C13052fPO c13052fPO2 = this.a;
|
|
c13052fPO2.e.success(c13052fPO2.c.e());
|
|
}
|
|
|
|
{
|
|
this.a = c13052fPO;
|
|
}
|
|
});
|
|
}
|
|
|
|
static /* synthetic */ void d(final C13052fPO c13052fPO, final String str) {
|
|
c13052fPO.d.post(new Runnable(c13052fPO, str) { // from class: o.fPM
|
|
private C13052fPO c;
|
|
private String e;
|
|
|
|
@Override // java.lang.Runnable
|
|
public final void run() {
|
|
C13052fPO c13052fPO2 = this.c;
|
|
c13052fPO2.e.success(this.e);
|
|
}
|
|
|
|
{
|
|
this.c = c13052fPO;
|
|
this.e = str;
|
|
}
|
|
});
|
|
}
|
|
|
|
@Override // io.flutter.plugin.common.EventChannel.StreamHandler
|
|
public final void onCancel(Object obj) {
|
|
if (this.b != null) {
|
|
this.c.d.unregisterNetworkCallback(this.b);
|
|
this.b = null;
|
|
}
|
|
}
|
|
}
|