Files
rr3-apk/decompiled/sources/com/tapjoy/TJCurrency.java
Daniel Elliott f9d20bb3fc Add decompiled APK source code (JADX)
- 28,932 files
- Full Java source code
- Smali files
- Resources

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-02-18 14:52:23 -08:00

99 lines
4.6 KiB
Java

package com.tapjoy;
import android.content.Context;
import android.content.SharedPreferences;
import com.tapjoy.TapjoyErrorMessage;
import java.util.Map;
/* loaded from: classes4.dex */
public class TJCurrency {
public static TJEarnedCurrencyListener c;
public final Context a;
public Boolean b;
public TJCurrency(Context context) {
this.a = context;
}
public void awardCurrency(int i, TJAwardCurrencyListener tJAwardCurrencyListener) {
if (i < 0) {
TapjoyLog.e("TJCurrency", new TapjoyErrorMessage(TapjoyErrorMessage.ErrorType.INTEGRATION_ERROR, "Amount must be a positive number for the awardCurrency API"));
if (tJAwardCurrencyListener != null) {
tJAwardCurrencyListener.onAwardCurrencyResponseFailure("Amount must be a positive number for the awardCurrency API");
return;
}
return;
}
if (a()) {
TapjoyLog.e("TJCurrency", new TapjoyErrorMessage(TapjoyErrorMessage.ErrorType.INTEGRATION_ERROR, "awardCurrency is not supported with self managed currency"));
if (tJAwardCurrencyListener != null) {
tJAwardCurrencyListener.onAwardCurrencyResponseFailure("awardCurrency is not supported with self managed currency");
return;
}
return;
}
Map<String, String> baseURLParams = TapjoyConnectCore.getInstance().getBaseURLParams();
TapjoyUtil.safePut(baseURLParams, TapjoyConstants.TJC_CURRENCY, String.valueOf(i), true);
baseURLParams.putAll(TJVerifier.INSTANCE.getTapjoyAwardCurrencyVerifierAndTimeStampParams(i));
new Thread(new h0(this, baseURLParams, tJAwardCurrencyListener)).start();
}
public void getCurrencyBalance(TJGetCurrencyBalanceListener tJGetCurrencyBalanceListener) {
if (!a()) {
new Thread(new f0(this, TapjoyConnectCore.getInstance().getBaseURLParams(), tJGetCurrencyBalanceListener)).start();
return;
}
TapjoyLog.e("TJCurrency", new TapjoyErrorMessage(TapjoyErrorMessage.ErrorType.INTEGRATION_ERROR, "getCurrencyBalance is not supported with self managed currency"));
if (tJGetCurrencyBalanceListener != null) {
tJGetCurrencyBalanceListener.onGetCurrencyBalanceResponseFailure("getCurrencyBalance is not supported with self managed currency");
}
}
public int getLocalCurrencyBalance() {
return this.a.getSharedPreferences(TapjoyConstants.TJC_PREFERENCE, 0).getInt(TapjoyConstants.PREF_SERVER_CURRENCY_BALANCE, -9999);
}
public void saveCurrencyBalance(int i) {
SharedPreferences.Editor edit = this.a.getSharedPreferences(TapjoyConstants.TJC_PREFERENCE, 0).edit();
edit.putInt(TapjoyConstants.PREF_SERVER_CURRENCY_BALANCE, i);
edit.apply();
}
public void setEarnedCurrencyListener(TJEarnedCurrencyListener tJEarnedCurrencyListener) {
c = tJEarnedCurrencyListener;
}
public void spendCurrency(int i, TJSpendCurrencyListener tJSpendCurrencyListener) {
if (i < 0) {
TapjoyLog.e("TJCurrency", new TapjoyErrorMessage(TapjoyErrorMessage.ErrorType.INTEGRATION_ERROR, "Amount must be a positive number for the spendCurrency API"));
if (tJSpendCurrencyListener != null) {
tJSpendCurrencyListener.onSpendCurrencyResponseFailure("Amount must be a positive number for the spendCurrency API");
return;
}
return;
}
if (a()) {
TapjoyLog.e("TJCurrency", new TapjoyErrorMessage(TapjoyErrorMessage.ErrorType.INTEGRATION_ERROR, "spendCurrency is not supported with self managed currency"));
if (tJSpendCurrencyListener != null) {
tJSpendCurrencyListener.onSpendCurrencyResponseFailure("spendCurrency is not supported with self managed currency");
return;
}
return;
}
Map<String, String> baseURLParams = TapjoyConnectCore.getInstance().getBaseURLParams();
TapjoyUtil.safePut(baseURLParams, TapjoyConstants.TJC_CURRENCY, "" + i, true);
new Thread(new g0(this, baseURLParams, tJSpendCurrencyListener)).start();
}
public final boolean a() {
if (this.b == null) {
SharedPreferences sharedPreferences = this.a.getSharedPreferences(TapjoyConstants.TJC_PREFERENCE, 0);
if (!sharedPreferences.contains("self_managed")) {
return false;
}
this.b = Boolean.valueOf(sharedPreferences.getBoolean("self_managed", false));
}
return this.b.booleanValue();
}
}