70 lines
2.5 KiB
Java
70 lines
2.5 KiB
Java
package com.discord.utilities.sms;
|
|
|
|
import android.app.Application;
|
|
import android.content.BroadcastReceiver;
|
|
import android.content.IntentFilter;
|
|
import c.c.a.a0.d;
|
|
import c.i.a.f.e.h.j.k0;
|
|
import c.i.a.f.e.h.j.p;
|
|
import c.i.a.f.h.b.b;
|
|
import c.i.a.f.h.b.h;
|
|
import c.i.a.f.h.b.j;
|
|
import c0.z.d.m;
|
|
import com.discord.utilities.lifecycle.ApplicationProvider;
|
|
import com.discord.widgets.auth.SmsAuthCodeBroadcastReceiver;
|
|
import com.google.android.gms.common.Feature;
|
|
import kotlin.Unit;
|
|
import kotlin.jvm.functions.Function1;
|
|
import kotlin.jvm.internal.DefaultConstructorMarker;
|
|
/* compiled from: SmsListener.kt */
|
|
public final class SmsListener {
|
|
public static final Companion Companion = new Companion(null);
|
|
private static BroadcastReceiver broadcastReceiver;
|
|
|
|
/* compiled from: SmsListener.kt */
|
|
public static final class Companion {
|
|
private Companion() {
|
|
}
|
|
|
|
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
|
|
this();
|
|
}
|
|
|
|
public final BroadcastReceiver getBroadcastReceiver() {
|
|
return SmsListener.access$getBroadcastReceiver$cp();
|
|
}
|
|
|
|
public final void setBroadcastReceiver(BroadcastReceiver broadcastReceiver) {
|
|
SmsListener.access$setBroadcastReceiver$cp(broadcastReceiver);
|
|
}
|
|
|
|
public final void startSmsListener(Function1<? super String, Unit> function1) {
|
|
m.checkNotNullParameter(function1, "onSuccess");
|
|
Application application = ApplicationProvider.INSTANCE.get();
|
|
h hVar = new h(application);
|
|
p.a aVar = new p.a(null);
|
|
aVar.a = new j(hVar);
|
|
aVar.b = new Feature[]{b.b};
|
|
d.p(true, "execute parameter required");
|
|
hVar.c(new k0(aVar, aVar.b, true));
|
|
setBroadcastReceiver(new SmsAuthCodeBroadcastReceiver(function1));
|
|
application.registerReceiver(getBroadcastReceiver(), new IntentFilter("com.google.android.gms.auth.api.phone.SMS_RETRIEVED"));
|
|
}
|
|
|
|
public final void stopSmsListener() {
|
|
try {
|
|
ApplicationProvider.INSTANCE.get().unregisterReceiver(getBroadcastReceiver());
|
|
} catch (Exception unused) {
|
|
}
|
|
}
|
|
}
|
|
|
|
public static final /* synthetic */ BroadcastReceiver access$getBroadcastReceiver$cp() {
|
|
return broadcastReceiver;
|
|
}
|
|
|
|
public static final /* synthetic */ void access$setBroadcastReceiver$cp(BroadcastReceiver broadcastReceiver2) {
|
|
broadcastReceiver = broadcastReceiver2;
|
|
}
|
|
}
|