package p138.p176.p291.p296.p297.p306.p308;

import android.util.Log;
import java.io.File;
import java.io.IOException;
import java.util.Map;
import p138.p139.p143.p144.C2803;
import p138.p176.p177.p242.p246.p251.C4303;
import p138.p176.p291.p296.p297.C5608;
import p138.p176.p291.p296.p297.p299.AbstractC5621;
import p138.p176.p291.p296.p297.p303.C5819;
import p138.p176.p291.p296.p297.p303.C5820;
import p138.p176.p291.p296.p297.p303.C5821;
import p138.p176.p291.p296.p297.p303.EnumC5818;
import p138.p176.p291.p296.p297.p306.p307.C5842;
import p138.p176.p291.p296.p297.p306.p307.InterfaceC5844;

/* JADX INFO: renamed from: ދ.ހ.ށ.ބ.ށ.ލ.ށ.ހ, reason: contains not printable characters */
/* JADX INFO: loaded from: classes.dex */
public class C5849 extends AbstractC5621 implements InterfaceC5848 {

    /* JADX INFO: renamed from: ރ, reason: contains not printable characters */
    public final String f16567;

    public C5849(String str, String str2, C5820 c5820, String str3) {
        super(str, str2, c5820, EnumC5818.POST);
        this.f16567 = str3;
    }

    @Override // p138.p176.p291.p296.p297.p306.p308.InterfaceC5848
    /* JADX INFO: renamed from: ֏ */
    public boolean mo9195(C5842 c5842, boolean z) {
        if (!z) {
            throw new RuntimeException("An invalid data collection token was used.");
        }
        C5819 c5819M8983 = m8983();
        c5819M8983.f16507.put("X-CRASHLYTICS-GOOGLE-APP-ID", c5842.f16556);
        c5819M8983.f16507.put("X-CRASHLYTICS-API-CLIENT-TYPE", "android");
        c5819M8983.f16507.put("X-CRASHLYTICS-API-CLIENT-VERSION", this.f16567);
        for (Map.Entry<String, String> entry : c5842.f16557.mo9189().entrySet()) {
            c5819M8983.f16507.put(entry.getKey(), entry.getValue());
        }
        InterfaceC5844 interfaceC5844 = c5842.f16557;
        c5819M8983.m9123("report[identifier]", interfaceC5844.mo9192());
        if (interfaceC5844.mo9190().length == 1) {
            C5608 c5608 = C5608.f16066;
            StringBuilder sbM4889 = C2803.m4889("Adding single file ");
            sbM4889.append(interfaceC5844.mo9191());
            sbM4889.append(" to report ");
            sbM4889.append(interfaceC5844.mo9192());
            c5608.m8972(sbM4889.toString());
            c5819M8983.m9124("report[file]", interfaceC5844.mo9191(), "application/octet-stream", interfaceC5844.mo9194());
        } else {
            int i = 0;
            for (File file : interfaceC5844.mo9190()) {
                C5608 c56082 = C5608.f16066;
                StringBuilder sbM48892 = C2803.m4889("Adding file ");
                sbM48892.append(file.getName());
                sbM48892.append(" to report ");
                sbM48892.append(interfaceC5844.mo9192());
                c56082.m8972(sbM48892.toString());
                c5819M8983.m9124("report[file" + i + "]", file.getName(), "application/octet-stream", file);
                i++;
            }
        }
        C5608 c56083 = C5608.f16066;
        StringBuilder sbM48893 = C2803.m4889("Sending report to: ");
        sbM48893.append(this.f16093);
        c56083.m8972(sbM48893.toString());
        try {
            C5821 c5821M9125 = c5819M8983.m9125();
            int i2 = c5821M9125.f16509;
            C5608.f16066.m8972("Create report request ID: " + c5821M9125.f16511.m10067("X-REQUEST-ID"));
            C5608.f16066.m8972("Result was: " + i2);
            return C4303.m7188(i2) == 0;
        } catch (IOException e) {
            C5608 c56084 = C5608.f16066;
            if (c56084.m8974(6)) {
                Log.e(c56084.f16067, "Create report HTTP request failed.", e);
            }
            throw new RuntimeException(e);
        }
    }
}
