正在查看: BodyTech v7.6.4 应用的 f.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: BodyTech v7.6.4 应用的 f.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package qf;
import android.content.Context;
import androidx.fragment.app.FragmentActivity;
import com.android.volley.NetworkResponse;
import com.android.volley.Request;
import com.android.volley.RequestQueue;
import com.android.volley.Response;
import com.android.volley.VolleyError;
import com.android.volley.toolbox.Volley;
import com.fitnessmobileapps.fma.Application;
import com.google.gson.Gson;
import com.mindbodyonline.android.auth.okhttp.domain.model.OAuthBasicToken;
import com.mindbodyonline.android.util.TaskCallback;
import com.mindbodyonline.domain.RefreshTokenModel;
import com.mindbodyonline.domain.Token;
import com.newrelic.agent.android.instrumentation.GsonInstrumentation;
import com.newrelic.agent.android.instrumentation.Instrumented;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.concurrent.atomic.AtomicBoolean;
import kotlin.Lazy;
import org.koin.java.KoinJavaComponent;
import t1.v;
import vf.o;
@Instrumented
public class f implements hf.d {
private static FragmentActivity j;
private static boolean k;
private static f l;
private static final Lazy<com.mindbodyonline.data.services.b> m = KoinJavaComponent.e(com.mindbodyonline.data.services.b.class);
private RequestQueue a;
private qf.b c;
private g d;
private j e;
private qf.a f;
private ArrayList<ff.c<?>> g = new ArrayList<>();
private AtomicBoolean h = new AtomicBoolean(false);
private List<TaskCallback<hf.b>> i = new ArrayList();
private Gson b = new Gson();
class a implements Response.Listener<Token> {
final Token.TokenState c;
final Response.Listener d;
final Response.ErrorListener e;
a(Token.TokenState tokenState, Response.Listener listener, Response.ErrorListener errorListener) {
this.c = tokenState;
this.d = listener;
this.e = errorListener;
}
public void onResponse(Token token) {
if (token == null || token.getAccessToken() == null) {
mo.a.d("ERROR Refreshing user token: invalid response", new Object[0]);
this.e.onErrorResponse(new VolleyError(new NetworkResponse(500, (byte[]) null, false, 0L, (List) null)));
f.this.u("app", "use-refresh-token", "failed", "ERROR Refreshing user token: invalid response");
} else {
token.timeStamp();
token.setState(this.c);
mo.a.d("Refresh Token received: token= %s", new Object[]{token.toString()});
if (this.c == Token.TokenState.User) {
f.l().f(token);
} else {
f.l().e(token);
}
f.this.u("app", "use-refresh-token", "completed", null);
this.d.onResponse(token);
}
f.this.w();
}
}
class b implements Response.ErrorListener {
final Response.ErrorListener c;
b(Response.ErrorListener errorListener) {
this.c = errorListener;
}
public void onErrorResponse(VolleyError volleyError) {
mo.a.d("ERROR Refreshing user token", new Object[0]);
this.c.onErrorResponse(volleyError);
f.this.w();
}
}
class c implements Response.Listener<hf.b> {
final ff.c c;
c(ff.c cVar) {
this.c = cVar;
}
public void onResponse(hf.b bVar) {
f.k = false;
this.c.f(OAuthBasicToken.OAUTH_HEADER_KEY, "Bearer " + bVar.getAccessToken());
f.this.a.add(this.c);
}
}
class d implements Response.ErrorListener {
final ff.c c;
final Context d;
d(ff.c cVar, Context context) {
this.c = cVar;
this.d = context;
}
public void onErrorResponse(VolleyError volleyError) {
Token d = f.l().d();
if (d != null && !d.needsRefresh()) {
this.c.f(OAuthBasicToken.OAUTH_HEADER_KEY, "Bearer " + d.getAccessToken());
f.this.a.add(this.c);
return;
}
if (!of.c.a(this.d)) {
this.c.deliverError(volleyError);
return;
}
HashMap hashMap = new HashMap();
hashMap.put("Action", "TokenExpired");
com.fitnessmobileapps.fma.util.f.b().l("Auth", hashMap);
mo.a.d("Token received from refresh call is null, user must log out.", new Object[0]);
this.c.deliverError(new VolleyError(new NetworkResponse(401, (byte[]) null, false, 0L, (List) null)));
}
}
private f() {
o(Application.d());
}
public static FragmentActivity j() {
return j;
}
public static com.mindbodyonline.data.services.b l() {
return (com.mindbodyonline.data.services.b) m.getValue();
}
public static synchronized f n() {
f fVar;
synchronized (f.class) {
try {
if (l == null) {
l = new f();
}
fVar = l;
} catch (Throwable th) {
throw th;
}
}
return fVar;
}
public synchronized void u(String str, String str2, String str3, String str4) {
try {
HashMap hashMap = new HashMap();
if (str4 != null) {
hashMap.put(o.f.b, str4);
}
a2.a.u(OAuthBasicToken.OAUTH_HEADER_KEY, "authorization", str, "app", str2, str3, hashMap);
} catch (Throwable th) {
throw th;
}
}
public static synchronized void v(FragmentActivity fragmentActivity) {
synchronized (f.class) {
j = fragmentActivity;
}
}
@Override
public void a(TaskCallback taskCallback) {
if (this.i.contains(taskCallback)) {
return;
}
this.i.add(taskCallback);
}
@Override
public boolean b() {
return this.h.get();
}
@Override
public synchronized void c(Response.Listener<hf.b> listener, Response.ErrorListener errorListener) {
Token d2 = l().d();
if (d2 == null) {
errorListener.onErrorResponse(new VolleyError(new NetworkResponse(401, (byte[]) null, false, 0L, (List) null)));
return;
}
if (d2.needsRefresh()) {
this.h.set(true);
u("app", "use-access-token", "failed", "Token expired or null");
u("app", "use-refresh-token", "started", null);
Token.TokenState state = d2.getState();
mo.a.d("Refreshing %1$s token...", new Object[]{state.name()});
t(1, of.a.r(), Token.class, of.a.g(), v.a(new RefreshTokenModel(d2.getRefreshToken())), new a(state, listener, errorListener), new b(errorListener));
} else {
listener.onResponse(d2);
}
}
public <T> ff.b<T> h(int i, String str, Class<T> cls, Map<String, String> map, Object obj, Response.Listener<T> listener, Response.ErrorListener errorListener) {
String z;
if (obj == null) {
z = null;
} else {
Gson k2 = k();
z = !(k2 instanceof Gson) ? k2.z(obj) : GsonInstrumentation.toJson(k2, obj);
}
return new ff.b<>(i, str, cls, map, z, listener, errorListener);
}
public synchronized void i() {
try {
Token d2 = l().d();
if (d2 != null) {
Iterator<ff.c<?>> it = this.g.iterator();
while (it.hasNext()) {
ff.c<?> next = it.next();
next.f(OAuthBasicToken.OAUTH_HEADER_KEY, "Bearer " + d2.getAccessToken());
this.a.add(next);
}
this.g.clear();
Iterator<TaskCallback<hf.b>> it2 = this.i.iterator();
while (it2.hasNext()) {
it2.next().a(d2);
}
}
} catch (Throwable th) {
throw th;
}
}
public Gson k() {
return this.b;
}
public RequestQueue m() {
if (this.a == null) {
o(Application.d());
}
return this.a;
}
public void o(Context context) {
this.a = Volley.newRequestQueue(context);
}
public synchronized qf.a p() {
try {
if (this.f == null) {
this.f = new qf.a(this);
}
} catch (Throwable th) {
throw th;
}
return this.f;
}
public synchronized qf.b q() {
try {
if (this.c == null) {
this.c = new qf.b(this);
}
} catch (Throwable th) {
throw th;
}
return this.c;
}
public synchronized g r() {
try {
if (this.d == null) {
this.d = new g(this);
}
} catch (Throwable th) {
throw th;
}
return this.d;
}
public synchronized j s() {
try {
if (this.e == null) {
this.e = new j(this);
}
} catch (Throwable th) {
throw th;
}
return this.e;
}
public <T> Request<T> t(int i, String str, Class<T> cls, Map<String, String> map, Map<String, String> map2, Response.Listener<T> listener, Response.ErrorListener errorListener) {
ff.a aVar = new ff.a(i, str, cls, map, map2, listener, errorListener);
this.a.add(aVar);
return aVar;
}
public void w() {
this.h.set(false);
i();
}
public <T> ff.b<T> x(int i, String str, Class<T> cls, Map<String, String> map, Response.Listener<T> listener, Response.ErrorListener errorListener) {
return y(i, str, cls, map, null, listener, errorListener);
}
public <T> ff.b<T> y(int i, String str, Class<T> cls, Map<String, String> map, Object obj, Response.Listener<T> listener, Response.ErrorListener errorListener) {
ff.b<T> h = h(i, str, cls, map, obj, listener, errorListener);
z(h, Application.d());
return h;
}
public synchronized void z(ff.c cVar, Context context) {
Token d2 = l().d();
if (d2 == null) {
cVar.deliverError(new VolleyError(new NetworkResponse(401, (byte[]) null, false, 0L, (List) null)));
return;
}
boolean needsRefresh = d2.needsRefresh();
boolean b2 = b();
if (!needsRefresh || !b2) {
c(new c(cVar), new d(cVar, context));
} else {
mo.a.d("Queueing request: %s", new Object[]{cVar.getUrl()});
this.g.add(cVar);
}
}
}