EhViewer v1.9.7.7版本的 MD5 值为:828893cd54837a794dab17a02809e194

以下内容为反编译后的 AppCenterIngestion.java 源代码,内容仅作参考


package com.microsoft.appcenter.ingestion;

import com.microsoft.appcenter.Constants;
import com.microsoft.appcenter.http.AbstractAppCallTemplate;
import com.microsoft.appcenter.http.HttpClient;
import com.microsoft.appcenter.http.ServiceCall;
import com.microsoft.appcenter.http.ServiceCallback;
import com.microsoft.appcenter.ingestion.models.LogContainer;
import com.microsoft.appcenter.ingestion.models.json.LogSerializer;
import java.util.HashMap;
import java.util.UUID;
import org.json.JSONException;
public class AppCenterIngestion extends AbstractAppCenterIngestion {
    static final String API_PATH = "/logs?api-version=1.0.0";
    public static final String DEFAULT_LOG_URL = "https://in.appcenter.ms";
    static final String INSTALL_ID = "Install-ID";
    private final LogSerializer mLogSerializer;

    public AppCenterIngestion(HttpClient httpClient, LogSerializer logSerializer) {
        super(httpClient, DEFAULT_LOG_URL);
        this.mLogSerializer = logSerializer;
    }

    @Override
    public ServiceCall sendAsync(String appSecret, UUID installId, LogContainer logContainer, final ServiceCallback serviceCallback) throws IllegalArgumentException {
        super.sendAsync(appSecret, installId, logContainer, serviceCallback);
        HashMap hashMap = new HashMap();
        hashMap.put(INSTALL_ID, installId.toString());
        hashMap.put(Constants.APP_SECRET, appSecret);
        IngestionCallTemplate ingestionCallTemplate = new IngestionCallTemplate(this.mLogSerializer, logContainer);
        return getServiceCall(getLogUrl() + API_PATH, "POST", hashMap, ingestionCallTemplate, serviceCallback);
    }

    private static class IngestionCallTemplate extends AbstractAppCallTemplate {
        private final LogContainer mLogContainer;
        private final LogSerializer mLogSerializer;

        IngestionCallTemplate(LogSerializer logSerializer, LogContainer logContainer) {
            this.mLogSerializer = logSerializer;
            this.mLogContainer = logContainer;
        }

        @Override
        public String buildRequestBody() throws JSONException {
            return this.mLogSerializer.serializeContainer(this.mLogContainer);
        }
    }
}