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

import com.tencent.matrix.trace.core.AppMethodBeat;
import com.tencent.mm.plugin.appbrand.g;
import com.tencent.mm.plugin.appbrand.report.AppBrandStatObject;
import com.tencent.mm.plugin.appbrand.report.model.AdReportCgiHelper;
import com.tencent.mm.sdk.platformtools.ab;
import com.tencent.mm.sdk.platformtools.ah;
import com.tencent.mm.sdk.platformtools.at;
import com.tencent.mm.sdk.platformtools.bo;

public final class i {
    public static void a(String str, String str2, AppBrandStatObject appBrandStatObject) {
        AppMethodBeat.i(131348);
        if (appBrandStatObject == null) {
            AppMethodBeat.o(131348);
            return;
        }
        String str3 = appBrandStatObject.hQF;
        if (bo.isNullOrNil(str3)) {
            AppMethodBeat.o(131348);
            return;
        }
        g.a(str, new 1(str, str2, str3, System.currentTimeMillis(), appBrandStatObject));
        AppMethodBeat.o(131348);
    }

    public static void b(String str, String str2, AppBrandStatObject appBrandStatObject) {
        AppMethodBeat.i(131349);
        if (appBrandStatObject == null) {
            AppMethodBeat.o(131349);
        } else if (bo.isNullOrNil(appBrandStatObject.hQF)) {
            AppMethodBeat.o(131349);
        } else {
            a(4, str, str2, appBrandStatObject.hQF, 0);
            AppMethodBeat.o(131349);
        }
    }

    private static void a(int i, String str, String str2, String str3, long j) {
        AppMethodBeat.i(131350);
        long anU = bo.anU();
        String gE = at.gE(ah.getContext());
        String str4 = str3 + "," + str2 + "," + str + "," + anU + "," + j + "," + i + "," + aEn() + "," + gE + "," + at.gF(ah.getContext()) + ",,";
        ab.v("MicroMsg.MiniProgramNavigatorAdReportHelper", "closeType:%d stayTime:%d", new Object[]{Integer.valueOf(i), Long.valueOf(j)});
        AdReportCgiHelper.a(16004, str4, null);
        AppMethodBeat.o(131350);
    }

    private static int aEn() {
        AppMethodBeat.i(131351);
        switch (at.getNetType(ah.getContext())) {
            case -1:
                AppMethodBeat.o(131351);
                return 255;
            case 0:
                AppMethodBeat.o(131351);
                return 1;
            case 1:
            case 6:
            case 8:
                AppMethodBeat.o(131351);
                return 3;
            case 2:
            case 5:
            case 7:
                AppMethodBeat.o(131351);
                return 2;
            case 3:
            case 4:
                AppMethodBeat.o(131351);
                return 4;
            case 10:
                AppMethodBeat.o(131351);
                return 5;
            default:
                AppMethodBeat.o(131351);
                return 6;
        }
    }
}
