127 lines
5.1 KiB
Java
127 lines
5.1 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.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.l0;
|
|
import c.i.a.f.e.k.c;
|
|
import c.i.a.f.n.b0;
|
|
import com.airbnb.lottie.parser.AnimatableValueParser;
|
|
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, 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;
|
|
AnimatableValueParser.z(tVar, "Listener must not be null");
|
|
AnimatableValueParser.z(looper, "Looper must not be null");
|
|
AnimatableValueParser.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) {
|
|
AnimatableValueParser.p(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.f2370c), 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.f1056c;
|
|
x xVar = new x(this, aVar, a0Var2);
|
|
AnimatableValueParser.z(kVar.f1056c, "Listener has already been released.");
|
|
AnimatableValueParser.z(aVar, "Listener has already been released.");
|
|
AnimatableValueParser.p(AnimatableValueParser.j0(kVar.f1056c, 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();
|
|
l0 l0Var = new l0(new d0(vVar, xVar, runnable), taskCompletionSource);
|
|
Handler handler = gVar.w;
|
|
handler.sendMessage(handler.obtainMessage(8, new c0(l0Var, gVar.r.get(), this)));
|
|
return taskCompletionSource.a;
|
|
}
|
|
|
|
public final <T> Task<Void> l(T t) {
|
|
TaskCompletionSource taskCompletionSource = new TaskCompletionSource();
|
|
String name = t.getClass().getName();
|
|
AnimatableValueParser.z(t, "Listener must not be null");
|
|
AnimatableValueParser.z(name, "Listener type must not be null");
|
|
AnimatableValueParser.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;
|
|
AnimatableValueParser.z(t, "Listener must not be null");
|
|
AnimatableValueParser.z(looper, "Looper must not be null");
|
|
AnimatableValueParser.z(name, "Listener type must not be null");
|
|
return new k<>(looper, t, name);
|
|
}
|
|
}
|