- Added realracing3-community.apk (71.57 MB) - Removed 32-bit support (armeabi-v7a) - Only includes arm64-v8a libraries - Decompiled source code included - Added README-community.md with analysis
71 lines
3.4 KiB
Java
71 lines
3.4 KiB
Java
package com.facebook.gamingservices;
|
|
|
|
import android.os.Bundle;
|
|
import com.facebook.AccessToken;
|
|
import com.facebook.FacebookException;
|
|
import com.facebook.FacebookRequestError;
|
|
import com.facebook.FacebookSdk;
|
|
import com.facebook.GraphRequest;
|
|
import com.facebook.GraphResponse;
|
|
import com.facebook.HttpMethod;
|
|
import com.facebook.bolts.TaskCompletionSource;
|
|
import kotlin.jvm.internal.Intrinsics;
|
|
import org.json.JSONObject;
|
|
|
|
/* loaded from: classes2.dex */
|
|
public final class TournamentUpdater {
|
|
public final TaskCompletionSource<Boolean> update(Tournament tournament, Number score) {
|
|
Intrinsics.checkNotNullParameter(tournament, "tournament");
|
|
Intrinsics.checkNotNullParameter(score, "score");
|
|
return update(tournament.identifier, score);
|
|
}
|
|
|
|
public final TaskCompletionSource<Boolean> update(String identifier, Number score) {
|
|
Intrinsics.checkNotNullParameter(identifier, "identifier");
|
|
Intrinsics.checkNotNullParameter(score, "score");
|
|
AccessToken currentAccessToken = AccessToken.Companion.getCurrentAccessToken();
|
|
if (currentAccessToken == null || currentAccessToken.isExpired()) {
|
|
throw new FacebookException("Attempted to fetch tournament with an invalid access token");
|
|
}
|
|
if (currentAccessToken.getGraphDomain() == null || !Intrinsics.areEqual(FacebookSdk.GAMING, currentAccessToken.getGraphDomain())) {
|
|
throw new FacebookException("User is not using gaming login");
|
|
}
|
|
final TaskCompletionSource<Boolean> taskCompletionSource = new TaskCompletionSource<>();
|
|
String stringPlus = Intrinsics.stringPlus(identifier, "/update_score");
|
|
Bundle bundle = new Bundle();
|
|
bundle.putInt("score", score.intValue());
|
|
new GraphRequest(currentAccessToken, stringPlus, bundle, HttpMethod.POST, new GraphRequest.Callback() { // from class: com.facebook.gamingservices.TournamentUpdater$$ExternalSyntheticLambda0
|
|
@Override // com.facebook.GraphRequest.Callback
|
|
public final void onCompleted(GraphResponse graphResponse) {
|
|
TournamentUpdater.m555update$lambda0(TaskCompletionSource.this, graphResponse);
|
|
}
|
|
}, null, 32, null).executeAsync();
|
|
return taskCompletionSource;
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: private */
|
|
/* renamed from: update$lambda-0, reason: not valid java name */
|
|
public static final void m555update$lambda0(TaskCompletionSource task, GraphResponse response) {
|
|
Intrinsics.checkNotNullParameter(task, "$task");
|
|
Intrinsics.checkNotNullParameter(response, "response");
|
|
if (response.getError() != null) {
|
|
FacebookRequestError error = response.getError();
|
|
if ((error == null ? null : error.getException()) != null) {
|
|
FacebookRequestError error2 = response.getError();
|
|
task.setError(error2 != null ? error2.getException() : null);
|
|
return;
|
|
} else {
|
|
task.setError(new GraphAPIException("Graph API Error"));
|
|
return;
|
|
}
|
|
}
|
|
JSONObject jSONObject = response.getJSONObject();
|
|
String optString = jSONObject != null ? jSONObject.optString("success") : null;
|
|
if (optString == null || optString.length() == 0) {
|
|
task.setError(new GraphAPIException("Graph API Error"));
|
|
} else {
|
|
task.setResult(Boolean.valueOf(optString.equals("true")));
|
|
}
|
|
}
|
|
}
|