discord-jadx/app/src/main/java/c/i/a/f/j/b/e/i.java

127 lines
4.8 KiB
Java

package c.i.a.f.j.b.e;
import android.app.Activity;
import android.os.Handler;
import android.os.Looper;
import androidx.annotation.Nullable;
import c.c.a.a0.d;
import c.i.a.f.e.h.a;
import c.i.a.f.e.h.b;
import c.i.a.f.e.h.j.c0;
import c.i.a.f.e.h.j.d0;
import c.i.a.f.e.h.j.g;
import c.i.a.f.e.h.j.k;
import c.i.a.f.e.h.j.n0;
import c.i.a.f.e.k.c;
import c.i.a.f.n.b0;
import com.google.android.gms.common.api.Status;
import com.google.android.gms.nearby.messages.Message;
import com.google.android.gms.nearby.messages.MessageListener;
import com.google.android.gms.nearby.messages.MessagesClient;
import com.google.android.gms.nearby.messages.PublishOptions;
import com.google.android.gms.nearby.messages.SubscribeOptions;
import com.google.android.gms.tasks.Task;
import com.google.android.gms.tasks.TaskCompletionSource;
import java.util.Objects;
public final class i extends MessagesClient {
public static final a.g<f> j;
public static final a.AbstractC0105a<f, c.i.a.f.j.b.a> k;
public static final a<c.i.a.f.j.b.a> l;
public final int m = 1;
static {
a.g<f> gVar = new a.g<>();
j = gVar;
q qVar = new q();
k = qVar;
l = new a<>("Nearby.MESSAGES_API", qVar, gVar);
}
public i(Activity activity, @Nullable c.i.a.f.j.b.a aVar) {
super(activity, l, aVar, b.a.a);
activity.getApplication().registerActivityLifecycleCallbacks(new z(activity, this, null));
}
public static k j(i iVar, TaskCompletionSource taskCompletionSource) {
Objects.requireNonNull(iVar);
t tVar = new t(taskCompletionSource);
String name = Status.class.getName();
Looper looper = iVar.e;
d.z(tVar, "Listener must not be null");
d.z(looper, "Looper must not be null");
d.z(name, "Listener type must not be null");
return new k(looper, tVar, name);
}
@Override // c.i.a.f.e.h.b
public final c.a a() {
return super.a();
}
@Override // com.google.android.gms.nearby.messages.MessagesClient
public final Task<Void> f(Message message, PublishOptions publishOptions) {
k m = m(message);
return k(m, new j(this, message, new r(this, m(publishOptions.b), m), publishOptions), new k(message));
}
@Override // com.google.android.gms.nearby.messages.MessagesClient
public final Task<Void> g(MessageListener messageListener, SubscribeOptions subscribeOptions) {
d.o(subscribeOptions.a.r == 0, "Strategy.setBackgroundScanMode() is only supported by background subscribe (the version which takes a PendingIntent).");
k m = m(messageListener);
return k(m, new l(this, m, new s(this, m(subscribeOptions.f2401c), m), subscribeOptions), new m(m));
}
@Override // com.google.android.gms.nearby.messages.MessagesClient
public final Task<Void> h(Message message) {
return l(message);
}
@Override // com.google.android.gms.nearby.messages.MessagesClient
public final Task<Void> i(MessageListener messageListener) {
return l(messageListener);
}
public final <T> Task<Void> k(k<T> kVar, a0 a0Var, a0 a0Var2) {
v vVar = new v(this, kVar, a0Var);
k.a<T> aVar = kVar.f1086c;
x xVar = new x(this, aVar, a0Var2);
d.z(kVar.f1086c, "Listener has already been released.");
d.z(aVar, "Listener has already been released.");
d.o(d.g0(kVar.f1086c, aVar), "Listener registration and unregistration methods must be constructed with the same ListenerHolder.");
g gVar = this.i;
Runnable runnable = c.i.a.f.e.h.k.i;
Objects.requireNonNull(gVar);
TaskCompletionSource taskCompletionSource = new TaskCompletionSource();
n0 n0Var = new n0(new d0(vVar, xVar, runnable), taskCompletionSource);
Handler handler = gVar.w;
handler.sendMessage(handler.obtainMessage(8, new c0(n0Var, gVar.r.get(), this)));
return taskCompletionSource.a;
}
public final <T> Task<Void> l(T t) {
TaskCompletionSource taskCompletionSource = new TaskCompletionSource();
String name = t.getClass().getName();
d.z(t, "Listener must not be null");
d.z(name, "Listener type must not be null");
d.v(name, "Listener type must not be empty");
Task<Boolean> b = b(new k.a<>(t, name));
u uVar = new u(taskCompletionSource);
b0 b0Var = (b0) b;
Objects.requireNonNull(b0Var);
b0Var.c(c.i.a.f.n.g.a, uVar);
return taskCompletionSource.a;
}
public final <T> k<T> m(T t) {
if (t == null) {
return null;
}
String name = t.getClass().getName();
Looper looper = this.e;
d.z(t, "Listener must not be null");
d.z(looper, "Looper must not be null");
d.z(name, "Listener type must not be null");
return new k<>(looper, t, name);
}
}