package df1; import android.content.Context; import com.liulishuo.okdownload.core.cause.EndCause; import com.meituan.robust.ChangeQuickRedirect; import com.meituan.robust.PatchProxy; import com.shizhuang.duapp.stream.impl.DuRecorder; import com.shizhuang.duapp.stream.interfaces.IRecorder; import com.shizhuang.duapp.stream.opengl.BaseEffectHelper; import com.shizhuang.duapp.stream.util.ResourceHelper; import fd.i; import fd.n; import fd.q; import java.io.File; import kotlin.Unit; import kotlin.jvm.functions.Function0; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import s9.c; /* compiled from: ResourceUtil.kt */ public final class f { @NotNull /* renamed from: a reason: collision with root package name */ public static final f f31484a = new f(); public static ChangeQuickRedirect changeQuickRedirect; /* compiled from: ResourceUtil.kt */ public static final class a extends vl.a { public static ChangeQuickRedirect changeQuickRedirect; /* renamed from: a reason: collision with root package name */ public final /* synthetic */ IRecorder f31485a; public final /* synthetic */ Context b; /* renamed from: c reason: collision with root package name */ public final /* synthetic */ Function0 f31486c; public a(IRecorder iRecorder, Context context, Function0 function0) { this.f31485a = iRecorder; this.b = context; this.f31486c = function0; } @Override // vl.a public void onTaskCompleted(@NotNull c cVar) { BaseEffectHelper b2; if (!PatchProxy.proxy(new Object[]{cVar}, this, changeQuickRedirect, false, 335142, new Class[]{c.class}, Void.TYPE).isSupported) { super.onTaskCompleted(cVar); File i = cVar.i(); if (i != null && i.getPath() != null) { IRecorder iRecorder = this.f31485a; if (!(iRecorder instanceof DuRecorder)) { iRecorder = null; } DuRecorder duRecorder = (DuRecorder) iRecorder; if (!(duRecorder == null || (b2 = duRecorder.b()) == null)) { b2.a(this.b); } this.f31486c.invoke(); } } } } /* compiled from: ResourceUtil.kt */ public static final class b extends vl.a { public static ChangeQuickRedirect changeQuickRedirect; /* renamed from: a reason: collision with root package name */ public final /* synthetic */ Context f31487a; public final /* synthetic */ Function0 b; /* compiled from: ResourceUtil.kt */ public static final class a implements Runnable { public static ChangeQuickRedirect changeQuickRedirect; public final /* synthetic */ b b; public a(b bVar) { this.b = bVar; } public final void run() { if (!PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 335146, new Class[0], Void.TYPE).isSupported) { this.b.b.invoke(); } } } public b(Context context, Function0 function0) { this.f31487a = context; this.b = function0; } @Override // vl.a public void onTaskEnd(@NotNull c cVar, @NotNull EndCause endCause, @Nullable Exception exc) { if (!PatchProxy.proxy(new Object[]{cVar, endCause, exc}, this, changeQuickRedirect, false, 335145, new Class[]{c.class, EndCause.class, Exception.class}, Void.TYPE).isSupported) { super.onTaskEnd(cVar, endCause, exc); if (endCause == EndCause.COMPLETED && ResourceHelper.f26082a.h(this.f31487a, cVar.i()) != null) { q.c(new a(this)); } } } } public final void a(@Nullable Context context, @Nullable IRecorder iRecorder, @NotNull Function0<Unit> function0) { if (!PatchProxy.proxy(new Object[]{context, iRecorder, function0}, this, changeQuickRedirect, false, 335133, new Class[]{Context.class, IRecorder.class, Function0.class}, Void.TYPE).isSupported) { tl.a.n((String) n.c("community_module", "community_cv_license_v2", String.class, "https://apk.poizon.com/duApp/Android_Config/license/cv/duapp_20210309_20210608_com.shizhuang.duapp_v1.0.2.licbag"), new a(iRecorder, context, function0)); } } public final void b(@Nullable Context context, @NotNull Function0<Unit> function0) { if (!PatchProxy.proxy(new Object[]{context, function0}, this, changeQuickRedirect, false, 335134, new Class[]{Context.class, Function0.class}, Void.TYPE).isSupported) { String str = (String) n.c("community_module", "ModelResourceV2", String.class, "https://apk.poizon.com/duApp/Android_Config/resource/updatehair.zip"); File t = tl.a.t(str); if (t == null || !t.exists()) { tl.a.n(str, new b(context, function0)); return; } ResourceHelper resourceHelper = ResourceHelper.f26082a; String f = resourceHelper.f(context, t); if (f == null || !i.t(f)) { resourceHelper.h(context, t); function0.invoke(); return; } function0.invoke(); } } }