package csdk.glucustomersupport; import android.app.Activity; import com.facebook.share.internal.ShareConstants; import com.ironsource.nb; import csdk.glucustomersupport.eventbus.GluConfigEventHandler; import csdk.glucustomersupport.eventbus.GluEventBus; import csdk.glucustomersupport.eventbus.GluEventHandler; import csdk.glucustomersupport.impl.GluDummyImpl; import csdk.glucustomersupport.impl.GluHelpshift; import csdk.glucustomersupport.impl.GluImplWrapper; import csdk.glucustomersupport.util.ConfigUtil; import csdk.glucustomersupport.util.GluUtil; import csdk.glucustomersupport.util.IAction2; import csdk.glucustomersupport.util.JsonUtil; import csdk.glucustomersupport.util.StringStore; import java.util.Locale; import java.util.Map; import java.util.concurrent.Callable; import org.json.JSONException; /* loaded from: classes4.dex */ public class GluFactory { public IGluCustomerSupport createCustomerSupport(final Callable callable, String str, Map map) { final GluImplWrapper gluImplWrapper = new GluImplWrapper(); final Map shallowClone = GluUtil.shallowClone(map); try { GluConfigEventHandler.request(str, JsonUtil.parseJsonObject(str), new IAction2() { // from class: csdk.glucustomersupport.GluFactory.1 @Override // csdk.glucustomersupport.util.IAction2 public void apply(String str2, String str3) { try { Map parseJsonObject = JsonUtil.parseJsonObject(str2); boolean z = ConfigUtil.getBoolean(parseJsonObject, "csdk.gluCustomerSupport.debug.all", false); Object[] objArr = new Object[4]; objArr[0] = "sdk"; objArr[1] = Consts.SDK_GLU_CUSTOMERSUPPORT; objArr[2] = ShareConstants.FEED_SOURCE_PARAM; objArr[3] = str3 != null ? str3.toUpperCase(Locale.US) : null; GluUtil.log(z, "CONFIG.RECONFIGURE", objArr); gluImplWrapper.setImpl(GluFactory.this.createInternal(callable, parseJsonObject, shallowClone, z)); } catch (JSONException e) { throw GluUtil.propagate(e); } } }); return gluImplWrapper; } catch (JSONException e) { throw GluUtil.propagate(e); } } /* JADX INFO: Access modifiers changed from: private */ public IGluCustomerSupport createInternal(Callable callable, Map map, Map map2, boolean z) { GluUtil.log(z, "SDK.VERSION", nb.q, Consts.SDK_GLU_CUSTOMERSUPPORT, csdk.gluads.Consts.KEY_TAPJOY_USER_ID_VERSION, BuildConfig.VERSION_NAME); if (ConfigUtil.getBoolean(map, "csdk.disabled.gluCustomerSupport", false)) { return new GluDummyImpl(); } StringStore.init(); GluHelpshift gluHelpshift = ConfigUtil.getString(map, "csdk.gluCustomerSupport.provider", "helpshift").equals("kustomer") ? null : new GluHelpshift(callable, map, map2); if (gluHelpshift == null) { return new GluDummyImpl(); } gluHelpshift.init(GluEventHandler.subscribe(ConfigUtil.getBoolean(map, "csdk.gluCustomerSupport.disabled.eventBus", false) ? GluEventBus.DISCONNECTED : GluEventBus.SHARED, GluEventBus.GLOBAL_TOKEN, gluHelpshift)); return gluHelpshift; } }