Add Discord community version (64-bit only)

- 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
This commit is contained in:
2026-02-18 15:48:36 -08:00
parent c19eb3d7ff
commit c080f0d97f
26930 changed files with 2529574 additions and 0 deletions

View File

@@ -0,0 +1,81 @@
package com.firemonkeys.cloudcellapi;
import android.accounts.Account;
import android.accounts.AccountManager;
import android.accounts.AccountManagerCallback;
import android.accounts.AccountManagerFuture;
import android.os.Bundle;
/* loaded from: classes2.dex */
public class AndroidAccountManager {
static final /* synthetic */ boolean $assertionsDisabled = false;
private static final String CLASSNAME = "AndroidAccountManager";
private static AndroidAccountManager s_instance;
private long m_loginCompleteCallback = 0;
private long m_userObject = 0;
private boolean m_addingAccount = false;
/* JADX INFO: Access modifiers changed from: private */
public static native void LoginCompleteCallback(boolean z, long j, long j2);
public static AndroidAccountManager getInstance() {
return s_instance;
}
public void Constructor(long j, long j2) {
s_instance = this;
this.m_loginCompleteCallback = j;
this.m_userObject = j2;
}
public void Destructor() {
s_instance = null;
this.m_loginCompleteCallback = 0L;
this.m_userObject = 0L;
}
public void onResume() {
if (this.m_addingAccount) {
this.m_addingAccount = false;
if (this.m_loginCompleteCallback == 0 || this.m_userObject == 0) {
return;
}
LoginCompleteCallback(AccountManager.get(CC_Component.GetActivity()).getAccountsByType("com.google").length > 0, this.m_loginCompleteCallback, this.m_userObject);
}
}
public boolean IsLoggedIn() {
Account[] accountsByType = AccountManager.get(CC_Component.GetActivity()).getAccountsByType("com.google");
return accountsByType != null && accountsByType.length > 0;
}
public void Login() {
final AccountManager accountManager = AccountManager.get(CC_Component.GetActivity());
boolean z = false;
try {
if (accountManager.getAccountsByType("com.google").length == 0) {
Logging.CC_ERROR(CLASSNAME, "No google account found");
this.m_addingAccount = true;
accountManager.addAccount("com.google", "android", null, new Bundle(), CC_Component.GetActivity(), new AccountManagerCallback<Bundle>() { // from class: com.firemonkeys.cloudcellapi.AndroidAccountManager.1
@Override // android.accounts.AccountManagerCallback
public void run(AccountManagerFuture<Bundle> accountManagerFuture) {
if (AndroidAccountManager.this.m_addingAccount) {
AndroidAccountManager.this.m_addingAccount = false;
AndroidAccountManager.LoginCompleteCallback(accountManager.getAccountsByType("com.google").length > 0, AndroidAccountManager.this.m_loginCompleteCallback, AndroidAccountManager.this.m_userObject);
}
}
}, null);
} else {
z = true;
}
} catch (Exception e) {
this.m_addingAccount = false;
Logging.CC_ERROR(CLASSNAME, "Exception occured: " + e.toString());
e.printStackTrace();
}
if (this.m_addingAccount) {
return;
}
LoginCompleteCallback(z, this.m_loginCompleteCallback, this.m_userObject);
}
}

View File

@@ -0,0 +1,35 @@
package com.firemonkeys.cloudcellapi;
import android.app.Service;
import android.content.Intent;
import android.os.IBinder;
/* loaded from: classes2.dex */
public class AndroidAssetManagerService extends Service {
private static final String CLASSNAME = "AndroidAssetManagerService";
public native void ProcessDownloadsJNI();
@Override // android.app.Service
public IBinder onBind(Intent intent) {
return null;
}
@Override // android.app.Service
public void onCreate() {
super.onCreate();
}
@Override // android.app.Service
public int onStartCommand(Intent intent, int i, int i2) {
Logging.CC_INFO(CLASSNAME, "onStartCommand()");
new Thread(new Runnable() { // from class: com.firemonkeys.cloudcellapi.AndroidAssetManagerService.1
@Override // java.lang.Runnable
public void run() {
AndroidAssetManagerService.this.ProcessDownloadsJNI();
CC_Component.stopDownloadService();
}
}).start();
return 2;
}
}

View File

@@ -0,0 +1,92 @@
package com.firemonkeys.cloudcellapi;
import android.app.AlertDialog;
import android.content.ActivityNotFoundException;
import android.content.DialogInterface;
import android.content.Intent;
import android.net.Uri;
import com.firemonkeys.cloudcellapi.util.GetInfo;
/* loaded from: classes2.dex */
public class AppPromptManager {
private static final String CLASSNAME = "AppPromptManager";
AlertDialog m_pDialog = null;
/* JADX INFO: Access modifiers changed from: private */
public native void OnDontRate();
/* JADX INFO: Access modifiers changed from: private */
public native void OnRateApp();
/* JADX INFO: Access modifiers changed from: private */
public native void OnRemindLater();
public AppPromptManager() {
Logging.CC_TRACE(CLASSNAME, "AppPromptManager created");
}
public void DisplayRateAppDialog(final String str, final String str2, final String str3, final String str4, final String str5) {
Logging.CC_TRACE(CLASSNAME, "DisplayRateAppDialog()");
DismissRateAppDialog();
Logging.CC_TRACE(CLASSNAME, "UIThreadQueue - Begin");
CC_Component.GetActivity().runOnUiThread(new Runnable() { // from class: com.firemonkeys.cloudcellapi.AppPromptManager.1
@Override // java.lang.Runnable
public void run() {
Logging.CC_TRACE(AppPromptManager.CLASSNAME, "DisplayRateAppDialog::Thread - Begin");
DialogInterface.OnClickListener onClickListener = new DialogInterface.OnClickListener() { // from class: com.firemonkeys.cloudcellapi.AppPromptManager.1.1
@Override // android.content.DialogInterface.OnClickListener
public void onClick(DialogInterface dialogInterface, int i) {
if (i == -2) {
Logging.CC_TRACE(AppPromptManager.CLASSNAME, "Dont rate app");
AppPromptManager.this.OnDontRate();
} else if (i == -1) {
Logging.CC_TRACE(AppPromptManager.CLASSNAME, "Rating App");
AppPromptManager.this.OpenStorePage();
AppPromptManager.this.OnRateApp();
} else {
Logging.CC_TRACE(AppPromptManager.CLASSNAME, "Remind Later");
AppPromptManager.this.OnRemindLater();
}
}
};
Logging.CC_TRACE(AppPromptManager.CLASSNAME, "DisplayRateAppDialog create dialog");
AppPromptManager.this.m_pDialog = new AlertDialog.Builder(CC_Component.GetActivity()).setTitle(str).setMessage(str2).setPositiveButton(str3, onClickListener).setNeutralButton(str4, onClickListener).setNegativeButton(str5, onClickListener).create();
Logging.CC_TRACE(AppPromptManager.CLASSNAME, "DisplayRateAppDialog show dialog");
AppPromptManager.this.m_pDialog.show();
Logging.CC_TRACE(AppPromptManager.CLASSNAME, "DisplayRateAppDialog::Thread - End");
}
});
Logging.CC_TRACE(CLASSNAME, "UIThreadQueue - End");
}
public void OpenStorePage() {
Logging.CC_TRACE(CLASSNAME, "OpenStorePage()");
String packageName = CC_Component.GetActivity().getApplicationContext().getPackageName();
Intent intent = new Intent("android.intent.action.VIEW");
if (GetInfo.GetIsAmazonDevice()) {
intent.setData(Uri.parse("amzn://apps/android?p=" + packageName));
} else {
intent.setData(Uri.parse("market://details?id=" + packageName));
intent.setPackage("com.android.vending");
}
try {
CC_Component.GetActivity().startActivity(intent);
} catch (ActivityNotFoundException unused) {
Logging.CC_TRACE(CLASSNAME, "Failed to open the store page as the target activity was not found.");
}
}
public void DismissRateAppDialog() {
Logging.CC_TRACE(CLASSNAME, "DismissRateAppDialog()");
CC_Component.GetActivity().runOnUiThread(new Runnable() { // from class: com.firemonkeys.cloudcellapi.AppPromptManager.2
@Override // java.lang.Runnable
public void run() {
Logging.CC_TRACE(AppPromptManager.CLASSNAME, "Destroying Dialog");
AlertDialog alertDialog = AppPromptManager.this.m_pDialog;
if (alertDialog != null) {
alertDialog.dismiss();
}
}
});
}
}

View File

@@ -0,0 +1,118 @@
package com.firemonkeys.cloudcellapi;
import android.app.Activity;
import android.content.Intent;
import android.opengl.GLSurfaceView;
import android.os.Bundle;
import android.view.SurfaceView;
import android.view.ViewGroup;
import com.facebook.FacebookSdk;
/* loaded from: classes2.dex */
public class CC_Activity extends Activity {
private static Activity s_instance;
public static Activity GetActivity() {
return s_instance;
}
public static void canCallSuspendResume() {
CC_Component.canCallSuspendResume();
}
@Override // android.app.Activity
public void onActivityResult(int i, int i2, Intent intent) {
super.onActivityResult(i, i2, intent);
CC_Component.GetInstance().onActivityResult(i, i2, intent);
}
public void setInstances(SurfaceView surfaceView, ViewGroup viewGroup) {
s_instance = this;
CC_Component.GetInstance().setInstances(s_instance, surfaceView, viewGroup);
}
public void clearInstances() {
s_instance = null;
CC_Component.GetInstance().clearInstances();
}
public static SurfaceView GetSurfaceView() {
return CC_Component.GetSurfaceView();
}
public static GLSurfaceView GetGLSurfaceView() {
return CC_Component.GetGLSurfaceView();
}
public static ViewGroup GetViewGroup() {
return CC_Component.GetViewGroup();
}
public static Object getStaticSystemService(String str) {
return CC_Component.getStaticSystemService(str);
}
public static void staticStartActivity(Intent intent) {
CC_Component.staticStartActivity(intent);
}
public static void startDownloadService() {
CC_Component.startDownloadService();
}
public static void setServiceStarted(boolean z) {
CC_Component.setServiceStarted(z);
}
public static void stopDownloadService() {
CC_Component.stopDownloadService();
}
public static int getNetworkConnectivity() {
return CC_Component.getNetworkConnectivity();
}
public static void runOnGLThreadonCloudell(Runnable runnable) {
CC_Component.runOnGLThreadonCloudell(runnable);
}
@Override // android.app.Activity
public void onCreate(Bundle bundle) {
super.onCreate(bundle);
s_instance = this;
if (!FacebookSdk.isInitialized()) {
FacebookSdk.sdkInitialize(getApplicationContext());
}
CC_Component.GetInstance().onCreate(this, bundle);
}
@Override // android.app.Activity
public void onStart() {
super.onStart();
CC_Component.GetInstance().onStart();
}
@Override // android.app.Activity
public void onStop() {
super.onStop();
CC_Component.GetInstance().onStop();
}
@Override // android.app.Activity
public void onPause() {
super.onPause();
CC_Component.GetInstance().onPause();
}
@Override // android.app.Activity
public void onResume() {
super.onResume();
CC_Component.GetInstance().onResume();
}
@Override // android.app.Activity
public void onDestroy() {
super.onDestroy();
CC_Component.GetInstance().onDestroy();
}
}

View File

@@ -0,0 +1,370 @@
package com.firemonkeys.cloudcellapi;
import android.content.SharedPreferences;
import android.os.AsyncTask;
import com.amazon.device.iap.PurchasingListener;
import com.amazon.device.iap.PurchasingService;
import com.amazon.device.iap.model.FulfillmentResult;
import com.amazon.device.iap.model.Product;
import com.amazon.device.iap.model.ProductDataResponse;
import com.amazon.device.iap.model.ProductType;
import com.amazon.device.iap.model.PurchaseResponse;
import com.amazon.device.iap.model.PurchaseUpdatesResponse;
import com.amazon.device.iap.model.Receipt;
import com.amazon.device.iap.model.UserData;
import com.amazon.device.iap.model.UserDataResponse;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Map;
/* loaded from: classes2.dex */
public class CC_AmazonStoreObserver_Class implements PurchasingListener {
private static final String CLASSNAME = "CC_AmazonStoreObserver_Class";
private static long m_nConstructCallback = 0;
private static long m_nProductDetailsCallback = 0;
private static long m_nPurchaseErrorCallback = 0;
private static long m_nPurchaseSucceedCallback = 0;
private static long m_nRestoreCallback = 0;
private static long m_nUserPointer = 0;
private static final String s_sAppTesterAccount1 = "l3HL7XppEMhrOGDnur9-ulvqomrSg6qyODKmah76lJU=";
private String currentUser;
private int m_nNumOutstandingProductRequests = 0;
Map<String, Product> mRetrievedProducts = null;
ArrayList<Receipt> mRestoreReceipts = new ArrayList<>();
String sActivePurchaseProductId = null;
/* JADX INFO: Access modifiers changed from: private */
public static native void ConstructCallback(boolean z, boolean z2, long j, long j2);
/* JADX INFO: Access modifiers changed from: private */
public static native void ProductDetailsCallback(boolean z, Product[] productArr, long j, long j2);
private static native void PurchaseErrorCallback(String str, long j, long j2, long j3);
private static native void PurchaseSucceedCallback(String str, Receipt receipt, long j, long j2);
private static native void RefreshCallback(boolean z, long j);
/* JADX INFO: Access modifiers changed from: private */
public static native void RestoreCallback(boolean z, String str, Receipt[] receiptArr, long j, long j2);
public String getCurrentUser() {
return this.currentUser;
}
public void setCurrentUser(String str) {
this.currentUser = str;
}
public CC_AmazonStoreObserver_Class(long j, long j2, long j3, long j4, long j5, long j6) {
m_nConstructCallback = j;
m_nProductDetailsCallback = j2;
m_nPurchaseSucceedCallback = j3;
m_nPurchaseErrorCallback = j4;
m_nRestoreCallback = j5;
m_nUserPointer = j6;
}
@Override // com.amazon.device.iap.PurchasingListener
public void onUserDataResponse(UserDataResponse userDataResponse) {
Logging.CC_TRACE(CLASSNAME, "onUserDataResponse recieved: Response " + userDataResponse);
Logging.CC_TRACE(CLASSNAME, "RequestId:" + userDataResponse.getRequestId());
Logging.CC_TRACE(CLASSNAME, "IdRequestStatus:" + userDataResponse.getRequestStatus());
new GetUserIdAsyncTask().execute(userDataResponse);
}
public class GetUserIdAsyncTask extends AsyncTask<UserDataResponse, Void, Boolean> {
private GetUserIdAsyncTask() {
}
@Override // android.os.AsyncTask
public Boolean doInBackground(UserDataResponse... userDataResponseArr) {
UserDataResponse userDataResponse = userDataResponseArr[0];
if (userDataResponse.getRequestStatus() == UserDataResponse.RequestStatus.SUCCESSFUL) {
Logging.CC_TRACE(CC_AmazonStoreObserver_Class.CLASSNAME, "doInBackground SUCCESSFUL");
CC_AmazonStoreObserver_Class.this.setCurrentUser(userDataResponse.getUserData().getUserId());
return Boolean.TRUE;
}
Logging.CC_TRACE(CC_AmazonStoreObserver_Class.CLASSNAME, "doInBackground: Unable to get user ID.");
return Boolean.FALSE;
}
@Override // android.os.AsyncTask
public void onPostExecute(Boolean bool) {
super.onPostExecute((GetUserIdAsyncTask) bool);
CC_AmazonStoreObserver_Class.ConstructCallback(bool.booleanValue(), bool.booleanValue(), CC_AmazonStoreObserver_Class.m_nConstructCallback, CC_AmazonStoreObserver_Class.m_nUserPointer);
}
}
public void getProductDetails(String[] strArr) {
Logging.CC_TRACE(CLASSNAME, "getProductDetails Begin");
if (this.mRetrievedProducts != null) {
Logging.CC_ERROR(CLASSNAME, "getProductDetails called when a previous request has not completed");
return;
}
int length = strArr.length;
if (length <= 0) {
Logging.CC_WARNING(CLASSNAME, "getProductDetails called with no product Ids");
return;
}
this.mRetrievedProducts = new HashMap();
int i = 0;
this.m_nNumOutstandingProductRequests = 0;
ArrayList arrayList = new ArrayList();
while (i < length) {
HashSet hashSet = new HashSet();
while (hashSet.size() < 100 && i < length) {
hashSet.add(strArr[i]);
i++;
}
Logging.CC_TRACE(CLASSNAME, "adding request for " + hashSet.size() + " products up to item " + i);
arrayList.add(hashSet);
}
this.m_nNumOutstandingProductRequests = arrayList.size();
Iterator it = arrayList.iterator();
while (it.hasNext()) {
PurchasingService.getProductData((HashSet) it.next());
}
}
@Override // com.amazon.device.iap.PurchasingListener
public void onProductDataResponse(ProductDataResponse productDataResponse) {
Logging.CC_TRACE(CLASSNAME, "onProductDataResponse recieved");
Logging.CC_TRACE(CLASSNAME, "ProductDataRequestStatus" + productDataResponse.getRequestStatus());
Logging.CC_TRACE(CLASSNAME, "ProductDataRequestId" + productDataResponse.getRequestId());
new ProductDataAsyncTask().execute(productDataResponse);
}
public class ProductDataAsyncTask extends AsyncTask<ProductDataResponse, Void, Void> {
private ProductDataAsyncTask() {
}
@Override // android.os.AsyncTask
public Void doInBackground(ProductDataResponse... productDataResponseArr) {
ProductDataResponse productDataResponse = productDataResponseArr[0];
CC_AmazonStoreObserver_Class cC_AmazonStoreObserver_Class = CC_AmazonStoreObserver_Class.this;
if (cC_AmazonStoreObserver_Class.mRetrievedProducts != null) {
cC_AmazonStoreObserver_Class.m_nNumOutstandingProductRequests--;
int i = AnonymousClass1.$SwitchMap$com$amazon$device$iap$model$ProductDataResponse$RequestStatus[productDataResponse.getRequestStatus().ordinal()];
if (i == 1 || i == 2) {
Map<String, Product> productData = productDataResponse.getProductData();
for (String str : productData.keySet()) {
Product product = productData.get(str);
Logging.CC_INFO(CC_AmazonStoreObserver_Class.CLASSNAME, String.format("Product: %s\n Type: %s\n SKU: %s\n Price: %s\n Description: %s\n", product.getTitle(), product.getProductType(), product.getSku(), product.getPrice(), product.getDescription()));
CC_AmazonStoreObserver_Class.this.mRetrievedProducts.put(str, product);
}
if (CC_AmazonStoreObserver_Class.this.m_nNumOutstandingProductRequests <= 0) {
Logging.CC_TRACE(CC_AmazonStoreObserver_Class.CLASSNAME, "retrieved products complete with " + CC_AmazonStoreObserver_Class.this.mRetrievedProducts.size() + " products");
Product[] productArr = (Product[]) CC_AmazonStoreObserver_Class.this.mRetrievedProducts.values().toArray(new Product[CC_AmazonStoreObserver_Class.this.mRetrievedProducts.size()]);
CC_AmazonStoreObserver_Class cC_AmazonStoreObserver_Class2 = CC_AmazonStoreObserver_Class.this;
cC_AmazonStoreObserver_Class2.mRetrievedProducts = null;
cC_AmazonStoreObserver_Class2.m_nNumOutstandingProductRequests = 0;
CC_AmazonStoreObserver_Class.ProductDetailsCallback(true, productArr, CC_AmazonStoreObserver_Class.m_nProductDetailsCallback, CC_AmazonStoreObserver_Class.m_nUserPointer);
}
} else if (i == 3) {
CC_AmazonStoreObserver_Class cC_AmazonStoreObserver_Class3 = CC_AmazonStoreObserver_Class.this;
cC_AmazonStoreObserver_Class3.mRetrievedProducts = null;
cC_AmazonStoreObserver_Class3.m_nNumOutstandingProductRequests = 0;
CC_AmazonStoreObserver_Class.ProductDetailsCallback(false, null, CC_AmazonStoreObserver_Class.m_nProductDetailsCallback, CC_AmazonStoreObserver_Class.m_nUserPointer);
}
}
return null;
}
}
public void Purchase(String str) {
Logging.CC_INFO(CLASSNAME, "Purchasing " + str);
this.sActivePurchaseProductId = str;
PurchasingService.purchase(str);
}
@Override // com.amazon.device.iap.PurchasingListener
public void onPurchaseResponse(PurchaseResponse purchaseResponse) {
Logging.CC_TRACE(CLASSNAME, "onPurchaseResponse recieved");
Logging.CC_TRACE(CLASSNAME, "PurchaseRequestStatus: " + purchaseResponse.getRequestStatus());
Receipt receipt = purchaseResponse.getReceipt();
printReceipt(receipt);
int i = AnonymousClass1.$SwitchMap$com$amazon$device$iap$model$PurchaseResponse$RequestStatus[purchaseResponse.getRequestStatus().ordinal()];
if (i == 1) {
PurchaseSucceedCallback(purchaseResponse.getUserData().getUserId(), receipt, m_nPurchaseSucceedCallback, m_nUserPointer);
} else if (i == 2 || i == 3 || i == 4 || i == 5) {
PurchaseErrorCallback(this.sActivePurchaseProductId, purchaseResponse.getRequestStatus().ordinal(), m_nPurchaseErrorCallback, m_nUserPointer);
}
this.sActivePurchaseProductId = null;
}
public void CompleteTransaction(String str, Boolean bool) {
Logging.CC_TRACE(CLASSNAME, "CompleteTransaction");
Logging.CC_TRACE(CLASSNAME, "fulfilled: " + bool);
if (bool.booleanValue()) {
PurchasingService.notifyFulfillment(str, FulfillmentResult.FULFILLED);
} else {
PurchasingService.notifyFulfillment(str, FulfillmentResult.UNAVAILABLE);
}
}
public void RefreshStorePurchases() {
Logging.CC_TRACE(CLASSNAME, "RefreshStorePurchases");
PurchasingService.getPurchaseUpdates(false);
}
public void RestorePurchase() {
Logging.CC_TRACE(CLASSNAME, "RestorePurchase");
this.mRestoreReceipts.clear();
PurchasingService.getPurchaseUpdates(true);
}
@Override // com.amazon.device.iap.PurchasingListener
public void onPurchaseUpdatesResponse(PurchaseUpdatesResponse purchaseUpdatesResponse) {
Logging.CC_TRACE(CLASSNAME, "onPurchaseUpdatesRecived received: Response -" + purchaseUpdatesResponse);
Logging.CC_TRACE(CLASSNAME, "RequestStatus:" + purchaseUpdatesResponse.getRequestStatus());
Logging.CC_TRACE(CLASSNAME, "RequestID:" + purchaseUpdatesResponse.getRequestId());
new PurchaseUpdatesAsyncTask().execute(purchaseUpdatesResponse);
}
public class PurchaseUpdatesAsyncTask extends AsyncTask<PurchaseUpdatesResponse, Void, Boolean> {
private PurchaseUpdatesAsyncTask() {
}
@Override // android.os.AsyncTask
public Boolean doInBackground(PurchaseUpdatesResponse... purchaseUpdatesResponseArr) {
int i = 0;
PurchaseUpdatesResponse purchaseUpdatesResponse = purchaseUpdatesResponseArr[0];
String currentUser = CC_AmazonStoreObserver_Class.this.getCurrentUser();
UserData userData = purchaseUpdatesResponse.getUserData();
String userId = userData != null ? userData.getUserId() : null;
if (userId == null || (!userId.equals(currentUser) && (currentUser == null || (!currentUser.equals(CC_AmazonStoreObserver_Class.s_sAppTesterAccount1) && !userId.equals(""))))) {
if (userId == null) {
userId = "";
}
Logging.CC_WARNING(CC_AmazonStoreObserver_Class.CLASSNAME, "Reject PurchaseUpdatesAsyncTask for user " + userId + " Excepted user " + currentUser);
CC_AmazonStoreObserver_Class.RestoreCallback(false, userId, null, CC_AmazonStoreObserver_Class.m_nRestoreCallback, CC_AmazonStoreObserver_Class.m_nUserPointer);
return Boolean.FALSE;
}
int i2 = AnonymousClass1.$SwitchMap$com$amazon$device$iap$model$PurchaseUpdatesResponse$RequestStatus[purchaseUpdatesResponse.getRequestStatus().ordinal()];
if (i2 != 1) {
if (i2 != 2) {
return Boolean.FALSE;
}
CC_AmazonStoreObserver_Class.RestoreCallback(false, purchaseUpdatesResponse.getUserData().getUserId(), null, CC_AmazonStoreObserver_Class.m_nRestoreCallback, CC_AmazonStoreObserver_Class.m_nUserPointer);
return Boolean.FALSE;
}
for (Receipt receipt : purchaseUpdatesResponse.getReceipts()) {
if (AnonymousClass1.$SwitchMap$com$amazon$device$iap$model$ProductType[receipt.getProductType().ordinal()] == 1) {
Logging.CC_TRACE(CC_AmazonStoreObserver_Class.CLASSNAME, "PurchaseUpdatesAsyncTask: consumable product for Restore");
}
CC_AmazonStoreObserver_Class.this.mRestoreReceipts.add(receipt);
CC_AmazonStoreObserver_Class.this.printReceipt(receipt);
}
if (purchaseUpdatesResponse.hasMore()) {
Logging.CC_TRACE(CC_AmazonStoreObserver_Class.CLASSNAME, "Initiating Another Purchase Updates");
PurchasingService.getPurchaseUpdates(false);
} else {
Receipt[] receiptArr = new Receipt[CC_AmazonStoreObserver_Class.this.mRestoreReceipts.size()];
Iterator<Receipt> it = CC_AmazonStoreObserver_Class.this.mRestoreReceipts.iterator();
while (it.hasNext()) {
receiptArr[i] = it.next();
i++;
}
CC_AmazonStoreObserver_Class.this.mRestoreReceipts.clear();
CC_AmazonStoreObserver_Class.RestoreCallback(true, purchaseUpdatesResponse.getUserData().getUserId(), receiptArr, CC_AmazonStoreObserver_Class.m_nRestoreCallback, CC_AmazonStoreObserver_Class.m_nUserPointer);
}
return Boolean.TRUE;
}
@Override // android.os.AsyncTask
public void onPostExecute(Boolean bool) {
super.onPostExecute((PurchaseUpdatesAsyncTask) bool);
}
}
/* renamed from: com.firemonkeys.cloudcellapi.CC_AmazonStoreObserver_Class$1, reason: invalid class name */
public static /* synthetic */ class AnonymousClass1 {
static final /* synthetic */ int[] $SwitchMap$com$amazon$device$iap$model$ProductDataResponse$RequestStatus;
static final /* synthetic */ int[] $SwitchMap$com$amazon$device$iap$model$ProductType;
static final /* synthetic */ int[] $SwitchMap$com$amazon$device$iap$model$PurchaseResponse$RequestStatus;
static final /* synthetic */ int[] $SwitchMap$com$amazon$device$iap$model$PurchaseUpdatesResponse$RequestStatus;
static {
int[] iArr = new int[PurchaseUpdatesResponse.RequestStatus.values().length];
$SwitchMap$com$amazon$device$iap$model$PurchaseUpdatesResponse$RequestStatus = iArr;
try {
iArr[PurchaseUpdatesResponse.RequestStatus.SUCCESSFUL.ordinal()] = 1;
} catch (NoSuchFieldError unused) {
}
try {
$SwitchMap$com$amazon$device$iap$model$PurchaseUpdatesResponse$RequestStatus[PurchaseUpdatesResponse.RequestStatus.FAILED.ordinal()] = 2;
} catch (NoSuchFieldError unused2) {
}
int[] iArr2 = new int[ProductType.values().length];
$SwitchMap$com$amazon$device$iap$model$ProductType = iArr2;
try {
iArr2[ProductType.CONSUMABLE.ordinal()] = 1;
} catch (NoSuchFieldError unused3) {
}
try {
$SwitchMap$com$amazon$device$iap$model$ProductType[ProductType.ENTITLED.ordinal()] = 2;
} catch (NoSuchFieldError unused4) {
}
try {
$SwitchMap$com$amazon$device$iap$model$ProductType[ProductType.SUBSCRIPTION.ordinal()] = 3;
} catch (NoSuchFieldError unused5) {
}
int[] iArr3 = new int[PurchaseResponse.RequestStatus.values().length];
$SwitchMap$com$amazon$device$iap$model$PurchaseResponse$RequestStatus = iArr3;
try {
iArr3[PurchaseResponse.RequestStatus.SUCCESSFUL.ordinal()] = 1;
} catch (NoSuchFieldError unused6) {
}
try {
$SwitchMap$com$amazon$device$iap$model$PurchaseResponse$RequestStatus[PurchaseResponse.RequestStatus.ALREADY_PURCHASED.ordinal()] = 2;
} catch (NoSuchFieldError unused7) {
}
try {
$SwitchMap$com$amazon$device$iap$model$PurchaseResponse$RequestStatus[PurchaseResponse.RequestStatus.FAILED.ordinal()] = 3;
} catch (NoSuchFieldError unused8) {
}
try {
$SwitchMap$com$amazon$device$iap$model$PurchaseResponse$RequestStatus[PurchaseResponse.RequestStatus.INVALID_SKU.ordinal()] = 4;
} catch (NoSuchFieldError unused9) {
}
try {
$SwitchMap$com$amazon$device$iap$model$PurchaseResponse$RequestStatus[PurchaseResponse.RequestStatus.NOT_SUPPORTED.ordinal()] = 5;
} catch (NoSuchFieldError unused10) {
}
int[] iArr4 = new int[ProductDataResponse.RequestStatus.values().length];
$SwitchMap$com$amazon$device$iap$model$ProductDataResponse$RequestStatus = iArr4;
try {
iArr4[ProductDataResponse.RequestStatus.NOT_SUPPORTED.ordinal()] = 1;
} catch (NoSuchFieldError unused11) {
}
try {
$SwitchMap$com$amazon$device$iap$model$ProductDataResponse$RequestStatus[ProductDataResponse.RequestStatus.SUCCESSFUL.ordinal()] = 2;
} catch (NoSuchFieldError unused12) {
}
try {
$SwitchMap$com$amazon$device$iap$model$ProductDataResponse$RequestStatus[ProductDataResponse.RequestStatus.FAILED.ordinal()] = 3;
} catch (NoSuchFieldError unused13) {
}
}
}
private SharedPreferences getSharedPreferencesForCurrentUser() {
return CC_Component.GetActivity().getSharedPreferences(getCurrentUser(), 0);
}
private SharedPreferences.Editor getSharedPreferencesEditor() {
return getSharedPreferencesForCurrentUser().edit();
}
/* JADX INFO: Access modifiers changed from: private */
public void printReceipt(Receipt receipt) {
if (receipt == null) {
Logging.CC_INFO(CLASSNAME, "Receipt: null");
} else {
Logging.CC_INFO(CLASSNAME, String.format("Receipt: ProductType: %s Sku: %s SubscriptionPeriod: %s - %s", receipt.getProductType(), receipt.getSku(), receipt.getPurchaseDate(), receipt.getCancelDate()));
}
}
}

View File

@@ -0,0 +1,37 @@
package com.firemonkeys.cloudcellapi;
import com.amazon.device.iap.PurchasingService;
/* loaded from: classes2.dex */
public class CC_AmazonStoreWorker_Class {
private CC_AmazonStoreObserver_Class mObserver;
public void Destructor() {
}
public void Constructor(long j, long j2, long j3, long j4, long j5, long j6) {
this.mObserver = new CC_AmazonStoreObserver_Class(j, j2, j3, j4, j5, j6);
PurchasingService.registerListener(CC_Component.GetActivity().getApplicationContext(), this.mObserver);
PurchasingService.getUserData();
}
public void getProductDetails(String[] strArr) {
this.mObserver.getProductDetails(strArr);
}
public void Purchase(String str) {
this.mObserver.Purchase(str);
}
public void CompleteTransaction(String str, boolean z) {
this.mObserver.CompleteTransaction(str, Boolean.valueOf(z));
}
public void RefreshStorePurchases() {
this.mObserver.RefreshStorePurchases();
}
public void RestorePurchase() {
this.mObserver.RestorePurchase();
}
}

View File

@@ -0,0 +1,236 @@
package com.firemonkeys.cloudcellapi;
import android.app.Activity;
import android.content.ActivityNotFoundException;
import android.content.Intent;
import android.content.IntentFilter;
import android.net.Uri;
import android.opengl.GLSurfaceView;
import android.os.Bundle;
import android.view.SurfaceView;
import android.view.ViewGroup;
import androidx.core.app.ActivityCompat;
import androidx.core.content.ContextCompat;
import com.ea.ironmonkey.components.GameComponent;
import com.firemonkeys.cloudcellapi.util.GetInfo;
import java.util.ArrayList;
/* loaded from: classes2.dex */
public class CC_Component extends GameComponent {
static final /* synthetic */ boolean $assertionsDisabled = false;
private static final String CLASSNAME = "CC_Component";
private static Activity s_activity;
private static CC_Component s_instance;
private static SurfaceView s_surfaceView;
private static ViewGroup s_viewGroup;
private static Boolean s_canCallSuspendResume = Boolean.FALSE;
private static boolean s_bDownloadServiceStarted = false;
private static boolean s_UsingImmersiveMode = false;
private static NetworkStatusMonitor m_pMonitor = null;
private static native void CloudcellResume();
private static native void CloudcellSuspend();
public static Activity GetActivity() {
return s_activity;
}
public static SurfaceView GetSurfaceView() {
return s_surfaceView;
}
public static ViewGroup GetViewGroup() {
return s_viewGroup;
}
public static void canCallSuspendResume() {
s_canCallSuspendResume = Boolean.TRUE;
}
public static boolean getIsUsingImmersiveMode() {
return s_UsingImmersiveMode;
}
public static void setIsUsingImmersiveMode(boolean z) {
s_UsingImmersiveMode = z;
}
public static void setServiceStarted(boolean z) {
s_bDownloadServiceStarted = z;
}
public void clearInstances() {
s_instance = null;
s_activity = null;
s_viewGroup = null;
s_surfaceView = null;
}
public void createSurface(SurfaceView surfaceView, ViewGroup viewGroup) {
s_surfaceView = surfaceView;
s_viewGroup = viewGroup;
}
private CC_Component() {
}
public void onActivityResult(int i, int i2, Intent intent) {
if (FacebookWorker.handleActivityResult(i, i2, intent)) {
return;
}
GooglePlayWorker.handleActivityResult(i, i2, intent);
}
public void setInstances(Activity activity, SurfaceView surfaceView, ViewGroup viewGroup) {
setActivity(activity);
s_viewGroup = viewGroup;
s_surfaceView = surfaceView;
}
public static CC_Component GetInstance() {
if (s_instance == null) {
s_instance = new CC_Component();
}
return s_instance;
}
public static GLSurfaceView GetGLSurfaceView() {
try {
return (GLSurfaceView) s_surfaceView;
} catch (ClassCastException unused) {
return null;
}
}
public static Object getStaticSystemService(String str) {
Activity GetActivity = GetActivity();
if (GetActivity() != null) {
return GetActivity.getSystemService(str);
}
return null;
}
public static void staticStartActivity(Intent intent) {
Activity GetActivity = GetActivity();
if (GetActivity != null) {
Logging.CC_TRACE(CLASSNAME, "staticStartActivity()");
try {
GetActivity.startActivity(intent);
} catch (ActivityNotFoundException unused) {
Logging.CC_TRACE(CLASSNAME, "start activity failed as there is no activity to handle it");
}
}
}
public static void startDownloadService() {
Activity GetActivity;
if (s_bDownloadServiceStarted || (GetActivity = GetActivity()) == null || s_bDownloadServiceStarted) {
return;
}
Logging.CC_TRACE(CLASSNAME, "startDownloadService");
GetActivity.startService(new Intent(GetActivity, (Class<?>) AndroidAssetManagerService.class));
s_bDownloadServiceStarted = true;
}
public static void stopDownloadService() {
Activity GetActivity = GetActivity();
if (GetActivity != null) {
Logging.CC_TRACE(CLASSNAME, "stopDownloadService()");
GetActivity.stopService(new Intent(GetActivity, (Class<?>) AndroidAssetManagerService.class));
s_bDownloadServiceStarted = false;
}
}
public static void openSettings() {
Activity GetActivity = GetActivity();
if (GetActivity != null) {
Logging.CC_TRACE(CLASSNAME, "openSettings()");
Intent intent = new Intent();
intent.setAction("android.settings.APPLICATION_DETAILS_SETTINGS");
intent.setData(Uri.fromParts("package", GetActivity.getPackageName(), null));
GetActivity.startActivity(intent);
}
}
public static int getNetworkConnectivity() {
return NetworkStatusMonitor.getNetworkConnectivity(GetActivity().getApplicationContext());
}
public static void runOnGLThreadonCloudell(Runnable runnable) {
GLSurfaceView GetGLSurfaceView;
if (runnable == null || (GetGLSurfaceView = GetGLSurfaceView()) == null) {
return;
}
GetGLSurfaceView.queueEvent(runnable);
}
public static boolean RequestMissingPermissions(int i) {
return RequestMissingPermissions(GetInfo.GetRequestedPermissions(), i);
}
public static boolean RequestMissingPermissions(String[] strArr, int i) {
try {
ArrayList arrayList = new ArrayList();
for (String str : strArr) {
if (ContextCompat.checkSelfPermission(GetActivity(), str) != 0 && GetInfo.IsSystemPermission(str) && GetInfo.IsValidPermission(str)) {
Logging.CC_INFO(CLASSNAME, "Missing permission: " + str);
arrayList.add(str);
}
}
if (arrayList.size() > 0) {
ActivityCompat.requestPermissions(GetActivity(), (String[]) arrayList.toArray(new String[arrayList.size()]), i);
return true;
}
} catch (Exception e) {
Logging.CC_ERROR(CLASSNAME, "RequestMissingPermissions() error: " + e.toString());
}
return false;
}
private void setActivity(Activity activity) {
s_activity = activity;
if (activity != null) {
GetInfo.Initialize(activity);
}
}
public void onCreate(Activity activity, Bundle bundle) {
setActivity(activity);
m_pMonitor = new NetworkStatusMonitor();
s_activity.registerReceiver(m_pMonitor, new IntentFilter("android.net.conn.CONNECTIVITY_CHANGE"), 2);
}
public void onStart() {
GooglePlayWorker.onStart();
}
public void onStop() {
GooglePlayWorker.onStop();
}
public void onPause() {
if (s_canCallSuspendResume.booleanValue()) {
CloudcellSuspend();
}
}
public void onResume() {
AndroidAccountManager androidAccountManager = AndroidAccountManager.getInstance();
if (androidAccountManager != null) {
androidAccountManager.onResume();
}
if (s_canCallSuspendResume.booleanValue()) {
CloudcellResume();
}
}
public void onDestroy() {
NetworkStatusMonitor networkStatusMonitor = m_pMonitor;
if (networkStatusMonitor != null) {
s_activity.unregisterReceiver(networkStatusMonitor);
m_pMonitor = null;
}
clearInstances();
}
}

View File

@@ -0,0 +1,77 @@
package com.firemonkeys.cloudcellapi;
import java.security.cert.X509Certificate;
import java.util.Date;
import javax.net.ssl.X509TrustManager;
/* loaded from: classes2.dex */
class CloudcellTrustManager implements X509TrustManager {
private static final String CLASSNAME = "CloudcellTrustManager";
private HttpRequest m_httpRequest;
@Override // javax.net.ssl.X509TrustManager
public void checkClientTrusted(X509Certificate[] x509CertificateArr, String str) {
}
@Override // javax.net.ssl.X509TrustManager
public X509Certificate[] getAcceptedIssuers() {
return null;
}
public CloudcellTrustManager(HttpRequest httpRequest) {
this.m_httpRequest = httpRequest;
}
public double getServerTime() {
HttpRequest httpRequest = this.m_httpRequest;
if (httpRequest != null) {
return httpRequest.getServerTime();
}
return 0.0d;
}
public void closeThread() {
HttpRequest httpRequest = this.m_httpRequest;
if (httpRequest != null) {
httpRequest.shutdown();
}
}
public boolean getSSLCheck() {
HttpRequest httpRequest = this.m_httpRequest;
if (httpRequest != null) {
return httpRequest.getSSLCheck();
}
return false;
}
public void setClosedBySSLCheck(boolean z) {
HttpRequest httpRequest = this.m_httpRequest;
if (httpRequest != null) {
httpRequest.setClosedBySSLCheck(z);
}
}
@Override // javax.net.ssl.X509TrustManager
public void checkServerTrusted(X509Certificate[] x509CertificateArr, String str) {
if (getSSLCheck()) {
try {
long longValue = Double.valueOf(getServerTime()).longValue();
Date date = new Date(longValue > 0 ? longValue * 1000 : System.currentTimeMillis());
if (x509CertificateArr != null) {
for (X509Certificate x509Certificate : x509CertificateArr) {
Date notAfter = x509Certificate.getNotAfter();
if (notAfter.before(date)) {
setClosedBySSLCheck(true);
closeThread();
Logging.CC_ERROR(CLASSNAME, "SSL Certificate expired! notAfter = " + notAfter.toString());
}
}
}
} catch (Exception e) {
Logging.CC_WARNING(CLASSNAME, "The certificate chain can't be validated, message:" + e.toString());
}
}
this.m_httpRequest = null;
}
}

View File

@@ -0,0 +1,165 @@
package com.firemonkeys.cloudcellapi;
import android.content.Intent;
import android.os.Bundle;
/* loaded from: classes2.dex */
public class Consts {
public static final String ACTION_CONFIRM_NOTIFICATION = "com.firemonkeys.cloudcellapi.CONFIRM_NOTIFICATION";
public static final String ACTION_GET_PURCHASE_INFORMATION = "com.firemonkeys.cloudcellapi.GET_PURCHASE_INFORMATION";
public static final String ACTION_NOTIFY = "com.android.vending.billing.IN_APP_NOTIFY";
public static final String ACTION_PURCHASE_STATE_CHANGED = "com.android.vending.billing.PURCHASE_STATE_CHANGED";
public static final String ACTION_RESPONSE_CODE = "com.android.vending.billing.RESPONSE_CODE";
public static final String ACTION_RESTORE_TRANSACTIONS = "com.firemonkeys.cloudcellapi.RESTORE_TRANSACTIONS";
public static final int ASSET_DOWNLOAD_PROGRESS_NOTIFICATION_ID = 2;
public static final int ASSET_DOWNLOAD_REMINDER_NOTIFICATION_ID = 1;
public static final String BILLING_CHECK_BILLING_SUPPORTED = "CHECK_BILLING_SUPPORTED";
public static final String BILLING_CONFIRM_NOTIFICATIONS = "CONFIRM_NOTIFICATIONS";
public static final String BILLING_GET_PURCHASE_INFORMATION = "GET_PURCHASE_INFORMATION";
public static final int BILLING_MAX_SKUS_PER_QUERY = 20;
public static final String BILLING_REQUEST_API_VERSION = "API_VERSION";
public static final String BILLING_REQUEST_DEVELOPER_PAYLOAD = "DEVELOPER_PAYLOAD";
public static final String BILLING_REQUEST_ITEM_ID = "ITEM_ID";
public static final String BILLING_REQUEST_ITEM_TYPE = "ITEM_TYPE";
public static final String BILLING_REQUEST_METHOD = "BILLING_REQUEST";
public static final String BILLING_REQUEST_NONCE = "NONCE";
public static final String BILLING_REQUEST_NOTIFY_IDS = "NOTIFY_IDS";
public static final String BILLING_REQUEST_PACKAGE_NAME = "PACKAGE_NAME";
public static final String BILLING_REQUEST_PURCHASE = "REQUEST_PURCHASE";
public static long BILLING_RESPONSE_INVALID_REQUEST_ID = -1;
public static final String BILLING_RESPONSE_PURCHASE_INTENT = "PURCHASE_INTENT";
public static final String BILLING_RESPONSE_REQUEST_ID = "REQUEST_ID";
public static final String BILLING_RESPONSE_RESPONSE_CODE = "RESPONSE_CODE";
public static final String BILLING_RESTORE_TRANSACTIONS = "RESTORE_TRANSACTIONS";
private static final String CLASSNAME = "Consts";
public static final String GET_SKU_DETAILS_ITEM_LIST = "ITEM_ID_LIST";
public static final String GET_SKU_DETAILS_ITEM_TYPE_LIST = "ITEM_TYPE_LIST";
public static final String INAPP_CONTINUATION_TOKEN = "INAPP_CONTINUATION_TOKEN";
public static final String INAPP_REQUEST_ID = "request_id";
public static final String INAPP_RESPONSE_CODE = "response_code";
public static final String INAPP_SIGNATURE = "inapp_signature";
public static final String INAPP_SIGNED_DATA = "inapp_signed_data";
public static final String ITEM_TYPE_INAPP = "inapp";
public static final String ITEM_TYPE_SUBSCRIPTION = "subs";
public static final String MARKET_BILLING_SERVICE_ACTION = "com.android.vending.billing.MarketBillingService.BIND";
public static final String NOTIFICATION_ID = "notification_id";
public static final int PERMISSIONS_REQUEST_YOUKU = 10002;
public static final int REPEAT_REMINDER_MAX = 2;
public static final String RESPONSE_BUY_INTENT = "BUY_INTENT";
public static final String RESPONSE_CODE = "RESPONSE_CODE";
public static final String RESPONSE_GET_SKU_DETAILS_LIST = "DETAILS_LIST";
public static final String RESPONSE_INAPP_ITEM_LIST = "INAPP_PURCHASE_ITEM_LIST";
public static final String RESPONSE_INAPP_PURCHASE_DATA = "INAPP_PURCHASE_DATA";
public static final String RESPONSE_INAPP_PURCHASE_DATA_LIST = "INAPP_PURCHASE_DATA_LIST";
public static final String RESPONSE_INAPP_SIGNATURE = "INAPP_DATA_SIGNATURE";
public static final String RESPONSE_INAPP_SIGNATURE_LIST = "INAPP_DATA_SIGNATURE_LIST";
public static final int TWO_DAY_DELAY_SEC = 172800;
public enum ResponseCode {
RESULT_OK(0),
RESULT_USER_CANCELED(1),
RESULT_SERVICE_UNAVAILABLE(2),
RESULT_BILLING_UNAVAILABLE(3),
RESULT_ITEM_UNAVAILABLE(4),
RESULT_DEVELOPER_ERROR(5),
RESULT_ERROR(6),
RESULT_ITEM_ALREADY_OWNED(7),
RESULT_ITEM_NOT_OWNED(8);
private int m_value;
public int getValue() {
return this.m_value;
}
ResponseCode(int i) {
this.m_value = i;
}
public static ResponseCode valueOf(int i) {
ResponseCode[] values = values();
return (i < 0 || i >= values.length) ? RESULT_ERROR : values[i];
}
}
public enum PurchaseState {
PURCHASED,
CANCELED,
REFUNDED;
public static PurchaseState valueOf(int i) {
PurchaseState[] values = values();
return (i < 0 || i >= values.length) ? CANCELED : values[i];
}
public static String toString(PurchaseState purchaseState) {
long j;
int i = AnonymousClass1.$SwitchMap$com$firemonkeys$cloudcellapi$Consts$PurchaseState[purchaseState.ordinal()];
if (i != 1) {
j = 1;
if (i != 2 && i == 3) {
j = 2;
}
} else {
j = 0;
}
return String.valueOf(j);
}
}
/* renamed from: com.firemonkeys.cloudcellapi.Consts$1, reason: invalid class name */
public static /* synthetic */ class AnonymousClass1 {
static final /* synthetic */ int[] $SwitchMap$com$firemonkeys$cloudcellapi$Consts$PurchaseState;
static {
int[] iArr = new int[PurchaseState.values().length];
$SwitchMap$com$firemonkeys$cloudcellapi$Consts$PurchaseState = iArr;
try {
iArr[PurchaseState.PURCHASED.ordinal()] = 1;
} catch (NoSuchFieldError unused) {
}
try {
$SwitchMap$com$firemonkeys$cloudcellapi$Consts$PurchaseState[PurchaseState.CANCELED.ordinal()] = 2;
} catch (NoSuchFieldError unused2) {
}
try {
$SwitchMap$com$firemonkeys$cloudcellapi$Consts$PurchaseState[PurchaseState.REFUNDED.ordinal()] = 3;
} catch (NoSuchFieldError unused3) {
}
}
}
public static ResponseCode getResponseCodeFromBundle(Bundle bundle) {
Object obj = bundle.get("RESPONSE_CODE");
if (obj == null) {
Logging.CC_TRACE(CLASSNAME, "Bundle with null response code, assuming OK (known issue)");
return ResponseCode.RESULT_OK;
}
if (obj instanceof Integer) {
return ResponseCode.valueOf(((Integer) obj).intValue());
}
if (obj instanceof Long) {
return ResponseCode.valueOf((int) ((Long) obj).longValue());
}
Logging.CC_ERROR(CLASSNAME, "Unexpected type for bundle response code.");
Logging.CC_ERROR(CLASSNAME, obj.getClass().getName());
throw new RuntimeException("Unexpected type for bundle response code: " + obj.getClass().getName());
}
public static ResponseCode getResponseCodeFromIntent(Intent intent) {
Object obj = intent.getExtras().get("RESPONSE_CODE");
if (obj == null) {
Logging.CC_ERROR(CLASSNAME, "Intent with no response code, assuming OK (known issue)");
return ResponseCode.RESULT_OK;
}
if (obj instanceof Integer) {
return ResponseCode.valueOf(((Integer) obj).intValue());
}
if (obj instanceof Long) {
return ResponseCode.valueOf((int) ((Long) obj).longValue());
}
Logging.CC_ERROR(CLASSNAME, "Unexpected type for intent response code.");
Logging.CC_ERROR(CLASSNAME, obj.getClass().getName());
throw new RuntimeException("Unexpected type for intent response code: " + obj.getClass().getName());
}
}

View File

@@ -0,0 +1,100 @@
package com.firemonkeys.cloudcellapi;
import android.annotation.TargetApi;
import android.app.IntentService;
import android.app.Notification;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
import android.content.pm.ApplicationInfo;
import com.google.android.gms.drive.DriveFile;
/* loaded from: classes2.dex */
public class DelayedNotificationService extends IntentService {
static final String ACTION_NOTIFICATION_DISMISSED = "ACTION_NOTIFICATION_DISMISSED";
private static final String CLASSNAME = ResourceHelper.GetDelayedNotificationServiceTag();
static final String GROUP_KEY = ResourceHelper.GetGroupKey();
private static final String NOTIFICATION_KEY = ".notification.";
public DelayedNotificationService() {
super("DelayedNotificationService");
Logging.CC_INFO(CLASSNAME, "Constructed");
}
public void NotificationDismissed() {
SerialiseNotificationsHelper.ClearAll(getApplicationContext());
}
@Override // android.app.IntentService
@TargetApi(21)
public void onHandleIntent(Intent intent) {
Notification CreateBigTextNotification;
String str = CLASSNAME;
Logging.CC_INFO(str, "DelayedNotificationService: onHandleIntent");
if (intent.getAction() != null && intent.getAction().equals(ACTION_NOTIFICATION_DISMISSED)) {
NotificationDismissed();
return;
}
Context applicationContext = getApplicationContext();
ApplicationInfo applicationInfo = applicationContext.getApplicationInfo();
int intExtra = intent.getIntExtra("id", -2);
String string = getApplicationContext().getResources().getString(applicationInfo.labelRes);
intent.getStringExtra("name");
getApplicationContext().getPackageName();
String stringExtra = intent.getStringExtra("message");
String stringExtra2 = intent.getStringExtra(LocalNotificationsCenter.EXTRA_LAUNCH_URL);
NotificationManager notificationManager = (NotificationManager) getSystemService("notification");
long currentTimeMillis = System.currentTimeMillis();
int identifier = getApplicationContext().getResources().getIdentifier(ResourceHelper.GetIconID(), "drawable", applicationContext.getPackageName());
Intent launchIntentForPackage = applicationContext.getPackageManager().getLaunchIntentForPackage(applicationContext.getPackageName());
if (stringExtra2 != null && !stringExtra2.isEmpty()) {
launchIntentForPackage.putExtra(LocalNotificationsCenter.EXTRA_LAUNCH_URL, stringExtra2);
}
Notification.Builder when = new Notification.Builder(getApplicationContext()).setContentTitle(string).setContentText(stringExtra).setSmallIcon(identifier).setContentIntent(PendingIntent.getActivity(this, 0, launchIntentForPackage, DriveFile.MODE_READ_ONLY)).setAutoCancel(true).setWhen(currentTimeMillis);
when.setChannelId(intent.getStringExtra(LocalNotificationsCenter.EXTRA_CHANNEL_ID));
Intent intent2 = new Intent(this, (Class<?>) DelayedNotificationService.class);
intent2.setAction(ACTION_NOTIFICATION_DISMISSED);
when.setDeleteIntent(PendingIntent.getService(this, 0, intent2, 134217728));
SerialisedNotificationInfo GetSavedInfo = SerialiseNotificationsHelper.GetSavedInfo(getApplicationContext());
int GetNotificationCount = GetSavedInfo.GetNotificationCount();
Logging.CC_INFO(str, "There are (" + GetNotificationCount + ") saved notifications");
if (GetNotificationCount > 0) {
CreateBigTextNotification = CreateStackedNotification(GetSavedInfo, when, stringExtra);
} else {
CreateBigTextNotification = CreateBigTextNotification(when, stringExtra);
}
SerialiseNotificationsHelper.AddNotification(getApplicationContext(), stringExtra);
Logging.CC_INFO(str, "DelayedNotificationService: showing notification id: " + intExtra + " msg: " + stringExtra);
try {
notificationManager.notify(0, CreateBigTextNotification);
} catch (Exception e) {
Logging.CC_ERROR(CLASSNAME, "DelayedNotificationService: Notification Exception: " + e.toString());
}
}
public Notification CreateStackedNotification(SerialisedNotificationInfo serialisedNotificationInfo, Notification.Builder builder, String str) {
String str2;
Notification.InboxStyle inboxStyle = new Notification.InboxStyle(builder);
inboxStyle.addLine(str);
int i = 0;
for (int GetNotificationCount = serialisedNotificationInfo.GetNotificationCount() - 1; GetNotificationCount >= 0; GetNotificationCount--) {
try {
str2 = "- " + serialisedNotificationInfo.GetNotificationString(GetNotificationCount);
} catch (Exception e) {
Logging.CC_ERROR(CLASSNAME, "Error getting notification string: " + e.toString());
str2 = "";
}
inboxStyle.addLine(str2);
i++;
if (i >= 4) {
break;
}
}
return inboxStyle.build();
}
public Notification CreateBigTextNotification(Notification.Builder builder, String str) {
return new Notification.BigTextStyle(builder).bigText(str).build();
}
}

View File

@@ -0,0 +1,731 @@
package com.firemonkeys.cloudcellapi;
import android.app.Activity;
import android.app.UiModeManager;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.net.Uri;
import android.os.Bundle;
import com.facebook.AccessToken;
import com.facebook.CallbackManager;
import com.facebook.FacebookCallback;
import com.facebook.FacebookException;
import com.facebook.FacebookSdk;
import com.facebook.GraphRequest;
import com.facebook.GraphResponse;
import com.facebook.HttpMethod;
import com.facebook.Profile;
import com.facebook.ProfileTracker;
import com.facebook.internal.CallbackManagerImpl;
import com.facebook.login.DefaultAudience;
import com.facebook.login.LoginBehavior;
import com.facebook.login.LoginManager;
import com.facebook.login.LoginResult;
import com.facebook.share.Sharer;
import com.facebook.share.internal.ShareConstants;
import com.facebook.share.model.GameRequestContent;
import com.facebook.share.model.ShareContent;
import com.facebook.share.model.ShareLinkContent;
import com.facebook.share.widget.GameRequestDialog;
import com.facebook.share.widget.ShareDialog;
import com.firemonkeys.cloudcellapi.util.GetInfo;
import java.nio.ByteBuffer;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import org.json.JSONArray;
import org.json.JSONObject;
/* loaded from: classes2.dex */
public class FacebookWorker {
private static String CLASSNAME = "FacebookWorker";
private static final String MANAGE_PERMISSION_PREFIX = "manage";
private static final String PUBLISH_PERMISSION_PREFIX = "publish";
private static CallbackManager s_CallbackManager = CallbackManager.Factory.create();
private static Set<String> OTHER_PUBLISH_PERMISSIONS = getOtherPublishPermissions();
private static FacebookWorker s_pSingleton = null;
private static int m_PermissionsRequested = 0;
static long m_sCallback = 0;
static long m_sUserPtr = 0;
private ProfileTracker m_ProfileTracker = null;
private ShareDialog m_ShareDialog = null;
private GameRequestDialog m_InviteDialog = null;
private native void FeedPostCallback(boolean z, long j, long j2);
private native void FriendInviteCallback(boolean z, long j, long j2);
private native void LoadAvatarUrlCallback(boolean z, String str, long j);
private native void LoadFriendVectorCallback(boolean z, String[] strArr, String[] strArr2, long j, long j2);
private native void LoginCallback(String str, String str2, String str3, String str4, String str5, long j, long j2);
private native void LogoutCallback(long j, long j2);
private native void PermissionCheckCallback(boolean z, long j, long j2);
private native void PermissionGrantCallback(boolean z, long j, long j2);
private native void PhotoPostCallback(boolean z, long j, long j2);
public FacebookWorker() {
s_pSingleton = this;
}
public void Constructor(String str) {
Logging.CC_TRACE(CLASSNAME, "Constructor called");
Logging.CC_TRACE(CLASSNAME, "using version: " + FacebookSdk.getSdkVersion());
if (str != FacebookSdk.getApplicationId()) {
Logging.CC_TRACE(CLASSNAME, "Constructor current ApplicationId: " + FacebookSdk.getApplicationId() + ", setting to: " + str);
FacebookSdk.setApplicationId(str);
}
if (FacebookSdk.isInitialized()) {
return;
}
Logging.CC_TRACE(CLASSNAME, "Constructor Sdk isn't initialized!");
}
public void setAutoInitEnabled(boolean z) {
if (z) {
FacebookSdk.setAutoInitEnabled(true);
FacebookSdk.fullyInitialize();
} else {
FacebookSdk.setAutoInitEnabled(false);
}
}
public void setAutoLogAppEventsEnabled(boolean z) {
FacebookSdk.setAutoLogAppEventsEnabled(z);
}
public static boolean handleActivityResult(int i, int i2, Intent intent) {
if (!FacebookSdk.isInitialized()) {
return false;
}
Logging.CC_TRACE(CLASSNAME, "handleActivityResult");
if (s_CallbackManager.onActivityResult(i, i2, intent)) {
return true;
}
Logging.CC_TRACE(CLASSNAME, "handleActivityResult unhandled");
if (i2 == 0 && m_sCallback != 0 && m_sUserPtr != 0) {
if (i == CallbackManagerImpl.RequestCodeOffset.AppInvite.toRequestCode() || i == CallbackManagerImpl.RequestCodeOffset.GameRequest.toRequestCode()) {
Logging.CC_ERROR(CLASSNAME, "Cancel called on friend invite, manually calling back");
s_pSingleton.OnFriendInviteFailure(m_sCallback, m_sUserPtr);
return true;
}
if (i == CallbackManagerImpl.RequestCodeOffset.Share.toRequestCode()) {
Logging.CC_ERROR(CLASSNAME, "Cancel called on share, manually calling back");
s_pSingleton.OnFeedPostFailure(m_sCallback, m_sUserPtr);
return true;
}
}
return false;
}
public boolean GetSessionValid() {
return !GetAccessToken().isEmpty();
}
public String GetAccessToken() {
AccessToken currentAccessToken = AccessToken.getCurrentAccessToken();
return currentAccessToken != null ? currentAccessToken.getToken() : "";
}
/* JADX INFO: Access modifiers changed from: private */
public static boolean isPublishPermission(String str) {
return str != null && (str.startsWith(PUBLISH_PERMISSION_PREFIX) || str.startsWith(MANAGE_PERMISSION_PREFIX) || OTHER_PUBLISH_PERMISSIONS.contains(str));
}
private static List<String> GetReadPermissions(String[] strArr) {
ArrayList arrayList = new ArrayList();
for (int i = 0; i < strArr.length; i++) {
if (!isPublishPermission(strArr[i])) {
arrayList.add(strArr[i]);
}
}
return arrayList;
}
private static List<String> GetPublishPermissions(String[] strArr) {
ArrayList arrayList = new ArrayList();
for (int i = 0; i < strArr.length; i++) {
if (isPublishPermission(strArr[i])) {
arrayList.add(strArr[i]);
}
}
return arrayList;
}
private static Set<String> getOtherPublishPermissions() {
return Collections.unmodifiableSet(new HashSet<String>() { // from class: com.firemonkeys.cloudcellapi.FacebookWorker.1
{
add("ads_management");
add("create_event");
add("rsvp_event");
}
});
}
public boolean IsNativeAppInstalled() {
return GetInfo.DoesPackageExist("com.facebook.katana");
}
public void Login(final String[] strArr, boolean z, final long j, final long j2) {
Logging.CC_TRACE(CLASSNAME, "Login called");
if (!z && GetSessionValid() && AccessToken.getCurrentAccessToken().getPermissions().containsAll(Collections.unmodifiableSet(new HashSet(Arrays.asList(strArr))))) {
OnLoginSuccess(j, j2);
return;
}
Activity GetActivity = CC_Activity.GetActivity();
LoginManager loginManager = LoginManager.getInstance();
if (((UiModeManager) GetActivity.getSystemService("uimode")).getCurrentModeType() == 4) {
loginManager.setLoginBehavior(LoginBehavior.DEVICE_AUTH);
} else {
loginManager.setLoginBehavior(LoginBehavior.NATIVE_WITH_FALLBACK);
}
loginManager.setDefaultAudience(DefaultAudience.EVERYONE);
loginManager.registerCallback(s_CallbackManager, new FacebookCallback<LoginResult>() { // from class: com.firemonkeys.cloudcellapi.FacebookWorker.2
@Override // com.facebook.FacebookCallback
public void onSuccess(LoginResult loginResult) {
Logging.CC_TRACE(FacebookWorker.CLASSNAME, "Login succeeded");
FacebookWorker.this.OnLoginSuccess(j, j2);
}
@Override // com.facebook.FacebookCallback
public void onCancel() {
Logging.CC_TRACE(FacebookWorker.CLASSNAME, "Login cancelled");
FacebookWorker.this.OnLoginFailure(j, j2);
}
@Override // com.facebook.FacebookCallback
public void onError(FacebookException facebookException) {
Logging.CC_ERROR(FacebookWorker.CLASSNAME, "Login failed. Error: " + facebookException.toString());
FacebookWorker.this.OnLoginFailure(j, j2);
}
});
if (this.m_ProfileTracker != null) {
Logging.CC_TRACE(CLASSNAME, "Login profile tracker still running? Killing it.");
this.m_ProfileTracker.stopTracking();
this.m_ProfileTracker = null;
}
GetActivity.runOnUiThread(new Runnable() { // from class: com.firemonkeys.cloudcellapi.FacebookWorker.3
@Override // java.lang.Runnable
public void run() {
ArrayList arrayList = new ArrayList();
int i = 0;
while (true) {
String[] strArr2 = strArr;
if (i < strArr2.length) {
if (!FacebookWorker.isPublishPermission(strArr2[i])) {
arrayList.add(strArr[i]);
}
i++;
} else {
Logging.CC_TRACE(FacebookWorker.CLASSNAME, "Logging in with permissions: " + arrayList.toString());
LoginManager.getInstance().logInWithReadPermissions(CC_Activity.GetActivity(), arrayList);
return;
}
}
}
});
}
public void Logout(long j, long j2) {
Logging.CC_TRACE(CLASSNAME, "Logout called");
LoginManager.getInstance().logOut();
Logging.CC_TRACE(CLASSNAME, "Facebook account is logged out");
OnLogout(j, j2);
}
public void PermissionCheck(String[] strArr, long j, long j2) {
Logging.CC_TRACE(CLASSNAME, "PermissionCheck called");
AccessToken currentAccessToken = AccessToken.getCurrentAccessToken();
if (!GetSessionValid() || currentAccessToken == null) {
Logging.CC_ERROR(CLASSNAME, "Facebook account is not logged in!");
OnPermissionCheckFailure(j, j2);
return;
}
Set<String> permissions = currentAccessToken.getPermissions();
for (int i = 0; i < strArr.length; i++) {
if (!permissions.contains(strArr[i])) {
Logging.CC_ERROR(CLASSNAME, "Facebook permission check failed, missing permission: " + strArr[i]);
OnPermissionCheckFailure(j, j2);
return;
}
}
OnPermissionCheckSuccess(j, j2);
}
public void PermissionGrant(String[] strArr, final long j, final long j2) {
Logging.CC_TRACE(CLASSNAME, "PermissionGrant called");
final List<String> GetReadPermissions = GetReadPermissions(strArr);
final List<String> GetPublishPermissions = GetPublishPermissions(strArr);
if (!GetSessionValid()) {
Logging.CC_TRACE(CLASSNAME, "Facebook account is not logged in!");
OnPermissionGrantFailure(j, j2);
return;
}
AccessToken currentAccessToken = AccessToken.getCurrentAccessToken();
Set<String> permissions = currentAccessToken.getPermissions();
if (permissions.containsAll(GetReadPermissions) && permissions.containsAll(GetPublishPermissions) && !currentAccessToken.isDataAccessExpired()) {
OnPermissionGrantSuccess(j, j2);
return;
}
final LoginManager loginManager = LoginManager.getInstance();
loginManager.registerCallback(s_CallbackManager, new FacebookCallback<LoginResult>() { // from class: com.firemonkeys.cloudcellapi.FacebookWorker.4
@Override // com.facebook.FacebookCallback
public void onSuccess(LoginResult loginResult) {
Logging.CC_TRACE(FacebookWorker.CLASSNAME, "PermissionGrant successfully with result");
int i = FacebookWorker.m_PermissionsRequested - 1;
FacebookWorker.m_PermissionsRequested = i;
if (i == 0) {
FacebookWorker.this.OnPermissionGrantSuccess(j, j2);
}
}
@Override // com.facebook.FacebookCallback
public void onCancel() {
Logging.CC_TRACE(FacebookWorker.CLASSNAME, "PermissionGrant cancelled");
int i = FacebookWorker.m_PermissionsRequested - 1;
FacebookWorker.m_PermissionsRequested = i;
if (i == 0) {
FacebookWorker.this.OnPermissionGrantFailure(j, j2);
}
}
@Override // com.facebook.FacebookCallback
public void onError(FacebookException facebookException) {
Logging.CC_ERROR(FacebookWorker.CLASSNAME, "PermissionGrant failed. Error: " + facebookException.toString());
int i = FacebookWorker.m_PermissionsRequested + (-1);
FacebookWorker.m_PermissionsRequested = i;
if (i == 0) {
FacebookWorker.this.OnPermissionGrantFailure(j, j2);
}
}
});
CC_Activity.GetActivity().runOnUiThread(new Runnable() { // from class: com.firemonkeys.cloudcellapi.FacebookWorker.5
@Override // java.lang.Runnable
public void run() {
if (AccessToken.getCurrentAccessToken().isDataAccessExpired()) {
loginManager.reauthorizeDataAccess(CC_Activity.GetActivity());
return;
}
FacebookWorker.m_PermissionsRequested = (!GetReadPermissions.isEmpty() ? 1 : 0) + (!GetPublishPermissions.isEmpty() ? 1 : 0);
if (!GetReadPermissions.isEmpty()) {
Logging.CC_TRACE(FacebookWorker.CLASSNAME, "Logging in with read permissions: " + GetReadPermissions.toString());
LoginManager.getInstance().logInWithReadPermissions(CC_Activity.GetActivity(), GetReadPermissions);
}
if (GetPublishPermissions.isEmpty()) {
return;
}
Logging.CC_TRACE(FacebookWorker.CLASSNAME, "Logging in with publish permissions: " + GetPublishPermissions.toString());
LoginManager.getInstance().logInWithPublishPermissions(CC_Activity.GetActivity(), GetPublishPermissions);
}
});
}
public void LoadFriendVector(final long j, final long j2) {
Logging.CC_TRACE(CLASSNAME, "LoadFriendVector called");
if (!GetSessionValid()) {
Logging.CC_TRACE(CLASSNAME, "Facebook account is not logged in!");
OnLoadFriendFailure(j, j2);
} else {
CC_Activity.GetActivity().runOnUiThread(new Runnable() { // from class: com.firemonkeys.cloudcellapi.FacebookWorker.6
@Override // java.lang.Runnable
public void run() {
AccessToken currentAccessToken = AccessToken.getCurrentAccessToken();
Bundle bundle = new Bundle();
bundle.putInt("limit", 100);
new GraphRequest(currentAccessToken, "/me/friends", bundle, HttpMethod.GET, new GraphRequest.Callback() { // from class: com.firemonkeys.cloudcellapi.FacebookWorker.6.1
List<String> sFacebookIdArray = new ArrayList();
List<String> sNameArray = new ArrayList();
@Override // com.facebook.GraphRequest.Callback
public void onCompleted(GraphResponse graphResponse) {
try {
JSONObject jSONObject = graphResponse.getJSONObject();
if (jSONObject != null) {
Logging.CC_TRACE(FacebookWorker.CLASSNAME, "Facebook friends request received");
JSONArray jSONArray = jSONObject.getJSONArray("data");
if (jSONArray != null) {
Logging.CC_TRACE(FacebookWorker.CLASSNAME, "Facebook friends request received data: " + jSONArray.toString());
for (int i = 0; i < jSONArray.length(); i++) {
JSONObject optJSONObject = jSONArray.optJSONObject(i);
if (optJSONObject != null) {
this.sFacebookIdArray.add(optJSONObject.optString("id", ""));
this.sNameArray.add(optJSONObject.optString("name", ""));
}
}
}
GraphRequest requestForPagedResults = graphResponse.getRequestForPagedResults(GraphResponse.PagingDirection.NEXT);
if (requestForPagedResults != null) {
Logging.CC_TRACE(FacebookWorker.CLASSNAME, "Requesting next friends page");
requestForPagedResults.setCallback(this);
requestForPagedResults.executeAsync();
return;
}
Logging.CC_TRACE(FacebookWorker.CLASSNAME, "Calling back");
FacebookWorker facebookWorker = FacebookWorker.this;
List<String> list = this.sFacebookIdArray;
String[] strArr = (String[]) list.toArray(new String[list.size()]);
List<String> list2 = this.sNameArray;
String[] strArr2 = (String[]) list2.toArray(new String[list2.size()]);
AnonymousClass6 anonymousClass6 = AnonymousClass6.this;
facebookWorker.OnLoadFriendSuccess(strArr, strArr2, j, j2);
return;
}
Logging.CC_ERROR(FacebookWorker.CLASSNAME, "Facebook friends request failed. Error: " + graphResponse.getError());
AnonymousClass6 anonymousClass62 = AnonymousClass6.this;
FacebookWorker.this.OnLoadFriendFailure(j, j2);
} catch (Exception e) {
Logging.CC_ERROR(FacebookWorker.CLASSNAME, "Facebook friends request failed. Exception: " + e.getMessage());
AnonymousClass6 anonymousClass63 = AnonymousClass6.this;
FacebookWorker.this.OnLoadFriendFailure(j, j2);
}
}
}).executeAsync();
}
});
}
}
public void LoadAvatarUrl(final long j, final String str, final boolean z) {
Logging.CC_TRACE(CLASSNAME, "LoadAvatarUrl called");
CC_Activity.GetActivity().runOnUiThread(new Runnable() { // from class: com.firemonkeys.cloudcellapi.FacebookWorker.7
@Override // java.lang.Runnable
public void run() {
AccessToken.getCurrentAccessToken();
String str2 = "/" + str + "/picture?redirect=false&fields=url";
if (z) {
str2 = str2 + "&breaking_change=profile_picture";
}
new GraphRequest(null, str2, null, HttpMethod.GET, new GraphRequest.Callback() { // from class: com.firemonkeys.cloudcellapi.FacebookWorker.7.1
@Override // com.facebook.GraphRequest.Callback
public void onCompleted(GraphResponse graphResponse) {
try {
JSONObject jSONObject = graphResponse.getJSONObject();
if (jSONObject != null) {
Logging.CC_TRACE(FacebookWorker.CLASSNAME, "Facebook LoadAvatarUrl response received");
String string = jSONObject.getJSONObject("data").getString("url");
if (!string.isEmpty()) {
AnonymousClass7 anonymousClass7 = AnonymousClass7.this;
FacebookWorker.this.OnLoadAvatarUrlSuccess(string, j);
} else {
AnonymousClass7 anonymousClass72 = AnonymousClass7.this;
FacebookWorker.this.OnLoadAvatarUrlFailure(j);
}
} else {
Logging.CC_TRACE(FacebookWorker.CLASSNAME, "Facebook LoadAvatarUrl GraphRequest returned a null responseJson: " + graphResponse.toString());
AnonymousClass7 anonymousClass73 = AnonymousClass7.this;
FacebookWorker.this.OnLoadAvatarUrlFailure(j);
}
} catch (Exception e) {
Logging.CC_ERROR(FacebookWorker.CLASSNAME, "Facebook LoadAvatarUrl request failed. Exception: " + e.getMessage());
AnonymousClass7 anonymousClass74 = AnonymousClass7.this;
FacebookWorker.this.OnLoadAvatarUrlFailure(j);
}
}
}).executeAsync();
}
});
}
public void FeedPost(final String str, final String str2, final String str3, final String str4, final String str5, String str6, boolean z, final long j, final long j2) {
String str7 = CLASSNAME;
StringBuilder sb = new StringBuilder();
sb.append("FeedPost called with: [ShowDialog=");
sb.append(z ? "TRUE]" : "FALSE]");
Logging.CC_TRACE(str7, sb.toString());
m_sCallback = j;
m_sUserPtr = j2;
if (z) {
if (this.m_ShareDialog == null) {
this.m_ShareDialog = new ShareDialog(CC_Activity.GetActivity());
}
this.m_ShareDialog.registerCallback(s_CallbackManager, new FacebookCallback<Sharer.Result>() { // from class: com.firemonkeys.cloudcellapi.FacebookWorker.8
@Override // com.facebook.FacebookCallback
public void onSuccess(Sharer.Result result) {
Logging.CC_TRACE(FacebookWorker.CLASSNAME, "FeedPost successfully with postId: " + result.getPostId());
FacebookWorker.this.OnFeedPostSuccess(j, j2);
}
@Override // com.facebook.FacebookCallback
public void onCancel() {
Logging.CC_TRACE(FacebookWorker.CLASSNAME, "FeedPost cancelled");
FacebookWorker.this.OnFeedPostFailure(j, j2);
}
@Override // com.facebook.FacebookCallback
public void onError(FacebookException facebookException) {
Logging.CC_ERROR(FacebookWorker.CLASSNAME, "FeedPost failed. Error: " + facebookException.toString());
FacebookWorker.this.OnFeedPostFailure(j, j2);
}
});
if (ShareDialog.canShow((Class<? extends ShareContent<?, ?>>) ShareLinkContent.class)) {
this.m_ShareDialog.show(new ShareLinkContent.Builder().setContentUrl(Uri.parse(str4)).build());
return;
}
return;
}
CC_Activity.GetActivity().runOnUiThread(new Runnable() { // from class: com.firemonkeys.cloudcellapi.FacebookWorker.9
@Override // java.lang.Runnable
public void run() {
try {
GraphRequest.newPostRequest(AccessToken.getCurrentAccessToken(), "me/feed", new JSONObject().put("name", str).put(ShareConstants.FEED_CAPTION_PARAM, str2).put("description", str3).put("link", str4).put("picture", str5), new GraphRequest.Callback() { // from class: com.firemonkeys.cloudcellapi.FacebookWorker.9.1
@Override // com.facebook.GraphRequest.Callback
public void onCompleted(GraphResponse graphResponse) {
if (graphResponse.getError() != null) {
Logging.CC_TRACE(FacebookWorker.CLASSNAME, "FeedPost Error:" + graphResponse.getError());
AnonymousClass9 anonymousClass9 = AnonymousClass9.this;
FacebookWorker.this.OnFeedPostFailure(j, j2);
return;
}
AnonymousClass9 anonymousClass92 = AnonymousClass9.this;
FacebookWorker.this.OnFeedPostSuccess(j, j2);
}
}).executeAsync();
} catch (Exception e) {
Logging.CC_ERROR(FacebookWorker.CLASSNAME, "FeedPost() Exception:" + e.getMessage());
FacebookWorker.this.OnFeedPostFailure(j, j2);
}
}
});
}
public void PhotoPost(final String str, byte[] bArr, final long j, final long j2) {
Logging.CC_TRACE(CLASSNAME, String.format("PhotoPost called [caption: %s] [imagelen: %x]", str, Integer.valueOf(bArr.length)));
if (bArr.length == 0) {
Logging.CC_ERROR(CLASSNAME, "Image is invalid");
}
final Bitmap decodeByteArray = BitmapFactory.decodeByteArray(bArr, 0, bArr.length);
CC_Activity.GetActivity().runOnUiThread(new Runnable() { // from class: com.firemonkeys.cloudcellapi.FacebookWorker.10
@Override // java.lang.Runnable
public void run() {
try {
GraphRequest.newUploadPhotoRequest(AccessToken.getCurrentAccessToken(), "me/photos", decodeByteArray, str, (Bundle) null, new GraphRequest.Callback() { // from class: com.firemonkeys.cloudcellapi.FacebookWorker.10.1
@Override // com.facebook.GraphRequest.Callback
public void onCompleted(GraphResponse graphResponse) {
if (graphResponse.getError() != null) {
Logging.CC_TRACE(FacebookWorker.CLASSNAME, "PhotoPost Error:" + graphResponse.getError());
AnonymousClass10 anonymousClass10 = AnonymousClass10.this;
FacebookWorker.this.OnPhotoPostFailure(j, j2);
return;
}
AnonymousClass10 anonymousClass102 = AnonymousClass10.this;
FacebookWorker.this.OnPhotoPostSuccess(j, j2);
}
}).executeAsync();
} catch (Exception e) {
Logging.CC_ERROR(FacebookWorker.CLASSNAME, "PhotoPost() Exception:" + e.getMessage());
FacebookWorker.this.OnPhotoPostFailure(j, j2);
}
}
});
}
public void FriendInvite(String str, String str2, final long j, final long j2) {
Logging.CC_TRACE(CLASSNAME, "FriendInvite() Title: " + str + ", Message: " + str2);
if (this.m_InviteDialog == null) {
this.m_InviteDialog = new GameRequestDialog(CC_Activity.GetActivity());
}
m_sCallback = j;
m_sUserPtr = j2;
this.m_InviteDialog.registerCallback(s_CallbackManager, new FacebookCallback<GameRequestDialog.Result>() { // from class: com.firemonkeys.cloudcellapi.FacebookWorker.11
@Override // com.facebook.FacebookCallback
public void onSuccess(GameRequestDialog.Result result) {
Logging.CC_TRACE(FacebookWorker.CLASSNAME, "FriendInvite successfully with PostId: " + result.getRequestId());
FacebookWorker.this.OnFriendInviteSuccess(j, j2);
}
@Override // com.facebook.FacebookCallback
public void onCancel() {
Logging.CC_TRACE(FacebookWorker.CLASSNAME, "PermissionGrant cancelled");
FacebookWorker.this.OnFriendInviteFailure(j, j2);
}
@Override // com.facebook.FacebookCallback
public void onError(FacebookException facebookException) {
Logging.CC_ERROR(FacebookWorker.CLASSNAME, "PermissionGrant failed. Error: " + facebookException.toString());
FacebookWorker.this.OnFriendInviteFailure(j, j2);
}
});
if (GameRequestDialog.canShow()) {
this.m_InviteDialog.show(new GameRequestContent.Builder().setTitle(str).setMessage(str2).setFilters(GameRequestContent.Filters.APP_NON_USERS).build());
}
}
public class AvatarInfo {
byte[] data;
int nChannels;
int nHeight;
int nWidth;
public AvatarInfo() {
}
}
public AvatarInfo DecodeAvatar(byte[] bArr, int i) {
AvatarInfo avatarInfo = new AvatarInfo();
Bitmap decodeByteArray = BitmapFactory.decodeByteArray(bArr, 0, i);
if (decodeByteArray != null) {
int byteCount = decodeByteArray.getByteCount();
avatarInfo.nWidth = decodeByteArray.getWidth();
avatarInfo.nHeight = decodeByteArray.getHeight();
avatarInfo.nChannels = byteCount / (decodeByteArray.getWidth() * decodeByteArray.getHeight());
ByteBuffer allocate = ByteBuffer.allocate(byteCount);
decodeByteArray.copyPixelsToBuffer(allocate);
avatarInfo.data = allocate.array();
decodeByteArray.recycle();
}
return avatarInfo;
}
/* JADX INFO: Access modifiers changed from: private */
public void OnLoginSuccess(final long j, final long j2) {
AccessToken currentAccessToken = AccessToken.getCurrentAccessToken();
if (currentAccessToken == null) {
Logging.CC_ERROR(CLASSNAME, "Facebook login failed. Token invalid!");
OnLoginFailure(j, j2);
return;
}
Profile currentProfile = Profile.getCurrentProfile();
if (currentProfile == null) {
if (this.m_ProfileTracker == null) {
Logging.CC_TRACE(CLASSNAME, "Profile is empty after login. Waiting until profile is fully loaded.");
ProfileTracker profileTracker = new ProfileTracker() { // from class: com.firemonkeys.cloudcellapi.FacebookWorker.12
@Override // com.facebook.ProfileTracker
public void onCurrentProfileChanged(Profile profile, Profile profile2) {
if (profile2 != null) {
Logging.CC_TRACE(FacebookWorker.CLASSNAME, "Profile loaded");
FacebookWorker.this.OnLoginSuccess(j, j2);
} else {
FacebookWorker.this.OnLoginFailure(j, j2);
}
}
};
this.m_ProfileTracker = profileTracker;
profileTracker.startTracking();
return;
}
Logging.CC_TRACE(CLASSNAME, "Facebook login failed. Profile invalid!");
OnLoginFailure(j, j2);
}
ProfileTracker profileTracker2 = this.m_ProfileTracker;
if (profileTracker2 != null) {
profileTracker2.stopTracking();
this.m_ProfileTracker = null;
}
String str = CLASSNAME;
StringBuilder sb = new StringBuilder();
sb.append("Facebook login succeeded. Token Id: ");
sb.append(currentAccessToken.getUserId());
sb.append(", Profile Name: ");
sb.append(currentProfile != null ? currentProfile.getName() : "ERROR");
Logging.CC_TRACE(str, sb.toString());
LoginCallback(currentAccessToken.getUserId(), currentProfile.getName(), currentProfile.getFirstName(), currentProfile.getMiddleName(), currentProfile.getLastName(), j, j2);
}
/* JADX INFO: Access modifiers changed from: private */
public void OnLoginFailure(long j, long j2) {
Logging.CC_TRACE(CLASSNAME, "Facebook login failed");
LoginCallback("0", "", "", "", "", j, j2);
}
private void OnLogout(long j, long j2) {
Logging.CC_TRACE(CLASSNAME, "Facebook logged out");
LogoutCallback(j, j2);
}
private void OnPermissionCheckSuccess(long j, long j2) {
Logging.CC_TRACE(CLASSNAME, "Facebook permission check succeeded");
PermissionCheckCallback(true, j, j2);
}
private void OnPermissionCheckFailure(long j, long j2) {
Logging.CC_TRACE(CLASSNAME, "Facebook permission check failed!");
PermissionCheckCallback(false, j, j2);
}
/* JADX INFO: Access modifiers changed from: private */
public void OnPermissionGrantSuccess(long j, long j2) {
Logging.CC_TRACE(CLASSNAME, "Facebook permission grant succeeded");
PermissionGrantCallback(true, j, j2);
}
/* JADX INFO: Access modifiers changed from: private */
public void OnPermissionGrantFailure(long j, long j2) {
Logging.CC_TRACE(CLASSNAME, "Facebook permission grant failed!");
PermissionGrantCallback(false, j, j2);
}
/* JADX INFO: Access modifiers changed from: private */
public void OnLoadFriendSuccess(String[] strArr, String[] strArr2, long j, long j2) {
Logging.CC_TRACE(CLASSNAME, "Facebook loaded friends successfully");
LoadFriendVectorCallback(true, strArr, strArr2, j, j2);
}
/* JADX INFO: Access modifiers changed from: private */
public void OnLoadFriendFailure(long j, long j2) {
Logging.CC_TRACE(CLASSNAME, "Facebook friend load failed!");
LoadFriendVectorCallback(false, null, null, j, j2);
}
/* JADX INFO: Access modifiers changed from: private */
public void OnLoadAvatarUrlSuccess(String str, long j) {
LoadAvatarUrlCallback(true, str, j);
}
/* JADX INFO: Access modifiers changed from: private */
public void OnLoadAvatarUrlFailure(long j) {
LoadAvatarUrlCallback(false, null, j);
}
/* JADX INFO: Access modifiers changed from: private */
public void OnFeedPostSuccess(long j, long j2) {
Logging.CC_TRACE(CLASSNAME, "Posted to feed successfully");
m_sCallback = 0L;
m_sUserPtr = 0L;
FeedPostCallback(true, j, j2);
}
/* JADX INFO: Access modifiers changed from: private */
public void OnFeedPostFailure(long j, long j2) {
Logging.CC_TRACE(CLASSNAME, "Posting to feed failed!");
m_sCallback = 0L;
m_sUserPtr = 0L;
FeedPostCallback(false, j, j2);
}
/* JADX INFO: Access modifiers changed from: private */
public void OnPhotoPostSuccess(long j, long j2) {
Logging.CC_TRACE(CLASSNAME, "Posted photo successfully");
PhotoPostCallback(true, j, j2);
}
/* JADX INFO: Access modifiers changed from: private */
public void OnPhotoPostFailure(long j, long j2) {
Logging.CC_TRACE(CLASSNAME, "Photo post failed!");
PhotoPostCallback(false, j, j2);
}
/* JADX INFO: Access modifiers changed from: private */
public void OnFriendInviteSuccess(long j, long j2) {
Logging.CC_TRACE(CLASSNAME, "Invited friends successfully");
m_sCallback = 0L;
m_sUserPtr = 0L;
FriendInviteCallback(true, j, j2);
}
/* JADX INFO: Access modifiers changed from: private */
public void OnFriendInviteFailure(long j, long j2) {
Logging.CC_TRACE(CLASSNAME, "Invite friends failed!");
m_sCallback = 0L;
m_sUserPtr = 0L;
FriendInviteCallback(false, j, j2);
}
}

View File

@@ -0,0 +1,733 @@
package com.firemonkeys.cloudcellapi;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.content.IntentSender;
import android.content.SharedPreferences;
import android.graphics.Bitmap;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.os.CancellationSignal;
import androidx.annotation.NonNull;
import androidx.core.content.ContextCompat;
import androidx.credentials.CredentialManager;
import androidx.credentials.CredentialManagerCallback;
import androidx.credentials.CustomCredential;
import androidx.credentials.GetCredentialRequest;
import androidx.credentials.GetCredentialResponse;
import androidx.credentials.exceptions.GetCredentialException;
import androidx.credentials.exceptions.NoCredentialException;
import com.firemonkeys.cloudcellapi.GooglePlayWorker;
import com.firemonkeys.cloudcellapi.util.GetInfo;
import com.google.android.gms.auth.api.identity.AuthorizationRequest;
import com.google.android.gms.auth.api.identity.AuthorizationResult;
import com.google.android.gms.auth.api.identity.Identity;
import com.google.android.gms.common.AccountPicker;
import com.google.android.gms.common.Scopes;
import com.google.android.gms.common.api.Scope;
import com.google.android.gms.common.images.ImageManager;
import com.google.android.gms.games.AnnotatedData;
import com.google.android.gms.games.AuthenticationResult;
import com.google.android.gms.games.PlayGames;
import com.google.android.gms.games.PlayGamesSdk;
import com.google.android.gms.games.Player;
import com.google.android.gms.tasks.OnCompleteListener;
import com.google.android.gms.tasks.OnFailureListener;
import com.google.android.gms.tasks.OnSuccessListener;
import com.google.android.gms.tasks.Task;
import com.google.android.libraries.identity.googleid.GetGoogleIdOption;
import com.google.android.libraries.identity.googleid.GoogleIdTokenCredential;
import com.google.firebase.perf.network.FirebasePerfHttpClient;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.util.ArrayList;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.util.EntityUtils;
/* loaded from: classes2.dex */
public class GooglePlayWorker {
private static final String CLASSNAME = "GooglePlayWorker";
private static final int RC_ACHIEVEMENT_UI = 9003;
private static final int RC_SIGN_IN = 9001;
private static final int REQUEST_AUTHORIZE = 9004;
private static final int REQUEST_CODE_PICK_ACCOUNT = 468725;
private static final String WEB_CLIENT_ID = "1056053393768-2irtr6olub9uil5dsp16apf9p5f0ge0k.apps.googleusercontent.com";
private static final String autoConnectPrefName = "AutoConnect";
private static final Object lock = new Object();
private static boolean m_bAlreadyStarted = false;
private static boolean m_bDisablePopups = false;
private static boolean m_bIsAuthenticated = false;
private static boolean m_bIsInitialPhaseComplete = false;
private static boolean m_bLoginChanged = false;
private static boolean m_bLoginSilent = true;
private static boolean m_bSignInFlow = false;
private static long m_nLoginCallback = 0;
private static long m_nShareCallback = 0;
private static CredentialManager m_pCredentialManager = null;
private static GoogleIdTokenCredential m_pGoogleIdTokenCredential = null;
private static GooglePlayWorker m_pGooglePlayWorker = null;
private static Player m_pPlayer = null;
private static final String sharedPrefsFileName = "GooglePlayPrefs";
/* JADX INFO: Access modifiers changed from: private */
public native void LoadAvatarCallbackFunc(boolean z, byte[] bArr, long j);
private native void LoadFriendVectorCallback(boolean z, String[] strArr, String[] strArr2, long j);
/* JADX INFO: Access modifiers changed from: private */
public native void LoadProfileCallback(boolean z, String[] strArr, long j);
private native void LogoutCallback(long j);
private native void NativeLoginCallback(String str, String str2, boolean z, long j);
private native void ShareCallback(boolean z, boolean z2, long j);
public static void onCreate(Context context) {
}
public Player GetCurrentPlayer() {
Player player;
if (!m_bIsAuthenticated || (player = m_pPlayer) == null) {
return null;
}
return player;
}
public boolean GetSessionValid() {
return m_bIsAuthenticated;
}
public boolean IsInitialPhaseComplete() {
return m_bIsInitialPhaseComplete;
}
public GooglePlayWorker() {
Logging.CC_TRACE(CLASSNAME, "GooglePlusWorker()");
m_pGooglePlayWorker = this;
}
public void Constructor(String str, boolean z) {
Logging.CC_TRACE(CLASSNAME, "Constructor");
InitializeClient(str, z);
if (m_bAlreadyStarted) {
Connect();
}
}
private void InitializeClient(String str, boolean z) {
Logging.CC_TRACE(CLASSNAME, "Initializing Google Credentials");
Context applicationContext = CC_Component.GetActivity().getApplicationContext();
m_bDisablePopups = z;
PlayGamesSdk.initialize(applicationContext);
}
public static void onStart() {
Logging.CC_TRACE(CLASSNAME, "onStart");
Connect();
ClearTempDirectory();
m_bAlreadyStarted = true;
}
public static void onStop() {
Logging.CC_TRACE(CLASSNAME, "onStop");
}
private static boolean GetAutoConnect() {
return CC_Component.GetActivity().getApplicationContext().getSharedPreferences(sharedPrefsFileName, 0).getBoolean(autoConnectPrefName, true);
}
private static void SetAutoConnect(boolean z) {
SharedPreferences.Editor edit = CC_Component.GetActivity().getApplicationContext().getSharedPreferences(sharedPrefsFileName, 0).edit();
edit.putBoolean(autoConnectPrefName, z);
edit.apply();
}
private static void Connect() {
Logging.CC_TRACE(CLASSNAME, "Connect()");
m_bSignInFlow = false;
if (!GetAutoConnect()) {
Logging.CC_TRACE(CLASSNAME, "Autoconnecting to googleplay disabled by user");
CompleteInitialPhase();
} else if (!m_bSignInFlow) {
m_bLoginSilent = true;
Logging.CC_TRACE(CLASSNAME, "SignIn with googleplay silently");
SignInSilently();
} else {
Logging.CC_TRACE(CLASSNAME, "This should not happen: " + m_bSignInFlow);
}
}
/* JADX INFO: Access modifiers changed from: private */
public static void SignInSilently() {
SignInToPlayGames();
}
/* JADX INFO: Access modifiers changed from: private */
public static void GoogleSignIn(boolean z) {
Logging.CC_TRACE(CLASSNAME, "GoogleSignIn called! with isAuthorizedAccAvlbe: " + z);
if (m_pGoogleIdTokenCredential != null) {
m_pGooglePlayWorker.onGoogleSignInConnected();
m_bSignInFlow = false;
return;
}
m_bSignInFlow = true;
m_pCredentialManager.getCredentialAsync(CC_Component.GetActivity(), new GetCredentialRequest.Builder().addCredentialOption(new GetGoogleIdOption.Builder().setFilterByAuthorizedAccounts(z).setAutoSelectEnabled(true).setServerClientId(WEB_CLIENT_ID).build()).build(), (CancellationSignal) null, ContextCompat.getMainExecutor(CC_Component.GetActivity()), new AnonymousClass1(z));
}
/* renamed from: com.firemonkeys.cloudcellapi.GooglePlayWorker$1, reason: invalid class name */
public class AnonymousClass1 implements CredentialManagerCallback<GetCredentialResponse, GetCredentialException> {
final /* synthetic */ boolean val$isAuthorizedAccAvlbe;
public AnonymousClass1(boolean z) {
this.val$isAuthorizedAccAvlbe = z;
}
@Override // androidx.credentials.CredentialManagerCallback
public void onResult(GetCredentialResponse getCredentialResponse) {
Logging.CC_TRACE(GooglePlayWorker.CLASSNAME, "In getCredentialAsync: ");
if ((getCredentialResponse.getCredential() instanceof CustomCredential) && getCredentialResponse.getCredential().getType().equals(GoogleIdTokenCredential.TYPE_GOOGLE_ID_TOKEN_CREDENTIAL)) {
GooglePlayWorker.m_pGoogleIdTokenCredential = GoogleIdTokenCredential.createFrom(getCredentialResponse.getCredential().getData());
String idToken = GooglePlayWorker.m_pGoogleIdTokenCredential.getIdToken();
String displayName = GooglePlayWorker.m_pGoogleIdTokenCredential.getDisplayName();
Logging.CC_TRACE(GooglePlayWorker.CLASSNAME, "Google ID Token: " + idToken);
Logging.CC_TRACE(GooglePlayWorker.CLASSNAME, "Signed in as: " + displayName);
GooglePlayWorker.m_pGooglePlayWorker.onGoogleSignInConnected();
GooglePlayWorker.m_bSignInFlow = false;
ArrayList arrayList = new ArrayList();
arrayList.add(new Scope(Scopes.PROFILE));
Identity.getAuthorizationClient(CC_Component.GetActivity().getApplicationContext()).authorize(AuthorizationRequest.builder().setRequestedScopes(arrayList).build()).addOnSuccessListener(new OnSuccessListener() { // from class: com.firemonkeys.cloudcellapi.GooglePlayWorker$1$$ExternalSyntheticLambda0
@Override // com.google.android.gms.tasks.OnSuccessListener
public final void onSuccess(Object obj) {
GooglePlayWorker.AnonymousClass1.lambda$onResult$0((AuthorizationResult) obj);
}
}).addOnFailureListener(new OnFailureListener() { // from class: com.firemonkeys.cloudcellapi.GooglePlayWorker$1$$ExternalSyntheticLambda1
@Override // com.google.android.gms.tasks.OnFailureListener
public final void onFailure(Exception exc) {
GooglePlayWorker.AnonymousClass1.lambda$onResult$1(exc);
}
});
}
}
/* JADX INFO: Access modifiers changed from: private */
public static /* synthetic */ void lambda$onResult$0(AuthorizationResult authorizationResult) {
if (authorizationResult.hasResolution()) {
try {
CC_Component.GetActivity().startIntentSenderForResult(authorizationResult.getPendingIntent().getIntentSender(), GooglePlayWorker.REQUEST_AUTHORIZE, null, 0, 0, 0, null);
} catch (IntentSender.SendIntentException e) {
Logging.CC_TRACE(GooglePlayWorker.CLASSNAME, "Couldn't start Authorization UI: " + e.getLocalizedMessage());
}
} else {
Logging.CC_TRACE(GooglePlayWorker.CLASSNAME, "Access already granted ");
}
GooglePlayWorker.SignInToPlayGames();
}
/* JADX INFO: Access modifiers changed from: private */
public static /* synthetic */ void lambda$onResult$1(Exception exc) {
Logging.CC_TRACE(GooglePlayWorker.CLASSNAME, "Failed to authorize: " + exc);
}
@Override // androidx.credentials.CredentialManagerCallback
public void onError(@NonNull GetCredentialException getCredentialException) {
Logging.CC_TRACE(GooglePlayWorker.CLASSNAME, "Sign-in failed: " + getCredentialException.getMessage());
if ((getCredentialException instanceof NoCredentialException) || this.val$isAuthorizedAccAvlbe) {
GooglePlayWorker.GoogleSignIn(false);
} else {
GooglePlayWorker.CompleteInitialPhase();
GooglePlayWorker.m_pGooglePlayWorker.onGoogleSignInFailed(true);
}
}
}
public static boolean handleActivityResult(int i, int i2, Intent intent) {
if (i2 == -1) {
Logging.CC_TRACE(CLASSNAME, "handleActivityResult: requestCode: " + i + " resultCode: RESULT_OK");
} else if (i2 == 0) {
Logging.CC_TRACE(CLASSNAME, "handleActivityResult: requestCode: " + i + " resultCode: RESULT_CANCELED");
} else {
Logging.CC_TRACE(CLASSNAME, "handleActivityResult: requestCode: " + i + " resultCode: " + i2);
}
GooglePlayWorker googlePlayWorker = m_pGooglePlayWorker;
if (googlePlayWorker == null) {
return false;
}
if (i != 9001) {
if (i == REQUEST_AUTHORIZE) {
Logging.CC_TRACE(CLASSNAME, "REQUEST_AUTHORIZE : Received");
}
if (i == REQUEST_CODE_PICK_ACCOUNT && i2 == -1) {
DoResetAchievements();
}
return true;
}
boolean z = i2 == 0;
if (i2 == -1) {
Logging.CC_TRACE(CLASSNAME, "handleActivityResult:signin complete");
SignInSilently();
} else if (z) {
googlePlayWorker.onGoogleSignInFailed(true);
}
return true;
}
public void Login(final long j, final boolean z) {
Logging.CC_TRACE(CLASSNAME, "Google Login... Silent:" + z + " callback: " + j);
CC_Component.GetActivity().runOnUiThread(new Runnable() { // from class: com.firemonkeys.cloudcellapi.GooglePlayWorker.2
@Override // java.lang.Runnable
public void run() {
synchronized (GooglePlayWorker.lock) {
GooglePlayWorker.m_nLoginCallback = j;
}
GooglePlayWorker.m_bLoginSilent = z;
GooglePlayWorker.m_bSignInFlow = true;
Logging.CC_TRACE(GooglePlayWorker.CLASSNAME, "Calling SignInSilently");
GooglePlayWorker.SignInSilently();
}
});
}
/* JADX INFO: Access modifiers changed from: private */
public void onGoogleSignInConnected() {
Logging.CC_TRACE(CLASSNAME, "onGoogleSignInConnected , id: " + m_pGoogleIdTokenCredential.getIdToken() + ", name:" + m_pGoogleIdTokenCredential.getDisplayName());
SetAutoConnect(true);
LoadCurrentPlayer();
CompleteInitialPhase();
}
/* JADX INFO: Access modifiers changed from: private */
public void onGoogleSignInFailed(boolean z) {
m_pGoogleIdTokenCredential = null;
m_bSignInFlow = false;
if (z) {
SetAutoConnect(false);
}
LoginCallback("", "", z);
CompleteInitialPhase();
}
private void onGooglePlayConnected() {
if (m_pGoogleIdTokenCredential == null) {
Logging.CC_TRACE(CLASSNAME, "onConnected null user, disconnecting");
LoginCallback("", "", false);
CompleteInitialPhase();
return;
}
Logging.CC_TRACE(CLASSNAME, "onConnected google plus id:" + GetGooglePlayId() + " name:" + GetDisplayName());
SetAutoConnect(true);
LoadCurrentPlayer();
}
public void LoginCallback(String str, String str2, boolean z) {
synchronized (lock) {
try {
Logging.CC_TRACE(CLASSNAME, "LoginCallback person id:" + str + " name:" + str2 + " m_nLoginCallback: " + m_nLoginCallback);
if (m_nLoginCallback != 0) {
Logging.CC_TRACE(CLASSNAME, "LoginCallback calling native callback");
NativeLoginCallback(str, str2, z, m_nLoginCallback);
} else {
Logging.CC_TRACE(CLASSNAME, "LoginCallback no native callback");
m_bLoginChanged = true;
}
m_nLoginCallback = 0L;
m_bSignInFlow = false;
} catch (Throwable th) {
throw th;
}
}
}
private void signOutAndClearDefaultAccount() {
Logging.CC_TRACE(CLASSNAME, "signOutAndClearDefaultAccount");
m_bIsAuthenticated = false;
m_pPlayer = null;
}
public void Logout(long j) {
Logging.CC_TRACE(CLASSNAME, "LOGOUT check remove connected account()");
signOutAndClearDefaultAccount();
m_pGoogleIdTokenCredential = null;
SetAutoConnect(false);
LogoutCallback(j);
}
public static void SignInToPlayGames() {
Logging.CC_TRACE(CLASSNAME, "Inside SignInToPlayGames :" + m_bLoginSilent);
m_bSignInFlow = true;
if (m_bLoginSilent) {
PlayGames.getGamesSignInClient(CC_Component.GetActivity()).isAuthenticated().addOnCompleteListener(new OnCompleteListener() { // from class: com.firemonkeys.cloudcellapi.GooglePlayWorker$$ExternalSyntheticLambda1
@Override // com.google.android.gms.tasks.OnCompleteListener
public final void onComplete(Task task) {
GooglePlayWorker.lambda$SignInToPlayGames$0(task);
}
});
} else {
PlayGames.getGamesSignInClient(CC_Component.GetActivity()).signIn().addOnCompleteListener(new OnCompleteListener() { // from class: com.firemonkeys.cloudcellapi.GooglePlayWorker$$ExternalSyntheticLambda2
@Override // com.google.android.gms.tasks.OnCompleteListener
public final void onComplete(Task task) {
GooglePlayWorker.lambda$SignInToPlayGames$2(task);
}
}).addOnFailureListener(new OnFailureListener() { // from class: com.firemonkeys.cloudcellapi.GooglePlayWorker$$ExternalSyntheticLambda3
@Override // com.google.android.gms.tasks.OnFailureListener
public final void onFailure(Exception exc) {
GooglePlayWorker.lambda$SignInToPlayGames$3(exc);
}
});
}
}
/* JADX INFO: Access modifiers changed from: private */
public static /* synthetic */ void lambda$SignInToPlayGames$0(Task task) {
if (task.isSuccessful() && ((AuthenticationResult) task.getResult()).isAuthenticated()) {
m_bIsAuthenticated = true;
Logging.CC_TRACE(CLASSNAME, "PlayGames Authentication : Success");
OnPlayGamesLoggedIn();
} else {
OnPlayGamesLoginFailed();
Logging.CC_TRACE(CLASSNAME, "PlayGames Authentication : Failed");
}
}
/* JADX INFO: Access modifiers changed from: private */
public static /* synthetic */ void lambda$SignInToPlayGames$2(Task task) {
if (task.isSuccessful()) {
Logging.CC_TRACE(CLASSNAME, "PlayGames SignIn : Success");
PlayGames.getGamesSignInClient(CC_Component.GetActivity()).isAuthenticated().addOnCompleteListener(new OnCompleteListener() { // from class: com.firemonkeys.cloudcellapi.GooglePlayWorker$$ExternalSyntheticLambda0
@Override // com.google.android.gms.tasks.OnCompleteListener
public final void onComplete(Task task2) {
GooglePlayWorker.lambda$SignInToPlayGames$1(task2);
}
});
}
}
/* JADX INFO: Access modifiers changed from: private */
public static /* synthetic */ void lambda$SignInToPlayGames$1(Task task) {
if (task.isSuccessful() && ((AuthenticationResult) task.getResult()).isAuthenticated()) {
m_bIsAuthenticated = true;
Logging.CC_TRACE(CLASSNAME, "PlayGames Authentication : Success");
OnPlayGamesLoggedIn();
m_pGooglePlayWorker.LoginCallback("", "", false);
return;
}
OnPlayGamesLoginFailed();
Logging.CC_TRACE(CLASSNAME, "PlayGames Authentication : Failed");
m_pGooglePlayWorker.LoginCallback("", "", true);
}
/* JADX INFO: Access modifiers changed from: private */
public static /* synthetic */ void lambda$SignInToPlayGames$3(Exception exc) {
Logging.CC_TRACE(CLASSNAME, "PlayGames SignIn Exception: " + exc);
}
public static void OnPlayGamesLoggedIn() {
SetAutoConnect(true);
LoadCurrentPlayer();
CompleteInitialPhase();
}
public static void OnPlayGamesLoginFailed() {
m_bSignInFlow = false;
SetAutoConnect(false);
CompleteInitialPhase();
}
public static void LoadCurrentPlayer() {
Logging.CC_TRACE(CLASSNAME, "LoadCurrentPlayer");
CC_Component.GetActivity().runOnUiThread(new AnonymousClass3());
}
/* renamed from: com.firemonkeys.cloudcellapi.GooglePlayWorker$3, reason: invalid class name */
public class AnonymousClass3 implements Runnable {
@Override // java.lang.Runnable
public void run() {
PlayGames.getPlayersClient(CC_Component.GetActivity()).getCurrentPlayer().addOnSuccessListener(new OnSuccessListener() { // from class: com.firemonkeys.cloudcellapi.GooglePlayWorker$3$$ExternalSyntheticLambda0
@Override // com.google.android.gms.tasks.OnSuccessListener
public final void onSuccess(Object obj) {
GooglePlayWorker.AnonymousClass3.lambda$run$0((Player) obj);
}
}).addOnFailureListener(new OnFailureListener() { // from class: com.firemonkeys.cloudcellapi.GooglePlayWorker$3$$ExternalSyntheticLambda1
@Override // com.google.android.gms.tasks.OnFailureListener
public final void onFailure(Exception exc) {
GooglePlayWorker.AnonymousClass3.lambda$run$1(exc);
}
});
}
/* JADX INFO: Access modifiers changed from: private */
public static /* synthetic */ void lambda$run$0(Player player) {
Logging.CC_TRACE(GooglePlayWorker.CLASSNAME, player.getPlayerId() + " " + player.getDisplayName());
GooglePlayWorker.m_pPlayer = player;
GooglePlayWorker.m_bLoginChanged = true;
GooglePlayWorker.m_bSignInFlow = false;
GooglePlayWorker.CompleteInitialPhase();
}
/* JADX INFO: Access modifiers changed from: private */
public static /* synthetic */ void lambda$run$1(Exception exc) {
Logging.CC_TRACE(GooglePlayWorker.CLASSNAME, "getCurrentPlayer Failed to get current player: " + exc);
GooglePlayWorker.m_bSignInFlow = false;
GooglePlayWorker.CompleteInitialPhase();
}
}
public void LoadProfile(final String str, final long j) {
Logging.CC_TRACE(CLASSNAME, "LoadProfile -" + str);
if (m_pGoogleIdTokenCredential == null) {
Logging.CC_TRACE(CLASSNAME, "GoogleApiClient null");
LoadProfileCallback(false, new String[0], j);
} else {
CC_Component.GetActivity().runOnUiThread(new Runnable() { // from class: com.firemonkeys.cloudcellapi.GooglePlayWorker.4
@Override // java.lang.Runnable
public void run() {
PlayGames.getPlayersClient(CC_Component.GetActivity()).loadPlayer(str).addOnCompleteListener(new OnCompleteListener<AnnotatedData<Player>>() { // from class: com.firemonkeys.cloudcellapi.GooglePlayWorker.4.1
@Override // com.google.android.gms.tasks.OnCompleteListener
public void onComplete(@NonNull Task<AnnotatedData<Player>> task) {
String[] strArr = null;
boolean z = false;
if (task.isSuccessful()) {
Player player = task.getResult().get();
if (player != null) {
try {
strArr = new String[]{player.getPlayerId(), player.getDisplayName(), player.getIconImageUri().toString()};
Logging.CC_TRACE(GooglePlayWorker.CLASSNAME, "onPlayerLoaded display name: " + player.getDisplayName() + " icon image uri: " + player.getIconImageUri().toString());
z = true;
} catch (Exception e) {
Logging.CC_ERROR(GooglePlayWorker.CLASSNAME, "onPlayerLoaded exception, message: " + e.toString());
e.printStackTrace();
}
}
StringBuilder sb = new StringBuilder();
sb.append("onPlayerLoaded ");
sb.append(z ? "SUCCESS" : "FAIL");
Logging.CC_TRACE(GooglePlayWorker.CLASSNAME, sb.toString());
synchronized (GooglePlayWorker.lock) {
try {
AnonymousClass4 anonymousClass4 = AnonymousClass4.this;
long j2 = j;
if (j2 != 0) {
GooglePlayWorker.this.LoadProfileCallback(z, strArr, j2);
}
} finally {
}
}
return;
}
Logging.CC_TRACE(GooglePlayWorker.CLASSNAME, "task failed: " + task.getException().getLocalizedMessage());
synchronized (GooglePlayWorker.lock) {
try {
AnonymousClass4 anonymousClass42 = AnonymousClass4.this;
long j3 = j;
if (j3 != 0) {
GooglePlayWorker.this.LoadProfileCallback(false, null, j3);
}
} finally {
}
}
}
});
}
});
}
}
public void LoadAvatar(final String str, final long j) {
Logging.CC_TRACE(CLASSNAME, "LoadAvatar -" + str);
final Activity GetActivity = CC_Component.GetActivity();
GetActivity.runOnUiThread(new Runnable() { // from class: com.firemonkeys.cloudcellapi.GooglePlayWorker.5
@Override // java.lang.Runnable
public void run() {
ImageManager.create(GetActivity.getApplicationContext()).loadImage(new ImageManager.OnImageLoadedListener() { // from class: com.firemonkeys.cloudcellapi.GooglePlayWorker.5.1
@Override // com.google.android.gms.common.images.ImageManager.OnImageLoadedListener
public void onImageLoaded(Uri uri, Drawable drawable, boolean z) {
byte[] bArr;
boolean z2;
if (drawable != null && z) {
try {
Bitmap bitmap = ((BitmapDrawable) drawable).getBitmap();
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
bitmap.compress(Bitmap.CompressFormat.PNG, 100, byteArrayOutputStream);
bArr = byteArrayOutputStream.toByteArray();
z2 = true;
} catch (Exception e) {
Logging.CC_ERROR(GooglePlayWorker.CLASSNAME, "LoadAvatar, '" + e.getMessage() + "' Cause: " + e.getCause());
}
Logging.CC_TRACE(GooglePlayWorker.CLASSNAME, "onImageLoaded - Finish");
AnonymousClass5 anonymousClass5 = AnonymousClass5.this;
GooglePlayWorker.this.LoadAvatarCallbackFunc(z2, bArr, j);
}
bArr = null;
z2 = false;
Logging.CC_TRACE(GooglePlayWorker.CLASSNAME, "onImageLoaded - Finish");
AnonymousClass5 anonymousClass52 = AnonymousClass5.this;
GooglePlayWorker.this.LoadAvatarCallbackFunc(z2, bArr, j);
}
}, Uri.parse(str));
}
});
}
public void LoadFriendVector(long j) {
Logging.CC_TRACE(CLASSNAME, "LoadFriendVector");
Logging.CC_TRACE(CLASSNAME, "LoadFriendVector not supported by Google Play");
LoadFriendVectorCallback(false, new String[0], new String[0], j);
}
public void LoadFriendVectorConnected(long j) {
Logging.CC_TRACE(CLASSNAME, "LoadFriendVectorConnected");
Logging.CC_TRACE(CLASSNAME, "LoadFriendVectorConnected not supported by Google Play");
LoadFriendVectorCallback(false, new String[0], new String[0], j);
}
public void Share(String str, String str2, String str3, String str4, String str5, String str6, byte[] bArr, String str7, String str8, String str9, final long j) {
CC_Component.GetActivity().runOnUiThread(new Runnable() { // from class: com.firemonkeys.cloudcellapi.GooglePlayWorker.6
@Override // java.lang.Runnable
public void run() {
synchronized (GooglePlayWorker.lock) {
GooglePlayWorker.m_nShareCallback = j;
}
Logging.CC_TRACE(GooglePlayWorker.CLASSNAME, "Share not supported by Google Play");
GooglePlayWorker.ShareCallback(false, false);
}
});
}
/* JADX INFO: Access modifiers changed from: private */
public static void ShareCallback(boolean z, boolean z2) {
synchronized (lock) {
try {
Logging.CC_TRACE(CLASSNAME, "ShareCallback. Success: " + z);
long j = m_nShareCallback;
if (j != 0) {
m_pGooglePlayWorker.ShareCallback(z, z2, j);
m_nShareCallback = 0L;
}
} catch (Throwable th) {
throw th;
}
}
}
public void UnlockAchievement(String str) {
Logging.CC_INFO(CLASSNAME, "Attempting to unlock Achievement:" + str);
PlayGames.getAchievementsClient(CC_Component.GetActivity()).unlock(str);
Logging.CC_TRACE(CLASSNAME, "getAchievementsClient unlock() called. AchievementId:" + str);
}
public void ShowAchievements() {
PlayGames.getAchievementsClient(CC_Component.GetActivity()).getAchievementsIntent().addOnSuccessListener(new OnSuccessListener<Intent>() { // from class: com.firemonkeys.cloudcellapi.GooglePlayWorker.7
@Override // com.google.android.gms.tasks.OnSuccessListener
public void onSuccess(Intent intent) {
CC_Component.GetActivity().startActivityForResult(intent, GooglePlayWorker.RC_ACHIEVEMENT_UI);
}
});
}
public void ResetAchievements() {
Logging.CC_TRACE(CLASSNAME, "Resetting achievements...");
if (m_pCredentialManager == null) {
return;
}
CC_Component.GetActivity().startActivityForResult(AccountPicker.newChooseAccountIntent(null, null, new String[]{"com.google"}, false, null, null, null, null), REQUEST_CODE_PICK_ACCOUNT);
}
public static void DoResetAchievements() {
Logging.CC_TRACE(CLASSNAME, "Actually resetting achievements...");
new Thread(new Runnable() { // from class: com.firemonkeys.cloudcellapi.GooglePlayWorker.8
@Override // java.lang.Runnable
public void run() {
try {
String idToken = GooglePlayWorker.m_pGoogleIdTokenCredential.getIdToken();
Logging.CC_TRACE(GooglePlayWorker.CLASSNAME, "ResetAchievements AccessToken:" + idToken);
Logging.CC_TRACE(GooglePlayWorker.CLASSNAME, EntityUtils.toString(FirebasePerfHttpClient.execute(new DefaultHttpClient(), new HttpPost("https://www.googleapis.com/games/v1management/achievements/reset?access_token=" + idToken)).getEntity()));
} catch (Exception e) {
Logging.CC_ERROR(GooglePlayWorker.CLASSNAME, "ResetAchievements exception.");
e.printStackTrace();
}
}
}).start();
}
public boolean GetLoginInProgress() {
Logging.CC_TRACE(CLASSNAME, "GetLoginInProgress() - m_pGoogleSignApiClient.isConnecting: " + m_bSignInFlow);
return m_bIsAuthenticated && m_bSignInFlow;
}
/* JADX INFO: Access modifiers changed from: private */
public static void CompleteInitialPhase() {
synchronized (lock) {
Logging.CC_TRACE(CLASSNAME, "Complete Initial Phase");
m_bIsInitialPhaseComplete = true;
}
}
public boolean GetSessionChanged() {
boolean z;
synchronized (lock) {
z = m_bLoginChanged;
m_bLoginChanged = false;
}
return z;
}
public String GetDisplayName() {
Player GetCurrentPlayer = GetCurrentPlayer();
return GetCurrentPlayer != null ? GetCurrentPlayer.getDisplayName() : "";
}
public String GetGooglePlusId() {
Player GetCurrentPlayer = GetCurrentPlayer();
return GetCurrentPlayer != null ? GetCurrentPlayer.getPlayerId() : "";
}
public String GetGooglePlusName() {
Player GetCurrentPlayer = GetCurrentPlayer();
return GetCurrentPlayer != null ? GetCurrentPlayer.getDisplayName() : "";
}
public String GetGooglePlayId() {
Player GetCurrentPlayer = GetCurrentPlayer();
String playerId = GetCurrentPlayer != null ? GetCurrentPlayer.getPlayerId() : "";
return playerId != null ? playerId : "";
}
public String GetGooglePlayName() {
Player GetCurrentPlayer = GetCurrentPlayer();
String displayName = GetCurrentPlayer != null ? GetCurrentPlayer.getDisplayName() : "";
return displayName != null ? displayName : "";
}
public boolean IsNativeAppInstalled() {
return GetInfo.DoesPackageExist("com.google.android.apps.plus");
}
private static void ClearTempDirectory() {
PurgeDirectory(GetTempDirectory());
}
private static void PurgeDirectory(File file) {
File[] listFiles;
if (file == null || (listFiles = file.listFiles()) == null) {
return;
}
for (File file2 : listFiles) {
file2.delete();
}
}
private static File GetTempDirectory() {
File cacheDir = CC_Component.GetActivity().getApplicationContext().getCacheDir();
if (cacheDir != null) {
File file = new File(cacheDir.getAbsolutePath() + "/GooglePlusShareTemp/");
if (file.exists() || file.mkdirs()) {
return file;
}
}
Logging.CC_ERROR(CLASSNAME, "Failed to create the temp directory");
return null;
}
}

View File

@@ -0,0 +1,116 @@
package com.firemonkeys.cloudcellapi;
import com.mbridge.msdk.newreward.function.common.MBridgeCommon;
import java.security.SecureRandom;
import java.util.List;
import java.util.Map;
import javax.net.ssl.HttpsURLConnection;
import javax.net.ssl.SSLContext;
import javax.net.ssl.TrustManager;
import org.apache.http.conn.ssl.SSLSocketFactory;
/* loaded from: classes2.dex */
public class HttpRequest {
private static final String CLASSNAME = "HttpRequest";
private static boolean s_sslContextInit;
public static String s_userAgent;
HttpThread m_thread = null;
private double m_serverTime = 0.0d;
private boolean m_bSSLCheck = false;
private int m_TimeoutMilliseconds = MBridgeCommon.DEFAULT_LOAD_TIMEOUT;
public native void completeCallback(long j, int i);
public native void dataCallback(long j, byte[] bArr, int i);
public native void errorCallback(long j, int i);
public boolean getSSLCheck() {
return this.m_bSSLCheck;
}
public double getServerTime() {
return this.m_serverTime;
}
public int getTimeoutMilliseconds() {
return this.m_TimeoutMilliseconds;
}
public native void headerCallback(long j, int i, Map<String, List<String>> map);
public boolean isClosed() {
return this.m_thread == null;
}
public HttpRequest() {
System.setProperty("http.keepAlive", "false");
}
public void init(String str, String str2, String str3, byte[] bArr, int i, long j, boolean z, double d, boolean z2, boolean z3, int i2) {
this.m_serverTime = d;
this.m_bSSLCheck = z2;
if (i2 > 0) {
this.m_TimeoutMilliseconds = i2 * 1000;
}
initSSLContext();
initUserAgent(str);
this.m_thread = new HttpThread(this, str2, str3, bArr, i, j, z, z3);
}
public void setClosedBySSLCheck(boolean z) {
this.m_thread.setClosedBySSLCheck(z);
}
public void shutdown() {
HttpThread httpThread = this.m_thread;
if (httpThread != null) {
httpThread.shutdown();
}
}
public void addHeader(String str, String str2) {
this.m_thread.addHeader(str, str2);
}
public void post() {
HttpThread httpThread = this.m_thread;
if (httpThread == null) {
Logging.CC_ERROR(CLASSNAME, "post() called but thread is already closed");
} else if (httpThread.isAlive()) {
Logging.CC_ERROR(CLASSNAME, "post() called but thread is already running");
} else {
this.m_thread.start();
}
}
public void close() {
HttpThread httpThread = this.m_thread;
if (httpThread != null) {
httpThread.interrupt();
}
this.m_thread = null;
}
private static void initUserAgent(String str) {
if (s_userAgent != null) {
return;
}
s_userAgent = str + " " + System.getProperty("http.agent");
StringBuilder sb = new StringBuilder();
sb.append("User Agent: ");
sb.append(s_userAgent);
Logging.CC_INFO(CLASSNAME, sb.toString());
}
private void initSSLContext() {
try {
SSLContext sSLContext = SSLContext.getInstance("TLS");
sSLContext.init(null, new TrustManager[]{new CloudcellTrustManager(this)}, new SecureRandom());
HttpsURLConnection.setDefaultSSLSocketFactory(new TLSSocketFactory(sSLContext.getSocketFactory()));
HttpsURLConnection.setDefaultHostnameVerifier(SSLSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER);
} catch (Exception unused) {
Logging.CC_ERROR(CLASSNAME, "Exception when trying to init SSLContext!");
}
}
}

View File

@@ -0,0 +1,154 @@
package com.firemonkeys.cloudcellapi;
import com.google.firebase.perf.network.FirebasePerfUrlConnection;
import com.ironsource.v8;
import java.io.IOException;
import java.io.InputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLConnection;
import java.util.HashMap;
import java.util.Map;
import org.apache.http.protocol.HTTP;
/* loaded from: classes2.dex */
class HttpThread extends Thread {
private static final String CLASSNAME = "HttpRequest";
private boolean m_addDefaultHeaders;
private long m_callbackPointer;
private byte[] m_data;
private boolean m_failOnErrorStatus;
private String m_method;
HttpRequest m_post;
private int m_readCapacity;
private String m_url;
private Map<String, String> m_mHeaders = new HashMap();
private boolean m_bClosedBySSLCheck = false;
private int m_HttpStatus = 0;
public void setClosedBySSLCheck(boolean z) {
this.m_bClosedBySSLCheck = z;
}
public HttpThread(HttpRequest httpRequest, String str, String str2, byte[] bArr, int i, long j, boolean z, boolean z2) {
this.m_post = null;
this.m_method = "";
this.m_url = "";
this.m_data = null;
this.m_readCapacity = 0;
this.m_callbackPointer = 0L;
this.m_failOnErrorStatus = false;
this.m_addDefaultHeaders = false;
this.m_post = httpRequest;
this.m_method = str;
this.m_url = str2;
this.m_data = bArr;
this.m_readCapacity = i;
this.m_callbackPointer = j;
this.m_failOnErrorStatus = z;
this.m_addDefaultHeaders = z2;
}
public void addHeader(String str, String str2) {
this.m_mHeaders.put(str, str2);
}
public void shutdown() {
interrupt();
}
public HttpURLConnection GetHttpConnection(URL url) throws IOException {
HttpURLConnection httpURLConnection = (HttpURLConnection) ((URLConnection) FirebasePerfUrlConnection.instrument(url.openConnection()));
httpURLConnection.setConnectTimeout(this.m_post.getTimeoutMilliseconds());
httpURLConnection.setReadTimeout(this.m_post.getTimeoutMilliseconds());
httpURLConnection.setUseCaches(false);
httpURLConnection.setDoInput(true);
for (Map.Entry<String, String> entry : this.m_mHeaders.entrySet()) {
httpURLConnection.addRequestProperty(entry.getKey().toString(), entry.getValue().toString());
}
httpURLConnection.addRequestProperty("User-Agent", HttpRequest.s_userAgent);
httpURLConnection.setRequestMethod(this.m_method);
if (this.m_data.length > 0) {
httpURLConnection.setDoOutput(true);
httpURLConnection.setFixedLengthStreamingMode(this.m_data.length);
if (this.m_addDefaultHeaders) {
httpURLConnection.setRequestProperty(HTTP.CONTENT_LEN, Integer.toString(this.m_data.length));
httpURLConnection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
} else if (!this.m_mHeaders.containsKey("Content-Type")) {
httpURLConnection.setRequestProperty("Content-Type", "");
}
}
return httpURLConnection;
}
public boolean ReadHttpData(HttpURLConnection httpURLConnection, InputStream inputStream) throws IOException {
if (inputStream == null) {
Logging.CC_ERROR(CLASSNAME, "ReadHttpData failed, no input stream");
return false;
}
String headerField = httpURLConnection.getHeaderField(HTTP.CONTENT_LEN);
this.m_post.headerCallback(this.m_callbackPointer, headerField != null ? Integer.parseInt(headerField) : 0, httpURLConnection.getHeaderFields());
byte[] bArr = new byte[this.m_readCapacity];
while (true) {
int read = inputStream.read(bArr);
if (read == -1) {
return false;
}
if (isInterrupted()) {
Logging.CC_WARNING(CLASSNAME, "HTTP thread interrupted");
return true;
}
this.m_post.dataCallback(this.m_callbackPointer, bArr, read);
}
}
public boolean ReadErrors(HttpURLConnection httpURLConnection) {
try {
InputStream errorStream = httpURLConnection.getErrorStream();
this.m_HttpStatus = httpURLConnection.getResponseCode();
Logging.CC_TRACE(CLASSNAME, "ReadErrors [ErrorResponseCode=" + this.m_HttpStatus + v8.i.e);
if (errorStream == null) {
return false;
}
if (this.m_failOnErrorStatus && this.m_HttpStatus >= 400) {
errorStream.close();
return false;
}
byte[] bArr = new byte[this.m_readCapacity];
while (true) {
int read = errorStream.read(bArr);
if (read != -1) {
if (isInterrupted()) {
Logging.CC_WARNING(CLASSNAME, "HTTP thread interrupted");
errorStream.close();
return true;
}
this.m_post.dataCallback(this.m_callbackPointer, bArr, read);
} else {
errorStream.close();
break;
}
}
} catch (IOException e) {
Logging.CC_ERROR(CLASSNAME, "Error processing HTTP error stream, '" + e.getMessage() + "' Cause: " + e.getCause());
}
return false;
}
/* JADX WARN: Removed duplicated region for block: B:23:0x0154 */
/* JADX WARN: Removed duplicated region for block: B:26:0x015b A[ADDED_TO_REGION] */
/* JADX WARN: Removed duplicated region for block: B:28:0x0163 */
/* JADX WARN: Removed duplicated region for block: B:32:0x016d */
@Override // java.lang.Thread, java.lang.Runnable
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
public void run() {
/*
Method dump skipped, instructions count: 377
To view this dump add '--comments-level debug' option
*/
throw new UnsupportedOperationException("Method not decompiled: com.firemonkeys.cloudcellapi.HttpThread.run():void");
}
}

View File

@@ -0,0 +1,293 @@
package com.firemonkeys.cloudcellapi;
import android.annotation.TargetApi;
import android.app.Activity;
import android.app.AlarmManager;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
import androidx.core.app.NotificationCompat;
import com.google.android.gms.drive.DriveFile;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import org.json.JSONArray;
import org.json.JSONObject;
/* loaded from: classes2.dex */
public class LocalNotificationsCenter {
private static String CLASSNAME = "LocalNotificationsCenter";
public static final String EXTRA_CHANNEL_ID = "channel";
public static final String EXTRA_FIRE_TIME = "firetime";
public static final String EXTRA_ID = "id";
public static final String EXTRA_LAUNCH_URL = "launchURL";
public static final String EXTRA_LAUNCH_URL_MP_INVITE = "MultiplayerInvite";
public static final String EXTRA_LAUNCH_URL_RT_ADMIN = "RaceTeamsAdmin";
public static final String EXTRA_MESSAGE = "message";
public static final String EXTRA_NAME = "name";
public static final String EXTRA_REMINDER = "reminder";
static final String FILENAME = ResourceHelper.GetNotificationsFilename();
private static HashMap<LocalNotification, PendingIntent> mNotificationsIntent = new HashMap<>();
private static Context broadcastContext = null;
public static class LocalNotification {
public String mChannel;
public long mFireTime;
public int mId;
public String mMessage;
public String mName;
public int mReminderRemain;
public String mURL;
public JSONObject Serialise() {
JSONObject jSONObject = new JSONObject();
try {
jSONObject.put("id", this.mId);
jSONObject.put("name", this.mName);
jSONObject.put("firetime", this.mFireTime);
jSONObject.put("message", this.mMessage);
jSONObject.put(LocalNotificationsCenter.EXTRA_LAUNCH_URL, this.mURL);
jSONObject.put("reminder", this.mReminderRemain);
jSONObject.put(LocalNotificationsCenter.EXTRA_CHANNEL_ID, this.mChannel);
} catch (Exception e) {
Logging.CC_ERROR(LocalNotificationsCenter.CLASSNAME, e.getMessage());
}
return jSONObject;
}
public void Serialise(JSONObject jSONObject) {
try {
this.mId = jSONObject.optInt("id");
this.mName = jSONObject.optString("name");
this.mFireTime = jSONObject.optLong("firetime");
this.mMessage = jSONObject.optString("message");
this.mURL = jSONObject.optString(LocalNotificationsCenter.EXTRA_LAUNCH_URL);
this.mReminderRemain = jSONObject.optInt("reminder");
this.mChannel = jSONObject.optString(LocalNotificationsCenter.EXTRA_CHANNEL_ID);
} catch (Exception e) {
Logging.CC_ERROR(LocalNotificationsCenter.CLASSNAME, e.getMessage());
}
}
public LocalNotification(JSONObject jSONObject) {
this.mReminderRemain = -1;
Serialise(jSONObject);
}
public LocalNotification(int i, String str, String str2, String str3) {
this.mReminderRemain = -1;
this.mId = i;
this.mName = str;
this.mMessage = str2;
this.mURL = str3;
this.mChannel = "";
}
public LocalNotification(int i, String str, String str2, String str3, String str4) {
this.mReminderRemain = -1;
this.mId = i;
this.mName = str;
this.mMessage = str2;
this.mURL = str3;
this.mChannel = str4;
}
}
private static Context getStaticContext() {
Activity GetActivity = CC_Component.GetActivity();
return GetActivity != null ? GetActivity.getApplicationContext() : broadcastContext;
}
@TargetApi(19)
public static PendingIntent CreateNotificationIntent(LocalNotification localNotification) {
Context applicationContext = CC_Component.GetActivity().getApplicationContext();
Intent intent = new Intent(applicationContext, (Class<?>) DelayedNotificationService.class);
intent.setType("type" + localNotification.mName);
intent.putExtra("message", localNotification.mMessage);
intent.putExtra("id", localNotification.mId);
int i = localNotification.mReminderRemain;
if (i != -1) {
intent.putExtra("reminder", i);
}
if (localNotification.mURL.length() > 0) {
intent.putExtra(EXTRA_LAUNCH_URL, localNotification.mURL);
}
intent.putExtra(EXTRA_CHANNEL_ID, localNotification.mChannel);
return PendingIntent.getService(applicationContext, 0, intent, 201326592);
}
@TargetApi(19)
public static void showNotification(LocalNotification localNotification) {
if (localNotification == null) {
return;
}
PendingIntent CreateNotificationIntent = CreateNotificationIntent(localNotification);
try {
((AlarmManager) CC_Component.GetActivity().getApplicationContext().getSystemService(NotificationCompat.CATEGORY_ALARM)).set(0, localNotification.mFireTime, CreateNotificationIntent);
} catch (Exception e) {
Logging.CC_ERROR(CLASSNAME, "showNotification: failed to set alarm: " + e.toString());
}
mNotificationsIntent.put(localNotification, CreateNotificationIntent);
SaveNotifications();
}
@TargetApi(19)
public static void showNotification(int i, String str, long j, String str2, String str3) {
if (str3 == null) {
str3 = "";
}
LocalNotification localNotification = new LocalNotification(i, str, str2, str3);
localNotification.mFireTime = j;
Logging.CC_INFO(CLASSNAME, "showNotification id: " + i + " name: " + str + " delay: " + j + " msg: " + str2);
String str4 = CLASSNAME;
StringBuilder sb = new StringBuilder();
sb.append("showNotification current time: ");
sb.append(System.currentTimeMillis());
Logging.CC_INFO(str4, sb.toString());
Logging.CC_INFO(CLASSNAME, "showNotification fire time: " + localNotification.mFireTime);
Logging.CC_INFO(CLASSNAME, "showNotification url: " + str3);
Logging.CC_INFO(CLASSNAME, "showNotification channel empty ");
showNotification(localNotification);
}
@TargetApi(26)
public static void showNotification(int i, String str, long j, String str2, String str3, String str4) {
if (str3 == null) {
str3 = "";
}
LocalNotification localNotification = new LocalNotification(i, str, str2, str3, str4);
localNotification.mFireTime = j;
Logging.CC_INFO(CLASSNAME, "showNotification id: " + i + " name: " + str + " delay: " + j + " msg: " + str2);
String str5 = CLASSNAME;
StringBuilder sb = new StringBuilder();
sb.append("showNotification current time: ");
sb.append(System.currentTimeMillis());
Logging.CC_INFO(str5, sb.toString());
Logging.CC_INFO(CLASSNAME, "showNotification fire time: " + localNotification.mFireTime);
Logging.CC_INFO(CLASSNAME, "showNotification url: " + str3);
Logging.CC_INFO(CLASSNAME, "showNotification channel: " + str4);
showNotification(localNotification);
}
public static void CancelAllNotifications() {
Logging.CC_TRACE(CLASSNAME, "CancelAllNotifications: start");
if (mNotificationsIntent.size() <= 0) {
LoadNotifications(false);
}
Context staticContext = getStaticContext();
((NotificationManager) staticContext.getSystemService("notification")).cancelAll();
Iterator<T> it = mNotificationsIntent.keySet().iterator();
while (it.hasNext()) {
CancelNotification((LocalNotification) it.next());
}
mNotificationsIntent.clear();
SaveNotifications();
Logging.CC_TRACE(CLASSNAME, "CancelAllNotifications: end");
SerialiseNotificationsHelper.ClearAll(staticContext);
}
public static void CancelNotification(LocalNotification localNotification) {
Context staticContext = getStaticContext();
NotificationManager notificationManager = (NotificationManager) staticContext.getSystemService("notification");
AlarmManager alarmManager = (AlarmManager) staticContext.getSystemService(NotificationCompat.CATEGORY_ALARM);
PendingIntent pendingIntent = mNotificationsIntent.get(localNotification);
if (pendingIntent == null) {
pendingIntent = CreateNotificationIntent(localNotification);
}
try {
Logging.CC_INFO(CLASSNAME, "Cancelling notification: " + localNotification.mId);
notificationManager.cancel(localNotification.mId);
if (pendingIntent != null) {
alarmManager.cancel(pendingIntent);
pendingIntent.cancel();
}
} catch (Exception e) {
Logging.CC_ERROR(CLASSNAME, "CancelNotification: failed to cancel alarm: " + e.toString());
}
}
public static void CancelNotification(int i, String str) {
Context staticContext = getStaticContext();
AlarmManager alarmManager = (AlarmManager) staticContext.getSystemService(NotificationCompat.CATEGORY_ALARM);
Intent intent = new Intent(staticContext, (Class<?>) DelayedNotificationService.class);
intent.setType("type" + str);
PendingIntent service = PendingIntent.getService(staticContext, 0, intent, DriveFile.MODE_READ_ONLY);
try {
((NotificationManager) staticContext.getSystemService("notification")).cancel(i);
alarmManager.cancel(service);
} catch (Exception e) {
Logging.CC_ERROR(CLASSNAME, "CancelNotification: failed to cancel alarm: " + e.toString());
}
}
public static void SetAreNotificationsAllowed(boolean z) {
SerialiseNotificationsHelper.SetAreNotificationsAllowed(getStaticContext(), z);
if (z) {
return;
}
CancelAllNotifications();
}
public static void SaveNotifications() {
SaveNotifications(mNotificationsIntent.keySet());
}
public static void SaveNotifications(Iterable<LocalNotification> iterable) {
Logging.CC_INFO(CLASSNAME, "SaveNotifications() Num:" + mNotificationsIntent.size());
try {
JSONArray jSONArray = new JSONArray();
Iterator<LocalNotification> it = iterable.iterator();
while (it.hasNext()) {
jSONArray.put(it.next().Serialise());
}
FileOutputStream fileOutputStream = new FileOutputStream(new File(getStaticContext().getFilesDir(), FILENAME));
ObjectOutputStream objectOutputStream = new ObjectOutputStream(fileOutputStream);
objectOutputStream.writeObject(jSONArray.toString());
objectOutputStream.close();
fileOutputStream.close();
} catch (Exception e) {
Logging.CC_ERROR(CLASSNAME, "SaveNotifications failed: " + e.toString());
}
}
public static void LoadNotifications(boolean z) {
for (LocalNotification localNotification : LoadNotifications()) {
if (z) {
showNotification(localNotification);
} else {
mNotificationsIntent.put(localNotification, null);
}
}
}
public static Iterable<LocalNotification> LoadNotifications() {
ArrayList arrayList = new ArrayList();
Logging.CC_INFO(CLASSNAME, "LoadNotifications()");
try {
File file = new File(getStaticContext().getFilesDir(), FILENAME);
if (file.exists()) {
Logging.CC_INFO(CLASSNAME, "Found saved file. Loading information");
FileInputStream fileInputStream = new FileInputStream(file);
ObjectInputStream objectInputStream = new ObjectInputStream(fileInputStream);
String str = (String) objectInputStream.readObject();
objectInputStream.close();
fileInputStream.close();
JSONArray jSONArray = new JSONArray(str);
for (int i = 0; i < jSONArray.length(); i++) {
arrayList.add(new LocalNotification(jSONArray.getJSONObject(i)));
}
} else {
Logging.CC_ERROR(CLASSNAME, "File not found");
}
} catch (Exception e) {
Logging.CC_ERROR(CLASSNAME, "LoadNotifications failed: " + e.toString());
}
return arrayList;
}
}

View File

@@ -0,0 +1,59 @@
package com.firemonkeys.cloudcellapi;
import android.util.Log;
import com.ironsource.v8;
/* loaded from: classes2.dex */
public class Logging {
private static final String LOG_NAMESPACE = "CCJ";
private static boolean m_Debug;
private static boolean m_Logging;
public static void setDebugLogging(boolean z) {
m_Debug = z;
}
public static void setLogging(boolean z) {
m_Logging = z;
}
public static void enableDebugLogging() {
setDebugLogging(true);
}
public static void enableLogging() {
setLogging(true);
}
public static void CC_TRACE(Object obj, String str) {
if (m_Logging && m_Debug) {
StringBuilder sb = new StringBuilder();
sb.append(v8.i.d);
sb.append(obj.toString());
sb.append("] ");
sb.append(str);
}
}
public static void CC_INFO(Object obj, String str) {
if (m_Logging && m_Debug) {
StringBuilder sb = new StringBuilder();
sb.append(v8.i.d);
sb.append(obj.toString());
sb.append("] ");
sb.append(str);
}
}
public static void CC_WARNING(Object obj, String str) {
if (m_Logging) {
Log.w(LOG_NAMESPACE, v8.i.d + obj.toString() + "] " + str);
}
}
public static void CC_ERROR(Object obj, String str) {
if (m_Logging) {
Log.e(LOG_NAMESPACE, v8.i.d + obj.toString() + "] " + str);
}
}
}

View File

@@ -0,0 +1,49 @@
package com.firemonkeys.cloudcellapi;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
/* loaded from: classes2.dex */
public class NetworkStatusMonitor extends BroadcastReceiver {
private static final String CLASSNAME = "NetworkStatusMonitor";
public static final int CONNECTION_TYPE_CARRIER = 4;
public static final int CONNECTION_TYPE_ETHERNET = 6;
public static final int CONNECTION_TYPE_NONE = 1;
public static final int CONNECTION_TYPE_TRANSIENT_CARRIER = 5;
public static final int CONNECTION_TYPE_TRANSIENT_WIFI = 3;
public static final int CONNECTION_TYPE_UNKNOWN = 0;
public static final int CONNECTION_TYPE_WIFI = 2;
public static final int NUM_CONNECTION_TYPE = 7;
public static native void ReachabilityCallbackJNI(int i);
@Override // android.content.BroadcastReceiver
public void onReceive(Context context, Intent intent) {
try {
ReachabilityCallbackJNI(getNetworkConnectivity(context));
} catch (UnsatisfiedLinkError unused) {
}
}
public static int getNetworkConnectivity(Context context) {
NetworkInfo activeNetworkInfo = ((ConnectivityManager) context.getSystemService("connectivity")).getActiveNetworkInfo();
if (activeNetworkInfo != null && activeNetworkInfo.isConnected()) {
int type = activeNetworkInfo.getType();
if (type == 1) {
Logging.CC_TRACE(CLASSNAME, "getNetworkConnectivity() - CONNECTION_TYPE_WIFI");
return 2;
}
if (type == 9) {
Logging.CC_TRACE(CLASSNAME, "getNetworkConnectivity() - CONNECTION_TYPE_ETHERNET");
return 6;
}
Logging.CC_TRACE(CLASSNAME, "getNetworkConnectivity() - CONNECTION_TYPE_CARRIER");
return 4;
}
Logging.CC_TRACE(CLASSNAME, "getNetworkConnectivity() - CONNECTION_TYPE_NONE");
return 1;
}
}

View File

@@ -0,0 +1,32 @@
package com.firemonkeys.cloudcellapi;
/* loaded from: classes2.dex */
public class ResourceHelper {
public static String GetDelayedNotificationServiceTag() {
return "RR3_DelayedNotificationService";
}
public static String GetGroupKey() {
return "RR3_NOTIFICATION_GROUP";
}
public static String GetIconID() {
return "icon_notification";
}
public static String GetNotificationsFilename() {
return "notifications.dat";
}
public static String GetPastNotificationsFilename() {
return "pastNotifications.bin";
}
public static String GetSerialisedNotificationHelper() {
return "RR3_SerialiseNotificationsHelper";
}
public static String GetSerialisedNotificationInfo() {
return "RR3_SerialisedNotificationInfo";
}
}

View File

@@ -0,0 +1,161 @@
package com.firemonkeys.cloudcellapi;
import android.text.TextUtils;
import com.facebook.gamingservices.cloudgaming.internal.SDKConstants;
import com.firemonkeys.cloudcellapi.Consts;
import com.firemonkeys.cloudcellapi.util.Base64;
import com.firemonkeys.cloudcellapi.util.Base64DecoderException;
import com.unity3d.ads.core.domain.HandleInvocationsFromAdViewer;
import com.unity3d.ads.metadata.InAppPurchaseMetaData;
import java.security.InvalidKeyException;
import java.security.KeyFactory;
import java.security.NoSuchAlgorithmException;
import java.security.PublicKey;
import java.security.SecureRandom;
import java.security.Signature;
import java.security.SignatureException;
import java.security.spec.InvalidKeySpecException;
import java.security.spec.X509EncodedKeySpec;
import java.util.ArrayList;
import java.util.HashSet;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
/* loaded from: classes2.dex */
public class Security {
private static final String CLASSNAME = "Security";
private static final String KEY_FACTORY_ALGORITHM = "RSA";
private static final String SIGNATURE_ALGORITHM = "SHA1withRSA";
private static final SecureRandom RANDOM = new SecureRandom();
private static HashSet<Long> sKnownNonces = new HashSet<>();
public static class VerifiedPurchase {
public String developerPayload;
public String notificationId;
public String orderId;
public String packageName;
public String productId;
public Consts.PurchaseState purchaseState;
public long purchaseTime;
public VerifiedPurchase(Consts.PurchaseState purchaseState, String str, String str2, String str3, String str4, long j, String str5) {
this.purchaseState = purchaseState;
this.notificationId = str;
this.productId = str2;
this.orderId = str3;
this.packageName = str4;
this.purchaseTime = j;
this.developerPayload = str5;
}
}
public static long generateNonce() {
long nextLong = RANDOM.nextLong();
sKnownNonces.add(Long.valueOf(nextLong));
return nextLong;
}
public static void removeNonce(long j) {
sKnownNonces.remove(Long.valueOf(j));
}
public static boolean isNonceKnown(long j) {
return sKnownNonces.contains(Long.valueOf(j));
}
public static ArrayList<VerifiedPurchase> getVerifiedPurchaseList(String str, String str2, String str3) {
boolean z;
if (str == null) {
Logging.CC_ERROR(CLASSNAME, "public key is null");
return null;
}
if (str2 == null) {
Logging.CC_ERROR(CLASSNAME, "data is null");
return null;
}
Logging.CC_INFO(CLASSNAME, "signedData: " + str2);
if (TextUtils.isEmpty(str3)) {
z = false;
} else {
z = verify(generatePublicKey(str), str2, str3);
if (!z) {
Logging.CC_WARNING(CLASSNAME, "signature does not match data.");
return null;
}
}
try {
JSONObject jSONObject = new JSONObject(str2);
long optLong = jSONObject.optLong("nonce");
JSONArray optJSONArray = jSONObject.optJSONArray("orders");
int length = optJSONArray != null ? optJSONArray.length() : 0;
if (!isNonceKnown(optLong)) {
Logging.CC_WARNING(CLASSNAME, "Nonce not found: " + optLong);
return null;
}
ArrayList<VerifiedPurchase> arrayList = new ArrayList<>();
for (int i = 0; i < length; i++) {
try {
JSONObject jSONObject2 = optJSONArray.getJSONObject(i);
Consts.PurchaseState valueOf = Consts.PurchaseState.valueOf(jSONObject2.getInt("purchaseState"));
String string = jSONObject2.getString(InAppPurchaseMetaData.KEY_PRODUCT_ID);
String string2 = jSONObject2.getString(HandleInvocationsFromAdViewer.KEY_PACKAGE_NAME);
long j = jSONObject2.getLong("purchaseTime");
String optString = jSONObject2.optString("orderId", "");
String string3 = jSONObject2.has("notificationId") ? jSONObject2.getString("notificationId") : null;
String optString2 = jSONObject2.optString(SDKConstants.PARAM_DEVELOPER_PAYLOAD, null);
if (valueOf != Consts.PurchaseState.PURCHASED || z) {
arrayList.add(new VerifiedPurchase(valueOf, string3, string, optString, string2, j, optString2));
}
} catch (JSONException e) {
Logging.CC_ERROR(CLASSNAME, "JSON exception: " + e.toString());
return null;
}
}
removeNonce(optLong);
return arrayList;
} catch (JSONException unused) {
return null;
}
}
public static PublicKey generatePublicKey(String str) {
try {
return KeyFactory.getInstance(KEY_FACTORY_ALGORITHM).generatePublic(new X509EncodedKeySpec(Base64.decode(str)));
} catch (Base64DecoderException e) {
Logging.CC_ERROR(CLASSNAME, "Base64 decoding failed.");
throw new IllegalArgumentException(e);
} catch (NoSuchAlgorithmException e2) {
throw new RuntimeException(e2);
} catch (InvalidKeySpecException e3) {
Logging.CC_ERROR(CLASSNAME, "Invalid key specification.");
throw new IllegalArgumentException(e3);
}
}
public static boolean verify(PublicKey publicKey, String str, String str2) {
Logging.CC_INFO(CLASSNAME, "signature: " + str2);
try {
Signature signature = Signature.getInstance(SIGNATURE_ALGORITHM);
signature.initVerify(publicKey);
signature.update(str.getBytes());
if (signature.verify(Base64.decode(str2))) {
return true;
}
Logging.CC_ERROR(CLASSNAME, "Signature verification failed.");
return false;
} catch (Base64DecoderException unused) {
Logging.CC_ERROR(CLASSNAME, "Base64 decoding failed.");
return false;
} catch (InvalidKeyException unused2) {
Logging.CC_ERROR(CLASSNAME, "Invalid key specification.");
return false;
} catch (NoSuchAlgorithmException unused3) {
Logging.CC_ERROR(CLASSNAME, "NoSuchAlgorithmException.");
return false;
} catch (SignatureException unused4) {
Logging.CC_ERROR(CLASSNAME, "Signature exception.");
return false;
}
}
}

View File

@@ -0,0 +1,81 @@
package com.firemonkeys.cloudcellapi;
import android.content.Context;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
/* loaded from: classes2.dex */
public class SerialiseNotificationsHelper {
static boolean bLog;
static final String TAG = ResourceHelper.GetSerialisedNotificationHelper();
static final String PATH = ResourceHelper.GetPastNotificationsFilename();
public static void Log(String str) {
}
public static void AddNotification(Context context, String str) {
SerialisedNotificationInfo LoadInformation = LoadInformation(context);
LoadInformation.AddNotification(str);
SaveInformation(context, LoadInformation);
}
public static void ClearAll(Context context) {
SerialisedNotificationInfo LoadInformation = LoadInformation(context);
LoadInformation.ClearAll();
SaveInformation(context, LoadInformation);
}
private static void SaveInformation(Context context, SerialisedNotificationInfo serialisedNotificationInfo) {
try {
FileOutputStream fileOutputStream = new FileOutputStream(new File(context.getFilesDir(), PATH));
ObjectOutputStream objectOutputStream = new ObjectOutputStream(fileOutputStream);
objectOutputStream.writeObject(serialisedNotificationInfo);
objectOutputStream.close();
fileOutputStream.close();
} catch (Exception unused) {
}
serialisedNotificationInfo.Print("Saved Information");
}
private static SerialisedNotificationInfo LoadInformation(Context context) {
Log("Attempting to load saved information");
SerialisedNotificationInfo serialisedNotificationInfo = new SerialisedNotificationInfo();
try {
File file = new File(context.getFilesDir(), PATH);
if (file.exists()) {
Log("Found saved file. Loading information");
FileInputStream fileInputStream = new FileInputStream(file);
ObjectInputStream objectInputStream = new ObjectInputStream(fileInputStream);
SerialisedNotificationInfo serialisedNotificationInfo2 = (SerialisedNotificationInfo) objectInputStream.readObject();
try {
objectInputStream.close();
fileInputStream.close();
} catch (Exception unused) {
}
serialisedNotificationInfo = serialisedNotificationInfo2;
} else {
Log("Saved file doesn't exist. Returning new file");
}
} catch (Exception unused2) {
}
serialisedNotificationInfo.Print("Loaded Information");
return serialisedNotificationInfo;
}
public static SerialisedNotificationInfo GetSavedInfo(Context context) {
return LoadInformation(context);
}
public static boolean AreNotificationsAllowed(Context context) {
return LoadInformation(context).AreNotificationsAllowed();
}
public static void SetAreNotificationsAllowed(Context context, boolean z) {
SerialisedNotificationInfo LoadInformation = LoadInformation(context);
LoadInformation.SetAreNotificationsAllowed(z);
SaveInformation(context, LoadInformation);
}
}

View File

@@ -0,0 +1,55 @@
package com.firemonkeys.cloudcellapi;
import java.io.Serializable;
import java.util.Vector;
/* loaded from: classes2.dex */
public class SerialisedNotificationInfo implements Serializable {
static final boolean s_bLog = false;
int nVersion = 2;
private Vector<String> m_vsNotifications = new Vector<>();
private boolean m_bNotificationsAllowed = true;
public boolean AreNotificationsAllowed() {
return this.m_bNotificationsAllowed;
}
public void LOG(String str) {
}
public void SetAreNotificationsAllowed(boolean z) {
this.m_bNotificationsAllowed = z;
}
public void Print(String str) {
LOG(str);
LOG("Notification count = " + this.m_vsNotifications);
for (int i = 0; i < this.m_vsNotifications.size(); i++) {
LOG("Notification (" + i + ") = " + this.m_vsNotifications.get(i));
}
LOG("-----");
}
public final int GetNotificationCount() {
LOG("Notification size = " + this.m_vsNotifications.size());
return this.m_vsNotifications.size();
}
public final String GetNotificationString(int i) throws Exception {
if (i >= 0 && i < this.m_vsNotifications.size()) {
LOG("Notification at index (" + i + ") = " + this.m_vsNotifications.get(i));
return this.m_vsNotifications.get(i);
}
throw new Exception("Trying to get a notification form an invalid index!");
}
public void AddNotification(String str) {
LOG("Add notification to the vector (" + str + ")");
this.m_vsNotifications.add(str);
}
public void ClearAll() {
LOG("Clear all notifications from vector");
this.m_vsNotifications.clear();
}
}

View File

@@ -0,0 +1,79 @@
package com.firemonkeys.cloudcellapi;
import java.io.IOException;
import java.net.InetAddress;
import java.net.Socket;
import java.net.UnknownHostException;
import java.security.KeyManagementException;
import java.security.NoSuchAlgorithmException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import javax.net.ssl.SSLSocket;
import javax.net.ssl.SSLSocketFactory;
/* loaded from: classes2.dex */
class TLSSocketFactory extends SSLSocketFactory {
private SSLSocketFactory internalSSLSocketFactory;
public TLSSocketFactory(SSLSocketFactory sSLSocketFactory) throws KeyManagementException, NoSuchAlgorithmException {
this.internalSSLSocketFactory = sSLSocketFactory;
}
@Override // javax.net.ssl.SSLSocketFactory
public String[] getDefaultCipherSuites() {
return this.internalSSLSocketFactory.getDefaultCipherSuites();
}
@Override // javax.net.ssl.SSLSocketFactory
public String[] getSupportedCipherSuites() {
return this.internalSSLSocketFactory.getSupportedCipherSuites();
}
@Override // javax.net.SocketFactory
public Socket createSocket() throws IOException {
return enableTLSOnSocket(this.internalSSLSocketFactory.createSocket());
}
@Override // javax.net.ssl.SSLSocketFactory
public Socket createSocket(Socket socket, String str, int i, boolean z) throws IOException {
return enableTLSOnSocket(this.internalSSLSocketFactory.createSocket(socket, str, i, z));
}
@Override // javax.net.SocketFactory
public Socket createSocket(String str, int i) throws IOException, UnknownHostException {
return enableTLSOnSocket(this.internalSSLSocketFactory.createSocket(str, i));
}
@Override // javax.net.SocketFactory
public Socket createSocket(String str, int i, InetAddress inetAddress, int i2) throws IOException, UnknownHostException {
return enableTLSOnSocket(this.internalSSLSocketFactory.createSocket(str, i, inetAddress, i2));
}
@Override // javax.net.SocketFactory
public Socket createSocket(InetAddress inetAddress, int i) throws IOException {
return enableTLSOnSocket(this.internalSSLSocketFactory.createSocket(inetAddress, i));
}
@Override // javax.net.SocketFactory
public Socket createSocket(InetAddress inetAddress, int i, InetAddress inetAddress2, int i2) throws IOException {
return enableTLSOnSocket(this.internalSSLSocketFactory.createSocket(inetAddress, i, inetAddress2, i2));
}
private Socket enableTLSOnSocket(Socket socket) {
String[] strArr = {"TLSv1.2", "TLSv1.1"};
if (socket != null && (socket instanceof SSLSocket)) {
SSLSocket sSLSocket = (SSLSocket) socket;
ArrayList arrayList = new ArrayList(Arrays.asList(sSLSocket.getEnabledProtocols()));
List asList = Arrays.asList(sSLSocket.getSupportedProtocols());
for (int i = 0; i < 2; i++) {
String str = strArr[i];
if (asList.contains(str) && !arrayList.contains(str)) {
arrayList.add(str);
}
}
sSLSocket.setEnabledProtocols((String[]) arrayList.toArray(new String[0]));
}
return socket;
}
}

View File

@@ -0,0 +1,502 @@
package com.firemonkeys.cloudcellapi;
import android.annotation.TargetApi;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Rect;
import android.graphics.Typeface;
import android.util.DisplayMetrics;
import android.view.Display;
import android.view.MotionEvent;
import android.view.View;
import android.view.inputmethod.InputMethodManager;
import android.webkit.ValueCallback;
import android.webkit.WebChromeClient;
import android.webkit.WebResourceError;
import android.webkit.WebResourceRequest;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;
import androidx.core.view.InputDeviceCompat;
import androidx.core.view.ViewCompat;
import java.io.File;
import org.apache.http.util.EncodingUtils;
/* loaded from: classes2.dex */
public class UserInterfaceManager {
private static final String CLASSNAME = "UserInterfaceManager";
static ScrollableWebView m_pStaticWebView;
/* JADX INFO: Access modifiers changed from: private */
public native void ClickableCallback(int i);
/* JADX INFO: Access modifiers changed from: private */
public native void WebBrowserEvaluateJavascriptCallback(int i, String str, long j);
/* JADX INFO: Access modifiers changed from: private */
public native void WebBrowserLoadFailCallback(long j);
/* JADX INFO: Access modifiers changed from: private */
public native void WebBrowserLoadFinishCallback(long j);
/* JADX INFO: Access modifiers changed from: private */
public native boolean WebBrowserLoadShouldStartCallback(String str, long j);
/* JADX INFO: Access modifiers changed from: private */
public native void WebBrowserLoadStartCallback(String str, long j);
public class ScrollableWebView extends WebView {
public int clamp(int i, int i2, int i3) {
return i < i2 ? i2 : i > i3 ? i3 : i;
}
public ScrollableWebView(Context context) {
super(context);
}
public void ScrollView(int i, int i2) {
scrollTo(clamp(getScrollX() + i, 0, computeHorizontalScrollRange() - getWidth()), clamp(getScrollY() + i2, 0, computeVerticalScrollRange() - getHeight()));
}
}
public class CrmClient extends WebChromeClient {
Activity m_activity;
RelativeLayout m_layout;
View m_view = null;
public CrmClient(Activity activity, RelativeLayout relativeLayout) {
this.m_activity = activity;
this.m_layout = relativeLayout;
}
@Override // android.webkit.WebChromeClient
public void onShowCustomView(View view, WebChromeClient.CustomViewCallback customViewCallback) {
super.onShowCustomView(view, customViewCallback);
view.setBackgroundColor(ViewCompat.MEASURED_STATE_MASK);
this.m_view = view;
this.m_layout.addView(view);
}
@Override // android.webkit.WebChromeClient
public void onHideCustomView() {
super.onHideCustomView();
this.m_layout.removeView(this.m_view);
}
}
@TargetApi(19)
public int GetScreenWidth() {
DisplayMetrics displayMetrics = new DisplayMetrics();
if (((CC_Component.GetActivity().getWindow().getDecorView().getSystemUiVisibility() & InputDeviceCompat.SOURCE_TOUCHSCREEN) == 4098) || CC_Component.getIsUsingImmersiveMode()) {
CC_Component.GetActivity().getWindowManager().getDefaultDisplay().getRealMetrics(displayMetrics);
} else {
CC_Component.GetActivity().getWindowManager().getDefaultDisplay().getMetrics(displayMetrics);
}
return (int) (displayMetrics.widthPixels / GetScreenScale());
}
public int GetScreenHeight() {
DisplayMetrics displayMetrics = new DisplayMetrics();
if (((CC_Component.GetActivity().getWindow().getDecorView().getSystemUiVisibility() & InputDeviceCompat.SOURCE_TOUCHSCREEN) == 4098) || CC_Component.getIsUsingImmersiveMode()) {
CC_Component.GetActivity().getWindowManager().getDefaultDisplay().getRealMetrics(displayMetrics);
} else {
CC_Component.GetActivity().getWindowManager().getDefaultDisplay().getMetrics(displayMetrics);
}
return (int) (displayMetrics.heightPixels / GetScreenScale());
}
public float GetScreenScale() {
Display defaultDisplay = CC_Component.GetActivity().getWindowManager().getDefaultDisplay();
DisplayMetrics displayMetrics = new DisplayMetrics();
defaultDisplay.getMetrics(displayMetrics);
return displayMetrics.density > 1.0f ? 2.0f : 1.0f;
}
public RelativeLayout WindowCreate(int i, int i2, final int i3, final int i4) {
final Activity GetActivity = CC_Component.GetActivity();
final RelativeLayout relativeLayout = new RelativeLayout(GetActivity);
GetActivity.runOnUiThread(new Runnable() { // from class: com.firemonkeys.cloudcellapi.UserInterfaceManager.1
@Override // java.lang.Runnable
public void run() {
GetActivity.addContentView(relativeLayout, new RelativeLayout.LayoutParams(i3, i4));
}
});
return relativeLayout;
}
public void WindowShow(final RelativeLayout relativeLayout) {
Logging.CC_TRACE(CLASSNAME, "--- UserInterfaceManager WindowShow");
CC_Component.GetActivity().runOnUiThread(new Runnable() { // from class: com.firemonkeys.cloudcellapi.UserInterfaceManager.2
@Override // java.lang.Runnable
public void run() {
Logging.CC_TRACE(UserInterfaceManager.CLASSNAME, "### UserInterfaceManager WindowShow");
relativeLayout.setVisibility(0);
}
});
}
public void WindowHide(final RelativeLayout relativeLayout) {
final Activity GetActivity = CC_Component.GetActivity();
GetActivity.runOnUiThread(new Runnable() { // from class: com.firemonkeys.cloudcellapi.UserInterfaceManager.3
@Override // java.lang.Runnable
public void run() {
View currentFocus = GetActivity.getCurrentFocus();
if (currentFocus != null) {
((InputMethodManager) GetActivity.getSystemService("input_method")).hideSoftInputFromWindow(currentFocus.getApplicationWindowToken(), 0);
}
relativeLayout.setVisibility(8);
}
});
}
public ImageView ImageCreate(final RelativeLayout relativeLayout, final int i, final int i2, final int i3, final int i4, final String str, int i5, int i6) {
Activity GetActivity = CC_Component.GetActivity();
final ImageView imageView = new ImageView(GetActivity);
GetActivity.runOnUiThread(new Runnable() { // from class: com.firemonkeys.cloudcellapi.UserInterfaceManager.4
@Override // java.lang.Runnable
public void run() {
imageView.setImageBitmap(BitmapFactory.decodeFile(str));
RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(i3, i4);
layoutParams.leftMargin = i;
layoutParams.topMargin = i2;
imageView.setLayoutParams(layoutParams);
relativeLayout.addView(imageView);
}
});
return imageView;
}
public void ImageShow(final ImageView imageView) {
CC_Component.GetActivity().runOnUiThread(new Runnable() { // from class: com.firemonkeys.cloudcellapi.UserInterfaceManager.5
@Override // java.lang.Runnable
public void run() {
imageView.setVisibility(0);
}
});
}
public void ImageHide(final ImageView imageView) {
CC_Component.GetActivity().runOnUiThread(new Runnable() { // from class: com.firemonkeys.cloudcellapi.UserInterfaceManager.6
@Override // java.lang.Runnable
public void run() {
imageView.setVisibility(8);
}
});
}
public ImageView ImagePatchCreate(final RelativeLayout relativeLayout, final int i, final int i2, final int i3, final int i4, final String str, final int i5) {
Activity GetActivity = CC_Component.GetActivity();
final ImageView imageView = new ImageView(GetActivity);
GetActivity.runOnUiThread(new Runnable() { // from class: com.firemonkeys.cloudcellapi.UserInterfaceManager.7
@Override // java.lang.Runnable
public void run() {
File file = new File(str);
Bitmap createBitmap = Bitmap.createBitmap(i3, i4, Bitmap.Config.ARGB_8888);
Canvas canvas = new Canvas(createBitmap);
Paint paint = new Paint(1);
Bitmap decodeFile = BitmapFactory.decodeFile(file.getAbsolutePath());
int i6 = i5;
Rect rect = new Rect(0, 0, i6, i6);
int i7 = i5;
canvas.drawBitmap(decodeFile, rect, new Rect(0, 0, i7, i7), paint);
int i8 = i5;
int width = decodeFile.getWidth();
int i9 = i5;
Rect rect2 = new Rect(i8, 0, width - i9, i9);
int i10 = i5;
canvas.drawBitmap(decodeFile, rect2, new Rect(i10, 0, i3 - i10, i10), paint);
Rect rect3 = new Rect(decodeFile.getWidth() - i5, 0, decodeFile.getWidth(), i5);
int i11 = i3;
int i12 = i5;
canvas.drawBitmap(decodeFile, rect3, new Rect(i11 - i12, 0, i11, i12), paint);
int i13 = i5;
Rect rect4 = new Rect(0, i13, i13, decodeFile.getHeight() - i5);
int i14 = i5;
canvas.drawBitmap(decodeFile, rect4, new Rect(0, i14, i14, i4 - i14), paint);
int i15 = i5;
Rect rect5 = new Rect(i15, i15, decodeFile.getWidth() - i5, decodeFile.getHeight() - i5);
int i16 = i5;
canvas.drawBitmap(decodeFile, rect5, new Rect(i16, i16, i3 - i16, i4 - i16), paint);
int width2 = decodeFile.getWidth();
int i17 = i5;
Rect rect6 = new Rect(width2 - i17, i17, decodeFile.getWidth(), decodeFile.getHeight() - i5);
int i18 = i3;
int i19 = i5;
canvas.drawBitmap(decodeFile, rect6, new Rect(i18 - i19, i19, i18, i4 - i19), paint);
int height = decodeFile.getHeight();
int i20 = i5;
Rect rect7 = new Rect(0, height - i20, i20, decodeFile.getHeight());
int i21 = i4;
int i22 = i5;
canvas.drawBitmap(decodeFile, rect7, new Rect(0, i21 - i22, i22, i21), paint);
Rect rect8 = new Rect(i5, decodeFile.getHeight() - i5, decodeFile.getWidth() - i5, decodeFile.getHeight());
int i23 = i5;
int i24 = i4;
canvas.drawBitmap(decodeFile, rect8, new Rect(i23, i24 - i23, i3 - i23, i24), paint);
Rect rect9 = new Rect(decodeFile.getWidth() - i5, decodeFile.getHeight() - i5, decodeFile.getWidth(), decodeFile.getHeight());
int i25 = i3;
int i26 = i5;
int i27 = i4;
canvas.drawBitmap(decodeFile, rect9, new Rect(i25 - i26, i27 - i26, i25, i27), paint);
imageView.setImageBitmap(createBitmap);
RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(i3, i4);
layoutParams.leftMargin = i;
layoutParams.topMargin = i2;
imageView.setLayoutParams(layoutParams);
relativeLayout.addView(imageView);
}
});
return imageView;
}
public void ClickableCreate(final ImageView imageView, final int i) {
CC_Component.GetActivity().runOnUiThread(new Runnable() { // from class: com.firemonkeys.cloudcellapi.UserInterfaceManager.8
@Override // java.lang.Runnable
public void run() {
imageView.setClickable(true);
imageView.setOnClickListener(new View.OnClickListener() { // from class: com.firemonkeys.cloudcellapi.UserInterfaceManager.8.1
@Override // android.view.View.OnClickListener
public void onClick(View view) {
Logging.CC_ERROR(UserInterfaceManager.CLASSNAME, "iElementId:" + i);
AnonymousClass8 anonymousClass8 = AnonymousClass8.this;
UserInterfaceManager.this.ClickableCallback(i);
}
});
}
});
}
public TextView LabelCreate(TextView textView, final RelativeLayout relativeLayout, final String str, final String str2, final int i, final float f, final float f2, final float f3, final int i2, final int i3, final int i4, final int i5) {
Activity GetActivity = CC_Component.GetActivity();
final boolean z = textView == null;
TextView textView2 = z ? new TextView(GetActivity) : textView;
final TextView textView3 = textView2;
TextView textView4 = textView2;
GetActivity.runOnUiThread(new Runnable() { // from class: com.firemonkeys.cloudcellapi.UserInterfaceManager.9
@Override // java.lang.Runnable
public void run() {
textView3.setText(str);
textView3.setTextSize(0, i);
textView3.setTypeface(Typeface.create(str2, 0));
textView3.setTextColor(Color.rgb((int) (f * 255.0f), (int) (f2 * 255.0f), (int) (f3 * 255.0f)));
textView3.setGravity(17);
RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(i4, i5);
layoutParams.leftMargin = i2;
layoutParams.topMargin = i3;
textView3.setLayoutParams(layoutParams);
if (z) {
relativeLayout.addView(textView3);
}
}
});
return textView4;
}
public void LabelDelete(final TextView textView) {
CC_Component.GetActivity().runOnUiThread(new Runnable() { // from class: com.firemonkeys.cloudcellapi.UserInterfaceManager.10
@Override // java.lang.Runnable
public void run() {
textView.setText("");
}
});
}
public void HandleScrollInput(float f, float f2) {
ScrollableWebView scrollableWebView = m_pStaticWebView;
if (scrollableWebView != null) {
final int i = (int) (f * 5.0f);
final int i2 = (int) (f2 * 5.0f);
scrollableWebView.post(new Runnable() { // from class: com.firemonkeys.cloudcellapi.UserInterfaceManager.11
@Override // java.lang.Runnable
public void run() {
UserInterfaceManager.m_pStaticWebView.ScrollView(i, i2);
}
});
}
}
public void AppSuspended() {
ScrollableWebView scrollableWebView = m_pStaticWebView;
if (scrollableWebView != null) {
scrollableWebView.post(new Runnable() { // from class: com.firemonkeys.cloudcellapi.UserInterfaceManager.12
@Override // java.lang.Runnable
public void run() {
UserInterfaceManager.m_pStaticWebView.onPause();
}
});
}
}
public void AppResumed() {
ScrollableWebView scrollableWebView = m_pStaticWebView;
if (scrollableWebView != null) {
scrollableWebView.post(new Runnable() { // from class: com.firemonkeys.cloudcellapi.UserInterfaceManager.13
@Override // java.lang.Runnable
public void run() {
UserInterfaceManager.m_pStaticWebView.onResume();
}
});
}
}
public WebView WebBrowserCreate(ScrollableWebView scrollableWebView, final RelativeLayout relativeLayout, final int i, final int i2, final int i3, final int i4, final long j) {
final Activity GetActivity = CC_Component.GetActivity();
m_pStaticWebView = scrollableWebView;
Runnable runnable = new Runnable() { // from class: com.firemonkeys.cloudcellapi.UserInterfaceManager.14
@Override // java.lang.Runnable
public void run() {
synchronized (this) {
try {
boolean z = UserInterfaceManager.m_pStaticWebView == null;
if (z) {
UserInterfaceManager.m_pStaticWebView = UserInterfaceManager.this.new ScrollableWebView(GetActivity);
}
UserInterfaceManager.m_pStaticWebView.getSettings().setJavaScriptEnabled(true);
UserInterfaceManager.m_pStaticWebView.getSettings().setDomStorageEnabled(true);
UserInterfaceManager.m_pStaticWebView.getSettings().setAllowFileAccess(true);
UserInterfaceManager.m_pStaticWebView.getSettings().setRenderPriority(WebSettings.RenderPriority.HIGH);
UserInterfaceManager.m_pStaticWebView.setWebViewClient(new WebViewClient() { // from class: com.firemonkeys.cloudcellapi.UserInterfaceManager.14.1
@Override // android.webkit.WebViewClient
public boolean shouldOverrideUrlLoading(WebView webView, String str) {
AnonymousClass14 anonymousClass14 = AnonymousClass14.this;
return UserInterfaceManager.this.WebBrowserLoadShouldStartCallback(str, j);
}
@Override // android.webkit.WebViewClient
public void onPageStarted(WebView webView, String str, Bitmap bitmap) {
AnonymousClass14 anonymousClass14 = AnonymousClass14.this;
UserInterfaceManager.this.WebBrowserLoadStartCallback(str, j);
}
@Override // android.webkit.WebViewClient
public void onPageFinished(WebView webView, String str) {
AnonymousClass14 anonymousClass14 = AnonymousClass14.this;
UserInterfaceManager.this.WebBrowserLoadFinishCallback(j);
}
@Override // android.webkit.WebViewClient
public void onReceivedError(WebView webView, WebResourceRequest webResourceRequest, WebResourceError webResourceError) {
AnonymousClass14 anonymousClass14 = AnonymousClass14.this;
UserInterfaceManager.this.WebBrowserLoadFailCallback(j);
}
});
UserInterfaceManager.m_pStaticWebView.setWebChromeClient(UserInterfaceManager.this.new CrmClient(GetActivity, relativeLayout));
UserInterfaceManager.m_pStaticWebView.setOnTouchListener(new View.OnTouchListener() { // from class: com.firemonkeys.cloudcellapi.UserInterfaceManager.14.2
@Override // android.view.View.OnTouchListener
public boolean onTouch(View view, MotionEvent motionEvent) {
int action = motionEvent.getAction();
if ((action != 0 && action != 1) || view.hasFocus()) {
return false;
}
view.requestFocus();
return false;
}
});
RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(i3, i4);
layoutParams.leftMargin = i;
layoutParams.topMargin = i2;
UserInterfaceManager.m_pStaticWebView.setLayoutParams(layoutParams);
if (z) {
relativeLayout.addView(UserInterfaceManager.m_pStaticWebView);
}
notify();
} catch (Throwable th) {
throw th;
}
}
}
};
synchronized (runnable) {
GetActivity.runOnUiThread(runnable);
try {
runnable.wait();
} catch (Exception unused) {
}
}
return m_pStaticWebView;
}
/* renamed from: com.firemonkeys.cloudcellapi.UserInterfaceManager$15, reason: invalid class name */
public class AnonymousClass15 implements Runnable {
final /* synthetic */ String val$javaScript;
final /* synthetic */ int val$nCallbackId;
final /* synthetic */ WebView val$pWebView;
final /* synthetic */ long val$userPointer;
public AnonymousClass15(WebView webView, String str, int i, long j) {
this.val$pWebView = webView;
this.val$javaScript = str;
this.val$nCallbackId = i;
this.val$userPointer = j;
}
@Override // java.lang.Runnable
public void run() {
this.val$pWebView.evaluateJavascript(this.val$javaScript, new ValueCallback<String>() { // from class: com.firemonkeys.cloudcellapi.UserInterfaceManager.15.1
@Override // android.webkit.ValueCallback
public void onReceiveValue(final String str) {
CC_Activity.runOnGLThreadonCloudell(new Runnable() { // from class: com.firemonkeys.cloudcellapi.UserInterfaceManager.15.1.1
@Override // java.lang.Runnable
public void run() {
AnonymousClass15 anonymousClass15 = AnonymousClass15.this;
UserInterfaceManager.this.WebBrowserEvaluateJavascriptCallback(anonymousClass15.val$nCallbackId, str, anonymousClass15.val$userPointer);
}
});
}
});
}
}
public void WebBrowserEvaluateJavascript(WebView webView, String str, int i, long j) {
CC_Component.GetActivity().runOnUiThread(new AnonymousClass15(webView, str, i, j));
}
public void WebBrowserOpenData(final WebView webView, final String str, String str2, boolean z, String str3) {
CC_Component.GetActivity().runOnUiThread(new Runnable() { // from class: com.firemonkeys.cloudcellapi.UserInterfaceManager.16
@Override // java.lang.Runnable
public void run() {
webView.loadDataWithBaseURL(null, str, null, "UTF-8", null);
}
});
}
public void WebBrowserOpenUrl(final WebView webView, final String str, final String str2, boolean z, final String str3) {
CC_Component.GetActivity().runOnUiThread(new Runnable() { // from class: com.firemonkeys.cloudcellapi.UserInterfaceManager.17
@Override // java.lang.Runnable
public void run() {
String str4 = str3;
if (str4 != null && str4.length() > 0) {
webView.postUrl(str + str2, EncodingUtils.getBytes(str3, "UTF-8"));
return;
}
webView.loadUrl(str + str2);
}
});
}
public void ShowDialogBox(final String str, final String str2, final String str3) {
final Activity GetActivity = CC_Component.GetActivity();
GetActivity.runOnUiThread(new Runnable() { // from class: com.firemonkeys.cloudcellapi.UserInterfaceManager.18
@Override // java.lang.Runnable
public void run() {
AlertDialog.Builder builder = new AlertDialog.Builder(GetActivity);
builder.setTitle(str).setMessage(str2).setNegativeButton(str3, new DialogInterface.OnClickListener() { // from class: com.firemonkeys.cloudcellapi.UserInterfaceManager.18.1
@Override // android.content.DialogInterface.OnClickListener
public void onClick(DialogInterface dialogInterface, int i) {
}
});
builder.show();
}
});
}
}

View File

@@ -0,0 +1,196 @@
package com.firemonkeys.cloudcellapi.util;
import com.applovin.exoplayer2.common.base.Ascii;
/* loaded from: classes2.dex */
public class Base64 {
static final /* synthetic */ boolean $assertionsDisabled = false;
public static final boolean DECODE = false;
public static final boolean ENCODE = true;
private static final byte NEW_LINE = 10;
private static final byte[] ALPHABET = {65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 43, 47};
private static final byte[] WEBSAFE_ALPHABET = {65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 45, 95};
private static final byte WHITE_SPACE_ENC = -5;
private static final byte EQUALS_SIGN = 61;
private static final byte EQUALS_SIGN_ENC = -1;
private static final byte[] DECODABET = {-9, -9, -9, -9, -9, -9, -9, -9, -9, WHITE_SPACE_ENC, WHITE_SPACE_ENC, -9, -9, WHITE_SPACE_ENC, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, WHITE_SPACE_ENC, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, 62, -9, -9, -9, 63, 52, 53, 54, 55, 56, 57, 58, 59, 60, EQUALS_SIGN, -9, -9, -9, EQUALS_SIGN_ENC, -9, -9, -9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, Ascii.VT, Ascii.FF, Ascii.CR, Ascii.SO, Ascii.SI, Ascii.DLE, 17, Ascii.DC2, 19, Ascii.DC4, Ascii.NAK, Ascii.SYN, Ascii.ETB, Ascii.CAN, Ascii.EM, -9, -9, -9, -9, -9, -9, Ascii.SUB, Ascii.ESC, Ascii.FS, Ascii.GS, Ascii.RS, Ascii.US, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, -9, -9, -9, -9, -9};
private static final byte[] WEBSAFE_DECODABET = {-9, -9, -9, -9, -9, -9, -9, -9, -9, WHITE_SPACE_ENC, WHITE_SPACE_ENC, -9, -9, WHITE_SPACE_ENC, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, WHITE_SPACE_ENC, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, 62, -9, -9, 52, 53, 54, 55, 56, 57, 58, 59, 60, EQUALS_SIGN, -9, -9, -9, EQUALS_SIGN_ENC, -9, -9, -9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, Ascii.VT, Ascii.FF, Ascii.CR, Ascii.SO, Ascii.SI, Ascii.DLE, 17, Ascii.DC2, 19, Ascii.DC4, Ascii.NAK, Ascii.SYN, Ascii.ETB, Ascii.CAN, Ascii.EM, -9, -9, -9, -9, 63, -9, Ascii.SUB, Ascii.ESC, Ascii.FS, Ascii.GS, Ascii.RS, Ascii.US, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, -9, -9, -9, -9, -9};
private Base64() {
}
private static byte[] encode3to4(byte[] bArr, int i, int i2, byte[] bArr2, int i3, byte[] bArr3) {
int i4 = (i2 > 0 ? (bArr[i] << Ascii.CAN) >>> 8 : 0) | (i2 > 1 ? (bArr[i + 1] << Ascii.CAN) >>> 16 : 0) | (i2 > 2 ? (bArr[i + 2] << Ascii.CAN) >>> 24 : 0);
if (i2 == 1) {
bArr2[i3] = bArr3[i4 >>> 18];
bArr2[i3 + 1] = bArr3[(i4 >>> 12) & 63];
bArr2[i3 + 2] = EQUALS_SIGN;
bArr2[i3 + 3] = EQUALS_SIGN;
return bArr2;
}
if (i2 == 2) {
bArr2[i3] = bArr3[i4 >>> 18];
bArr2[i3 + 1] = bArr3[(i4 >>> 12) & 63];
bArr2[i3 + 2] = bArr3[(i4 >>> 6) & 63];
bArr2[i3 + 3] = EQUALS_SIGN;
return bArr2;
}
if (i2 != 3) {
return bArr2;
}
bArr2[i3] = bArr3[i4 >>> 18];
bArr2[i3 + 1] = bArr3[(i4 >>> 12) & 63];
bArr2[i3 + 2] = bArr3[(i4 >>> 6) & 63];
bArr2[i3 + 3] = bArr3[i4 & 63];
return bArr2;
}
public static String encode(byte[] bArr) {
return encode(bArr, 0, bArr.length, ALPHABET, true);
}
public static String encodeWebSafe(byte[] bArr, boolean z) {
return encode(bArr, 0, bArr.length, WEBSAFE_ALPHABET, z);
}
public static String encode(byte[] bArr, int i, int i2, byte[] bArr2, boolean z) {
byte[] encode = encode(bArr, i, i2, bArr2, Integer.MAX_VALUE);
int length = encode.length;
while (!z && length > 0 && encode[length - 1] == 61) {
length--;
}
return new String(encode, 0, length);
}
public static byte[] encode(byte[] bArr, int i, int i2, byte[] bArr2, int i3) {
int i4 = ((i2 + 2) / 3) * 4;
byte[] bArr3 = new byte[i4 + (i4 / i3)];
int i5 = i2 - 2;
int i6 = 0;
int i7 = 0;
int i8 = 0;
while (i6 < i5) {
int i9 = ((bArr[i6 + i] << Ascii.CAN) >>> 8) | ((bArr[(i6 + 1) + i] << Ascii.CAN) >>> 16) | ((bArr[(i6 + 2) + i] << Ascii.CAN) >>> 24);
bArr3[i7] = bArr2[i9 >>> 18];
int i10 = i7 + 1;
bArr3[i10] = bArr2[(i9 >>> 12) & 63];
bArr3[i7 + 2] = bArr2[(i9 >>> 6) & 63];
bArr3[i7 + 3] = bArr2[i9 & 63];
i8 += 4;
if (i8 == i3) {
bArr3[i7 + 4] = 10;
i8 = 0;
i7 = i10;
}
i6 += 3;
i7 += 4;
}
if (i6 < i2) {
encode3to4(bArr, i6 + i, i2 - i6, bArr3, i7, bArr2);
if (i8 + 4 == i3) {
bArr3[i7 + 4] = 10;
}
}
return bArr3;
}
private static int decode4to3(byte[] bArr, int i, byte[] bArr2, int i2, byte[] bArr3) {
byte b = bArr[i + 2];
if (b == 61) {
bArr2[i2] = (byte) ((((bArr3[bArr[i + 1]] << Ascii.CAN) >>> 12) | ((bArr3[bArr[i]] << Ascii.CAN) >>> 6)) >>> 16);
return 1;
}
byte b2 = bArr[i + 3];
if (b2 == 61) {
int i3 = ((bArr3[bArr[i + 1]] << Ascii.CAN) >>> 12) | ((bArr3[bArr[i]] << Ascii.CAN) >>> 6) | ((bArr3[b] << Ascii.CAN) >>> 18);
bArr2[i2] = (byte) (i3 >>> 16);
bArr2[i2 + 1] = (byte) (i3 >>> 8);
return 2;
}
int i4 = ((bArr3[bArr[i + 1]] << Ascii.CAN) >>> 12) | ((bArr3[bArr[i]] << Ascii.CAN) >>> 6) | ((bArr3[b] << Ascii.CAN) >>> 18) | ((bArr3[b2] << Ascii.CAN) >>> 24);
bArr2[i2] = (byte) (i4 >> 16);
bArr2[i2 + 1] = (byte) (i4 >> 8);
bArr2[i2 + 2] = (byte) i4;
return 3;
}
public static byte[] decode(String str) throws Base64DecoderException {
byte[] bytes = str.getBytes();
return decode(bytes, 0, bytes.length);
}
public static byte[] decodeWebSafe(String str) throws Base64DecoderException {
byte[] bytes = str.getBytes();
return decodeWebSafe(bytes, 0, bytes.length);
}
public static byte[] decode(byte[] bArr) throws Base64DecoderException {
return decode(bArr, 0, bArr.length);
}
public static byte[] decodeWebSafe(byte[] bArr) throws Base64DecoderException {
return decodeWebSafe(bArr, 0, bArr.length);
}
public static byte[] decode(byte[] bArr, int i, int i2) throws Base64DecoderException {
return decode(bArr, i, i2, DECODABET);
}
public static byte[] decodeWebSafe(byte[] bArr, int i, int i2) throws Base64DecoderException {
return decode(bArr, i, i2, WEBSAFE_DECODABET);
}
public static byte[] decode(byte[] bArr, int i, int i2, byte[] bArr2) throws Base64DecoderException {
byte[] bArr3 = new byte[((i2 * 3) / 4) + 2];
byte[] bArr4 = new byte[4];
int i3 = 0;
int i4 = 0;
int i5 = 0;
while (true) {
if (i3 >= i2) {
break;
}
int i6 = i3 + i;
byte b = (byte) (bArr[i6] & Byte.MAX_VALUE);
byte b2 = bArr2[b];
if (b2 < -5) {
throw new Base64DecoderException("Bad Base64 input character at " + i3 + ": " + ((int) bArr[i6]) + "(decimal)");
}
if (b2 >= -1) {
if (b == 61) {
int i7 = i2 - i3;
byte b3 = (byte) (bArr[(i2 - 1) + i] & Byte.MAX_VALUE);
if (i4 == 0 || i4 == 1) {
throw new Base64DecoderException("invalid padding byte '=' at byte offset " + i3);
}
if ((i4 == 3 && i7 > 2) || (i4 == 4 && i7 > 1)) {
throw new Base64DecoderException("padding byte '=' falsely signals end of encoded value at offset " + i3);
}
if (b3 != 61 && b3 != 10) {
throw new Base64DecoderException("encoded value has invalid trailing byte");
}
} else {
int i8 = i4 + 1;
bArr4[i4] = b;
if (i8 == 4) {
i5 += decode4to3(bArr4, 0, bArr3, i5, bArr2);
i4 = 0;
} else {
i4 = i8;
}
}
}
i3++;
}
if (i4 != 0) {
if (i4 == 1) {
throw new Base64DecoderException("single trailing character at offset " + (i2 - 1));
}
bArr4[i4] = EQUALS_SIGN;
i5 += decode4to3(bArr4, 0, bArr3, i5, bArr2);
}
byte[] bArr5 = new byte[i5];
System.arraycopy(bArr3, 0, bArr5, 0, i5);
return bArr5;
}
}

View File

@@ -0,0 +1,13 @@
package com.firemonkeys.cloudcellapi.util;
/* loaded from: classes2.dex */
public class Base64DecoderException extends Exception {
private static final long serialVersionUID = 1;
public Base64DecoderException() {
}
public Base64DecoderException(String str) {
super(str);
}
}

View File

@@ -0,0 +1,19 @@
package com.firemonkeys.cloudcellapi.util;
import android.content.SharedPreferences;
import com.firemonkeys.cloudcellapi.CC_Component;
/* loaded from: classes2.dex */
public class FacebookAccessToken {
static final String TAG = "cloudcellapi.util.FacebookAccessToken";
public static void setFacebookAccessToken(String str) {
SharedPreferences.Editor edit = CC_Component.GetActivity().getPreferences(0).edit();
edit.putString("access_token", str);
edit.commit();
}
public static String getFacebookAccessToken() {
return CC_Component.GetActivity().getPreferences(0).getString("access_token", "");
}
}

View File

@@ -0,0 +1,315 @@
package com.firemonkeys.cloudcellapi.util;
import android.Manifest;
import android.app.Activity;
import android.app.UiModeManager;
import android.content.Context;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
import android.content.pm.PermissionInfo;
import android.media.AudioManager;
import android.net.wifi.WifiManager;
import android.os.Build;
import android.os.Environment;
import android.provider.Settings;
import com.firemonkeys.cloudcellapi.CC_Component;
import com.firemonkeys.cloudcellapi.Logging;
import com.google.android.gms.ads.identifier.AdvertisingIdClient;
import com.google.android.gms.common.GooglePlayServicesNotAvailableException;
import com.google.android.gms.common.GooglePlayServicesRepairableException;
import java.io.File;
import java.io.IOException;
import java.lang.reflect.Field;
import java.net.InetAddress;
import java.net.NetworkInterface;
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.Iterator;
import java.util.Locale;
import org.apache.http.conn.util.InetAddressUtils;
/* loaded from: classes2.dex */
public class GetInfo {
private static final String CLASSNAME = "GetInfo";
private static final int MAX_RETRIES = 5;
static Boolean bShouldUseLegacyExternalFilesDir = null;
protected static ArrayList<String> m_systemPermissions = null;
static boolean ms_bAdvertisingEnabled = false;
static boolean ms_bInitialized = false;
static String ms_sAdvertisingIdentifier = "";
public static boolean GetAdvertisingEnabled() {
return ms_bAdvertisingEnabled;
}
public static String GetAdvertisingID() {
return ms_sAdvertisingIdentifier;
}
public static int GetApiLevel() {
return Build.VERSION.SDK_INT;
}
public static String GetImei() {
return "";
}
public static boolean IsInitialized() {
return ms_bInitialized;
}
public static void Initialize(final Activity activity) {
if (activity == null) {
Logging.CC_ERROR(CLASSNAME, "Invalid Activity passed to GetInfo.Initialize. AdvertisingId will NOT be set!");
} else {
ms_bAdvertisingEnabled = true;
new Thread(new Runnable() { // from class: com.firemonkeys.cloudcellapi.util.GetInfo.1
@Override // java.lang.Runnable
public void run() {
Logging.CC_INFO(GetInfo.CLASSNAME, "Initialize()");
for (int i = 0; i < 5; i++) {
try {
GetInfo.ms_sAdvertisingIdentifier = AdvertisingIdClient.getAdvertisingIdInfo(activity).getId();
GetInfo.ms_bAdvertisingEnabled = !r2.isLimitAdTrackingEnabled();
break;
} catch (GooglePlayServicesNotAvailableException e) {
Logging.CC_ERROR(GetInfo.CLASSNAME, "GooglePlayServicesNotAvailableException" + e.getMessage());
try {
Thread.sleep(1000L);
} catch (InterruptedException e2) {
Logging.CC_ERROR(GetInfo.CLASSNAME, "InterruptedException" + e2.getMessage());
}
} catch (GooglePlayServicesRepairableException e3) {
Logging.CC_ERROR(GetInfo.CLASSNAME, "GooglePlayServicesRepairableException" + e3.getMessage());
Thread.sleep(1000L);
} catch (IOException e4) {
Logging.CC_ERROR(GetInfo.CLASSNAME, "IOException" + e4.getMessage());
Thread.sleep(1000L);
} catch (IllegalStateException e5) {
Logging.CC_ERROR(GetInfo.CLASSNAME, "IllegalStateException" + e5.getMessage());
Thread.sleep(1000L);
}
}
Logging.CC_INFO(GetInfo.CLASSNAME, "AdvertisingIdentifier: " + GetInfo.ms_sAdvertisingIdentifier);
Logging.CC_INFO(GetInfo.CLASSNAME, "AdvertisingEnabled: " + GetInfo.ms_bAdvertisingEnabled);
GetInfo.ms_bInitialized = true;
}
}).start();
}
}
public static boolean GetIsTablet() {
return (CC_Component.GetActivity().getApplicationContext().getResources().getConfiguration().screenLayout & 15) >= 3;
}
public static boolean GetIsRunningOnTv() {
return ((UiModeManager) CC_Component.GetActivity().getSystemService("uimode")).getCurrentModeType() == 4;
}
public static String GetDeviceCode() {
return Build.DEVICE;
}
public static String GetDeviceName() {
return Build.MANUFACTURER + " " + Build.MODEL;
}
public static String GetDeviceManufacturer() {
return Build.MANUFACTURER;
}
public static String GetDeviceModel() {
return Build.MODEL;
}
public static String GetDeviceBrand() {
return Build.BRAND;
}
public static String GetDeviceFirmwareVersion() {
return Build.VERSION.RELEASE;
}
public static String GetBuildVersion() {
try {
Activity GetActivity = CC_Component.GetActivity();
return GetActivity.getPackageManager().getPackageInfo(GetActivity.getPackageName(), 0).versionName;
} catch (Exception e) {
Logging.CC_ERROR(CLASSNAME, "GetBuildVersion() error: " + e.toString());
return "1.0.0";
}
}
public static String GetDeviceMacAddress() {
try {
return ((WifiManager) CC_Component.GetActivity().getSystemService("wifi")).getConnectionInfo().getMacAddress();
} catch (Exception e) {
Logging.CC_ERROR(CLASSNAME, "GetDeviceMacAddress() error: " + e.toString());
return "";
}
}
public static String GetPackageName() {
try {
return CC_Component.GetActivity().getPackageName();
} catch (Exception e) {
Logging.CC_ERROR(CLASSNAME, "GetPackageName() error: " + e.toString());
return "";
}
}
public static boolean GetIsAmazonDevice() {
return GetDeviceManufacturer().toLowerCase().contains("amazon");
}
public static boolean GetIsChinaBuild() {
return GetPackageName().endsWith("_cn");
}
public static String GetDeviceUID() {
return Settings.Secure.getString(CC_Component.GetActivity().getApplicationContext().getContentResolver(), "android_id");
}
public static String GetLocalIp() {
try {
Enumeration<NetworkInterface> networkInterfaces = NetworkInterface.getNetworkInterfaces();
while (networkInterfaces.hasMoreElements()) {
Enumeration<InetAddress> inetAddresses = networkInterfaces.nextElement().getInetAddresses();
while (inetAddresses.hasMoreElements()) {
InetAddress nextElement = inetAddresses.nextElement();
if (nextElement.isLoopbackAddress() || (!InetAddressUtils.isIPv4Address(nextElement.getHostAddress().toString()) && !InetAddressUtils.isIPv6Address(nextElement.getHostAddress().toString()))) {
}
return nextElement.getHostAddress().toString();
}
}
return "";
} catch (Exception e) {
Logging.CC_ERROR(CLASSNAME, "GetLocalIp() error: " + e.toString());
return "";
}
}
public static String GetDeviceCountry() {
try {
return Locale.getDefault().getISO3Country();
} catch (Exception e) {
Logging.CC_ERROR(CLASSNAME, "GetDeviceCountry() error: " + e.toString());
return "";
}
}
public static String GetDeviceLanguage() {
return Locale.getDefault().getLanguage();
}
public static int GetVolume() {
return ((AudioManager) CC_Component.GetActivity().getSystemService("audio")).getStreamVolume(3);
}
public static boolean DoesPackageExist(String str) {
try {
return CC_Component.GetActivity().getPackageManager().getApplicationInfo(str, 0) != null;
} catch (Exception unused) {
return false;
}
}
public static String[] GetRequestedPermissions() {
String[] strArr = new String[0];
try {
Activity GetActivity = CC_Component.GetActivity();
return GetActivity.getPackageManager().getPackageInfo(GetActivity.getPackageName(), 4096).requestedPermissions;
} catch (Exception e) {
Logging.CC_ERROR(CLASSNAME, "GetRequestedPermissions() error: " + e.toString());
return strArr;
}
}
public static boolean IsValidPermission(String str) {
try {
PermissionInfo permissionInfo = CC_Component.GetActivity().getPackageManager().getPermissionInfo(str, 128);
if (permissionInfo == null) {
return false;
}
int i = permissionInfo.protectionLevel;
return i == 1 || i == 0;
} catch (Exception unused) {
return false;
}
}
public static ArrayList<String> GetSystemPermissions() {
String str;
try {
if (m_systemPermissions == null) {
m_systemPermissions = new ArrayList<>();
for (Field field : Manifest.permission.class.getDeclaredFields()) {
if (field.getType().isAssignableFrom(String.class) && (str = (String) field.get(null)) != null) {
m_systemPermissions.add(str);
}
}
}
} catch (Exception e) {
Logging.CC_ERROR(CLASSNAME, "Initialising System Permissions exception: " + e.toString());
}
return m_systemPermissions;
}
public static boolean IsSystemPermission(String str) {
Iterator<String> it = GetSystemPermissions().iterator();
while (it.hasNext()) {
if (it.next().equals(str)) {
return true;
}
}
return false;
}
public static boolean IsPackageEnabled(String str) {
try {
ApplicationInfo applicationInfo = CC_Component.GetActivity().getPackageManager().getApplicationInfo(str, 0);
if (applicationInfo != null) {
return applicationInfo.enabled;
}
return false;
} catch (Exception unused) {
return false;
}
}
public static long getAppInstallTime() {
try {
Context applicationContext = CC_Component.GetActivity().getApplicationContext();
return applicationContext.getPackageManager().getPackageInfo(applicationContext.getPackageName(), 0).lastUpdateTime;
} catch (PackageManager.NameNotFoundException unused) {
return 0L;
}
}
public static Boolean ShouldUseLegacyExternalFilesDir() {
if (bShouldUseLegacyExternalFilesDir == null) {
bShouldUseLegacyExternalFilesDir = Boolean.valueOf(new File(getLegacyExternalStorageDirPath() + "/.depot/").exists());
}
return bShouldUseLegacyExternalFilesDir;
}
public static String getLegacyExternalStorageDirPath() {
File externalStorageDirectory = Environment.getExternalStorageDirectory();
if (externalStorageDirectory == null) {
return "";
}
return externalStorageDirectory.getAbsolutePath() + "/Android/data/" + CC_Component.GetActivity().getApplicationContext().getPackageName();
}
public static String getExternalStorageDir() {
if (ShouldUseLegacyExternalFilesDir().booleanValue()) {
return getLegacyExternalStorageDirPath();
}
File externalFilesDir = CC_Component.GetActivity().getApplicationContext().getExternalFilesDir(null);
return externalFilesDir != null ? externalFilesDir.getAbsolutePath() : "";
}
public static void DEBUG_DoJavaException() {
throw new RuntimeException("DEBUG Throwing an exception in DEBUG_DoJavaException");
}
}

View File

@@ -0,0 +1,29 @@
package com.firemonkeys.cloudcellapi.util;
import com.firemonkeys.cloudcellapi.Consts;
/* loaded from: classes2.dex */
public class IabException extends Exception {
IabResult mResult;
public IabResult getResult() {
return this.mResult;
}
public IabException(IabResult iabResult) {
this(iabResult, (Exception) null);
}
public IabException(Consts.ResponseCode responseCode, String str) {
this(new IabResult(responseCode, str));
}
public IabException(IabResult iabResult, Exception exc) {
super(iabResult.getMessage(), exc);
this.mResult = iabResult;
}
public IabException(Consts.ResponseCode responseCode, String str, Exception exc) {
this(new IabResult(responseCode, str), exc);
}
}

View File

@@ -0,0 +1,44 @@
package com.firemonkeys.cloudcellapi.util;
import com.firemonkeys.cloudcellapi.Consts;
/* loaded from: classes2.dex */
public class IabResult {
String mMessage;
Consts.ResponseCode mResponse;
String mSku;
public String getMessage() {
return this.mMessage;
}
public Consts.ResponseCode getResponse() {
return this.mResponse;
}
public String getSku() {
return this.mSku;
}
public IabResult(Consts.ResponseCode responseCode, String str) {
this.mResponse = responseCode;
this.mMessage = str;
}
public IabResult(Consts.ResponseCode responseCode, String str, String str2) {
this(responseCode, str);
this.mSku = str2;
}
public boolean isSuccess() {
return this.mResponse == Consts.ResponseCode.RESULT_OK;
}
public boolean isFailure() {
return !isSuccess();
}
public String toString() {
return "IabResult: " + getMessage();
}
}

View File

@@ -0,0 +1,68 @@
package com.firemonkeys.cloudcellapi.util;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/* loaded from: classes2.dex */
public class Inventory {
Map<String, SkuDetails> mSkuMap = new HashMap();
Map<String, Purchase> mPurchaseMap = new HashMap();
public SkuDetails getSkuDetails(String str) {
return this.mSkuMap.get(str);
}
public Purchase getPurchase(String str) {
return this.mPurchaseMap.get(str);
}
public boolean hasPurchase(String str) {
return this.mPurchaseMap.containsKey(str);
}
public boolean hasDetails(String str) {
return this.mSkuMap.containsKey(str);
}
public List<String> getAllSkus() {
return new ArrayList(this.mSkuMap.keySet());
}
public List<SkuDetails> getAllSkuDetails() {
return new ArrayList(this.mSkuMap.values());
}
public void erasePurchase(String str) {
if (this.mPurchaseMap.containsKey(str)) {
this.mPurchaseMap.remove(str);
}
}
public List<String> getAllOwnedSkus() {
return new ArrayList(this.mPurchaseMap.keySet());
}
public List<String> getAllOwnedSkus(String str) {
ArrayList arrayList = new ArrayList();
for (Purchase purchase : this.mPurchaseMap.values()) {
if (purchase.getItemType().equals(str)) {
arrayList.add(purchase.getSku());
}
}
return arrayList;
}
public List<Purchase> getAllPurchases() {
return new ArrayList(this.mPurchaseMap.values());
}
public void addSkuDetails(SkuDetails skuDetails) {
this.mSkuMap.put(skuDetails.getSku(), skuDetails);
}
public void addPurchase(Purchase purchase) {
this.mPurchaseMap.put(purchase.getSku(), purchase);
}
}

View File

@@ -0,0 +1,79 @@
package com.firemonkeys.cloudcellapi.util;
import com.facebook.gamingservices.cloudgaming.internal.SDKConstants;
import com.unity3d.ads.core.domain.HandleInvocationsFromAdViewer;
import com.unity3d.ads.metadata.InAppPurchaseMetaData;
import org.json.JSONException;
import org.json.JSONObject;
/* loaded from: classes2.dex */
public class Purchase {
String mDeveloperPayload;
String mItemType;
String mOrderId;
String mOriginalJson;
String mPackageName;
int mPurchaseState;
long mPurchaseTime;
String mSignature;
String mSku;
String mToken;
public String getDeveloperPayload() {
return this.mDeveloperPayload;
}
public String getItemType() {
return this.mItemType;
}
public String getOrderId() {
return this.mOrderId;
}
public String getOriginalJson() {
return this.mOriginalJson;
}
public String getPackageName() {
return this.mPackageName;
}
public int getPurchaseState() {
return this.mPurchaseState;
}
public long getPurchaseTime() {
return this.mPurchaseTime;
}
public String getSignature() {
return this.mSignature;
}
public String getSku() {
return this.mSku;
}
public String getToken() {
return this.mToken;
}
public Purchase(String str, String str2, String str3) throws JSONException {
this.mItemType = str;
this.mOriginalJson = str2;
JSONObject jSONObject = new JSONObject(this.mOriginalJson);
this.mOrderId = jSONObject.optString("orderId");
this.mPackageName = jSONObject.optString(HandleInvocationsFromAdViewer.KEY_PACKAGE_NAME);
this.mSku = jSONObject.optString(InAppPurchaseMetaData.KEY_PRODUCT_ID);
this.mPurchaseTime = jSONObject.optLong("purchaseTime");
this.mPurchaseState = jSONObject.optInt("purchaseState");
this.mDeveloperPayload = jSONObject.optString(SDKConstants.PARAM_DEVELOPER_PAYLOAD);
this.mToken = jSONObject.optString("token", jSONObject.optString(SDKConstants.PARAM_PURCHASE_TOKEN));
this.mSignature = str3;
}
public String toString() {
return "PurchaseInfo(type:" + this.mItemType + "):" + this.mOriginalJson;
}
}

View File

@@ -0,0 +1,70 @@
package com.firemonkeys.cloudcellapi.util;
import android.text.TextUtils;
import android.util.Log;
import java.security.InvalidKeyException;
import java.security.KeyFactory;
import java.security.NoSuchAlgorithmException;
import java.security.PublicKey;
import java.security.Signature;
import java.security.SignatureException;
import java.security.spec.InvalidKeySpecException;
import java.security.spec.X509EncodedKeySpec;
/* loaded from: classes2.dex */
public class Security {
private static final String KEY_FACTORY_ALGORITHM = "RSA";
private static final String SIGNATURE_ALGORITHM = "SHA1withRSA";
private static final String TAG = "IABUtil/Security";
public static boolean verifyPurchase(String str, String str2, String str3) {
if (str2 == null) {
Log.e(TAG, "data is null");
return false;
}
if (TextUtils.isEmpty(str3) || verify(generatePublicKey(str), str2, str3)) {
return true;
}
Log.w(TAG, "signature does not match data.");
return false;
}
public static PublicKey generatePublicKey(String str) {
try {
return KeyFactory.getInstance(KEY_FACTORY_ALGORITHM).generatePublic(new X509EncodedKeySpec(Base64.decode(str)));
} catch (Base64DecoderException e) {
Log.e(TAG, "Base64 decoding failed.");
throw new IllegalArgumentException(e);
} catch (NoSuchAlgorithmException e2) {
throw new RuntimeException(e2);
} catch (InvalidKeySpecException e3) {
Log.e(TAG, "Invalid key specification.");
throw new IllegalArgumentException(e3);
}
}
public static boolean verify(PublicKey publicKey, String str, String str2) {
try {
Signature signature = Signature.getInstance(SIGNATURE_ALGORITHM);
signature.initVerify(publicKey);
signature.update(str.getBytes());
if (signature.verify(Base64.decode(str2))) {
return true;
}
Log.e(TAG, "Signature verification failed.");
return false;
} catch (Base64DecoderException unused) {
Log.e(TAG, "Base64 decoding failed.");
return false;
} catch (InvalidKeyException unused2) {
Log.e(TAG, "Invalid key specification.");
return false;
} catch (NoSuchAlgorithmException unused3) {
Log.e(TAG, "NoSuchAlgorithmException.");
return false;
} catch (SignatureException unused4) {
Log.e(TAG, "Signature exception.");
return false;
}
}
}

View File

@@ -0,0 +1,68 @@
package com.firemonkeys.cloudcellapi.util;
import com.unity3d.ads.metadata.InAppPurchaseMetaData;
import org.json.JSONException;
import org.json.JSONObject;
/* loaded from: classes2.dex */
public class SkuDetails {
public static final String ITEM_TYPE_INAPP = "inapp";
String mDescription;
String mItemType;
String mJson;
String mPrice;
String mPriceAmountMicros;
String mPriceCurrencyCode;
String mSku;
String mTitle;
String mType;
public String getDescription() {
return this.mDescription;
}
public String getPrice() {
return this.mPrice;
}
public String getPriceAmountMicros() {
return this.mPriceAmountMicros;
}
public String getPriceCurrencyCode() {
return this.mPriceCurrencyCode;
}
public String getSku() {
return this.mSku;
}
public String getTitle() {
return this.mTitle;
}
public String getType() {
return this.mType;
}
public SkuDetails(String str) throws JSONException {
this("inapp", str);
}
public SkuDetails(String str, String str2) throws JSONException {
this.mItemType = str;
this.mJson = str2;
JSONObject jSONObject = new JSONObject(this.mJson);
this.mSku = jSONObject.optString(InAppPurchaseMetaData.KEY_PRODUCT_ID);
this.mType = jSONObject.optString("type");
this.mPrice = jSONObject.optString("price");
this.mPriceAmountMicros = jSONObject.optString("price_amount_micros");
this.mPriceCurrencyCode = jSONObject.optString("price_currency_code");
this.mTitle = jSONObject.optString("title");
this.mDescription = jSONObject.optString("description");
}
public String toString() {
return "SkuDetails:" + this.mJson;
}
}