正在查看: Tasker v6.5.11 应用的 d.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: Tasker v6.5.11 应用的 d.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package eg;
import android.content.Context;
import android.content.SharedPreferences;
import android.net.Uri;
import com.joaomgcd.taskerm.net.auth.AuthInfo;
import com.joaomgcd.taskerm.util.x2;
import com.joaomgcd.taskerservercommon.ConstantsCommonTaskerServer;
import dg.j;
import dg.m;
import dg.t;
import eg.b;
import java.net.HttpURLConnection;
import java.util.HashMap;
import java.util.List;
import java.util.UUID;
import ji.r;
import kotlin.Pair;
import kotlin.collections.k0;
import lj.e0;
import lj.o;
import org.json.JSONObject;
import pg.w0;
import xj.l;
import yj.p;
import yj.q;
public final class d implements eg.b {
private final Context a;
private final String b;
private final String c;
private final String d;
private final String e;
private final String[] f;
private final h g;
private final boolean h;
public class a {
public static final int[] a;
static {
int[] iArr = new int[h.values().length];
try {
iArr[h.q.ordinal()] = 1;
} catch (NoSuchFieldError unused) {
}
try {
iArr[h.r.ordinal()] = 2;
} catch (NoSuchFieldError unused2) {
}
a = iArr;
}
}
static final class b extends q implements xj.a<g> {
final long q;
public static final class a extends g {
final AuthInfo a;
a(AuthInfo authInfo) {
this.a = authInfo;
}
@Override
public void a(HashMap<String, String> hashMap) {
p.i(hashMap, "headers");
hashMap.put(this.a.getAuthHeaderKey(), this.a.getAuthHeaderValue());
}
}
b(long j) {
super(0);
this.q = j;
}
@Override
public final g invoke() {
AuthInfo t = d.this.h ? null : d.this.t();
if (t == null) {
t = d.this.j(this.q);
} else if (t.isExpired()) {
t = d.this.k(t, this.q);
}
d.this.w(t);
return new a(t);
}
}
public static final class c<T> implements oi.g {
public static final c<T> a = new c<>();
@Override
public final boolean a(Object obj) {
p.i(obj, "it");
return obj instanceof eg.a;
}
}
static final class e extends q implements l<HttpURLConnection, e0> {
final boolean i;
final d q;
e(boolean z, d dVar) {
super(1);
this.i = z;
this.q = dVar;
}
public final void a(HttpURLConnection httpURLConnection) {
p.i(httpURLConnection, "it");
if (this.i) {
d dVar = this.q;
String l = dVar.l(dVar.b, this.q.c);
p.h(l, "base64EncodeUserPass(...)");
x2.c4(httpURLConnection, l);
}
x2.f4(httpURLConnection, this.q.g.d());
}
@Override
public e0 invoke(HttpURLConnection httpURLConnection) {
a(httpURLConnection);
return e0.a;
}
}
public d(Context context, String str, String str2, String str3, String str4, String[] strArr, h hVar, boolean z) {
p.i(context, "context");
p.i(str, "clientId");
p.i(str2, "clientSecret");
p.i(str3, "endpointCode");
p.i(str4, "endpointRefresh");
p.i(strArr, "scopes");
p.i(hVar, "tokenDataType");
this.a = context;
this.b = str;
this.c = str2;
this.d = str3;
this.e = str4;
this.f = strArr;
this.g = hVar;
this.h = z;
}
public final com.joaomgcd.taskerm.net.auth.AuthInfo j(long r6) {
throw new UnsupportedOperationException("Method not decompiled: eg.d.j(long):com.joaomgcd.taskerm.net.auth.AuthInfo");
}
public final AuthInfo k(AuthInfo authInfo, long j) {
try {
String refreshToken = authInfo.getRefreshToken();
if (refreshToken == null) {
return authInfo;
}
JSONObject jSONObject = new JSONObject(q(o(refreshToken), true));
String r = r(jSONObject);
if (r != null) {
refreshToken = r;
}
String m = m(jSONObject);
if (m != null) {
return new AuthInfo(refreshToken, m, p(jSONObject));
}
throw new RuntimeException("Could not get access token");
} catch (j unused) {
w(null);
return j(j);
}
}
private final String n(String str, String str2) {
JSONObject jSONObject = new JSONObject();
jSONObject.put("grant_type", "authorization_code");
jSONObject.put("code", str);
if (str2 == null) {
str2 = "https://tasker.joaoapps.com/auth.html";
}
jSONObject.put("redirect_uri", str2);
jSONObject.put("client_id", this.b);
jSONObject.put("client_secret", this.c);
int i = a.a[this.g.ordinal()];
if (i != 1) {
if (i == 2) {
return x2.Z0(jSONObject);
}
throw new o();
}
String jSONObject2 = jSONObject.toString();
p.h(jSONObject2, "toString(...)");
return jSONObject2;
}
private final String o(String str) {
JSONObject jSONObject = new JSONObject();
jSONObject.put("grant_type", "refresh_token");
jSONObject.put("refresh_token", str);
int i = a.a[this.g.ordinal()];
if (i != 1) {
if (i == 2) {
return x2.Z0(jSONObject);
}
throw new o();
}
String jSONObject2 = jSONObject.toString();
p.h(jSONObject2, "toString(...)");
return jSONObject2;
}
private final String q(String str, boolean z) {
dg.f fVar = new dg.f(str, this.e, null, null, 12, null);
fVar.u(new e(z, this));
return (String) m.e(new t(fVar), null, 1, null);
}
private final String s() {
return kotlin.collections.l.l0(this.f, " ", null, null, 0, null, null, 62, null);
}
public final AuthInfo t() {
String u = u();
SharedPreferences a2 = eg.c.a(this.a);
p.h(a2, "<get-preferencesHttpAuth>(...)");
Object obj = null;
String string = a2.getString(u, null);
if (string != null) {
p.f(string);
obj = wf.c.a().h(string, AuthInfo.class);
}
return (AuthInfo) obj;
}
private final String u() {
return this.b + ConstantsCommonTaskerServer.ID_SEPARATOR + this.c + ConstantsCommonTaskerServer.ID_SEPARATOR + this.d + ConstantsCommonTaskerServer.ID_SEPARATOR + this.e + ConstantsCommonTaskerServer.ID_SEPARATOR + s();
}
private final String v(boolean z) {
HashMap b2;
Uri.Builder appendQueryParameter = Uri.parse(this.d).buildUpon().appendQueryParameter("client_id", this.b).appendQueryParameter("response_type", "code");
String uuid = UUID.randomUUID().toString();
p.h(uuid, "toString(...)");
Uri.Builder appendQueryParameter2 = appendQueryParameter.appendQueryParameter("state", hk.o.C(uuid, "-", "", false, 4, null));
if (z) {
appendQueryParameter2.appendQueryParameter("redirect_uri", "https://tasker.joaoapps.com/auth.html");
}
if (!(this.f.length == 0)) {
appendQueryParameter2.appendQueryParameter("scope", s());
}
b2 = eg.e.b();
HashMap hashMap = (HashMap) b2.get(this.d);
if (hashMap != null) {
p.f(hashMap);
List<Pair> t = k0.t(hashMap);
if (t != null) {
for (Pair pair : t) {
appendQueryParameter2.appendQueryParameter((String) pair.getFirst(), (String) pair.getSecond());
}
}
}
if (this.h) {
appendQueryParameter2.appendQueryParameter("show_dialog", "true");
}
String uri = appendQueryParameter2.build().toString();
p.h(uri, "toString(...)");
return uri;
}
public final void w(AuthInfo authInfo) {
Context context = this.a;
String u = u();
SharedPreferences a2 = eg.c.a(this.a);
p.h(a2, "<get-preferencesHttpAuth>(...)");
jg.c.J(context, u, authInfo, a2, null, 8, null);
}
@Override
public r<g> a(long j) {
return w0.K0(new b(j));
}
public String l(String str, String str2) {
return b.a.a(this, str, str2);
}
public String m(JSONObject jSONObject) {
return b.a.b(this, jSONObject);
}
public Long p(JSONObject jSONObject) {
return b.a.c(this, jSONObject);
}
public String r(JSONObject jSONObject) {
return b.a.d(this, jSONObject);
}
public d(Context context, String str, String str2, String str3, String str4, String[] strArr, h hVar, boolean z, int i, yj.h hVar2) {
this(context, str, str2, str3, str4, strArr, (i & 64) != 0 ? h.r : hVar, (i & 128) != 0 ? false : z);
}
public static final class C0144d extends q implements l<eg.a, e0> {
public static final C0144d i = new C0144d();
public C0144d() {
super(1);
}
@Override
public e0 invoke(eg.a aVar) {
a(aVar);
return e0.a;
}
public final void a(eg.a aVar) {
}
}
}