MD5 校验值:195005882709ac21163d7a1b97aeec73
AppCenterIngestion.java 文件包含反编译后的源代码,请注意,该内容仅供学习和参考使用,不得用于非法用途。
package com.microsoft.appcenter.ingestion; import android.support.annotation.NonNull; import android.support.annotation.VisibleForTesting; import com.microsoft.appcenter.Constants; import com.microsoft.appcenter.http.AbstractAppCallTemplate; import com.microsoft.appcenter.http.DefaultHttpClient; 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.io.IOException; import java.util.HashMap; import java.util.UUID; import org.json.JSONException; public class AppCenterIngestion implements Ingestion { @VisibleForTesting static final String API_PATH = "/logs?api-version=1.0.0"; public static final String DEFAULT_LOG_URL = "https://in.appcenter.ms"; @VisibleForTesting static final String INSTALL_ID = "Install-ID"; private final HttpClient mHttpClient; private final LogSerializer mLogSerializer; private String mLogUrl = DEFAULT_LOG_URL; 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); } } public AppCenterIngestion(@NonNull HttpClient httpClient, @NonNull LogSerializer logSerializer) { this.mLogSerializer = logSerializer; this.mHttpClient = httpClient; } @Override public void close() throws IOException { this.mHttpClient.close(); } @Override public void reopen() { this.mHttpClient.reopen(); } @Override public ServiceCall sendAsync(String str, UUID uuid, LogContainer logContainer, ServiceCallback serviceCallback) throws IllegalArgumentException { HashMap hashMap = new HashMap(); hashMap.put(INSTALL_ID, uuid.toString()); hashMap.put(Constants.APP_SECRET, str); return this.mHttpClient.callAsync(this.mLogUrl + API_PATH, DefaultHttpClient.METHOD_POST, hashMap, new IngestionCallTemplate(this.mLogSerializer, logContainer), serviceCallback); } @Override public void setLogUrl(@NonNull String str) { this.mLogUrl = str; } }