package com.tapjoy; import android.content.Context; import android.text.TextUtils; import com.tapjoy.TapjoyErrorMessage; import com.tapjoy.internal.p2; import com.tapjoy.internal.u2; import java.util.Hashtable; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; /* loaded from: classes4.dex */ public abstract class m1 extends p2 { public TJCurrency b = null; public final ExecutorService c = Executors.newSingleThreadExecutor(); public final void b(final String str, final TJSetUserIDListener tJSetUserIDListener) { if (a("setUserID")) { this.c.submit(new Runnable() { // from class: com.tapjoy.m1$$ExternalSyntheticLambda0 @Override // java.lang.Runnable public final void run() { TJUser.INSTANCE.setUserIdRequest(str, tJSetUserIDListener); } }); } else if (tJSetUserIDListener != null) { tJSetUserIDListener.onSetUserIDFailure("Tapjoy SDK is not connected"); tJSetUserIDListener.onSetUserIDFailure(0, "Tapjoy SDK is not connected"); } } public synchronized boolean a(Context context, String str, Hashtable hashtable, TJConnectListener tJConnectListener) { if (hashtable != null) { try { Object obj = hashtable.get(TapjoyConnectFlag.ENABLE_LOGGING); if (obj != null) { TapjoyLog.setDebugEnabled("true".equals(obj.toString())); } } catch (Throwable th) { throw th; } } if (context == null) { TapjoyLog.e("TapjoyAPI", new TapjoyErrorMessage(TapjoyErrorMessage.ErrorType.INTEGRATION_ERROR, "The application context is NULL")); if (tJConnectListener != null) { ((u2) tJConnectListener).a.c(1, "The application context is NULL"); } return false; } com.tapjoy.internal.j.a(context); if (TextUtils.isEmpty(str)) { TapjoyLog.e("TapjoyAPI", new TapjoyErrorMessage(TapjoyErrorMessage.ErrorType.INTEGRATION_ERROR, "The SDK key is NULL. A valid SDK key is required to connect successfully to Tapjoy")); if (tJConnectListener != null) { ((u2) tJConnectListener).a.c(1, "The SDK key is NULL. A valid SDK key is required to connect successfully to Tapjoy"); } return false; } try { TapjoyAppSettings.init(context); this.b = new TJCurrency(context); TapjoyConnectCore.getInstance().requestTapjoyConnect(context, str, hashtable, new l1((u2) tJConnectListener)); TJSession.INSTANCE.setAutomaticSessionTracking(context, hashtable); return true; } catch (TapjoyIntegrationException e) { TapjoyLog.e("TapjoyAPI", new TapjoyErrorMessage(TapjoyErrorMessage.ErrorType.INTEGRATION_ERROR, e.getMessage())); if (tJConnectListener != null) { ((u2) tJConnectListener).a.c(1, e.getMessage()); } return false; } catch (TapjoyException e2) { TapjoyLog.e("TapjoyAPI", new TapjoyErrorMessage(TapjoyErrorMessage.ErrorType.SDK_ERROR, e2.getMessage())); if (tJConnectListener != null) { ((u2) tJConnectListener).a.c(1, e2.getMessage()); } return false; } } public static boolean a(String str) { if (TapjoyConnectCore.getInstance().isConnected()) { return true; } TapjoyLog.w("TapjoyAPI", "Can not call " + str + " because Tapjoy SDK has not successfully connected."); return false; } }