Commit 0011be9e975512b64e94470c5b15ebe78d0e949e
Merge branch 'master' of bj.gitlab.cnlive.com:cnlive-team/newModuleStrike
Showing
100 changed files
with
533 additions
and
4 deletions
Too many changes to show.
To preserve performance only 100 of 116 files are displayed.
.idea/misc.xml
| 1 | 1 | <?xml version="1.0" encoding="UTF-8"?> |
| 2 | 2 | <project version="4"> |
| 3 | + <component name="NullableNotNullManager"> | |
| 4 | + <option name="myDefaultNullable" value="org.jetbrains.annotations.Nullable" /> | |
| 5 | + <option name="myDefaultNotNull" value="androidx.annotation.NonNull" /> | |
| 6 | + <option name="myNullables"> | |
| 7 | + <value> | |
| 8 | + <list size="12"> | |
| 9 | + <item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.Nullable" /> | |
| 10 | + <item index="1" class="java.lang.String" itemvalue="javax.annotation.Nullable" /> | |
| 11 | + <item index="2" class="java.lang.String" itemvalue="javax.annotation.CheckForNull" /> | |
| 12 | + <item index="3" class="java.lang.String" itemvalue="edu.umd.cs.findbugs.annotations.Nullable" /> | |
| 13 | + <item index="4" class="java.lang.String" itemvalue="android.support.annotation.Nullable" /> | |
| 14 | + <item index="5" class="java.lang.String" itemvalue="androidx.annotation.Nullable" /> | |
| 15 | + <item index="6" class="java.lang.String" itemvalue="android.annotation.Nullable" /> | |
| 16 | + <item index="7" class="java.lang.String" itemvalue="androidx.annotation.RecentlyNullable" /> | |
| 17 | + <item index="8" class="java.lang.String" itemvalue="org.checkerframework.checker.nullness.qual.Nullable" /> | |
| 18 | + <item index="9" class="java.lang.String" itemvalue="org.checkerframework.checker.nullness.compatqual.NullableDecl" /> | |
| 19 | + <item index="10" class="java.lang.String" itemvalue="org.checkerframework.checker.nullness.compatqual.NullableType" /> | |
| 20 | + <item index="11" class="java.lang.String" itemvalue="com.android.annotations.Nullable" /> | |
| 21 | + </list> | |
| 22 | + </value> | |
| 23 | + </option> | |
| 24 | + <option name="myNotNulls"> | |
| 25 | + <value> | |
| 26 | + <list size="11"> | |
| 27 | + <item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.NotNull" /> | |
| 28 | + <item index="1" class="java.lang.String" itemvalue="javax.annotation.Nonnull" /> | |
| 29 | + <item index="2" class="java.lang.String" itemvalue="edu.umd.cs.findbugs.annotations.NonNull" /> | |
| 30 | + <item index="3" class="java.lang.String" itemvalue="android.support.annotation.NonNull" /> | |
| 31 | + <item index="4" class="java.lang.String" itemvalue="androidx.annotation.NonNull" /> | |
| 32 | + <item index="5" class="java.lang.String" itemvalue="android.annotation.NonNull" /> | |
| 33 | + <item index="6" class="java.lang.String" itemvalue="androidx.annotation.RecentlyNonNull" /> | |
| 34 | + <item index="7" class="java.lang.String" itemvalue="org.checkerframework.checker.nullness.qual.NonNull" /> | |
| 35 | + <item index="8" class="java.lang.String" itemvalue="org.checkerframework.checker.nullness.compatqual.NonNullDecl" /> | |
| 36 | + <item index="9" class="java.lang.String" itemvalue="org.checkerframework.checker.nullness.compatqual.NonNullType" /> | |
| 37 | + <item index="10" class="java.lang.String" itemvalue="com.android.annotations.NonNull" /> | |
| 38 | + </list> | |
| 39 | + </value> | |
| 40 | + </option> | |
| 41 | + </component> | |
| 3 | 42 | <component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="1.8" project-jdk-type="JavaSDK"> |
| 4 | 43 | <output url="file://$PROJECT_DIR$/build/classes" /> |
| 5 | 44 | </component> | ... | ... |
cloud/share/.gitignore renamed to cloud/third_tool/.gitignore
cloud/share/build.gradle renamed to cloud/third_tool/build.gradle
cloud/share/libs/open_sdk_r6008_lite.jar renamed to cloud/third_tool/libs/open_sdk_r6008_lite.jar
No preview for this file type
cloud/share/proguard-rules.pro renamed to cloud/third_tool/proguard-rules.pro
cloud/share/src/debug/AndroidManifest.xml renamed to cloud/third_tool/src/debug/AndroidManifest.xml
cloud/share/src/debug/java/com/cnlive/cloud/debug/wxapi/WXEntryActivity.java renamed to cloud/third_tool/src/debug/java/com/cnlive/strike/debug/wxapi/WXEntryActivity.java
| 1 | -package com.cnlive.cloud.debug.wxapi; | |
| 1 | +package com.cnlive.strike.debug.wxapi; | |
| 2 | 2 | |
| 3 | 3 | import android.app.Activity; |
| 4 | 4 | import android.content.Intent; |
| ... | ... | @@ -7,17 +7,17 @@ import android.os.Bundle; |
| 7 | 7 | import android.text.TextUtils; |
| 8 | 8 | import android.widget.Toast; |
| 9 | 9 | |
| 10 | +import com.cnlive.cloud.user.auth.UserService; | |
| 10 | 11 | import com.cnlive.core.libs.base.application.AppConfig; |
| 11 | 12 | import com.cnlive.core.libs.base.util.AlertUtil; |
| 12 | 13 | import com.cnlive.share.BuildConfig; |
| 13 | 14 | import com.cnlive.share.arouter.ARouterUtil; |
| 14 | 15 | import com.cnlive.share.data.ShareIntegralTypeInfo; |
| 15 | 16 | import com.cnlive.share.data.WeChatInfo; |
| 16 | -import com.cnlive.share.observable.WechatLoginObservable; | |
| 17 | +import com.cnlive.login.observer.WechatLoginObservable; | |
| 17 | 18 | import com.cnlive.share.observable.WechatShareObservable; |
| 18 | 19 | import com.cnlive.share.util.DateTimeUtil; |
| 19 | 20 | import com.cnlive.share.util.OkHttpUtils; |
| 20 | -import com.cnlive.cloud.user.auth.UserService; | |
| 21 | 21 | import com.google.gson.Gson; |
| 22 | 22 | import com.tencent.mm.opensdk.modelbase.BaseReq; |
| 23 | 23 | import com.tencent.mm.opensdk.modelbase.BaseResp; | ... | ... |
cloud/share/src/main/AndroidManifest.xml renamed to cloud/third_tool/src/main/AndroidManifest.xml
cloud/third_tool/src/main/java/com/cnlive/login/action/UserThirdAction.java
0 → 100644
| 1 | +package com.cnlive.login.action; | |
| 2 | + | |
| 3 | +import android.accounts.Account; | |
| 4 | +import android.content.Context; | |
| 5 | +import android.text.TextUtils; | |
| 6 | + | |
| 7 | +import com.cnlive.cloud.user.auth.UserService; | |
| 8 | +import com.cnlive.cloud.user.model.CNLiveUserInfo; | |
| 9 | +import com.cnlive.core.network.HttpConn; | |
| 10 | +import com.cnlive.core.network.NetCallBack; | |
| 11 | +import com.cnlive.core.network.model.BaseResult; | |
| 12 | +import com.cnlive.core.network.model.UserData; | |
| 13 | + | |
| 14 | +import io.reactivex.Observable; | |
| 15 | + | |
| 16 | +//import com.cnlive.strike.user.model.CNLiveUserInfo; | |
| 17 | + | |
| 18 | +/** | |
| 19 | + * created by hanyayun | |
| 20 | + * on 2019/12/4 | |
| 21 | + */ | |
| 22 | +public class UserThirdAction { | |
| 23 | + | |
| 24 | + | |
| 25 | + private static final int MAX_USER_COUNT = 1; | |
| 26 | + | |
| 27 | + public static void otherLogin(Context context, String thirdPartyPlat, String thirdPartyId, CallBack callBack) { | |
| 28 | + | |
| 29 | + HttpConn.action(UserThirdUtilAction.otherLogin(context, thirdPartyPlat, thirdPartyId), new NetCallBack<BaseResult<UserData>>() { | |
| 30 | + @Override | |
| 31 | + public void onRequestState(int state) { | |
| 32 | + if (null != callBack) { | |
| 33 | + callBack.callback(state, "", null); | |
| 34 | + } | |
| 35 | + } | |
| 36 | + | |
| 37 | + @Override | |
| 38 | + public void onSuccess(BaseResult<UserData> data) { | |
| 39 | + loginAppAction(data, context, "", "", true, callBack); | |
| 40 | + } | |
| 41 | + | |
| 42 | + @Override | |
| 43 | + public void onFailure(String errCode, String errMsg, Exception e) { | |
| 44 | + if (null != callBack) { | |
| 45 | + callBack.callback(Integer.parseInt(errCode), errMsg, null); | |
| 46 | + } | |
| 47 | + } | |
| 48 | + }); | |
| 49 | + } | |
| 50 | + | |
| 51 | + | |
| 52 | + public static void otherLoginBindMobile(Context context, String phone, String countryCode, String ems, | |
| 53 | + String thirdPartyPlat, String thirdPartyId, String nickName, String gender, | |
| 54 | + String location, String faceUrl, CallBack callBack) { | |
| 55 | + | |
| 56 | + HttpConn.action(UserThirdUtilAction.otherLoginBindMobile(context, phone, countryCode, ems, | |
| 57 | + thirdPartyPlat, thirdPartyId, nickName, gender, location, faceUrl), new NetCallBack<BaseResult<UserData>>() { | |
| 58 | + @Override | |
| 59 | + public void onRequestState(int state) { | |
| 60 | + if (null != callBack) { | |
| 61 | + callBack.callback(state, "", null); | |
| 62 | + } | |
| 63 | + } | |
| 64 | + | |
| 65 | + @Override | |
| 66 | + public void onSuccess(BaseResult<UserData> data) { | |
| 67 | + loginAppAction(data,context, "", "", true, callBack); | |
| 68 | + } | |
| 69 | + | |
| 70 | + @Override | |
| 71 | + public void onFailure(String errCode, String errMsg, Exception e) { | |
| 72 | + | |
| 73 | + } | |
| 74 | + }); | |
| 75 | + } | |
| 76 | + | |
| 77 | + | |
| 78 | + private static Observable<CNLiveUserInfo> loginAppAction(BaseResult<UserData> data, Context context, String userName, String userPassword, boolean otherLogin, CallBack callBack) { | |
| 79 | + CNLiveUserInfo userinfo = null; | |
| 80 | + if (null == data || null == data.getData()) { | |
| 81 | + if (null != callBack) { | |
| 82 | + callBack.callback(-5, "获取账户信息失败 请重试.", null); | |
| 83 | + } | |
| 84 | + } else if (TextUtils.isEmpty(data.getData().getMobile())) { | |
| 85 | + callBack.callback(-5, "绑定手机号已失效..", null); | |
| 86 | + } else { | |
| 87 | + //更新登录用户信息 | |
| 88 | + UserService userService = UserService.getInstance(context); | |
| 89 | + userService.loginAppAccount( | |
| 90 | + otherLogin ? data.getData().getMobile() : userName, | |
| 91 | + otherLogin ? data.getData().getMobile() : userPassword, | |
| 92 | + data.getData()); | |
| 93 | + //保留近期登录用户 | |
| 94 | + Account[] accounts = userService.getUserList(); | |
| 95 | + userinfo = userService.getAppAccount(); | |
| 96 | + if (accounts.length <= MAX_USER_COUNT) { | |
| 97 | + callBack.callback(0, "", userinfo); | |
| 98 | + } else { | |
| 99 | + CNLiveUserInfo finalUserinfo = userinfo; | |
| 100 | + userService.removeUser(accounts[0], future -> callBack.callback(0, "", finalUserinfo)); | |
| 101 | + } | |
| 102 | + } | |
| 103 | + return Observable.just(userinfo); | |
| 104 | + } | |
| 105 | + | |
| 106 | + | |
| 107 | + public interface CallBack { | |
| 108 | + void callback(int state, String msg, Object object); | |
| 109 | + } | |
| 110 | +} | ... | ... |
cloud/third_tool/src/main/java/com/cnlive/login/action/UserThirdUtilAction.java
0 → 100644
| 1 | +package com.cnlive.login.action; | |
| 2 | + | |
| 3 | +import android.content.Context; | |
| 4 | + | |
| 5 | +import com.cnlive.core.libs.base.application.AppConfig; | |
| 6 | +import com.cnlive.core.network.api.ApiBaseServiceOpen; | |
| 7 | +import com.cnlive.core.network.model.BaseResult; | |
| 8 | +import com.cnlive.core.network.model.UserData; | |
| 9 | +import com.cnlive.core.network.request.BaseRequest; | |
| 10 | + | |
| 11 | +import java.util.HashMap; | |
| 12 | +import java.util.Map; | |
| 13 | + | |
| 14 | +import io.reactivex.Observable; | |
| 15 | + | |
| 16 | +/** | |
| 17 | + * created by hanyayun | |
| 18 | + * on 2019/12/4 | |
| 19 | + */ | |
| 20 | +public class UserThirdUtilAction { | |
| 21 | + | |
| 22 | + /** | |
| 23 | + * 其他平台账户登录 | |
| 24 | + * | |
| 25 | + * @param context | |
| 26 | + * @param thirdPartyPlat 平台类型 1:sina 2:qq 3:weixin 4:renren | |
| 27 | + * @param thirdPartyId 第三方用户ID | |
| 28 | + * [qq: 建议使用openid, wx: 建议使用unionid, sina: 建议使用idstr]; | |
| 29 | + * 注意:同一用户在登录Sp下不同app时,thirdPartyId必须相同 | |
| 30 | + */ | |
| 31 | + public static Observable<BaseResult<UserData>> otherLogin(Context context, String thirdPartyPlat, String thirdPartyId) { | |
| 32 | + | |
| 33 | + Map<String, String> requestMap = new HashMap<>(); | |
| 34 | + requestMap.put("appId", AppConfig.getAppId()); | |
| 35 | + requestMap.put("thirdPartyPlat", thirdPartyPlat); | |
| 36 | + requestMap.put("thirdPartyId", thirdPartyId); | |
| 37 | + requestMap.put("frmId", AppConfig.getAppChannel()); | |
| 38 | + requestMap.put("clientPlat", "a"); | |
| 39 | + return BaseRequest.init().service(ApiBaseServiceOpen.class).loginIn3rdForWJJ(requestMap); | |
| 40 | + } | |
| 41 | + | |
| 42 | + /** | |
| 43 | + * 其他平台账户版定手机号并登录 | |
| 44 | + * | |
| 45 | + * @param context | |
| 46 | + * @param thirdPartyPlat 平台类型 1:sina 2:qq 3:weixin 4:renren | |
| 47 | + * @param thirdPartyId 第三方用户ID | |
| 48 | + * [qq: 建议使用openid, wx: 建议使用unionid, sina: 建议使用idstr]; | |
| 49 | + * 注意:同一用户在登录Sp下不同app时,thirdPartyId必须相同 | |
| 50 | + */ | |
| 51 | + | |
| 52 | + | |
| 53 | + public static Observable<BaseResult<UserData>> otherLoginBindMobile(Context context, | |
| 54 | + String phone, | |
| 55 | + String countryCode, | |
| 56 | + String ems, | |
| 57 | + String thirdPartyPlat, | |
| 58 | + String thirdPartyId, | |
| 59 | + String nickName, | |
| 60 | + String gender, | |
| 61 | + String location, | |
| 62 | + String faceUrl) { | |
| 63 | + Map<String, String> requestMap = new HashMap<>(); | |
| 64 | + | |
| 65 | + requestMap.put("frmId", AppConfig.getAppChannel()); | |
| 66 | + requestMap.put("clientPlat", "a"); | |
| 67 | + requestMap.put("uuid", AppConfig.getAppUUID()); | |
| 68 | + | |
| 69 | + requestMap.put("appId", AppConfig.getAppId()); | |
| 70 | + requestMap.put("mobile", phone); | |
| 71 | + requestMap.put("countryCode", countryCode); | |
| 72 | + requestMap.put("verificationCode", ems); | |
| 73 | + | |
| 74 | + requestMap.put("thirdPartyPlat", thirdPartyPlat); | |
| 75 | + requestMap.put("thirdPartyId", thirdPartyId); | |
| 76 | + requestMap.put("nickName", nickName); | |
| 77 | + requestMap.put("gender", gender); | |
| 78 | + requestMap.put("location", location); | |
| 79 | + requestMap.put("faceUrl", faceUrl); | |
| 80 | + | |
| 81 | + return BaseRequest.init().service(ApiBaseServiceOpen.class).loginIn3rdAndMobileForWJJ(requestMap); | |
| 82 | + } | |
| 83 | +} | ... | ... |
cloud/third_tool/src/main/java/com/cnlive/login/model/ThirdLoginInfo.java
0 → 100644
| 1 | +package com.cnlive.login.model; | |
| 2 | + | |
| 3 | + | |
| 4 | +import com.cnlive.cloud.user.frame.data.OtherUserInfo; | |
| 5 | + | |
| 6 | +/** | |
| 7 | + * 作者: 吴奎庆 | |
| 8 | + * <p> | |
| 9 | + * 时间: 2019/9/19 | |
| 10 | + * <p> | |
| 11 | + * 简介: | |
| 12 | + */ | |
| 13 | +public class ThirdLoginInfo { | |
| 14 | + //类型 1 成功 2失败 | |
| 15 | + private int type; | |
| 16 | + //错误信息 | |
| 17 | + private String message; | |
| 18 | + //登陆信息 | |
| 19 | + OtherUserInfo otherUserInfo; | |
| 20 | + | |
| 21 | + public ThirdLoginInfo() { | |
| 22 | + } | |
| 23 | + | |
| 24 | + public ThirdLoginInfo(int type, String message, OtherUserInfo otherUserInfo) { | |
| 25 | + this.type = type; | |
| 26 | + this.message = message; | |
| 27 | + this.otherUserInfo = otherUserInfo; | |
| 28 | + } | |
| 29 | + | |
| 30 | + public int getType() { | |
| 31 | + return type; | |
| 32 | + } | |
| 33 | + | |
| 34 | + public void setType(int type) { | |
| 35 | + this.type = type; | |
| 36 | + } | |
| 37 | + | |
| 38 | + public String getMessage() { | |
| 39 | + return message; | |
| 40 | + } | |
| 41 | + | |
| 42 | + public void setMessage(String message) { | |
| 43 | + this.message = message; | |
| 44 | + } | |
| 45 | + | |
| 46 | + public OtherUserInfo getOtherUserInfo() { | |
| 47 | + return otherUserInfo; | |
| 48 | + } | |
| 49 | + | |
| 50 | + public void setOtherUserInfo(OtherUserInfo otherUserInfo) { | |
| 51 | + this.otherUserInfo = otherUserInfo; | |
| 52 | + } | |
| 53 | +} | ... | ... |
cloud/third_tool/src/main/java/com/cnlive/login/observer/ThirdLoginObservable.java
0 → 100644
| 1 | +package com.cnlive.login.observer; | |
| 2 | + | |
| 3 | + | |
| 4 | +import com.cnlive.login.model.ThirdLoginInfo; | |
| 5 | + | |
| 6 | +import java.util.Observable; | |
| 7 | + | |
| 8 | +/** | |
| 9 | + * 作者: 吴奎庆 | |
| 10 | + * <p> | |
| 11 | + * 时间: 2019/9/19 | |
| 12 | + * <p> | |
| 13 | + * 简介: | |
| 14 | + */ | |
| 15 | +public class ThirdLoginObservable extends Observable { | |
| 16 | + | |
| 17 | + private static ThirdLoginObservable instance; | |
| 18 | + | |
| 19 | + public static ThirdLoginObservable getInstance() { | |
| 20 | + synchronized (ThirdLoginObservable.class) { | |
| 21 | + if (instance == null) { | |
| 22 | + instance = new ThirdLoginObservable(); | |
| 23 | + } | |
| 24 | + } | |
| 25 | + return instance; | |
| 26 | + } | |
| 27 | + | |
| 28 | + public void update(ThirdLoginInfo userInfo){ | |
| 29 | + setChanged(); | |
| 30 | + notifyObservers(userInfo); | |
| 31 | + } | |
| 32 | +} | ... | ... |
cloud/share/src/main/java/com/cnlive/share/observable/WechatLoginObservable.java renamed to cloud/third_tool/src/main/java/com/cnlive/login/observer/WechatLoginObservable.java
cloud/third_tool/src/main/java/com/cnlive/login/utils/ThirdLoginUtil.java
0 → 100644
| 1 | +package com.cnlive.login.utils; | |
| 2 | + | |
| 3 | +import android.content.Context; | |
| 4 | +import android.text.TextUtils; | |
| 5 | + | |
| 6 | +import com.cnlive.cloud.user.frame.data.OtherUserInfo; | |
| 7 | +import com.cnlive.login.model.ThirdLoginInfo; | |
| 8 | +import com.cnlive.login.observer.ThirdLoginObservable; | |
| 9 | +import com.sina.weibo.sdk.auth.Oauth2AccessToken; | |
| 10 | +import com.sina.weibo.sdk.net.HttpManager; | |
| 11 | +import com.sina.weibo.sdk.net.WeiboParameters; | |
| 12 | +import com.tencent.connect.UserInfo; | |
| 13 | +import com.tencent.tauth.IUiListener; | |
| 14 | +import com.tencent.tauth.Tencent; | |
| 15 | +import com.tencent.tauth.UiError; | |
| 16 | + | |
| 17 | +import org.json.JSONException; | |
| 18 | +import org.json.JSONObject; | |
| 19 | + | |
| 20 | +import io.reactivex.Observable; | |
| 21 | +import io.reactivex.ObservableEmitter; | |
| 22 | +import io.reactivex.ObservableOnSubscribe; | |
| 23 | +import io.reactivex.Observer; | |
| 24 | +import io.reactivex.android.schedulers.AndroidSchedulers; | |
| 25 | +import io.reactivex.disposables.Disposable; | |
| 26 | +import io.reactivex.schedulers.Schedulers; | |
| 27 | + | |
| 28 | +import static com.tencent.connect.common.Constants.PARAM_ACCESS_TOKEN; | |
| 29 | +import static com.tencent.connect.common.Constants.PARAM_EXPIRES_IN; | |
| 30 | +import static com.tencent.open.SocialConstants.PARAM_OPEN_ID; | |
| 31 | + | |
| 32 | +/** | |
| 33 | + * 作者: 吴奎庆 | |
| 34 | + * <p> | |
| 35 | + * 时间: 2019/9/19 | |
| 36 | + * <p> | |
| 37 | + * 简介: 三方登陆的工具类 | |
| 38 | + */ | |
| 39 | +public class ThirdLoginUtil { | |
| 40 | + /** | |
| 41 | + * 获取微博信息 | |
| 42 | + * | |
| 43 | + * @param context | |
| 44 | + * @param oauth2AccessToken | |
| 45 | + */ | |
| 46 | + public static void getWeiBoInfo(Context context, Oauth2AccessToken oauth2AccessToken) { | |
| 47 | + | |
| 48 | + Oauth2AccessToken mAccessToken = oauth2AccessToken; | |
| 49 | + //从这里获取用户输入的 电话号码信息 | |
| 50 | + if (mAccessToken.isSessionValid()) { | |
| 51 | + // 显示 Token | |
| 52 | + Observable.create(new ObservableOnSubscribe<String>() { | |
| 53 | + @Override | |
| 54 | + public void subscribe(ObservableEmitter<String> emitter) throws Exception { | |
| 55 | + | |
| 56 | + WeiboParameters parameters = new WeiboParameters("3884700821"); | |
| 57 | + parameters.put("access_token", oauth2AccessToken.getToken()); | |
| 58 | + parameters.put("uid", oauth2AccessToken.getUid()); | |
| 59 | + String message = HttpManager.openUrl(context, "https://api.weibo.com/2/users/show.json", "GET", parameters); | |
| 60 | + emitter.onNext(message); | |
| 61 | + } | |
| 62 | + }).subscribeOn(Schedulers.io()) | |
| 63 | + .observeOn(AndroidSchedulers.mainThread()) | |
| 64 | + .subscribe(new Observer<String>() { | |
| 65 | + @Override | |
| 66 | + public void onSubscribe(Disposable d) { | |
| 67 | + | |
| 68 | + } | |
| 69 | + | |
| 70 | + @Override | |
| 71 | + public void onNext(String message) { | |
| 72 | + try { | |
| 73 | + | |
| 74 | + JSONObject jsonObject = new JSONObject(message); | |
| 75 | + if (jsonObject == null) return; | |
| 76 | + String id = jsonObject.getString("idstr"); | |
| 77 | + String name = jsonObject.getString("name"); | |
| 78 | + String urlface = jsonObject.getString("avatar_large"); | |
| 79 | + String location = jsonObject.getString("location"); | |
| 80 | + String gender = jsonObject.getString("gender"); | |
| 81 | + if (TextUtils.isEmpty(id)) return; | |
| 82 | + | |
| 83 | + OtherUserInfo userInfo = new OtherUserInfo(); | |
| 84 | + userInfo.setFaceUrl(urlface); | |
| 85 | + userInfo.setGender(gender); | |
| 86 | + userInfo.setNickName(name); | |
| 87 | + userInfo.setLocation(location); | |
| 88 | + userInfo.setThirdPartyId(id); | |
| 89 | + userInfo.setLoginType("1"); | |
| 90 | + | |
| 91 | + ThirdLoginInfo thirdLoginInfo = new ThirdLoginInfo(); | |
| 92 | + thirdLoginInfo.setType(1); | |
| 93 | + thirdLoginInfo.setOtherUserInfo(userInfo); | |
| 94 | + ThirdLoginObservable.getInstance().update(thirdLoginInfo); | |
| 95 | + | |
| 96 | + } catch (Exception e) { | |
| 97 | + ThirdLoginObservable.getInstance().update(new ThirdLoginInfo(2, "登陆失败", null)); | |
| 98 | + } | |
| 99 | + } | |
| 100 | + | |
| 101 | + @Override | |
| 102 | + public void onError(Throwable e) { | |
| 103 | + ThirdLoginObservable.getInstance().update(new ThirdLoginInfo(2, "登陆失败", null)); | |
| 104 | + } | |
| 105 | + | |
| 106 | + @Override | |
| 107 | + public void onComplete() { | |
| 108 | + | |
| 109 | + } | |
| 110 | + }); | |
| 111 | + } else { | |
| 112 | + // 以下几种情况,您会收到 Code: | |
| 113 | + // 1. 当您未在平台上注册的应用程序的包名与签名时; | |
| 114 | + // 2. 当您注册的应用程序包名与签名不正确时; | |
| 115 | + // 3. 当您在平台上注册的包名和签名与您当前测试的应用的包名和签名不匹配时。 | |
| 116 | + String code = oauth2AccessToken.getBundle().getString("code"); | |
| 117 | + String message = "null"; | |
| 118 | + if (!TextUtils.isEmpty(code)) { | |
| 119 | + message = message + "\nObtained the code: " + code; | |
| 120 | + } | |
| 121 | + ThirdLoginObservable.getInstance().update(new ThirdLoginInfo(2, "登陆失败", null)); | |
| 122 | + } | |
| 123 | + | |
| 124 | + } | |
| 125 | + | |
| 126 | + | |
| 127 | + public static void getQQInfo(Context context, Tencent mTencent, Object obj) { | |
| 128 | + JSONObject jsonObject = (JSONObject) obj; | |
| 129 | + if (jsonObject != null) { | |
| 130 | + try { | |
| 131 | + int ret = jsonObject.getInt("ret"); | |
| 132 | + if (ret == 0) { | |
| 133 | + //此处登录授权成功 | |
| 134 | + String openId = jsonObject.getString(PARAM_OPEN_ID); | |
| 135 | + String access_token = jsonObject.getString(PARAM_ACCESS_TOKEN); | |
| 136 | + String expires = jsonObject.getString(PARAM_EXPIRES_IN); | |
| 137 | + mTencent.setOpenId(openId); | |
| 138 | + mTencent.setAccessToken(access_token, expires); | |
| 139 | + //获取用户信息 | |
| 140 | + getUserInfo(context, mTencent, openId); | |
| 141 | + } else { | |
| 142 | + ThirdLoginObservable.getInstance().update(new ThirdLoginInfo(2, "登陆失败", null)); | |
| 143 | + } | |
| 144 | + } catch (JSONException e) { | |
| 145 | + e.printStackTrace(); | |
| 146 | + } | |
| 147 | + } | |
| 148 | + } | |
| 149 | + | |
| 150 | + | |
| 151 | + private static void getUserInfo(Context context, Tencent mTencent, String openId) { | |
| 152 | + UserInfo info = new UserInfo(context, mTencent.getQQToken()); | |
| 153 | + info.getUserInfo(new IUiListener() { | |
| 154 | + @Override | |
| 155 | + public void onComplete(Object value) { | |
| 156 | + JSONObject jsonObject = (JSONObject) value; | |
| 157 | + if (jsonObject == null) return; | |
| 158 | + | |
| 159 | + try { | |
| 160 | + String name = jsonObject.getString("nickname"); | |
| 161 | + String urlface = jsonObject.getString("figureurl_qq"); | |
| 162 | + String gender = jsonObject.getString("gender"); | |
| 163 | + String province = jsonObject.getString("province"); | |
| 164 | + String city = jsonObject.getString("city"); | |
| 165 | + | |
| 166 | + if (TextUtils.isEmpty(openId)) return; | |
| 167 | + | |
| 168 | + OtherUserInfo otherUserInfo = new OtherUserInfo(); | |
| 169 | + otherUserInfo.setFaceUrl(urlface); | |
| 170 | + | |
| 171 | + otherUserInfo.setNickName(name); | |
| 172 | + if (TextUtils.isEmpty(city)) { | |
| 173 | + otherUserInfo.setLocation(province); | |
| 174 | + } else { | |
| 175 | + otherUserInfo.setLocation(city); | |
| 176 | + } | |
| 177 | + | |
| 178 | + if ("男".equals(gender)) { | |
| 179 | + otherUserInfo.setGender("m"); | |
| 180 | + } else if ("女".equals(gender)) { | |
| 181 | + otherUserInfo.setGender("f"); | |
| 182 | + } else { | |
| 183 | + otherUserInfo.setGender("n"); | |
| 184 | + } | |
| 185 | + | |
| 186 | + otherUserInfo.setThirdPartyId(openId); | |
| 187 | + otherUserInfo.setLoginType("2"); | |
| 188 | + ThirdLoginInfo thirdLoginInfo = new ThirdLoginInfo(); | |
| 189 | + thirdLoginInfo.setType(1); | |
| 190 | + thirdLoginInfo.setOtherUserInfo(otherUserInfo); | |
| 191 | + ThirdLoginObservable.getInstance().update(thirdLoginInfo); | |
| 192 | + | |
| 193 | + } catch (JSONException e) { | |
| 194 | + ThirdLoginObservable.getInstance().update(new ThirdLoginInfo(2, "登陆失败", null)); | |
| 195 | + } | |
| 196 | + } | |
| 197 | + | |
| 198 | + @Override | |
| 199 | + public void onError(UiError uiError) { | |
| 200 | + ThirdLoginObservable.getInstance().update(new ThirdLoginInfo(2, "登陆失败", null)); | |
| 201 | + } | |
| 202 | + | |
| 203 | + @Override | |
| 204 | + public void onCancel() { | |
| 205 | + } | |
| 206 | + }); | |
| 207 | + } | |
| 208 | + | |
| 209 | +} | ... | ... |
cloud/share/src/main/java/com/cnlive/share/QQListener.java renamed to cloud/third_tool/src/main/java/com/cnlive/share/QQListener.java
cloud/share/src/main/java/com/cnlive/share/adapter/DataBindingAdapter.java renamed to cloud/third_tool/src/main/java/com/cnlive/share/adapter/DataBindingAdapter.java
cloud/share/src/main/java/com/cnlive/share/api/ApiShareService.java renamed to cloud/third_tool/src/main/java/com/cnlive/share/api/ApiShareService.java
cloud/share/src/main/java/com/cnlive/share/arouter/ARouterUtil.java renamed to cloud/third_tool/src/main/java/com/cnlive/share/arouter/ARouterUtil.java
cloud/share/src/main/java/com/cnlive/share/data/FullVideoShareItemData.java renamed to cloud/third_tool/src/main/java/com/cnlive/share/data/FullVideoShareItemData.java
cloud/share/src/main/java/com/cnlive/share/data/IconInfo.java renamed to cloud/third_tool/src/main/java/com/cnlive/share/data/IconInfo.java
cloud/share/src/main/java/com/cnlive/share/data/ShareInfo.java renamed to cloud/third_tool/src/main/java/com/cnlive/share/data/ShareInfo.java
cloud/share/src/main/java/com/cnlive/share/data/ShareIntegralTypeInfo.java renamed to cloud/third_tool/src/main/java/com/cnlive/share/data/ShareIntegralTypeInfo.java
cloud/share/src/main/java/com/cnlive/share/data/WeChatInfo.java renamed to cloud/third_tool/src/main/java/com/cnlive/share/data/WeChatInfo.java
cloud/share/src/main/java/com/cnlive/share/model/ShareReleaseInfoUtil.java renamed to cloud/third_tool/src/main/java/com/cnlive/share/model/ShareReleaseInfoUtil.java
cloud/share/src/main/java/com/cnlive/share/model/ShareStateInfo.java renamed to cloud/third_tool/src/main/java/com/cnlive/share/model/ShareStateInfo.java
cloud/share/src/main/java/com/cnlive/share/model/ShortLinkInfo.java renamed to cloud/third_tool/src/main/java/com/cnlive/share/model/ShortLinkInfo.java
cloud/share/src/main/java/com/cnlive/share/observable/ShareClickObservable.java renamed to cloud/third_tool/src/main/java/com/cnlive/share/observable/ShareClickObservable.java
cloud/share/src/main/java/com/cnlive/share/observable/ShareStateObservable.java renamed to cloud/third_tool/src/main/java/com/cnlive/share/observable/ShareStateObservable.java
cloud/share/src/main/java/com/cnlive/share/observable/ShareWjjStateObservable.java renamed to cloud/third_tool/src/main/java/com/cnlive/share/observable/ShareWjjStateObservable.java
cloud/share/src/main/java/com/cnlive/share/observable/WechatShareObservable.java renamed to cloud/third_tool/src/main/java/com/cnlive/share/observable/WechatShareObservable.java
cloud/share/src/main/java/com/cnlive/share/ui/FullVideoShareView.java renamed to cloud/third_tool/src/main/java/com/cnlive/share/ui/FullVideoShareView.java
cloud/share/src/main/java/com/cnlive/share/ui/ShareActivity.java renamed to cloud/third_tool/src/main/java/com/cnlive/share/ui/ShareActivity.java
cloud/share/src/main/java/com/cnlive/share/ui/ShareDialogListAdapter.java renamed to cloud/third_tool/src/main/java/com/cnlive/share/ui/ShareDialogListAdapter.java
cloud/share/src/main/java/com/cnlive/share/ui/ShareImgActivity.java renamed to cloud/third_tool/src/main/java/com/cnlive/share/ui/ShareImgActivity.java
cloud/share/src/main/java/com/cnlive/share/ui/WechatAppletActivity.java renamed to cloud/third_tool/src/main/java/com/cnlive/share/ui/WechatAppletActivity.java
cloud/share/src/main/java/com/cnlive/share/ui/dialog/ShareDialog.java renamed to cloud/third_tool/src/main/java/com/cnlive/share/ui/dialog/ShareDialog.java
cloud/share/src/main/java/com/cnlive/share/util/BindingAdapterUtil.java renamed to cloud/third_tool/src/main/java/com/cnlive/share/util/BindingAdapterUtil.java
cloud/share/src/main/java/com/cnlive/share/util/DateTimeUtil.java renamed to cloud/third_tool/src/main/java/com/cnlive/share/util/DateTimeUtil.java
cloud/share/src/main/java/com/cnlive/share/util/OkHttpUtils.java renamed to cloud/third_tool/src/main/java/com/cnlive/share/util/OkHttpUtils.java
cloud/share/src/main/java/com/cnlive/share/util/ShareOtherUtil.java renamed to cloud/third_tool/src/main/java/com/cnlive/share/util/ShareOtherUtil.java
cloud/share/src/main/java/com/cnlive/share/util/ShareUtils.java renamed to cloud/third_tool/src/main/java/com/cnlive/share/util/ShareUtils.java
| ... | ... | @@ -127,6 +127,7 @@ public class ShareUtils { |
| 127 | 127 | } |
| 128 | 128 | String url = Util.processUrlData(shareInfo.getUrl(), mContext, false); |
| 129 | 129 | WXWebpageObject webpage = new WXWebpageObject(); |
| 130 | + //TODO 上传maven考虑正式版测试版 | |
| 130 | 131 | IWXAPI api = WXAPIFactory.createWXAPI(mContext, AppConfig.getWechatAppid()); |
| 131 | 132 | webpage.webpageUrl = url; |
| 132 | 133 | WXMediaMessage msg = new WXMediaMessage(webpage); | ... | ... |
cloud/share/src/main/java/com/cnlive/share/util/Util.java renamed to cloud/third_tool/src/main/java/com/cnlive/share/util/Util.java
cloud/share/src/main/res/anim/share_activity_in.xml renamed to cloud/third_tool/src/main/res/anim/share_activity_in.xml
cloud/share/src/main/res/anim/share_activity_out.xml renamed to cloud/third_tool/src/main/res/anim/share_activity_out.xml
cloud/share/src/main/res/anim/share_slide_in_bottom.xml renamed to cloud/third_tool/src/main/res/anim/share_slide_in_bottom.xml
cloud/share/src/main/res/anim/share_slide_out_bottom.xml renamed to cloud/third_tool/src/main/res/anim/share_slide_out_bottom.xml
cloud/share/src/main/res/drawable-hdpi/browser.webp renamed to cloud/third_tool/src/main/res/drawable-hdpi/browser.webp
No preview for this file type
cloud/share/src/main/res/drawable-hdpi/download_album.webp renamed to cloud/third_tool/src/main/res/drawable-hdpi/download_album.webp
No preview for this file type
cloud/share/src/main/res/drawable-hdpi/drd_quxiao.webp renamed to cloud/third_tool/src/main/res/drawable-hdpi/drd_quxiao.webp
No preview for this file type
cloud/share/src/main/res/drawable-hdpi/pengyouquan.webp renamed to cloud/third_tool/src/main/res/drawable-hdpi/pengyouquan.webp
No preview for this file type
cloud/share/src/main/res/drawable-hdpi/qq.webp renamed to cloud/third_tool/src/main/res/drawable-hdpi/qq.webp
No preview for this file type
cloud/share/src/main/res/drawable-hdpi/report_icon.webp renamed to cloud/third_tool/src/main/res/drawable-hdpi/report_icon.webp
No preview for this file type
cloud/share/src/main/res/drawable-hdpi/shenghuoquan.webp renamed to cloud/third_tool/src/main/res/drawable-hdpi/shenghuoquan.webp
No preview for this file type
cloud/share/src/main/res/drawable-hdpi/ssdk_oks_ptr_ptr.webp renamed to cloud/third_tool/src/main/res/drawable-hdpi/ssdk_oks_ptr_ptr.webp
No preview for this file type
cloud/share/src/main/res/drawable-hdpi/wechat.webp renamed to cloud/third_tool/src/main/res/drawable-hdpi/wechat.webp
No preview for this file type
cloud/share/src/main/res/drawable-hdpi/weibo.webp renamed to cloud/third_tool/src/main/res/drawable-hdpi/weibo.webp
No preview for this file type
cloud/share/src/main/res/drawable-hdpi/wjjhaoyou.webp renamed to cloud/third_tool/src/main/res/drawable-hdpi/wjjhaoyou.webp
No preview for this file type
cloud/share/src/main/res/drawable-xhdpi/browser.webp renamed to cloud/third_tool/src/main/res/drawable-xhdpi/browser.webp
No preview for this file type
cloud/share/src/main/res/drawable-xhdpi/download_album.webp renamed to cloud/third_tool/src/main/res/drawable-xhdpi/download_album.webp
No preview for this file type
cloud/share/src/main/res/drawable-xhdpi/drd_pengyouquan.webp renamed to cloud/third_tool/src/main/res/drawable-xhdpi/drd_pengyouquan.webp
No preview for this file type
cloud/share/src/main/res/drawable-xhdpi/drd_qq.webp renamed to cloud/third_tool/src/main/res/drawable-xhdpi/drd_qq.webp
No preview for this file type
cloud/share/src/main/res/drawable-xhdpi/drd_quxiao.webp renamed to cloud/third_tool/src/main/res/drawable-xhdpi/drd_quxiao.webp
No preview for this file type
cloud/share/src/main/res/drawable-xhdpi/drd_weixin.webp renamed to cloud/third_tool/src/main/res/drawable-xhdpi/drd_weixin.webp
No preview for this file type
cloud/share/src/main/res/drawable-xhdpi/pengyouquan.webp renamed to cloud/third_tool/src/main/res/drawable-xhdpi/pengyouquan.webp
No preview for this file type
cloud/share/src/main/res/drawable-xhdpi/qq.webp renamed to cloud/third_tool/src/main/res/drawable-xhdpi/qq.webp
No preview for this file type
cloud/share/src/main/res/drawable-xhdpi/report_icon.webp renamed to cloud/third_tool/src/main/res/drawable-xhdpi/report_icon.webp
No preview for this file type
cloud/share/src/main/res/drawable-xhdpi/share_logo_share_module.webp renamed to cloud/third_tool/src/main/res/drawable-xhdpi/share_logo_share_module.webp
No preview for this file type
cloud/share/src/main/res/drawable-xhdpi/shenghuoquan.webp renamed to cloud/third_tool/src/main/res/drawable-xhdpi/shenghuoquan.webp
No preview for this file type
cloud/share/src/main/res/drawable-xhdpi/wechat.webp renamed to cloud/third_tool/src/main/res/drawable-xhdpi/wechat.webp
No preview for this file type
cloud/share/src/main/res/drawable-xhdpi/weibo.webp renamed to cloud/third_tool/src/main/res/drawable-xhdpi/weibo.webp
No preview for this file type
cloud/share/src/main/res/drawable-xhdpi/white.webp renamed to cloud/third_tool/src/main/res/drawable-xhdpi/white.webp
No preview for this file type
cloud/share/src/main/res/drawable-xhdpi/wjjhaoyou.webp renamed to cloud/third_tool/src/main/res/drawable-xhdpi/wjjhaoyou.webp
No preview for this file type
cloud/share/src/main/res/drawable-xxhdpi/browser.webp renamed to cloud/third_tool/src/main/res/drawable-xxhdpi/browser.webp
No preview for this file type
cloud/share/src/main/res/drawable-xxhdpi/download_album.webp renamed to cloud/third_tool/src/main/res/drawable-xxhdpi/download_album.webp
No preview for this file type
cloud/share/src/main/res/drawable-xxhdpi/pengyouquan.webp renamed to cloud/third_tool/src/main/res/drawable-xxhdpi/pengyouquan.webp
No preview for this file type
cloud/share/src/main/res/drawable-xxhdpi/qq.webp renamed to cloud/third_tool/src/main/res/drawable-xxhdpi/qq.webp
No preview for this file type
cloud/share/src/main/res/drawable-xxhdpi/report_icon.webp renamed to cloud/third_tool/src/main/res/drawable-xxhdpi/report_icon.webp
No preview for this file type
cloud/share/src/main/res/drawable-xxhdpi/shenghuoquan.webp renamed to cloud/third_tool/src/main/res/drawable-xxhdpi/shenghuoquan.webp
No preview for this file type
cloud/share/src/main/res/drawable-xxhdpi/wechat.webp renamed to cloud/third_tool/src/main/res/drawable-xxhdpi/wechat.webp
No preview for this file type
cloud/share/src/main/res/drawable-xxhdpi/weibo.webp renamed to cloud/third_tool/src/main/res/drawable-xxhdpi/weibo.webp
No preview for this file type
cloud/share/src/main/res/drawable-xxhdpi/wjjhaoyou.webp renamed to cloud/third_tool/src/main/res/drawable-xxhdpi/wjjhaoyou.webp
No preview for this file type
cloud/share/src/main/res/drawable/ssdk_oks_classic_platform_cell_back.xml renamed to cloud/third_tool/src/main/res/drawable/ssdk_oks_classic_platform_cell_back.xml
cloud/share/src/main/res/drawable/ssdk_oks_classic_progressbar.xml renamed to cloud/third_tool/src/main/res/drawable/ssdk_oks_classic_progressbar.xml
cloud/share/src/main/res/layout/activity_share_dialog.xml renamed to cloud/third_tool/src/main/res/layout/activity_share_dialog.xml
cloud/share/src/main/res/layout/activity_share_img.xml renamed to cloud/third_tool/src/main/res/layout/activity_share_img.xml
cloud/share/src/main/res/layout/layout_full_video_share.xml renamed to cloud/third_tool/src/main/res/layout/layout_full_video_share.xml
cloud/share/src/main/res/layout/layout_share_dialog.xml renamed to cloud/third_tool/src/main/res/layout/layout_share_dialog.xml
cloud/share/src/main/res/layout/list_item_full_video_share.xml renamed to cloud/third_tool/src/main/res/layout/list_item_full_video_share.xml
cloud/share/src/main/res/layout/share_dialog_item.xml renamed to cloud/third_tool/src/main/res/layout/share_dialog_item.xml
cloud/share/src/main/res/values-en/ssdk_country_arrays.xml renamed to cloud/third_tool/src/main/res/values-en/ssdk_country_arrays.xml
cloud/share/src/main/res/values-en/ssdk_oks_strings.xml renamed to cloud/third_tool/src/main/res/values-en/ssdk_oks_strings.xml
cloud/share/src/main/res/values-en/ssdk_strings.xml renamed to cloud/third_tool/src/main/res/values-en/ssdk_strings.xml
cloud/share/src/main/res/values/colors.xml renamed to cloud/third_tool/src/main/res/values/colors.xml
cloud/share/src/main/res/values/ssdk_country_arrays.xml renamed to cloud/third_tool/src/main/res/values/ssdk_country_arrays.xml
cloud/share/src/main/res/values/ssdk_instapaper_strings.xml renamed to cloud/third_tool/src/main/res/values/ssdk_instapaper_strings.xml
cloud/share/src/main/res/values/ssdk_oks_color_drawables.xml renamed to cloud/third_tool/src/main/res/values/ssdk_oks_color_drawables.xml
cloud/share/src/main/res/values/ssdk_oks_strings.xml renamed to cloud/third_tool/src/main/res/values/ssdk_oks_strings.xml
cloud/share/src/main/res/values/ssdk_strings.xml renamed to cloud/third_tool/src/main/res/values/ssdk_strings.xml
cloud/share/src/main/res/values/strings.xml renamed to cloud/third_tool/src/main/res/values/strings.xml
cloud/share/src/main/res/values/styles.xml renamed to cloud/third_tool/src/main/res/values/styles.xml