|
@@ -1,10 +1,16 @@
|
|
|
package com.sheep.jiuyan.samllsheep.wxapi;
|
|
package com.sheep.jiuyan.samllsheep.wxapi;
|
|
|
|
|
+
|
|
|
import android.content.Intent;
|
|
import android.content.Intent;
|
|
|
import android.os.Bundle;
|
|
import android.os.Bundle;
|
|
|
|
|
|
|
|
|
|
+import com.sheep.gamegroup.event.WXLoginAuthEvent;
|
|
|
import com.sheep.jiuyan.samllsheep.wxutil.WXAPIUtil;
|
|
import com.sheep.jiuyan.samllsheep.wxutil.WXAPIUtil;
|
|
|
|
|
+import com.tencent.mm.opensdk.modelbase.BaseResp;
|
|
|
|
|
+import com.tencent.mm.opensdk.modelmsg.SendAuth;
|
|
|
import com.umeng.socialize.weixin.view.WXCallbackActivity;
|
|
import com.umeng.socialize.weixin.view.WXCallbackActivity;
|
|
|
|
|
|
|
|
|
|
+import org.greenrobot.eventbus.EventBus;
|
|
|
|
|
+
|
|
|
public class WXEntryActivity extends WXCallbackActivity {
|
|
public class WXEntryActivity extends WXCallbackActivity {
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
@@ -20,4 +26,18 @@ public class WXEntryActivity extends WXCallbackActivity {
|
|
|
finish();
|
|
finish();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public void onResp(BaseResp resp) {
|
|
|
|
|
+ if (resp instanceof SendAuth.Resp) {
|
|
|
|
|
+ if (resp.errCode == BaseResp.ErrCode.ERR_OK) {
|
|
|
|
|
+ String code = ((SendAuth.Resp) resp).code;
|
|
|
|
|
+ EventBus.getDefault().post(new WXLoginAuthEvent(code));
|
|
|
|
|
+ } else{
|
|
|
|
|
+ EventBus.getDefault().post(new WXLoginAuthEvent(null));
|
|
|
|
|
+ }
|
|
|
|
|
+ } else {
|
|
|
|
|
+ super.onResp(resp);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
}
|
|
}
|