Initial commit
This commit is contained in:
99
sources/com/unity3d/ads/metadata/InAppPurchaseMetaData.java
Normal file
99
sources/com/unity3d/ads/metadata/InAppPurchaseMetaData.java
Normal file
@@ -0,0 +1,99 @@
|
||||
package com.unity3d.ads.metadata;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
/* loaded from: classes2.dex */
|
||||
public class InAppPurchaseMetaData extends MetaData {
|
||||
public static final String IAP_KEY = "iap";
|
||||
public static final String KEY_CURRENCY = "currency";
|
||||
public static final String KEY_PRICE = "price";
|
||||
public static final String KEY_PRODUCT_ID = "productId";
|
||||
public static final String KEY_RECEIPT_PURCHASE_DATA = "receiptPurchaseData";
|
||||
public static final String KEY_SIGNATURE = "signature";
|
||||
|
||||
public InAppPurchaseMetaData(Context context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
/* JADX WARN: Removed duplicated region for block: B:10:0x002a */
|
||||
@Override // com.unity3d.ads.metadata.MetaData
|
||||
/*
|
||||
Code decompiled incorrectly, please refer to instructions dump.
|
||||
To view partially-correct code enable 'Show inconsistent code' option in preferences
|
||||
*/
|
||||
public void commit() {
|
||||
/*
|
||||
r7 = this;
|
||||
android.content.Context r0 = r7._context
|
||||
boolean r0 = com.unity3d.ads.device.StorageManager.init(r0)
|
||||
if (r0 == 0) goto L55
|
||||
com.unity3d.ads.device.StorageManager$StorageType r0 = com.unity3d.ads.device.StorageManager.StorageType.PUBLIC
|
||||
com.unity3d.ads.device.Storage r0 = com.unity3d.ads.device.StorageManager.getStorage(r0)
|
||||
org.json.JSONObject r1 = r7.getData()
|
||||
if (r1 == 0) goto L5a
|
||||
if (r0 == 0) goto L5a
|
||||
java.lang.String r1 = "iap.purchases"
|
||||
java.lang.Object r2 = r0.get(r1)
|
||||
r3 = 0
|
||||
if (r2 == 0) goto L27
|
||||
org.json.JSONArray r2 = (org.json.JSONArray) r2 // Catch: java.lang.Exception -> L22
|
||||
goto L28
|
||||
L22:
|
||||
java.lang.String r2 = "Invalid object type for purchases"
|
||||
com.unity3d.ads.log.DeviceLog.error(r2)
|
||||
L27:
|
||||
r2 = r3
|
||||
L28:
|
||||
if (r2 != 0) goto L2f
|
||||
org.json.JSONArray r2 = new org.json.JSONArray
|
||||
r2.<init>()
|
||||
L2f:
|
||||
org.json.JSONObject r3 = r7.getData()
|
||||
java.lang.String r4 = "ts"
|
||||
long r5 = java.lang.System.currentTimeMillis() // Catch: org.json.JSONException -> L4f
|
||||
r3.put(r4, r5) // Catch: org.json.JSONException -> L4f
|
||||
r2.put(r3)
|
||||
r0.set(r1, r2)
|
||||
r0.writeStorage()
|
||||
com.unity3d.ads.device.StorageEvent r2 = com.unity3d.ads.device.StorageEvent.SET
|
||||
java.lang.Object r1 = r0.get(r1)
|
||||
r0.sendEvent(r2, r1)
|
||||
goto L5a
|
||||
L4f:
|
||||
java.lang.String r0 = "Error constructing purchase object"
|
||||
com.unity3d.ads.log.DeviceLog.error(r0)
|
||||
return
|
||||
L55:
|
||||
java.lang.String r0 = "Unity Ads could not commit metadata due to storage error or the data is null"
|
||||
com.unity3d.ads.log.DeviceLog.error(r0)
|
||||
L5a:
|
||||
return
|
||||
*/
|
||||
throw new UnsupportedOperationException("Method not decompiled: com.unity3d.ads.metadata.InAppPurchaseMetaData.commit():void");
|
||||
}
|
||||
|
||||
@Override // com.unity3d.ads.metadata.MetaData, com.unity3d.ads.misc.JsonStorage
|
||||
public synchronized boolean set(String str, Object obj) {
|
||||
return setRaw(str, obj);
|
||||
}
|
||||
|
||||
public void setCurrency(String str) {
|
||||
set(KEY_CURRENCY, str);
|
||||
}
|
||||
|
||||
public void setPrice(Double d) {
|
||||
set(KEY_PRICE, d);
|
||||
}
|
||||
|
||||
public void setProductId(String str) {
|
||||
set(KEY_PRODUCT_ID, str);
|
||||
}
|
||||
|
||||
public void setReceiptPurchaseData(String str) {
|
||||
set(KEY_RECEIPT_PURCHASE_DATA, str);
|
||||
}
|
||||
|
||||
public void setSignature(String str) {
|
||||
set(KEY_SIGNATURE, str);
|
||||
}
|
||||
}
|
32
sources/com/unity3d/ads/metadata/MediationMetaData.java
Normal file
32
sources/com/unity3d/ads/metadata/MediationMetaData.java
Normal file
@@ -0,0 +1,32 @@
|
||||
package com.unity3d.ads.metadata;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
/* loaded from: classes2.dex */
|
||||
public class MediationMetaData extends MetaData {
|
||||
public static final String KEY_MISSED_IMPRESSION_ORDINAL = "missedImpressionOrdinal";
|
||||
public static final String KEY_NAME = "name";
|
||||
public static final String KEY_ORDINAL = "ordinal";
|
||||
public static final String KEY_VERSION = "version";
|
||||
|
||||
public MediationMetaData(Context context) {
|
||||
super(context);
|
||||
setCategory("mediation");
|
||||
}
|
||||
|
||||
public void setMissedImpressionOrdinal(int i) {
|
||||
set(KEY_MISSED_IMPRESSION_ORDINAL, Integer.valueOf(i));
|
||||
}
|
||||
|
||||
public void setName(String str) {
|
||||
set(KEY_NAME, str);
|
||||
}
|
||||
|
||||
public void setOrdinal(int i) {
|
||||
set(KEY_ORDINAL, Integer.valueOf(i));
|
||||
}
|
||||
|
||||
public void setVersion(String str) {
|
||||
set(KEY_VERSION, str);
|
||||
}
|
||||
}
|
80
sources/com/unity3d/ads/metadata/MetaData.java
Normal file
80
sources/com/unity3d/ads/metadata/MetaData.java
Normal file
@@ -0,0 +1,80 @@
|
||||
package com.unity3d.ads.metadata;
|
||||
|
||||
import android.content.Context;
|
||||
import com.unity3d.ads.device.Storage;
|
||||
import com.unity3d.ads.device.StorageEvent;
|
||||
import com.unity3d.ads.device.StorageManager;
|
||||
import com.unity3d.ads.log.DeviceLog;
|
||||
import com.unity3d.ads.misc.JsonStorage;
|
||||
import com.unity3d.ads.misc.Utilities;
|
||||
import java.util.Iterator;
|
||||
import org.json.JSONObject;
|
||||
|
||||
/* loaded from: classes2.dex */
|
||||
public class MetaData extends JsonStorage {
|
||||
private String _category;
|
||||
protected Context _context;
|
||||
|
||||
public MetaData(Context context) {
|
||||
this._context = context.getApplicationContext();
|
||||
}
|
||||
|
||||
private String getActualKey(String str) {
|
||||
if (getCategory() == null) {
|
||||
return str;
|
||||
}
|
||||
return getCategory() + "." + str;
|
||||
}
|
||||
|
||||
public void commit() {
|
||||
if (!StorageManager.init(this._context)) {
|
||||
DeviceLog.error("Unity Ads could not commit metadata due to storage error");
|
||||
return;
|
||||
}
|
||||
Storage storage = StorageManager.getStorage(StorageManager.StorageType.PUBLIC);
|
||||
if (getData() == null || storage == null) {
|
||||
return;
|
||||
}
|
||||
Iterator<String> keys = getData().keys();
|
||||
while (keys.hasNext()) {
|
||||
String next = keys.next();
|
||||
Object obj = get(next);
|
||||
if (storage.get(next) != null && (storage.get(next) instanceof JSONObject) && (get(next) instanceof JSONObject)) {
|
||||
try {
|
||||
obj = Utilities.mergeJsonObjects((JSONObject) obj, (JSONObject) storage.get(next));
|
||||
} catch (Exception e) {
|
||||
DeviceLog.exception("Exception merging JSONs", e);
|
||||
}
|
||||
}
|
||||
storage.set(next, obj);
|
||||
}
|
||||
storage.writeStorage();
|
||||
storage.sendEvent(StorageEvent.SET, getData());
|
||||
}
|
||||
|
||||
public String getCategory() {
|
||||
return this._category;
|
||||
}
|
||||
|
||||
@Override // com.unity3d.ads.misc.JsonStorage
|
||||
public synchronized boolean set(String str, Object obj) {
|
||||
boolean z;
|
||||
initData();
|
||||
z = false;
|
||||
if (super.set(getActualKey(str) + ".value", obj)) {
|
||||
if (super.set(getActualKey(str) + ".ts", Long.valueOf(System.currentTimeMillis()))) {
|
||||
z = true;
|
||||
}
|
||||
}
|
||||
return z;
|
||||
}
|
||||
|
||||
public void setCategory(String str) {
|
||||
this._category = str;
|
||||
}
|
||||
|
||||
protected synchronized boolean setRaw(String str, Object obj) {
|
||||
initData();
|
||||
return super.set(getActualKey(str), obj);
|
||||
}
|
||||
}
|
17
sources/com/unity3d/ads/metadata/PlayerMetaData.java
Normal file
17
sources/com/unity3d/ads/metadata/PlayerMetaData.java
Normal file
@@ -0,0 +1,17 @@
|
||||
package com.unity3d.ads.metadata;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
/* loaded from: classes2.dex */
|
||||
public class PlayerMetaData extends MetaData {
|
||||
public static final String KEY_SERVER_ID = "server_id";
|
||||
|
||||
public PlayerMetaData(Context context) {
|
||||
super(context);
|
||||
setCategory("player");
|
||||
}
|
||||
|
||||
public void setServerId(String str) {
|
||||
set(KEY_SERVER_ID, str);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user