正在查看: Aisle v12.32 应用的 m.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: Aisle v12.32 应用的 m.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package F8;
import F8.b;
import F8.d;
import F8.h;
import G8.a;
import com.google.android.gms.tasks.OnFailureListener;
import com.google.android.gms.tasks.OnSuccessListener;
import com.google.android.gms.tasks.Task;
import com.google.android.gms.tasks.TaskCompletionSource;
import com.google.android.gms.tasks.Tasks;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.TimeUnit;
public class m implements b.a, F8.h {
private static long H;
private String A;
private long F;
private boolean G;
private final h.a a;
private final F8.f b;
private String c;
private long f;
private F8.b g;
private Map l;
private List m;
private Map n;
private Map o;
private Map p;
private String q;
private boolean r;
private String s;
private boolean t;
private final F8.c u;
private final F8.d v;
private final F8.d w;
private final ScheduledExecutorService x;
private final O8.c y;
private final G8.a z;
private HashSet d = new HashSet();
private boolean e = true;
private j h = j.Disconnected;
private long i = 0;
private long j = 0;
private long k = 0;
private long B = 0;
private int C = 0;
private int D = 0;
private ScheduledFuture E = null;
class a implements d.a {
final TaskCompletionSource a;
a(TaskCompletionSource taskCompletionSource) {
this.a = taskCompletionSource;
}
@Override
public void a(String str) {
this.a.setException(new Exception(str));
}
@Override
public void onSuccess(String str) {
this.a.setResult(str);
}
}
class b implements d.a {
final TaskCompletionSource a;
b(TaskCompletionSource taskCompletionSource) {
this.a = taskCompletionSource;
}
@Override
public void a(String str) {
this.a.setException(new Exception(str));
}
@Override
public void onSuccess(String str) {
this.a.setResult(str);
}
}
class c implements i {
final boolean a;
c(boolean z) {
this.a = z;
}
@Override
public void a(Map map) {
String str = (String) map.get("s");
if (str.equals("ok")) {
m.this.h = j.Connected;
m.this.C = 0;
m.this.l0(this.a);
return;
}
m.this.q = null;
m.this.r = true;
m.this.a.b(false);
String str2 = (String) map.get("d");
m.this.y.b("Authentication failed: " + str + " (" + str2 + ")", new Object[0]);
m.this.g.c();
if (str.equals("invalid_token")) {
m.v(m.this);
if (m.this.C >= 3) {
m.this.z.d();
m.this.y.i("Provided authentication credentials are invalid. This usually indicates your FirebaseApp instance was not initialized correctly. Make sure your google-services.json file has the correct firebase_url and api_key. You can re-download google-services.json from https://console.firebase.google.com/.");
}
}
}
}
class d implements i {
final String a;
final long b;
final C0026m c;
final o d;
d(String str, long j, C0026m c0026m, o oVar) {
this.a = str;
this.b = j;
this.c = c0026m;
this.d = oVar;
}
@Override
public void a(Map map) {
if (m.this.y.f()) {
m.this.y.b(this.a + " response: " + map, new Object[0]);
}
if (((C0026m) m.this.n.get(Long.valueOf(this.b))) == this.c) {
m.this.n.remove(Long.valueOf(this.b));
if (this.d != null) {
String str = (String) map.get("s");
if (str.equals("ok")) {
this.d.a(null, null);
} else {
this.d.a(str, (String) map.get("d"));
}
}
} else if (m.this.y.f()) {
m.this.y.b("Ignoring on complete for put " + this.b + " because it was removed already.", new Object[0]);
}
m.this.Q();
}
}
class e implements i {
final Long a;
e(Long l, k kVar) {
this.a = l;
}
@Override
public void a(Map map) {
android.support.v4.media.session.b.a(m.this.o.get(this.a));
m.this.o.remove(this.a);
k.c(null).a(map);
}
}
class f implements i {
final l a;
f(l lVar) {
this.a = lVar;
}
@Override
public void a(Map map) {
String str = (String) map.get("s");
if (str.equals("ok")) {
Map map2 = (Map) map.get("d");
if (map2.containsKey("w")) {
m.this.B0((List) map2.get("w"), this.a.b);
}
}
if (((l) m.this.p.get(this.a.d())) == this.a) {
if (str.equals("ok")) {
this.a.a.a(null, null);
return;
}
m.this.g0(this.a.d());
this.a.a.a(str, (String) map.get("d"));
}
}
}
class g implements i {
g() {
}
@Override
public void a(Map map) {
String str = (String) map.get("s");
if (str.equals("ok")) {
return;
}
String str2 = (String) map.get("d");
if (m.this.y.f()) {
m.this.y.b("Failed to send stats: " + str + " (message: " + str2 + ")", new Object[0]);
}
}
}
class h implements Runnable {
h() {
}
@Override
public void run() {
m.this.E = null;
if (m.this.V()) {
m.this.d("connection_idle");
} else {
m.this.Q();
}
}
}
interface i {
void a(Map map);
}
enum j {
Disconnected,
GettingToken,
Connecting,
Authenticating,
Connected
}
private static class k {
static boolean a(k kVar) {
throw null;
}
static Map b(k kVar) {
throw null;
}
static i c(k kVar) {
throw null;
}
}
private static class l {
private final o a;
private final n b;
private final F8.g c;
private final Long d;
l(o oVar, n nVar, Long l, F8.g gVar, a aVar) {
this(oVar, nVar, l, gVar);
}
public F8.g c() {
return this.c;
}
public n d() {
return this.b;
}
public Long e() {
return this.d;
}
public String toString() {
return this.b.toString() + " (Tag: " + this.d + ")";
}
private l(o oVar, n nVar, Long l, F8.g gVar) {
this.a = oVar;
this.b = nVar;
this.c = gVar;
this.d = l;
}
}
private static class C0026m {
private String a;
private Map b;
private o c;
private boolean d;
C0026m(String str, Map map, o oVar, a aVar) {
this(str, map, oVar);
}
public String a() {
return this.a;
}
public o b() {
return this.c;
}
public Map c() {
return this.b;
}
public void d() {
this.d = true;
}
public boolean e() {
return this.d;
}
private C0026m(String str, Map map, o oVar) {
this.a = str;
this.b = map;
this.c = oVar;
}
}
private static class n {
private final List a;
private final Map b;
public n(List list, Map map) {
this.a = list;
this.b = map;
}
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (!(obj instanceof n)) {
return false;
}
n nVar = (n) obj;
if (this.a.equals(nVar.a)) {
return this.b.equals(nVar.b);
}
return false;
}
public int hashCode() {
return (this.a.hashCode() * 31) + this.b.hashCode();
}
public String toString() {
return F8.e.d(this.a) + " (params: " + this.b + ")";
}
}
public m(F8.c cVar, F8.f fVar, h.a aVar) {
this.a = aVar;
this.u = cVar;
ScheduledExecutorService e2 = cVar.e();
this.x = e2;
this.v = cVar.c();
this.w = cVar.a();
this.b = fVar;
this.p = new HashMap();
this.l = new HashMap();
this.n = new HashMap();
this.o = new ConcurrentHashMap();
this.m = new ArrayList();
this.z = new a.b(e2, cVar.f(), "ConnectionRetryHelper").d(1000L).e(1.3d).c(30000L).b(0.7d).a();
long j2 = H;
H = 1 + j2;
this.y = new O8.c(cVar.f(), "PersistentConnection", "pc_" + j2);
this.A = null;
Q();
}
private void A0() {
n0(false);
}
public void B0(List list, n nVar) {
if (list.contains("no_index")) {
String str = "\".indexOn\": \"" + nVar.b.get("i") + '\"';
this.y.i("Using an unspecified index. Your data will be downloaded and filtered on the client. Consider adding '" + str + "' at " + F8.e.d(nVar.a) + " to your security and Firebase Database rules for better performance");
}
}
private boolean M() {
return this.h == j.Connected;
}
private boolean N() {
return this.h == j.Connected;
}
private void O() {
ArrayList arrayList = new ArrayList();
Iterator it = this.n.entrySet().iterator();
while (it.hasNext()) {
C0026m c0026m = (C0026m) ((Map.Entry) it.next()).getValue();
if (c0026m.c().containsKey("h") && c0026m.e()) {
arrayList.add(c0026m);
it.remove();
}
}
int size = arrayList.size();
int i2 = 0;
while (i2 < size) {
Object obj = arrayList.get(i2);
i2++;
((C0026m) obj).b().a("disconnected", null);
}
}
private boolean P() {
j jVar = this.h;
return jVar == j.Authenticating || jVar == j.Connected;
}
public void Q() {
if (W()) {
ScheduledFuture scheduledFuture = this.E;
if (scheduledFuture != null) {
scheduledFuture.cancel(false);
}
this.E = this.x.schedule(new h(), 60000L, TimeUnit.MILLISECONDS);
return;
}
if (X("connection_idle")) {
F8.e.a(!W());
g("connection_idle");
}
}
private Task R(boolean z) {
TaskCompletionSource taskCompletionSource = new TaskCompletionSource();
this.y.b("Trying to fetch app check token", new Object[0]);
this.w.a(z, new b(taskCompletionSource));
return taskCompletionSource.getTask();
}
private Task S(boolean z) {
TaskCompletionSource taskCompletionSource = new TaskCompletionSource();
this.y.b("Trying to fetch auth token", new Object[0]);
this.v.a(z, new a(taskCompletionSource));
return taskCompletionSource.getTask();
}
private Map T(List list, Object obj, String str) {
HashMap hashMap = new HashMap();
hashMap.put("p", F8.e.d(list));
hashMap.put("d", obj);
if (str != null) {
hashMap.put("h", str);
}
return hashMap;
}
private void U(long j2) {
if (this.y.f()) {
this.y.b("handling timestamp", new Object[0]);
}
long currentTimeMillis = j2 - System.currentTimeMillis();
HashMap hashMap = new HashMap();
hashMap.put("serverTimeOffset", Long.valueOf(currentTimeMillis));
this.a.d(hashMap);
}
public boolean V() {
return W() && System.currentTimeMillis() > this.F + 60000;
}
private boolean W() {
return this.p.isEmpty() && this.o.isEmpty() && this.l.isEmpty() && !this.G && this.n.isEmpty();
}
private long Y() {
long j2 = this.k;
this.k = 1 + j2;
return j2;
}
private void Z(String str, String str2) {
this.y.b("App check token revoked: " + str + " (" + str2 + ")", new Object[0]);
this.s = null;
this.t = true;
}
private void a0(String str, String str2) {
this.y.b("Auth token revoked: " + str + " (" + str2 + ")", new Object[0]);
this.q = null;
this.r = true;
this.a.b(false);
this.g.c();
}
private void b0(String str, Map map) {
if (this.y.f()) {
this.y.b("handleServerMessage: " + str + " " + map, new Object[0]);
}
if (str.equals("d") || str.equals("m")) {
boolean equals = str.equals("m");
String str2 = (String) map.get("p");
Object obj = map.get("d");
Long c2 = F8.e.c(map.get("t"));
if (!equals || !(obj instanceof Map) || ((Map) obj).size() != 0) {
this.a.a(F8.e.e(str2), obj, equals, c2);
return;
}
if (this.y.f()) {
this.y.b("ignoring empty merge for path " + str2, new Object[0]);
return;
}
return;
}
if (!str.equals("rm")) {
if (str.equals("c")) {
c0(F8.e.e((String) map.get("p")));
return;
}
if (str.equals("ac")) {
a0((String) map.get("s"), (String) map.get("d"));
return;
}
if (str.equals("apc")) {
Z((String) map.get("s"), (String) map.get("d"));
return;
}
if (str.equals("sd")) {
d0(map);
return;
}
if (this.y.f()) {
this.y.b("Unrecognized action from server: " + str, new Object[0]);
return;
}
return;
}
String str3 = (String) map.get("p");
List e2 = F8.e.e(str3);
Object obj2 = map.get("d");
Long c3 = F8.e.c(map.get("t"));
ArrayList arrayList = new ArrayList();
for (Map map2 : (List) obj2) {
String str4 = (String) map2.get("s");
String str5 = (String) map2.get("e");
List list = null;
List e3 = str4 != null ? F8.e.e(str4) : null;
if (str5 != null) {
list = F8.e.e(str5);
}
arrayList.add(new F8.n(e3, list, map2.get("m")));
}
if (!arrayList.isEmpty()) {
this.a.f(e2, arrayList, c3);
return;
}
if (this.y.f()) {
this.y.b("Ignoring empty range merge for path " + str3, new Object[0]);
}
}
private void c0(List list) {
Collection h0 = h0(list);
if (h0 != null) {
Iterator it = h0.iterator();
while (it.hasNext()) {
((l) it.next()).a.a("permission_denied", null);
}
}
}
private void d0(Map map) {
this.y.e((String) map.get("msg"));
}
private void f0(String str, List list, Object obj, String str2, o oVar) {
Map T = T(list, obj, str2);
long j2 = this.i;
this.i = 1 + j2;
this.n.put(Long.valueOf(j2), new C0026m(str, T, oVar, null));
if (N()) {
r0(j2);
}
this.F = System.currentTimeMillis();
Q();
}
public l g0(n nVar) {
if (this.y.f()) {
this.y.b("removing query " + nVar, new Object[0]);
}
if (this.p.containsKey(nVar)) {
l lVar = (l) this.p.get(nVar);
this.p.remove(nVar);
Q();
return lVar;
}
if (!this.y.f()) {
return null;
}
this.y.b("Trying to remove listener for QuerySpec " + nVar + " but no listener exists.", new Object[0]);
return null;
}
private Collection h0(List list) {
int i2 = 0;
if (this.y.f()) {
this.y.b("removing all listens at path " + list, new Object[0]);
}
ArrayList arrayList = new ArrayList();
for (Map.Entry entry : this.p.entrySet()) {
n nVar = (n) entry.getKey();
l lVar = (l) entry.getValue();
if (nVar.a.equals(list)) {
arrayList.add(lVar);
}
}
int size = arrayList.size();
while (i2 < size) {
Object obj = arrayList.get(i2);
i2++;
this.p.remove(((l) obj).d());
}
Q();
return arrayList;
}
private void i0() {
j jVar = this.h;
int i2 = 0;
F8.e.b(jVar == j.Connected, "Should be connected if we're restoring state, but we are: %s", jVar);
if (this.y.f()) {
this.y.b("Restoring outstanding listens", new Object[0]);
}
for (l lVar : this.p.values()) {
if (this.y.f()) {
this.y.b("Restoring listen " + lVar.d(), new Object[0]);
}
q0(lVar);
}
if (this.y.f()) {
this.y.b("Restoring writes.", new Object[0]);
}
ArrayList arrayList = new ArrayList(this.n.keySet());
Collections.sort(arrayList);
int size = arrayList.size();
int i3 = 0;
while (i3 < size) {
Object obj = arrayList.get(i3);
i3++;
r0(((Long) obj).longValue());
}
Iterator it = this.m.iterator();
if (it.hasNext()) {
android.support.v4.media.session.b.a(it.next());
throw null;
}
this.m.clear();
if (this.y.f()) {
this.y.b("Restoring reads.", new Object[0]);
}
ArrayList arrayList2 = new ArrayList(this.o.keySet());
Collections.sort(arrayList2);
int size2 = arrayList2.size();
while (i2 < size2) {
Object obj2 = arrayList2.get(i2);
i2++;
p0((Long) obj2);
}
}
private void j0() {
if (this.y.f()) {
this.y.b("calling restore tokens", new Object[0]);
}
j jVar = this.h;
F8.e.b(jVar == j.Connecting, "Wanted to restore tokens, but was in wrong state: %s", jVar);
if (this.q != null) {
if (this.y.f()) {
this.y.b("Restoring auth.", new Object[0]);
}
this.h = j.Authenticating;
m0();
return;
}
if (this.y.f()) {
this.y.b("Not restoring auth because auth token is null.", new Object[0]);
}
this.h = j.Connected;
l0(true);
}
private void k0(String str, Map map, i iVar) {
s0(str, false, map, iVar);
}
public void l0(final boolean z) {
if (this.s == null) {
i0();
return;
}
F8.e.b(P(), "Must be connected to send auth, but was: %s", this.h);
if (this.y.f()) {
this.y.b("Sending app check.", new Object[0]);
}
i iVar = new i() {
@Override
public final void a(Map map) {
m.p(m.this, z, map);
}
};
HashMap hashMap = new HashMap();
F8.e.b(this.s != null, "App check token must be set!", new Object[0]);
hashMap.put("token", this.s);
s0("appcheck", true, hashMap, iVar);
}
private void m0() {
n0(true);
}
private void n0(boolean z) {
F8.e.b(P(), "Must be connected to send auth, but was: %s", this.h);
if (this.y.f()) {
this.y.b("Sending auth.", new Object[0]);
}
c cVar = new c(z);
HashMap hashMap = new HashMap();
R8.a c2 = R8.a.c(this.q);
if (c2 == null) {
hashMap.put("cred", this.q);
s0("auth", true, hashMap, cVar);
} else {
hashMap.put("cred", c2.b());
if (c2.a() != null) {
hashMap.put("authvar", c2.a());
}
s0("gauth", true, hashMap, cVar);
}
}
private void o0() {
HashMap hashMap = new HashMap();
if (this.u.i()) {
hashMap.put("persistence.android.enabled", 1);
}
hashMap.put("sdk.android." + this.u.d().replace('.', '-'), 1);
if (this.y.f()) {
this.y.b("Sending first connection stats", new Object[0]);
}
t0(hashMap);
}
public static void p(m mVar, boolean z, Map map) {
mVar.getClass();
String str = (String) map.get("s");
if (str.equals("ok")) {
mVar.D = 0;
} else {
mVar.s = null;
mVar.t = true;
String str2 = (String) map.get("d");
mVar.y.b("App check failed: " + str + " (" + str2 + ")", new Object[0]);
}
if (z) {
mVar.i0();
}
}
private void p0(Long l2) {
F8.e.b(M(), "sendGet called when we can't send gets", new Object[0]);
android.support.v4.media.session.b.a(this.o.get(l2));
if (k.a(null) || !this.y.f()) {
k0("g", k.b(null), new e(l2, null));
return;
}
this.y.b("get" + l2 + " cancelled, ignoring.", new Object[0]);
}
public static void q(m mVar, long j2, Task task, Task task2, Void r72) {
if (j2 != mVar.B) {
mVar.y.b("Ignoring getToken result, because this was not the latest attempt.", new Object[0]);
return;
}
j jVar = mVar.h;
if (jVar == j.GettingToken) {
mVar.y.b("Successfully fetched token, opening connection", new Object[0]);
mVar.e0((String) task.getResult(), (String) task2.getResult());
} else if (jVar == j.Disconnected) {
mVar.y.b("Not opening connection after token refresh, because connection was set to disconnected", new Object[0]);
}
}
private void q0(l lVar) {
HashMap hashMap = new HashMap();
hashMap.put("p", F8.e.d(lVar.d().a));
Long e2 = lVar.e();
if (e2 != null) {
hashMap.put("q", lVar.b.b);
hashMap.put("t", e2);
}
F8.g c2 = lVar.c();
hashMap.put("h", c2.d());
if (c2.c()) {
F8.a b2 = c2.b();
ArrayList arrayList = new ArrayList();
Iterator it = b2.b().iterator();
while (it.hasNext()) {
arrayList.add(F8.e.d((List) it.next()));
}
HashMap hashMap2 = new HashMap();
hashMap2.put("hs", b2.a());
hashMap2.put("ps", arrayList);
hashMap.put("ch", hashMap2);
}
k0("q", hashMap, new f(lVar));
}
public static void r(final m mVar, boolean z, boolean z2) {
j jVar = mVar.h;
F8.e.b(jVar == j.Disconnected, "Not in disconnected state: %s", jVar);
mVar.h = j.GettingToken;
final long j2 = mVar.B + 1;
mVar.B = j2;
final Task S = mVar.S(z);
final Task R = mVar.R(z2);
Tasks.whenAll((Task<?>[]) new Task[]{S, R}).addOnSuccessListener(mVar.x, new OnSuccessListener() {
@Override
public final void onSuccess(Object obj) {
m.q(m.this, j2, S, R, (Void) obj);
}
}).addOnFailureListener(mVar.x, new OnFailureListener() {
@Override
public final void onFailure(Exception exc) {
m.s(m.this, j2, exc);
}
});
}
private void r0(long j2) {
F8.e.b(N(), "sendPut called when we can't send writes (we're disconnected or writes are paused).", new Object[0]);
C0026m c0026m = (C0026m) this.n.get(Long.valueOf(j2));
o b2 = c0026m.b();
String a2 = c0026m.a();
c0026m.d();
k0(a2, c0026m.c(), new d(a2, j2, c0026m, b2));
}
public static void s(m mVar, long j2, Exception exc) {
if (j2 != mVar.B) {
mVar.y.b("Ignoring getToken error, because this was not the latest attempt.", new Object[0]);
return;
}
mVar.h = j.Disconnected;
mVar.y.b("Error fetching token: " + exc, new Object[0]);
mVar.y0();
}
private void s0(String str, boolean z, Map map, i iVar) {
long Y = Y();
HashMap hashMap = new HashMap();
hashMap.put("r", Long.valueOf(Y));
hashMap.put("a", str);
hashMap.put("b", map);
this.g.m(hashMap, z);
this.l.put(Long.valueOf(Y), iVar);
}
private void t0(Map map) {
if (map.isEmpty()) {
if (this.y.f()) {
this.y.b("Not sending stats because stats are empty", new Object[0]);
}
} else {
HashMap hashMap = new HashMap();
hashMap.put("c", map);
k0("s", hashMap, new g());
}
}
private void u0() {
F8.e.b(P(), "Must be connected to send unauth.", new Object[0]);
F8.e.b(this.s == null, "App check token must not be set.", new Object[0]);
k0("unappcheck", Collections.EMPTY_MAP, null);
}
static int v(m mVar) {
int i2 = mVar.C;
mVar.C = i2 + 1;
return i2;
}
private void v0() {
F8.e.b(P(), "Must be connected to send unauth.", new Object[0]);
F8.e.b(this.q == null, "Auth token must not be set.", new Object[0]);
k0("unauth", Collections.EMPTY_MAP, null);
}
private void w0(l lVar) {
HashMap hashMap = new HashMap();
hashMap.put("p", F8.e.d(lVar.b.a));
Long e2 = lVar.e();
if (e2 != null) {
hashMap.put("q", lVar.d().b);
hashMap.put("t", e2);
}
k0("n", hashMap, null);
}
private void y0() {
if (x0()) {
j jVar = this.h;
F8.e.b(jVar == j.Disconnected, "Not in disconnected state: %s", jVar);
final boolean z = this.r;
final boolean z2 = this.t;
this.y.b("Scheduling connection attempt", new Object[0]);
this.r = false;
this.t = false;
this.z.c(new Runnable() {
@Override
public final void run() {
m.r(m.this, z, z2);
}
});
}
}
private void z0() {
l0(false);
}
public boolean X(String str) {
return this.d.contains(str);
}
@Override
public void a() {
y0();
}
@Override
public void b(List list, Map map, F8.g gVar, Long l2, o oVar) {
n nVar = new n(list, map);
if (this.y.f()) {
this.y.b("Listening on " + nVar, new Object[0]);
}
F8.e.b(!this.p.containsKey(nVar), "listen() called twice for same QuerySpec.", new Object[0]);
if (this.y.f()) {
this.y.b("Adding listen query: " + nVar, new Object[0]);
}
l lVar = new l(oVar, nVar, l2, gVar, null);
this.p.put(nVar, lVar);
if (P()) {
q0(lVar);
}
Q();
}
@Override
public void c(b.EnumC0025b enumC0025b) {
boolean z = false;
if (this.y.f()) {
this.y.b("Got on disconnect due to " + enumC0025b.name(), new Object[0]);
}
this.h = j.Disconnected;
this.g = null;
this.G = false;
this.l.clear();
O();
if (x0()) {
long currentTimeMillis = System.currentTimeMillis();
long j2 = this.f;
long j3 = currentTimeMillis - j2;
if (j2 > 0 && j3 > 30000) {
z = true;
}
if (enumC0025b == b.EnumC0025b.SERVER_RESET || z) {
this.z.e();
}
y0();
}
this.f = 0L;
this.a.e();
}
@Override
public void d(String str) {
if (this.y.f()) {
this.y.b("Connection interrupted for: " + str, new Object[0]);
}
this.d.add(str);
F8.b bVar = this.g;
if (bVar != null) {
bVar.c();
this.g = null;
} else {
this.z.b();
this.h = j.Disconnected;
}
this.z.e();
}
@Override
public void e(List list, Object obj, String str, o oVar) {
f0("p", list, obj, str, oVar);
}
public void e0(String str, String str2) {
j jVar = this.h;
F8.e.b(jVar == j.GettingToken, "Trying to open network connection while in the wrong state: %s", jVar);
if (str == null) {
this.a.b(false);
}
this.q = str;
this.s = str2;
this.h = j.Connecting;
F8.b bVar = new F8.b(this.u, this.b, this.c, this, this.A, str2);
this.g = bVar;
bVar.k();
}
@Override
public void f(String str) {
this.c = str;
}
@Override
public void g(String str) {
if (this.y.f()) {
this.y.b("Connection no longer interrupted for: " + str, new Object[0]);
}
this.d.remove(str);
if (x0() && this.h == j.Disconnected) {
y0();
}
}
@Override
public void h(String str) {
if (str.equals("Invalid appcheck token")) {
int i2 = this.D;
if (i2 < 3) {
this.D = i2 + 1;
this.y.i("Detected invalid AppCheck token. Reconnecting (" + (3 - this.D) + " attempts remaining)");
return;
}
}
this.y.i("Firebase Database connection was forcefully killed by the server. Will not attempt reconnect. Reason: " + str);
d("server_kill");
}
@Override
public void i(List list, Object obj, o oVar) {
f0("p", list, obj, null, oVar);
}
@Override
public void j(long j2, String str) {
if (this.y.f()) {
this.y.b("onReady", new Object[0]);
}
this.f = System.currentTimeMillis();
U(j2);
if (this.e) {
o0();
}
j0();
this.e = false;
this.A = str;
this.a.c();
}
@Override
public void k(String str) {
this.y.b("Auth token refreshed.", new Object[0]);
this.q = str;
if (P()) {
if (str != null) {
A0();
} else {
v0();
}
}
}
@Override
public void l(List list, Map map, o oVar) {
f0("m", list, map, null, oVar);
}
@Override
public void m(String str) {
this.y.b("App check token refreshed.", new Object[0]);
this.s = str;
if (P()) {
if (str != null) {
z0();
} else {
u0();
}
}
}
@Override
public void n(Map map) {
if (map.containsKey("r")) {
i iVar = (i) this.l.remove(Long.valueOf(((Integer) map.get("r")).intValue()));
if (iVar != null) {
iVar.a((Map) map.get("b"));
return;
}
return;
}
if (map.containsKey("error")) {
return;
}
if (map.containsKey("a")) {
b0((String) map.get("a"), (Map) map.get("b"));
return;
}
if (this.y.f()) {
this.y.b("Ignoring unknown message: " + map, new Object[0]);
}
}
@Override
public void o(List list, Map map) {
n nVar = new n(list, map);
if (this.y.f()) {
this.y.b("unlistening on " + nVar, new Object[0]);
}
l g0 = g0(nVar);
if (g0 != null && P()) {
w0(g0);
}
Q();
}
boolean x0() {
return this.d.size() == 0;
}
}