package com.ss.android.ugc.aweme.donation;

import X.2YS;
import X.2ma;
import X.3At;
import X.3YB;
import X.4vZ;
import X.9DY;
import X.C3874Lar;
import X.C4672Lnj;
import X.K2I;
import X.K2W;
import X.M12;
import X.PYx;
import android.app.Activity;
import android.content.Context;
import android.os.Bundle;
import androidx.fragment.app.Fragment;
import com.bytedance.covode.number.Covode;
import com.bytedance.frameworks.apm.trace.MethodCollector;
import com.bytedance.ies.ugc.aweme.network.RetrofitFactory;
import com.bytedance.router.interceptor.IInterceptor;
import com.bytedance.tux.sheet.sheet.TuxSheet;
import com.ss.android.ugc.aweme.donation.detail.DonationFragment;
import com.ss.android.ugc.aweme.donation.detail.DonationInterceptor;
import org.json.JSONObject;

public final class DonationServiceImpl implements IDonationService {
    public static final K2W LIZ = new K2W((byte) 0);

    static {
        Covode.recordClassIndex(66325);
    }

    public final IInterceptor LIZ() {
        return new DonationInterceptor();
    }

    public static IDonationService LIZIZ() {
        MethodCollector.i(1248);
        IDonationService iDonationService = (IDonationService) C4672Lnj.LIZ(IDonationService.class, false);
        if (iDonationService != null) {
            MethodCollector.o(1248);
            return iDonationService;
        }
        Object LIZIZ = C4672Lnj.LIZIZ(IDonationService.class, false);
        if (LIZIZ != null) {
            IDonationService iDonationService2 = (IDonationService) LIZIZ;
            MethodCollector.o(1248);
            return iDonationService2;
        }
        if (C4672Lnj.LLJIJIL == null) {
            synchronized (IDonationService.class) {
                try {
                    if (C4672Lnj.LLJIJIL == null) {
                        C4672Lnj.LLJIJIL = new DonationServiceImpl();
                    }
                } catch (Throwable th) {
                    MethodCollector.o(1248);
                    throw th;
                }
            }
        }
        DonationServiceImpl donationServiceImpl = (DonationServiceImpl) C4672Lnj.LLJIJIL;
        MethodCollector.o(1248);
        return donationServiceImpl;
    }

    public final void LIZ(Context context, String str, String str2) {
        Context context2 = context;
        M12.LIZ((Object) context2);
        String str3 = str;
        String str4 = str2;
        2YS.LIZ.LIZ(context2, str3, 1, str4, new JSONObject().toString(), new K2I(context2, (Bundle) null));
    }

    public final TuxSheet LIZ(int i, String str, Bundle bundle) {
        M12.LIZ((Object) str, (Object) bundle);
        DonationFragment donationFragment = new DonationFragment();
        bundle.putInt("ngo_id", i);
        bundle.putString("profile_uid", str);
        bundle.putInt("item_type", 3);
        donationFragment.setArguments(bundle);
        3YB r1 = new 3YB();
        r1.LIZ(donationFragment);
        r1.LIZ(0);
        r1.LIZIZ(false);
        return r1.LIZ;
    }

    public final TuxSheet LIZIZ(int i, String str, Bundle bundle) {
        M12.LIZ((Object) str, (Object) bundle);
        DonationFragment donationFragment = new DonationFragment();
        bundle.putInt("ngo_id", i);
        bundle.putString("sticker_id", str);
        bundle.putInt("item_type", 4);
        donationFragment.setArguments(bundle);
        3YB r1 = new 3YB();
        r1.LIZ(donationFragment);
        r1.LIZ(0);
        r1.LIZIZ(false);
        return r1.LIZ;
    }

    public final void LIZ(int i, String str, Bundle bundle, Fragment fragment, Activity activity) {
        String str2 = str;
        Bundle bundle2 = bundle;
        Activity activity2 = activity;
        Fragment fragment2 = fragment;
        M12.LIZ(str2, bundle2, fragment2, activity2);
        3At r12 = new 3At(activity2);
        4vZ.LIZ(r12);
        DonateApi donateApi = (DonateApi) RetrofitFactory.LIZ().LIZIZ(9DY.LJ).LIZJ().LIZ(DonateApi.class);
        long j = 0L;
        try {
            j = Long.valueOf(Long.parseLong(str2));
        } catch (NumberFormatException unused) {
        }
        int i2 = i;
        PYx.LIZ(donateApi.getDonateDetail((String) null, 0, Integer.valueOf(i2), str2, j, 3, "", true), new C3874Lar(activity2, str2, r12, bundle2, i2, fragment2), 2ma.LIZ);
    }
}
