曹妃甸核酸检测平台.apk(点击下载) / ReportComponent.java


package com.netease.yunxin.report.sdk;

import android.content.Context;
import org.json.JSONObject;

public class ReportComponent {
    private static final String REPORTER_SERVER = "https://statistic.live.126.net/statics/report/common/form";
    private String appKey;
    private IAssembler assembler;
    private Context context;
    private String deviceID;
    private int eventThresholdCount;
    private LogCallback logCallback;
    private String sdkType;
    private String sdkVersion;
    private String server;

    public static class Builder {
        private static final int EVENT_THRESHOLD_COUNT = 50;
        private String appKey;
        private IAssembler assembler;
        private Context context;
        private boolean dev = false;
        private String deviceID;
        private int eventThresholdCount = 50;
        private LogCallback logCallback;
        private String sdkType;
        private String sdkVersion;
        private String server = ReportComponent.REPORTER_SERVER;

        public Builder(Context context2, String str, String str2, String str3, String str4) {
            this.context = context2.getApplicationContext();
            this.appKey = str;
            this.sdkType = str2;
            this.sdkVersion = str3;
            this.deviceID = str4;
        }

        public Builder assembler(IAssembler iAssembler) {
            this.assembler = iAssembler;
            return this;
        }

        public ReportComponent build() {
            ReportComponent reportComponent = new ReportComponent(this.context, this.appKey, this.sdkType, this.sdkVersion, this.deviceID);
            if (this.dev) {
                this.server = this.server.replaceFirst("https://", "http://");
            }
            reportComponent.server(this.server);
            reportComponent.logCallback(this.logCallback);
            reportComponent.assembler(this.assembler).eventThresholdCount(this.eventThresholdCount);
            return reportComponent;
        }

        public Builder dev(boolean z) {
            this.dev = z;
            return this;
        }

        public Builder eventThresholdCount(int i) {
            if (i < 0) {
                return this;
            }
            this.eventThresholdCount = i;
            return this;
        }

        public Builder logCallback(LogCallback logCallback2) {
            this.logCallback = logCallback2;
            return this;
        }

        public Builder server(String str) {
            this.server = str;
            return this;
        }
    }

    public interface IAssembler {
        JSONObject createCommonJson();
    }

    public interface LogCallback {
        void log(int i, String str, String str2);
    }

    private ReportComponent(Context context2, String str, String str2, String str3, String str4) {
        this.context = context2;
        this.appKey = str;
        this.sdkType = str2;
        this.sdkVersion = str3;
        this.deviceID = str4;
    }

    /* access modifiers changed from: private */
    /* access modifiers changed from: public */
    private ReportComponent logCallback(LogCallback logCallback2) {
        this.logCallback = logCallback2;
        return this;
    }

    /* access modifiers changed from: private */
    /* access modifiers changed from: public */
    private ReportComponent server(String str) {
        this.server = str;
        return this;
    }

    public ReportComponent assembler(IAssembler iAssembler) {
        this.assembler = iAssembler;
        return this;
    }

    public ReportComponent eventThresholdCount(int i) {
        this.eventThresholdCount = i;
        return this;
    }

    public String getAppKey() {
        return this.appKey;
    }

    public IAssembler getAssembler() {
        return this.assembler;
    }

    public Context getContext() {
        return this.context;
    }

    public String getDeviceID() {
        return this.deviceID;
    }

    public int getEventThresholdCount() {
        return this.eventThresholdCount;
    }

    public LogCallback getLogCallback() {
        return this.logCallback;
    }

    public String getSdkType() {
        return this.sdkType;
    }

    public String getSdkVersion() {
        return this.sdkVersion;
    }

    public String getServer() {
        return this.server;
    }
}