Initial commit
This commit is contained in:
79
sources/com/twitter/Extractor.java
Normal file
79
sources/com/twitter/Extractor.java
Normal file
@@ -0,0 +1,79 @@
|
||||
package com.twitter;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.regex.Matcher;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class Extractor {
|
||||
protected boolean a = true;
|
||||
|
||||
public List<Entity> a(String str) {
|
||||
if (str != null && str.length() != 0) {
|
||||
if (str.indexOf(this.a ? 46 : 58) != -1) {
|
||||
ArrayList arrayList = new ArrayList();
|
||||
Matcher matcher = Regex.f.matcher(str);
|
||||
while (matcher.find()) {
|
||||
if (matcher.group(4) != null || (this.a && !Regex.h.matcher(matcher.group(2)).matches())) {
|
||||
String group = matcher.group(3);
|
||||
int start = matcher.start(3);
|
||||
int end = matcher.end(3);
|
||||
Matcher matcher2 = Regex.g.matcher(group);
|
||||
if (matcher2.find()) {
|
||||
group = matcher2.group();
|
||||
end = group.length() + start;
|
||||
}
|
||||
arrayList.add(new Entity(start, end, group, Entity.Type.URL));
|
||||
}
|
||||
}
|
||||
return arrayList;
|
||||
}
|
||||
}
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
public static class Entity {
|
||||
protected int a;
|
||||
protected int b;
|
||||
protected final String c;
|
||||
protected final Type d;
|
||||
|
||||
public enum Type {
|
||||
URL,
|
||||
HASHTAG,
|
||||
MENTION,
|
||||
CASHTAG
|
||||
}
|
||||
|
||||
public Entity(int i, int i2, String str, String str2, Type type) {
|
||||
this.a = i;
|
||||
this.b = i2;
|
||||
this.c = str;
|
||||
this.d = type;
|
||||
}
|
||||
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj) {
|
||||
return true;
|
||||
}
|
||||
if (!(obj instanceof Entity)) {
|
||||
return false;
|
||||
}
|
||||
Entity entity = (Entity) obj;
|
||||
return this.d.equals(entity.d) && this.a == entity.a && this.b == entity.b && this.c.equals(entity.c);
|
||||
}
|
||||
|
||||
public int hashCode() {
|
||||
return this.d.hashCode() + this.c.hashCode() + this.a + this.b;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return this.c + "(" + this.d + ") [" + this.a + "," + this.b + "]";
|
||||
}
|
||||
|
||||
public Entity(int i, int i2, String str, Type type) {
|
||||
this(i, i2, str, null, type);
|
||||
}
|
||||
}
|
||||
}
|
66
sources/com/twitter/Regex.java
Normal file
66
sources/com/twitter/Regex.java
Normal file
@@ -0,0 +1,66 @@
|
||||
package com.twitter;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Iterator;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class Regex {
|
||||
private static final String a = "(?:(?:" + a(TldLists.a, "|") + ")(?=[^\\p{Alnum}@]|$))";
|
||||
private static final String b = "(?:(?:" + a(TldLists.b, "|") + ")(?=[^\\p{Alnum}@]|$))";
|
||||
private static final String c = "(?:(?>(?:[\\p{Alnum}\\u00c0-\\u00d6\\u00d8-\\u00f6\\u00f8-\\u00ff\\u0100-\\u024f\\u0253\\u0254\\u0256\\u0257\\u0259\\u025b\\u0263\\u0268\\u026f\\u0272\\u0289\\u028b\\u02bb\\u0300-\\u036f\\u1e00-\\u1eff][[\\p{Alnum}\\u00c0-\\u00d6\\u00d8-\\u00f6\\u00f8-\\u00ff\\u0100-\\u024f\\u0253\\u0254\\u0256\\u0257\\u0259\\u025b\\u0263\\u0268\\u026f\\u0272\\u0289\\u028b\\u02bb\\u0300-\\u036f\\u1e00-\\u1eff]\\-_]*)?[\\p{Alnum}\\u00c0-\\u00d6\\u00d8-\\u00f6\\u00f8-\\u00ff\\u0100-\\u024f\\u0253\\u0254\\u0256\\u0257\\u0259\\u025b\\u0263\\u0268\\u026f\\u0272\\u0289\\u028b\\u02bb\\u0300-\\u036f\\u1e00-\\u1eff]\\.)+(?:(?:[\\p{Alnum}\\u00c0-\\u00d6\\u00d8-\\u00f6\\u00f8-\\u00ff\\u0100-\\u024f\\u0253\\u0254\\u0256\\u0257\\u0259\\u025b\\u0263\\u0268\\u026f\\u0272\\u0289\\u028b\\u02bb\\u0300-\\u036f\\u1e00-\\u1eff][[\\p{Alnum}\\u00c0-\\u00d6\\u00d8-\\u00f6\\u00f8-\\u00ff\\u0100-\\u024f\\u0253\\u0254\\u0256\\u0257\\u0259\\u025b\\u0263\\u0268\\u026f\\u0272\\u0289\\u028b\\u02bb\\u0300-\\u036f\\u1e00-\\u1eff]\\-]*)?[\\p{Alnum}\\u00c0-\\u00d6\\u00d8-\\u00f6\\u00f8-\\u00ff\\u0100-\\u024f\\u0253\\u0254\\u0256\\u0257\\u0259\\u025b\\u0263\\u0268\\u026f\\u0272\\u0289\\u028b\\u02bb\\u0300-\\u036f\\u1e00-\\u1eff]\\.)(?:" + a + "|" + b + "|(?:xn--[0-9a-z]+)))|(?:(?:(?:[\\p{Alnum}\\u00c0-\\u00d6\\u00d8-\\u00f6\\u00f8-\\u00ff\\u0100-\\u024f\\u0253\\u0254\\u0256\\u0257\\u0259\\u025b\\u0263\\u0268\\u026f\\u0272\\u0289\\u028b\\u02bb\\u0300-\\u036f\\u1e00-\\u1eff][[\\p{Alnum}\\u00c0-\\u00d6\\u00d8-\\u00f6\\u00f8-\\u00ff\\u0100-\\u024f\\u0253\\u0254\\u0256\\u0257\\u0259\\u025b\\u0263\\u0268\\u026f\\u0272\\u0289\\u028b\\u02bb\\u0300-\\u036f\\u1e00-\\u1eff]\\-]*)?[\\p{Alnum}\\u00c0-\\u00d6\\u00d8-\\u00f6\\u00f8-\\u00ff\\u0100-\\u024f\\u0253\\u0254\\u0256\\u0257\\u0259\\u025b\\u0263\\u0268\\u026f\\u0272\\u0289\\u028b\\u02bb\\u0300-\\u036f\\u1e00-\\u1eff]\\.)(?:" + a + "|(?:xn--[0-9a-z]+)|(?:(?:co|tv)(?=[^\\p{Alnum}@]|$))))|(?:(?<=https?://)(?:(?:(?:(?:[\\p{Alnum}\\u00c0-\\u00d6\\u00d8-\\u00f6\\u00f8-\\u00ff\\u0100-\\u024f\\u0253\\u0254\\u0256\\u0257\\u0259\\u025b\\u0263\\u0268\\u026f\\u0272\\u0289\\u028b\\u02bb\\u0300-\\u036f\\u1e00-\\u1eff][[\\p{Alnum}\\u00c0-\\u00d6\\u00d8-\\u00f6\\u00f8-\\u00ff\\u0100-\\u024f\\u0253\\u0254\\u0256\\u0257\\u0259\\u025b\\u0263\\u0268\\u026f\\u0272\\u0289\\u028b\\u02bb\\u0300-\\u036f\\u1e00-\\u1eff]\\-]*)?[\\p{Alnum}\\u00c0-\\u00d6\\u00d8-\\u00f6\\u00f8-\\u00ff\\u0100-\\u024f\\u0253\\u0254\\u0256\\u0257\\u0259\\u025b\\u0263\\u0268\\u026f\\u0272\\u0289\\u028b\\u02bb\\u0300-\\u036f\\u1e00-\\u1eff]\\.)" + b + ")|(?:[.[^\\p{Punct}\\s\\p{Z}\\p{InGeneralPunctuation}]]+\\.(?:" + a + "|" + b + "))))|(?:(?:(?:[\\p{Alnum}\\u00c0-\\u00d6\\u00d8-\\u00f6\\u00f8-\\u00ff\\u0100-\\u024f\\u0253\\u0254\\u0256\\u0257\\u0259\\u025b\\u0263\\u0268\\u026f\\u0272\\u0289\\u028b\\u02bb\\u0300-\\u036f\\u1e00-\\u1eff][[\\p{Alnum}\\u00c0-\\u00d6\\u00d8-\\u00f6\\u00f8-\\u00ff\\u0100-\\u024f\\u0253\\u0254\\u0256\\u0257\\u0259\\u025b\\u0263\\u0268\\u026f\\u0272\\u0289\\u028b\\u02bb\\u0300-\\u036f\\u1e00-\\u1eff]\\-]*)?[\\p{Alnum}\\u00c0-\\u00d6\\u00d8-\\u00f6\\u00f8-\\u00ff\\u0100-\\u024f\\u0253\\u0254\\u0256\\u0257\\u0259\\u025b\\u0263\\u0268\\u026f\\u0272\\u0289\\u028b\\u02bb\\u0300-\\u036f\\u1e00-\\u1eff]\\.)" + b + "(?=/))";
|
||||
private static final String d;
|
||||
public static final Pattern e;
|
||||
public static final Pattern f;
|
||||
public static final Pattern g;
|
||||
public static final Pattern h;
|
||||
|
||||
static {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("(((?:[^A-Z0-9@@$##\u202a-\u202e]|^))((https?://)?(");
|
||||
sb.append(c);
|
||||
sb.append(")");
|
||||
sb.append("(?::(");
|
||||
sb.append("[0-9]++");
|
||||
sb.append("))?");
|
||||
sb.append("(/");
|
||||
sb.append("(?:(?:[a-z0-9!\\*';:=\\+,.\\$/%#\\[\\]\\-_~\\|&@\\u00c0-\\u00d6\\u00d8-\\u00f6\\u00f8-\\u00ff\\u0100-\\u024f\\u0253\\u0254\\u0256\\u0257\\u0259\\u025b\\u0263\\u0268\\u026f\\u0272\\u0289\\u028b\\u02bb\\u0300-\\u036f\\u1e00-\\u1eff]*(?:\\((?:[a-z0-9!\\*';:=\\+,.\\$/%#\\[\\]\\-_~\\|&@\\u00c0-\\u00d6\\u00d8-\\u00f6\\u00f8-\\u00ff\\u0100-\\u024f\\u0253\\u0254\\u0256\\u0257\\u0259\\u025b\\u0263\\u0268\\u026f\\u0272\\u0289\\u028b\\u02bb\\u0300-\\u036f\\u1e00-\\u1eff]+|(?:[a-z0-9!\\*';:=\\+,.\\$/%#\\[\\]\\-_~\\|&@\\u00c0-\\u00d6\\u00d8-\\u00f6\\u00f8-\\u00ff\\u0100-\\u024f\\u0253\\u0254\\u0256\\u0257\\u0259\\u025b\\u0263\\u0268\\u026f\\u0272\\u0289\\u028b\\u02bb\\u0300-\\u036f\\u1e00-\\u1eff]*\\([a-z0-9!\\*';:=\\+,.\\$/%#\\[\\]\\-_~\\|&@\\u00c0-\\u00d6\\u00d8-\\u00f6\\u00f8-\\u00ff\\u0100-\\u024f\\u0253\\u0254\\u0256\\u0257\\u0259\\u025b\\u0263\\u0268\\u026f\\u0272\\u0289\\u028b\\u02bb\\u0300-\\u036f\\u1e00-\\u1eff]+\\)[a-z0-9!\\*';:=\\+,.\\$/%#\\[\\]\\-_~\\|&@\\u00c0-\\u00d6\\u00d8-\\u00f6\\u00f8-\\u00ff\\u0100-\\u024f\\u0253\\u0254\\u0256\\u0257\\u0259\\u025b\\u0263\\u0268\\u026f\\u0272\\u0289\\u028b\\u02bb\\u0300-\\u036f\\u1e00-\\u1eff]*))\\)[a-z0-9!\\*';:=\\+,.\\$/%#\\[\\]\\-_~\\|&@\\u00c0-\\u00d6\\u00d8-\\u00f6\\u00f8-\\u00ff\\u0100-\\u024f\\u0253\\u0254\\u0256\\u0257\\u0259\\u025b\\u0263\\u0268\\u026f\\u0272\\u0289\\u028b\\u02bb\\u0300-\\u036f\\u1e00-\\u1eff]*)*[a-z0-9=_#/\\-\\+\\u00c0-\\u00d6\\u00d8-\\u00f6\\u00f8-\\u00ff\\u0100-\\u024f\\u0253\\u0254\\u0256\\u0257\\u0259\\u025b\\u0263\\u0268\\u026f\\u0272\\u0289\\u028b\\u02bb\\u0300-\\u036f\\u1e00-\\u1eff]|(?:\\((?:[a-z0-9!\\*';:=\\+,.\\$/%#\\[\\]\\-_~\\|&@\\u00c0-\\u00d6\\u00d8-\\u00f6\\u00f8-\\u00ff\\u0100-\\u024f\\u0253\\u0254\\u0256\\u0257\\u0259\\u025b\\u0263\\u0268\\u026f\\u0272\\u0289\\u028b\\u02bb\\u0300-\\u036f\\u1e00-\\u1eff]+|(?:[a-z0-9!\\*';:=\\+,.\\$/%#\\[\\]\\-_~\\|&@\\u00c0-\\u00d6\\u00d8-\\u00f6\\u00f8-\\u00ff\\u0100-\\u024f\\u0253\\u0254\\u0256\\u0257\\u0259\\u025b\\u0263\\u0268\\u026f\\u0272\\u0289\\u028b\\u02bb\\u0300-\\u036f\\u1e00-\\u1eff]*\\([a-z0-9!\\*';:=\\+,.\\$/%#\\[\\]\\-_~\\|&@\\u00c0-\\u00d6\\u00d8-\\u00f6\\u00f8-\\u00ff\\u0100-\\u024f\\u0253\\u0254\\u0256\\u0257\\u0259\\u025b\\u0263\\u0268\\u026f\\u0272\\u0289\\u028b\\u02bb\\u0300-\\u036f\\u1e00-\\u1eff]+\\)[a-z0-9!\\*';:=\\+,.\\$/%#\\[\\]\\-_~\\|&@\\u00c0-\\u00d6\\u00d8-\\u00f6\\u00f8-\\u00ff\\u0100-\\u024f\\u0253\\u0254\\u0256\\u0257\\u0259\\u025b\\u0263\\u0268\\u026f\\u0272\\u0289\\u028b\\u02bb\\u0300-\\u036f\\u1e00-\\u1eff]*))\\)))|(?:@[a-z0-9!\\*';:=\\+,.\\$/%#\\[\\]\\-_~\\|&@\\u00c0-\\u00d6\\u00d8-\\u00f6\\u00f8-\\u00ff\\u0100-\\u024f\\u0253\\u0254\\u0256\\u0257\\u0259\\u025b\\u0263\\u0268\\u026f\\u0272\\u0289\\u028b\\u02bb\\u0300-\\u036f\\u1e00-\\u1eff]+/))");
|
||||
sb.append("*+");
|
||||
sb.append(")?");
|
||||
sb.append("(\\?");
|
||||
sb.append("[a-z0-9!?\\*'\\(\\);:&=\\+\\$/%#\\[\\]\\-_\\.,~\\|@]");
|
||||
sb.append("*");
|
||||
sb.append("[a-z0-9_&=#/]");
|
||||
sb.append(")?");
|
||||
sb.append(")");
|
||||
sb.append(")");
|
||||
d = sb.toString();
|
||||
synchronized (Regex.class) {
|
||||
Pattern.compile("(^|[^&\\p{L}\\p{M}\\p{Nd}_\\u200c\\u200d\\ua67e\\u05be\\u05f3\\u05f4\\u309b\\u309c\\u30a0\\u30fb\\u3003\\u0f0b\\u0f0c\\u00b7])(#|#)([\\p{L}\\p{M}\\p{Nd}_\\u200c\\u200d\\ua67e\\u05be\\u05f3\\u05f4\\u309b\\u309c\\u30a0\\u30fb\\u3003\\u0f0b\\u0f0c\\u00b7]*[\\p{L}\\p{M}][\\p{L}\\p{M}\\p{Nd}_\\u200c\\u200d\\ua67e\\u05be\\u05f3\\u05f4\\u309b\\u309c\\u30a0\\u30fb\\u3003\\u0f0b\\u0f0c\\u00b7]*)", 2);
|
||||
Pattern.compile("^(?:[##]|://)");
|
||||
Pattern.compile("[\u0600-ۿݐ-ݿ\u0590-\u05ffﹰ-\ufeff]");
|
||||
e = Pattern.compile("[@@]");
|
||||
Pattern.compile("([^a-z0-9_!#$%&*@@]|^|(?:^|[^a-z0-9_+~.-])RT:?)(" + e + "+)([a-z0-9_]{1,20})(/[a-z][a-z0-9_\\-]{0,24})?", 2);
|
||||
Pattern.compile("^(?:[\\u0009-\\u000d\\u0020\\u0085\\u00a0\\u1680\\u180E\\u2000-\\u200a\\u2028\\u2029\\u202F\\u205F\\u3000])*" + e + "([a-z0-9_]{1,20})", 2);
|
||||
Pattern.compile("^(?:[@@\\u00c0-\\u00d6\\u00d8-\\u00f6\\u00f8-\\u00ff\\u0100-\\u024f\\u0253\\u0254\\u0256\\u0257\\u0259\\u025b\\u0263\\u0268\\u026f\\u0272\\u0289\\u028b\\u02bb\\u0300-\\u036f\\u1e00-\\u1eff]|://)");
|
||||
h = Pattern.compile("[-_./]$");
|
||||
f = Pattern.compile(d, 2);
|
||||
g = Pattern.compile("^https?:\\/\\/t\\.co\\/[a-z0-9]+", 2);
|
||||
Pattern.compile("(^|[\\u0009-\\u000d\\u0020\\u0085\\u00a0\\u1680\\u180E\\u2000-\\u200a\\u2028\\u2029\\u202F\\u205F\\u3000])(\\$)([a-z]{1,6}(?:[._][a-z]{1,2})?)(?=$|\\s|\\p{Punct})", 2);
|
||||
Pattern.compile(c, 2);
|
||||
}
|
||||
}
|
||||
|
||||
private static String a(Collection<?> collection, String str) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
Iterator<?> it = collection.iterator();
|
||||
if (it.hasNext()) {
|
||||
sb.append(it.next().toString());
|
||||
}
|
||||
while (it.hasNext()) {
|
||||
sb.append(str);
|
||||
sb.append(it.next().toString());
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
20
sources/com/twitter/TldLists.java
Normal file
20
sources/com/twitter/TldLists.java
Normal file
File diff suppressed because one or more lines are too long
20
sources/com/twitter/Validator.java
Normal file
20
sources/com/twitter/Validator.java
Normal file
@@ -0,0 +1,20 @@
|
||||
package com.twitter;
|
||||
|
||||
import com.twitter.Extractor;
|
||||
import java.text.Normalizer;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class Validator {
|
||||
protected int a = 23;
|
||||
protected int b = 23;
|
||||
private Extractor c = new Extractor();
|
||||
|
||||
public int a(String str) {
|
||||
String normalize = Normalizer.normalize(str, Normalizer.Form.NFC);
|
||||
int codePointCount = normalize.codePointCount(0, normalize.length());
|
||||
for (Extractor.Entity entity : this.c.a(normalize)) {
|
||||
codePointCount = codePointCount + (entity.a - entity.b) + (entity.c.toLowerCase().startsWith("https://") ? this.b : this.a);
|
||||
}
|
||||
return codePointCount;
|
||||
}
|
||||
}
|
20
sources/com/twitter/sdk/android/core/AuthToken.java
Normal file
20
sources/com/twitter/sdk/android/core/AuthToken.java
Normal file
@@ -0,0 +1,20 @@
|
||||
package com.twitter.sdk.android.core;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public abstract class AuthToken {
|
||||
|
||||
@SerializedName("created_at")
|
||||
protected final long createdAt;
|
||||
|
||||
public AuthToken() {
|
||||
this(System.currentTimeMillis());
|
||||
}
|
||||
|
||||
public abstract boolean isExpired();
|
||||
|
||||
protected AuthToken(long j) {
|
||||
this.createdAt = j;
|
||||
}
|
||||
}
|
53
sources/com/twitter/sdk/android/core/AuthTokenAdapter.java
Normal file
53
sources/com/twitter/sdk/android/core/AuthTokenAdapter.java
Normal file
@@ -0,0 +1,53 @@
|
||||
package com.twitter.sdk.android.core;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.JsonDeserializationContext;
|
||||
import com.google.gson.JsonDeserializer;
|
||||
import com.google.gson.JsonElement;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonParseException;
|
||||
import com.google.gson.JsonSerializationContext;
|
||||
import com.google.gson.JsonSerializer;
|
||||
import com.twitter.sdk.android.core.internal.oauth.GuestAuthToken;
|
||||
import com.twitter.sdk.android.core.internal.oauth.OAuth2Token;
|
||||
import java.lang.reflect.Type;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class AuthTokenAdapter implements JsonSerializer<AuthToken>, JsonDeserializer<AuthToken> {
|
||||
static final Map<String, Class<? extends AuthToken>> b = new HashMap();
|
||||
private final Gson a = new Gson();
|
||||
|
||||
static {
|
||||
b.put("oauth1a", TwitterAuthToken.class);
|
||||
b.put("oauth2", OAuth2Token.class);
|
||||
b.put("guest", GuestAuthToken.class);
|
||||
}
|
||||
|
||||
@Override // com.google.gson.JsonSerializer
|
||||
/* renamed from: a, reason: merged with bridge method [inline-methods] */
|
||||
public JsonElement serialize(AuthToken authToken, Type type, JsonSerializationContext jsonSerializationContext) {
|
||||
JsonObject jsonObject = new JsonObject();
|
||||
jsonObject.addProperty("auth_type", a(authToken.getClass()));
|
||||
jsonObject.add("auth_token", this.a.toJsonTree(authToken));
|
||||
return jsonObject;
|
||||
}
|
||||
|
||||
/* JADX WARN: Can't rename method to resolve collision */
|
||||
@Override // com.google.gson.JsonDeserializer
|
||||
public AuthToken deserialize(JsonElement jsonElement, Type type, JsonDeserializationContext jsonDeserializationContext) throws JsonParseException {
|
||||
JsonObject asJsonObject = jsonElement.getAsJsonObject();
|
||||
String asString = asJsonObject.getAsJsonPrimitive("auth_type").getAsString();
|
||||
return (AuthToken) this.a.fromJson(asJsonObject.get("auth_token"), (Class) b.get(asString));
|
||||
}
|
||||
|
||||
static String a(Class<? extends AuthToken> cls) {
|
||||
for (Map.Entry<String, Class<? extends AuthToken>> entry : b.entrySet()) {
|
||||
if (entry.getValue().equals(cls)) {
|
||||
return entry.getKey();
|
||||
}
|
||||
}
|
||||
return "";
|
||||
}
|
||||
}
|
25
sources/com/twitter/sdk/android/core/Callback.java
Normal file
25
sources/com/twitter/sdk/android/core/Callback.java
Normal file
@@ -0,0 +1,25 @@
|
||||
package com.twitter.sdk.android.core;
|
||||
|
||||
import retrofit2.Call;
|
||||
import retrofit2.Response;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public abstract class Callback<T> implements retrofit2.Callback<T> {
|
||||
public abstract void a(Result<T> result);
|
||||
|
||||
public abstract void a(TwitterException twitterException);
|
||||
|
||||
@Override // retrofit2.Callback
|
||||
public final void onFailure(Call<T> call, Throwable th) {
|
||||
a(new TwitterException("Request Failure", th));
|
||||
}
|
||||
|
||||
@Override // retrofit2.Callback
|
||||
public final void onResponse(Call<T> call, Response<T> response) {
|
||||
if (response.isSuccessful()) {
|
||||
a(new Result<>(response.body(), response));
|
||||
} else {
|
||||
a(new TwitterApiException(response));
|
||||
}
|
||||
}
|
||||
}
|
48
sources/com/twitter/sdk/android/core/GuestSession.java
Normal file
48
sources/com/twitter/sdk/android/core/GuestSession.java
Normal file
@@ -0,0 +1,48 @@
|
||||
package com.twitter.sdk.android.core;
|
||||
|
||||
import android.text.TextUtils;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
import com.twitter.sdk.android.core.internal.oauth.GuestAuthToken;
|
||||
import io.fabric.sdk.android.Fabric;
|
||||
import io.fabric.sdk.android.services.persistence.SerializationStrategy;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class GuestSession extends Session<GuestAuthToken> {
|
||||
|
||||
public static class Serializer implements SerializationStrategy<GuestSession> {
|
||||
private final Gson a = new GsonBuilder().registerTypeAdapter(GuestAuthToken.class, new AuthTokenAdapter()).create();
|
||||
|
||||
@Override // io.fabric.sdk.android.services.persistence.SerializationStrategy
|
||||
/* renamed from: a, reason: merged with bridge method [inline-methods] */
|
||||
public String serialize(GuestSession guestSession) {
|
||||
if (guestSession == null || guestSession.a() == null) {
|
||||
return "";
|
||||
}
|
||||
try {
|
||||
return this.a.toJson(guestSession);
|
||||
} catch (Exception e) {
|
||||
Fabric.g().d("Twitter", "Failed to serialize session " + e.getMessage());
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
/* JADX WARN: Can't rename method to resolve collision */
|
||||
@Override // io.fabric.sdk.android.services.persistence.SerializationStrategy
|
||||
public GuestSession a(String str) {
|
||||
if (TextUtils.isEmpty(str)) {
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
return (GuestSession) this.a.fromJson(str, GuestSession.class);
|
||||
} catch (Exception e) {
|
||||
Fabric.g().d("Twitter", "Failed to deserialize session " + e.getMessage());
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public GuestSession(GuestAuthToken guestAuthToken) {
|
||||
super(guestAuthToken, 0L);
|
||||
}
|
||||
}
|
@@ -0,0 +1,61 @@
|
||||
package com.twitter.sdk.android.core;
|
||||
|
||||
import com.twitter.sdk.android.core.internal.oauth.GuestAuthToken;
|
||||
import com.twitter.sdk.android.core.internal.oauth.OAuth2Service;
|
||||
import io.fabric.sdk.android.Fabric;
|
||||
import java.util.concurrent.CountDownLatch;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class GuestSessionProvider {
|
||||
private final OAuth2Service a;
|
||||
private final SessionManager<GuestSession> b;
|
||||
|
||||
public GuestSessionProvider(OAuth2Service oAuth2Service, SessionManager<GuestSession> sessionManager) {
|
||||
this.a = oAuth2Service;
|
||||
this.b = sessionManager;
|
||||
}
|
||||
|
||||
public synchronized GuestSession b(GuestSession guestSession) {
|
||||
GuestSession b = this.b.b();
|
||||
if (guestSession != null && guestSession.equals(b)) {
|
||||
b();
|
||||
}
|
||||
return this.b.b();
|
||||
}
|
||||
|
||||
public synchronized GuestSession a() {
|
||||
GuestSession b = this.b.b();
|
||||
if (a(b)) {
|
||||
return b;
|
||||
}
|
||||
b();
|
||||
return this.b.b();
|
||||
}
|
||||
|
||||
void b() {
|
||||
Fabric.g().d("GuestSessionProvider", "Refreshing expired guest session.");
|
||||
final CountDownLatch countDownLatch = new CountDownLatch(1);
|
||||
this.a.b(new Callback<GuestAuthToken>() { // from class: com.twitter.sdk.android.core.GuestSessionProvider.1
|
||||
@Override // com.twitter.sdk.android.core.Callback
|
||||
public void a(Result<GuestAuthToken> result) {
|
||||
GuestSessionProvider.this.b.a((SessionManager) new GuestSession(result.a));
|
||||
countDownLatch.countDown();
|
||||
}
|
||||
|
||||
@Override // com.twitter.sdk.android.core.Callback
|
||||
public void a(TwitterException twitterException) {
|
||||
GuestSessionProvider.this.b.a(0L);
|
||||
countDownLatch.countDown();
|
||||
}
|
||||
});
|
||||
try {
|
||||
countDownLatch.await();
|
||||
} catch (InterruptedException unused) {
|
||||
this.b.a(0L);
|
||||
}
|
||||
}
|
||||
|
||||
boolean a(GuestSession guestSession) {
|
||||
return (guestSession == null || guestSession.a() == null || guestSession.a().isExpired()) ? false : true;
|
||||
}
|
||||
}
|
19
sources/com/twitter/sdk/android/core/IntentUtils.java
Normal file
19
sources/com/twitter/sdk/android/core/IntentUtils.java
Normal file
@@ -0,0 +1,19 @@
|
||||
package com.twitter.sdk.android.core;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class IntentUtils {
|
||||
public static boolean a(Context context, Intent intent) {
|
||||
return !context.getPackageManager().queryIntentActivities(intent, 0).isEmpty();
|
||||
}
|
||||
|
||||
public static boolean b(Context context, Intent intent) {
|
||||
if (!a(context, intent)) {
|
||||
return false;
|
||||
}
|
||||
context.startActivity(intent);
|
||||
return true;
|
||||
}
|
||||
}
|
@@ -0,0 +1,135 @@
|
||||
package com.twitter.sdk.android.core;
|
||||
|
||||
import com.twitter.sdk.android.core.Session;
|
||||
import io.fabric.sdk.android.services.persistence.PreferenceStore;
|
||||
import io.fabric.sdk.android.services.persistence.PreferenceStoreStrategy;
|
||||
import io.fabric.sdk.android.services.persistence.SerializationStrategy;
|
||||
import java.util.Collections;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class PersistedSessionManager<T extends Session> implements SessionManager<T> {
|
||||
private final PreferenceStore a;
|
||||
private final SerializationStrategy<T> b;
|
||||
private final ConcurrentHashMap<Long, T> c;
|
||||
private final ConcurrentHashMap<Long, PreferenceStoreStrategy<T>> d;
|
||||
private final PreferenceStoreStrategy<T> e;
|
||||
private final AtomicReference<T> f;
|
||||
private final String g;
|
||||
private volatile boolean h;
|
||||
|
||||
public PersistedSessionManager(PreferenceStore preferenceStore, SerializationStrategy<T> serializationStrategy, String str, String str2) {
|
||||
this(preferenceStore, serializationStrategy, new ConcurrentHashMap(1), new ConcurrentHashMap(1), new PreferenceStoreStrategy(preferenceStore, serializationStrategy, str), str2);
|
||||
}
|
||||
|
||||
private void d() {
|
||||
T b = this.e.b();
|
||||
if (b != null) {
|
||||
a(b.b(), b, false);
|
||||
}
|
||||
}
|
||||
|
||||
private synchronized void e() {
|
||||
if (this.h) {
|
||||
d();
|
||||
f();
|
||||
this.h = false;
|
||||
}
|
||||
}
|
||||
|
||||
private void f() {
|
||||
T a;
|
||||
for (Map.Entry<String, ?> entry : this.a.get().getAll().entrySet()) {
|
||||
if (a(entry.getKey()) && (a = this.b.a((String) entry.getValue())) != null) {
|
||||
a(a.b(), a, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
boolean a(String str) {
|
||||
return str.startsWith(this.g);
|
||||
}
|
||||
|
||||
@Override // com.twitter.sdk.android.core.SessionManager
|
||||
public T b() {
|
||||
c();
|
||||
return this.f.get();
|
||||
}
|
||||
|
||||
void c() {
|
||||
if (this.h) {
|
||||
e();
|
||||
}
|
||||
}
|
||||
|
||||
PersistedSessionManager(PreferenceStore preferenceStore, SerializationStrategy<T> serializationStrategy, ConcurrentHashMap<Long, T> concurrentHashMap, ConcurrentHashMap<Long, PreferenceStoreStrategy<T>> concurrentHashMap2, PreferenceStoreStrategy<T> preferenceStoreStrategy, String str) {
|
||||
this.h = true;
|
||||
this.a = preferenceStore;
|
||||
this.b = serializationStrategy;
|
||||
this.c = concurrentHashMap;
|
||||
this.d = concurrentHashMap2;
|
||||
this.e = preferenceStoreStrategy;
|
||||
this.f = new AtomicReference<>();
|
||||
this.g = str;
|
||||
}
|
||||
|
||||
@Override // com.twitter.sdk.android.core.SessionManager
|
||||
public void a(T t) {
|
||||
if (t == null) {
|
||||
throw new IllegalArgumentException("Session must not be null!");
|
||||
}
|
||||
c();
|
||||
a(t.b(), t, true);
|
||||
}
|
||||
|
||||
@Override // com.twitter.sdk.android.core.SessionManager
|
||||
public T b(long j) {
|
||||
c();
|
||||
return this.c.get(Long.valueOf(j));
|
||||
}
|
||||
|
||||
String c(long j) {
|
||||
return this.g + "_" + j;
|
||||
}
|
||||
|
||||
@Override // com.twitter.sdk.android.core.SessionManager
|
||||
public Map<Long, T> a() {
|
||||
c();
|
||||
return Collections.unmodifiableMap(this.c);
|
||||
}
|
||||
|
||||
private void a(long j, T t, boolean z) {
|
||||
this.c.put(Long.valueOf(j), t);
|
||||
PreferenceStoreStrategy<T> preferenceStoreStrategy = this.d.get(Long.valueOf(j));
|
||||
if (preferenceStoreStrategy == null) {
|
||||
preferenceStoreStrategy = new PreferenceStoreStrategy<>(this.a, this.b, c(j));
|
||||
this.d.putIfAbsent(Long.valueOf(j), preferenceStoreStrategy);
|
||||
}
|
||||
preferenceStoreStrategy.a(t);
|
||||
T t2 = this.f.get();
|
||||
if (t2 == null || t2.b() == j || z) {
|
||||
synchronized (this) {
|
||||
this.f.compareAndSet(t2, t);
|
||||
this.e.a(t);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override // com.twitter.sdk.android.core.SessionManager
|
||||
public void a(long j) {
|
||||
c();
|
||||
if (this.f.get() != null && this.f.get().b() == j) {
|
||||
synchronized (this) {
|
||||
this.f.set(null);
|
||||
this.e.a();
|
||||
}
|
||||
}
|
||||
this.c.remove(Long.valueOf(j));
|
||||
PreferenceStoreStrategy<T> remove = this.d.remove(Long.valueOf(j));
|
||||
if (remove != null) {
|
||||
remove.a();
|
||||
}
|
||||
}
|
||||
}
|
13
sources/com/twitter/sdk/android/core/R$id.java
Normal file
13
sources/com/twitter/sdk/android/core/R$id.java
Normal file
@@ -0,0 +1,13 @@
|
||||
package com.twitter.sdk.android.core;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public final class R$id {
|
||||
public static final int height = 2131296692;
|
||||
public static final int imageView = 2131296818;
|
||||
public static final int tw__allow_btn = 2131297842;
|
||||
public static final int tw__not_now_btn = 2131297865;
|
||||
public static final int tw__share_email_desc = 2131297868;
|
||||
public static final int tw__spinner = 2131297869;
|
||||
public static final int tw__web_view = 2131297884;
|
||||
public static final int width = 2131297983;
|
||||
}
|
7
sources/com/twitter/sdk/android/core/R$layout.java
Normal file
7
sources/com/twitter/sdk/android/core/R$layout.java
Normal file
@@ -0,0 +1,7 @@
|
||||
package com.twitter.sdk.android.core;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public final class R$layout {
|
||||
public static final int tw__activity_oauth = 2131493364;
|
||||
public static final int tw__activity_share_email = 2131493365;
|
||||
}
|
6
sources/com/twitter/sdk/android/core/R$raw.java
Normal file
6
sources/com/twitter/sdk/android/core/R$raw.java
Normal file
@@ -0,0 +1,6 @@
|
||||
package com.twitter.sdk.android.core;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public final class R$raw {
|
||||
public static final int tw__cacerts = 2131755011;
|
||||
}
|
11
sources/com/twitter/sdk/android/core/R$string.java
Normal file
11
sources/com/twitter/sdk/android/core/R$string.java
Normal file
@@ -0,0 +1,11 @@
|
||||
package com.twitter.sdk.android.core;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public final class R$string {
|
||||
public static final int kit_name = 2131821184;
|
||||
public static final int tw__allow_btn_txt = 2131821703;
|
||||
public static final int tw__login_btn_txt = 2131821709;
|
||||
public static final int tw__not_now_btn_txt = 2131821711;
|
||||
public static final int tw__share_email_desc = 2131821721;
|
||||
public static final int tw__share_email_title = 2131821722;
|
||||
}
|
10
sources/com/twitter/sdk/android/core/R$styleable.java
Normal file
10
sources/com/twitter/sdk/android/core/R$styleable.java
Normal file
@@ -0,0 +1,10 @@
|
||||
package com.twitter.sdk.android.core;
|
||||
|
||||
import com.ubt.jimu.R;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public final class R$styleable {
|
||||
public static final int[] tw__AspectRatioImageView = {R.attr.tw__image_aspect_ratio, R.attr.tw__image_dimension_to_adjust};
|
||||
public static final int tw__AspectRatioImageView_tw__image_aspect_ratio = 0;
|
||||
public static final int tw__AspectRatioImageView_tw__image_dimension_to_adjust = 1;
|
||||
}
|
12
sources/com/twitter/sdk/android/core/Result.java
Normal file
12
sources/com/twitter/sdk/android/core/Result.java
Normal file
@@ -0,0 +1,12 @@
|
||||
package com.twitter.sdk.android.core;
|
||||
|
||||
import retrofit2.Response;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class Result<T> {
|
||||
public final T a;
|
||||
|
||||
public Result(T t, Response response) {
|
||||
this.a = t;
|
||||
}
|
||||
}
|
54
sources/com/twitter/sdk/android/core/Session.java
Normal file
54
sources/com/twitter/sdk/android/core/Session.java
Normal file
@@ -0,0 +1,54 @@
|
||||
package com.twitter.sdk.android.core;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import com.twitter.sdk.android.core.AuthToken;
|
||||
import com.ubt.jimu.controller.data.widget.JockstickDataConverter;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class Session<T extends AuthToken> {
|
||||
|
||||
@SerializedName("auth_token")
|
||||
private final T a;
|
||||
|
||||
@SerializedName(JockstickDataConverter.ID)
|
||||
private final long b;
|
||||
|
||||
public Session(T t, long j) {
|
||||
if (t == null) {
|
||||
throw new IllegalArgumentException("AuthToken must not be null.");
|
||||
}
|
||||
this.a = t;
|
||||
this.b = j;
|
||||
}
|
||||
|
||||
public T a() {
|
||||
return this.a;
|
||||
}
|
||||
|
||||
public long b() {
|
||||
return this.b;
|
||||
}
|
||||
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj) {
|
||||
return true;
|
||||
}
|
||||
if (obj == null || getClass() != obj.getClass()) {
|
||||
return false;
|
||||
}
|
||||
Session session = (Session) obj;
|
||||
if (this.b != session.b) {
|
||||
return false;
|
||||
}
|
||||
T t = this.a;
|
||||
T t2 = session.a;
|
||||
return t != null ? t.equals(t2) : t2 == null;
|
||||
}
|
||||
|
||||
public int hashCode() {
|
||||
T t = this.a;
|
||||
int hashCode = t != null ? t.hashCode() : 0;
|
||||
long j = this.b;
|
||||
return (hashCode * 31) + ((int) (j ^ (j >>> 32)));
|
||||
}
|
||||
}
|
17
sources/com/twitter/sdk/android/core/SessionManager.java
Normal file
17
sources/com/twitter/sdk/android/core/SessionManager.java
Normal file
@@ -0,0 +1,17 @@
|
||||
package com.twitter.sdk.android.core;
|
||||
|
||||
import com.twitter.sdk.android.core.Session;
|
||||
import java.util.Map;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public interface SessionManager<T extends Session> {
|
||||
Map<Long, T> a();
|
||||
|
||||
void a(long j);
|
||||
|
||||
void a(T t);
|
||||
|
||||
T b();
|
||||
|
||||
T b(long j);
|
||||
}
|
67
sources/com/twitter/sdk/android/core/TwitterApiClient.java
Normal file
67
sources/com/twitter/sdk/android/core/TwitterApiClient.java
Normal file
@@ -0,0 +1,67 @@
|
||||
package com.twitter.sdk.android.core;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
import com.twitter.sdk.android.core.internal.TwitterApi;
|
||||
import com.twitter.sdk.android.core.internal.network.OkHttpClientHelper;
|
||||
import com.twitter.sdk.android.core.models.BindingValues;
|
||||
import com.twitter.sdk.android.core.models.BindingValuesAdapter;
|
||||
import com.twitter.sdk.android.core.models.SafeListAdapter;
|
||||
import com.twitter.sdk.android.core.models.SafeMapAdapter;
|
||||
import com.twitter.sdk.android.core.services.AccountService;
|
||||
import com.twitter.sdk.android.core.services.FavoriteService;
|
||||
import com.twitter.sdk.android.core.services.MediaService;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import okhttp3.OkHttpClient;
|
||||
import retrofit2.Retrofit;
|
||||
import retrofit2.converter.gson.GsonConverterFactory;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class TwitterApiClient {
|
||||
final ConcurrentHashMap<Class, Object> a;
|
||||
final Retrofit b;
|
||||
|
||||
public TwitterApiClient() {
|
||||
this(OkHttpClientHelper.a(TwitterCore.z().s(), TwitterCore.z().t()), new TwitterApi());
|
||||
}
|
||||
|
||||
private Retrofit a(OkHttpClient okHttpClient, TwitterApi twitterApi) {
|
||||
return new Retrofit.Builder().client(okHttpClient).baseUrl(twitterApi.a()).addConverterFactory(GsonConverterFactory.create(e())).build();
|
||||
}
|
||||
|
||||
private ConcurrentHashMap d() {
|
||||
return new ConcurrentHashMap();
|
||||
}
|
||||
|
||||
private Gson e() {
|
||||
return new GsonBuilder().registerTypeAdapterFactory(new SafeListAdapter()).registerTypeAdapterFactory(new SafeMapAdapter()).registerTypeAdapter(BindingValues.class, new BindingValuesAdapter()).create();
|
||||
}
|
||||
|
||||
public FavoriteService b() {
|
||||
return (FavoriteService) a(FavoriteService.class);
|
||||
}
|
||||
|
||||
public MediaService c() {
|
||||
return (MediaService) a(MediaService.class);
|
||||
}
|
||||
|
||||
public TwitterApiClient(TwitterSession twitterSession) {
|
||||
this(OkHttpClientHelper.a(twitterSession, TwitterCore.z().q(), TwitterCore.z().t()), new TwitterApi());
|
||||
}
|
||||
|
||||
public AccountService a() {
|
||||
return (AccountService) a(AccountService.class);
|
||||
}
|
||||
|
||||
TwitterApiClient(OkHttpClient okHttpClient, TwitterApi twitterApi) {
|
||||
this.a = d();
|
||||
this.b = a(okHttpClient, twitterApi);
|
||||
}
|
||||
|
||||
protected <T> T a(Class<T> cls) {
|
||||
if (!this.a.contains(cls)) {
|
||||
this.a.putIfAbsent(cls, this.b.create(cls));
|
||||
}
|
||||
return (T) this.a.get(cls);
|
||||
}
|
||||
}
|
@@ -0,0 +1,94 @@
|
||||
package com.twitter.sdk.android.core;
|
||||
|
||||
import android.text.TextUtils;
|
||||
import com.google.gson.GsonBuilder;
|
||||
import com.google.gson.JsonSyntaxException;
|
||||
import com.twitter.sdk.android.core.models.ApiError;
|
||||
import com.twitter.sdk.android.core.models.ApiErrors;
|
||||
import com.twitter.sdk.android.core.models.SafeListAdapter;
|
||||
import com.twitter.sdk.android.core.models.SafeMapAdapter;
|
||||
import io.fabric.sdk.android.Fabric;
|
||||
import retrofit2.Response;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class TwitterApiException extends TwitterException {
|
||||
public static final int DEFAULT_ERROR_CODE = 0;
|
||||
private final ApiError apiError;
|
||||
private final int code;
|
||||
private final Response response;
|
||||
private final TwitterRateLimit twitterRateLimit;
|
||||
|
||||
public TwitterApiException(Response response) {
|
||||
this(response, readApiError(response), readApiRateLimit(response), response.code());
|
||||
}
|
||||
|
||||
static String createExceptionMessage(int i) {
|
||||
return "HTTP request failed, Status: " + i;
|
||||
}
|
||||
|
||||
static ApiError parseApiError(String str) {
|
||||
try {
|
||||
ApiErrors apiErrors = (ApiErrors) new GsonBuilder().registerTypeAdapterFactory(new SafeListAdapter()).registerTypeAdapterFactory(new SafeMapAdapter()).create().fromJson(str, ApiErrors.class);
|
||||
if (apiErrors.a.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
return apiErrors.a.get(0);
|
||||
} catch (JsonSyntaxException e) {
|
||||
Fabric.g().b("Twitter", "Invalid json: " + str, e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static ApiError readApiError(Response response) {
|
||||
try {
|
||||
String readUtf8 = response.errorBody().source().buffer().clone().readUtf8();
|
||||
if (TextUtils.isEmpty(readUtf8)) {
|
||||
return null;
|
||||
}
|
||||
return parseApiError(readUtf8);
|
||||
} catch (Exception e) {
|
||||
Fabric.g().b("Twitter", "Unexpected response", e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static TwitterRateLimit readApiRateLimit(Response response) {
|
||||
return new TwitterRateLimit(response.headers());
|
||||
}
|
||||
|
||||
public int getErrorCode() {
|
||||
ApiError apiError = this.apiError;
|
||||
if (apiError == null) {
|
||||
return 0;
|
||||
}
|
||||
return apiError.b;
|
||||
}
|
||||
|
||||
public String getErrorMessage() {
|
||||
ApiError apiError = this.apiError;
|
||||
if (apiError == null) {
|
||||
return null;
|
||||
}
|
||||
return apiError.a;
|
||||
}
|
||||
|
||||
public Response getResponse() {
|
||||
return this.response;
|
||||
}
|
||||
|
||||
public int getStatusCode() {
|
||||
return this.code;
|
||||
}
|
||||
|
||||
public TwitterRateLimit getTwitterRateLimit() {
|
||||
return this.twitterRateLimit;
|
||||
}
|
||||
|
||||
TwitterApiException(Response response, ApiError apiError, TwitterRateLimit twitterRateLimit, int i) {
|
||||
super(createExceptionMessage(i));
|
||||
this.apiError = apiError;
|
||||
this.twitterRateLimit = twitterRateLimit;
|
||||
this.code = i;
|
||||
this.response = response;
|
||||
}
|
||||
}
|
67
sources/com/twitter/sdk/android/core/TwitterAuthConfig.java
Normal file
67
sources/com/twitter/sdk/android/core/TwitterAuthConfig.java
Normal file
@@ -0,0 +1,67 @@
|
||||
package com.twitter.sdk.android.core;
|
||||
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class TwitterAuthConfig implements Parcelable {
|
||||
public static final Parcelable.Creator<TwitterAuthConfig> CREATOR = new Parcelable.Creator<TwitterAuthConfig>() { // from class: com.twitter.sdk.android.core.TwitterAuthConfig.1
|
||||
/* JADX WARN: Can't rename method to resolve collision */
|
||||
@Override // android.os.Parcelable.Creator
|
||||
public TwitterAuthConfig createFromParcel(Parcel parcel) {
|
||||
return new TwitterAuthConfig(parcel);
|
||||
}
|
||||
|
||||
/* JADX WARN: Can't rename method to resolve collision */
|
||||
@Override // android.os.Parcelable.Creator
|
||||
public TwitterAuthConfig[] newArray(int i) {
|
||||
return new TwitterAuthConfig[i];
|
||||
}
|
||||
};
|
||||
public static final int DEFAULT_AUTH_REQUEST_CODE = 140;
|
||||
private final String consumerKey;
|
||||
private final String consumerSecret;
|
||||
|
||||
static String sanitizeAttribute(String str) {
|
||||
if (str != null) {
|
||||
return str.trim();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override // android.os.Parcelable
|
||||
public int describeContents() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public String getConsumerKey() {
|
||||
return this.consumerKey;
|
||||
}
|
||||
|
||||
public String getConsumerSecret() {
|
||||
return this.consumerSecret;
|
||||
}
|
||||
|
||||
public int getRequestCode() {
|
||||
return DEFAULT_AUTH_REQUEST_CODE;
|
||||
}
|
||||
|
||||
@Override // android.os.Parcelable
|
||||
public void writeToParcel(Parcel parcel, int i) {
|
||||
parcel.writeString(this.consumerKey);
|
||||
parcel.writeString(this.consumerSecret);
|
||||
}
|
||||
|
||||
public TwitterAuthConfig(String str, String str2) {
|
||||
if (str == null || str2 == null) {
|
||||
throw new IllegalArgumentException("TwitterAuthConfig must not be created with null consumer key or secret.");
|
||||
}
|
||||
this.consumerKey = sanitizeAttribute(str);
|
||||
this.consumerSecret = sanitizeAttribute(str2);
|
||||
}
|
||||
|
||||
private TwitterAuthConfig(Parcel parcel) {
|
||||
this.consumerKey = parcel.readString();
|
||||
this.consumerSecret = parcel.readString();
|
||||
}
|
||||
}
|
@@ -0,0 +1,14 @@
|
||||
package com.twitter.sdk.android.core;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class TwitterAuthException extends TwitterException {
|
||||
private static final long serialVersionUID = 577033016879783994L;
|
||||
|
||||
public TwitterAuthException(String str) {
|
||||
super(str);
|
||||
}
|
||||
|
||||
public TwitterAuthException(String str, Throwable th) {
|
||||
super(str, th);
|
||||
}
|
||||
}
|
88
sources/com/twitter/sdk/android/core/TwitterAuthToken.java
Normal file
88
sources/com/twitter/sdk/android/core/TwitterAuthToken.java
Normal file
@@ -0,0 +1,88 @@
|
||||
package com.twitter.sdk.android.core;
|
||||
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class TwitterAuthToken extends AuthToken implements Parcelable {
|
||||
public static final Parcelable.Creator<TwitterAuthToken> CREATOR = new Parcelable.Creator<TwitterAuthToken>() { // from class: com.twitter.sdk.android.core.TwitterAuthToken.1
|
||||
/* JADX WARN: Can't rename method to resolve collision */
|
||||
@Override // android.os.Parcelable.Creator
|
||||
public TwitterAuthToken createFromParcel(Parcel parcel) {
|
||||
return new TwitterAuthToken(parcel);
|
||||
}
|
||||
|
||||
/* JADX WARN: Can't rename method to resolve collision */
|
||||
@Override // android.os.Parcelable.Creator
|
||||
public TwitterAuthToken[] newArray(int i) {
|
||||
return new TwitterAuthToken[i];
|
||||
}
|
||||
};
|
||||
|
||||
@SerializedName("secret")
|
||||
public final String secret;
|
||||
|
||||
@SerializedName("token")
|
||||
public final String token;
|
||||
|
||||
@Override // android.os.Parcelable
|
||||
public int describeContents() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj) {
|
||||
return true;
|
||||
}
|
||||
if (!(obj instanceof TwitterAuthToken)) {
|
||||
return false;
|
||||
}
|
||||
TwitterAuthToken twitterAuthToken = (TwitterAuthToken) obj;
|
||||
String str = this.secret;
|
||||
if (str == null ? twitterAuthToken.secret != null : !str.equals(twitterAuthToken.secret)) {
|
||||
return false;
|
||||
}
|
||||
String str2 = this.token;
|
||||
String str3 = twitterAuthToken.token;
|
||||
return str2 == null ? str3 == null : str2.equals(str3);
|
||||
}
|
||||
|
||||
public int hashCode() {
|
||||
String str = this.token;
|
||||
int hashCode = (str != null ? str.hashCode() : 0) * 31;
|
||||
String str2 = this.secret;
|
||||
return hashCode + (str2 != null ? str2.hashCode() : 0);
|
||||
}
|
||||
|
||||
@Override // com.twitter.sdk.android.core.AuthToken
|
||||
public boolean isExpired() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return "token=" + this.token + ",secret=" + this.secret;
|
||||
}
|
||||
|
||||
@Override // android.os.Parcelable
|
||||
public void writeToParcel(Parcel parcel, int i) {
|
||||
parcel.writeString(this.token);
|
||||
parcel.writeString(this.secret);
|
||||
}
|
||||
|
||||
public TwitterAuthToken(String str, String str2) {
|
||||
this.token = str;
|
||||
this.secret = str2;
|
||||
}
|
||||
|
||||
TwitterAuthToken(String str, String str2, long j) {
|
||||
super(j);
|
||||
this.token = str;
|
||||
this.secret = str2;
|
||||
}
|
||||
|
||||
private TwitterAuthToken(Parcel parcel) {
|
||||
this.token = parcel.readString();
|
||||
this.secret = parcel.readString();
|
||||
}
|
||||
}
|
155
sources/com/twitter/sdk/android/core/TwitterCore.java
Normal file
155
sources/com/twitter/sdk/android/core/TwitterCore.java
Normal file
@@ -0,0 +1,155 @@
|
||||
package com.twitter.sdk.android.core;
|
||||
|
||||
import com.twitter.sdk.android.core.GuestSession;
|
||||
import com.twitter.sdk.android.core.TwitterSession;
|
||||
import com.twitter.sdk.android.core.internal.MigrationHelper;
|
||||
import com.twitter.sdk.android.core.internal.SessionMonitor;
|
||||
import com.twitter.sdk.android.core.internal.TwitterApi;
|
||||
import com.twitter.sdk.android.core.internal.TwitterSessionVerifier;
|
||||
import com.twitter.sdk.android.core.internal.oauth.OAuth2Service;
|
||||
import com.twitter.sdk.android.core.internal.scribe.TwitterCoreScribeClientHolder;
|
||||
import io.fabric.sdk.android.Fabric;
|
||||
import io.fabric.sdk.android.Kit;
|
||||
import io.fabric.sdk.android.services.network.NetworkUtils;
|
||||
import io.fabric.sdk.android.services.persistence.PreferenceStoreImpl;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import javax.net.ssl.SSLSocketFactory;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class TwitterCore extends Kit<Boolean> {
|
||||
SessionManager<TwitterSession> g;
|
||||
SessionManager<GuestSession> h;
|
||||
SessionMonitor<TwitterSession> i;
|
||||
private final TwitterAuthConfig j;
|
||||
private final ConcurrentHashMap<Session, TwitterApiClient> k;
|
||||
private volatile TwitterApiClient l;
|
||||
private volatile GuestSessionProvider m;
|
||||
private volatile SSLSocketFactory n;
|
||||
|
||||
public TwitterCore(TwitterAuthConfig twitterAuthConfig) {
|
||||
this(twitterAuthConfig, new ConcurrentHashMap(), null);
|
||||
}
|
||||
|
||||
private void A() {
|
||||
TwitterCoreScribeClientHolder.a(this, u(), s(), f());
|
||||
}
|
||||
|
||||
private static void v() {
|
||||
if (Fabric.a(TwitterCore.class) == null) {
|
||||
throw new IllegalStateException("Must start Twitter Kit with Fabric.with() first");
|
||||
}
|
||||
}
|
||||
|
||||
private synchronized void w() {
|
||||
if (this.l == null) {
|
||||
this.l = new TwitterApiClient();
|
||||
}
|
||||
}
|
||||
|
||||
private synchronized void x() {
|
||||
if (this.m == null) {
|
||||
this.m = new GuestSessionProvider(new OAuth2Service(this, t(), new TwitterApi()), this.h);
|
||||
}
|
||||
}
|
||||
|
||||
private synchronized void y() {
|
||||
if (this.n == null) {
|
||||
try {
|
||||
this.n = NetworkUtils.a(new TwitterPinningInfoProvider(d()));
|
||||
Fabric.g().d("Twitter", "Custom SSL pinning enabled");
|
||||
} catch (Exception e) {
|
||||
Fabric.g().b("Twitter", "Exception setting up custom SSL pinning", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static TwitterCore z() {
|
||||
v();
|
||||
return (TwitterCore) Fabric.a(TwitterCore.class);
|
||||
}
|
||||
|
||||
public TwitterApiClient a(TwitterSession twitterSession) {
|
||||
v();
|
||||
if (!this.k.containsKey(twitterSession)) {
|
||||
this.k.putIfAbsent(twitterSession, new TwitterApiClient(twitterSession));
|
||||
}
|
||||
return this.k.get(twitterSession);
|
||||
}
|
||||
|
||||
@Override // io.fabric.sdk.android.Kit
|
||||
public String g() {
|
||||
return "com.twitter.sdk.android:twitter-core";
|
||||
}
|
||||
|
||||
@Override // io.fabric.sdk.android.Kit
|
||||
public String i() {
|
||||
return "2.3.1.171";
|
||||
}
|
||||
|
||||
@Override // io.fabric.sdk.android.Kit
|
||||
protected boolean o() {
|
||||
new MigrationHelper().a(d(), g(), g() + ":session_store.xml");
|
||||
this.g = new PersistedSessionManager(new PreferenceStoreImpl(d(), "session_store"), new TwitterSession.Serializer(), "active_twittersession", "twittersession");
|
||||
this.h = new PersistedSessionManager(new PreferenceStoreImpl(d(), "session_store"), new GuestSession.Serializer(), "active_guestsession", "guestsession");
|
||||
this.i = new SessionMonitor<>(this.g, e().b(), new TwitterSessionVerifier());
|
||||
return true;
|
||||
}
|
||||
|
||||
public TwitterApiClient p() {
|
||||
v();
|
||||
TwitterSession b = this.g.b();
|
||||
return b == null ? r() : a(b);
|
||||
}
|
||||
|
||||
public TwitterAuthConfig q() {
|
||||
return this.j;
|
||||
}
|
||||
|
||||
public TwitterApiClient r() {
|
||||
v();
|
||||
if (this.l == null) {
|
||||
w();
|
||||
}
|
||||
return this.l;
|
||||
}
|
||||
|
||||
public GuestSessionProvider s() {
|
||||
v();
|
||||
if (this.m == null) {
|
||||
x();
|
||||
}
|
||||
return this.m;
|
||||
}
|
||||
|
||||
public SSLSocketFactory t() {
|
||||
v();
|
||||
if (this.n == null) {
|
||||
y();
|
||||
}
|
||||
return this.n;
|
||||
}
|
||||
|
||||
public SessionManager<TwitterSession> u() {
|
||||
v();
|
||||
return this.g;
|
||||
}
|
||||
|
||||
TwitterCore(TwitterAuthConfig twitterAuthConfig, ConcurrentHashMap<Session, TwitterApiClient> concurrentHashMap, TwitterApiClient twitterApiClient) {
|
||||
this.j = twitterAuthConfig;
|
||||
this.k = concurrentHashMap;
|
||||
this.l = twitterApiClient;
|
||||
}
|
||||
|
||||
/* JADX INFO: Access modifiers changed from: protected */
|
||||
/* JADX WARN: Can't rename method to resolve collision */
|
||||
@Override // io.fabric.sdk.android.Kit
|
||||
public Boolean c() {
|
||||
this.g.b();
|
||||
this.h.b();
|
||||
t();
|
||||
s();
|
||||
A();
|
||||
this.i.a(e().a());
|
||||
return true;
|
||||
}
|
||||
}
|
12
sources/com/twitter/sdk/android/core/TwitterException.java
Normal file
12
sources/com/twitter/sdk/android/core/TwitterException.java
Normal file
@@ -0,0 +1,12 @@
|
||||
package com.twitter.sdk.android.core;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class TwitterException extends RuntimeException {
|
||||
public TwitterException(String str) {
|
||||
super(str);
|
||||
}
|
||||
|
||||
public TwitterException(String str, Throwable th) {
|
||||
super(str, th);
|
||||
}
|
||||
}
|
@@ -0,0 +1,64 @@
|
||||
package com.twitter.sdk.android.core;
|
||||
|
||||
import android.content.Context;
|
||||
import io.fabric.sdk.android.services.network.PinningInfoProvider;
|
||||
import java.io.InputStream;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
class TwitterPinningInfoProvider implements PinningInfoProvider {
|
||||
private static final String[] b;
|
||||
private final Context a;
|
||||
|
||||
static {
|
||||
HashMap hashMap = new HashMap();
|
||||
hashMap.put("VERISIGN_CLASS1", "2343d148a255899b947d461a797ec04cfed170b7");
|
||||
hashMap.put("VERISIGN_CLASS1_G3", "5519b278acb281d7eda7abc18399c3bb690424b5");
|
||||
hashMap.put("VERISIGN_CLASS2_G2", "1237ba4517eead2926fdc1cdfebeedf2ded9145c");
|
||||
hashMap.put("VERISIGN_CLASS2_G3", "5abec575dcaef3b08e271943fc7f250c3df661e3");
|
||||
hashMap.put("VERISIGN_CLASS3_G2", "1a21b4952b6293ce18b365ec9c0e934cb381e6d4");
|
||||
hashMap.put("VERISIGN_CLASS3_G3", "22f19e2ec6eaccfc5d2346f4c2e8f6c554dd5e07");
|
||||
hashMap.put("VERISIGN_CLASS3_G4", "ed663135d31bd4eca614c429e319069f94c12650");
|
||||
hashMap.put("VERISIGN_CLASS3_G5", "b181081a19a4c0941ffae89528c124c99b34acc7");
|
||||
hashMap.put("VERISIGN_CLASS4_G3", "3c03436868951cf3692ab8b426daba8fe922e5bd");
|
||||
hashMap.put("VERISIGN_UNIVERSAL", "bbc23e290bb328771dad3ea24dbdf423bd06b03d");
|
||||
hashMap.put("GEOTRUST_GLOBAL", "c07a98688d89fbab05640c117daa7d65b8cacc4e");
|
||||
hashMap.put("GEOTRUST_GLOBAL2", "713836f2023153472b6eba6546a9101558200509");
|
||||
hashMap.put("GEOTRUST_PRIMARY", "b01989e7effb4aafcb148f58463976224150e1ba");
|
||||
hashMap.put("GEOTRUST_PRIMARY_G2", "bdbea71bab7157f9e475d954d2b727801a822682");
|
||||
hashMap.put("GEOTRUST_PRIMARY_G3", "9ca98d00af740ddd8180d21345a58b8f2e9438d6");
|
||||
hashMap.put("GEOTRUST_UNIVERAL", "87e85b6353c623a3128cb0ffbbf551fe59800e22");
|
||||
hashMap.put("GEOTRUST_UNIVERSAL2", "5e4f538685dd4f9eca5fdc0d456f7d51b1dc9b7b");
|
||||
hashMap.put("DIGICERT_GLOBAL_ROOT", "d52e13c1abe349dae8b49594ef7c3843606466bd");
|
||||
hashMap.put("DIGICERT_EV_ROOT", "83317e62854253d6d7783190ec919056e991b9e3");
|
||||
hashMap.put("DIGICERT_ASSUREDID_ROOT", "68330e61358521592983a3c8d2d2e1406e7ab3c1");
|
||||
hashMap.put("TWITTER1", "56fef3c2147d4ed38837fdbd3052387201e5778d");
|
||||
Collection values = hashMap.values();
|
||||
b = (String[]) values.toArray(new String[values.size()]);
|
||||
}
|
||||
|
||||
public TwitterPinningInfoProvider(Context context) {
|
||||
this.a = context.getApplicationContext();
|
||||
}
|
||||
|
||||
@Override // io.fabric.sdk.android.services.network.PinningInfoProvider
|
||||
public String a() {
|
||||
return "changeit";
|
||||
}
|
||||
|
||||
@Override // io.fabric.sdk.android.services.network.PinningInfoProvider
|
||||
public long b() {
|
||||
return 1487715659454L;
|
||||
}
|
||||
|
||||
@Override // io.fabric.sdk.android.services.network.PinningInfoProvider
|
||||
public InputStream c() {
|
||||
return this.a.getResources().openRawResource(R$raw.tw__cacerts);
|
||||
}
|
||||
|
||||
@Override // io.fabric.sdk.android.services.network.PinningInfoProvider
|
||||
public String[] d() {
|
||||
return b;
|
||||
}
|
||||
}
|
21
sources/com/twitter/sdk/android/core/TwitterRateLimit.java
Normal file
21
sources/com/twitter/sdk/android/core/TwitterRateLimit.java
Normal file
@@ -0,0 +1,21 @@
|
||||
package com.twitter.sdk.android.core;
|
||||
|
||||
import okhttp3.Headers;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class TwitterRateLimit {
|
||||
TwitterRateLimit(Headers headers) {
|
||||
if (headers == null) {
|
||||
throw new IllegalArgumentException("headers must not be null");
|
||||
}
|
||||
for (int i = 0; i < headers.size(); i++) {
|
||||
if ("x-rate-limit-limit".equals(headers.name(i))) {
|
||||
Integer.valueOf(headers.value(i)).intValue();
|
||||
} else if ("x-rate-limit-remaining".equals(headers.name(i))) {
|
||||
Integer.valueOf(headers.value(i)).intValue();
|
||||
} else if ("x-rate-limit-reset".equals(headers.name(i))) {
|
||||
Long.valueOf(headers.value(i)).longValue();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
79
sources/com/twitter/sdk/android/core/TwitterSession.java
Normal file
79
sources/com/twitter/sdk/android/core/TwitterSession.java
Normal file
@@ -0,0 +1,79 @@
|
||||
package com.twitter.sdk.android.core;
|
||||
|
||||
import android.text.TextUtils;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import io.fabric.sdk.android.Fabric;
|
||||
import io.fabric.sdk.android.services.persistence.SerializationStrategy;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class TwitterSession extends Session<TwitterAuthToken> {
|
||||
|
||||
@SerializedName("user_name")
|
||||
private final String c;
|
||||
|
||||
static class Serializer implements SerializationStrategy<TwitterSession> {
|
||||
private final Gson a = new Gson();
|
||||
|
||||
@Override // io.fabric.sdk.android.services.persistence.SerializationStrategy
|
||||
/* renamed from: a, reason: merged with bridge method [inline-methods] */
|
||||
public String serialize(TwitterSession twitterSession) {
|
||||
if (twitterSession == null || twitterSession.a() == null) {
|
||||
return "";
|
||||
}
|
||||
try {
|
||||
return this.a.toJson(twitterSession);
|
||||
} catch (Exception e) {
|
||||
Fabric.g().d("Twitter", e.getMessage());
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
/* JADX WARN: Can't rename method to resolve collision */
|
||||
@Override // io.fabric.sdk.android.services.persistence.SerializationStrategy
|
||||
public TwitterSession a(String str) {
|
||||
if (TextUtils.isEmpty(str)) {
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
return (TwitterSession) this.a.fromJson(str, TwitterSession.class);
|
||||
} catch (Exception e) {
|
||||
Fabric.g().d("Twitter", e.getMessage());
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public TwitterSession(TwitterAuthToken twitterAuthToken, long j, String str) {
|
||||
super(twitterAuthToken, j);
|
||||
this.c = str;
|
||||
}
|
||||
|
||||
public long c() {
|
||||
return b();
|
||||
}
|
||||
|
||||
public String d() {
|
||||
return this.c;
|
||||
}
|
||||
|
||||
@Override // com.twitter.sdk.android.core.Session
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj) {
|
||||
return true;
|
||||
}
|
||||
if (obj == null || TwitterSession.class != obj.getClass() || !super.equals(obj)) {
|
||||
return false;
|
||||
}
|
||||
String str = this.c;
|
||||
String str2 = ((TwitterSession) obj).c;
|
||||
return str != null ? str.equals(str2) : str2 == null;
|
||||
}
|
||||
|
||||
@Override // com.twitter.sdk.android.core.Session
|
||||
public int hashCode() {
|
||||
int hashCode = super.hashCode() * 31;
|
||||
String str = this.c;
|
||||
return hashCode + (str != null ? str.hashCode() : 0);
|
||||
}
|
||||
}
|
@@ -0,0 +1,56 @@
|
||||
package com.twitter.sdk.android.core.identity;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Intent;
|
||||
import com.twitter.sdk.android.core.Callback;
|
||||
import com.twitter.sdk.android.core.Result;
|
||||
import com.twitter.sdk.android.core.TwitterAuthConfig;
|
||||
import com.twitter.sdk.android.core.TwitterAuthException;
|
||||
import com.twitter.sdk.android.core.TwitterAuthToken;
|
||||
import com.twitter.sdk.android.core.TwitterSession;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public abstract class AuthHandler {
|
||||
protected final int a;
|
||||
private final TwitterAuthConfig b;
|
||||
private final Callback<TwitterSession> c;
|
||||
|
||||
AuthHandler(TwitterAuthConfig twitterAuthConfig, Callback<TwitterSession> callback, int i) {
|
||||
this.b = twitterAuthConfig;
|
||||
this.c = callback;
|
||||
this.a = i;
|
||||
}
|
||||
|
||||
TwitterAuthConfig a() {
|
||||
return this.b;
|
||||
}
|
||||
|
||||
public abstract boolean a(Activity activity);
|
||||
|
||||
Callback<TwitterSession> b() {
|
||||
return this.c;
|
||||
}
|
||||
|
||||
public boolean a(int i, int i2, Intent intent) {
|
||||
if (this.a != i) {
|
||||
return false;
|
||||
}
|
||||
Callback<TwitterSession> b = b();
|
||||
if (b == null) {
|
||||
return true;
|
||||
}
|
||||
if (i2 == -1) {
|
||||
String stringExtra = intent.getStringExtra("tk");
|
||||
String stringExtra2 = intent.getStringExtra("ts");
|
||||
String stringExtra3 = intent.getStringExtra("screen_name");
|
||||
b.a(new Result<>(new TwitterSession(new TwitterAuthToken(stringExtra, stringExtra2), intent.getLongExtra("user_id", 0L), stringExtra3), null));
|
||||
return true;
|
||||
}
|
||||
if (intent == null || !intent.hasExtra("auth_error")) {
|
||||
b.a(new TwitterAuthException("Authorize failed."));
|
||||
return true;
|
||||
}
|
||||
b.a((TwitterAuthException) intent.getSerializableExtra("auth_error"));
|
||||
return true;
|
||||
}
|
||||
}
|
39
sources/com/twitter/sdk/android/core/identity/AuthState.java
Normal file
39
sources/com/twitter/sdk/android/core/identity/AuthState.java
Normal file
@@ -0,0 +1,39 @@
|
||||
package com.twitter.sdk.android.core.identity;
|
||||
|
||||
import android.app.Activity;
|
||||
import io.fabric.sdk.android.Fabric;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
class AuthState {
|
||||
final AtomicReference<AuthHandler> a = new AtomicReference<>(null);
|
||||
|
||||
AuthState() {
|
||||
}
|
||||
|
||||
public boolean a(Activity activity, AuthHandler authHandler) {
|
||||
if (c()) {
|
||||
Fabric.g().w("Twitter", "Authorize already in progress");
|
||||
} else if (authHandler.a(activity)) {
|
||||
boolean compareAndSet = this.a.compareAndSet(null, authHandler);
|
||||
if (compareAndSet) {
|
||||
return compareAndSet;
|
||||
}
|
||||
Fabric.g().w("Twitter", "Failed to update authHandler, authorize already in progress.");
|
||||
return compareAndSet;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public AuthHandler b() {
|
||||
return this.a.get();
|
||||
}
|
||||
|
||||
public boolean c() {
|
||||
return this.a.get() != null;
|
||||
}
|
||||
|
||||
public void a() {
|
||||
this.a.set(null);
|
||||
}
|
||||
}
|
@@ -0,0 +1,53 @@
|
||||
package com.twitter.sdk.android.core.identity;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.webkit.WebView;
|
||||
import android.widget.ProgressBar;
|
||||
import com.twitter.sdk.android.core.R$id;
|
||||
import com.twitter.sdk.android.core.R$layout;
|
||||
import com.twitter.sdk.android.core.TwitterAuthConfig;
|
||||
import com.twitter.sdk.android.core.TwitterAuthException;
|
||||
import com.twitter.sdk.android.core.TwitterCore;
|
||||
import com.twitter.sdk.android.core.identity.OAuthController;
|
||||
import com.twitter.sdk.android.core.internal.TwitterApi;
|
||||
import com.twitter.sdk.android.core.internal.oauth.OAuth1aService;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class OAuthActivity extends Activity implements OAuthController.Listener {
|
||||
OAuthController a;
|
||||
private ProgressBar b;
|
||||
private WebView c;
|
||||
|
||||
@Override // com.twitter.sdk.android.core.identity.OAuthController.Listener
|
||||
public void a(int i, Intent intent) {
|
||||
setResult(i, intent);
|
||||
finish();
|
||||
}
|
||||
|
||||
@Override // android.app.Activity
|
||||
public void onBackPressed() {
|
||||
this.a.a(0, new TwitterAuthException("Authorization failed, request was canceled."));
|
||||
}
|
||||
|
||||
@Override // android.app.Activity
|
||||
protected void onCreate(Bundle bundle) {
|
||||
super.onCreate(bundle);
|
||||
setContentView(R$layout.tw__activity_oauth);
|
||||
this.b = (ProgressBar) findViewById(R$id.tw__spinner);
|
||||
this.c = (WebView) findViewById(R$id.tw__web_view);
|
||||
this.b.setVisibility(bundle != null ? bundle.getBoolean("progress", false) : true ? 0 : 8);
|
||||
TwitterCore z = TwitterCore.z();
|
||||
this.a = new OAuthController(this.b, this.c, (TwitterAuthConfig) getIntent().getParcelableExtra("auth_config"), new OAuth1aService(z, z.t(), new TwitterApi()), this);
|
||||
this.a.c();
|
||||
}
|
||||
|
||||
@Override // android.app.Activity
|
||||
protected void onSaveInstanceState(Bundle bundle) {
|
||||
if (this.b.getVisibility() == 0) {
|
||||
bundle.putBoolean("progress", true);
|
||||
}
|
||||
super.onSaveInstanceState(bundle);
|
||||
}
|
||||
}
|
@@ -0,0 +1,150 @@
|
||||
package com.twitter.sdk.android.core.identity;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.webkit.WebChromeClient;
|
||||
import android.webkit.WebSettings;
|
||||
import android.webkit.WebView;
|
||||
import android.webkit.WebViewClient;
|
||||
import android.widget.ProgressBar;
|
||||
import com.twitter.sdk.android.core.Callback;
|
||||
import com.twitter.sdk.android.core.Result;
|
||||
import com.twitter.sdk.android.core.TwitterAuthConfig;
|
||||
import com.twitter.sdk.android.core.TwitterAuthException;
|
||||
import com.twitter.sdk.android.core.TwitterAuthToken;
|
||||
import com.twitter.sdk.android.core.TwitterException;
|
||||
import com.twitter.sdk.android.core.identity.OAuthWebViewClient;
|
||||
import com.twitter.sdk.android.core.internal.oauth.OAuth1aService;
|
||||
import com.twitter.sdk.android.core.internal.oauth.OAuthResponse;
|
||||
import io.fabric.sdk.android.Fabric;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
class OAuthController implements OAuthWebViewClient.Listener {
|
||||
final Listener a;
|
||||
TwitterAuthToken b;
|
||||
private final ProgressBar c;
|
||||
private final WebView d;
|
||||
private final TwitterAuthConfig e;
|
||||
private final OAuth1aService f;
|
||||
|
||||
interface Listener {
|
||||
void a(int i, Intent intent);
|
||||
}
|
||||
|
||||
OAuthController(ProgressBar progressBar, WebView webView, TwitterAuthConfig twitterAuthConfig, OAuth1aService oAuth1aService, Listener listener) {
|
||||
this.c = progressBar;
|
||||
this.d = webView;
|
||||
this.e = twitterAuthConfig;
|
||||
this.f = oAuth1aService;
|
||||
this.a = listener;
|
||||
}
|
||||
|
||||
private void d() {
|
||||
this.c.setVisibility(8);
|
||||
}
|
||||
|
||||
private void e() {
|
||||
this.d.stopLoading();
|
||||
d();
|
||||
}
|
||||
|
||||
protected void a(int i, TwitterAuthException twitterAuthException) {
|
||||
Intent intent = new Intent();
|
||||
intent.putExtra("auth_error", twitterAuthException);
|
||||
this.a.a(i, intent);
|
||||
}
|
||||
|
||||
Callback<OAuthResponse> b() {
|
||||
return new Callback<OAuthResponse>() { // from class: com.twitter.sdk.android.core.identity.OAuthController.1
|
||||
@Override // com.twitter.sdk.android.core.Callback
|
||||
public void a(Result<OAuthResponse> result) {
|
||||
OAuthController oAuthController = OAuthController.this;
|
||||
oAuthController.b = result.a.authToken;
|
||||
String a = oAuthController.f.a(OAuthController.this.b);
|
||||
Fabric.g().d("Twitter", "Redirecting user to web view to complete authorization flow");
|
||||
OAuthController oAuthController2 = OAuthController.this;
|
||||
oAuthController2.a(oAuthController2.d, new OAuthWebViewClient(OAuthController.this.f.a(OAuthController.this.e), OAuthController.this), a, new OAuthWebChromeClient());
|
||||
}
|
||||
|
||||
@Override // com.twitter.sdk.android.core.Callback
|
||||
public void a(TwitterException twitterException) {
|
||||
Fabric.g().b("Twitter", "Failed to get request token", twitterException);
|
||||
OAuthController.this.a(1, new TwitterAuthException("Failed to get request token"));
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
void c() {
|
||||
Fabric.g().d("Twitter", "Obtaining request token to start the sign in flow");
|
||||
this.f.b(b());
|
||||
}
|
||||
|
||||
private void b(Bundle bundle) {
|
||||
String string;
|
||||
Fabric.g().d("Twitter", "OAuth web view completed successfully");
|
||||
if (bundle != null && (string = bundle.getString("oauth_verifier")) != null) {
|
||||
Fabric.g().d("Twitter", "Converting the request token to an access token.");
|
||||
this.f.a(a(), this.b, string);
|
||||
return;
|
||||
}
|
||||
Fabric.g().b("Twitter", "Failed to get authorization, bundle incomplete " + bundle, null);
|
||||
a(1, new TwitterAuthException("Failed to get authorization, bundle incomplete"));
|
||||
}
|
||||
|
||||
void a(WebView webView, WebViewClient webViewClient, String str, WebChromeClient webChromeClient) {
|
||||
WebSettings settings = webView.getSettings();
|
||||
settings.setAllowFileAccess(false);
|
||||
settings.setJavaScriptEnabled(false);
|
||||
settings.setSaveFormData(false);
|
||||
webView.setVerticalScrollBarEnabled(false);
|
||||
webView.setHorizontalScrollBarEnabled(false);
|
||||
webView.setWebViewClient(webViewClient);
|
||||
webView.loadUrl(str);
|
||||
webView.setVisibility(4);
|
||||
webView.setWebChromeClient(webChromeClient);
|
||||
}
|
||||
|
||||
private void b(WebViewException webViewException) {
|
||||
Fabric.g().b("Twitter", "OAuth web view completed with an error", webViewException);
|
||||
a(1, new TwitterAuthException("OAuth web view completed with an error"));
|
||||
}
|
||||
|
||||
Callback<OAuthResponse> a() {
|
||||
return new Callback<OAuthResponse>() { // from class: com.twitter.sdk.android.core.identity.OAuthController.2
|
||||
@Override // com.twitter.sdk.android.core.Callback
|
||||
public void a(Result<OAuthResponse> result) {
|
||||
Intent intent = new Intent();
|
||||
OAuthResponse oAuthResponse = result.a;
|
||||
intent.putExtra("screen_name", oAuthResponse.userName);
|
||||
intent.putExtra("user_id", oAuthResponse.userId);
|
||||
intent.putExtra("tk", oAuthResponse.authToken.token);
|
||||
intent.putExtra("ts", oAuthResponse.authToken.secret);
|
||||
OAuthController.this.a.a(-1, intent);
|
||||
}
|
||||
|
||||
@Override // com.twitter.sdk.android.core.Callback
|
||||
public void a(TwitterException twitterException) {
|
||||
Fabric.g().b("Twitter", "Failed to get access token", twitterException);
|
||||
OAuthController.this.a(1, new TwitterAuthException("Failed to get access token"));
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@Override // com.twitter.sdk.android.core.identity.OAuthWebViewClient.Listener
|
||||
public void a(WebView webView, String str) {
|
||||
d();
|
||||
webView.setVisibility(0);
|
||||
}
|
||||
|
||||
@Override // com.twitter.sdk.android.core.identity.OAuthWebViewClient.Listener
|
||||
public void a(Bundle bundle) {
|
||||
b(bundle);
|
||||
e();
|
||||
}
|
||||
|
||||
@Override // com.twitter.sdk.android.core.identity.OAuthWebViewClient.Listener
|
||||
public void a(WebViewException webViewException) {
|
||||
b(webViewException);
|
||||
e();
|
||||
}
|
||||
}
|
@@ -0,0 +1,26 @@
|
||||
package com.twitter.sdk.android.core.identity;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Intent;
|
||||
import com.twitter.sdk.android.core.Callback;
|
||||
import com.twitter.sdk.android.core.TwitterAuthConfig;
|
||||
import com.twitter.sdk.android.core.TwitterSession;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
class OAuthHandler extends AuthHandler {
|
||||
public OAuthHandler(TwitterAuthConfig twitterAuthConfig, Callback<TwitterSession> callback, int i) {
|
||||
super(twitterAuthConfig, callback, i);
|
||||
}
|
||||
|
||||
@Override // com.twitter.sdk.android.core.identity.AuthHandler
|
||||
public boolean a(Activity activity) {
|
||||
activity.startActivityForResult(b(activity), this.a);
|
||||
return true;
|
||||
}
|
||||
|
||||
Intent b(Activity activity) {
|
||||
Intent intent = new Intent(activity, (Class<?>) OAuthActivity.class);
|
||||
intent.putExtra("auth_config", a());
|
||||
return intent;
|
||||
}
|
||||
}
|
@@ -0,0 +1,15 @@
|
||||
package com.twitter.sdk.android.core.identity;
|
||||
|
||||
import android.webkit.ConsoleMessage;
|
||||
import android.webkit.WebChromeClient;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
class OAuthWebChromeClient extends WebChromeClient {
|
||||
OAuthWebChromeClient() {
|
||||
}
|
||||
|
||||
@Override // android.webkit.WebChromeClient
|
||||
public boolean onConsoleMessage(ConsoleMessage consoleMessage) {
|
||||
return true;
|
||||
}
|
||||
}
|
@@ -0,0 +1,62 @@
|
||||
package com.twitter.sdk.android.core.identity;
|
||||
|
||||
import android.net.http.SslError;
|
||||
import android.os.Bundle;
|
||||
import android.webkit.SslErrorHandler;
|
||||
import android.webkit.WebView;
|
||||
import android.webkit.WebViewClient;
|
||||
import io.fabric.sdk.android.services.network.UrlUtils;
|
||||
import java.net.URI;
|
||||
import java.util.Map;
|
||||
import java.util.TreeMap;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
class OAuthWebViewClient extends WebViewClient {
|
||||
private final String a;
|
||||
private final Listener b;
|
||||
|
||||
interface Listener {
|
||||
void a(Bundle bundle);
|
||||
|
||||
void a(WebView webView, String str);
|
||||
|
||||
void a(WebViewException webViewException);
|
||||
}
|
||||
|
||||
public OAuthWebViewClient(String str, Listener listener) {
|
||||
this.a = str;
|
||||
this.b = listener;
|
||||
}
|
||||
|
||||
@Override // android.webkit.WebViewClient
|
||||
public void onPageFinished(WebView webView, String str) {
|
||||
super.onPageFinished(webView, str);
|
||||
this.b.a(webView, str);
|
||||
}
|
||||
|
||||
@Override // android.webkit.WebViewClient
|
||||
public void onReceivedError(WebView webView, int i, String str, String str2) {
|
||||
super.onReceivedError(webView, i, str, str2);
|
||||
this.b.a(new WebViewException(i, str, str2));
|
||||
}
|
||||
|
||||
@Override // android.webkit.WebViewClient
|
||||
public void onReceivedSslError(WebView webView, SslErrorHandler sslErrorHandler, SslError sslError) {
|
||||
super.onReceivedSslError(webView, sslErrorHandler, sslError);
|
||||
this.b.a(new WebViewException(sslError.getPrimaryError(), null, null));
|
||||
}
|
||||
|
||||
@Override // android.webkit.WebViewClient
|
||||
public boolean shouldOverrideUrlLoading(WebView webView, String str) {
|
||||
if (!str.startsWith(this.a)) {
|
||||
return super.shouldOverrideUrlLoading(webView, str);
|
||||
}
|
||||
TreeMap<String, String> a = UrlUtils.a(URI.create(str), false);
|
||||
Bundle bundle = new Bundle(a.size());
|
||||
for (Map.Entry<String, String> entry : a.entrySet()) {
|
||||
bundle.putString(entry.getKey(), entry.getValue());
|
||||
}
|
||||
this.b.a(bundle);
|
||||
return true;
|
||||
}
|
||||
}
|
@@ -0,0 +1,76 @@
|
||||
package com.twitter.sdk.android.core.identity;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.ComponentName;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.content.pm.Signature;
|
||||
import com.twitter.sdk.android.core.Callback;
|
||||
import com.twitter.sdk.android.core.IntentUtils;
|
||||
import com.twitter.sdk.android.core.TwitterAuthConfig;
|
||||
import com.twitter.sdk.android.core.TwitterSession;
|
||||
import io.fabric.sdk.android.Fabric;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
class SSOAuthHandler extends AuthHandler {
|
||||
public SSOAuthHandler(TwitterAuthConfig twitterAuthConfig, Callback<TwitterSession> callback, int i) {
|
||||
super(twitterAuthConfig, callback, i);
|
||||
}
|
||||
|
||||
private boolean b(Activity activity) {
|
||||
String a = a(activity.getPackageManager());
|
||||
if (a == null) {
|
||||
Fabric.g().b("Twitter", "SSO app signature check failed", null);
|
||||
return false;
|
||||
}
|
||||
ComponentName componentName = new ComponentName(a, "com.twitter.android.SingleSignOnActivity");
|
||||
TwitterAuthConfig a2 = a();
|
||||
Intent component = new Intent().setComponent(componentName);
|
||||
if (!IntentUtils.a(activity, component)) {
|
||||
Fabric.g().b("Twitter", "SSO auth activity not found", null);
|
||||
return false;
|
||||
}
|
||||
component.putExtra("ck", a2.getConsumerKey()).putExtra("cs", a2.getConsumerSecret());
|
||||
try {
|
||||
activity.startActivityForResult(component, this.a);
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
Fabric.g().b("Twitter", "SSO exception occurred", e);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override // com.twitter.sdk.android.core.identity.AuthHandler
|
||||
public boolean a(Activity activity) {
|
||||
return b(activity);
|
||||
}
|
||||
|
||||
public static String a(PackageManager packageManager) {
|
||||
if (a(packageManager, "com.twitter.android", "3082025d308201c6a00302010202044bd76cce300d06092a864886f70d01010505003073310b3009060355040613025553310b3009060355040813024341311630140603550407130d53616e204672616e636973636f31163014060355040a130d547769747465722c20496e632e310f300d060355040b13064d6f62696c65311630140603550403130d4c656c616e6420526563686973301e170d3130303432373233303133345a170d3438303832353233303133345a3073310b3009060355040613025553310b3009060355040813024341311630140603550407130d53616e204672616e636973636f31163014060355040a130d547769747465722c20496e632e310f300d060355040b13064d6f62696c65311630140603550403130d4c656c616e642052656368697330819f300d06092a864886f70d010101050003818d003081890281810086233c2e51c62232d49cc932e470713d63a6a1106b38f9e442e01bc79ca4f95c72b2cb3f1369ef7dea6036bff7c4b2828cb3787e7657ad83986751ced5b131fcc6f413efb7334e32ed9787f9e9a249ae108fa66009ac7a7932c25d37e1e07d4f9f66aa494c270dbac87d261c9668d321c2fba4ef2800e46671a597ff2eac5d7f0203010001300d06092a864886f70d0101050500038181003e1f01cb6ea8be8d2cecef5cd2a64c97ba8728aa5f08f8275d00508d64d139b6a72c5716b40a040df0eeeda04de9361107e123ee8d3dc05e70c8a355f46dbadf1235443b0b214c57211afd4edd147451c443d49498d2a7ff27e45a99c39b9e47429a1dae843ba233bf8ca81296dbe1dc5c5434514d995b0279246809392a219b")) {
|
||||
return "com.twitter.android";
|
||||
}
|
||||
if (a(packageManager, "com.twitter.android.beta", "308203523082023aa00302010202044fd0006b300d06092a864886f70d0101050500306b310b3009060355040613025553310b3009060355040813024341311630140603550407130d53616e204672616e636973636f3110300e060355040a130754776974746572310f300d060355040b13064d6f62696c65311430120603550403130b4a6f6e617468616e204c65301e170d3132303630373031313431395a170d3339313032343031313431395a306b310b3009060355040613025553310b3009060355040813024341311630140603550407130d53616e204672616e636973636f3110300e060355040a130754776974746572310f300d060355040b13064d6f62696c65311430120603550403130b4a6f6e617468616e204c6530820122300d06092a864886f70d01010105000382010f003082010a028201010089e6cbdfed4288a9c0a215d33d4fa978a5bdd20be426ef4b497d358a9fd1c6efec9684f059f6955e60e5fda1b5910bb2d097e7421a78f9c81e95cd8ef3bf50add7f8d9f073c0478736a6c7fd38c5871559783a76420d37f3f874f2114ec02532e85587791d24037485b1b95ec8cbc75b52042867988b51c7c3589d5b5972fd20a2e8a7c9ced986873f5008a418b2921daa7cfb78afc174eecdb8a79dc0961bea9740d09c4656ac9b8c86263a788e35af1d4a3f86ce053a1aefb5369def91614a390219f896f378712376baa05934a341798950e229f4f735b86004952b259f23cc9fc3b8c1bc8171984884dc92940e91f2e9a78a84a78f0c2946b7e37bbf3b9b0203010001300d06092a864886f70d010105050003820101001cf15250365e66cc87bb5054de1661266cf87907841016b20dfa1f9f59842020cbc33f9b4d41717db0428d11696a0bade6a4950a48cc4fa8ae56c850647379a5c2d977436b644162c453dd36b7745ccb9ff0b5fc070125024de73dab6dcda5c69372e978a49865f569927199ed0f61d7cbee1839079a7da2e83f8c90f7421a8c81b3f17f1cc05d52aedac9acd6e092ffd9ad572960e779a5b91a78e1aeb2b3c7b24464bd223c745e40abd74fc586310809520d183443fcca3c6ade3be458afedbd3325df9c0e552636e35bb55b240eb8c0ba3973c4fb81213f22363be2d70e85014650c2f4fc679747a7ec31ea7b08da7dd9b9ba279a7fbbc1bd440fbe831bf4")) {
|
||||
return "com.twitter.android.beta";
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static boolean a(Context context) {
|
||||
PackageManager packageManager = context.getPackageManager();
|
||||
return a(packageManager, "com.twitter.android", "3082025d308201c6a00302010202044bd76cce300d06092a864886f70d01010505003073310b3009060355040613025553310b3009060355040813024341311630140603550407130d53616e204672616e636973636f31163014060355040a130d547769747465722c20496e632e310f300d060355040b13064d6f62696c65311630140603550403130d4c656c616e6420526563686973301e170d3130303432373233303133345a170d3438303832353233303133345a3073310b3009060355040613025553310b3009060355040813024341311630140603550407130d53616e204672616e636973636f31163014060355040a130d547769747465722c20496e632e310f300d060355040b13064d6f62696c65311630140603550403130d4c656c616e642052656368697330819f300d06092a864886f70d010101050003818d003081890281810086233c2e51c62232d49cc932e470713d63a6a1106b38f9e442e01bc79ca4f95c72b2cb3f1369ef7dea6036bff7c4b2828cb3787e7657ad83986751ced5b131fcc6f413efb7334e32ed9787f9e9a249ae108fa66009ac7a7932c25d37e1e07d4f9f66aa494c270dbac87d261c9668d321c2fba4ef2800e46671a597ff2eac5d7f0203010001300d06092a864886f70d0101050500038181003e1f01cb6ea8be8d2cecef5cd2a64c97ba8728aa5f08f8275d00508d64d139b6a72c5716b40a040df0eeeda04de9361107e123ee8d3dc05e70c8a355f46dbadf1235443b0b214c57211afd4edd147451c443d49498d2a7ff27e45a99c39b9e47429a1dae843ba233bf8ca81296dbe1dc5c5434514d995b0279246809392a219b") || a(packageManager, "com.twitter.android.beta", "308203523082023aa00302010202044fd0006b300d06092a864886f70d0101050500306b310b3009060355040613025553310b3009060355040813024341311630140603550407130d53616e204672616e636973636f3110300e060355040a130754776974746572310f300d060355040b13064d6f62696c65311430120603550403130b4a6f6e617468616e204c65301e170d3132303630373031313431395a170d3339313032343031313431395a306b310b3009060355040613025553310b3009060355040813024341311630140603550407130d53616e204672616e636973636f3110300e060355040a130754776974746572310f300d060355040b13064d6f62696c65311430120603550403130b4a6f6e617468616e204c6530820122300d06092a864886f70d01010105000382010f003082010a028201010089e6cbdfed4288a9c0a215d33d4fa978a5bdd20be426ef4b497d358a9fd1c6efec9684f059f6955e60e5fda1b5910bb2d097e7421a78f9c81e95cd8ef3bf50add7f8d9f073c0478736a6c7fd38c5871559783a76420d37f3f874f2114ec02532e85587791d24037485b1b95ec8cbc75b52042867988b51c7c3589d5b5972fd20a2e8a7c9ced986873f5008a418b2921daa7cfb78afc174eecdb8a79dc0961bea9740d09c4656ac9b8c86263a788e35af1d4a3f86ce053a1aefb5369def91614a390219f896f378712376baa05934a341798950e229f4f735b86004952b259f23cc9fc3b8c1bc8171984884dc92940e91f2e9a78a84a78f0c2946b7e37bbf3b9b0203010001300d06092a864886f70d010105050003820101001cf15250365e66cc87bb5054de1661266cf87907841016b20dfa1f9f59842020cbc33f9b4d41717db0428d11696a0bade6a4950a48cc4fa8ae56c850647379a5c2d977436b644162c453dd36b7745ccb9ff0b5fc070125024de73dab6dcda5c69372e978a49865f569927199ed0f61d7cbee1839079a7da2e83f8c90f7421a8c81b3f17f1cc05d52aedac9acd6e092ffd9ad572960e779a5b91a78e1aeb2b3c7b24464bd223c745e40abd74fc586310809520d183443fcca3c6ade3be458afedbd3325df9c0e552636e35bb55b240eb8c0ba3973c4fb81213f22363be2d70e85014650c2f4fc679747a7ec31ea7b08da7dd9b9ba279a7fbbc1bd440fbe831bf4");
|
||||
}
|
||||
|
||||
private static boolean a(PackageManager packageManager, String str, String str2) {
|
||||
try {
|
||||
for (Signature signature : packageManager.getPackageInfo(str, 64).signatures) {
|
||||
if (!str2.equals(signature.toCharsString())) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
} catch (PackageManager.NameNotFoundException unused) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,74 @@
|
||||
package com.twitter.sdk.android.core.identity;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.os.ResultReceiver;
|
||||
import android.view.View;
|
||||
import android.widget.TextView;
|
||||
import com.twitter.sdk.android.core.R$id;
|
||||
import com.twitter.sdk.android.core.R$layout;
|
||||
import com.twitter.sdk.android.core.R$string;
|
||||
import com.twitter.sdk.android.core.TwitterCore;
|
||||
import com.twitter.sdk.android.core.TwitterSession;
|
||||
import io.fabric.sdk.android.Fabric;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class ShareEmailActivity extends Activity {
|
||||
ShareEmailController a;
|
||||
private TwitterSession b;
|
||||
|
||||
private ResultReceiver a(Intent intent) {
|
||||
ResultReceiver resultReceiver = (ResultReceiver) intent.getParcelableExtra("result_receiver");
|
||||
if (resultReceiver != null) {
|
||||
return resultReceiver;
|
||||
}
|
||||
throw new IllegalArgumentException("ResultReceiver must not be null. This activity should not be started directly.");
|
||||
}
|
||||
|
||||
private TwitterSession b(Intent intent) {
|
||||
long longExtra = intent.getLongExtra("session_id", -1L);
|
||||
TwitterSession b = TwitterCore.z().u().b(longExtra);
|
||||
if (b != null) {
|
||||
return b;
|
||||
}
|
||||
throw new IllegalArgumentException("No TwitterSession for id:" + longExtra);
|
||||
}
|
||||
|
||||
@Override // android.app.Activity
|
||||
public void onBackPressed() {
|
||||
this.a.a();
|
||||
super.onBackPressed();
|
||||
}
|
||||
|
||||
public void onClickAllow(View view) {
|
||||
this.a.b();
|
||||
finish();
|
||||
}
|
||||
|
||||
public void onClickNotNow(View view) {
|
||||
this.a.a();
|
||||
finish();
|
||||
}
|
||||
|
||||
@Override // android.app.Activity
|
||||
protected void onCreate(Bundle bundle) {
|
||||
super.onCreate(bundle);
|
||||
setContentView(R$layout.tw__activity_share_email);
|
||||
try {
|
||||
Intent intent = getIntent();
|
||||
ResultReceiver a = a(intent);
|
||||
this.b = b(intent);
|
||||
this.a = new ShareEmailController(new ShareEmailClient(this.b), a);
|
||||
a(this, (TextView) findViewById(R$id.tw__share_email_desc));
|
||||
} catch (IllegalArgumentException e) {
|
||||
Fabric.g().b("Twitter", "Failed to create ShareEmailActivity.", e);
|
||||
finish();
|
||||
}
|
||||
}
|
||||
|
||||
void a(Context context, TextView textView) {
|
||||
textView.setText(getResources().getString(R$string.tw__share_email_desc, context.getPackageManager().getApplicationLabel(context.getApplicationInfo()), this.b.d()));
|
||||
}
|
||||
}
|
@@ -0,0 +1,26 @@
|
||||
package com.twitter.sdk.android.core.identity;
|
||||
|
||||
import com.twitter.sdk.android.core.Callback;
|
||||
import com.twitter.sdk.android.core.TwitterApiClient;
|
||||
import com.twitter.sdk.android.core.TwitterSession;
|
||||
import com.twitter.sdk.android.core.models.User;
|
||||
import retrofit2.Call;
|
||||
import retrofit2.http.GET;
|
||||
import retrofit2.http.Query;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
class ShareEmailClient extends TwitterApiClient {
|
||||
|
||||
interface EmailService {
|
||||
@GET("/1.1/account/verify_credentials.json?include_email=true")
|
||||
Call<User> verifyCredentials(@Query("include_entities") Boolean bool, @Query("skip_status") Boolean bool2);
|
||||
}
|
||||
|
||||
ShareEmailClient(TwitterSession twitterSession) {
|
||||
super(twitterSession);
|
||||
}
|
||||
|
||||
protected void a(Callback<User> callback) {
|
||||
((EmailService) a(EmailService.class)).verifyCredentials(true, true).enqueue(callback);
|
||||
}
|
||||
}
|
@@ -0,0 +1,70 @@
|
||||
package com.twitter.sdk.android.core.identity;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.os.ResultReceiver;
|
||||
import com.baidu.cloud.media.player.BDCloudMediaPlayer;
|
||||
import com.tencent.open.SocialConstants;
|
||||
import com.twitter.sdk.android.core.Callback;
|
||||
import com.twitter.sdk.android.core.Result;
|
||||
import com.twitter.sdk.android.core.TwitterException;
|
||||
import com.twitter.sdk.android.core.models.User;
|
||||
import io.fabric.sdk.android.Fabric;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
class ShareEmailController {
|
||||
private final ShareEmailClient a;
|
||||
private final ResultReceiver b;
|
||||
|
||||
public ShareEmailController(ShareEmailClient shareEmailClient, ResultReceiver resultReceiver) {
|
||||
this.a = shareEmailClient;
|
||||
this.b = resultReceiver;
|
||||
}
|
||||
|
||||
void a(User user) {
|
||||
String str = user.email;
|
||||
if (str == null) {
|
||||
a(new TwitterException("Your application may not have access to email addresses or the user may not have an email address. To request access, please visit https://support.twitter.com/forms/platform."));
|
||||
} else if ("".equals(str)) {
|
||||
a(new TwitterException("This user does not have an email address."));
|
||||
} else {
|
||||
a(user.email);
|
||||
}
|
||||
}
|
||||
|
||||
public void b() {
|
||||
this.a.a(c());
|
||||
}
|
||||
|
||||
Callback<User> c() {
|
||||
return new Callback<User>() { // from class: com.twitter.sdk.android.core.identity.ShareEmailController.1
|
||||
@Override // com.twitter.sdk.android.core.Callback
|
||||
public void a(Result<User> result) {
|
||||
ShareEmailController.this.a(result.a);
|
||||
}
|
||||
|
||||
@Override // com.twitter.sdk.android.core.Callback
|
||||
public void a(TwitterException twitterException) {
|
||||
Fabric.g().b("Twitter", "Failed to get email address.", twitterException);
|
||||
ShareEmailController.this.a(new TwitterException("Failed to get email address."));
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
void a(String str) {
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putString("email", str);
|
||||
this.b.send(-1, bundle);
|
||||
}
|
||||
|
||||
void a(TwitterException twitterException) {
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putSerializable(BDCloudMediaPlayer.OnNativeInvokeListener.ARG_ERROR, twitterException);
|
||||
this.b.send(1, bundle);
|
||||
}
|
||||
|
||||
public void a() {
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putSerializable(SocialConstants.PARAM_SEND_MSG, "The user chose not to share their email address at this time.");
|
||||
this.b.send(0, bundle);
|
||||
}
|
||||
}
|
@@ -0,0 +1,39 @@
|
||||
package com.twitter.sdk.android.core.identity;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.os.ResultReceiver;
|
||||
import com.baidu.cloud.media.player.BDCloudMediaPlayer;
|
||||
import com.tencent.open.SocialConstants;
|
||||
import com.twitter.sdk.android.core.Callback;
|
||||
import com.twitter.sdk.android.core.Result;
|
||||
import com.twitter.sdk.android.core.TwitterException;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
class ShareEmailResultReceiver extends ResultReceiver {
|
||||
private final Callback<String> callback;
|
||||
|
||||
public ShareEmailResultReceiver(Callback<String> callback) {
|
||||
super(null);
|
||||
if (callback == null) {
|
||||
throw new IllegalArgumentException("Callback must not be null");
|
||||
}
|
||||
this.callback = callback;
|
||||
}
|
||||
|
||||
@Override // android.os.ResultReceiver
|
||||
public void onReceiveResult(int i, Bundle bundle) {
|
||||
if (i == -1) {
|
||||
this.callback.a(new Result<>(bundle.getString("email"), null));
|
||||
return;
|
||||
}
|
||||
if (i == 0) {
|
||||
this.callback.a(new TwitterException(bundle.getString(SocialConstants.PARAM_SEND_MSG)));
|
||||
} else {
|
||||
if (i == 1) {
|
||||
this.callback.a((TwitterException) bundle.getSerializable(BDCloudMediaPlayer.OnNativeInvokeListener.ARG_ERROR));
|
||||
return;
|
||||
}
|
||||
throw new IllegalArgumentException("Invalid result code " + i);
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,134 @@
|
||||
package com.twitter.sdk.android.core.identity;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import com.twitter.sdk.android.core.Callback;
|
||||
import com.twitter.sdk.android.core.Result;
|
||||
import com.twitter.sdk.android.core.SessionManager;
|
||||
import com.twitter.sdk.android.core.TwitterAuthConfig;
|
||||
import com.twitter.sdk.android.core.TwitterAuthException;
|
||||
import com.twitter.sdk.android.core.TwitterCore;
|
||||
import com.twitter.sdk.android.core.TwitterException;
|
||||
import com.twitter.sdk.android.core.TwitterSession;
|
||||
import com.twitter.sdk.android.core.internal.scribe.DefaultScribeClient;
|
||||
import com.twitter.sdk.android.core.internal.scribe.EventNamespace;
|
||||
import com.twitter.sdk.android.core.internal.scribe.TwitterCoreScribeClientHolder;
|
||||
import com.ubt.jimu.base.cache.Constants;
|
||||
import io.fabric.sdk.android.Fabric;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class TwitterAuthClient {
|
||||
final AuthState a;
|
||||
final SessionManager<TwitterSession> b;
|
||||
private final TwitterAuthConfig c;
|
||||
|
||||
private static class AuthStateLazyHolder {
|
||||
private static final AuthState a = new AuthState();
|
||||
}
|
||||
|
||||
public TwitterAuthClient() {
|
||||
this(TwitterCore.z().d(), TwitterCore.z().q(), TwitterCore.z().u(), AuthStateLazyHolder.a);
|
||||
}
|
||||
|
||||
private void b(Activity activity, Callback<TwitterSession> callback) {
|
||||
b();
|
||||
CallbackWrapper callbackWrapper = new CallbackWrapper(this.b, callback);
|
||||
if (b(activity, callbackWrapper) || a(activity, callbackWrapper)) {
|
||||
return;
|
||||
}
|
||||
callbackWrapper.a(new TwitterAuthException("Authorize failed."));
|
||||
}
|
||||
|
||||
public void a(Activity activity, Callback<TwitterSession> callback) {
|
||||
if (activity == null) {
|
||||
throw new IllegalArgumentException("Activity must not be null.");
|
||||
}
|
||||
if (callback == null) {
|
||||
throw new IllegalArgumentException("Callback must not be null.");
|
||||
}
|
||||
if (activity.isFinishing()) {
|
||||
Fabric.g().b("Twitter", "Cannot authorize, activity is finishing.", null);
|
||||
} else {
|
||||
b(activity, callback);
|
||||
}
|
||||
}
|
||||
|
||||
TwitterAuthClient(Context context, TwitterAuthConfig twitterAuthConfig, SessionManager<TwitterSession> sessionManager, AuthState authState) {
|
||||
this.a = authState;
|
||||
this.c = twitterAuthConfig;
|
||||
this.b = sessionManager;
|
||||
}
|
||||
|
||||
static class CallbackWrapper extends Callback<TwitterSession> {
|
||||
private final SessionManager<TwitterSession> a;
|
||||
private final Callback<TwitterSession> b;
|
||||
|
||||
public CallbackWrapper(SessionManager<TwitterSession> sessionManager, Callback<TwitterSession> callback) {
|
||||
this.a = sessionManager;
|
||||
this.b = callback;
|
||||
}
|
||||
|
||||
@Override // com.twitter.sdk.android.core.Callback
|
||||
public void a(Result<TwitterSession> result) {
|
||||
Fabric.g().d("Twitter", "Authorization completed successfully");
|
||||
this.a.a((SessionManager<TwitterSession>) result.a);
|
||||
this.b.a(result);
|
||||
}
|
||||
|
||||
@Override // com.twitter.sdk.android.core.Callback
|
||||
public void a(TwitterException twitterException) {
|
||||
Fabric.g().b("Twitter", "Authorization completed with an error", twitterException);
|
||||
this.b.a(twitterException);
|
||||
}
|
||||
}
|
||||
|
||||
private boolean b(Activity activity, CallbackWrapper callbackWrapper) {
|
||||
if (!SSOAuthHandler.a((Context) activity)) {
|
||||
return false;
|
||||
}
|
||||
Fabric.g().d("Twitter", "Using SSO");
|
||||
AuthState authState = this.a;
|
||||
TwitterAuthConfig twitterAuthConfig = this.c;
|
||||
return authState.a(activity, new SSOAuthHandler(twitterAuthConfig, callbackWrapper, twitterAuthConfig.getRequestCode()));
|
||||
}
|
||||
|
||||
private boolean a(Activity activity, CallbackWrapper callbackWrapper) {
|
||||
Fabric.g().d("Twitter", "Using OAuth");
|
||||
AuthState authState = this.a;
|
||||
TwitterAuthConfig twitterAuthConfig = this.c;
|
||||
return authState.a(activity, new OAuthHandler(twitterAuthConfig, callbackWrapper, twitterAuthConfig.getRequestCode()));
|
||||
}
|
||||
|
||||
private void b() {
|
||||
DefaultScribeClient a = a();
|
||||
if (a == null) {
|
||||
return;
|
||||
}
|
||||
EventNamespace.Builder builder = new EventNamespace.Builder();
|
||||
builder.b("android");
|
||||
builder.e(Constants.LOGIN);
|
||||
builder.f("");
|
||||
builder.c("");
|
||||
builder.d("");
|
||||
builder.a("impression");
|
||||
a.a(builder.a());
|
||||
}
|
||||
|
||||
public void a(int i, int i2, Intent intent) {
|
||||
Fabric.g().d("Twitter", "onActivityResult called with " + i + " " + i2);
|
||||
if (!this.a.c()) {
|
||||
Fabric.g().b("Twitter", "Authorize not in progress", null);
|
||||
return;
|
||||
}
|
||||
AuthHandler b = this.a.b();
|
||||
if (b == null || !b.a(i, i2, intent)) {
|
||||
return;
|
||||
}
|
||||
this.a.a();
|
||||
}
|
||||
|
||||
protected DefaultScribeClient a() {
|
||||
return TwitterCoreScribeClientHolder.a();
|
||||
}
|
||||
}
|
@@ -0,0 +1,8 @@
|
||||
package com.twitter.sdk.android.core.identity;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
class WebViewException extends Exception {
|
||||
public WebViewException(int i, String str, String str2) {
|
||||
super(str);
|
||||
}
|
||||
}
|
@@ -0,0 +1,60 @@
|
||||
package com.twitter.sdk.android.core.internal;
|
||||
|
||||
import android.content.Context;
|
||||
import java.io.File;
|
||||
import java.io.FilenameFilter;
|
||||
import java.util.Arrays;
|
||||
import java.util.Comparator;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class MigrationHelper {
|
||||
|
||||
static class FileLastModifiedComparator implements Comparator<File> {
|
||||
FileLastModifiedComparator() {
|
||||
}
|
||||
|
||||
@Override // java.util.Comparator
|
||||
/* renamed from: a, reason: merged with bridge method [inline-methods] */
|
||||
public int compare(File file, File file2) {
|
||||
return Long.valueOf(file2.lastModified()).compareTo(Long.valueOf(file.lastModified()));
|
||||
}
|
||||
}
|
||||
|
||||
static class PrefixFileNameFilter implements FilenameFilter {
|
||||
final String a;
|
||||
|
||||
public PrefixFileNameFilter(String str) {
|
||||
this.a = str;
|
||||
}
|
||||
|
||||
@Override // java.io.FilenameFilter
|
||||
public boolean accept(File file, String str) {
|
||||
return str.startsWith(this.a);
|
||||
}
|
||||
}
|
||||
|
||||
public void a(Context context, String str, String str2) {
|
||||
File a;
|
||||
File a2 = a(context);
|
||||
if (a2.exists() && a2.isDirectory()) {
|
||||
File file = new File(a2, str2);
|
||||
if (file.exists() || (a = a(a2, str)) == null) {
|
||||
return;
|
||||
}
|
||||
a.renameTo(file);
|
||||
}
|
||||
}
|
||||
|
||||
File a(Context context) {
|
||||
return new File(context.getApplicationInfo().dataDir, "shared_prefs");
|
||||
}
|
||||
|
||||
File a(File file, String str) {
|
||||
File[] listFiles = file.listFiles(new PrefixFileNameFilter(str));
|
||||
Arrays.sort(listFiles, new FileLastModifiedComparator());
|
||||
if (listFiles.length > 0) {
|
||||
return listFiles[0];
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
@@ -0,0 +1,89 @@
|
||||
package com.twitter.sdk.android.core.internal;
|
||||
|
||||
import android.app.Activity;
|
||||
import com.twitter.sdk.android.core.Session;
|
||||
import com.twitter.sdk.android.core.SessionManager;
|
||||
import io.fabric.sdk.android.ActivityLifecycleManager;
|
||||
import io.fabric.sdk.android.services.common.SystemCurrentTimeProvider;
|
||||
import java.util.Calendar;
|
||||
import java.util.Iterator;
|
||||
import java.util.TimeZone;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class SessionMonitor<T extends Session> {
|
||||
protected final MonitorState a;
|
||||
private final SystemCurrentTimeProvider b;
|
||||
private final SessionManager<T> c;
|
||||
private final ExecutorService d;
|
||||
private final SessionVerifier e;
|
||||
|
||||
public SessionMonitor(SessionManager<T> sessionManager, ExecutorService executorService, SessionVerifier<T> sessionVerifier) {
|
||||
this(sessionManager, new SystemCurrentTimeProvider(), executorService, new MonitorState(), sessionVerifier);
|
||||
}
|
||||
|
||||
public void a(ActivityLifecycleManager activityLifecycleManager) {
|
||||
activityLifecycleManager.a(new ActivityLifecycleManager.Callbacks() { // from class: com.twitter.sdk.android.core.internal.SessionMonitor.1
|
||||
@Override // io.fabric.sdk.android.ActivityLifecycleManager.Callbacks
|
||||
public void d(Activity activity) {
|
||||
SessionMonitor.this.a();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
protected void b() {
|
||||
Iterator<T> it = this.c.a().values().iterator();
|
||||
while (it.hasNext()) {
|
||||
this.e.a(it.next());
|
||||
}
|
||||
this.a.b(this.b.a());
|
||||
}
|
||||
|
||||
SessionMonitor(SessionManager<T> sessionManager, SystemCurrentTimeProvider systemCurrentTimeProvider, ExecutorService executorService, MonitorState monitorState, SessionVerifier sessionVerifier) {
|
||||
this.b = systemCurrentTimeProvider;
|
||||
this.c = sessionManager;
|
||||
this.d = executorService;
|
||||
this.a = monitorState;
|
||||
this.e = sessionVerifier;
|
||||
}
|
||||
|
||||
public void a() {
|
||||
if (this.c.b() != null && this.a.a(this.b.a())) {
|
||||
this.d.submit(new Runnable() { // from class: com.twitter.sdk.android.core.internal.SessionMonitor.2
|
||||
@Override // java.lang.Runnable
|
||||
public void run() {
|
||||
SessionMonitor.this.b();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
protected static class MonitorState {
|
||||
public boolean a;
|
||||
public long b;
|
||||
private final Calendar c = Calendar.getInstance(TimeZone.getTimeZone("UTC"));
|
||||
|
||||
public synchronized boolean a(long j) {
|
||||
boolean z = j - this.b > 21600000;
|
||||
boolean z2 = !a(j, this.b);
|
||||
if (this.a || !(z || z2)) {
|
||||
return false;
|
||||
}
|
||||
this.a = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
public synchronized void b(long j) {
|
||||
this.a = false;
|
||||
this.b = j;
|
||||
}
|
||||
|
||||
private boolean a(long j, long j2) {
|
||||
this.c.setTimeInMillis(j);
|
||||
int i = this.c.get(6);
|
||||
int i2 = this.c.get(1);
|
||||
this.c.setTimeInMillis(j2);
|
||||
return i == this.c.get(6) && i2 == this.c.get(1);
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,8 @@
|
||||
package com.twitter.sdk.android.core.internal;
|
||||
|
||||
import com.twitter.sdk.android.core.Session;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public interface SessionVerifier<T extends Session> {
|
||||
void a(T t);
|
||||
}
|
@@ -0,0 +1,51 @@
|
||||
package com.twitter.sdk.android.core.internal;
|
||||
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import java.text.Normalizer;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class TwitterApi {
|
||||
private final String a;
|
||||
|
||||
public TwitterApi() {
|
||||
this("https://api.twitter.com");
|
||||
}
|
||||
|
||||
static String b(String str) {
|
||||
StringBuilder sb = new StringBuilder(str.length());
|
||||
for (int i = 0; i < str.length(); i++) {
|
||||
char charAt = str.charAt(i);
|
||||
if (charAt > 31 && charAt < 127) {
|
||||
sb.append(charAt);
|
||||
}
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
public String a() {
|
||||
return this.a;
|
||||
}
|
||||
|
||||
public TwitterApi(String str) {
|
||||
this.a = str;
|
||||
}
|
||||
|
||||
public Uri.Builder a(String... strArr) {
|
||||
Uri.Builder buildUpon = Uri.parse(a()).buildUpon();
|
||||
if (strArr != null) {
|
||||
for (String str : strArr) {
|
||||
buildUpon.appendPath(str);
|
||||
}
|
||||
}
|
||||
return buildUpon;
|
||||
}
|
||||
|
||||
public static String a(String str, String str2) {
|
||||
return a(str + '/' + str2 + ' ' + Build.MODEL + '/' + Build.VERSION.RELEASE + " (" + Build.MANUFACTURER + ';' + Build.MODEL + ';' + Build.BRAND + ';' + Build.PRODUCT + ')');
|
||||
}
|
||||
|
||||
static String a(String str) {
|
||||
return b(Normalizer.normalize(str, Normalizer.Form.NFD));
|
||||
}
|
||||
}
|
@@ -0,0 +1,48 @@
|
||||
package com.twitter.sdk.android.core.internal;
|
||||
|
||||
import com.twitter.sdk.android.core.TwitterApiClient;
|
||||
import com.twitter.sdk.android.core.TwitterSession;
|
||||
import com.twitter.sdk.android.core.internal.scribe.DefaultScribeClient;
|
||||
import com.twitter.sdk.android.core.internal.scribe.EventNamespace;
|
||||
import com.twitter.sdk.android.core.internal.scribe.TwitterCoreScribeClientHolder;
|
||||
import com.twitter.sdk.android.core.services.AccountService;
|
||||
import java.io.IOException;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class TwitterSessionVerifier implements SessionVerifier<TwitterSession> {
|
||||
private final AccountServiceProvider a = new AccountServiceProvider();
|
||||
private final DefaultScribeClient b = TwitterCoreScribeClientHolder.a();
|
||||
|
||||
protected static class AccountServiceProvider {
|
||||
protected AccountServiceProvider() {
|
||||
}
|
||||
|
||||
public AccountService a(TwitterSession twitterSession) {
|
||||
return new TwitterApiClient(twitterSession).a();
|
||||
}
|
||||
}
|
||||
|
||||
@Override // com.twitter.sdk.android.core.internal.SessionVerifier
|
||||
public void a(TwitterSession twitterSession) {
|
||||
AccountService a = this.a.a(twitterSession);
|
||||
try {
|
||||
a();
|
||||
a.verifyCredentials(true, false).execute();
|
||||
} catch (IOException | RuntimeException unused) {
|
||||
}
|
||||
}
|
||||
|
||||
private void a() {
|
||||
if (this.b == null) {
|
||||
return;
|
||||
}
|
||||
EventNamespace.Builder builder = new EventNamespace.Builder();
|
||||
builder.b("android");
|
||||
builder.e("credentials");
|
||||
builder.f("");
|
||||
builder.c("");
|
||||
builder.d("");
|
||||
builder.a("impression");
|
||||
this.b.a(builder.a());
|
||||
}
|
||||
}
|
65
sources/com/twitter/sdk/android/core/internal/UserUtils.java
Normal file
65
sources/com/twitter/sdk/android/core/internal/UserUtils.java
Normal file
@@ -0,0 +1,65 @@
|
||||
package com.twitter.sdk.android.core.internal;
|
||||
|
||||
import com.twitter.sdk.android.core.models.User;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public final class UserUtils {
|
||||
|
||||
/* renamed from: com.twitter.sdk.android.core.internal.UserUtils$1, reason: invalid class name */
|
||||
static /* synthetic */ class AnonymousClass1 {
|
||||
static final /* synthetic */ int[] a = new int[AvatarSize.values().length];
|
||||
|
||||
static {
|
||||
try {
|
||||
a[AvatarSize.NORMAL.ordinal()] = 1;
|
||||
} catch (NoSuchFieldError unused) {
|
||||
}
|
||||
try {
|
||||
a[AvatarSize.BIGGER.ordinal()] = 2;
|
||||
} catch (NoSuchFieldError unused2) {
|
||||
}
|
||||
try {
|
||||
a[AvatarSize.MINI.ordinal()] = 3;
|
||||
} catch (NoSuchFieldError unused3) {
|
||||
}
|
||||
try {
|
||||
a[AvatarSize.ORIGINAL.ordinal()] = 4;
|
||||
} catch (NoSuchFieldError unused4) {
|
||||
}
|
||||
try {
|
||||
a[AvatarSize.REASONABLY_SMALL.ordinal()] = 5;
|
||||
} catch (NoSuchFieldError unused5) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public enum AvatarSize {
|
||||
NORMAL("_normal"),
|
||||
BIGGER("_bigger"),
|
||||
MINI("_mini"),
|
||||
ORIGINAL("_original"),
|
||||
REASONABLY_SMALL("_reasonably_small");
|
||||
|
||||
private final String suffix;
|
||||
|
||||
AvatarSize(String str) {
|
||||
this.suffix = str;
|
||||
}
|
||||
|
||||
String getSuffix() {
|
||||
return this.suffix;
|
||||
}
|
||||
}
|
||||
|
||||
public static String a(User user, AvatarSize avatarSize) {
|
||||
String str;
|
||||
if (user == null || (str = user.profileImageUrlHttps) == null) {
|
||||
return null;
|
||||
}
|
||||
if (avatarSize == null || str == null) {
|
||||
return str;
|
||||
}
|
||||
int i = AnonymousClass1.a[avatarSize.ordinal()];
|
||||
return (i == 1 || i == 2 || i == 3 || i == 4 || i == 5) ? str.replace(AvatarSize.NORMAL.getSuffix(), avatarSize.getSuffix()) : str;
|
||||
}
|
||||
}
|
@@ -0,0 +1,38 @@
|
||||
package com.twitter.sdk.android.core.internal;
|
||||
|
||||
import com.tencent.open.SocialConstants;
|
||||
import com.twitter.sdk.android.core.models.Card;
|
||||
import com.twitter.sdk.android.core.models.ImageValue;
|
||||
import com.twitter.sdk.android.core.models.UserValue;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class VineCardUtils {
|
||||
public static ImageValue a(Card card) {
|
||||
return (ImageValue) card.a.a("player_image");
|
||||
}
|
||||
|
||||
public static String b(Card card) {
|
||||
return ((UserValue) card.a.a(SocialConstants.PARAM_APP_SOURCE)).a;
|
||||
}
|
||||
|
||||
public static String c(Card card) {
|
||||
return (String) card.a.a("player_stream_url");
|
||||
}
|
||||
|
||||
public static boolean d(Card card) {
|
||||
return ("player".equals(card.b) || "vine".equals(card.b)) && e(card);
|
||||
}
|
||||
|
||||
private static boolean e(Card card) {
|
||||
UserValue userValue = (UserValue) card.a.a(SocialConstants.PARAM_APP_SOURCE);
|
||||
if (userValue != null) {
|
||||
try {
|
||||
if (Long.parseLong(userValue.a) == 586671909) {
|
||||
return true;
|
||||
}
|
||||
} catch (NumberFormatException unused) {
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
@@ -0,0 +1,36 @@
|
||||
package com.twitter.sdk.android.core.internal.network;
|
||||
|
||||
import com.twitter.sdk.android.core.GuestSession;
|
||||
import com.twitter.sdk.android.core.GuestSessionProvider;
|
||||
import com.twitter.sdk.android.core.internal.oauth.GuestAuthToken;
|
||||
import java.io.IOException;
|
||||
import okhttp3.Interceptor;
|
||||
import okhttp3.Request;
|
||||
import okhttp3.Response;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class GuestAuthInterceptor implements Interceptor {
|
||||
final GuestSessionProvider a;
|
||||
|
||||
public GuestAuthInterceptor(GuestSessionProvider guestSessionProvider) {
|
||||
this.a = guestSessionProvider;
|
||||
}
|
||||
|
||||
static void a(Request.Builder builder, GuestAuthToken guestAuthToken) {
|
||||
builder.header("Authorization", guestAuthToken.getTokenType() + " " + guestAuthToken.getAccessToken());
|
||||
builder.header(GuestAuthToken.HEADER_GUEST_TOKEN, guestAuthToken.getGuestToken());
|
||||
}
|
||||
|
||||
@Override // okhttp3.Interceptor
|
||||
public Response intercept(Interceptor.Chain chain) throws IOException {
|
||||
Request request = chain.request();
|
||||
GuestSession a = this.a.a();
|
||||
GuestAuthToken a2 = a == null ? null : a.a();
|
||||
if (a2 == null) {
|
||||
return chain.proceed(request);
|
||||
}
|
||||
Request.Builder newBuilder = request.newBuilder();
|
||||
a(newBuilder, a2);
|
||||
return chain.proceed(newBuilder.build());
|
||||
}
|
||||
}
|
@@ -0,0 +1,14 @@
|
||||
package com.twitter.sdk.android.core.internal.network;
|
||||
|
||||
import java.io.IOException;
|
||||
import okhttp3.Interceptor;
|
||||
import okhttp3.Response;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class GuestAuthNetworkInterceptor implements Interceptor {
|
||||
@Override // okhttp3.Interceptor
|
||||
public Response intercept(Interceptor.Chain chain) throws IOException {
|
||||
Response proceed = chain.proceed(chain.request());
|
||||
return proceed.code() == 403 ? proceed.newBuilder().code(401).build() : proceed;
|
||||
}
|
||||
}
|
@@ -0,0 +1,65 @@
|
||||
package com.twitter.sdk.android.core.internal.network;
|
||||
|
||||
import com.twitter.sdk.android.core.GuestSession;
|
||||
import com.twitter.sdk.android.core.GuestSessionProvider;
|
||||
import com.twitter.sdk.android.core.internal.oauth.GuestAuthToken;
|
||||
import com.twitter.sdk.android.core.internal.oauth.OAuth2Token;
|
||||
import java.io.IOException;
|
||||
import okhttp3.Authenticator;
|
||||
import okhttp3.Headers;
|
||||
import okhttp3.Request;
|
||||
import okhttp3.Response;
|
||||
import okhttp3.Route;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class GuestAuthenticator implements Authenticator {
|
||||
final GuestSessionProvider a;
|
||||
|
||||
public GuestAuthenticator(GuestSessionProvider guestSessionProvider) {
|
||||
this.a = guestSessionProvider;
|
||||
}
|
||||
|
||||
Request a(Request request, GuestAuthToken guestAuthToken) {
|
||||
Request.Builder newBuilder = request.newBuilder();
|
||||
GuestAuthInterceptor.a(newBuilder, guestAuthToken);
|
||||
return newBuilder.build();
|
||||
}
|
||||
|
||||
@Override // okhttp3.Authenticator
|
||||
public Request authenticate(Route route, Response response) throws IOException {
|
||||
return c(response);
|
||||
}
|
||||
|
||||
GuestSession b(Response response) {
|
||||
Headers headers = response.request().headers();
|
||||
String str = headers.get("Authorization");
|
||||
String str2 = headers.get(GuestAuthToken.HEADER_GUEST_TOKEN);
|
||||
if (str == null || str2 == null) {
|
||||
return null;
|
||||
}
|
||||
return new GuestSession(new GuestAuthToken(OAuth2Token.TOKEN_TYPE_BEARER, str.replace("bearer ", ""), str2));
|
||||
}
|
||||
|
||||
Request c(Response response) {
|
||||
if (a(response)) {
|
||||
GuestSession b = this.a.b(b(response));
|
||||
GuestAuthToken a = b == null ? null : b.a();
|
||||
if (a != null) {
|
||||
return a(response.request(), a);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
boolean a(Response response) {
|
||||
int i = 1;
|
||||
while (true) {
|
||||
response = response.priorResponse();
|
||||
if (response == null) {
|
||||
break;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
return i < 2;
|
||||
}
|
||||
}
|
@@ -0,0 +1,62 @@
|
||||
package com.twitter.sdk.android.core.internal.network;
|
||||
|
||||
import com.twitter.sdk.android.core.Session;
|
||||
import com.twitter.sdk.android.core.TwitterAuthConfig;
|
||||
import com.twitter.sdk.android.core.TwitterAuthToken;
|
||||
import com.twitter.sdk.android.core.internal.oauth.OAuth1aHeaders;
|
||||
import io.fabric.sdk.android.services.network.UrlUtils;
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import okhttp3.FormBody;
|
||||
import okhttp3.HttpUrl;
|
||||
import okhttp3.Interceptor;
|
||||
import okhttp3.Request;
|
||||
import okhttp3.RequestBody;
|
||||
import okhttp3.Response;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class OAuth1aInterceptor implements Interceptor {
|
||||
final Session<? extends TwitterAuthToken> a;
|
||||
final TwitterAuthConfig b;
|
||||
|
||||
public OAuth1aInterceptor(Session<? extends TwitterAuthToken> session, TwitterAuthConfig twitterAuthConfig) {
|
||||
this.a = session;
|
||||
this.b = twitterAuthConfig;
|
||||
}
|
||||
|
||||
HttpUrl a(HttpUrl httpUrl) {
|
||||
HttpUrl.Builder query = httpUrl.newBuilder().query(null);
|
||||
int querySize = httpUrl.querySize();
|
||||
for (int i = 0; i < querySize; i++) {
|
||||
query.addEncodedQueryParameter(UrlUtils.a(httpUrl.queryParameterName(i)), UrlUtils.a(httpUrl.queryParameterValue(i)));
|
||||
}
|
||||
return query.build();
|
||||
}
|
||||
|
||||
Map<String, String> b(Request request) throws IOException {
|
||||
HashMap hashMap = new HashMap();
|
||||
if ("POST".equals(request.method().toUpperCase(Locale.US))) {
|
||||
RequestBody body = request.body();
|
||||
if (body instanceof FormBody) {
|
||||
FormBody formBody = (FormBody) body;
|
||||
for (int i = 0; i < formBody.size(); i++) {
|
||||
hashMap.put(formBody.encodedName(i), formBody.value(i));
|
||||
}
|
||||
}
|
||||
}
|
||||
return hashMap;
|
||||
}
|
||||
|
||||
@Override // okhttp3.Interceptor
|
||||
public Response intercept(Interceptor.Chain chain) throws IOException {
|
||||
Request request = chain.request();
|
||||
Request build = request.newBuilder().url(a(request.url())).build();
|
||||
return chain.proceed(build.newBuilder().header("Authorization", a(build)).build());
|
||||
}
|
||||
|
||||
String a(Request request) throws IOException {
|
||||
return new OAuth1aHeaders().a(this.b, this.a.a(), null, request.method(), request.url().toString(), b(request));
|
||||
}
|
||||
}
|
@@ -0,0 +1,38 @@
|
||||
package com.twitter.sdk.android.core.internal.network;
|
||||
|
||||
import com.twitter.sdk.android.core.GuestSessionProvider;
|
||||
import com.twitter.sdk.android.core.Session;
|
||||
import com.twitter.sdk.android.core.TwitterAuthConfig;
|
||||
import com.twitter.sdk.android.core.TwitterAuthToken;
|
||||
import javax.net.ssl.SSLSocketFactory;
|
||||
import okhttp3.OkHttpClient;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class OkHttpClientHelper {
|
||||
public static OkHttpClient a(GuestSessionProvider guestSessionProvider, SSLSocketFactory sSLSocketFactory) {
|
||||
return b(guestSessionProvider, sSLSocketFactory).build();
|
||||
}
|
||||
|
||||
public static OkHttpClient.Builder b(GuestSessionProvider guestSessionProvider, SSLSocketFactory sSLSocketFactory) {
|
||||
return a(new OkHttpClient.Builder(), guestSessionProvider, sSLSocketFactory);
|
||||
}
|
||||
|
||||
public static OkHttpClient a(Session<? extends TwitterAuthToken> session, TwitterAuthConfig twitterAuthConfig, SSLSocketFactory sSLSocketFactory) {
|
||||
return b(session, twitterAuthConfig, sSLSocketFactory).build();
|
||||
}
|
||||
|
||||
public static OkHttpClient.Builder b(Session<? extends TwitterAuthToken> session, TwitterAuthConfig twitterAuthConfig, SSLSocketFactory sSLSocketFactory) {
|
||||
if (session != null) {
|
||||
return a(new OkHttpClient.Builder(), session, twitterAuthConfig, sSLSocketFactory);
|
||||
}
|
||||
throw new IllegalArgumentException("Session must not be null.");
|
||||
}
|
||||
|
||||
static OkHttpClient.Builder a(OkHttpClient.Builder builder, GuestSessionProvider guestSessionProvider, SSLSocketFactory sSLSocketFactory) {
|
||||
return builder.sslSocketFactory(sSLSocketFactory).authenticator(new GuestAuthenticator(guestSessionProvider)).addInterceptor(new GuestAuthInterceptor(guestSessionProvider)).addNetworkInterceptor(new GuestAuthNetworkInterceptor());
|
||||
}
|
||||
|
||||
static OkHttpClient.Builder a(OkHttpClient.Builder builder, Session<? extends TwitterAuthToken> session, TwitterAuthConfig twitterAuthConfig, SSLSocketFactory sSLSocketFactory) {
|
||||
return builder.sslSocketFactory(sSLSocketFactory).addInterceptor(new OAuth1aInterceptor(session, twitterAuthConfig));
|
||||
}
|
||||
}
|
@@ -0,0 +1,51 @@
|
||||
package com.twitter.sdk.android.core.internal.oauth;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class GuestAuthToken extends OAuth2Token {
|
||||
private static final long EXPIRES_IN_MS = 10800000;
|
||||
public static final String HEADER_GUEST_TOKEN = "x-guest-token";
|
||||
|
||||
@SerializedName("guest_token")
|
||||
private final String guestToken;
|
||||
|
||||
public GuestAuthToken(String str, String str2, String str3) {
|
||||
super(str, str2);
|
||||
this.guestToken = str3;
|
||||
}
|
||||
|
||||
@Override // com.twitter.sdk.android.core.internal.oauth.OAuth2Token
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj) {
|
||||
return true;
|
||||
}
|
||||
if (obj == null || GuestAuthToken.class != obj.getClass() || !super.equals(obj)) {
|
||||
return false;
|
||||
}
|
||||
String str = this.guestToken;
|
||||
String str2 = ((GuestAuthToken) obj).guestToken;
|
||||
return str == null ? str2 == null : str.equals(str2);
|
||||
}
|
||||
|
||||
public String getGuestToken() {
|
||||
return this.guestToken;
|
||||
}
|
||||
|
||||
@Override // com.twitter.sdk.android.core.internal.oauth.OAuth2Token
|
||||
public int hashCode() {
|
||||
int hashCode = super.hashCode() * 31;
|
||||
String str = this.guestToken;
|
||||
return hashCode + (str != null ? str.hashCode() : 0);
|
||||
}
|
||||
|
||||
@Override // com.twitter.sdk.android.core.internal.oauth.OAuth2Token, com.twitter.sdk.android.core.AuthToken
|
||||
public boolean isExpired() {
|
||||
return System.currentTimeMillis() >= this.createdAt + EXPIRES_IN_MS;
|
||||
}
|
||||
|
||||
public GuestAuthToken(String str, String str2, String str3, long j) {
|
||||
super(str, str2, j);
|
||||
this.guestToken = str3;
|
||||
}
|
||||
}
|
@@ -0,0 +1,10 @@
|
||||
package com.twitter.sdk.android.core.internal.oauth;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
class GuestTokenResponse {
|
||||
|
||||
@SerializedName("guest_token")
|
||||
public final String a;
|
||||
}
|
@@ -0,0 +1,16 @@
|
||||
package com.twitter.sdk.android.core.internal.oauth;
|
||||
|
||||
import com.twitter.sdk.android.core.TwitterAuthConfig;
|
||||
import com.twitter.sdk.android.core.TwitterAuthToken;
|
||||
import java.util.Map;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class OAuth1aHeaders {
|
||||
public String a(TwitterAuthConfig twitterAuthConfig, TwitterAuthToken twitterAuthToken, String str, String str2, String str3, Map<String, String> map) {
|
||||
return b(twitterAuthConfig, twitterAuthToken, str, str2, str3, map).a();
|
||||
}
|
||||
|
||||
OAuth1aParameters b(TwitterAuthConfig twitterAuthConfig, TwitterAuthToken twitterAuthToken, String str, String str2, String str3, Map<String, String> map) {
|
||||
return new OAuth1aParameters(twitterAuthConfig, twitterAuthToken, str, str2, str3, map);
|
||||
}
|
||||
}
|
@@ -0,0 +1,143 @@
|
||||
package com.twitter.sdk.android.core.internal.oauth;
|
||||
|
||||
import com.afunx.ble.blelitelib.BuildConfig;
|
||||
import com.tencent.open.SocialConstants;
|
||||
import com.twitter.sdk.android.core.TwitterAuthConfig;
|
||||
import com.twitter.sdk.android.core.TwitterAuthToken;
|
||||
import io.fabric.sdk.android.Fabric;
|
||||
import io.fabric.sdk.android.services.network.HttpRequest;
|
||||
import io.fabric.sdk.android.services.network.UrlUtils;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.URI;
|
||||
import java.security.InvalidKeyException;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.security.SecureRandom;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.TreeMap;
|
||||
import javax.crypto.Mac;
|
||||
import javax.crypto.spec.SecretKeySpec;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
class OAuth1aParameters {
|
||||
private static final SecureRandom g = new SecureRandom();
|
||||
private final TwitterAuthConfig a;
|
||||
private final TwitterAuthToken b;
|
||||
private final String c;
|
||||
private final String d;
|
||||
private final String e;
|
||||
private final Map<String, String> f;
|
||||
|
||||
public OAuth1aParameters(TwitterAuthConfig twitterAuthConfig, TwitterAuthToken twitterAuthToken, String str, String str2, String str3, Map<String, String> map) {
|
||||
this.a = twitterAuthConfig;
|
||||
this.b = twitterAuthToken;
|
||||
this.c = str;
|
||||
this.d = str2;
|
||||
this.e = str3;
|
||||
this.f = map;
|
||||
}
|
||||
|
||||
private String b() {
|
||||
return String.valueOf(System.nanoTime()) + String.valueOf(Math.abs(g.nextLong()));
|
||||
}
|
||||
|
||||
private String c() {
|
||||
TwitterAuthToken twitterAuthToken = this.b;
|
||||
return UrlUtils.c(this.a.getConsumerSecret()) + '&' + UrlUtils.c(twitterAuthToken != null ? twitterAuthToken.secret : null);
|
||||
}
|
||||
|
||||
private String d() {
|
||||
return Long.toString(System.currentTimeMillis() / 1000);
|
||||
}
|
||||
|
||||
public String a() {
|
||||
String b = b();
|
||||
String d = d();
|
||||
return a(b, d, a(a(b, d)));
|
||||
}
|
||||
|
||||
String a(String str, String str2) {
|
||||
String str3;
|
||||
URI create = URI.create(this.e);
|
||||
TreeMap<String, String> a = UrlUtils.a(create, true);
|
||||
Map<String, String> map = this.f;
|
||||
if (map != null) {
|
||||
a.putAll(map);
|
||||
}
|
||||
String str4 = this.c;
|
||||
if (str4 != null) {
|
||||
a.put("oauth_callback", str4);
|
||||
}
|
||||
a.put(SocialConstants.PARAM_CONSUMER_KEY, this.a.getConsumerKey());
|
||||
a.put("oauth_nonce", str);
|
||||
a.put("oauth_signature_method", "HMAC-SHA1");
|
||||
a.put("oauth_timestamp", str2);
|
||||
TwitterAuthToken twitterAuthToken = this.b;
|
||||
if (twitterAuthToken != null && (str3 = twitterAuthToken.token) != null) {
|
||||
a.put("oauth_token", str3);
|
||||
}
|
||||
a.put("oauth_version", BuildConfig.VERSION_NAME);
|
||||
return this.d.toUpperCase(Locale.ENGLISH) + '&' + UrlUtils.a(create.getScheme() + "://" + create.getHost() + create.getPath()) + '&' + a(a);
|
||||
}
|
||||
|
||||
private String a(TreeMap<String, String> treeMap) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
int size = treeMap.size();
|
||||
int i = 0;
|
||||
for (Map.Entry<String, String> entry : treeMap.entrySet()) {
|
||||
sb.append(UrlUtils.a(UrlUtils.a(entry.getKey())));
|
||||
sb.append("%3D");
|
||||
sb.append(UrlUtils.a(UrlUtils.a(entry.getValue())));
|
||||
i++;
|
||||
if (i < size) {
|
||||
sb.append("%26");
|
||||
}
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
String a(String str) {
|
||||
try {
|
||||
String c = c();
|
||||
byte[] bytes = str.getBytes("UTF8");
|
||||
SecretKeySpec secretKeySpec = new SecretKeySpec(c.getBytes("UTF8"), "HmacSHA1");
|
||||
Mac mac = Mac.getInstance("HmacSHA1");
|
||||
mac.init(secretKeySpec);
|
||||
byte[] doFinal = mac.doFinal(bytes);
|
||||
return new String(HttpRequest.Base64.b(doFinal, 0, doFinal.length), "UTF8");
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
Fabric.g().b("Twitter", "Failed to calculate signature", e);
|
||||
return "";
|
||||
} catch (InvalidKeyException e2) {
|
||||
Fabric.g().b("Twitter", "Failed to calculate signature", e2);
|
||||
return "";
|
||||
} catch (NoSuchAlgorithmException e3) {
|
||||
Fabric.g().b("Twitter", "Failed to calculate signature", e3);
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
String a(String str, String str2, String str3) {
|
||||
StringBuilder sb = new StringBuilder("OAuth");
|
||||
a(sb, "oauth_callback", this.c);
|
||||
a(sb, SocialConstants.PARAM_CONSUMER_KEY, this.a.getConsumerKey());
|
||||
a(sb, "oauth_nonce", str);
|
||||
a(sb, "oauth_signature", str3);
|
||||
a(sb, "oauth_signature_method", "HMAC-SHA1");
|
||||
a(sb, "oauth_timestamp", str2);
|
||||
TwitterAuthToken twitterAuthToken = this.b;
|
||||
a(sb, "oauth_token", twitterAuthToken != null ? twitterAuthToken.token : null);
|
||||
a(sb, "oauth_version", BuildConfig.VERSION_NAME);
|
||||
return sb.substring(0, sb.length() - 1);
|
||||
}
|
||||
|
||||
private void a(StringBuilder sb, String str, String str2) {
|
||||
if (str2 != null) {
|
||||
sb.append(' ');
|
||||
sb.append(UrlUtils.a(str));
|
||||
sb.append("=\"");
|
||||
sb.append(UrlUtils.a(str2));
|
||||
sb.append("\",");
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,127 @@
|
||||
package com.twitter.sdk.android.core.internal.oauth;
|
||||
|
||||
import android.net.Uri;
|
||||
import com.twitter.sdk.android.core.Callback;
|
||||
import com.twitter.sdk.android.core.Result;
|
||||
import com.twitter.sdk.android.core.TwitterAuthConfig;
|
||||
import com.twitter.sdk.android.core.TwitterAuthException;
|
||||
import com.twitter.sdk.android.core.TwitterAuthToken;
|
||||
import com.twitter.sdk.android.core.TwitterCore;
|
||||
import com.twitter.sdk.android.core.TwitterException;
|
||||
import com.twitter.sdk.android.core.internal.TwitterApi;
|
||||
import com.unity3d.ads.metadata.MediationMetaData;
|
||||
import io.fabric.sdk.android.services.network.UrlUtils;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.util.TreeMap;
|
||||
import javax.net.ssl.SSLSocketFactory;
|
||||
import okhttp3.ResponseBody;
|
||||
import retrofit2.Call;
|
||||
import retrofit2.http.Header;
|
||||
import retrofit2.http.POST;
|
||||
import retrofit2.http.Query;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class OAuth1aService extends OAuthService {
|
||||
OAuthApi e;
|
||||
|
||||
interface OAuthApi {
|
||||
@POST("/oauth/access_token")
|
||||
Call<ResponseBody> getAccessToken(@Header("Authorization") String str, @Query("oauth_verifier") String str2);
|
||||
|
||||
@POST("/oauth/request_token")
|
||||
Call<ResponseBody> getTempToken(@Header("Authorization") String str);
|
||||
}
|
||||
|
||||
public OAuth1aService(TwitterCore twitterCore, SSLSocketFactory sSLSocketFactory, TwitterApi twitterApi) {
|
||||
super(twitterCore, sSLSocketFactory, twitterApi);
|
||||
this.e = (OAuthApi) b().create(OAuthApi.class);
|
||||
}
|
||||
|
||||
public String a(TwitterAuthConfig twitterAuthConfig) {
|
||||
return Uri.parse("twittersdk://callback").buildUpon().appendQueryParameter(MediationMetaData.KEY_VERSION, c().i()).appendQueryParameter("app", twitterAuthConfig.getConsumerKey()).build().toString();
|
||||
}
|
||||
|
||||
public void b(Callback<OAuthResponse> callback) {
|
||||
TwitterAuthConfig q = c().q();
|
||||
this.e.getTempToken(new OAuth1aHeaders().a(q, null, a(q), "POST", f(), null)).enqueue(a(callback));
|
||||
}
|
||||
|
||||
String e() {
|
||||
return a().a() + "/oauth/access_token";
|
||||
}
|
||||
|
||||
String f() {
|
||||
return a().a() + "/oauth/request_token";
|
||||
}
|
||||
|
||||
public void a(Callback<OAuthResponse> callback, TwitterAuthToken twitterAuthToken, String str) {
|
||||
this.e.getAccessToken(new OAuth1aHeaders().a(c().q(), twitterAuthToken, null, "POST", e(), null), str).enqueue(a(callback));
|
||||
}
|
||||
|
||||
public String a(TwitterAuthToken twitterAuthToken) {
|
||||
return a().a("oauth", "authorize").appendQueryParameter("oauth_token", twitterAuthToken.token).build().toString();
|
||||
}
|
||||
|
||||
public static OAuthResponse a(String str) {
|
||||
TreeMap<String, String> a = UrlUtils.a(str, false);
|
||||
String str2 = a.get("oauth_token");
|
||||
String str3 = a.get("oauth_token_secret");
|
||||
String str4 = a.get("screen_name");
|
||||
long parseLong = a.containsKey("user_id") ? Long.parseLong(a.get("user_id")) : 0L;
|
||||
if (str2 == null || str3 == null) {
|
||||
return null;
|
||||
}
|
||||
return new OAuthResponse(new TwitterAuthToken(str2, str3), str4, parseLong);
|
||||
}
|
||||
|
||||
Callback<ResponseBody> a(final Callback<OAuthResponse> callback) {
|
||||
return new Callback<ResponseBody>(this) { // from class: com.twitter.sdk.android.core.internal.oauth.OAuth1aService.1
|
||||
@Override // com.twitter.sdk.android.core.Callback
|
||||
public void a(Result<ResponseBody> result) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
BufferedReader bufferedReader = null;
|
||||
try {
|
||||
try {
|
||||
BufferedReader bufferedReader2 = new BufferedReader(new InputStreamReader(result.a.byteStream()));
|
||||
while (true) {
|
||||
try {
|
||||
String readLine = bufferedReader2.readLine();
|
||||
if (readLine == null) {
|
||||
break;
|
||||
} else {
|
||||
sb.append(readLine);
|
||||
}
|
||||
} catch (Throwable th) {
|
||||
th = th;
|
||||
bufferedReader = bufferedReader2;
|
||||
if (bufferedReader != null) {
|
||||
bufferedReader.close();
|
||||
}
|
||||
throw th;
|
||||
}
|
||||
}
|
||||
bufferedReader2.close();
|
||||
String sb2 = sb.toString();
|
||||
OAuthResponse a = OAuth1aService.a(sb2);
|
||||
if (a != null) {
|
||||
callback.a(new Result(a, null));
|
||||
return;
|
||||
}
|
||||
callback.a(new TwitterAuthException("Failed to parse auth response: " + sb2));
|
||||
} catch (Throwable th2) {
|
||||
th = th2;
|
||||
}
|
||||
} catch (IOException e) {
|
||||
callback.a(new TwitterAuthException(e.getMessage(), e));
|
||||
}
|
||||
}
|
||||
|
||||
@Override // com.twitter.sdk.android.core.Callback
|
||||
public void a(TwitterException twitterException) {
|
||||
callback.a(twitterException);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
@@ -0,0 +1,85 @@
|
||||
package com.twitter.sdk.android.core.internal.oauth;
|
||||
|
||||
import com.twitter.sdk.android.core.Callback;
|
||||
import com.twitter.sdk.android.core.Result;
|
||||
import com.twitter.sdk.android.core.TwitterAuthConfig;
|
||||
import com.twitter.sdk.android.core.TwitterCore;
|
||||
import com.twitter.sdk.android.core.TwitterException;
|
||||
import com.twitter.sdk.android.core.internal.TwitterApi;
|
||||
import io.fabric.sdk.android.Fabric;
|
||||
import io.fabric.sdk.android.services.network.HttpRequest;
|
||||
import io.fabric.sdk.android.services.network.UrlUtils;
|
||||
import javax.net.ssl.SSLSocketFactory;
|
||||
import retrofit2.Call;
|
||||
import retrofit2.http.Field;
|
||||
import retrofit2.http.FormUrlEncoded;
|
||||
import retrofit2.http.Header;
|
||||
import retrofit2.http.Headers;
|
||||
import retrofit2.http.POST;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class OAuth2Service extends OAuthService {
|
||||
OAuth2Api e;
|
||||
|
||||
interface OAuth2Api {
|
||||
@FormUrlEncoded
|
||||
@Headers({"Content-Type: application/x-www-form-urlencoded;charset=UTF-8"})
|
||||
@POST("/oauth2/token")
|
||||
Call<OAuth2Token> getAppAuthToken(@Header("Authorization") String str, @Field("grant_type") String str2);
|
||||
|
||||
@POST("/1.1/guest/activate.json")
|
||||
Call<GuestTokenResponse> getGuestToken(@Header("Authorization") String str);
|
||||
}
|
||||
|
||||
public OAuth2Service(TwitterCore twitterCore, SSLSocketFactory sSLSocketFactory, TwitterApi twitterApi) {
|
||||
super(twitterCore, sSLSocketFactory, twitterApi);
|
||||
this.e = (OAuth2Api) b().create(OAuth2Api.class);
|
||||
}
|
||||
|
||||
private String e() {
|
||||
TwitterAuthConfig q = c().q();
|
||||
return "Basic " + HttpRequest.Base64.a(UrlUtils.a(q.getConsumerKey()) + ":" + UrlUtils.a(q.getConsumerSecret()));
|
||||
}
|
||||
|
||||
void a(Callback<OAuth2Token> callback) {
|
||||
this.e.getAppAuthToken(e(), "client_credentials").enqueue(callback);
|
||||
}
|
||||
|
||||
public void b(final Callback<GuestAuthToken> callback) {
|
||||
a(new Callback<OAuth2Token>() { // from class: com.twitter.sdk.android.core.internal.oauth.OAuth2Service.1
|
||||
@Override // com.twitter.sdk.android.core.Callback
|
||||
public void a(Result<OAuth2Token> result) {
|
||||
final OAuth2Token oAuth2Token = result.a;
|
||||
OAuth2Service.this.a(new Callback<GuestTokenResponse>() { // from class: com.twitter.sdk.android.core.internal.oauth.OAuth2Service.1.1
|
||||
@Override // com.twitter.sdk.android.core.Callback
|
||||
public void a(Result<GuestTokenResponse> result2) {
|
||||
callback.a(new Result(new GuestAuthToken(oAuth2Token.getTokenType(), oAuth2Token.getAccessToken(), result2.a.a), null));
|
||||
}
|
||||
|
||||
@Override // com.twitter.sdk.android.core.Callback
|
||||
public void a(TwitterException twitterException) {
|
||||
Fabric.g().b("Twitter", "Your app may not allow guest auth. Please talk to us regarding upgrading your consumer key.", twitterException);
|
||||
callback.a(twitterException);
|
||||
}
|
||||
}, oAuth2Token);
|
||||
}
|
||||
|
||||
@Override // com.twitter.sdk.android.core.Callback
|
||||
public void a(TwitterException twitterException) {
|
||||
Fabric.g().b("Twitter", "Failed to get app auth token", twitterException);
|
||||
Callback callback2 = callback;
|
||||
if (callback2 != null) {
|
||||
callback2.a(twitterException);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
void a(Callback<GuestTokenResponse> callback, OAuth2Token oAuth2Token) {
|
||||
this.e.getGuestToken(a(oAuth2Token)).enqueue(callback);
|
||||
}
|
||||
|
||||
private String a(OAuth2Token oAuth2Token) {
|
||||
return "Bearer " + oAuth2Token.getAccessToken();
|
||||
}
|
||||
}
|
@@ -0,0 +1,95 @@
|
||||
package com.twitter.sdk.android.core.internal.oauth;
|
||||
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
import com.facebook.AccessToken;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import com.twitter.sdk.android.core.AuthToken;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class OAuth2Token extends AuthToken implements Parcelable {
|
||||
public static final Parcelable.Creator<OAuth2Token> CREATOR = new Parcelable.Creator<OAuth2Token>() { // from class: com.twitter.sdk.android.core.internal.oauth.OAuth2Token.1
|
||||
/* JADX WARN: Can't rename method to resolve collision */
|
||||
@Override // android.os.Parcelable.Creator
|
||||
public OAuth2Token createFromParcel(Parcel parcel) {
|
||||
return new OAuth2Token(parcel);
|
||||
}
|
||||
|
||||
/* JADX WARN: Can't rename method to resolve collision */
|
||||
@Override // android.os.Parcelable.Creator
|
||||
public OAuth2Token[] newArray(int i) {
|
||||
return new OAuth2Token[i];
|
||||
}
|
||||
};
|
||||
public static final String TOKEN_TYPE_BEARER = "bearer";
|
||||
|
||||
@SerializedName(AccessToken.ACCESS_TOKEN_KEY)
|
||||
private final String accessToken;
|
||||
|
||||
@SerializedName("token_type")
|
||||
private final String tokenType;
|
||||
|
||||
@Override // android.os.Parcelable
|
||||
public int describeContents() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj) {
|
||||
return true;
|
||||
}
|
||||
if (obj == null || getClass() != obj.getClass()) {
|
||||
return false;
|
||||
}
|
||||
OAuth2Token oAuth2Token = (OAuth2Token) obj;
|
||||
String str = this.accessToken;
|
||||
if (str == null ? oAuth2Token.accessToken != null : !str.equals(oAuth2Token.accessToken)) {
|
||||
return false;
|
||||
}
|
||||
String str2 = this.tokenType;
|
||||
String str3 = oAuth2Token.tokenType;
|
||||
return str2 == null ? str3 == null : str2.equals(str3);
|
||||
}
|
||||
|
||||
public String getAccessToken() {
|
||||
return this.accessToken;
|
||||
}
|
||||
|
||||
public String getTokenType() {
|
||||
return this.tokenType;
|
||||
}
|
||||
|
||||
public int hashCode() {
|
||||
String str = this.tokenType;
|
||||
int hashCode = (str != null ? str.hashCode() : 0) * 31;
|
||||
String str2 = this.accessToken;
|
||||
return hashCode + (str2 != null ? str2.hashCode() : 0);
|
||||
}
|
||||
|
||||
@Override // com.twitter.sdk.android.core.AuthToken
|
||||
public boolean isExpired() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override // android.os.Parcelable
|
||||
public void writeToParcel(Parcel parcel, int i) {
|
||||
parcel.writeString(this.tokenType);
|
||||
parcel.writeString(this.accessToken);
|
||||
}
|
||||
|
||||
public OAuth2Token(String str, String str2) {
|
||||
this.tokenType = str;
|
||||
this.accessToken = str2;
|
||||
}
|
||||
|
||||
public OAuth2Token(String str, String str2, long j) {
|
||||
super(j);
|
||||
this.tokenType = str;
|
||||
this.accessToken = str2;
|
||||
}
|
||||
|
||||
private OAuth2Token(Parcel parcel) {
|
||||
this.tokenType = parcel.readString();
|
||||
this.accessToken = parcel.readString();
|
||||
}
|
||||
}
|
@@ -0,0 +1,53 @@
|
||||
package com.twitter.sdk.android.core.internal.oauth;
|
||||
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
import com.twitter.sdk.android.core.TwitterAuthToken;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class OAuthResponse implements Parcelable {
|
||||
public static final Parcelable.Creator<OAuthResponse> CREATOR = new Parcelable.Creator<OAuthResponse>() { // from class: com.twitter.sdk.android.core.internal.oauth.OAuthResponse.1
|
||||
/* JADX WARN: Can't rename method to resolve collision */
|
||||
@Override // android.os.Parcelable.Creator
|
||||
public OAuthResponse createFromParcel(Parcel parcel) {
|
||||
return new OAuthResponse(parcel);
|
||||
}
|
||||
|
||||
/* JADX WARN: Can't rename method to resolve collision */
|
||||
@Override // android.os.Parcelable.Creator
|
||||
public OAuthResponse[] newArray(int i) {
|
||||
return new OAuthResponse[i];
|
||||
}
|
||||
};
|
||||
public final TwitterAuthToken authToken;
|
||||
public final long userId;
|
||||
public final String userName;
|
||||
|
||||
@Override // android.os.Parcelable
|
||||
public int describeContents() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return "authToken=" + this.authToken + ",userName=" + this.userName + ",userId=" + this.userId;
|
||||
}
|
||||
|
||||
@Override // android.os.Parcelable
|
||||
public void writeToParcel(Parcel parcel, int i) {
|
||||
parcel.writeParcelable(this.authToken, i);
|
||||
parcel.writeString(this.userName);
|
||||
parcel.writeLong(this.userId);
|
||||
}
|
||||
|
||||
public OAuthResponse(TwitterAuthToken twitterAuthToken, String str, long j) {
|
||||
this.authToken = twitterAuthToken;
|
||||
this.userName = str;
|
||||
this.userId = j;
|
||||
}
|
||||
|
||||
private OAuthResponse(Parcel parcel) {
|
||||
this.authToken = (TwitterAuthToken) parcel.readParcelable(TwitterAuthToken.class.getClassLoader());
|
||||
this.userName = parcel.readString();
|
||||
this.userId = parcel.readLong();
|
||||
}
|
||||
}
|
@@ -0,0 +1,50 @@
|
||||
package com.twitter.sdk.android.core.internal.oauth;
|
||||
|
||||
import com.twitter.sdk.android.core.TwitterCore;
|
||||
import com.twitter.sdk.android.core.internal.TwitterApi;
|
||||
import java.io.IOException;
|
||||
import javax.net.ssl.SSLSocketFactory;
|
||||
import okhttp3.Interceptor;
|
||||
import okhttp3.OkHttpClient;
|
||||
import okhttp3.Response;
|
||||
import retrofit2.Retrofit;
|
||||
import retrofit2.converter.gson.GsonConverterFactory;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
abstract class OAuthService {
|
||||
private final TwitterCore a;
|
||||
private final TwitterApi b;
|
||||
private final String c;
|
||||
private final Retrofit d;
|
||||
|
||||
OAuthService(TwitterCore twitterCore, SSLSocketFactory sSLSocketFactory, TwitterApi twitterApi) {
|
||||
this.a = twitterCore;
|
||||
this.b = twitterApi;
|
||||
this.c = TwitterApi.a("TwitterAndroidSDK", twitterCore.i());
|
||||
if (sSLSocketFactory == null) {
|
||||
throw new IllegalArgumentException("sslSocketFactory must not be null");
|
||||
}
|
||||
this.d = new Retrofit.Builder().baseUrl(a().a()).client(new OkHttpClient.Builder().sslSocketFactory(sSLSocketFactory).addInterceptor(new Interceptor() { // from class: com.twitter.sdk.android.core.internal.oauth.OAuthService.1
|
||||
@Override // okhttp3.Interceptor
|
||||
public Response intercept(Interceptor.Chain chain) throws IOException {
|
||||
return chain.proceed(chain.request().newBuilder().header("User-Agent", OAuthService.this.d()).build());
|
||||
}
|
||||
}).build()).addConverterFactory(GsonConverterFactory.create()).build();
|
||||
}
|
||||
|
||||
protected TwitterApi a() {
|
||||
return this.b;
|
||||
}
|
||||
|
||||
protected Retrofit b() {
|
||||
return this.d;
|
||||
}
|
||||
|
||||
protected TwitterCore c() {
|
||||
return this.a;
|
||||
}
|
||||
|
||||
protected String d() {
|
||||
return this.c;
|
||||
}
|
||||
}
|
@@ -0,0 +1,112 @@
|
||||
package com.twitter.sdk.android.core.internal.scribe;
|
||||
|
||||
import android.os.Build;
|
||||
import android.text.TextUtils;
|
||||
import com.google.gson.FieldNamingPolicy;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
import com.twitter.sdk.android.core.GuestSessionProvider;
|
||||
import com.twitter.sdk.android.core.Session;
|
||||
import com.twitter.sdk.android.core.SessionManager;
|
||||
import com.twitter.sdk.android.core.TwitterAuthToken;
|
||||
import com.twitter.sdk.android.core.TwitterCore;
|
||||
import com.twitter.sdk.android.core.internal.scribe.ScribeEvent;
|
||||
import io.fabric.sdk.android.Kit;
|
||||
import io.fabric.sdk.android.services.common.ExecutorUtils;
|
||||
import io.fabric.sdk.android.services.common.IdManager;
|
||||
import io.fabric.sdk.android.services.settings.AnalyticsSettingsData;
|
||||
import io.fabric.sdk.android.services.settings.Settings;
|
||||
import io.fabric.sdk.android.services.settings.SettingsData;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class DefaultScribeClient extends ScribeClient {
|
||||
private static volatile ScheduledExecutorService n;
|
||||
private final Kit k;
|
||||
private final SessionManager<? extends Session<TwitterAuthToken>> l;
|
||||
private final String m;
|
||||
|
||||
public DefaultScribeClient(Kit kit, String str, SessionManager<? extends Session<TwitterAuthToken>> sessionManager, GuestSessionProvider guestSessionProvider, IdManager idManager) {
|
||||
this(kit, str, c(), sessionManager, guestSessionProvider, idManager);
|
||||
}
|
||||
|
||||
private static ScheduledExecutorService b() {
|
||||
if (n == null) {
|
||||
synchronized (DefaultScribeClient.class) {
|
||||
if (n == null) {
|
||||
n = ExecutorUtils.a("scribe");
|
||||
}
|
||||
}
|
||||
}
|
||||
return n;
|
||||
}
|
||||
|
||||
private static Gson c() {
|
||||
return new GsonBuilder().setFieldNamingPolicy(FieldNamingPolicy.LOWER_CASE_WITH_UNDERSCORES).create();
|
||||
}
|
||||
|
||||
private String d() {
|
||||
return this.k.d() != null ? this.k.d().getResources().getConfiguration().locale.getLanguage() : "";
|
||||
}
|
||||
|
||||
private static boolean e() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public void a(EventNamespace... eventNamespaceArr) {
|
||||
for (EventNamespace eventNamespace : eventNamespaceArr) {
|
||||
a(eventNamespace, Collections.emptyList());
|
||||
}
|
||||
}
|
||||
|
||||
DefaultScribeClient(Kit kit, String str, Gson gson, SessionManager<? extends Session<TwitterAuthToken>> sessionManager, GuestSessionProvider guestSessionProvider, IdManager idManager) {
|
||||
super(kit, b(), a(Settings.d().a(), a(str, kit)), new ScribeEvent.Transform(gson), TwitterCore.z().q(), sessionManager, guestSessionProvider, TwitterCore.z().t(), idManager);
|
||||
this.l = sessionManager;
|
||||
this.k = kit;
|
||||
this.m = idManager.a();
|
||||
}
|
||||
|
||||
public void a(EventNamespace eventNamespace, List<ScribeItem> list) {
|
||||
a(ScribeEventFactory.a(eventNamespace, "", System.currentTimeMillis(), d(), this.m, list));
|
||||
}
|
||||
|
||||
public void a(ScribeEvent scribeEvent) {
|
||||
super.a(scribeEvent, a(a()));
|
||||
}
|
||||
|
||||
Session a() {
|
||||
return this.l.b();
|
||||
}
|
||||
|
||||
long a(Session session) {
|
||||
if (session != null) {
|
||||
return session.b();
|
||||
}
|
||||
return 0L;
|
||||
}
|
||||
|
||||
static ScribeConfig a(SettingsData settingsData, String str) {
|
||||
int i;
|
||||
int i2;
|
||||
AnalyticsSettingsData analyticsSettingsData;
|
||||
if (settingsData == null || (analyticsSettingsData = settingsData.b) == null) {
|
||||
i = 100;
|
||||
i2 = 600;
|
||||
} else {
|
||||
int i3 = analyticsSettingsData.b;
|
||||
i2 = analyticsSettingsData.a;
|
||||
i = i3;
|
||||
}
|
||||
return new ScribeConfig(e(), a("https://syndication.twitter.com", ""), "i", "sdk", "", str, i, i2);
|
||||
}
|
||||
|
||||
static String a(String str, Kit kit) {
|
||||
return "Fabric/" + kit.e().f() + " (Android " + Build.VERSION.SDK_INT + ") " + str + "/" + kit.i();
|
||||
}
|
||||
|
||||
static String a(String str, String str2) {
|
||||
return !TextUtils.isEmpty(str2) ? str2 : str;
|
||||
}
|
||||
}
|
@@ -0,0 +1,22 @@
|
||||
package com.twitter.sdk.android.core.internal.scribe;
|
||||
|
||||
import android.content.Context;
|
||||
import io.fabric.sdk.android.services.events.EnabledEventsStrategy;
|
||||
import io.fabric.sdk.android.services.events.FilesSender;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
class EnabledScribeStrategy extends EnabledEventsStrategy<ScribeEvent> {
|
||||
private final FilesSender f;
|
||||
|
||||
public EnabledScribeStrategy(Context context, ScheduledExecutorService scheduledExecutorService, ScribeFilesManager scribeFilesManager, ScribeConfig scribeConfig, ScribeFilesSender scribeFilesSender) {
|
||||
super(context, scheduledExecutorService, scribeFilesManager);
|
||||
this.f = scribeFilesSender;
|
||||
a(scribeConfig.h);
|
||||
}
|
||||
|
||||
@Override // io.fabric.sdk.android.services.events.EventsStrategy
|
||||
public FilesSender a() {
|
||||
return this.f;
|
||||
}
|
||||
}
|
@@ -0,0 +1,129 @@
|
||||
package com.twitter.sdk.android.core.internal.scribe;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class EventNamespace {
|
||||
|
||||
@SerializedName("client")
|
||||
public final String a;
|
||||
|
||||
@SerializedName("page")
|
||||
public final String b;
|
||||
|
||||
@SerializedName("section")
|
||||
public final String c;
|
||||
|
||||
@SerializedName("component")
|
||||
public final String d;
|
||||
|
||||
@SerializedName("element")
|
||||
public final String e;
|
||||
|
||||
@SerializedName("action")
|
||||
public final String f;
|
||||
|
||||
public static class Builder {
|
||||
private String a;
|
||||
private String b;
|
||||
private String c;
|
||||
private String d;
|
||||
private String e;
|
||||
private String f;
|
||||
|
||||
public Builder a(String str) {
|
||||
this.f = str;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder b(String str) {
|
||||
this.a = str;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder c(String str) {
|
||||
this.d = str;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder d(String str) {
|
||||
this.e = str;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder e(String str) {
|
||||
this.b = str;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder f(String str) {
|
||||
this.c = str;
|
||||
return this;
|
||||
}
|
||||
|
||||
public EventNamespace a() {
|
||||
return new EventNamespace(this.a, this.b, this.c, this.d, this.e, this.f);
|
||||
}
|
||||
}
|
||||
|
||||
public EventNamespace(String str, String str2, String str3, String str4, String str5, String str6) {
|
||||
this.a = str;
|
||||
this.b = str2;
|
||||
this.c = str3;
|
||||
this.d = str4;
|
||||
this.e = str5;
|
||||
this.f = str6;
|
||||
}
|
||||
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj) {
|
||||
return true;
|
||||
}
|
||||
if (obj == null || EventNamespace.class != obj.getClass()) {
|
||||
return false;
|
||||
}
|
||||
EventNamespace eventNamespace = (EventNamespace) obj;
|
||||
String str = this.f;
|
||||
if (str == null ? eventNamespace.f != null : !str.equals(eventNamespace.f)) {
|
||||
return false;
|
||||
}
|
||||
String str2 = this.a;
|
||||
if (str2 == null ? eventNamespace.a != null : !str2.equals(eventNamespace.a)) {
|
||||
return false;
|
||||
}
|
||||
String str3 = this.d;
|
||||
if (str3 == null ? eventNamespace.d != null : !str3.equals(eventNamespace.d)) {
|
||||
return false;
|
||||
}
|
||||
String str4 = this.e;
|
||||
if (str4 == null ? eventNamespace.e != null : !str4.equals(eventNamespace.e)) {
|
||||
return false;
|
||||
}
|
||||
String str5 = this.b;
|
||||
if (str5 == null ? eventNamespace.b != null : !str5.equals(eventNamespace.b)) {
|
||||
return false;
|
||||
}
|
||||
String str6 = this.c;
|
||||
String str7 = eventNamespace.c;
|
||||
return str6 == null ? str7 == null : str6.equals(str7);
|
||||
}
|
||||
|
||||
public int hashCode() {
|
||||
String str = this.a;
|
||||
int hashCode = (str != null ? str.hashCode() : 0) * 31;
|
||||
String str2 = this.b;
|
||||
int hashCode2 = (hashCode + (str2 != null ? str2.hashCode() : 0)) * 31;
|
||||
String str3 = this.c;
|
||||
int hashCode3 = (hashCode2 + (str3 != null ? str3.hashCode() : 0)) * 31;
|
||||
String str4 = this.d;
|
||||
int hashCode4 = (hashCode3 + (str4 != null ? str4.hashCode() : 0)) * 31;
|
||||
String str5 = this.e;
|
||||
int hashCode5 = (hashCode4 + (str5 != null ? str5.hashCode() : 0)) * 31;
|
||||
String str6 = this.f;
|
||||
return hashCode5 + (str6 != null ? str6.hashCode() : 0);
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return "client=" + this.a + ", page=" + this.b + ", section=" + this.c + ", component=" + this.d + ", element=" + this.e + ", action=" + this.f;
|
||||
}
|
||||
}
|
@@ -0,0 +1,90 @@
|
||||
package com.twitter.sdk.android.core.internal.scribe;
|
||||
|
||||
import android.content.Context;
|
||||
import com.twitter.sdk.android.core.GuestSessionProvider;
|
||||
import com.twitter.sdk.android.core.Session;
|
||||
import com.twitter.sdk.android.core.SessionManager;
|
||||
import com.twitter.sdk.android.core.TwitterAuthConfig;
|
||||
import com.twitter.sdk.android.core.TwitterAuthToken;
|
||||
import com.twitter.sdk.android.core.internal.scribe.ScribeEvent;
|
||||
import io.fabric.sdk.android.Kit;
|
||||
import io.fabric.sdk.android.services.common.CommonUtils;
|
||||
import io.fabric.sdk.android.services.common.IdManager;
|
||||
import io.fabric.sdk.android.services.common.SystemCurrentTimeProvider;
|
||||
import io.fabric.sdk.android.services.events.DisabledEventsStrategy;
|
||||
import io.fabric.sdk.android.services.events.EventsStrategy;
|
||||
import io.fabric.sdk.android.services.events.QueueFileEventStorage;
|
||||
import io.fabric.sdk.android.services.persistence.FileStoreImpl;
|
||||
import java.io.IOException;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
import javax.net.ssl.SSLSocketFactory;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class ScribeClient {
|
||||
final ConcurrentHashMap<Long, ScribeHandler> a = new ConcurrentHashMap<>(2);
|
||||
private final Kit b;
|
||||
private final ScheduledExecutorService c;
|
||||
private final ScribeConfig d;
|
||||
private final ScribeEvent.Transform e;
|
||||
private final TwitterAuthConfig f;
|
||||
private final SessionManager<? extends Session<TwitterAuthToken>> g;
|
||||
private final GuestSessionProvider h;
|
||||
private final SSLSocketFactory i;
|
||||
private final IdManager j;
|
||||
|
||||
public ScribeClient(Kit kit, ScheduledExecutorService scheduledExecutorService, ScribeConfig scribeConfig, ScribeEvent.Transform transform, TwitterAuthConfig twitterAuthConfig, SessionManager<? extends Session<TwitterAuthToken>> sessionManager, GuestSessionProvider guestSessionProvider, SSLSocketFactory sSLSocketFactory, IdManager idManager) {
|
||||
this.b = kit;
|
||||
this.c = scheduledExecutorService;
|
||||
this.d = scribeConfig;
|
||||
this.e = transform;
|
||||
this.f = twitterAuthConfig;
|
||||
this.g = sessionManager;
|
||||
this.h = guestSessionProvider;
|
||||
this.i = sSLSocketFactory;
|
||||
this.j = idManager;
|
||||
}
|
||||
|
||||
private ScribeHandler d(long j) throws IOException {
|
||||
Context d = this.b.d();
|
||||
ScribeFilesManager scribeFilesManager = new ScribeFilesManager(d, this.e, new SystemCurrentTimeProvider(), new QueueFileEventStorage(d, new FileStoreImpl(this.b).a(), c(j), b(j)), this.d.g);
|
||||
return new ScribeHandler(d, a(j, scribeFilesManager), scribeFilesManager, this.c);
|
||||
}
|
||||
|
||||
public boolean a(ScribeEvent scribeEvent, long j) {
|
||||
try {
|
||||
a(j).a(scribeEvent);
|
||||
return true;
|
||||
} catch (IOException e) {
|
||||
CommonUtils.a(this.b.d(), "Failed to scribe event", e);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
String b(long j) {
|
||||
return j + "_se_to_send";
|
||||
}
|
||||
|
||||
String c(long j) {
|
||||
return j + "_se.tap";
|
||||
}
|
||||
|
||||
ScribeHandler a(long j) throws IOException {
|
||||
if (!this.a.containsKey(Long.valueOf(j))) {
|
||||
this.a.putIfAbsent(Long.valueOf(j), d(j));
|
||||
}
|
||||
return this.a.get(Long.valueOf(j));
|
||||
}
|
||||
|
||||
EventsStrategy<ScribeEvent> a(long j, ScribeFilesManager scribeFilesManager) {
|
||||
Context d = this.b.d();
|
||||
if (this.d.a) {
|
||||
CommonUtils.b(d, "Scribe enabled");
|
||||
ScheduledExecutorService scheduledExecutorService = this.c;
|
||||
ScribeConfig scribeConfig = this.d;
|
||||
return new EnabledScribeStrategy(d, scheduledExecutorService, scribeFilesManager, scribeConfig, new ScribeFilesSender(d, scribeConfig, j, this.f, this.g, this.h, this.i, scheduledExecutorService, this.j));
|
||||
}
|
||||
CommonUtils.b(d, "Scribe disabled");
|
||||
return new DisabledEventsStrategy();
|
||||
}
|
||||
}
|
@@ -0,0 +1,24 @@
|
||||
package com.twitter.sdk.android.core.internal.scribe;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class ScribeConfig {
|
||||
public final boolean a;
|
||||
public final String b;
|
||||
public final String c;
|
||||
public final String d;
|
||||
public final String e;
|
||||
public final String f;
|
||||
public final int g;
|
||||
public final int h;
|
||||
|
||||
public ScribeConfig(boolean z, String str, String str2, String str3, String str4, String str5, int i, int i2) {
|
||||
this.a = z;
|
||||
this.b = str;
|
||||
this.c = str2;
|
||||
this.d = str3;
|
||||
this.e = str4;
|
||||
this.f = str5;
|
||||
this.g = i;
|
||||
this.h = i2;
|
||||
}
|
||||
}
|
@@ -0,0 +1,105 @@
|
||||
package com.twitter.sdk.android.core.internal.scribe;
|
||||
|
||||
import android.text.TextUtils;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import io.fabric.sdk.android.services.events.EventTransform;
|
||||
import java.io.IOException;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class ScribeEvent {
|
||||
|
||||
@SerializedName("event_namespace")
|
||||
final EventNamespace a;
|
||||
|
||||
@SerializedName("ts")
|
||||
final String b;
|
||||
|
||||
@SerializedName("format_version")
|
||||
final String c = "2";
|
||||
|
||||
@SerializedName("_category_")
|
||||
final String d;
|
||||
|
||||
@SerializedName("items")
|
||||
final List<ScribeItem> e;
|
||||
|
||||
public static class Transform implements EventTransform<ScribeEvent> {
|
||||
private final Gson a;
|
||||
|
||||
public Transform(Gson gson) {
|
||||
this.a = gson;
|
||||
}
|
||||
|
||||
@Override // io.fabric.sdk.android.services.events.EventTransform
|
||||
public byte[] a(ScribeEvent scribeEvent) throws IOException {
|
||||
return this.a.toJson(scribeEvent).getBytes("UTF-8");
|
||||
}
|
||||
}
|
||||
|
||||
public ScribeEvent(String str, EventNamespace eventNamespace, long j, List<ScribeItem> list) {
|
||||
this.d = str;
|
||||
this.a = eventNamespace;
|
||||
this.b = String.valueOf(j);
|
||||
this.e = Collections.unmodifiableList(list);
|
||||
}
|
||||
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj) {
|
||||
return true;
|
||||
}
|
||||
if (obj == null || getClass() != obj.getClass()) {
|
||||
return false;
|
||||
}
|
||||
ScribeEvent scribeEvent = (ScribeEvent) obj;
|
||||
String str = this.d;
|
||||
if (str == null ? scribeEvent.d != null : !str.equals(scribeEvent.d)) {
|
||||
return false;
|
||||
}
|
||||
EventNamespace eventNamespace = this.a;
|
||||
if (eventNamespace == null ? scribeEvent.a != null : !eventNamespace.equals(scribeEvent.a)) {
|
||||
return false;
|
||||
}
|
||||
String str2 = this.c;
|
||||
if (str2 == null ? scribeEvent.c != null : !str2.equals(scribeEvent.c)) {
|
||||
return false;
|
||||
}
|
||||
String str3 = this.b;
|
||||
if (str3 == null ? scribeEvent.b != null : !str3.equals(scribeEvent.b)) {
|
||||
return false;
|
||||
}
|
||||
List<ScribeItem> list = this.e;
|
||||
List<ScribeItem> list2 = scribeEvent.e;
|
||||
return list == null ? list2 == null : list.equals(list2);
|
||||
}
|
||||
|
||||
public int hashCode() {
|
||||
EventNamespace eventNamespace = this.a;
|
||||
int hashCode = (eventNamespace != null ? eventNamespace.hashCode() : 0) * 31;
|
||||
String str = this.b;
|
||||
int hashCode2 = (hashCode + (str != null ? str.hashCode() : 0)) * 31;
|
||||
String str2 = this.c;
|
||||
int hashCode3 = (hashCode2 + (str2 != null ? str2.hashCode() : 0)) * 31;
|
||||
String str3 = this.d;
|
||||
int hashCode4 = (hashCode3 + (str3 != null ? str3.hashCode() : 0)) * 31;
|
||||
List<ScribeItem> list = this.e;
|
||||
return hashCode4 + (list != null ? list.hashCode() : 0);
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("event_namespace=");
|
||||
sb.append(this.a);
|
||||
sb.append(", ts=");
|
||||
sb.append(this.b);
|
||||
sb.append(", format_version=");
|
||||
sb.append(this.c);
|
||||
sb.append(", _category_=");
|
||||
sb.append(this.d);
|
||||
sb.append(", items=");
|
||||
sb.append("[" + TextUtils.join(", ", this.e) + "]");
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
@@ -0,0 +1,11 @@
|
||||
package com.twitter.sdk.android.core.internal.scribe;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class ScribeEventFactory {
|
||||
public static ScribeEvent a(EventNamespace eventNamespace, String str, long j, String str2, String str3, List<ScribeItem> list) {
|
||||
String str4 = eventNamespace.a;
|
||||
return ((str4.hashCode() == 114757 && str4.equals("tfw")) ? (char) 0 : (char) 65535) != 0 ? new SyndicatedSdkImpressionEvent(eventNamespace, j, str2, str3, list) : new SyndicationClientEvent(eventNamespace, str, j, str2, str3, list);
|
||||
}
|
||||
}
|
@@ -0,0 +1,21 @@
|
||||
package com.twitter.sdk.android.core.internal.scribe;
|
||||
|
||||
import android.content.Context;
|
||||
import io.fabric.sdk.android.services.common.CurrentTimeProvider;
|
||||
import io.fabric.sdk.android.services.events.EventTransform;
|
||||
import io.fabric.sdk.android.services.events.EventsFilesManager;
|
||||
import io.fabric.sdk.android.services.events.QueueFileEventStorage;
|
||||
import java.io.IOException;
|
||||
import java.util.UUID;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
class ScribeFilesManager extends EventsFilesManager<ScribeEvent> {
|
||||
public ScribeFilesManager(Context context, EventTransform<ScribeEvent> eventTransform, CurrentTimeProvider currentTimeProvider, QueueFileEventStorage queueFileEventStorage, int i) throws IOException {
|
||||
super(context, eventTransform, currentTimeProvider, queueFileEventStorage, i);
|
||||
}
|
||||
|
||||
@Override // io.fabric.sdk.android.services.events.EventsFilesManager
|
||||
protected String b() {
|
||||
return "se_" + UUID.randomUUID().toString() + "_" + this.c.a() + ".tap";
|
||||
}
|
||||
}
|
@@ -0,0 +1,200 @@
|
||||
package com.twitter.sdk.android.core.internal.scribe;
|
||||
|
||||
import android.content.Context;
|
||||
import android.text.TextUtils;
|
||||
import com.ijm.dataencryption.de.DataDecryptTool;
|
||||
import com.twitter.sdk.android.core.GuestSessionProvider;
|
||||
import com.twitter.sdk.android.core.Session;
|
||||
import com.twitter.sdk.android.core.SessionManager;
|
||||
import com.twitter.sdk.android.core.TwitterAuthConfig;
|
||||
import com.twitter.sdk.android.core.TwitterAuthToken;
|
||||
import com.twitter.sdk.android.core.internal.network.GuestAuthInterceptor;
|
||||
import com.twitter.sdk.android.core.internal.network.OAuth1aInterceptor;
|
||||
import io.fabric.sdk.android.services.common.CommonUtils;
|
||||
import io.fabric.sdk.android.services.common.IdManager;
|
||||
import io.fabric.sdk.android.services.common.QueueFile;
|
||||
import io.fabric.sdk.android.services.events.FilesSender;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
import javax.net.ssl.SSLSocketFactory;
|
||||
import okhttp3.Interceptor;
|
||||
import okhttp3.OkHttpClient;
|
||||
import okhttp3.Request;
|
||||
import okhttp3.Response;
|
||||
import okhttp3.ResponseBody;
|
||||
import retrofit2.Call;
|
||||
import retrofit2.Retrofit;
|
||||
import retrofit2.http.Field;
|
||||
import retrofit2.http.FormUrlEncoded;
|
||||
import retrofit2.http.Headers;
|
||||
import retrofit2.http.POST;
|
||||
import retrofit2.http.Path;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
class ScribeFilesSender implements FilesSender {
|
||||
private static final byte[] j = {91};
|
||||
private static final byte[] k = {44};
|
||||
private static final byte[] l = {93};
|
||||
private final Context a;
|
||||
private final ScribeConfig b;
|
||||
private final long c;
|
||||
private final TwitterAuthConfig d;
|
||||
private final SessionManager<? extends Session<TwitterAuthToken>> e;
|
||||
private final GuestSessionProvider f;
|
||||
private final SSLSocketFactory g;
|
||||
private final AtomicReference<ScribeService> h = new AtomicReference<>();
|
||||
private final IdManager i;
|
||||
|
||||
static class ConfigRequestInterceptor implements Interceptor {
|
||||
private final ScribeConfig a;
|
||||
private final IdManager b;
|
||||
|
||||
ConfigRequestInterceptor(ScribeConfig scribeConfig, IdManager idManager) {
|
||||
this.a = scribeConfig;
|
||||
this.b = idManager;
|
||||
}
|
||||
|
||||
@Override // okhttp3.Interceptor
|
||||
public Response intercept(Interceptor.Chain chain) throws IOException {
|
||||
Request.Builder newBuilder = chain.request().newBuilder();
|
||||
if (!TextUtils.isEmpty(this.a.f)) {
|
||||
newBuilder.header("User-Agent", this.a.f);
|
||||
}
|
||||
if (!TextUtils.isEmpty(this.b.f())) {
|
||||
newBuilder.header("X-Client-UUID", this.b.f());
|
||||
}
|
||||
newBuilder.header("X-Twitter-Polling", "true");
|
||||
return chain.proceed(newBuilder.build());
|
||||
}
|
||||
}
|
||||
|
||||
interface ScribeService {
|
||||
@FormUrlEncoded
|
||||
@Headers({"Content-Type: application/x-www-form-urlencoded;charset=UTF-8"})
|
||||
@POST("/{version}/jot/{type}")
|
||||
Call<ResponseBody> upload(@Path("version") String str, @Path("type") String str2, @Field("log[]") String str3);
|
||||
|
||||
@FormUrlEncoded
|
||||
@Headers({"Content-Type: application/x-www-form-urlencoded;charset=UTF-8"})
|
||||
@POST("/scribe/{sequence}")
|
||||
Call<ResponseBody> uploadSequence(@Path("sequence") String str, @Field("log[]") String str2);
|
||||
}
|
||||
|
||||
public ScribeFilesSender(Context context, ScribeConfig scribeConfig, long j2, TwitterAuthConfig twitterAuthConfig, SessionManager<? extends Session<TwitterAuthToken>> sessionManager, GuestSessionProvider guestSessionProvider, SSLSocketFactory sSLSocketFactory, ExecutorService executorService, IdManager idManager) {
|
||||
this.a = context;
|
||||
this.b = scribeConfig;
|
||||
this.c = j2;
|
||||
this.d = twitterAuthConfig;
|
||||
this.e = sessionManager;
|
||||
this.f = guestSessionProvider;
|
||||
this.g = sSLSocketFactory;
|
||||
this.i = idManager;
|
||||
}
|
||||
|
||||
private boolean c() {
|
||||
return a() != null;
|
||||
}
|
||||
|
||||
@Override // io.fabric.sdk.android.services.events.FilesSender
|
||||
public boolean a(List<File> list) {
|
||||
if (!c()) {
|
||||
CommonUtils.b(this.a, "Cannot attempt upload at this time");
|
||||
return false;
|
||||
}
|
||||
try {
|
||||
String b = b(list);
|
||||
CommonUtils.b(this.a, b);
|
||||
retrofit2.Response<ResponseBody> a = a(b);
|
||||
if (a.code() == 200) {
|
||||
return true;
|
||||
}
|
||||
CommonUtils.a(this.a, "Failed sending files", (Throwable) null);
|
||||
if (a.code() != 500) {
|
||||
if (a.code() != 400) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
CommonUtils.a(this.a, "Failed sending files", e);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
String b(List<File> list) throws IOException {
|
||||
QueueFile queueFile;
|
||||
final ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(DataDecryptTool.DECRYPT_SP_FILE);
|
||||
final boolean[] zArr = new boolean[1];
|
||||
byteArrayOutputStream.write(j);
|
||||
Iterator<File> it = list.iterator();
|
||||
while (it.hasNext()) {
|
||||
try {
|
||||
queueFile = new QueueFile(it.next());
|
||||
} catch (Throwable th) {
|
||||
th = th;
|
||||
queueFile = null;
|
||||
}
|
||||
try {
|
||||
queueFile.a(new QueueFile.ElementReader(this) { // from class: com.twitter.sdk.android.core.internal.scribe.ScribeFilesSender.1
|
||||
@Override // io.fabric.sdk.android.services.common.QueueFile.ElementReader
|
||||
public void a(InputStream inputStream, int i) throws IOException {
|
||||
byte[] bArr = new byte[i];
|
||||
inputStream.read(bArr);
|
||||
boolean[] zArr2 = zArr;
|
||||
if (zArr2[0]) {
|
||||
byteArrayOutputStream.write(ScribeFilesSender.k);
|
||||
} else {
|
||||
zArr2[0] = true;
|
||||
}
|
||||
byteArrayOutputStream.write(bArr);
|
||||
}
|
||||
});
|
||||
CommonUtils.a(queueFile);
|
||||
} catch (Throwable th2) {
|
||||
th = th2;
|
||||
CommonUtils.a(queueFile);
|
||||
throw th;
|
||||
}
|
||||
}
|
||||
byteArrayOutputStream.write(l);
|
||||
return byteArrayOutputStream.toString("UTF-8");
|
||||
}
|
||||
|
||||
/* JADX WARN: Multi-variable type inference failed */
|
||||
synchronized ScribeService a() {
|
||||
OkHttpClient build;
|
||||
if (this.h.get() == null) {
|
||||
Session a = a(this.c);
|
||||
if (a(a)) {
|
||||
build = new OkHttpClient.Builder().sslSocketFactory(this.g).addInterceptor(new ConfigRequestInterceptor(this.b, this.i)).addInterceptor(new OAuth1aInterceptor(a, this.d)).build();
|
||||
} else {
|
||||
build = new OkHttpClient.Builder().sslSocketFactory(this.g).addInterceptor(new ConfigRequestInterceptor(this.b, this.i)).addInterceptor(new GuestAuthInterceptor(this.f)).build();
|
||||
}
|
||||
this.h.compareAndSet(null, new Retrofit.Builder().baseUrl(this.b.b).client(build).build().create(ScribeService.class));
|
||||
}
|
||||
return this.h.get();
|
||||
}
|
||||
|
||||
private Session a(long j2) {
|
||||
return this.e.b(j2);
|
||||
}
|
||||
|
||||
private boolean a(Session session) {
|
||||
return (session == null || session.a() == null) ? false : true;
|
||||
}
|
||||
|
||||
retrofit2.Response<ResponseBody> a(String str) throws IOException {
|
||||
ScribeService a = a();
|
||||
if (!TextUtils.isEmpty(this.b.e)) {
|
||||
return a.uploadSequence(this.b.e, str).execute();
|
||||
}
|
||||
ScribeConfig scribeConfig = this.b;
|
||||
return a.upload(scribeConfig.c, scribeConfig.d, str).execute();
|
||||
}
|
||||
}
|
@@ -0,0 +1,18 @@
|
||||
package com.twitter.sdk.android.core.internal.scribe;
|
||||
|
||||
import android.content.Context;
|
||||
import io.fabric.sdk.android.services.events.EventsFilesManager;
|
||||
import io.fabric.sdk.android.services.events.EventsHandler;
|
||||
import io.fabric.sdk.android.services.events.EventsStrategy;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
class ScribeHandler extends EventsHandler<ScribeEvent> {
|
||||
public ScribeHandler(Context context, EventsStrategy<ScribeEvent> eventsStrategy, EventsFilesManager eventsFilesManager, ScheduledExecutorService scheduledExecutorService) {
|
||||
super(context, eventsStrategy, eventsFilesManager, scheduledExecutorService);
|
||||
}
|
||||
|
||||
public void a(ScribeEvent scribeEvent) {
|
||||
a(scribeEvent, false);
|
||||
}
|
||||
}
|
@@ -0,0 +1,238 @@
|
||||
package com.twitter.sdk.android.core.internal.scribe;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import com.tencent.open.SocialConstants;
|
||||
import com.twitter.sdk.android.core.internal.VineCardUtils;
|
||||
import com.twitter.sdk.android.core.models.Card;
|
||||
import com.twitter.sdk.android.core.models.MediaEntity;
|
||||
import com.twitter.sdk.android.core.models.Tweet;
|
||||
import com.twitter.sdk.android.core.models.User;
|
||||
import com.ubt.jimu.controller.data.widget.JockstickDataConverter;
|
||||
import java.io.Serializable;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class ScribeItem implements Serializable {
|
||||
public static final int TYPE_MESSAGE = 6;
|
||||
public static final int TYPE_TWEET = 0;
|
||||
public static final int TYPE_USER = 3;
|
||||
|
||||
@SerializedName("card_event")
|
||||
public final CardEvent cardEvent;
|
||||
|
||||
@SerializedName(SocialConstants.PARAM_COMMENT)
|
||||
public final String description;
|
||||
|
||||
@SerializedName(JockstickDataConverter.ID)
|
||||
public final Long id;
|
||||
|
||||
@SerializedName("item_type")
|
||||
public final Integer itemType;
|
||||
|
||||
@SerializedName("media_details")
|
||||
public final MediaDetails mediaDetails;
|
||||
|
||||
public static class Builder {
|
||||
private Integer a;
|
||||
private Long b;
|
||||
private String c;
|
||||
private CardEvent d;
|
||||
private MediaDetails e;
|
||||
|
||||
public Builder a(int i) {
|
||||
this.a = Integer.valueOf(i);
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder a(long j) {
|
||||
this.b = Long.valueOf(j);
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder a(String str) {
|
||||
this.c = str;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder a(CardEvent cardEvent) {
|
||||
this.d = cardEvent;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder a(MediaDetails mediaDetails) {
|
||||
this.e = mediaDetails;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ScribeItem a() {
|
||||
return new ScribeItem(this.a, this.b, this.c, this.d, this.e);
|
||||
}
|
||||
}
|
||||
|
||||
public static class CardEvent implements Serializable {
|
||||
|
||||
@SerializedName("promotion_card_type")
|
||||
final int promotionCardType;
|
||||
|
||||
public CardEvent(int i) {
|
||||
this.promotionCardType = i;
|
||||
}
|
||||
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj) {
|
||||
return true;
|
||||
}
|
||||
return obj != null && CardEvent.class == obj.getClass() && this.promotionCardType == ((CardEvent) obj).promotionCardType;
|
||||
}
|
||||
|
||||
public int hashCode() {
|
||||
return this.promotionCardType;
|
||||
}
|
||||
}
|
||||
|
||||
public static class MediaDetails implements Serializable {
|
||||
public static final String GIF_TYPE = "animated_gif";
|
||||
public static final int TYPE_AMPLIFY = 2;
|
||||
public static final int TYPE_ANIMATED_GIF = 3;
|
||||
public static final int TYPE_CONSUMER = 1;
|
||||
public static final int TYPE_VINE = 4;
|
||||
|
||||
@SerializedName("content_id")
|
||||
public final long contentId;
|
||||
|
||||
@SerializedName("media_type")
|
||||
public final int mediaType;
|
||||
|
||||
@SerializedName("publisher_id")
|
||||
public final long publisherId;
|
||||
|
||||
public MediaDetails(long j, int i, long j2) {
|
||||
this.contentId = j;
|
||||
this.mediaType = i;
|
||||
this.publisherId = j2;
|
||||
}
|
||||
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj) {
|
||||
return true;
|
||||
}
|
||||
if (obj == null || MediaDetails.class != obj.getClass()) {
|
||||
return false;
|
||||
}
|
||||
MediaDetails mediaDetails = (MediaDetails) obj;
|
||||
return this.contentId == mediaDetails.contentId && this.mediaType == mediaDetails.mediaType && this.publisherId == mediaDetails.publisherId;
|
||||
}
|
||||
|
||||
public int hashCode() {
|
||||
long j = this.contentId;
|
||||
int i = ((((int) (j ^ (j >>> 32))) * 31) + this.mediaType) * 31;
|
||||
long j2 = this.publisherId;
|
||||
return i + ((int) (j2 ^ (j2 >>> 32)));
|
||||
}
|
||||
}
|
||||
|
||||
static MediaDetails createCardDetails(long j, Card card) {
|
||||
return new MediaDetails(j, 4, Long.valueOf(VineCardUtils.b(card)).longValue());
|
||||
}
|
||||
|
||||
static MediaDetails createMediaDetails(long j, MediaEntity mediaEntity) {
|
||||
return new MediaDetails(j, getMediaType(mediaEntity), mediaEntity.id);
|
||||
}
|
||||
|
||||
public static ScribeItem fromMediaEntity(long j, MediaEntity mediaEntity) {
|
||||
Builder builder = new Builder();
|
||||
builder.a(0);
|
||||
builder.a(j);
|
||||
builder.a(createMediaDetails(j, mediaEntity));
|
||||
return builder.a();
|
||||
}
|
||||
|
||||
public static ScribeItem fromMessage(String str) {
|
||||
Builder builder = new Builder();
|
||||
builder.a(6);
|
||||
builder.a(str);
|
||||
return builder.a();
|
||||
}
|
||||
|
||||
public static ScribeItem fromTweet(Tweet tweet) {
|
||||
Builder builder = new Builder();
|
||||
builder.a(0);
|
||||
builder.a(tweet.i);
|
||||
return builder.a();
|
||||
}
|
||||
|
||||
public static ScribeItem fromTweetCard(long j, Card card) {
|
||||
Builder builder = new Builder();
|
||||
builder.a(0);
|
||||
builder.a(j);
|
||||
builder.a(createCardDetails(j, card));
|
||||
return builder.a();
|
||||
}
|
||||
|
||||
public static ScribeItem fromUser(User user) {
|
||||
Builder builder = new Builder();
|
||||
builder.a(3);
|
||||
builder.a(user.id);
|
||||
return builder.a();
|
||||
}
|
||||
|
||||
static int getMediaType(MediaEntity mediaEntity) {
|
||||
return MediaDetails.GIF_TYPE.equals(mediaEntity.type) ? 3 : 1;
|
||||
}
|
||||
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj) {
|
||||
return true;
|
||||
}
|
||||
if (obj == null || ScribeItem.class != obj.getClass()) {
|
||||
return false;
|
||||
}
|
||||
ScribeItem scribeItem = (ScribeItem) obj;
|
||||
Integer num = this.itemType;
|
||||
if (num == null ? scribeItem.itemType != null : !num.equals(scribeItem.itemType)) {
|
||||
return false;
|
||||
}
|
||||
Long l = this.id;
|
||||
if (l == null ? scribeItem.id != null : !l.equals(scribeItem.id)) {
|
||||
return false;
|
||||
}
|
||||
String str = this.description;
|
||||
if (str == null ? scribeItem.description != null : !str.equals(scribeItem.description)) {
|
||||
return false;
|
||||
}
|
||||
CardEvent cardEvent = this.cardEvent;
|
||||
if (cardEvent == null ? scribeItem.cardEvent != null : !cardEvent.equals(scribeItem.cardEvent)) {
|
||||
return false;
|
||||
}
|
||||
MediaDetails mediaDetails = this.mediaDetails;
|
||||
MediaDetails mediaDetails2 = scribeItem.mediaDetails;
|
||||
if (mediaDetails != null) {
|
||||
if (mediaDetails.equals(mediaDetails2)) {
|
||||
return true;
|
||||
}
|
||||
} else if (mediaDetails2 == null) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public int hashCode() {
|
||||
Integer num = this.itemType;
|
||||
int hashCode = (num != null ? num.hashCode() : 0) * 31;
|
||||
Long l = this.id;
|
||||
int hashCode2 = (hashCode + (l != null ? l.hashCode() : 0)) * 31;
|
||||
String str = this.description;
|
||||
int hashCode3 = (hashCode2 + (str != null ? str.hashCode() : 0)) * 31;
|
||||
CardEvent cardEvent = this.cardEvent;
|
||||
int hashCode4 = (hashCode3 + (cardEvent != null ? cardEvent.hashCode() : 0)) * 31;
|
||||
MediaDetails mediaDetails = this.mediaDetails;
|
||||
return hashCode4 + (mediaDetails != null ? mediaDetails.hashCode() : 0);
|
||||
}
|
||||
|
||||
private ScribeItem(Integer num, Long l, String str, CardEvent cardEvent, MediaDetails mediaDetails) {
|
||||
this.itemType = num;
|
||||
this.id = l;
|
||||
this.description = str;
|
||||
this.cardEvent = cardEvent;
|
||||
this.mediaDetails = mediaDetails;
|
||||
}
|
||||
}
|
@@ -0,0 +1,17 @@
|
||||
package com.twitter.sdk.android.core.internal.scribe;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class SyndicatedSdkImpressionEvent extends ScribeEvent {
|
||||
|
||||
public class ExternalIds {
|
||||
public ExternalIds(SyndicatedSdkImpressionEvent syndicatedSdkImpressionEvent, String str) {
|
||||
}
|
||||
}
|
||||
|
||||
public SyndicatedSdkImpressionEvent(EventNamespace eventNamespace, long j, String str, String str2, List<ScribeItem> list) {
|
||||
super("syndicated_sdk_impression", eventNamespace, j, list);
|
||||
new ExternalIds(this, str2);
|
||||
}
|
||||
}
|
@@ -0,0 +1,17 @@
|
||||
package com.twitter.sdk.android.core.internal.scribe;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class SyndicationClientEvent extends ScribeEvent {
|
||||
|
||||
public class ExternalIds {
|
||||
public ExternalIds(SyndicationClientEvent syndicationClientEvent, String str) {
|
||||
}
|
||||
}
|
||||
|
||||
public SyndicationClientEvent(EventNamespace eventNamespace, String str, long j, String str2, String str3, List<ScribeItem> list) {
|
||||
super("tfw_client_event", eventNamespace, j, list);
|
||||
new ExternalIds(this, str3);
|
||||
}
|
||||
}
|
@@ -0,0 +1,21 @@
|
||||
package com.twitter.sdk.android.core.internal.scribe;
|
||||
|
||||
import com.twitter.sdk.android.core.GuestSessionProvider;
|
||||
import com.twitter.sdk.android.core.Session;
|
||||
import com.twitter.sdk.android.core.SessionManager;
|
||||
import com.twitter.sdk.android.core.TwitterAuthToken;
|
||||
import com.twitter.sdk.android.core.TwitterCore;
|
||||
import io.fabric.sdk.android.services.common.IdManager;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class TwitterCoreScribeClientHolder {
|
||||
private static DefaultScribeClient a;
|
||||
|
||||
public static DefaultScribeClient a() {
|
||||
return a;
|
||||
}
|
||||
|
||||
public static void a(TwitterCore twitterCore, SessionManager<? extends Session<TwitterAuthToken>> sessionManager, GuestSessionProvider guestSessionProvider, IdManager idManager) {
|
||||
a = new DefaultScribeClient(twitterCore, "TwitterCore", sessionManager, guestSessionProvider, idManager);
|
||||
}
|
||||
}
|
@@ -0,0 +1,64 @@
|
||||
package com.twitter.sdk.android.core.internal.util;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.TypedArray;
|
||||
import android.util.AttributeSet;
|
||||
import android.widget.ImageView;
|
||||
import com.twitter.sdk.android.core.R$styleable;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class AspectRatioImageView extends ImageView {
|
||||
private double a;
|
||||
private int b;
|
||||
|
||||
public AspectRatioImageView(Context context) {
|
||||
this(context, null);
|
||||
}
|
||||
|
||||
int a(int i, double d) {
|
||||
if (d == 0.0d) {
|
||||
return 0;
|
||||
}
|
||||
return (int) Math.round(i / d);
|
||||
}
|
||||
|
||||
int b(int i, double d) {
|
||||
return (int) Math.round(i * d);
|
||||
}
|
||||
|
||||
public double getAspectRatio() {
|
||||
return this.a;
|
||||
}
|
||||
|
||||
public int getDimensionToAdjust() {
|
||||
return this.b;
|
||||
}
|
||||
|
||||
@Override // android.widget.ImageView, android.view.View
|
||||
protected void onMeasure(int i, int i2) {
|
||||
super.onMeasure(i, i2);
|
||||
int measuredWidth = getMeasuredWidth();
|
||||
int measuredHeight = getMeasuredHeight();
|
||||
if (this.b == 0) {
|
||||
measuredHeight = a(measuredWidth, this.a);
|
||||
} else {
|
||||
measuredWidth = b(measuredHeight, this.a);
|
||||
}
|
||||
setMeasuredDimension(measuredWidth, measuredHeight);
|
||||
}
|
||||
|
||||
public void setAspectRatio(double d) {
|
||||
this.a = d;
|
||||
}
|
||||
|
||||
public AspectRatioImageView(Context context, AttributeSet attributeSet) {
|
||||
super(context, attributeSet);
|
||||
TypedArray obtainStyledAttributes = context.obtainStyledAttributes(attributeSet, R$styleable.tw__AspectRatioImageView);
|
||||
try {
|
||||
this.a = obtainStyledAttributes.getFloat(R$styleable.tw__AspectRatioImageView_tw__image_aspect_ratio, 1.0f);
|
||||
this.b = obtainStyledAttributes.getInt(R$styleable.tw__AspectRatioImageView_tw__image_dimension_to_adjust, 0);
|
||||
} finally {
|
||||
obtainStyledAttributes.recycle();
|
||||
}
|
||||
}
|
||||
}
|
14
sources/com/twitter/sdk/android/core/models/ApiError.java
Normal file
14
sources/com/twitter/sdk/android/core/models/ApiError.java
Normal file
@@ -0,0 +1,14 @@
|
||||
package com.twitter.sdk.android.core.models;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import com.ubt.jimu.base.entities.Course;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class ApiError {
|
||||
|
||||
@SerializedName("message")
|
||||
public final String a;
|
||||
|
||||
@SerializedName(Course.TYPE_BLOCKLY)
|
||||
public final int b;
|
||||
}
|
11
sources/com/twitter/sdk/android/core/models/ApiErrors.java
Normal file
11
sources/com/twitter/sdk/android/core/models/ApiErrors.java
Normal file
@@ -0,0 +1,11 @@
|
||||
package com.twitter.sdk.android.core.models;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import java.util.List;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class ApiErrors {
|
||||
|
||||
@SerializedName("errors")
|
||||
public final List<ApiError> a;
|
||||
}
|
@@ -0,0 +1,25 @@
|
||||
package com.twitter.sdk.android.core.models;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Map;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class BindingValues {
|
||||
private final Map<String, Object> a;
|
||||
|
||||
public BindingValues() {
|
||||
this(Collections.EMPTY_MAP);
|
||||
}
|
||||
|
||||
public <T> T a(String str) {
|
||||
try {
|
||||
return (T) this.a.get(str);
|
||||
} catch (ClassCastException unused) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public BindingValues(Map<String, Object> map) {
|
||||
this.a = Collections.unmodifiableMap(map);
|
||||
}
|
||||
}
|
@@ -0,0 +1,86 @@
|
||||
package com.twitter.sdk.android.core.models;
|
||||
|
||||
import com.google.gson.JsonDeserializationContext;
|
||||
import com.google.gson.JsonDeserializer;
|
||||
import com.google.gson.JsonElement;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonParseException;
|
||||
import com.google.gson.JsonSerializationContext;
|
||||
import com.google.gson.JsonSerializer;
|
||||
import com.ubt.jimu.gen.UserDao;
|
||||
import java.lang.reflect.Type;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class BindingValuesAdapter implements JsonSerializer<BindingValues>, JsonDeserializer<BindingValues> {
|
||||
@Override // com.google.gson.JsonSerializer
|
||||
/* renamed from: a, reason: merged with bridge method [inline-methods] */
|
||||
public JsonElement serialize(BindingValues bindingValues, Type type, JsonSerializationContext jsonSerializationContext) {
|
||||
return null;
|
||||
}
|
||||
|
||||
/* JADX WARN: Failed to restore switch over string. Please report as a decompilation issue */
|
||||
Object a(JsonObject jsonObject, JsonDeserializationContext jsonDeserializationContext) {
|
||||
JsonElement jsonElement = jsonObject.get("type");
|
||||
if (jsonElement == null || !jsonElement.isJsonPrimitive()) {
|
||||
return null;
|
||||
}
|
||||
String asString = jsonElement.getAsString();
|
||||
char c = 65535;
|
||||
switch (asString.hashCode()) {
|
||||
case -1838656495:
|
||||
if (asString.equals("STRING")) {
|
||||
c = 0;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 2614219:
|
||||
if (asString.equals(UserDao.TABLENAME)) {
|
||||
c = 2;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 69775675:
|
||||
if (asString.equals("IMAGE")) {
|
||||
c = 1;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 782694408:
|
||||
if (asString.equals("BOOLEAN")) {
|
||||
c = 3;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (c == 0) {
|
||||
return jsonDeserializationContext.deserialize(jsonObject.get("string_value"), String.class);
|
||||
}
|
||||
if (c == 1) {
|
||||
return jsonDeserializationContext.deserialize(jsonObject.get("image_value"), ImageValue.class);
|
||||
}
|
||||
if (c == 2) {
|
||||
return jsonDeserializationContext.deserialize(jsonObject.get("user_value"), UserValue.class);
|
||||
}
|
||||
if (c != 3) {
|
||||
return null;
|
||||
}
|
||||
return jsonDeserializationContext.deserialize(jsonObject.get("boolean_value"), Boolean.class);
|
||||
}
|
||||
|
||||
/* JADX WARN: Can't rename method to resolve collision */
|
||||
@Override // com.google.gson.JsonDeserializer
|
||||
public BindingValues deserialize(JsonElement jsonElement, Type type, JsonDeserializationContext jsonDeserializationContext) throws JsonParseException {
|
||||
if (!jsonElement.isJsonObject()) {
|
||||
return new BindingValues();
|
||||
}
|
||||
Set<Map.Entry<String, JsonElement>> entrySet = jsonElement.getAsJsonObject().entrySet();
|
||||
HashMap hashMap = new HashMap(32);
|
||||
for (Map.Entry<String, JsonElement> entry : entrySet) {
|
||||
hashMap.put(entry.getKey(), a(entry.getValue().getAsJsonObject(), jsonDeserializationContext));
|
||||
}
|
||||
return new BindingValues(hashMap);
|
||||
}
|
||||
}
|
14
sources/com/twitter/sdk/android/core/models/Card.java
Normal file
14
sources/com/twitter/sdk/android/core/models/Card.java
Normal file
@@ -0,0 +1,14 @@
|
||||
package com.twitter.sdk.android.core.models;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import com.unity3d.ads.metadata.MediationMetaData;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class Card {
|
||||
|
||||
@SerializedName("binding_values")
|
||||
public final BindingValues a;
|
||||
|
||||
@SerializedName(MediationMetaData.KEY_NAME)
|
||||
public final String b;
|
||||
}
|
@@ -0,0 +1,5 @@
|
||||
package com.twitter.sdk.android.core.models;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class Coordinates {
|
||||
}
|
31
sources/com/twitter/sdk/android/core/models/Entity.java
Normal file
31
sources/com/twitter/sdk/android/core/models/Entity.java
Normal file
@@ -0,0 +1,31 @@
|
||||
package com.twitter.sdk.android.core.models;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
class Entity implements Serializable {
|
||||
private static final int END_INDEX = 1;
|
||||
private static final int START_INDEX = 0;
|
||||
|
||||
@SerializedName("indices")
|
||||
public final List<Integer> indices;
|
||||
|
||||
public Entity(int i, int i2) {
|
||||
ArrayList arrayList = new ArrayList(2);
|
||||
arrayList.add(0, Integer.valueOf(i));
|
||||
arrayList.add(1, Integer.valueOf(i2));
|
||||
this.indices = Collections.unmodifiableList(arrayList);
|
||||
}
|
||||
|
||||
public int getEnd() {
|
||||
return this.indices.get(1).intValue();
|
||||
}
|
||||
|
||||
public int getStart() {
|
||||
return this.indices.get(0).intValue();
|
||||
}
|
||||
}
|
@@ -0,0 +1,25 @@
|
||||
package com.twitter.sdk.android.core.models;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class HashtagEntity extends Entity {
|
||||
|
||||
@SerializedName("text")
|
||||
public final String text;
|
||||
|
||||
public HashtagEntity(String str, int i, int i2) {
|
||||
super(i, i2);
|
||||
this.text = str;
|
||||
}
|
||||
|
||||
@Override // com.twitter.sdk.android.core.models.Entity
|
||||
public /* bridge */ /* synthetic */ int getEnd() {
|
||||
return super.getEnd();
|
||||
}
|
||||
|
||||
@Override // com.twitter.sdk.android.core.models.Entity
|
||||
public /* bridge */ /* synthetic */ int getStart() {
|
||||
return super.getStart();
|
||||
}
|
||||
}
|
@@ -0,0 +1,5 @@
|
||||
package com.twitter.sdk.android.core.models;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public interface Identifiable {
|
||||
}
|
13
sources/com/twitter/sdk/android/core/models/ImageValue.java
Normal file
13
sources/com/twitter/sdk/android/core/models/ImageValue.java
Normal file
@@ -0,0 +1,13 @@
|
||||
package com.twitter.sdk.android.core.models;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class ImageValue {
|
||||
|
||||
@SerializedName("url")
|
||||
public final String a;
|
||||
|
||||
@SerializedName("alt")
|
||||
public final String b;
|
||||
}
|
10
sources/com/twitter/sdk/android/core/models/Media.java
Normal file
10
sources/com/twitter/sdk/android/core/models/Media.java
Normal file
@@ -0,0 +1,10 @@
|
||||
package com.twitter.sdk.android.core.models;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class Media {
|
||||
|
||||
@SerializedName("media_id")
|
||||
public final long a;
|
||||
}
|
93
sources/com/twitter/sdk/android/core/models/MediaEntity.java
Normal file
93
sources/com/twitter/sdk/android/core/models/MediaEntity.java
Normal file
@@ -0,0 +1,93 @@
|
||||
package com.twitter.sdk.android.core.models;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import com.ubt.jimu.controller.data.widget.JockstickDataConverter;
|
||||
import java.io.Serializable;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class MediaEntity extends UrlEntity {
|
||||
|
||||
@SerializedName("ext_alt_text")
|
||||
public final String altText;
|
||||
|
||||
@SerializedName(JockstickDataConverter.ID)
|
||||
public final long id;
|
||||
|
||||
@SerializedName("id_str")
|
||||
public final String idStr;
|
||||
|
||||
@SerializedName("media_url")
|
||||
public final String mediaUrl;
|
||||
|
||||
@SerializedName("media_url_https")
|
||||
public final String mediaUrlHttps;
|
||||
|
||||
@SerializedName("sizes")
|
||||
public final Sizes sizes;
|
||||
|
||||
@SerializedName("source_status_id")
|
||||
public final long sourceStatusId;
|
||||
|
||||
@SerializedName("source_status_id_str")
|
||||
public final String sourceStatusIdStr;
|
||||
|
||||
@SerializedName("type")
|
||||
public final String type;
|
||||
|
||||
@SerializedName("video_info")
|
||||
public final VideoInfo videoInfo;
|
||||
|
||||
public static class Size implements Serializable {
|
||||
|
||||
@SerializedName("h")
|
||||
public final int h;
|
||||
|
||||
@SerializedName("resize")
|
||||
public final String resize;
|
||||
|
||||
@SerializedName("w")
|
||||
public final int w;
|
||||
|
||||
public Size(int i, int i2, String str) {
|
||||
this.w = i;
|
||||
this.h = i2;
|
||||
this.resize = str;
|
||||
}
|
||||
}
|
||||
|
||||
public static class Sizes implements Serializable {
|
||||
|
||||
@SerializedName("large")
|
||||
public final Size large;
|
||||
|
||||
@SerializedName("medium")
|
||||
public final Size medium;
|
||||
|
||||
@SerializedName("small")
|
||||
public final Size small;
|
||||
|
||||
@SerializedName("thumb")
|
||||
public final Size thumb;
|
||||
|
||||
public Sizes(Size size, Size size2, Size size3, Size size4) {
|
||||
this.thumb = size;
|
||||
this.small = size2;
|
||||
this.medium = size3;
|
||||
this.large = size4;
|
||||
}
|
||||
}
|
||||
|
||||
public MediaEntity(String str, String str2, String str3, int i, int i2, long j, String str4, String str5, String str6, Sizes sizes, long j2, String str7, String str8, VideoInfo videoInfo, String str9) {
|
||||
super(str, str2, str3, i, i2);
|
||||
this.id = j;
|
||||
this.idStr = str4;
|
||||
this.mediaUrl = str5;
|
||||
this.mediaUrlHttps = str6;
|
||||
this.sizes = sizes;
|
||||
this.sourceStatusId = j2;
|
||||
this.sourceStatusIdStr = str7;
|
||||
this.type = str8;
|
||||
this.videoInfo = videoInfo;
|
||||
this.altText = str9;
|
||||
}
|
||||
}
|
@@ -0,0 +1,39 @@
|
||||
package com.twitter.sdk.android.core.models;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import com.ubt.jimu.controller.data.widget.JockstickDataConverter;
|
||||
import com.unity3d.ads.metadata.MediationMetaData;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class MentionEntity extends Entity {
|
||||
|
||||
@SerializedName(JockstickDataConverter.ID)
|
||||
public final long id;
|
||||
|
||||
@SerializedName("id_str")
|
||||
public final String idStr;
|
||||
|
||||
@SerializedName(MediationMetaData.KEY_NAME)
|
||||
public final String name;
|
||||
|
||||
@SerializedName("screen_name")
|
||||
public final String screenName;
|
||||
|
||||
public MentionEntity(long j, String str, String str2, String str3, int i, int i2) {
|
||||
super(i, i2);
|
||||
this.id = j;
|
||||
this.idStr = str;
|
||||
this.name = str2;
|
||||
this.screenName = str3;
|
||||
}
|
||||
|
||||
@Override // com.twitter.sdk.android.core.models.Entity
|
||||
public /* bridge */ /* synthetic */ int getEnd() {
|
||||
return super.getEnd();
|
||||
}
|
||||
|
||||
@Override // com.twitter.sdk.android.core.models.Entity
|
||||
public /* bridge */ /* synthetic */ int getStart() {
|
||||
return super.getStart();
|
||||
}
|
||||
}
|
5
sources/com/twitter/sdk/android/core/models/Place.java
Normal file
5
sources/com/twitter/sdk/android/core/models/Place.java
Normal file
@@ -0,0 +1,5 @@
|
||||
package com.twitter.sdk.android.core.models;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class Place {
|
||||
}
|
@@ -0,0 +1,31 @@
|
||||
package com.twitter.sdk.android.core.models;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.TypeAdapter;
|
||||
import com.google.gson.TypeAdapterFactory;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
import com.google.gson.stream.JsonReader;
|
||||
import com.google.gson.stream.JsonWriter;
|
||||
import java.io.IOException;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class SafeListAdapter implements TypeAdapterFactory {
|
||||
@Override // com.google.gson.TypeAdapterFactory
|
||||
public <T> TypeAdapter<T> create(Gson gson, final TypeToken<T> typeToken) {
|
||||
final TypeAdapter<T> delegateAdapter = gson.getDelegateAdapter(this, typeToken);
|
||||
return new TypeAdapter<T>(this) { // from class: com.twitter.sdk.android.core.models.SafeListAdapter.1
|
||||
@Override // com.google.gson.TypeAdapter
|
||||
public T read(JsonReader jsonReader) throws IOException {
|
||||
T t = (T) delegateAdapter.read(jsonReader);
|
||||
return List.class.isAssignableFrom(typeToken.getRawType()) ? t == null ? (T) Collections.EMPTY_LIST : (T) Collections.unmodifiableList((List) t) : t;
|
||||
}
|
||||
|
||||
@Override // com.google.gson.TypeAdapter
|
||||
public void write(JsonWriter jsonWriter, T t) throws IOException {
|
||||
delegateAdapter.write(jsonWriter, t);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
@@ -0,0 +1,31 @@
|
||||
package com.twitter.sdk.android.core.models;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.TypeAdapter;
|
||||
import com.google.gson.TypeAdapterFactory;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
import com.google.gson.stream.JsonReader;
|
||||
import com.google.gson.stream.JsonWriter;
|
||||
import java.io.IOException;
|
||||
import java.util.Collections;
|
||||
import java.util.Map;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class SafeMapAdapter implements TypeAdapterFactory {
|
||||
@Override // com.google.gson.TypeAdapterFactory
|
||||
public <T> TypeAdapter<T> create(Gson gson, final TypeToken<T> typeToken) {
|
||||
final TypeAdapter<T> delegateAdapter = gson.getDelegateAdapter(this, typeToken);
|
||||
return new TypeAdapter<T>(this) { // from class: com.twitter.sdk.android.core.models.SafeMapAdapter.1
|
||||
@Override // com.google.gson.TypeAdapter
|
||||
public T read(JsonReader jsonReader) throws IOException {
|
||||
T t = (T) delegateAdapter.read(jsonReader);
|
||||
return Map.class.isAssignableFrom(typeToken.getRawType()) ? t == null ? (T) Collections.EMPTY_MAP : (T) Collections.unmodifiableMap((Map) t) : t;
|
||||
}
|
||||
|
||||
@Override // com.google.gson.TypeAdapter
|
||||
public void write(JsonWriter jsonWriter, T t) throws IOException {
|
||||
delegateAdapter.write(jsonWriter, t);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
@@ -0,0 +1,25 @@
|
||||
package com.twitter.sdk.android.core.models;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class SymbolEntity extends Entity {
|
||||
|
||||
@SerializedName("text")
|
||||
public final String text;
|
||||
|
||||
public SymbolEntity(String str, int i, int i2) {
|
||||
super(i, i2);
|
||||
this.text = str;
|
||||
}
|
||||
|
||||
@Override // com.twitter.sdk.android.core.models.Entity
|
||||
public /* bridge */ /* synthetic */ int getEnd() {
|
||||
return super.getEnd();
|
||||
}
|
||||
|
||||
@Override // com.twitter.sdk.android.core.models.Entity
|
||||
public /* bridge */ /* synthetic */ int getStart() {
|
||||
return super.getStart();
|
||||
}
|
||||
}
|
157
sources/com/twitter/sdk/android/core/models/Tweet.java
Normal file
157
sources/com/twitter/sdk/android/core/models/Tweet.java
Normal file
@@ -0,0 +1,157 @@
|
||||
package com.twitter.sdk.android.core.models;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import com.tencent.open.SocialConstants;
|
||||
import com.ubt.jimu.controller.data.widget.JockstickDataConverter;
|
||||
import java.util.List;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class Tweet implements Identifiable {
|
||||
|
||||
@SerializedName(alternate = {"full_text"}, value = "text")
|
||||
public final String A;
|
||||
|
||||
@SerializedName("display_text_range")
|
||||
public final List<Integer> B;
|
||||
|
||||
@SerializedName("truncated")
|
||||
public final boolean C;
|
||||
|
||||
@SerializedName("user")
|
||||
public final User D;
|
||||
|
||||
@SerializedName("withheld_copyright")
|
||||
public final boolean E;
|
||||
|
||||
@SerializedName("withheld_in_countries")
|
||||
public final List<String> F;
|
||||
|
||||
@SerializedName("withheld_scope")
|
||||
public final String G;
|
||||
|
||||
@SerializedName("card")
|
||||
public final Card H;
|
||||
|
||||
@SerializedName("coordinates")
|
||||
public final Coordinates a;
|
||||
|
||||
@SerializedName("created_at")
|
||||
public final String b;
|
||||
|
||||
@SerializedName("current_user_retweet")
|
||||
public final Object c;
|
||||
|
||||
@SerializedName("entities")
|
||||
public final TweetEntities d;
|
||||
|
||||
@SerializedName("extended_entities")
|
||||
public final TweetEntities e;
|
||||
|
||||
@SerializedName("favorite_count")
|
||||
public final Integer f;
|
||||
|
||||
@SerializedName("favorited")
|
||||
public final boolean g;
|
||||
|
||||
@SerializedName("filter_level")
|
||||
public final String h;
|
||||
|
||||
@SerializedName(JockstickDataConverter.ID)
|
||||
public final long i;
|
||||
|
||||
@SerializedName("id_str")
|
||||
public final String j;
|
||||
|
||||
@SerializedName("in_reply_to_screen_name")
|
||||
public final String k;
|
||||
|
||||
@SerializedName("in_reply_to_status_id")
|
||||
public final long l;
|
||||
|
||||
@SerializedName("in_reply_to_status_id_str")
|
||||
public final String m;
|
||||
|
||||
@SerializedName("in_reply_to_user_id")
|
||||
public final long n;
|
||||
|
||||
@SerializedName("lang")
|
||||
public final String o;
|
||||
|
||||
@SerializedName("place")
|
||||
public final Place p;
|
||||
|
||||
@SerializedName("possibly_sensitive")
|
||||
public final boolean q;
|
||||
|
||||
@SerializedName("scopes")
|
||||
public final Object r;
|
||||
|
||||
@SerializedName("quoted_status_id")
|
||||
public final long s;
|
||||
|
||||
@SerializedName("quoted_status_id_str")
|
||||
public final String t;
|
||||
|
||||
@SerializedName("quoted_status")
|
||||
public final Tweet u;
|
||||
|
||||
@SerializedName("retweet_count")
|
||||
public final int v;
|
||||
|
||||
@SerializedName("retweeted")
|
||||
public final boolean x;
|
||||
|
||||
@SerializedName("retweeted_status")
|
||||
public final Tweet y;
|
||||
|
||||
@SerializedName(SocialConstants.PARAM_SOURCE)
|
||||
public final String z;
|
||||
|
||||
public Tweet(Coordinates coordinates, String str, Object obj, TweetEntities tweetEntities, TweetEntities tweetEntities2, Integer num, boolean z, String str2, long j, String str3, String str4, long j2, String str5, long j3, String str6, String str7, Place place, boolean z2, Object obj2, long j4, String str8, Tweet tweet, int i, boolean z3, Tweet tweet2, String str9, String str10, List<Integer> list, boolean z4, User user, boolean z5, List<String> list2, String str11, Card card) {
|
||||
this.a = coordinates;
|
||||
this.b = str;
|
||||
this.c = obj;
|
||||
this.d = tweetEntities;
|
||||
this.e = tweetEntities2;
|
||||
this.f = num;
|
||||
this.g = z;
|
||||
this.h = str2;
|
||||
this.i = j;
|
||||
this.j = str3;
|
||||
this.k = str4;
|
||||
this.l = j2;
|
||||
this.m = str5;
|
||||
this.n = j3;
|
||||
this.o = str7;
|
||||
this.p = place;
|
||||
this.q = z2;
|
||||
this.r = obj2;
|
||||
this.s = j4;
|
||||
this.t = str8;
|
||||
this.u = tweet;
|
||||
this.v = i;
|
||||
this.x = z3;
|
||||
this.y = tweet2;
|
||||
this.z = str9;
|
||||
this.A = str10;
|
||||
this.B = list;
|
||||
this.C = z4;
|
||||
this.D = user;
|
||||
this.E = z5;
|
||||
this.F = list2;
|
||||
this.G = str11;
|
||||
this.H = card;
|
||||
}
|
||||
|
||||
public long a() {
|
||||
return this.i;
|
||||
}
|
||||
|
||||
public boolean equals(Object obj) {
|
||||
return obj != null && (obj instanceof Tweet) && this.i == ((Tweet) obj).i;
|
||||
}
|
||||
|
||||
public int hashCode() {
|
||||
return (int) this.i;
|
||||
}
|
||||
}
|
@@ -0,0 +1,96 @@
|
||||
package com.twitter.sdk.android.core.models;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class TweetBuilder {
|
||||
private String A;
|
||||
private List<Integer> B;
|
||||
private boolean C;
|
||||
private User D;
|
||||
private boolean E;
|
||||
private List<String> F;
|
||||
private String G;
|
||||
private Card H;
|
||||
private Coordinates a;
|
||||
private String b;
|
||||
private Object c;
|
||||
private TweetEntities d;
|
||||
private TweetEntities e;
|
||||
private Integer f;
|
||||
private boolean g;
|
||||
private String h;
|
||||
private long i = -1;
|
||||
private String j;
|
||||
private String k;
|
||||
private long l;
|
||||
private String m;
|
||||
private long n;
|
||||
private String o;
|
||||
private String p;
|
||||
private Place q;
|
||||
private boolean r;
|
||||
private Object s;
|
||||
private long t;
|
||||
private String u;
|
||||
private Tweet v;
|
||||
private int w;
|
||||
private boolean x;
|
||||
private Tweet y;
|
||||
private String z;
|
||||
|
||||
public TweetBuilder() {
|
||||
List list = Collections.EMPTY_LIST;
|
||||
this.B = list;
|
||||
this.F = list;
|
||||
}
|
||||
|
||||
public TweetBuilder a(boolean z) {
|
||||
this.g = z;
|
||||
return this;
|
||||
}
|
||||
|
||||
public TweetBuilder a(Tweet tweet) {
|
||||
this.a = tweet.a;
|
||||
this.b = tweet.b;
|
||||
this.c = tweet.c;
|
||||
this.d = tweet.d;
|
||||
this.e = tweet.e;
|
||||
this.f = tweet.f;
|
||||
this.g = tweet.g;
|
||||
this.h = tweet.h;
|
||||
this.i = tweet.i;
|
||||
this.j = tweet.j;
|
||||
this.k = tweet.k;
|
||||
this.l = tweet.l;
|
||||
String str = tweet.m;
|
||||
this.m = str;
|
||||
this.n = tweet.n;
|
||||
this.o = str;
|
||||
this.p = tweet.o;
|
||||
this.q = tweet.p;
|
||||
this.r = tweet.q;
|
||||
this.s = tweet.r;
|
||||
this.t = tweet.s;
|
||||
this.u = tweet.t;
|
||||
this.v = tweet.u;
|
||||
this.w = tweet.v;
|
||||
this.x = tweet.x;
|
||||
this.y = tweet.y;
|
||||
this.z = tweet.z;
|
||||
this.A = tweet.A;
|
||||
this.B = tweet.B;
|
||||
this.C = tweet.C;
|
||||
this.D = tweet.D;
|
||||
this.E = tweet.E;
|
||||
this.F = tweet.F;
|
||||
this.G = tweet.G;
|
||||
this.H = tweet.H;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Tweet a() {
|
||||
return new Tweet(this.a, this.b, this.c, this.d, this.e, this.f, this.g, this.h, this.i, this.j, this.k, this.l, this.m, this.n, this.o, this.p, this.q, this.r, this.s, this.t, this.u, this.v, this.w, this.x, this.y, this.z, this.A, this.B, this.C, this.D, this.E, this.F, this.G, this.H);
|
||||
}
|
||||
}
|
@@ -0,0 +1,5 @@
|
||||
package com.twitter.sdk.android.core.models;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class TweetEntities {
|
||||
}
|
33
sources/com/twitter/sdk/android/core/models/UrlEntity.java
Normal file
33
sources/com/twitter/sdk/android/core/models/UrlEntity.java
Normal file
@@ -0,0 +1,33 @@
|
||||
package com.twitter.sdk.android.core.models;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class UrlEntity extends Entity {
|
||||
|
||||
@SerializedName("display_url")
|
||||
public final String displayUrl;
|
||||
|
||||
@SerializedName("expanded_url")
|
||||
public final String expandedUrl;
|
||||
|
||||
@SerializedName("url")
|
||||
public final String url;
|
||||
|
||||
public UrlEntity(String str, String str2, String str3, int i, int i2) {
|
||||
super(i, i2);
|
||||
this.url = str;
|
||||
this.expandedUrl = str2;
|
||||
this.displayUrl = str3;
|
||||
}
|
||||
|
||||
@Override // com.twitter.sdk.android.core.models.Entity
|
||||
public /* bridge */ /* synthetic */ int getEnd() {
|
||||
return super.getEnd();
|
||||
}
|
||||
|
||||
@Override // com.twitter.sdk.android.core.models.Entity
|
||||
public /* bridge */ /* synthetic */ int getStart() {
|
||||
return super.getStart();
|
||||
}
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user