package com.tencent.mm.plugin.appbrand.jsapi.share;

import android.content.Intent;
import com.tencent.matrix.trace.core.AppMethodBeat;
import com.tencent.mm.plugin.appbrand.config.AppBrandInitConfigWC;
import com.tencent.mm.plugin.appbrand.config.AppBrandSysConfigWC;
import com.tencent.mm.plugin.appbrand.ipc.AppBrandMainProcessService;
import com.tencent.mm.plugin.appbrand.n;
import com.tencent.mm.plugin.appbrand.o;
import com.tencent.mm.plugin.appbrand.page.w;
import com.tencent.mm.plugin.appbrand.report.AppBrandStatObject;
import com.tencent.mm.plugin.appbrand.s;
import com.tencent.mm.sdk.platformtools.ab;
import com.tencent.mm.sdk.platformtools.bo;
import com.tencent.mm.ui.MMActivity;
import com.tencent.mm.ui.MMActivity.a;
import com.tencent.mm.ui.base.h;
import com.tencent.ytcommon.BuildConfig;
import org.xwalk.core.XWalkFeature;

class e$1 implements a {
    final /* synthetic */ MMActivity cgq;
    final /* synthetic */ String chV;
    final /* synthetic */ int eIl;
    final /* synthetic */ String fwC;
    final /* synthetic */ w hIw;
    final /* synthetic */ AppBrandSysConfigWC hIx;
    final /* synthetic */ e hWA;
    final /* synthetic */ String hWe;
    final /* synthetic */ String hWg;
    final /* synthetic */ String hWh;
    final /* synthetic */ String hWi;
    final /* synthetic */ boolean hWk;
    final /* synthetic */ String hWl;
    final /* synthetic */ int hWo;
    final /* synthetic */ int hWx;
    final /* synthetic */ boolean hWy;
    final /* synthetic */ String hWz;
    final /* synthetic */ s hsj;
    final /* synthetic */ String val$appId;

    e$1(e eVar, s sVar, int i, String str, int i2, boolean z, String str2, String str3, String str4, String str5, AppBrandSysConfigWC appBrandSysConfigWC, String str6, String str7, String str8, w wVar, boolean z2, String str9, int i3, MMActivity mMActivity) {
        this.hWA = eVar;
        this.hsj = sVar;
        this.eIl = i;
        this.val$appId = str;
        this.hWx = i2;
        this.hWy = z;
        this.chV = str2;
        this.hWg = str3;
        this.hWi = str4;
        this.hWz = str5;
        this.hIx = appBrandSysConfigWC;
        this.fwC = str6;
        this.hWe = str7;
        this.hWh = str8;
        this.hIw = wVar;
        this.hWk = z2;
        this.hWl = str9;
        this.hWo = i3;
        this.cgq = mMActivity;
    }

    public final void c(int i, int i2, Intent intent) {
        AppMethodBeat.i(131447);
        if (1 != i) {
            ab.e("MicroMsg.JsApiShareAppMessageForFakeNative", "requestCode(%d) not corrected.", new Object[]{Integer.valueOf(i)});
            AppMethodBeat.o(131447);
        } else if (-1 != i2) {
            ab.e("MicroMsg.JsApiShareAppMessageForFakeNative", "resultCode is not RESULT_OK(%d).", new Object[]{Integer.valueOf(i2)});
            this.hsj.M(this.eIl, this.hWA.j("cancel", null));
            AppMethodBeat.o(131447);
        } else {
            String stringExtra = intent == null ? null : intent.getStringExtra("Select_Conv_User");
            if (bo.isNullOrNil(stringExtra)) {
                ab.e("MicroMsg.JsApiShareAppMessageForFakeNative", "mmOnActivityResult fail, toUser is null.");
                this.hsj.M(this.eIl, this.hWA.j("fail:no selected user", null));
                AppMethodBeat.o(131447);
                return;
            }
            int i3;
            ab.d("MicroMsg.JsApiShareAppMessageForFakeNative", "share app msg success, to: %s ", new Object[]{stringExtra});
            String stringExtra2 = intent.getStringExtra("custom_send_text");
            SendAppMessageTask sendAppMessageTask = new SendAppMessageTask();
            sendAppMessageTask.hWD = stringExtra2;
            sendAppMessageTask.toUser = stringExtra;
            sendAppMessageTask.appId = this.val$appId;
            o runtime = this.hsj.getRuntime();
            if (runtime == null || runtime.yf() == null || !(runtime.yf() instanceof AppBrandInitConfigWC)) {
                ab.w("MicroMsg.JsApiShareAppMessageForFakeNative", "can not retrieve init config.");
                sendAppMessageTask.axy = -1;
            } else {
                sendAppMessageTask.axy = ((AppBrandInitConfigWC) runtime.yf()).axy;
            }
            sendAppMessageTask.hWH = 2;
            sendAppMessageTask.type = 2;
            sendAppMessageTask.duk = this.hWx;
            if (this.hWy) {
                i3 = 1;
            } else {
                i3 = 0;
            }
            sendAppMessageTask.hWI = i3;
            sendAppMessageTask.title = this.chV;
            sendAppMessageTask.description = this.hWg;
            sendAppMessageTask.hWE = this.hWi;
            sendAppMessageTask.hWG = this.hWz;
            sendAppMessageTask.iconUrl = this.hIx.hgW;
            sendAppMessageTask.userName = this.fwC;
            sendAppMessageTask.nickname = this.hIx.cwz;
            sendAppMessageTask.path = this.hWe;
            sendAppMessageTask.cBc = this.hIx.hhd.gVt;
            sendAppMessageTask.hiv = this.hIx.hhd.cvZ;
            sendAppMessageTask.version = this.hIx.hhd.gVu;
            sendAppMessageTask.url = this.hWh;
            sendAppMessageTask.hWJ = n.xb(this.val$appId).gPd.getAndIncrement();
            sendAppMessageTask.hWL = this.hIw.getURL();
            sendAppMessageTask.hWM = this.hIw.aBg();
            AppBrandStatObject appBrandStatObject = this.hIw.getRuntime().ya().bQn;
            if (appBrandStatObject != null) {
                sendAppMessageTask.scene = appBrandStatObject.scene == 0 ? XWalkFeature.INTERFACE_GEO_LOCATION_PERMISSION : appBrandStatObject.scene;
                sendAppMessageTask.cst = bo.nullAsNil(appBrandStatObject.cst);
                sendAppMessageTask.hWK = bo.nullAsNil(this.hIw.getRuntime().atI().xz());
            }
            sendAppMessageTask.hIs = this.hWk;
            sendAppMessageTask.hWF = l.getRealPath(this.hWl);
            sendAppMessageTask.fmr = this.hWo;
            com.tencent.mm.plugin.appbrand.jsapi.t.a aJS = this.hIw.aJS();
            if (aJS == null) {
                stringExtra = BuildConfig.FLAVOR;
            } else {
                stringExtra = aJS.getWebView().getUrl();
            }
            sendAppMessageTask.hWP = stringExtra;
            AppBrandMainProcessService.a(sendAppMessageTask);
            this.hsj.M(this.eIl, this.hWA.j("ok", null));
            h.bQ(this.cgq, this.cgq.getResources().getString(2131296555));
            AppMethodBeat.o(131447);
        }
    }
}
