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

122 lines
4.6 KiB
Java

package b.i.a.f.j.b.e;
import android.app.Activity;
import android.os.Handler;
import android.os.Looper;
import androidx.annotation.Nullable;
import b.c.a.a0.d;
import b.i.a.f.e.h.a;
import b.i.a.f.e.h.b;
import b.i.a.f.e.h.j.c0;
import b.i.a.f.e.h.j.d0;
import b.i.a.f.e.h.j.g;
import b.i.a.f.e.h.j.k;
import b.i.a.f.e.h.j.n0;
import b.i.a.f.e.k.c;
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.AbstractC0104a<f, b.i.a.f.j.b.a> k;
public static final a<b.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 b.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 // b.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.f2991b), 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.f2992s == 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.c), 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.c;
x xVar = new x(this, aVar, a0Var2);
d.z(kVar.c, "Listener has already been released.");
d.z(aVar, "Listener has already been released.");
d.o(d.h0(kVar.c, aVar), "Listener registration and unregistration methods must be constructed with the same ListenerHolder.");
g gVar = this.i;
Runnable runnable = b.i.a.f.e.h.k.j;
Objects.requireNonNull(gVar);
TaskCompletionSource taskCompletionSource = new TaskCompletionSource();
n0 n0Var = new n0(new d0(vVar, xVar, runnable), taskCompletionSource);
Handler handler = gVar.f1356x;
handler.sendMessage(handler.obtainMessage(8, new c0(n0Var, gVar.f1355s.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");
b(new k.a<>(t, name)).b(new u(taskCompletionSource));
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);
}
}