// Path: ezy.sdk3rd.social/src/main/java/ezy/sdk3rd/social/sdk/IResult.java
// public interface IResult {
//     void onResult(int requestCode, int resultCode, Intent data);
// }
// 
// Path: ezy.sdk3rd.social/src/main/java/ezy/sdk3rd/social/sdk/OnCallback.java
// public interface OnCallback<T> {
//     void onStarted(Activity activity);
//     void onCompleted(Activity activity);
//     void onSucceed(Activity activity, T result);
//     void onFailed(Activity activity, int code, String message);
// }
// 
// Path: ezy.sdk3rd.social/src/main/java/ezy/sdk3rd/social/sdk/Platform.java
// public class Platform {
//     final String name;
//     final String appId;
// 
//     Map<String, String> extra;
// 
//     public Platform(@NonNull String name, @NonNull String appId) {
//         this.name = name;
//         this.appId = appId;
//     }
// 
//     public String getName() {
//         return name;
//     }
// 
//     public String getAppId() {
//         return appId;
//     }
// 
//     public String extra(String key) {
//         return extra == null ? "" : extra.get(key);
//     }
// 
//     public Platform extra(String key, String value) {
//         if (extra == null) {
//             extra = new HashMap<>();
//         }
//         extra.put(key, value);
//         return this;
//     }
// }
// 
// Path: ezy.sdk3rd.social/src/main/java/ezy/sdk3rd/social/sdk/ResultCode.java
// public class ResultCode {
//     public static final int RESULT_OK = 0;
//     public static final int RESULT_PENDING = 1;
//     public static final int RESULT_CANCELLED = 2;
//     public static final int RESULT_FAILED = 3;
// 
// }


import android.app.Activity;
import android.content.Intent;
import android.text.TextUtils;
import android.util.Log;
import com.tencent.mm.opensdk.constants.ConstantsAPI;
import com.tencent.mm.opensdk.modelbase.BaseReq;
import com.tencent.mm.opensdk.modelbase.BaseResp;
import com.tencent.mm.opensdk.modelmsg.SendAuth;
import com.tencent.mm.opensdk.modelmsg.SendMessageToWX;
import com.tencent.mm.opensdk.modelpay.PayResp;
import com.tencent.mm.opensdk.openapi.IWXAPI;
import com.tencent.mm.opensdk.openapi.IWXAPIEventHandler;
import com.tencent.mm.opensdk.openapi.WXAPIFactory;
import java.util.WeakHashMap;
import ezy.sdk3rd.social.sdk.IResult;
import ezy.sdk3rd.social.sdk.OnCallback;
import ezy.sdk3rd.social.sdk.Platform;
import ezy.sdk3rd.social.sdk.ResultCode;

    @Override
    public void onResult(int requestCode, int resultCode, Intent data) {
        if (mApi != null && requestCode == REQUEST_CODE) {
            mApi.handleIntent(data, this);
        }
    }

    @Override
    public void onReq(BaseReq req) {
        Log.e(TAG, "transaction = " + req.transaction + ", type = " + req.getType() + ", openId = " + req.openId);
    }

    @Override
    public void onResp(BaseResp resp) {
        Log.e(TAG, "transaction = " + resp.transaction + ", type = " + resp.getType() + ", errCode = " + resp.errCode + ", err = " + resp.errStr);

        if (resp.errCode == BaseResp.ErrCode.ERR_OK) {
            switch (resp.getType()) {
            case ConstantsAPI.COMMAND_SENDAUTH:
                onResultOk((SendAuth.Resp) resp);
                break;
            case ConstantsAPI.COMMAND_PAY_BY_WX:
                onResultOk((PayResp) resp);
                break;
            case ConstantsAPI.COMMAND_SENDMESSAGE_TO_WX:
                onResultOk((SendMessageToWX.Resp) resp);
                break;
            }
        } else if (resp.errCode == BaseResp.ErrCode.ERR_USER_CANCEL) {
// Path: ezy.sdk3rd.social/src/main/java/ezy/sdk3rd/social/sdk/IResult.java
// public interface IResult {
//     void onResult(int requestCode, int resultCode, Intent data);
// }
// 
// Path: ezy.sdk3rd.social/src/main/java/ezy/sdk3rd/social/sdk/OnCallback.java
// public interface OnCallback<T> {
//     void onStarted(Activity activity);
//     void onCompleted(Activity activity);
//     void onSucceed(Activity activity, T result);
//     void onFailed(Activity activity, int code, String message);
// }
// 
// Path: ezy.sdk3rd.social/src/main/java/ezy/sdk3rd/social/sdk/Platform.java
// public class Platform {
//     final String name;
//     final String appId;
// 
//     Map<String, String> extra;
// 
//     public Platform(@NonNull String name, @NonNull String appId) {
//         this.name = name;
//         this.appId = appId;
//     }
// 
//     public String getName() {
//         return name;
//     }
// 
//     public String getAppId() {
//         return appId;
//     }
// 
//     public String extra(String key) {
//         return extra == null ? "" : extra.get(key);
//     }
// 
//     public Platform extra(String key, String value) {
//         if (extra == null) {
//             extra = new HashMap<>();
//         }
//         extra.put(key, value);
//         return this;
//     }
// }
// 
// Path: ezy.sdk3rd.social/src/main/java/ezy/sdk3rd/social/sdk/ResultCode.java
// public class ResultCode {
//     public static final int RESULT_OK = 0;
//     public static final int RESULT_PENDING = 1;
//     public static final int RESULT_CANCELLED = 2;
//     public static final int RESULT_FAILED = 3;
// 
// }


// Path: ezy.sdk3rd.social/src/main/java/ezy/sdk3rd/social/platforms/weixin/WXBase.java
import android.app.Activity;
import android.content.Intent;
import android.text.TextUtils;
import android.util.Log;
import com.tencent.mm.opensdk.constants.ConstantsAPI;
import com.tencent.mm.opensdk.modelbase.BaseReq;
import com.tencent.mm.opensdk.modelbase.BaseResp;
import com.tencent.mm.opensdk.modelmsg.SendAuth;
import com.tencent.mm.opensdk.modelmsg.SendMessageToWX;
import com.tencent.mm.opensdk.modelpay.PayResp;
import com.tencent.mm.opensdk.openapi.IWXAPI;
import com.tencent.mm.opensdk.openapi.IWXAPIEventHandler;
import com.tencent.mm.opensdk.openapi.WXAPIFactory;
import java.util.WeakHashMap;
import ezy.sdk3rd.social.sdk.IResult;
import ezy.sdk3rd.social.sdk.OnCallback;
import ezy.sdk3rd.social.sdk.Platform;
import ezy.sdk3rd.social.sdk.ResultCode;


    @Override
    public void onResult(int requestCode, int resultCode, Intent data) {
        if (mApi != null && requestCode == REQUEST_CODE) {
            mApi.handleIntent(data, this);
        }
    }

    @Override
    public void onReq(BaseReq req) {
        Log.e(TAG, "transaction = " + req.transaction + ", type = " + req.getType() + ", openId = " + req.openId);
    }

    @Override
    public void onResp(BaseResp resp) {
        Log.e(TAG, "transaction = " + resp.transaction + ", type = " + resp.getType() + ", errCode = " + resp.errCode + ", err = " + resp.errStr);

        if (resp.errCode == BaseResp.ErrCode.ERR_OK) {
            switch (resp.getType()) {
            case ConstantsAPI.COMMAND_SENDAUTH:
                onResultOk((SendAuth.Resp) resp);
                break;
            case ConstantsAPI.COMMAND_PAY_BY_WX:
                onResultOk((PayResp) resp);
                break;
            case ConstantsAPI.COMMAND_SENDMESSAGE_TO_WX:
                onResultOk((SendMessageToWX.Resp) resp);
                break;
            }
        } else if (resp.errCode == BaseResp.ErrCode.ERR_USER_CANCEL) {
            mCallback.onFailed(mActivity, ResultCode.RESULT_CANCELLED, toMessage(resp));