小红书.apk(点击下载) / e.java


package q40;

import android.content.Context;
import android.graphics.Bitmap;
import android.net.Uri;
import android.os.Bundle;
import cn.jiguang.union.ads.api.JUnionAdError;
import cn.jpush.android.local.JPushConstants;
import com.alibaba.alibclinkpartner.linkpartner.constants.ALPParamConstant;
import com.meizu.cloud.pushsdk.notification.model.AdvanceSetting;
import com.tencent.smtt.sdk.TbsReaderView;
import com.xingin.android.redutils.base.XhsActivity;
import com.xingin.android.xhscomm.router.RouterCallback;
import com.xingin.android.xhscomm.router.Routers;
import com.xingin.skynet.utils.ServerError;
import com.xingin.uploader.api.RobusterClient;
import com.xingin.uploader.api.UploaderResult;
import com.xingin.uploader.api.UploaderResultListener;
import com.xingin.utils.async.run.task.XYRunnable;
import dw2.r;
import java.io.File;
import java.io.FileOutputStream;
import java.util.UUID;
import kotlin.Metadata;
import kotlin.Unit;
import kotlin.io.CloseableKt;
import kotlin.jvm.functions.Function1;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.FunctionReferenceImpl;
import kotlin.jvm.internal.Intrinsics;
import kotlin.jvm.internal.Lambda;
import kotlin.text.StringsKt__StringsJVMKt;
import n40.d;
import t10.z0;

@Metadata(bv = {}, d1 = {"\u0000Z\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u0002\n\u0002\b\u0004\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010\u000e\n\u0002\b\u0007\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0006\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0006\n\u0002\u0018\u0002\n\u0002\b\f\n\u0002\u0018\u0002\n\u0002\b\n\u0018\u00002\u0014\u0012\u0004\u0012\u00020\u0002\u0012\u0004\u0012\u00020\u0000\u0012\u0004\u0012\u00020\u00030\u0001:\u0001>B\u0007¢\u0006\u0004\b<\u0010=J\b\u0010\u0005\u001a\u00020\u0004H\u0002J\b\u0010\u0007\u001a\u00020\u0006H\u0002J\b\u0010\b\u001a\u00020\u0006H\u0002J\b\u0010\t\u001a\u00020\u0006H\u0002J\b\u0010\n\u001a\u00020\u0006H\u0002J\u0010\u0010\r\u001a\u00020\u00062\u0006\u0010\f\u001a\u00020\u000bH\u0002J\u0010\u0010\u0010\u001a\u00020\u00062\u0006\u0010\u000f\u001a\u00020\u000eH\u0002J\u0010\u0010\u0012\u001a\u00020\u00062\u0006\u0010\u0011\u001a\u00020\u000eH\u0002J\b\u0010\u0013\u001a\u00020\u000eH\u0002J\b\u0010\u0014\u001a\u00020\u000eH\u0002J\b\u0010\u0015\u001a\u00020\u0006H\u0002J\u0012\u0010\u0018\u001a\u00020\u00062\b\u0010\u0017\u001a\u0004\u0018\u00010\u0016H\u0014R\"\u0010\u001a\u001a\u00020\u00198\u0006@\u0006X‡.¢\u0006\u0012\n\u0004\b\u001a\u0010\u001b\u001a\u0004\b\u001c\u0010\u001d\"\u0004\b\u001e\u0010\u001fR(\u0010\"\u001a\b\u0012\u0004\u0012\u00020!0 8\u0006@\u0006X‡.¢\u0006\u0012\n\u0004\b\"\u0010#\u001a\u0004\b$\u0010%\"\u0004\b&\u0010'R(\u0010)\u001a\b\u0012\u0004\u0012\u00020\u00060(8\u0006@\u0006X‡.¢\u0006\u0012\n\u0004\b)\u0010*\u001a\u0004\b+\u0010,\"\u0004\b-\u0010.R\"\u0010/\u001a\u00020\u000e8\u0006@\u0006X‡.¢\u0006\u0012\n\u0004\b/\u00100\u001a\u0004\b1\u00102\"\u0004\b3\u00104R\"\u00106\u001a\u0002058\u0006@\u0006X‡.¢\u0006\u0012\n\u0004\b6\u00107\u001a\u0004\b8\u00109\"\u0004\b:\u0010;¨\u0006?"}, d2 = {"Lq40/e;", "Ltu0/b;", "Lq40/l;", "Lq40/i;", "Lhw2/c;", "listenAttachEvent", "", "k1", "j1", "l1", "o1", "Landroid/graphics/Bitmap;", "bitmap", "n1", "", TbsReaderView.KEY_FILE_PATH, "p1", "imageUrl", "a1", "c1", "i1", "m1", "Landroid/os/Bundle;", "savedInstanceState", "onAttach", "Lcom/xingin/android/redutils/base/XhsActivity;", "activity", "Lcom/xingin/android/redutils/base/XhsActivity;", "getActivity", "()Lcom/xingin/android/redutils/base/XhsActivity;", "setActivity", "(Lcom/xingin/android/redutils/base/XhsActivity;)V", "Ldx2/b;", "Lo40/c;", "cameraActionObservable", "Ldx2/b;", "e1", "()Ldx2/b;", "setCameraActionObservable", "(Ldx2/b;)V", "Ldx2/d;", "backPressEvent", "Ldx2/d;", "d1", "()Ldx2/d;", "setBackPressEvent", "(Ldx2/d;)V", "intentFaceRoute", "Ljava/lang/String;", "f1", "()Ljava/lang/String;", "setIntentFaceRoute", "(Ljava/lang/String;)V", "Lp40/a;", "trackHelper", "Lp40/a;", "h1", "()Lp40/a;", "setTrackHelper", "(Lp40/a;)V", "<init>", "()V", "a", "ar_library_release"}, k = 1, mv = {1, 6, 0})
/* compiled from: SkinAnalysisPageController.kt */
public final class e extends tu0.b<l, e, i> {

    /* renamed from: h  reason: collision with root package name */
    public static final a f120512h = new a(null);

    /* renamed from: a  reason: collision with root package name */
    public XhsActivity f120513a;

    /* renamed from: b  reason: collision with root package name */
    public dx2.b<o40.c> f120514b;

    /* renamed from: c  reason: collision with root package name */
    public Bitmap f120515c;

    /* renamed from: d  reason: collision with root package name */
    public hw2.c f120516d;

    /* renamed from: e  reason: collision with root package name */
    public dx2.d<Unit> f120517e;

    /* renamed from: f  reason: collision with root package name */
    public String f120518f;

    /* renamed from: g  reason: collision with root package name */
    public p40.a f120519g;

    @Metadata(bv = {}, d1 = {"\u0000\u0010\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\u0010\u000e\n\u0002\b\u0005\b†\u0003\u0018\u00002\u00020\u0001B\t\b\u0002¢\u0006\u0004\b\u0005\u0010\u0006R\u0014\u0010\u0003\u001a\u00020\u00028\u0006X†T¢\u0006\u0006\n\u0004\b\u0003\u0010\u0004¨\u0006\u0007"}, d2 = {"Lq40/e$a;", "", "", "TAG", "Ljava/lang/String;", "<init>", "()V", "ar_library_release"}, k = 1, mv = {1, 6, 0})
    /* compiled from: SkinAnalysisPageController.kt */
    public static final class a {
        public a() {
        }

        public /* synthetic */ a(DefaultConstructorMarker defaultConstructorMarker) {
            this();
        }
    }

    @Metadata(bv = {}, d1 = {"\u0000\u0010\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010\u0002\n\u0002\b\u0002\u0010\u0004\u001a\u00020\u00032\u000e\u0010\u0002\u001a\n \u0001*\u0004\u0018\u00010\u00000\u0000H\n¢\u0006\u0004\b\u0004\u0010\u0005"}, d2 = {"Lo40/j;", "kotlin.jvm.PlatformType", AdvanceSetting.NETWORK_TYPE, "", "b", "(Lo40/j;)V"}, k = 3, mv = {1, 6, 0})
    /* compiled from: SkinAnalysisPageController.kt */
    public static final class b extends Lambda implements Function1<o40.j, Unit> {

        /* renamed from: a  reason: collision with root package name */
        public final /* synthetic */ long f120520a;

        /* renamed from: b  reason: collision with root package name */
        public final /* synthetic */ e f120521b;

        @Metadata(bv = {}, d1 = {"\u0000+\n\u0000\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u0002\n\u0002\b\u0002\n\u0002\u0010\u000b\n\u0000\n\u0002\u0010\u0003\n\u0002\b\u0003*\u0001\u0000\b\n\u0018\u00002\u00020\u0001J\u001c\u0010\u0007\u001a\u00020\u00062\b\u0010\u0003\u001a\u0004\u0018\u00010\u00022\b\u0010\u0005\u001a\u0004\u0018\u00010\u0004H\u0016J\u001c\u0010\b\u001a\u00020\u00062\b\u0010\u0003\u001a\u0004\u0018\u00010\u00022\b\u0010\u0005\u001a\u0004\u0018\u00010\u0004H\u0016J\u001c\u0010\n\u001a\u00020\t2\b\u0010\u0003\u001a\u0004\u0018\u00010\u00022\b\u0010\u0005\u001a\u0004\u0018\u00010\u0004H\u0016J&\u0010\r\u001a\u00020\u00062\b\u0010\u0003\u001a\u0004\u0018\u00010\u00022\b\u0010\u0005\u001a\u0004\u0018\u00010\u00042\b\u0010\f\u001a\u0004\u0018\u00010\u000bH\u0016¨\u0006\u000e"}, d2 = {"q40/e$b$a", "Lcom/xingin/android/xhscomm/router/RouterCallback;", "Landroid/content/Context;", "context", "Landroid/net/Uri;", ALPParamConstant.URI, "", "afterOpen", "notFound", "", "beforeOpen", "", "e", "error", "ar_library_release"}, k = 1, mv = {1, 6, 0})
        /* compiled from: SkinAnalysisPageController.kt */
        public static final class a implements RouterCallback {

            /* renamed from: a  reason: collision with root package name */
            public final /* synthetic */ e f120522a;

            public a(e eVar) {
                this.f120522a = eVar;
            }

            @Override // com.xingin.android.xhscomm.router.RouterCallback
            public void afterOpen(Context context, Uri uri) {
                ((l) this.f120522a.getPresenter()).k();
            }

            @Override // com.xingin.android.xhscomm.router.RouterCallback
            public boolean beforeOpen(Context context, Uri uri) {
                return false;
            }

            @Override // com.xingin.android.xhscomm.router.RouterCallback
            public void error(Context context, Uri uri, Throwable th3) {
            }

            @Override // com.xingin.android.xhscomm.router.RouterCallback
            public void notFound(Context context, Uri uri) {
            }
        }

        /* JADX INFO: super call moved to the top of the method (can break code semantics) */
        public b(long j14, e eVar) {
            super(1);
            this.f120520a = j14;
            this.f120521b = eVar;
        }

        public static final void c(e eVar) {
            Intrinsics.checkNotNullParameter(eVar, "this$0");
            eVar.e1().a(new o40.c(o40.b.GOTO_SKIN_PROFILE, null, 2, null));
        }

        public final void b(o40.j jVar) {
            long currentTimeMillis = System.currentTimeMillis() - this.f120520a;
            boolean z14 = true;
            if (jVar.getLink().length() > 0) {
                Routers.build(jVar.getLink()).open(this.f120521b.getActivity(), new a(this.f120521b));
                mi2.a.R(new f(this.f120521b));
                n40.d.f108714a.f(currentTimeMillis);
            }
            n40.d dVar = n40.d.f108714a;
            if (jVar.getLink().length() <= 0) {
                z14 = false;
            }
            dVar.d(currentTimeMillis, z14 ? d.a.RESULT_SUCCESS : d.a.RESULT_INVALID, 200);
        }

        /* Return type fixed from 'java.lang.Object' to match base method */
        /* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object] */
        @Override // kotlin.jvm.functions.Function1
        public /* bridge */ /* synthetic */ Unit invoke(o40.j jVar) {
            b(jVar);
            return Unit.INSTANCE;
        }
    }

    @Metadata(d1 = {"\u0000\u000e\n\u0000\n\u0002\u0010\u0002\n\u0000\n\u0002\u0010\u0003\n\u0000\u0010\u0000\u001a\u00020\u00012\u0006\u0010\u0002\u001a\u00020\u0003H\n¢\u0006\u0002\b\u0004"}, d2 = {"<anonymous>", "", AdvanceSetting.NETWORK_TYPE, "", "invoke"}, k = 3, mv = {1, 6, 0}, xi = 48)
    /* compiled from: SkinAnalysisPageController.kt */
    public static final class c extends Lambda implements Function1<Throwable, Unit> {

        /* renamed from: a  reason: collision with root package name */
        public final /* synthetic */ long f120523a;

        /* JADX INFO: super call moved to the top of the method (can break code semantics) */
        public c(long j14) {
            super(1);
            this.f120523a = j14;
        }

        /* Return type fixed from 'java.lang.Object' to match base method */
        /* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object] */
        @Override // kotlin.jvm.functions.Function1
        public /* bridge */ /* synthetic */ Unit invoke(Throwable th3) {
            invoke(th3);
            return Unit.INSTANCE;
        }

        public final void invoke(Throwable th3) {
            Intrinsics.checkNotNullParameter(th3, AdvanceSetting.NETWORK_TYPE);
            n40.d.f108714a.d(System.currentTimeMillis() - this.f120523a, d.a.RESULT_FAILURE, th3 instanceof ServerError ? ((ServerError) th3).getErrorCode() : -1);
        }
    }

    @Metadata(d1 = {"\u0000\n\n\u0000\n\u0002\u0010\u0002\n\u0002\b\u0003\u0010\u0000\u001a\u00020\u00012\u0006\u0010\u0002\u001a\u00020\u0001H\n¢\u0006\u0004\b\u0003\u0010\u0004"}, d2 = {"<anonymous>", "", AdvanceSetting.NETWORK_TYPE, "invoke", "(Lkotlin/Unit;)V"}, k = 3, mv = {1, 6, 0}, xi = 48)
    /* compiled from: SkinAnalysisPageController.kt */
    public static final class d extends Lambda implements Function1<Unit, Unit> {

        /* renamed from: a  reason: collision with root package name */
        public final /* synthetic */ e f120524a;

        /* JADX INFO: super call moved to the top of the method (can break code semantics) */
        public d(e eVar) {
            super(1);
            this.f120524a = eVar;
        }

        /* Return type fixed from 'java.lang.Object' to match base method */
        /* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object] */
        @Override // kotlin.jvm.functions.Function1
        public /* bridge */ /* synthetic */ Unit invoke(Unit unit) {
            invoke(unit);
            return Unit.INSTANCE;
        }

        public final void invoke(Unit unit) {
            Intrinsics.checkNotNullParameter(unit, AdvanceSetting.NETWORK_TYPE);
            hw2.c cVar = this.f120524a.f120516d;
            if (cVar != null) {
                cVar.dispose();
            }
            this.f120524a.f120516d = null;
            this.f120524a.m1();
            this.f120524a.e1().a(new o40.c(o40.b.PICTURE_BACK, null, 2, null));
        }
    }

    @Metadata(d1 = {"\u0000\n\n\u0000\n\u0002\u0010\u0002\n\u0002\b\u0003\u0010\u0000\u001a\u00020\u00012\u0006\u0010\u0002\u001a\u00020\u0001H\n¢\u0006\u0004\b\u0003\u0010\u0004"}, d2 = {"<anonymous>", "", AdvanceSetting.NETWORK_TYPE, "invoke", "(Lkotlin/Unit;)V"}, k = 3, mv = {1, 6, 0}, xi = 48)
    /* renamed from: q40.e$e  reason: collision with other inner class name */
    /* compiled from: SkinAnalysisPageController.kt */
    public static final class C1893e extends Lambda implements Function1<Unit, Unit> {

        /* renamed from: a  reason: collision with root package name */
        public static final C1893e f120525a = new C1893e();

        public C1893e() {
            super(1);
        }

        /* Return type fixed from 'java.lang.Object' to match base method */
        /* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object] */
        @Override // kotlin.jvm.functions.Function1
        public /* bridge */ /* synthetic */ Unit invoke(Unit unit) {
            invoke(unit);
            return Unit.INSTANCE;
        }

        public final void invoke(Unit unit) {
            Intrinsics.checkNotNullParameter(unit, AdvanceSetting.NETWORK_TYPE);
        }
    }

    @Metadata(k = 3, mv = {1, 6, 0}, xi = 48)
    /* compiled from: SkinAnalysisPageController.kt */
    public /* synthetic */ class f extends FunctionReferenceImpl implements Function1<Throwable, Unit> {
        public f(Object obj) {
            super(1, obj, y40.f.class, "e", "e(Ljava/lang/Throwable;)V", 0);
        }

        /* Return type fixed from 'java.lang.Object' to match base method */
        /* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object] */
        @Override // kotlin.jvm.functions.Function1
        public /* bridge */ /* synthetic */ Unit invoke(Throwable th3) {
            invoke(th3);
            return Unit.INSTANCE;
        }

        public final void invoke(Throwable th3) {
            Intrinsics.checkNotNullParameter(th3, "p0");
            y40.f.c(th3);
        }
    }

    @Metadata(d1 = {"\u0000\n\n\u0000\n\u0002\u0010\u0002\n\u0002\b\u0004\u0010\u0000\u001a\u00020\u00012\u000e\u0010\u0002\u001a\n \u0003*\u0004\u0018\u00010\u00010\u0001H\n¢\u0006\u0004\b\u0004\u0010\u0005"}, d2 = {"<anonymous>", "", AdvanceSetting.NETWORK_TYPE, "kotlin.jvm.PlatformType", "invoke", "(Lkotlin/Unit;)V"}, k = 3, mv = {1, 6, 0}, xi = 48)
    /* compiled from: SkinAnalysisPageController.kt */
    public static final class g extends Lambda implements Function1<Unit, Unit> {

        /* renamed from: a  reason: collision with root package name */
        public final /* synthetic */ e f120526a;

        /* JADX INFO: super call moved to the top of the method (can break code semantics) */
        public g(e eVar) {
            super(1);
            this.f120526a = eVar;
        }

        /* Return type fixed from 'java.lang.Object' to match base method */
        /* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object] */
        @Override // kotlin.jvm.functions.Function1
        public /* bridge */ /* synthetic */ Unit invoke(Unit unit) {
            invoke(unit);
            return Unit.INSTANCE;
        }

        public final void invoke(Unit unit) {
            hw2.c cVar = this.f120526a.f120516d;
            if (cVar != null) {
                cVar.dispose();
            }
            this.f120526a.f120516d = null;
        }
    }

    @Metadata(k = 3, mv = {1, 6, 0}, xi = 48)
    /* compiled from: SkinAnalysisPageController.kt */
    public /* synthetic */ class h extends FunctionReferenceImpl implements Function1<Throwable, Unit> {
        public h(Object obj) {
            super(1, obj, y40.f.class, "e", "e(Ljava/lang/Throwable;)V", 0);
        }

        /* Return type fixed from 'java.lang.Object' to match base method */
        /* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object] */
        @Override // kotlin.jvm.functions.Function1
        public /* bridge */ /* synthetic */ Unit invoke(Throwable th3) {
            invoke(th3);
            return Unit.INSTANCE;
        }

        public final void invoke(Throwable th3) {
            Intrinsics.checkNotNullParameter(th3, "p0");
            y40.f.c(th3);
        }
    }

    @Metadata(bv = {}, d1 = {"\u0000\u0010\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010\u0002\n\u0002\b\u0002\u0010\u0004\u001a\u00020\u00032\u000e\u0010\u0002\u001a\n \u0001*\u0004\u0018\u00010\u00000\u0000H\n¢\u0006\u0004\b\u0004\u0010\u0005"}, d2 = {"Lo40/c;", "kotlin.jvm.PlatformType", "action", "", "a", "(Lo40/c;)V"}, k = 3, mv = {1, 6, 0})
    /* compiled from: SkinAnalysisPageController.kt */
    public static final class i extends Lambda implements Function1<o40.c, Unit> {

        /* renamed from: a  reason: collision with root package name */
        public final /* synthetic */ e f120527a;

        @Metadata(k = 3, mv = {1, 6, 0}, xi = 48)
        /* compiled from: SkinAnalysisPageController.kt */
        public /* synthetic */ class a {

            /* renamed from: a  reason: collision with root package name */
            public static final /* synthetic */ int[] f120528a;

            static {
                int[] iArr = new int[o40.b.values().length];
                iArr[o40.b.CAMERA_TAKE.ordinal()] = 1;
                f120528a = iArr;
            }
        }

        /* JADX INFO: super call moved to the top of the method (can break code semantics) */
        public i(e eVar) {
            super(1);
            this.f120527a = eVar;
        }

        public final void a(o40.c cVar) {
            boolean z14 = true;
            if (a.f120528a[cVar.getType().ordinal()] == 1) {
                if (this.f120527a.f1().length() <= 0) {
                    z14 = false;
                }
                if (z14) {
                    this.f120527a.h1().f(this.f120527a.f1(), "start");
                }
                if (cVar.getData() instanceof o40.d) {
                    this.f120527a.f120515c = ((o40.d) cVar.getData()).getBitmap();
                    ((l) this.f120527a.getPresenter()).j(((o40.d) cVar.getData()).getBitmap(), ((o40.d) cVar.getData()).getFaceDetectEntity());
                    ((l) this.f120527a.getPresenter()).g();
                    this.f120527a.o1();
                }
            }
        }

        /* Return type fixed from 'java.lang.Object' to match base method */
        /* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object] */
        @Override // kotlin.jvm.functions.Function1
        public /* bridge */ /* synthetic */ Unit invoke(o40.c cVar) {
            a(cVar);
            return Unit.INSTANCE;
        }
    }

    @Metadata(bv = {}, d1 = {"\u0000\u0011\n\u0000\n\u0002\u0018\u0002\n\u0002\u0010\u0002\n\u0002\b\u0002*\u0001\u0000\b\n\u0018\u00002\u00020\u0001J\b\u0010\u0003\u001a\u00020\u0002H\u0016¨\u0006\u0004"}, d2 = {"q40/e$j", "Lcom/xingin/utils/async/run/task/XYRunnable;", "", "execute", "ar_library_release"}, k = 1, mv = {1, 6, 0})
    /* compiled from: SkinAnalysisPageController.kt */
    public static final class j extends XYRunnable {

        /* renamed from: a  reason: collision with root package name */
        public final /* synthetic */ e f120529a;

        /* JADX INFO: super call moved to the top of the method (can break code semantics) */
        public j(e eVar) {
            super("ArSkin", null, 2, null);
            this.f120529a = eVar;
        }

        @Override // com.xingin.utils.async.run.task.XYRunnable
        public void execute() {
            Bitmap bitmap = this.f120529a.f120515c;
            if (bitmap != null) {
                this.f120529a.n1(bitmap);
            }
        }
    }

    @Metadata(bv = {}, d1 = {"\u0000%\n\u0000\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u0002\n\u0000\n\u0002\u0010\u000e\n\u0002\b\u0003\n\u0002\u0010\u0006\n\u0002\b\u0003*\u0001\u0000\b\n\u0018\u00002\u00020\u0001J\u0012\u0010\u0005\u001a\u00020\u00042\b\u0010\u0003\u001a\u0004\u0018\u00010\u0002H\u0016J\u001c\u0010\t\u001a\u00020\u00042\b\u0010\u0007\u001a\u0004\u0018\u00010\u00062\b\u0010\b\u001a\u0004\u0018\u00010\u0006H\u0016J\u0010\u0010\f\u001a\u00020\u00042\u0006\u0010\u000b\u001a\u00020\nH\u0016¨\u0006\r"}, d2 = {"q40/e$k", "Lcom/xingin/uploader/api/UploaderResultListener;", "Lcom/xingin/uploader/api/UploaderResult;", "result", "", "onSuccess", "", "errCode", "errMsg", "onFailed", "", "percent", "onProgress", "ar_library_release"}, k = 1, mv = {1, 6, 0})
    /* compiled from: SkinAnalysisPageController.kt */
    public static final class k implements UploaderResultListener {

        /* renamed from: a  reason: collision with root package name */
        public final /* synthetic */ long f120530a;

        /* renamed from: b  reason: collision with root package name */
        public final /* synthetic */ int f120531b;

        /* renamed from: c  reason: collision with root package name */
        public final /* synthetic */ e f120532c;

        public k(long j14, int i10, e eVar) {
            this.f120530a = j14;
            this.f120531b = i10;
            this.f120532c = eVar;
        }

        public static final void b(e eVar) {
            Intrinsics.checkNotNullParameter(eVar, "this$0");
            eVar.e1().a(new o40.c(o40.b.GOTO_SKIN_PROFILE, null, 2, null));
        }

        @Override // com.xingin.uploader.api.UploaderResultListener
        public void onFailed(String str, String str2) {
            n40.d.f108714a.h(System.currentTimeMillis() - this.f120530a, d.a.RESULT_FAILURE, this.f120531b);
            y40.f.b("SkinAnalysisPageController", "upload fail errCode = " + str + ", errMsg = " + str2);
        }

        @Override // com.xingin.uploader.api.UploaderResultListener
        public void onProgress(double d14) {
            y40.f.a("SkinAnalysisPageController", "upload onProgress percent = " + d14);
        }

        @Override // com.xingin.uploader.api.UploaderResultListener
        public void onSuccess(UploaderResult uploaderResult) {
            String str;
            n40.d.f108714a.h(System.currentTimeMillis() - this.f120530a, d.a.RESULT_SUCCESS, this.f120531b);
            StringBuilder sb3 = new StringBuilder();
            sb3.append("upload onSuccess result = ");
            sb3.append(uploaderResult);
            sb3.append(" url = ");
            sb3.append(uploaderResult != null ? uploaderResult.accessUrl : null);
            y40.f.a("SkinAnalysisPageController", sb3.toString());
            if (uploaderResult != null && (str = uploaderResult.accessUrl) != null) {
                boolean z14 = true;
                if (!(str.length() > 0)) {
                    str = null;
                }
                if (str != null) {
                    e eVar = this.f120532c;
                    if (!(StringsKt__StringsJVMKt.startsWith$default(str, JPushConstants.HTTP_PRE, false, 2, null)) && !(StringsKt__StringsJVMKt.startsWith$default(str, JPushConstants.HTTPS_PRE, false, 2, null))) {
                        str = JPushConstants.HTTPS_PRE + str;
                    }
                    if (eVar.f1().length() <= 0) {
                        z14 = false;
                    }
                    if (z14) {
                        eVar.h1().f(eVar.f1(), JUnionAdError.Message.SUCCESS);
                        Routers.build(Uri.parse(eVar.f1()).getQueryParameter(ALPParamConstant.PLUGIN_RULE_FORWARD) + "?naviHidden=yes&face_photo=" + str).open(eVar.getActivity());
                        mi2.a.R(new g(eVar));
                        return;
                    }
                    eVar.a1(str);
                }
            }
        }
    }

    public static final void b1(e eVar, o40.j jVar) {
        Intrinsics.checkNotNullParameter(eVar, "this$0");
        eVar.f120516d = null;
    }

    public final void a1(String str) {
        long currentTimeMillis = System.currentTimeMillis();
        r<o40.j> m04 = o40.i.INSTANCE.getSkinAnalysisResult(str).x1(mi2.a.P()).W0(gw2.a.a()).m0(new d(this));
        Intrinsics.checkNotNullExpressionValue(m04, "SkinAnalysisApis.getSkin…ext { disposable = null }");
        this.f120516d = bj2.h.f(m04, this, new b(currentTimeMillis, this), new c(currentTimeMillis));
    }

    public final String c1() {
        File file = new File(i1() + "photoTemp/");
        bj2.f.b(file);
        return file.getAbsolutePath() + File.separator + System.currentTimeMillis() + ".jpeg";
    }

    public final dx2.d<Unit> d1() {
        dx2.d<Unit> dVar = this.f120517e;
        if (dVar != null) {
            return dVar;
        }
        Intrinsics.throwUninitializedPropertyAccessException("backPressEvent");
        return null;
    }

    public final dx2.b<o40.c> e1() {
        dx2.b<o40.c> bVar = this.f120514b;
        if (bVar != null) {
            return bVar;
        }
        Intrinsics.throwUninitializedPropertyAccessException("cameraActionObservable");
        return null;
    }

    public final String f1() {
        String str = this.f120518f;
        if (str != null) {
            return str;
        }
        Intrinsics.throwUninitializedPropertyAccessException("intentFaceRoute");
        return null;
    }

    public final XhsActivity getActivity() {
        XhsActivity xhsActivity = this.f120513a;
        if (xhsActivity != null) {
            return xhsActivity;
        }
        Intrinsics.throwUninitializedPropertyAccessException("activity");
        return null;
    }

    public final p40.a h1() {
        p40.a aVar = this.f120519g;
        if (aVar != null) {
            return aVar;
        }
        Intrinsics.throwUninitializedPropertyAccessException("trackHelper");
        return null;
    }

    public final String i1() {
        StringBuilder sb3 = new StringBuilder();
        XhsActivity activity = getActivity();
        y40.j jVar = y40.j.CAPA_PRIVATE_FOLDER;
        sb3.append(z0.k(activity, jVar.getFileType()));
        sb3.append(File.separator);
        sb3.append(jVar.getFileDir());
        String sb4 = sb3.toString();
        bj2.f.b(new File(sb4));
        return sb4;
    }

    public final void j1() {
        bj2.h.d(((l) getPresenter()).f(), this, new d(this));
    }

    public final void k1() {
        bj2.h.f(d1(), this, new g(this), new h(y40.f.f156699a));
    }

    public final void l1() {
        bj2.h.d(e1(), this, new i(this));
    }

    public final hw2.c listenAttachEvent() {
        return bj2.h.f(((l) getPresenter()).attachObservable(), this, C1893e.f120525a, new f(y40.f.f156699a));
    }

    public final void m1() {
        Bitmap bitmap = this.f120515c;
        if (bitmap != null) {
            bitmap.recycle();
        }
        this.f120515c = null;
    }

    /* JADX WARNING: Code restructure failed: missing block: B:17:0x004b, code lost:
        r0 = move-exception;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:18:0x004c, code lost:
        kotlin.io.CloseableKt.closeFinally(r1, r5);
     */
    /* JADX WARNING: Code restructure failed: missing block: B:19:0x004f, code lost:
        throw r0;
     */
    public final void n1(Bitmap bitmap) {
        File file = new File(c1());
        FileOutputStream fileOutputStream = new FileOutputStream(file);
        boolean compress = bitmap.compress(Bitmap.CompressFormat.JPEG, 100, fileOutputStream);
        File file2 = null;
        CloseableKt.closeFinally(fileOutputStream, null);
        if (compress) {
            file2 = file;
        }
        if (file2 != null) {
            String absolutePath = file.getAbsolutePath();
            Intrinsics.checkNotNullExpressionValue(absolutePath, "file.absolutePath");
            p1(absolutePath);
        }
        StringBuilder sb3 = new StringBuilder();
        sb3.append("saveToLocalFile res ");
        sb3.append(compress ? JUnionAdError.Message.SUCCESS : "failure");
        y40.f.a("SkinAnalysisPageController", sb3.toString());
    }

    public final void o1() {
        mi2.a.m(new j(this));
    }

    @Override // tu0.b
    public void onAttach(Bundle bundle) {
        super.onAttach(bundle);
        j1();
        l1();
        listenAttachEvent();
        k1();
    }

    public final void p1(String str) {
        String uuid = UUID.randomUUID().toString();
        Intrinsics.checkNotNullExpressionValue(uuid, "randomUUID().toString()");
        long currentTimeMillis = System.currentTimeMillis();
        int length = (int) new File(str).length();
        if (f1().length() > 0) {
            h1().f(f1(), "loading");
        }
        RobusterClient.uploadFileAsyncWithRetry$default(new RobusterClient(3, "other", null, 4, null), str, uuid, new k(currentTimeMillis, length, this), null, null, 24, null);
    }
}