Commit eca4a56e3a55fb3e28f70e8e74e5552548b9d199
1 parent
ba42588e
三方登录修改集成测试
Showing
22 changed files
with
537 additions
and
258 deletions
cloud/third_tool/build.gradle
| @@ -68,5 +68,5 @@ dependencies { | @@ -68,5 +68,5 @@ dependencies { | ||
| 68 | 68 | ||
| 69 | implementation project(':core:network') | 69 | implementation project(':core:network') |
| 70 | implementation project(':core:base') | 70 | implementation project(':core:base') |
| 71 | - implementation project (':cloud:user') | 71 | +// implementation project (':cloud:user') |
| 72 | } | 72 | } |
cloud/third_tool/src/debug/java/com/cnlive/strike/debug/wxapi/WXEntryActivity.java
| @@ -7,8 +7,9 @@ import android.os.Bundle; | @@ -7,8 +7,9 @@ import android.os.Bundle; | ||
| 7 | import android.text.TextUtils; | 7 | import android.text.TextUtils; |
| 8 | import android.widget.Toast; | 8 | import android.widget.Toast; |
| 9 | 9 | ||
| 10 | -import com.cnlive.cloud.user.auth.UserService; | 10 | +import com.alibaba.android.arouter.launcher.ARouter; |
| 11 | import com.cnlive.core.libs.base.application.AppConfig; | 11 | import com.cnlive.core.libs.base.application.AppConfig; |
| 12 | +import com.cnlive.core.libs.base.arouter.user.CNLiveUserService; | ||
| 12 | import com.cnlive.core.libs.base.util.AlertUtil; | 13 | import com.cnlive.core.libs.base.util.AlertUtil; |
| 13 | import com.cnlive.share.BuildConfig; | 14 | import com.cnlive.share.BuildConfig; |
| 14 | import com.cnlive.share.arouter.ARouterUtil; | 15 | import com.cnlive.share.arouter.ARouterUtil; |
| @@ -172,12 +173,13 @@ public class WXEntryActivity extends Activity implements IWXAPIEventHandler { | @@ -172,12 +173,13 @@ public class WXEntryActivity extends Activity implements IWXAPIEventHandler { | ||
| 172 | try { | 173 | try { |
| 173 | Gson gson = new Gson(); | 174 | Gson gson = new Gson(); |
| 174 | ShareIntegralTypeInfo integralTypeInfo = gson.fromJson(shareType, ShareIntegralTypeInfo.class); | 175 | ShareIntegralTypeInfo integralTypeInfo = gson.fromJson(shareType, ShareIntegralTypeInfo.class); |
| 175 | - | 176 | + CNLiveUserService service = (CNLiveUserService) ARouter.getInstance().navigation(CNLiveUserService.class); |
| 177 | + String userId = service.getUid(this); | ||
| 176 | if ("witnessVideo".equals(integralTypeInfo.getShareType())) { | 178 | if ("witnessVideo".equals(integralTypeInfo.getShareType())) { |
| 177 | SharedPreferences preferences = this.getSharedPreferences("sharevideo", MODE_PRIVATE); | 179 | SharedPreferences preferences = this.getSharedPreferences("sharevideo", MODE_PRIVATE); |
| 178 | - boolean status = preferences.getBoolean(UserService.getUid(this), false); | 180 | + boolean status = preferences.getBoolean(userId, false); |
| 179 | String newTime = DateTimeUtil.getCurrentTime(); | 181 | String newTime = DateTimeUtil.getCurrentTime(); |
| 180 | - String oldtime = preferences.getString(UserService.getUid(this) + "time", "2019-04-10"); | 182 | + String oldtime = preferences.getString(userId + "time", "2019-04-10"); |
| 181 | boolean sameDay = DateTimeUtil.isSameDay(newTime, oldtime); | 183 | boolean sameDay = DateTimeUtil.isSameDay(newTime, oldtime); |
| 182 | if (!status) { | 184 | if (!status) { |
| 183 | ARouterUtil.addIntegrationPic(this, "share_video", integralTypeInfo.getContentId(), "sharevideo"); | 185 | ARouterUtil.addIntegrationPic(this, "share_video", integralTypeInfo.getContentId(), "sharevideo"); |
| @@ -188,9 +190,9 @@ public class WXEntryActivity extends Activity implements IWXAPIEventHandler { | @@ -188,9 +190,9 @@ public class WXEntryActivity extends Activity implements IWXAPIEventHandler { | ||
| 188 | 190 | ||
| 189 | } else if (integralTypeInfo.getShareType() != null) { | 191 | } else if (integralTypeInfo.getShareType() != null) { |
| 190 | SharedPreferences preferences = this.getSharedPreferences("sharearticle", MODE_PRIVATE); | 192 | SharedPreferences preferences = this.getSharedPreferences("sharearticle", MODE_PRIVATE); |
| 191 | - boolean status = preferences.getBoolean(UserService.getUid(this), false); | 193 | + boolean status = preferences.getBoolean(userId, false); |
| 192 | String newTime = DateTimeUtil.getCurrentTime(); | 194 | String newTime = DateTimeUtil.getCurrentTime(); |
| 193 | - String oldtime = preferences.getString(UserService.getUid(this) + "time", "2019-04-10"); | 195 | + String oldtime = preferences.getString(userId + "time", "2019-04-10"); |
| 194 | boolean sameDay = DateTimeUtil.isSameDay(newTime, oldtime); | 196 | boolean sameDay = DateTimeUtil.isSameDay(newTime, oldtime); |
| 195 | if (!status) { | 197 | if (!status) { |
| 196 | ARouterUtil.addIntegrationPic(this, "share_article", integralTypeInfo.getContentId(), "sharearticle"); | 198 | ARouterUtil.addIntegrationPic(this, "share_article", integralTypeInfo.getContentId(), "sharearticle"); |
cloud/third_tool/src/main/AndroidManifest.xml
| @@ -14,7 +14,8 @@ | @@ -14,7 +14,8 @@ | ||
| 14 | <uses-permission android:name="android.permission.READ_PHONE_STATE" /> | 14 | <uses-permission android:name="android.permission.READ_PHONE_STATE" /> |
| 15 | 15 | ||
| 16 | <application android:largeHeap="true"> | 16 | <application android:largeHeap="true"> |
| 17 | - | 17 | + <uses-library android:name="org.apache.http.legacy" |
| 18 | + android:required="false" /> | ||
| 18 | <meta-data | 19 | <meta-data |
| 19 | android:name="WEIBO_APPKEY" | 20 | android:name="WEIBO_APPKEY" |
| 20 | android:value="3884700821" /> | 21 | android:value="3884700821" /> |
cloud/third_tool/src/main/java/com/cnlive/login/action/UserThirdAction.java deleted
100644 → 0
| 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 deleted
100644 → 0
| 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/user/src/main/java/com/cnlive/cloud/user/frame/data/OtherUserInfo.java renamed to cloud/third_tool/src/main/java/com/cnlive/login/model/OtherUserInfo.java
cloud/third_tool/src/main/java/com/cnlive/login/model/ThirdLoginInfo.java
cloud/third_tool/src/main/java/com/cnlive/login/utils/ThirdLoginUtil.java
| 1 | package com.cnlive.login.utils; | 1 | package com.cnlive.login.utils; |
| 2 | 2 | ||
| 3 | +import android.app.Activity; | ||
| 3 | import android.content.Context; | 4 | import android.content.Context; |
| 5 | +import android.content.Intent; | ||
| 4 | import android.text.TextUtils; | 6 | import android.text.TextUtils; |
| 7 | +import android.util.Log; | ||
| 5 | 8 | ||
| 6 | -import com.cnlive.cloud.user.frame.data.OtherUserInfo; | 9 | +import com.cnlive.core.libs.base.application.AppConfig; |
| 10 | +import com.cnlive.core.libs.base.util.AlertUtil; | ||
| 11 | +import com.cnlive.login.model.OtherUserInfo; | ||
| 7 | import com.cnlive.login.model.ThirdLoginInfo; | 12 | import com.cnlive.login.model.ThirdLoginInfo; |
| 8 | import com.cnlive.login.observer.ThirdLoginObservable; | 13 | import com.cnlive.login.observer.ThirdLoginObservable; |
| 14 | +import com.cnlive.share.BuildConfig; | ||
| 9 | import com.sina.weibo.sdk.auth.Oauth2AccessToken; | 15 | import com.sina.weibo.sdk.auth.Oauth2AccessToken; |
| 16 | +import com.sina.weibo.sdk.auth.WbAuthListener; | ||
| 17 | +import com.sina.weibo.sdk.auth.WbConnectErrorMessage; | ||
| 18 | +import com.sina.weibo.sdk.auth.sso.SsoHandler; | ||
| 10 | import com.sina.weibo.sdk.net.HttpManager; | 19 | import com.sina.weibo.sdk.net.HttpManager; |
| 11 | import com.sina.weibo.sdk.net.WeiboParameters; | 20 | import com.sina.weibo.sdk.net.WeiboParameters; |
| 12 | import com.tencent.connect.UserInfo; | 21 | import com.tencent.connect.UserInfo; |
| 22 | +import com.tencent.mm.opensdk.modelmsg.SendAuth; | ||
| 23 | +import com.tencent.mm.opensdk.openapi.IWXAPI; | ||
| 24 | +import com.tencent.mm.opensdk.openapi.WXAPIFactory; | ||
| 13 | import com.tencent.tauth.IUiListener; | 25 | import com.tencent.tauth.IUiListener; |
| 14 | import com.tencent.tauth.Tencent; | 26 | import com.tencent.tauth.Tencent; |
| 15 | import com.tencent.tauth.UiError; | 27 | import com.tencent.tauth.UiError; |
| @@ -37,6 +49,101 @@ import static com.tencent.open.SocialConstants.PARAM_OPEN_ID; | @@ -37,6 +49,101 @@ import static com.tencent.open.SocialConstants.PARAM_OPEN_ID; | ||
| 37 | * 简介: 三方登陆的工具类 | 49 | * 简介: 三方登陆的工具类 |
| 38 | */ | 50 | */ |
| 39 | public class ThirdLoginUtil { | 51 | public class ThirdLoginUtil { |
| 52 | + | ||
| 53 | + //qq登录 | ||
| 54 | + private static Tencent mTencent; | ||
| 55 | + public static final String ACOPE_ALL = "all"; | ||
| 56 | + private static Activity mContext; | ||
| 57 | + | ||
| 58 | + private static SsoHandler mSsoHandler; | ||
| 59 | + | ||
| 60 | + public static void init(Context context) { | ||
| 61 | + synchronized (Tencent.class) { | ||
| 62 | + if (mTencent == null) { | ||
| 63 | + mTencent = Tencent.createInstance(BuildConfig.QQ_SHARE, context); | ||
| 64 | + } | ||
| 65 | + } | ||
| 66 | + } | ||
| 67 | + | ||
| 68 | + | ||
| 69 | + /** | ||
| 70 | + * 是否安装qq | ||
| 71 | + * @param context | ||
| 72 | + * @return | ||
| 73 | + */ | ||
| 74 | + public static boolean isQQInstalled(Activity context){ | ||
| 75 | + boolean isInstall = false; | ||
| 76 | + mContext = context; | ||
| 77 | + isInstall = mTencent.isQQInstalled(context); | ||
| 78 | + if(isInstall) mTencent.login(context, ACOPE_ALL, listener); | ||
| 79 | + return isInstall; | ||
| 80 | + } | ||
| 81 | + | ||
| 82 | + /** | ||
| 83 | + * 回调处理 | ||
| 84 | + * @param requestCode | ||
| 85 | + * @param resultCode | ||
| 86 | + * @param data | ||
| 87 | + */ | ||
| 88 | + public static void getQQResult(int requestCode, int resultCode, Intent data){ | ||
| 89 | + Tencent.onActivityResultData(requestCode, resultCode, data, listener); | ||
| 90 | + } | ||
| 91 | + | ||
| 92 | + | ||
| 93 | + /** | ||
| 94 | + * 微博登录 | ||
| 95 | + * @param activity | ||
| 96 | + */ | ||
| 97 | + public static void loginWeibo(Activity activity){ | ||
| 98 | + if(mSsoHandler == null)mSsoHandler = new SsoHandler(activity); | ||
| 99 | + mSsoHandler.authorize(new WbAuthListener() { | ||
| 100 | + @Override | ||
| 101 | + public void onSuccess(Oauth2AccessToken oauth2AccessToken) { | ||
| 102 | + getWeiBoInfo(activity, oauth2AccessToken); | ||
| 103 | + } | ||
| 104 | + | ||
| 105 | + @Override | ||
| 106 | + public void cancel() { | ||
| 107 | + AlertUtil.showDeftToast(activity, "取消登录"); | ||
| 108 | + } | ||
| 109 | + | ||
| 110 | + @Override | ||
| 111 | + public void onFailure(WbConnectErrorMessage wbConnectErrorMessage) { | ||
| 112 | + AlertUtil.showDeftToast(activity, "登录失败"); | ||
| 113 | + } | ||
| 114 | + }); | ||
| 115 | + } | ||
| 116 | + | ||
| 117 | + /** | ||
| 118 | + * 微博回调处理 | ||
| 119 | + * @param requestCode | ||
| 120 | + * @param resultCode | ||
| 121 | + * @param data | ||
| 122 | + */ | ||
| 123 | + public static void getWeiboResult(int requestCode, int resultCode, Intent data){ | ||
| 124 | + if (mSsoHandler != null) { | ||
| 125 | + try { | ||
| 126 | + mSsoHandler.authorizeCallBack(requestCode, resultCode, data); | ||
| 127 | + } catch (Exception e) { | ||
| 128 | + Log.e("新浪异常:", "", e); | ||
| 129 | + } | ||
| 130 | + } | ||
| 131 | + } | ||
| 132 | + | ||
| 133 | + /** | ||
| 134 | + * 微信登录 | ||
| 135 | + * @param activity | ||
| 136 | + * @param wechatAppId | ||
| 137 | + */ | ||
| 138 | + public static void loginWechat(Activity activity,String wechatAppId){ | ||
| 139 | + SendAuth.Req req = new SendAuth.Req(); | ||
| 140 | + req.scope = "snsapi_userinfo"; | ||
| 141 | + req.state = BuildConfig.SEND_AUTH_REQ_STATE; | ||
| 142 | + | ||
| 143 | + IWXAPI iwxapi = WXAPIFactory.createWXAPI(activity, AppConfig.getWechatAppid(), true); | ||
| 144 | + iwxapi.registerApp(wechatAppId); | ||
| 145 | + iwxapi.sendReq(req); | ||
| 146 | + } | ||
| 40 | /** | 147 | /** |
| 41 | * 获取微博信息 | 148 | * 获取微博信息 |
| 42 | * | 149 | * |
| @@ -206,4 +313,20 @@ public class ThirdLoginUtil { | @@ -206,4 +313,20 @@ public class ThirdLoginUtil { | ||
| 206 | }); | 313 | }); |
| 207 | } | 314 | } |
| 208 | 315 | ||
| 316 | + static IUiListener listener = new IUiListener() { | ||
| 317 | + @Override | ||
| 318 | + public void onComplete(Object o) { | ||
| 319 | + getQQInfo(mContext, mTencent, o); | ||
| 320 | + } | ||
| 321 | + | ||
| 322 | + @Override | ||
| 323 | + public void onError(UiError uiError) { | ||
| 324 | + AlertUtil.showDeftToast(mContext, "登录失败"); | ||
| 325 | + } | ||
| 326 | + | ||
| 327 | + @Override | ||
| 328 | + public void onCancel() { | ||
| 329 | + AlertUtil.showDeftToast(mContext, "取消登录"); | ||
| 330 | + } | ||
| 331 | + }; | ||
| 209 | } | 332 | } |
cloud/third_tool/src/main/java/com/cnlive/share/arouter/ARouterUtil.java
| @@ -3,9 +3,9 @@ package com.cnlive.share.arouter; | @@ -3,9 +3,9 @@ package com.cnlive.share.arouter; | ||
| 3 | import android.content.Context; | 3 | import android.content.Context; |
| 4 | 4 | ||
| 5 | import com.alibaba.android.arouter.launcher.ARouter; | 5 | import com.alibaba.android.arouter.launcher.ARouter; |
| 6 | +import com.cnlive.core.libs.base.arouter.user.CNLiveUserService; | ||
| 6 | import com.cnlive.core.libs.base.util.SharedPreferencesHelper; | 7 | import com.cnlive.core.libs.base.util.SharedPreferencesHelper; |
| 7 | import com.cnlive.core.network.action.CoinRainAction; | 8 | import com.cnlive.core.network.action.CoinRainAction; |
| 8 | -import com.cnlive.cloud.user.auth.UserService; | ||
| 9 | 9 | ||
| 10 | public class ARouterUtil { | 10 | public class ARouterUtil { |
| 11 | /** | 11 | /** |
| @@ -14,7 +14,9 @@ public class ARouterUtil { | @@ -14,7 +14,9 @@ public class ARouterUtil { | ||
| 14 | public static void addIntegrationPic(Context context, String taskId, String contentId, String addtype) { | 14 | public static void addIntegrationPic(Context context, String taskId, String contentId, String addtype) { |
| 15 | Boolean app_is_show_integral = SharedPreferencesHelper.getInstance(context).getBoolValue("APP_IS_SHOW_INTEGRAL"); | 15 | Boolean app_is_show_integral = SharedPreferencesHelper.getInstance(context).getBoolValue("APP_IS_SHOW_INTEGRAL"); |
| 16 | if (app_is_show_integral) { | 16 | if (app_is_show_integral) { |
| 17 | - CoinRainAction.code(context, UserService.getUid(context), taskId, contentId, addtype,false); | 17 | + CNLiveUserService service = (CNLiveUserService) ARouter.getInstance().navigation(CNLiveUserService.class); |
| 18 | + String sid = service.getUid(context); | ||
| 19 | + CoinRainAction.code(context, sid, taskId, contentId, addtype,false); | ||
| 18 | } | 20 | } |
| 19 | } | 21 | } |
| 20 | 22 |
cloud/third_tool/src/main/java/com/cnlive/share/ui/ShareImgActivity.java
| @@ -15,6 +15,8 @@ import android.view.ViewGroup; | @@ -15,6 +15,8 @@ import android.view.ViewGroup; | ||
| 15 | import android.widget.LinearLayout; | 15 | import android.widget.LinearLayout; |
| 16 | 16 | ||
| 17 | import com.alibaba.android.arouter.facade.annotation.Route; | 17 | import com.alibaba.android.arouter.facade.annotation.Route; |
| 18 | +import com.alibaba.android.arouter.launcher.ARouter; | ||
| 19 | +import com.cnlive.core.libs.base.arouter.user.CNLiveUserService; | ||
| 18 | import com.cnlive.core.libs.base.util.AlertUtil; | 20 | import com.cnlive.core.libs.base.util.AlertUtil; |
| 19 | import com.cnlive.core.libs.base.util.DoublePressed; | 21 | import com.cnlive.core.libs.base.util.DoublePressed; |
| 20 | import com.cnlive.share.BuildConfig; | 22 | import com.cnlive.share.BuildConfig; |
| @@ -23,7 +25,6 @@ import com.cnlive.share.data.IconInfo; | @@ -23,7 +25,6 @@ import com.cnlive.share.data.IconInfo; | ||
| 23 | import com.cnlive.share.observable.ShareClickObservable; | 25 | import com.cnlive.share.observable.ShareClickObservable; |
| 24 | import com.cnlive.share.util.ShareUtils; | 26 | import com.cnlive.share.util.ShareUtils; |
| 25 | import com.cnlive.share.util.Util; | 27 | import com.cnlive.share.util.Util; |
| 26 | -import com.cnlive.cloud.user.auth.UserService; | ||
| 27 | import com.sina.weibo.sdk.share.WbShareCallback; | 28 | import com.sina.weibo.sdk.share.WbShareCallback; |
| 28 | import com.sina.weibo.sdk.share.WbShareHandler; | 29 | import com.sina.weibo.sdk.share.WbShareHandler; |
| 29 | import com.tencent.connect.common.Constants; | 30 | import com.tencent.connect.common.Constants; |
| @@ -90,8 +91,11 @@ public class ShareImgActivity extends AppCompatActivity implements ShareDialogLi | @@ -90,8 +91,11 @@ public class ShareImgActivity extends AppCompatActivity implements ShareDialogLi | ||
| 90 | } | 91 | } |
| 91 | 92 | ||
| 92 | private void initList() { | 93 | private void initList() { |
| 93 | - if (getIntent().getStringExtra("fileName") != null) | ||
| 94 | - fileName = UserService.getUid(this) + getIntent().getStringExtra("fileName"); | 94 | + if (getIntent().getStringExtra("fileName") != null){ |
| 95 | + CNLiveUserService service = (CNLiveUserService) ARouter.getInstance().navigation(CNLiveUserService.class); | ||
| 96 | + String sid = service.getUid(this); | ||
| 97 | + fileName = sid + getIntent().getStringExtra("fileName"); | ||
| 98 | + } | ||
| 95 | SharedPreferences sp = this.getSharedPreferences("sp", Context.MODE_PRIVATE); | 99 | SharedPreferences sp = this.getSharedPreferences("sp", Context.MODE_PRIVATE); |
| 96 | String bt = sp.getString("share_img_string", ""); | 100 | String bt = sp.getString("share_img_string", ""); |
| 97 | bitmap = convertStringToIcon(bt); | 101 | bitmap = convertStringToIcon(bt); |
cloud/third_tool/src/main/java/com/cnlive/share/util/ShareUtils.java
| @@ -16,6 +16,7 @@ import com.alibaba.android.arouter.launcher.ARouter; | @@ -16,6 +16,7 @@ import com.alibaba.android.arouter.launcher.ARouter; | ||
| 16 | import com.bumptech.glide.Glide; | 16 | import com.bumptech.glide.Glide; |
| 17 | import com.bumptech.glide.request.RequestOptions; | 17 | import com.bumptech.glide.request.RequestOptions; |
| 18 | import com.cnlive.core.libs.base.application.AppConfig; | 18 | import com.cnlive.core.libs.base.application.AppConfig; |
| 19 | +import com.cnlive.core.libs.base.arouter.user.CNLiveUserService; | ||
| 19 | import com.cnlive.core.libs.base.util.AlertUtil; | 20 | import com.cnlive.core.libs.base.util.AlertUtil; |
| 20 | import com.cnlive.core.libs.base.util.FileUtils; | 21 | import com.cnlive.core.libs.base.util.FileUtils; |
| 21 | import com.cnlive.core.libs.base.util.NetworkUtil; | 22 | import com.cnlive.core.libs.base.util.NetworkUtil; |
| @@ -33,7 +34,6 @@ import com.cnlive.share.data.ShareInfo; | @@ -33,7 +34,6 @@ import com.cnlive.share.data.ShareInfo; | ||
| 33 | import com.cnlive.share.data.ShareIntegralTypeInfo; | 34 | import com.cnlive.share.data.ShareIntegralTypeInfo; |
| 34 | import com.cnlive.share.model.ShareReleaseInfoUtil; | 35 | import com.cnlive.share.model.ShareReleaseInfoUtil; |
| 35 | import com.cnlive.share.model.ShortLinkInfo; | 36 | import com.cnlive.share.model.ShortLinkInfo; |
| 36 | -import com.cnlive.cloud.user.auth.UserService; | ||
| 37 | import com.google.gson.Gson; | 37 | import com.google.gson.Gson; |
| 38 | import com.sina.weibo.sdk.api.ImageObject; | 38 | import com.sina.weibo.sdk.api.ImageObject; |
| 39 | import com.sina.weibo.sdk.api.TextObject; | 39 | import com.sina.weibo.sdk.api.TextObject; |
| @@ -284,12 +284,14 @@ public class ShareUtils { | @@ -284,12 +284,14 @@ public class ShareUtils { | ||
| 284 | */ | 284 | */ |
| 285 | public static void processQQCallBack(Activity mContext, String shareType, String contentId) { | 285 | public static void processQQCallBack(Activity mContext, String shareType, String contentId) { |
| 286 | if (TextUtils.isEmpty(shareType)) return; | 286 | if (TextUtils.isEmpty(shareType)) return; |
| 287 | + CNLiveUserService service = (CNLiveUserService) ARouter.getInstance().navigation(CNLiveUserService.class); | ||
| 288 | + String sid = service.getUid(mContext); | ||
| 287 | switch (shareType) { | 289 | switch (shareType) { |
| 288 | case "witnessVideo": | 290 | case "witnessVideo": |
| 289 | SharedPreferences preferences = mContext.getSharedPreferences("sharevideo", MODE_PRIVATE); | 291 | SharedPreferences preferences = mContext.getSharedPreferences("sharevideo", MODE_PRIVATE); |
| 290 | - boolean status = preferences.getBoolean(UserService.getUid(mContext), false); | 292 | + boolean status = preferences.getBoolean(sid, false); |
| 291 | String newTime = DateTimeUtil.getCurrentTime(); | 293 | String newTime = DateTimeUtil.getCurrentTime(); |
| 292 | - String oldtime = preferences.getString(UserService.getUid(mContext) + "time", "2019-04-10"); | 294 | + String oldtime = preferences.getString(sid + "time", "2019-04-10"); |
| 293 | boolean sameDay = DateTimeUtil.isSameDay(newTime, oldtime); | 295 | boolean sameDay = DateTimeUtil.isSameDay(newTime, oldtime); |
| 294 | if (!status) { | 296 | if (!status) { |
| 295 | ARouterUtil.addIntegrationPic(mContext, "share_video", contentId, "sharevideo"); | 297 | ARouterUtil.addIntegrationPic(mContext, "share_video", contentId, "sharevideo"); |
| @@ -300,9 +302,9 @@ public class ShareUtils { | @@ -300,9 +302,9 @@ public class ShareUtils { | ||
| 300 | break; | 302 | break; |
| 301 | default: | 303 | default: |
| 302 | SharedPreferences preferences1 = mContext.getSharedPreferences("sharearticle", MODE_PRIVATE); | 304 | SharedPreferences preferences1 = mContext.getSharedPreferences("sharearticle", MODE_PRIVATE); |
| 303 | - boolean status1 = preferences1.getBoolean(UserService.getUid(mContext), false); | 305 | + boolean status1 = preferences1.getBoolean(sid, false); |
| 304 | String newTime1 = DateTimeUtil.getCurrentTime(); | 306 | String newTime1 = DateTimeUtil.getCurrentTime(); |
| 305 | - String oldtime1 = preferences1.getString(UserService.getUid(mContext) + "time", "2019-04-10"); | 307 | + String oldtime1 = preferences1.getString(sid + "time", "2019-04-10"); |
| 306 | boolean sameDay1 = DateTimeUtil.isSameDay(newTime1, oldtime1); | 308 | boolean sameDay1 = DateTimeUtil.isSameDay(newTime1, oldtime1); |
| 307 | if (!status1) { | 309 | if (!status1) { |
| 308 | ARouterUtil.addIntegrationPic(mContext, "share_article", contentId, "sharearticle"); | 310 | ARouterUtil.addIntegrationPic(mContext, "share_article", contentId, "sharearticle"); |
cloud/third_tool/src/main/java/com/cnlive/share/util/Util.java
| @@ -20,10 +20,11 @@ import android.graphics.Rect; | @@ -20,10 +20,11 @@ import android.graphics.Rect; | ||
| 20 | import android.net.Uri; | 20 | import android.net.Uri; |
| 21 | import android.text.TextUtils; | 21 | import android.text.TextUtils; |
| 22 | 22 | ||
| 23 | +import com.alibaba.android.arouter.launcher.ARouter; | ||
| 23 | import com.cnlive.core.libs.base.application.AppConfig; | 24 | import com.cnlive.core.libs.base.application.AppConfig; |
| 25 | +import com.cnlive.core.libs.base.arouter.user.CNLiveUserService; | ||
| 24 | import com.cnlive.core.network.util.UriUtil; | 26 | import com.cnlive.core.network.util.UriUtil; |
| 25 | import com.cnlive.share.BuildConfig; | 27 | import com.cnlive.share.BuildConfig; |
| 26 | -import com.cnlive.cloud.user.auth.UserService; | ||
| 27 | import com.sina.weibo.sdk.WbSdk; | 28 | import com.sina.weibo.sdk.WbSdk; |
| 28 | import com.sina.weibo.sdk.auth.AuthInfo; | 29 | import com.sina.weibo.sdk.auth.AuthInfo; |
| 29 | import com.tencent.mm.opensdk.openapi.IWXAPI; | 30 | import com.tencent.mm.opensdk.openapi.IWXAPI; |
| @@ -156,6 +157,8 @@ public class Util { | @@ -156,6 +157,8 @@ public class Util { | ||
| 156 | */ | 157 | */ |
| 157 | public static String processUrlData(String shareInfoUrl, Context mContext, boolean isToWjj) { | 158 | public static String processUrlData(String shareInfoUrl, Context mContext, boolean isToWjj) { |
| 158 | if (shareInfoUrl.contains("http://wjjh5.cnlive.com") || shareInfoUrl.contains("http://wjjh5test.cnlive.com")) { | 159 | if (shareInfoUrl.contains("http://wjjh5.cnlive.com") || shareInfoUrl.contains("http://wjjh5test.cnlive.com")) { |
| 160 | + CNLiveUserService service = (CNLiveUserService) ARouter.getInstance().navigation(CNLiveUserService.class); | ||
| 161 | + String userId = service.getUid(mContext); | ||
| 159 | Uri oldUri = Uri.parse(shareInfoUrl); | 162 | Uri oldUri = Uri.parse(shareInfoUrl); |
| 160 | //判断分享地址中是否有参数,如果没有则先拼接问号 | 163 | //判断分享地址中是否有参数,如果没有则先拼接问号 |
| 161 | if (oldUri.getQueryParameterNames().size() <= 0) { | 164 | if (oldUri.getQueryParameterNames().size() <= 0) { |
| @@ -164,13 +167,13 @@ public class Util { | @@ -164,13 +167,13 @@ public class Util { | ||
| 164 | } | 167 | } |
| 165 | if (!shareInfoUrl.contains("?sid=") && !shareInfoUrl.contains("&sid=")) { | 168 | if (!shareInfoUrl.contains("?sid=") && !shareInfoUrl.contains("&sid=")) { |
| 166 | StringBuilder pageUrl = new StringBuilder(shareInfoUrl); | 169 | StringBuilder pageUrl = new StringBuilder(shareInfoUrl); |
| 167 | - pageUrl.append(oldUri.getQueryParameterNames().size() <= 0 ? "sid=" : "&sid=").append(UserService.getUid(mContext)); | 170 | + pageUrl.append(oldUri.getQueryParameterNames().size() <= 0 ? "sid=" : "&sid=").append(userId); |
| 168 | shareInfoUrl = pageUrl.toString(); | 171 | shareInfoUrl = pageUrl.toString(); |
| 169 | } | 172 | } |
| 170 | 173 | ||
| 171 | if (!shareInfoUrl.contains("?shareSid=") && !shareInfoUrl.contains("&shareSid=")) { | 174 | if (!shareInfoUrl.contains("?shareSid=") && !shareInfoUrl.contains("&shareSid=")) { |
| 172 | StringBuilder pageUrl = new StringBuilder(shareInfoUrl); | 175 | StringBuilder pageUrl = new StringBuilder(shareInfoUrl); |
| 173 | - pageUrl.append("&shareSid=").append(UserService.getUid(mContext)); | 176 | + pageUrl.append("&shareSid=").append(userId); |
| 174 | shareInfoUrl = pageUrl.toString(); | 177 | shareInfoUrl = pageUrl.toString(); |
| 175 | } | 178 | } |
| 176 | if (!shareInfoUrl.contains("?isApp=") && !shareInfoUrl.contains("&isApp=")) { | 179 | if (!shareInfoUrl.contains("?isApp=") && !shareInfoUrl.contains("&isApp=")) { |
| @@ -208,15 +211,16 @@ public class Util { | @@ -208,15 +211,16 @@ public class Util { | ||
| 208 | String url = urls[0]; | 211 | String url = urls[0]; |
| 209 | StringBuilder pageUrl = new StringBuilder(url); | 212 | StringBuilder pageUrl = new StringBuilder(url); |
| 210 | pageUrl.append("?"); | 213 | pageUrl.append("?"); |
| 214 | + | ||
| 211 | for (String key : uri.getQueryParameterNames()) { | 215 | for (String key : uri.getQueryParameterNames()) { |
| 212 | if ("sid".equals(key)) { | 216 | if ("sid".equals(key)) { |
| 213 | - pageUrl.append(key).append("=").append(Uri.encode(TextUtils.isEmpty(UserService.getUid(mContext)) ? "" : UserService.getUid(mContext))).append("&"); | 217 | + pageUrl.append(key).append("=").append(Uri.encode(TextUtils.isEmpty(userId) ? "" : userId)).append("&"); |
| 214 | } else if ("ver".equals(key)) { | 218 | } else if ("ver".equals(key)) { |
| 215 | pageUrl.append(key).append("=").append(Uri.encode(TextUtils.isEmpty(AppConfig.getAppVersion()) ? "" : AppConfig.getAppVersion())).append("&"); | 219 | pageUrl.append(key).append("=").append(Uri.encode(TextUtils.isEmpty(AppConfig.getAppVersion()) ? "" : AppConfig.getAppVersion())).append("&"); |
| 216 | } else if ("plat".equals(key)) { | 220 | } else if ("plat".equals(key)) { |
| 217 | pageUrl.append(key).append("=").append(Uri.encode("a")).append("&"); | 221 | pageUrl.append(key).append("=").append(Uri.encode("a")).append("&"); |
| 218 | } else if ("shareSid".equals(key)) { | 222 | } else if ("shareSid".equals(key)) { |
| 219 | - pageUrl.append(key).append("=").append(Uri.encode(TextUtils.isEmpty(UserService.getUid(mContext)) ? "" : UserService.getUid(mContext))).append("&"); | 223 | + pageUrl.append(key).append("=").append(Uri.encode(TextUtils.isEmpty(userId) ? "" : userId)).append("&"); |
| 220 | } else if ("isApp".equals(key)) { | 224 | } else if ("isApp".equals(key)) { |
| 221 | pageUrl.append(key).append("=").append(isToWjj).append("&"); | 225 | pageUrl.append(key).append("=").append(isToWjj).append("&"); |
| 222 | } else if ("wjjFrom".equals(key)) { | 226 | } else if ("wjjFrom".equals(key)) { |
cloud/user/build.gradle
| @@ -49,6 +49,6 @@ dependencies { | @@ -49,6 +49,6 @@ dependencies { | ||
| 49 | implementation "com.cnlive.libs:emoj:$rootProject.libEmoj" | 49 | implementation "com.cnlive.libs:emoj:$rootProject.libEmoj" |
| 50 | //图片选择器 | 50 | //图片选择器 |
| 51 | implementation "com.cnlive.libs:mediapicker:$rootProject.libMediaPicker" | 51 | implementation "com.cnlive.libs:mediapicker:$rootProject.libMediaPicker" |
| 52 | -// implementation project(path: ':cloud:third_tool') | 52 | + implementation project(path: ':cloud:third_tool') |
| 53 | 53 | ||
| 54 | } | 54 | } |
cloud/user/src/main/java/com/cnlive/cloud/user/UserUtilAction.java
| @@ -325,6 +325,70 @@ public class UserUtilAction { | @@ -325,6 +325,70 @@ public class UserUtilAction { | ||
| 325 | // return null; | 325 | // return null; |
| 326 | // } | 326 | // } |
| 327 | 327 | ||
| 328 | + | ||
| 329 | + /** | ||
| 330 | + * 其他平台账户登录 | ||
| 331 | + * | ||
| 332 | + * @param context | ||
| 333 | + * @param thirdPartyPlat 平台类型 1:sina 2:qq 3:weixin 4:renren | ||
| 334 | + * @param thirdPartyId 第三方用户ID | ||
| 335 | + * [qq: 建议使用openid, wx: 建议使用unionid, sina: 建议使用idstr]; | ||
| 336 | + * 注意:同一用户在登录Sp下不同app时,thirdPartyId必须相同 | ||
| 337 | + */ | ||
| 338 | + public static Observable<BaseResult<UserData>> otherLogin(Context context, String thirdPartyPlat, String thirdPartyId) { | ||
| 339 | + | ||
| 340 | + Map<String, String> requestMap = new HashMap<>(); | ||
| 341 | + requestMap.put("appId", AppConfig.getAppId()); | ||
| 342 | + requestMap.put("thirdPartyPlat", thirdPartyPlat); | ||
| 343 | + requestMap.put("thirdPartyId", thirdPartyId); | ||
| 344 | + requestMap.put("frmId", AppConfig.getAppChannel()); | ||
| 345 | + requestMap.put("clientPlat", "a"); | ||
| 346 | + return BaseRequest.init().service(ApiBaseServiceOpen.class).loginIn3rdForWJJ(requestMap); | ||
| 347 | + } | ||
| 348 | + | ||
| 349 | + /** | ||
| 350 | + * 其他平台账户版定手机号并登录 | ||
| 351 | + * | ||
| 352 | + * @param context | ||
| 353 | + * @param thirdPartyPlat 平台类型 1:sina 2:qq 3:weixin 4:renren | ||
| 354 | + * @param thirdPartyId 第三方用户ID | ||
| 355 | + * [qq: 建议使用openid, wx: 建议使用unionid, sina: 建议使用idstr]; | ||
| 356 | + * 注意:同一用户在登录Sp下不同app时,thirdPartyId必须相同 | ||
| 357 | + */ | ||
| 358 | + | ||
| 359 | + | ||
| 360 | + public static Observable<BaseResult<UserData>> otherLoginBindMobile(Context context, | ||
| 361 | + String phone, | ||
| 362 | + String countryCode, | ||
| 363 | + String ems, | ||
| 364 | + String thirdPartyPlat, | ||
| 365 | + String thirdPartyId, | ||
| 366 | + String nickName, | ||
| 367 | + String gender, | ||
| 368 | + String location, | ||
| 369 | + String faceUrl) { | ||
| 370 | + Map<String, String> requestMap = new HashMap<>(); | ||
| 371 | + | ||
| 372 | + requestMap.put("frmId", AppConfig.getAppChannel()); | ||
| 373 | + requestMap.put("clientPlat", "a"); | ||
| 374 | + requestMap.put("uuid", AppConfig.getAppUUID()); | ||
| 375 | + | ||
| 376 | + requestMap.put("appId", AppConfig.getAppId()); | ||
| 377 | + requestMap.put("mobile", phone); | ||
| 378 | + requestMap.put("countryCode", countryCode); | ||
| 379 | + requestMap.put("verificationCode", ems); | ||
| 380 | + | ||
| 381 | + requestMap.put("thirdPartyPlat", thirdPartyPlat); | ||
| 382 | + requestMap.put("thirdPartyId", thirdPartyId); | ||
| 383 | + requestMap.put("nickName", nickName); | ||
| 384 | + requestMap.put("gender", gender); | ||
| 385 | + requestMap.put("location", location); | ||
| 386 | + requestMap.put("faceUrl", faceUrl); | ||
| 387 | + | ||
| 388 | + return BaseRequest.init().service(ApiBaseServiceOpen.class).loginIn3rdAndMobileForWJJ(requestMap); | ||
| 389 | + } | ||
| 390 | + | ||
| 391 | + | ||
| 328 | private static String getPath() { | 392 | private static String getPath() { |
| 329 | String path = Environment.getExternalStorageDirectory() + "/strike/image/"; | 393 | String path = Environment.getExternalStorageDirectory() + "/strike/image/"; |
| 330 | File file = new File(path); | 394 | File file = new File(path); |
cloud/user/src/main/java/com/cnlive/cloud/user/frame/presenter/LoginDialogPresenter.java
| @@ -13,7 +13,6 @@ import com.cnlive.core.network.model.BaseResult; | @@ -13,7 +13,6 @@ import com.cnlive.core.network.model.BaseResult; | ||
| 13 | import com.cnlive.cloud.user.R; | 13 | import com.cnlive.cloud.user.R; |
| 14 | import com.cnlive.cloud.user.UserUtilAction; | 14 | import com.cnlive.cloud.user.UserUtilAction; |
| 15 | import com.cnlive.cloud.user.auth.UserService; | 15 | import com.cnlive.cloud.user.auth.UserService; |
| 16 | -import com.cnlive.cloud.user.frame.data.OtherUserInfo; | ||
| 17 | import com.cnlive.cloud.user.frame.data.QuickLoginData; | 16 | import com.cnlive.cloud.user.frame.data.QuickLoginData; |
| 18 | import com.cnlive.cloud.user.frame.view.LoginDialogView; | 17 | import com.cnlive.cloud.user.frame.view.LoginDialogView; |
| 19 | import com.cnlive.cloud.user.model.CNLiveUserInfo; | 18 | import com.cnlive.cloud.user.model.CNLiveUserInfo; |
| @@ -21,6 +20,7 @@ import com.cnlive.cloud.user.router.user.UserAction; | @@ -21,6 +20,7 @@ import com.cnlive.cloud.user.router.user.UserAction; | ||
| 21 | import com.cnlive.cloud.user.ui.activity.LoginDialogActivity; | 20 | import com.cnlive.cloud.user.ui.activity.LoginDialogActivity; |
| 22 | import com.cnlive.cloud.user.util.RegexUtils; | 21 | import com.cnlive.cloud.user.util.RegexUtils; |
| 23 | import com.cnlive.cloud.user.util.TimeEvent; | 22 | import com.cnlive.cloud.user.util.TimeEvent; |
| 23 | +import com.cnlive.login.model.OtherUserInfo; | ||
| 24 | 24 | ||
| 25 | import java.util.Arrays; | 25 | import java.util.Arrays; |
| 26 | import java.util.Collections; | 26 | import java.util.Collections; |
| @@ -40,6 +40,7 @@ public class LoginDialogPresenter extends BasePresenter<LoginDialogView> { | @@ -40,6 +40,7 @@ public class LoginDialogPresenter extends BasePresenter<LoginDialogView> { | ||
| 40 | private static final String TAG = "QuickLoginPresenter"; | 40 | private static final String TAG = "QuickLoginPresenter"; |
| 41 | 41 | ||
| 42 | private Disposable event; | 42 | private Disposable event; |
| 43 | + private Disposable otherEvent; | ||
| 43 | private Disposable sendMsgBefQuickLogin; | 44 | private Disposable sendMsgBefQuickLogin; |
| 44 | private TimerWaitUtil timerUtil; //计时工具类 | 45 | private TimerWaitUtil timerUtil; //计时工具类 |
| 45 | 46 | ||
| @@ -65,8 +66,10 @@ public class LoginDialogPresenter extends BasePresenter<LoginDialogView> { | @@ -65,8 +66,10 @@ public class LoginDialogPresenter extends BasePresenter<LoginDialogView> { | ||
| 65 | Account account = accounts.length > 0 ? accounts[0] : null; | 66 | Account account = accounts.length > 0 ? accounts[0] : null; |
| 66 | String name = account == null ? "" : account.name; | 67 | String name = account == null ? "" : account.name; |
| 67 | //页面填充数据 | 68 | //页面填充数据 |
| 68 | - ifViewAttached(view -> view.uploadInputData(name)); | ||
| 69 | - ifViewAttached(view -> view.uploadListData(accounts)); | 69 | + if(getView() != null){ |
| 70 | + getView().uploadInputData(name); | ||
| 71 | + getView().uploadListData(accounts); | ||
| 72 | + } | ||
| 70 | } | 73 | } |
| 71 | 74 | ||
| 72 | private void startTimer() { | 75 | private void startTimer() { |
| @@ -217,26 +220,27 @@ public class LoginDialogPresenter extends BasePresenter<LoginDialogView> { | @@ -217,26 +220,27 @@ public class LoginDialogPresenter extends BasePresenter<LoginDialogView> { | ||
| 217 | break; | 220 | break; |
| 218 | } | 221 | } |
| 219 | } | 222 | } |
| 220 | -// /** | ||
| 221 | -// * 三方登陆 | ||
| 222 | -// * | ||
| 223 | -// * @param context | ||
| 224 | -// * @param otherUserInfo | ||
| 225 | -// */ | ||
| 226 | -// public void otherLogin(LoginDialogActivity context, OtherUserInfo otherUserInfo) { | ||
| 227 | -// if (otherUserInfo == null) { | ||
| 228 | -// getView().showToast(context.getString(R.string.user_toast_other_info_error)); | ||
| 229 | -// } else { | ||
| 230 | -// cancelLoad(); | ||
| 231 | -// context.isLogin = true; | ||
| 232 | -// | ||
| 233 | -// UserAction.otherLogin(context, context.otherUserInfo.getLoginType(), context.otherUserInfo.getThirdPartyId(), initLoginEvent(context, false, otherUserInfo)); | ||
| 234 | -// } | ||
| 235 | -// } | ||
| 236 | -// | ||
| 237 | -// private Event<CNLiveUserInfo> initLoginEvent(LoginDialogActivity context, Boolean retry) { | ||
| 238 | -// return initLoginEvent(context, retry, null); | ||
| 239 | -// } | 223 | + /** |
| 224 | + * 三方登陆 | ||
| 225 | + * | ||
| 226 | + * @param context | ||
| 227 | + * @param otherUserInfo | ||
| 228 | + */ | ||
| 229 | + public void otherLogin(LoginDialogActivity context, OtherUserInfo otherUserInfo) { | ||
| 230 | + if (otherUserInfo == null) { | ||
| 231 | + getView().showToast(context.getString(R.string.user_toast_other_info_error)); | ||
| 232 | + } else { | ||
| 233 | + cancelLoad(); | ||
| 234 | + context.isLogin = true; | ||
| 235 | + | ||
| 236 | + otherEvent = UserAction.otherLogin(context, otherUserInfo.getLoginType(), otherUserInfo.getThirdPartyId(), new UserAction.CallBack() { | ||
| 237 | + @Override | ||
| 238 | + public void callback(int state, String msg, Object object) { | ||
| 239 | + initLoginEvent(context, state,msg,false, otherUserInfo); | ||
| 240 | + } | ||
| 241 | + }); | ||
| 242 | + } | ||
| 243 | + } | ||
| 240 | 244 | ||
| 241 | 245 | ||
| 242 | public void cancelLoad() { | 246 | public void cancelLoad() { |
| @@ -246,6 +250,13 @@ public class LoginDialogPresenter extends BasePresenter<LoginDialogView> { | @@ -246,6 +250,13 @@ public class LoginDialogPresenter extends BasePresenter<LoginDialogView> { | ||
| 246 | } | 250 | } |
| 247 | event = null; | 251 | event = null; |
| 248 | } | 252 | } |
| 253 | + | ||
| 254 | + if (otherEvent != null) { | ||
| 255 | + if (!otherEvent.isDisposed()) { | ||
| 256 | + otherEvent.dispose(); | ||
| 257 | + } | ||
| 258 | + otherEvent = null; | ||
| 259 | + } | ||
| 249 | } | 260 | } |
| 250 | 261 | ||
| 251 | /** | 262 | /** |
cloud/user/src/main/java/com/cnlive/cloud/user/frame/presenter/QuickLoginPresenter.java
| 1 | package com.cnlive.cloud.user.frame.presenter; | 1 | package com.cnlive.cloud.user.frame.presenter; |
| 2 | 2 | ||
| 3 | import android.accounts.Account; | 3 | import android.accounts.Account; |
| 4 | +import android.app.Activity; | ||
| 4 | import android.content.Context; | 5 | import android.content.Context; |
| 5 | import android.text.TextUtils; | 6 | import android.text.TextUtils; |
| 6 | 7 | ||
| 7 | import com.cnlive.cloud.user.R; | 8 | import com.cnlive.cloud.user.R; |
| 8 | import com.cnlive.cloud.user.UserUtilAction; | 9 | import com.cnlive.cloud.user.UserUtilAction; |
| 9 | import com.cnlive.cloud.user.auth.UserService; | 10 | import com.cnlive.cloud.user.auth.UserService; |
| 10 | -import com.cnlive.cloud.user.frame.data.OtherUserInfo; | ||
| 11 | import com.cnlive.cloud.user.frame.data.QuickLoginData; | 11 | import com.cnlive.cloud.user.frame.data.QuickLoginData; |
| 12 | import com.cnlive.cloud.user.frame.view.QuickLoginView; | 12 | import com.cnlive.cloud.user.frame.view.QuickLoginView; |
| 13 | import com.cnlive.cloud.user.model.CNLiveUserInfo; | 13 | import com.cnlive.cloud.user.model.CNLiveUserInfo; |
| 14 | import com.cnlive.cloud.user.router.user.UserAction; | 14 | import com.cnlive.cloud.user.router.user.UserAction; |
| 15 | +import com.cnlive.cloud.user.ui.activity.LoginDialogActivity; | ||
| 15 | import com.cnlive.cloud.user.ui.fragment.QuickLoginFragment; | 16 | import com.cnlive.cloud.user.ui.fragment.QuickLoginFragment; |
| 16 | import com.cnlive.cloud.user.util.RegexUtils; | 17 | import com.cnlive.cloud.user.util.RegexUtils; |
| 17 | import com.cnlive.cloud.user.util.TimeEvent; | 18 | import com.cnlive.cloud.user.util.TimeEvent; |
| @@ -21,6 +22,7 @@ import com.cnlive.core.network.model.BaseResult; | @@ -21,6 +22,7 @@ import com.cnlive.core.network.model.BaseResult; | ||
| 21 | import com.cnlive.core.network.HttpConn; | 22 | import com.cnlive.core.network.HttpConn; |
| 22 | import com.cnlive.core.network.NetCallBack; | 23 | import com.cnlive.core.network.NetCallBack; |
| 23 | import com.cnlive.core.libs.base.util.TimerWaitUtil; | 24 | import com.cnlive.core.libs.base.util.TimerWaitUtil; |
| 25 | +import com.cnlive.login.model.OtherUserInfo; | ||
| 24 | 26 | ||
| 25 | import java.util.Arrays; | 27 | import java.util.Arrays; |
| 26 | import java.util.Collections; | 28 | import java.util.Collections; |
| @@ -38,7 +40,7 @@ public class QuickLoginPresenter extends BasePresenter<QuickLoginView> { | @@ -38,7 +40,7 @@ public class QuickLoginPresenter extends BasePresenter<QuickLoginView> { | ||
| 38 | 40 | ||
| 39 | private Disposable event; | 41 | private Disposable event; |
| 40 | private Disposable sendMsgBefQuickLogin; | 42 | private Disposable sendMsgBefQuickLogin; |
| 41 | -// private Event otherEvent; | 43 | + private Disposable otherEvent; |
| 42 | 44 | ||
| 43 | public void deleteUserInfo(Context context, String userName) { | 45 | public void deleteUserInfo(Context context, String userName) { |
| 44 | UserService.getInstance(context).removeUser(userName, future -> { | 46 | UserService.getInstance(context).removeUser(userName, future -> { |
| @@ -62,8 +64,8 @@ public class QuickLoginPresenter extends BasePresenter<QuickLoginView> { | @@ -62,8 +64,8 @@ public class QuickLoginPresenter extends BasePresenter<QuickLoginView> { | ||
| 62 | Account account = accounts.length > 0 ? accounts[0] : null; | 64 | Account account = accounts.length > 0 ? accounts[0] : null; |
| 63 | String name = account == null ? "" : account.name; | 65 | String name = account == null ? "" : account.name; |
| 64 | //页面填充数据 | 66 | //页面填充数据 |
| 65 | - ifViewAttached(view -> view.uploadInputData(name)); | ||
| 66 | - ifViewAttached(view -> view.uploadListData(accounts)); | 67 | + getView().uploadInputData(name); |
| 68 | + getView().uploadListData(accounts); | ||
| 67 | } | 69 | } |
| 68 | 70 | ||
| 69 | private void startTimer() { | 71 | private void startTimer() { |
| @@ -137,6 +139,29 @@ public class QuickLoginPresenter extends BasePresenter<QuickLoginView> { | @@ -137,6 +139,29 @@ public class QuickLoginPresenter extends BasePresenter<QuickLoginView> { | ||
| 137 | } | 139 | } |
| 138 | } | 140 | } |
| 139 | 141 | ||
| 142 | + | ||
| 143 | + /** | ||
| 144 | + * 三方登陆 | ||
| 145 | + * | ||
| 146 | + * @param context | ||
| 147 | + * @param otherUserInfo | ||
| 148 | + */ | ||
| 149 | + public void otherLogin(QuickLoginFragment context, OtherUserInfo otherUserInfo) { | ||
| 150 | + if (otherUserInfo == null) { | ||
| 151 | + getView().showToast(context.getString(R.string.user_toast_other_info_error)); | ||
| 152 | + } else { | ||
| 153 | + cancelLoad(); | ||
| 154 | + context.isLogin = true; | ||
| 155 | + | ||
| 156 | + otherEvent = UserAction.otherLogin(context.getActivity(), otherUserInfo.getLoginType(), otherUserInfo.getThirdPartyId(), new UserAction.CallBack() { | ||
| 157 | + @Override | ||
| 158 | + public void callback(int state, String msg, Object object) { | ||
| 159 | + initLoginEvent(context, state,msg,false, otherUserInfo); | ||
| 160 | + } | ||
| 161 | + }); | ||
| 162 | + } | ||
| 163 | + } | ||
| 164 | + | ||
| 140 | private void initLoginEvent(QuickLoginFragment context, int state, String msg, Boolean retry, OtherUserInfo otherUserInfo) { | 165 | private void initLoginEvent(QuickLoginFragment context, int state, String msg, Boolean retry, OtherUserInfo otherUserInfo) { |
| 141 | switch (state) { | 166 | switch (state) { |
| 142 | //请求成功 | 167 | //请求成功 |
| @@ -173,10 +198,12 @@ public class QuickLoginPresenter extends BasePresenter<QuickLoginView> { | @@ -173,10 +198,12 @@ public class QuickLoginPresenter extends BasePresenter<QuickLoginView> { | ||
| 173 | } | 198 | } |
| 174 | break; | 199 | break; |
| 175 | case HttpConn.ON_START: | 200 | case HttpConn.ON_START: |
| 176 | - ifViewAttached(view -> view.showProgress()); | 201 | + if(getView() != null) getView().showProgress(); |
| 202 | +// ifViewAttached(view -> view.showProgress()); | ||
| 177 | break; | 203 | break; |
| 178 | case HttpConn.ON_END: | 204 | case HttpConn.ON_END: |
| 179 | - ifViewAttached(view -> view.hideProgress()); | 205 | + if(getView() != null) getView().hideProgress(); |
| 206 | +// ifViewAttached(view -> view.hideProgress()); | ||
| 180 | break; | 207 | break; |
| 181 | case 41010: //手机号无效 | 208 | case 41010: //手机号无效 |
| 182 | ifViewAttached(view -> view.showToast(msg)); | 209 | ifViewAttached(view -> view.showToast(msg)); |
| @@ -301,5 +328,12 @@ public class QuickLoginPresenter extends BasePresenter<QuickLoginView> { | @@ -301,5 +328,12 @@ public class QuickLoginPresenter extends BasePresenter<QuickLoginView> { | ||
| 301 | } | 328 | } |
| 302 | event = null; | 329 | event = null; |
| 303 | } | 330 | } |
| 331 | + | ||
| 332 | + if (otherEvent != null) { | ||
| 333 | + if (!otherEvent.isDisposed()) { | ||
| 334 | + otherEvent.dispose(); | ||
| 335 | + } | ||
| 336 | + otherEvent = null; | ||
| 337 | + } | ||
| 304 | } | 338 | } |
| 305 | } | 339 | } |
cloud/user/src/main/java/com/cnlive/cloud/user/frame/view/LoginDialogView.java
| @@ -19,13 +19,13 @@ import com.cnlive.core.libs.base.frame.view.BaseView; | @@ -19,13 +19,13 @@ import com.cnlive.core.libs.base.frame.view.BaseView; | ||
| 19 | import com.cnlive.core.libs.base.util.AlertUtil; | 19 | import com.cnlive.core.libs.base.util.AlertUtil; |
| 20 | import com.cnlive.core.libs.base.util.DoublePressed; | 20 | import com.cnlive.core.libs.base.util.DoublePressed; |
| 21 | import com.cnlive.cloud.user.R; | 21 | import com.cnlive.cloud.user.R; |
| 22 | -import com.cnlive.cloud.user.frame.data.OtherUserInfo; | ||
| 23 | import com.cnlive.cloud.user.sms.OnSmsCatchListener; | 22 | import com.cnlive.cloud.user.sms.OnSmsCatchListener; |
| 24 | import com.cnlive.cloud.user.sms.SmsVerifyCatcher; | 23 | import com.cnlive.cloud.user.sms.SmsVerifyCatcher; |
| 25 | import com.cnlive.cloud.user.ui.activity.FirstLoginActivity; | 24 | import com.cnlive.cloud.user.ui.activity.FirstLoginActivity; |
| 26 | import com.cnlive.cloud.user.ui.activity.LoginActivity; | 25 | import com.cnlive.cloud.user.ui.activity.LoginActivity; |
| 27 | import com.cnlive.cloud.user.ui.activity.LoginDialogActivity; | 26 | import com.cnlive.cloud.user.ui.activity.LoginDialogActivity; |
| 28 | import com.cnlive.cloud.user.util.UserRouterHelper; | 27 | import com.cnlive.cloud.user.util.UserRouterHelper; |
| 28 | +import com.cnlive.login.model.OtherUserInfo; | ||
| 29 | 29 | ||
| 30 | import java.util.regex.Matcher; | 30 | import java.util.regex.Matcher; |
| 31 | import java.util.regex.Pattern; | 31 | import java.util.regex.Pattern; |
cloud/user/src/main/java/com/cnlive/cloud/user/frame/view/QuickLoginView.java
| @@ -17,7 +17,6 @@ import android.view.View; | @@ -17,7 +17,6 @@ import android.view.View; | ||
| 17 | 17 | ||
| 18 | import com.alibaba.android.arouter.launcher.ARouter; | 18 | import com.alibaba.android.arouter.launcher.ARouter; |
| 19 | import com.cnlive.cloud.user.R; | 19 | import com.cnlive.cloud.user.R; |
| 20 | -import com.cnlive.cloud.user.frame.data.OtherUserInfo; | ||
| 21 | import com.cnlive.cloud.user.model.LoginSuccessInfo; | 20 | import com.cnlive.cloud.user.model.LoginSuccessInfo; |
| 22 | import com.cnlive.cloud.user.sms.OnSmsCatchListener; | 21 | import com.cnlive.cloud.user.sms.OnSmsCatchListener; |
| 23 | import com.cnlive.cloud.user.sms.SmsVerifyCatcher; | 22 | import com.cnlive.cloud.user.sms.SmsVerifyCatcher; |
| @@ -28,6 +27,8 @@ import com.cnlive.core.libs.base.application.AppConfig; | @@ -28,6 +27,8 @@ import com.cnlive.core.libs.base.application.AppConfig; | ||
| 28 | import com.cnlive.core.libs.base.frame.view.BaseView; | 27 | import com.cnlive.core.libs.base.frame.view.BaseView; |
| 29 | import com.cnlive.core.libs.base.util.AlertUtil; | 28 | import com.cnlive.core.libs.base.util.AlertUtil; |
| 30 | import com.cnlive.core.libs.base.util.DoublePressed; | 29 | import com.cnlive.core.libs.base.util.DoublePressed; |
| 30 | +import com.cnlive.login.model.OtherUserInfo; | ||
| 31 | + | ||
| 31 | import java.util.regex.Matcher; | 32 | import java.util.regex.Matcher; |
| 32 | import java.util.regex.Pattern; | 33 | import java.util.regex.Pattern; |
| 33 | 34 |
cloud/user/src/main/java/com/cnlive/cloud/user/router/user/UserAction.java
| @@ -76,6 +76,31 @@ public class UserAction { | @@ -76,6 +76,31 @@ public class UserAction { | ||
| 76 | 76 | ||
| 77 | } | 77 | } |
| 78 | 78 | ||
| 79 | + | ||
| 80 | + public static Disposable otherLogin(Context context, String thirdPartyPlat, String thirdPartyId, CallBack callBack) { | ||
| 81 | + | ||
| 82 | + return HttpConn.action(UserUtilAction.otherLogin(context, thirdPartyPlat, thirdPartyId), new NetCallBack<BaseResult<UserData>>() { | ||
| 83 | + @Override | ||
| 84 | + public void onRequestState(int state) { | ||
| 85 | + if (null != callBack) { | ||
| 86 | + callBack.callback(state, "", null); | ||
| 87 | + } | ||
| 88 | + } | ||
| 89 | + | ||
| 90 | + @Override | ||
| 91 | + public void onSuccess(BaseResult<UserData> data) { | ||
| 92 | + loginAppAction(data, context, "", "", true, callBack); | ||
| 93 | + } | ||
| 94 | + | ||
| 95 | + @Override | ||
| 96 | + public void onFailure(String errCode, String errMsg, Exception e) { | ||
| 97 | + if (null != callBack) { | ||
| 98 | + callBack.callback(Integer.parseInt(errCode), errMsg, null); | ||
| 99 | + } | ||
| 100 | + } | ||
| 101 | + }); | ||
| 102 | + } | ||
| 103 | + | ||
| 79 | private static Observable<CNLiveUserInfo> loginAppAction(BaseResult<UserData> data, Context context, String userName, String userPassword, boolean otherLogin, CallBack callBack) { | 104 | private static Observable<CNLiveUserInfo> loginAppAction(BaseResult<UserData> data, Context context, String userName, String userPassword, boolean otherLogin, CallBack callBack) { |
| 80 | CNLiveUserInfo userinfo = null; | 105 | CNLiveUserInfo userinfo = null; |
| 81 | if (null == data || null == data.getData()) { | 106 | if (null == data || null == data.getData()) { |
| @@ -104,6 +129,32 @@ public class UserAction { | @@ -104,6 +129,32 @@ public class UserAction { | ||
| 104 | return Observable.just(userinfo); | 129 | return Observable.just(userinfo); |
| 105 | } | 130 | } |
| 106 | 131 | ||
| 132 | + | ||
| 133 | + public static void otherLoginBindMobile(Context context, String phone, String countryCode, String ems, | ||
| 134 | + String thirdPartyPlat, String thirdPartyId, String nickName, String gender, | ||
| 135 | + String location, String faceUrl, CallBack callBack) { | ||
| 136 | + | ||
| 137 | + HttpConn.action(UserUtilAction.otherLoginBindMobile(context, phone, countryCode, ems, | ||
| 138 | + thirdPartyPlat, thirdPartyId, nickName, gender, location, faceUrl), new NetCallBack<BaseResult<UserData>>() { | ||
| 139 | + @Override | ||
| 140 | + public void onRequestState(int state) { | ||
| 141 | + if (null != callBack) { | ||
| 142 | + callBack.callback(state, "", null); | ||
| 143 | + } | ||
| 144 | + } | ||
| 145 | + | ||
| 146 | + @Override | ||
| 147 | + public void onSuccess(BaseResult<UserData> data) { | ||
| 148 | + loginAppAction(data,context, "", "", true, callBack); | ||
| 149 | + } | ||
| 150 | + | ||
| 151 | + @Override | ||
| 152 | + public void onFailure(String errCode, String errMsg, Exception e) { | ||
| 153 | + | ||
| 154 | + } | ||
| 155 | + }); | ||
| 156 | + } | ||
| 157 | + | ||
| 107 | public interface CallBack { | 158 | public interface CallBack { |
| 108 | void callback(int state, String msg, Object object); | 159 | void callback(int state, String msg, Object object); |
| 109 | } | 160 | } |
cloud/user/src/main/java/com/cnlive/cloud/user/ui/activity/LoginDialogActivity.java
| @@ -25,6 +25,15 @@ import com.cnlive.cloud.user.frame.view.LoginDialogView; | @@ -25,6 +25,15 @@ import com.cnlive.cloud.user.frame.view.LoginDialogView; | ||
| 25 | import com.cnlive.cloud.user.router.user.UserAction; | 25 | import com.cnlive.cloud.user.router.user.UserAction; |
| 26 | import com.cnlive.cloud.user.sms.SmsVerifyCatcher; | 26 | import com.cnlive.cloud.user.sms.SmsVerifyCatcher; |
| 27 | import com.cnlive.cloud.user.ui.adapter.UserListAdapter; | 27 | import com.cnlive.cloud.user.ui.adapter.UserListAdapter; |
| 28 | +import com.cnlive.login.model.OtherUserInfo; | ||
| 29 | +import com.cnlive.login.model.ThirdLoginInfo; | ||
| 30 | +import com.cnlive.login.observer.ThirdLoginObservable; | ||
| 31 | +import com.cnlive.login.observer.WechatLoginObservable; | ||
| 32 | +import com.cnlive.login.utils.ThirdLoginUtil; | ||
| 33 | +import com.cnlive.share.data.WeChatInfo; | ||
| 34 | +import com.cnlive.share.util.Util; | ||
| 35 | + | ||
| 36 | +import java.util.Observable; | ||
| 28 | 37 | ||
| 29 | import static com.cnlive.cloud.user.ui.activity.LoginActivity.TAG_CLICK_AD; | 38 | import static com.cnlive.cloud.user.ui.activity.LoginActivity.TAG_CLICK_AD; |
| 30 | 39 | ||
| @@ -48,11 +57,11 @@ public class LoginDialogActivity extends BaseActivity<LoginDialogView, LoginDial | @@ -48,11 +57,11 @@ public class LoginDialogActivity extends BaseActivity<LoginDialogView, LoginDial | ||
| 48 | public boolean hasLogin = false;//是否已经登录 | 57 | public boolean hasLogin = false;//是否已经登录 |
| 49 | public Uri uri; | 58 | public Uri uri; |
| 50 | public String tagShare; | 59 | public String tagShare; |
| 51 | - //三方登陆 | ||
| 52 | - //qq的权限 | ||
| 53 | - public final String ACOPE_ALL = "all"; | 60 | + |
| 54 | //三方登陆的信息 | 61 | //三方登陆的信息 |
| 62 | + public OtherUserInfo otherUserInfo; | ||
| 55 | public Boolean clickAd; | 63 | public Boolean clickAd; |
| 64 | + | ||
| 56 | public String tagUrl; | 65 | public String tagUrl; |
| 57 | public ActivityLoginDialogBinding binding; | 66 | public ActivityLoginDialogBinding binding; |
| 58 | public QuickLoginData data; | 67 | public QuickLoginData data; |
| @@ -83,7 +92,7 @@ public class LoginDialogActivity extends BaseActivity<LoginDialogView, LoginDial | @@ -83,7 +92,7 @@ public class LoginDialogActivity extends BaseActivity<LoginDialogView, LoginDial | ||
| 83 | p.height = WindowManager.LayoutParams.MATCH_PARENT; | 92 | p.height = WindowManager.LayoutParams.MATCH_PARENT; |
| 84 | p.width = (ScreenUtils.getScreenWidth(this) - dp2px(88)); | 93 | p.width = (ScreenUtils.getScreenWidth(this) - dp2px(88)); |
| 85 | getWindow().setAttributes(p); | 94 | getWindow().setAttributes(p); |
| 86 | -// initThreeLogin(); | 95 | + initThreeLogin(); |
| 87 | uri = UserAction.getUri(this); | 96 | uri = UserAction.getUri(this); |
| 88 | tagUrl = getIntent().getStringExtra(TAG_URL); | 97 | tagUrl = getIntent().getStringExtra(TAG_URL); |
| 89 | clickAd = getIntent().getBooleanExtra(TAG_CLICK_AD, false); | 98 | clickAd = getIntent().getBooleanExtra(TAG_CLICK_AD, false); |
| @@ -108,6 +117,15 @@ public class LoginDialogActivity extends BaseActivity<LoginDialogView, LoginDial | @@ -108,6 +117,15 @@ public class LoginDialogActivity extends BaseActivity<LoginDialogView, LoginDial | ||
| 108 | } | 117 | } |
| 109 | 118 | ||
| 110 | 119 | ||
| 120 | + /** | ||
| 121 | + * 初始化第三方 | ||
| 122 | + */ | ||
| 123 | + private void initThreeLogin() { | ||
| 124 | + ThirdLoginUtil.init(this); | ||
| 125 | + WechatLoginObservable.getInstance().addObserver(this); | ||
| 126 | + ThirdLoginObservable.getInstance().addObserver(this); | ||
| 127 | + } | ||
| 128 | + | ||
| 111 | 129 | ||
| 112 | @Override | 130 | @Override |
| 113 | public void onStart() { | 131 | public void onStart() { |
| @@ -153,8 +171,24 @@ public class LoginDialogActivity extends BaseActivity<LoginDialogView, LoginDial | @@ -153,8 +171,24 @@ public class LoginDialogActivity extends BaseActivity<LoginDialogView, LoginDial | ||
| 153 | // } | 171 | // } |
| 154 | else if (id == R.id.iv_qq) { | 172 | else if (id == R.id.iv_qq) { |
| 155 | if (DoublePressed.onDoublePressed()) return; | 173 | if (DoublePressed.onDoublePressed()) return; |
| 174 | + if (!ThirdLoginUtil.isQQInstalled(LoginDialogActivity.this) && getMvpView() != null) | ||
| 175 | + getMvpView().showToast("您未安装该第三方应用,无法获取用户信息!"); | ||
| 156 | } else if (id == R.id.iv_wb) { | 176 | } else if (id == R.id.iv_wb) { |
| 157 | if (DoublePressed.onDoublePressed()) return; | 177 | if (DoublePressed.onDoublePressed()) return; |
| 178 | + if (Util.isWeiboInstallAndInit(this)) { | ||
| 179 | + ThirdLoginUtil.loginWeibo(LoginDialogActivity.this); | ||
| 180 | + } else { | ||
| 181 | + if (getMvpView() != null) getMvpView().showToast("您未安装该第三方应用,无法获取用户信息!"); | ||
| 182 | + } | ||
| 183 | + } else if (id == R.id.iv_wc) { | ||
| 184 | + if (DoublePressed.onDoublePressed()) return; | ||
| 185 | + if (Util.isWXAppInstalledAndSupported(this)) { | ||
| 186 | + new Thread(() -> { | ||
| 187 | + ThirdLoginUtil.loginWechat(LoginDialogActivity.this, AppConfig.getWechatAppid()); | ||
| 188 | + }).start(); | ||
| 189 | + } else { | ||
| 190 | + if (getMvpView() != null) getMvpView().showToast("您未安装该第三方应用,无法获取用户信息!"); | ||
| 191 | + } | ||
| 158 | } else if (id == R.id.iv_close) { | 192 | } else if (id == R.id.iv_close) { |
| 159 | finish(); | 193 | finish(); |
| 160 | } | 194 | } |
| @@ -190,6 +224,9 @@ public class LoginDialogActivity extends BaseActivity<LoginDialogView, LoginDial | @@ -190,6 +224,9 @@ public class LoginDialogActivity extends BaseActivity<LoginDialogView, LoginDial | ||
| 190 | super.onDestroy(); | 224 | super.onDestroy(); |
| 191 | if (getMvpView() != null) getMvpView().hideProgress(); | 225 | if (getMvpView() != null) getMvpView().hideProgress(); |
| 192 | if (getPresenter() != null) getPresenter().destroy(); | 226 | if (getPresenter() != null) getPresenter().destroy(); |
| 227 | + | ||
| 228 | + WechatLoginObservable.getInstance().deleteObserver(this); | ||
| 229 | + ThirdLoginObservable.getInstance().deleteObserver(this); | ||
| 193 | } | 230 | } |
| 194 | 231 | ||
| 195 | @Override | 232 | @Override |
| @@ -214,6 +251,9 @@ public class LoginDialogActivity extends BaseActivity<LoginDialogView, LoginDial | @@ -214,6 +251,9 @@ public class LoginDialogActivity extends BaseActivity<LoginDialogView, LoginDial | ||
| 214 | } | 251 | } |
| 215 | } | 252 | } |
| 216 | 253 | ||
| 254 | + ThirdLoginUtil.getQQResult(requestCode, resultCode, data); | ||
| 255 | + ThirdLoginUtil.getWeiboResult(requestCode, resultCode, data); | ||
| 256 | + | ||
| 217 | } | 257 | } |
| 218 | 258 | ||
| 219 | @Override | 259 | @Override |
| @@ -225,6 +265,48 @@ public class LoginDialogActivity extends BaseActivity<LoginDialogView, LoginDial | @@ -225,6 +265,48 @@ public class LoginDialogActivity extends BaseActivity<LoginDialogView, LoginDial | ||
| 225 | } | 265 | } |
| 226 | } | 266 | } |
| 227 | 267 | ||
| 268 | + //微信登录回调接口 | ||
| 269 | + @Override | ||
| 270 | + public void update(Observable observable, Object o) { | ||
| 271 | + if (observable instanceof WechatLoginObservable && null != o) { | ||
| 272 | + WeChatInfo weChatInfo = (WeChatInfo) o; | ||
| 273 | + if (weChatInfo != null) { | ||
| 274 | + otherUserInfo = new OtherUserInfo(); | ||
| 275 | + otherUserInfo.setFaceUrl(weChatInfo.getHeadimgurl()); | ||
| 276 | + if ("1".equals(weChatInfo.getSex())) { | ||
| 277 | + otherUserInfo.setGender("m"); | ||
| 278 | + } else if ("2".equals(weChatInfo.getSex())) { | ||
| 279 | + otherUserInfo.setGender("f"); | ||
| 280 | + } else { | ||
| 281 | + otherUserInfo.setGender("n"); | ||
| 282 | + } | ||
| 283 | + | ||
| 284 | + otherUserInfo.setNickName(weChatInfo.getNickname()); | ||
| 285 | + if (!TextUtils.isEmpty(weChatInfo.getProvince())) { | ||
| 286 | + otherUserInfo.setLocation(weChatInfo.getProvince()); | ||
| 287 | + } else { | ||
| 288 | + otherUserInfo.setLocation(weChatInfo.getCountry()); | ||
| 289 | + } | ||
| 290 | + | ||
| 291 | + otherUserInfo.setThirdPartyId(weChatInfo.getUnionid()); | ||
| 292 | + otherUserInfo.setLoginType("3"); | ||
| 293 | + } | ||
| 294 | + if (otherUserInfo != null && getPresenter() != null) | ||
| 295 | + getPresenter().otherLogin(this, otherUserInfo); | ||
| 296 | + } else if (observable instanceof ThirdLoginObservable) { | ||
| 297 | + ThirdLoginInfo info = (ThirdLoginInfo) o; | ||
| 298 | + if (info != null) { | ||
| 299 | + if (info.getType() == 1) { | ||
| 300 | + if (info.getOtherUserInfo() != null) otherUserInfo = info.getOtherUserInfo(); | ||
| 301 | + getPresenter().otherLogin(this, otherUserInfo); | ||
| 302 | + } else if (info.getType() == 2) { | ||
| 303 | + if (getMvpView() != null) getMvpView().showToast(info.getMessage()); | ||
| 304 | + } | ||
| 305 | + } | ||
| 306 | + | ||
| 307 | + } | ||
| 308 | + } | ||
| 309 | + | ||
| 228 | @Override | 310 | @Override |
| 229 | public void finish() { | 311 | public void finish() { |
| 230 | super.finish(); | 312 | super.finish(); |
cloud/user/src/main/java/com/cnlive/cloud/user/ui/fragment/QuickLoginFragment.java
| @@ -11,6 +11,7 @@ import androidx.databinding.ViewDataBinding; | @@ -11,6 +11,7 @@ import androidx.databinding.ViewDataBinding; | ||
| 11 | 11 | ||
| 12 | import com.cnlive.cloud.user.databinding.FragmentQuickLoginBinding; | 12 | import com.cnlive.cloud.user.databinding.FragmentQuickLoginBinding; |
| 13 | import com.cnlive.cloud.user.frame.presenter.QuickLoginPresenter; | 13 | import com.cnlive.cloud.user.frame.presenter.QuickLoginPresenter; |
| 14 | +import com.cnlive.cloud.user.ui.activity.LoginDialogActivity; | ||
| 14 | import com.cnlive.core.libs.base.application.AppConfig; | 15 | import com.cnlive.core.libs.base.application.AppConfig; |
| 15 | import com.cnlive.core.libs.base.frame.fragment.BaseFragment; | 16 | import com.cnlive.core.libs.base.frame.fragment.BaseFragment; |
| 16 | import com.cnlive.core.libs.base.util.DoublePressed; | 17 | import com.cnlive.core.libs.base.util.DoublePressed; |
| @@ -22,6 +23,16 @@ import com.cnlive.cloud.user.sms.SmsVerifyCatcher; | @@ -22,6 +23,16 @@ import com.cnlive.cloud.user.sms.SmsVerifyCatcher; | ||
| 22 | import com.cnlive.cloud.user.ui.activity.LoginActivity; | 23 | import com.cnlive.cloud.user.ui.activity.LoginActivity; |
| 23 | import com.cnlive.cloud.user.ui.activity.SelectCountryActivity; | 24 | import com.cnlive.cloud.user.ui.activity.SelectCountryActivity; |
| 24 | import com.cnlive.cloud.user.ui.adapter.UserListAdapter; | 25 | import com.cnlive.cloud.user.ui.adapter.UserListAdapter; |
| 26 | +import com.cnlive.login.model.OtherUserInfo; | ||
| 27 | +import com.cnlive.login.model.ThirdLoginInfo; | ||
| 28 | +import com.cnlive.login.observer.ThirdLoginObservable; | ||
| 29 | +import com.cnlive.login.observer.WechatLoginObservable; | ||
| 30 | +import com.cnlive.login.utils.ThirdLoginUtil; | ||
| 31 | +import com.cnlive.share.BuildConfig; | ||
| 32 | +import com.cnlive.share.data.WeChatInfo; | ||
| 33 | +import com.cnlive.share.util.Util; | ||
| 34 | + | ||
| 35 | +import java.util.Observable; | ||
| 25 | 36 | ||
| 26 | /** | 37 | /** |
| 27 | * @author Lynn | 38 | * @author Lynn |
| @@ -48,6 +59,10 @@ public class QuickLoginFragment extends BaseFragment<QuickLoginView, QuickLoginP | @@ -48,6 +59,10 @@ public class QuickLoginFragment extends BaseFragment<QuickLoginView, QuickLoginP | ||
| 48 | public String tagUrl; | 59 | public String tagUrl; |
| 49 | public static String TAG_URL = "tagurl"; | 60 | public static String TAG_URL = "tagurl"; |
| 50 | 61 | ||
| 62 | + //三方登陆的信息 | ||
| 63 | + public OtherUserInfo otherUserInfo; | ||
| 64 | + private boolean needEntranceBtn; | ||
| 65 | + | ||
| 51 | @Override | 66 | @Override |
| 52 | protected int getBindLayoutId() { | 67 | protected int getBindLayoutId() { |
| 53 | return R.layout.fragment_quick_login; | 68 | return R.layout.fragment_quick_login; |
| @@ -100,6 +115,7 @@ public class QuickLoginFragment extends BaseFragment<QuickLoginView, QuickLoginP | @@ -100,6 +115,7 @@ public class QuickLoginFragment extends BaseFragment<QuickLoginView, QuickLoginP | ||
| 100 | 115 | ||
| 101 | @Override | 116 | @Override |
| 102 | protected void initView() { | 117 | protected void initView() { |
| 118 | + initThreeLogin(); | ||
| 103 | adapter = new UserListAdapter(getActivity(), 0); | 119 | adapter = new UserListAdapter(getActivity(), 0); |
| 104 | adapter.setClickListener((name) -> getMvpView().onUploadLoginUser(name)); | 120 | adapter.setClickListener((name) -> getMvpView().onUploadLoginUser(name)); |
| 105 | adapter.setDeleteListener((name) -> getMvpView().onDeleteLoginUser(name)); | 121 | adapter.setDeleteListener((name) -> getMvpView().onDeleteLoginUser(name)); |
| @@ -116,6 +132,16 @@ public class QuickLoginFragment extends BaseFragment<QuickLoginView, QuickLoginP | @@ -116,6 +132,16 @@ public class QuickLoginFragment extends BaseFragment<QuickLoginView, QuickLoginP | ||
| 116 | if (getMvpView() != null) getMvpView().initView(); | 132 | if (getMvpView() != null) getMvpView().initView(); |
| 117 | } | 133 | } |
| 118 | 134 | ||
| 135 | + | ||
| 136 | + /** | ||
| 137 | + * 初始化第三方 | ||
| 138 | + */ | ||
| 139 | + private void initThreeLogin() { | ||
| 140 | + ThirdLoginUtil.init(getActivity()); | ||
| 141 | + WechatLoginObservable.getInstance().addObserver(this); | ||
| 142 | + ThirdLoginObservable.getInstance().addObserver(this); | ||
| 143 | + } | ||
| 144 | + | ||
| 119 | @Override | 145 | @Override |
| 120 | public void onStart() { | 146 | public void onStart() { |
| 121 | super.onStart(); | 147 | super.onStart(); |
| @@ -158,8 +184,28 @@ public class QuickLoginFragment extends BaseFragment<QuickLoginView, QuickLoginP | @@ -158,8 +184,28 @@ public class QuickLoginFragment extends BaseFragment<QuickLoginView, QuickLoginP | ||
| 158 | if (DoublePressed.onDoublePressed()) return; | 184 | if (DoublePressed.onDoublePressed()) return; |
| 159 | SelectCountryActivity.startSelectCountryActivity(getActivity(), 1010, countryCode); | 185 | SelectCountryActivity.startSelectCountryActivity(getActivity(), 1010, countryCode); |
| 160 | 186 | ||
| 161 | - } else { | ||
| 162 | - if (getMvpView() != null) getMvpView().showToast("您未安装该第三方应用,无法获取用户信息!"); | 187 | + }else if (id == R.id.iv_qq) { |
| 188 | + if (DoublePressed.onDoublePressed()) return; | ||
| 189 | + if (!ThirdLoginUtil.isQQInstalled(getActivity()) && getMvpView() != null) | ||
| 190 | + getMvpView().showToast("您未安装该第三方应用,无法获取用户信息!"); | ||
| 191 | + } else if (id == R.id.iv_wb) { | ||
| 192 | + if (DoublePressed.onDoublePressed()) return; | ||
| 193 | + if (Util.isWeiboInstallAndInit(getActivity())) { | ||
| 194 | + ThirdLoginUtil.loginWeibo(getActivity()); | ||
| 195 | + } else { | ||
| 196 | + if (getMvpView() != null) getMvpView().showToast("您未安装该第三方应用,无法获取用户信息!"); | ||
| 197 | + } | ||
| 198 | + } else if (id == R.id.iv_wc) { | ||
| 199 | + if (DoublePressed.onDoublePressed()) return; | ||
| 200 | + if (Util.isWXAppInstalledAndSupported(getActivity())) { | ||
| 201 | + new Thread(() -> { | ||
| 202 | + ThirdLoginUtil.loginWechat(getActivity(), AppConfig.getWechatAppid()); | ||
| 203 | + }).start(); | ||
| 204 | + } else { | ||
| 205 | + if (getMvpView() != null) getMvpView().showToast("您未安装该第三方应用,无法获取用户信息!"); | ||
| 206 | + } | ||
| 207 | + } else if (id == R.id.iv_close) { | ||
| 208 | + getActivity().finish(); | ||
| 163 | } | 209 | } |
| 164 | } | 210 | } |
| 165 | 211 | ||
| @@ -193,6 +239,8 @@ public class QuickLoginFragment extends BaseFragment<QuickLoginView, QuickLoginP | @@ -193,6 +239,8 @@ public class QuickLoginFragment extends BaseFragment<QuickLoginView, QuickLoginP | ||
| 193 | super.onDestroy(); | 239 | super.onDestroy(); |
| 194 | if (getMvpView() != null) getMvpView().hideProgress(); | 240 | if (getMvpView() != null) getMvpView().hideProgress(); |
| 195 | if (getPresenter() != null) getPresenter().destroy(); | 241 | if (getPresenter() != null) getPresenter().destroy(); |
| 242 | + WechatLoginObservable.getInstance().deleteObserver(this); | ||
| 243 | + ThirdLoginObservable.getInstance().deleteObserver(this); | ||
| 196 | } | 244 | } |
| 197 | 245 | ||
| 198 | @Override | 246 | @Override |
| @@ -216,6 +264,9 @@ public class QuickLoginFragment extends BaseFragment<QuickLoginView, QuickLoginP | @@ -216,6 +264,9 @@ public class QuickLoginFragment extends BaseFragment<QuickLoginView, QuickLoginP | ||
| 216 | return; | 264 | return; |
| 217 | } | 265 | } |
| 218 | } | 266 | } |
| 267 | + | ||
| 268 | + ThirdLoginUtil.getQQResult(requestCode, resultCode, data); | ||
| 269 | + ThirdLoginUtil.getWeiboResult(requestCode, resultCode, data); | ||
| 219 | } | 270 | } |
| 220 | 271 | ||
| 221 | @Override | 272 | @Override |
| @@ -227,5 +278,46 @@ public class QuickLoginFragment extends BaseFragment<QuickLoginView, QuickLoginP | @@ -227,5 +278,46 @@ public class QuickLoginFragment extends BaseFragment<QuickLoginView, QuickLoginP | ||
| 227 | } | 278 | } |
| 228 | } | 279 | } |
| 229 | 280 | ||
| 281 | + //微信登录回调接口 | ||
| 282 | + @Override | ||
| 283 | + public void update(Observable observable, Object o) { | ||
| 284 | + if (observable instanceof WechatLoginObservable && null != o) { | ||
| 285 | + WeChatInfo weChatInfo = (WeChatInfo) o; | ||
| 286 | + if (weChatInfo != null) { | ||
| 287 | + otherUserInfo = new OtherUserInfo(); | ||
| 288 | + otherUserInfo.setFaceUrl(weChatInfo.getHeadimgurl()); | ||
| 289 | + if ("1".equals(weChatInfo.getSex())) { | ||
| 290 | + otherUserInfo.setGender("m"); | ||
| 291 | + } else if ("2".equals(weChatInfo.getSex())) { | ||
| 292 | + otherUserInfo.setGender("f"); | ||
| 293 | + } else { | ||
| 294 | + otherUserInfo.setGender("n"); | ||
| 295 | + } | ||
| 296 | + | ||
| 297 | + otherUserInfo.setNickName(weChatInfo.getNickname()); | ||
| 298 | + if (!TextUtils.isEmpty(weChatInfo.getProvince())) { | ||
| 299 | + otherUserInfo.setLocation(weChatInfo.getProvince()); | ||
| 300 | + } else { | ||
| 301 | + otherUserInfo.setLocation(weChatInfo.getCountry()); | ||
| 302 | + } | ||
| 303 | + | ||
| 304 | + otherUserInfo.setThirdPartyId(weChatInfo.getUnionid()); | ||
| 305 | + otherUserInfo.setLoginType("3"); | ||
| 306 | + } | ||
| 307 | + if (otherUserInfo != null && getPresenter() != null) | ||
| 308 | + getPresenter().otherLogin(this, otherUserInfo); | ||
| 309 | + } else if (observable instanceof ThirdLoginObservable) { | ||
| 310 | + ThirdLoginInfo info = (ThirdLoginInfo) o; | ||
| 311 | + if (info != null) { | ||
| 312 | + if (info.getType() == 1) { | ||
| 313 | + if (info.getOtherUserInfo() != null) otherUserInfo = info.getOtherUserInfo(); | ||
| 314 | + getPresenter().otherLogin(this, otherUserInfo); | ||
| 315 | + } else if (info.getType() == 2) { | ||
| 316 | + if (getMvpView() != null) getMvpView().showToast(info.getMessage()); | ||
| 317 | + } | ||
| 318 | + } | ||
| 319 | + | ||
| 320 | + } | ||
| 321 | + } | ||
| 230 | 322 | ||
| 231 | } | 323 | } |
core/base/src/main/java/com/hannesdorfmann/mosby3/mvp/MvpBasePresenter.java
| @@ -163,7 +163,7 @@ public class MvpBasePresenter<V extends MvpView> implements MvpPresenter<V> { | @@ -163,7 +163,7 @@ public class MvpBasePresenter<V extends MvpView> implements MvpPresenter<V> { | ||
| 163 | * {@inheritDoc} | 163 | * {@inheritDoc} |
| 164 | */ | 164 | */ |
| 165 | public void destroy() { | 165 | public void destroy() { |
| 166 | - detachView(false); | 166 | +// detachView(false); |
| 167 | presenterDestroyed = true; | 167 | presenterDestroyed = true; |
| 168 | } | 168 | } |
| 169 | } | 169 | } |