package X; import android.content.Context; import android.os.Build; import com.bef.effectsdk.BEFEffectNative; import com.bytedance.covode.number.Covode; import com.ss.android.ugc.aweme.common.NaviEffectNetworkerImpl; import com.ss.android.ugc.aweme.out.AVExternalServiceImpl; import com.ss.android.ugc.effectmanager.DownloadableModelConfig; import com.ss.android.ugc.effectmanager.DownloadableModelSupport; import com.ss.android.ugc.effectmanager.EffectConfiguration; import com.ss.android.ugc.effectmanager.EffectManager; import com.ss.android.ugc.effectmanager.common.task.ExceptionResult; import com.ss.android.ugc.effectmanager.effect.listener.ICheckChannelListener; import com.ss.android.ugc.effectmanager.effect.listener.IFetchEffectChannelListener; import com.ss.android.ugc.effectmanager.effect.model.Effect; import com.ss.android.ugc.effectmanager.link.model.host.Host; import java.io.File; import java.util.List; import kotlin.g.b.m; /* renamed from: X.NCz reason: case insensitive filesystem */ public final class C58960NCz implements ICheckChannelListener { public static final C58960NCz LIZ = new C58960NCz(); public static final String LIZIZ = "NaviLokiHelper"; public static final String LIZJ = C53584L2f.LIZ().LIZ; public static String LIZLLL = BEFEffectNative.getEffectSDKVersion(); public static EffectManager LJ; public static IFetchEffectChannelListener LJFF; static { Covode.recordClassIndex(53097); } private final List<Host> LIZ() { return AnonymousClass1ZP.LIZLLL(new Host("https://api-va.tiktokv.com")); } public static Context LIZJ(Context context) { Context applicationContext = context.getApplicationContext(); return (C16360kz.LIZJ && applicationContext == null) ? C16360kz.LIZ : applicationContext; } public final DownloadableModelSupport LIZ(Context context) { C21090sc.LIZ(context); if (!DownloadableModelSupport.isInitialized()) { DownloadableModelConfig.Builder accessKey = new DownloadableModelConfig.Builder().setContext(context).setAccessKey("142710f02c3a11e8b42429f14557854a"); Boolean LIZIZ2 = C18450oM.LIZIZ.LIZ().LJJIFFI().LIZIZ(); m.LIZIZ(LIZIZ2, ""); DownloadableModelSupport.initialize(accessKey.setAppId(LIZIZ2.booleanValue() ? "1180" : "1233").setHosts(LIZ()).setSdkVersion(LIZLLL).setDeviceType(Build.MODEL).setJsonConverter(new C84383Tv()).setModelFileEnv(AVExternalServiceImpl.LIZ().configService().avsettingsConfig().enableModelFileOnlyEnv() ? DownloadableModelConfig.ModelFileEnv.ONLINE : DownloadableModelConfig.ModelFileEnv.TEST).setEffectNetWorker(new NaviEffectNetworkerImpl()).setAssetManager(context.getAssets()).setWorkspace(AVExternalServiceImpl.LIZ().configService().cacheConfig().effectModelDir()).setExecutor(C14740iN.LIZ()).build()); } DownloadableModelSupport instance = DownloadableModelSupport.getInstance(); m.LIZIZ(instance, ""); return instance; } public final void LIZ(Context context, IFetchEffectChannelListener iFetchEffectChannelListener) { C21090sc.LIZ(context, iFetchEffectChannelListener); LJFF = iFetchEffectChannelListener; LIZ(context); LIZIZ(context); } public final void LIZ(Effect effect, int i2, AnonymousClass1IX<? super Boolean, ? super Effect, C23860x5> r5) { C21090sc.LIZ(effect, r5); EffectManager effectManager = LJ; if (effectManager != null) { if (effectManager == null) { m.LIZIZ(); } if (effectManager.isEffectReady(effect)) { EffectManager effectManager2 = LJ; if (effectManager2 == null) { m.LIZIZ(); } if (effectManager2.isEffectDownloaded(effect)) { r5.invoke(false, effect); return; } } EffectManager effectManager3 = LJ; if (effectManager3 == null) { m.LIZIZ(); } effectManager3.fetchEffect(effect, new C53583L2e(i2, r5, effect)); } } public final EffectManager LIZIZ(Context context) { C21090sc.LIZ(context); if (LJ == null) { EffectConfiguration.Builder accessKey = new EffectConfiguration.Builder().accessKey("142710f02c3a11e8b42429f14557854a"); String LJIIIZ = C18450oM.LIZIZ.LIZ().LJJ().LJIIIZ(); if (LJIIIZ == null) { LJIIIZ = "test"; } EffectConfiguration.Builder deviceType = accessKey.channel(LJIIIZ).sdkVersion(LIZLLL).appVersion(LIZLLL).platform("android").deviceType(Build.MODEL); String LIZ2 = C18450oM.LIZIZ.LIZ().LJJ().LIZ(); if (LIZ2 == null) { LIZ2 = "0"; } EffectConfiguration.Builder executor = deviceType.deviceId(LIZ2).effectDir(new File(AVExternalServiceImpl.LIZ().configService().cacheConfig().effectCacheDir())).JsonConverter(new C84383Tv()).effectNetWorker(new NaviEffectNetworkerImpl()).hosts(LIZ()).context(LIZJ(context)).retryCount(3).region("").executor(C14740iN.LIZ()); DownloadableModelSupport instance = DownloadableModelSupport.getInstance(); m.LIZIZ(instance, ""); EffectConfiguration build = executor.effectFetcher(instance.getEffectFetcher()).build(); m.LIZIZ(build, ""); EffectManager effectManager = new EffectManager(); LJ = effectManager; effectManager.init(build); } EffectManager effectManager2 = LJ; if (effectManager2 == null) { m.LIZIZ(); } return effectManager2; } @Override // com.ss.android.ugc.effectmanager.effect.listener.ICheckChannelListener public final void checkChannelFailed(ExceptionResult exceptionResult) { Exception exception; if (exceptionResult != null && (exception = exceptionResult.getException()) != null) { exception.printStackTrace(); } } @Override // com.ss.android.ugc.effectmanager.effect.listener.ICheckChannelListener public final void checkChannelSuccess(boolean z) { IFetchEffectChannelListener iFetchEffectChannelListener = LJFF; if (iFetchEffectChannelListener == null) { return; } if (z) { EffectManager effectManager = LJ; if (effectManager != null) { effectManager.fetchEffectList(LIZJ, false, iFetchEffectChannelListener); return; } return; } EffectManager effectManager2 = LJ; if (effectManager2 != null) { effectManager2.fetchEffectListFromCache(LIZJ, iFetchEffectChannelListener); } } }