Merge branch 'main' of http://192.168.1.42/developOne/harmonyPool into main
* 'main' of http://192.168.1.42/developOne/harmonyPool: ref |> 从新处理回华为账号一键登录
Showing
4 changed files
with
128 additions
and
75 deletions
| @@ -106,6 +106,7 @@ export class HttpUrlUtils { | @@ -106,6 +106,7 @@ export class HttpUrlUtils { | ||
| 106 | * 资料编辑 更新普通用户名(用户名、身份证号、邮箱、手机号修改url) | 106 | * 资料编辑 更新普通用户名(用户名、身份证号、邮箱、手机号修改url) |
| 107 | */ | 107 | */ |
| 108 | static readonly APPOINTMENT_editUserDetail1_PATH: string = "/api/rmrb-user-center/user/zh/c/completeUserInfo"; | 108 | static readonly APPOINTMENT_editUserDetail1_PATH: string = "/api/rmrb-user-center/user/zh/c/completeUserInfo"; |
| 109 | + static readonly APPOINTMENT_editCreatorNickName_PATH: string = "/api/rmrb-creator-user/c/rmrb-creator-user/creator/updateName"; | ||
| 109 | /** | 110 | /** |
| 110 | * 资料编辑 地区拉取 | 111 | * 资料编辑 地区拉取 |
| 111 | */ | 112 | */ |
| @@ -9,8 +9,9 @@ import { encryptMessage } from '../../utils/cryptoUtil' | @@ -9,8 +9,9 @@ import { encryptMessage } from '../../utils/cryptoUtil' | ||
| 9 | 9 | ||
| 10 | import { SpConstants } from 'wdConstant/Index' | 10 | import { SpConstants } from 'wdConstant/Index' |
| 11 | import { UserDetail } from 'wdBean/Index'; | 11 | import { UserDetail } from 'wdBean/Index'; |
| 12 | -import { HttpUtils } from 'wdNetwork/Index' | 12 | +import { HttpUrlUtils, HttpUtils, ResponseDTO, WDHttp } from 'wdNetwork/Index' |
| 13 | import { LoginModule } from '../../LoginModule' | 13 | import { LoginModule } from '../../LoginModule' |
| 14 | +import HuaweiAuth from '../../utils/HuaweiAuth' | ||
| 14 | 15 | ||
| 15 | const TAG = "LoginViewModel" | 16 | const TAG = "LoginViewModel" |
| 16 | 17 | ||
| @@ -58,9 +59,34 @@ export class LoginViewModel { | @@ -58,9 +59,34 @@ export class LoginViewModel { | ||
| 58 | 59 | ||
| 59 | huaweiOneKeyLogin(authCode: string) { | 60 | huaweiOneKeyLogin(authCode: string) { |
| 60 | return new Promise<LoginBean>((success, fail) => { | 61 | return new Promise<LoginBean>((success, fail) => { |
| 61 | - this.loginModel.thirdPartLogin(9, {"idToken": authCode}).then((data: LoginBean) => { | 62 | + this.loginModel.thirdPartLogin(9, {"idToken": authCode}).then(async (data: LoginBean) => { |
| 62 | this.dealWithLoginSuccess(data) | 63 | this.dealWithLoginSuccess(data) |
| 64 | + | ||
| 65 | + try { | ||
| 66 | + await this.queryUserDetail() | ||
| 67 | + | ||
| 68 | + // 1、暂时只能更新昵称 | ||
| 69 | + // 2、昵称需要审核,需要接口支持不带审核的? | ||
| 70 | + // if (data.firstMark == 1) { | ||
| 71 | + // let profileData = await HuaweiAuth.sharedInstance().requestProfile() | ||
| 72 | + // | ||
| 73 | + // if (profileData.nickName && profileData.nickName.length > 0) { | ||
| 74 | + // | ||
| 75 | + // let creatorId = SPHelper.default.getSync(SpConstants.USER_CREATOR_ID, "") as string | ||
| 76 | + // if (data.userType == 1) { | ||
| 77 | + // await this.uploadNormalUserNickNameFirstTime(profileData.nickName) | ||
| 78 | + // } else if (creatorId.length > 0) { | ||
| 79 | + // await this.uploadCreatorNickNameFirstTime(creatorId, profileData.nickName) | ||
| 80 | + // } | ||
| 81 | + // } | ||
| 82 | + // | ||
| 83 | + // } | ||
| 84 | + } catch (e) { | ||
| 85 | + | ||
| 86 | + } finally { | ||
| 63 | success(data) | 87 | success(data) |
| 88 | + } | ||
| 89 | + | ||
| 64 | }).catch((error:string) => { | 90 | }).catch((error:string) => { |
| 65 | fail(error) | 91 | fail(error) |
| 66 | }) | 92 | }) |
| @@ -69,14 +95,14 @@ export class LoginViewModel { | @@ -69,14 +95,14 @@ export class LoginViewModel { | ||
| 69 | 95 | ||
| 70 | //TODO: 这里要整体改掉 | 96 | //TODO: 这里要整体改掉 |
| 71 | dealWithLoginSuccess(data: LoginBean) { | 97 | dealWithLoginSuccess(data: LoginBean) { |
| 72 | - SPHelper.default.saveSync(SpConstants.USER_FIRST_MARK, data.firstMark) | 98 | + SPHelper.default.saveSync(SpConstants.USER_FIRST_MARK, data.firstMark ?? 0) |
| 73 | SPHelper.default.saveSync(SpConstants.USER_ID, data.id) | 99 | SPHelper.default.saveSync(SpConstants.USER_ID, data.id) |
| 74 | SPHelper.default.saveSync(SpConstants.USER_JWT_TOKEN, data.jwtToken) | 100 | SPHelper.default.saveSync(SpConstants.USER_JWT_TOKEN, data.jwtToken) |
| 75 | - SPHelper.default.saveSync(SpConstants.USER_LONG_TIME_NO_LOGIN_MARK, data.longTimeNoLoginMark) | 101 | + SPHelper.default.saveSync(SpConstants.USER_LONG_TIME_NO_LOGIN_MARK, data.longTimeNoLoginMark ?? 0) |
| 76 | SPHelper.default.saveSync(SpConstants.USER_REFRESH_TOKEN, data.refreshToken) | 102 | SPHelper.default.saveSync(SpConstants.USER_REFRESH_TOKEN, data.refreshToken) |
| 77 | - SPHelper.default.saveSync(SpConstants.USER_STATUS, data.status) | 103 | + SPHelper.default.saveSync(SpConstants.USER_STATUS, data.status ?? 0) |
| 78 | SPHelper.default.saveSync(SpConstants.USER_Type, data.userType) | 104 | SPHelper.default.saveSync(SpConstants.USER_Type, data.userType) |
| 79 | - SPHelper.default.saveSync(SpConstants.USER_NAME, data.userName) | 105 | + SPHelper.default.saveSync(SpConstants.USER_NAME, data.userName ?? "") |
| 80 | EmitterUtils.sendEmptyEvent(EmitterEventId.LOGIN_SUCCESS) | 106 | EmitterUtils.sendEmptyEvent(EmitterEventId.LOGIN_SUCCESS) |
| 81 | 107 | ||
| 82 | LoginModule.reportDeviceInfo() | 108 | LoginModule.reportDeviceInfo() |
| @@ -273,4 +299,33 @@ export class LoginViewModel { | @@ -273,4 +299,33 @@ export class LoginViewModel { | ||
| 273 | } | 299 | } |
| 274 | return isMatch; | 300 | return isMatch; |
| 275 | } | 301 | } |
| 302 | + | ||
| 303 | + public uploadNormalUserNickNameFirstTime(nickName: string) { | ||
| 304 | + return new Promise<boolean>((success, fail) => { | ||
| 305 | + | ||
| 306 | + let requestUrl = HttpUrlUtils.getHost() + HttpUrlUtils.APPOINTMENT_editUserDetail1_PATH | ||
| 307 | + let params = {"userName": nickName} as Record<string, string> | ||
| 308 | + | ||
| 309 | + WDHttp.post<ResponseDTO<string>>(requestUrl,params).then((res) => { | ||
| 310 | + success(true) | ||
| 311 | + }).catch(() => { | ||
| 312 | + fail() | ||
| 313 | + }) | ||
| 314 | + | ||
| 315 | + }) | ||
| 316 | + } | ||
| 317 | + | ||
| 318 | + public uploadCreatorNickNameFirstTime(creatorId: string, nickName: string) { | ||
| 319 | + return new Promise<boolean>((success, fail) => { | ||
| 320 | + | ||
| 321 | + let requestUrl = HttpUrlUtils.getHost() + HttpUrlUtils.APPOINTMENT_editCreatorNickName_PATH | ||
| 322 | + let params = {"name": nickName, "creatorId": creatorId} as Record<string, string> | ||
| 323 | + | ||
| 324 | + WDHttp.post<ResponseDTO<string>>(requestUrl,params).then((res) => { | ||
| 325 | + success(true) | ||
| 326 | + }).catch(() => { | ||
| 327 | + fail() | ||
| 328 | + }) | ||
| 329 | + }) | ||
| 330 | + } | ||
| 276 | } | 331 | } |
| @@ -36,24 +36,26 @@ struct OneKeyLoginPage { | @@ -36,24 +36,26 @@ struct OneKeyLoginPage { | ||
| 36 | new loginComponentManager.LoginWithHuaweiIDButtonController() | 36 | new loginComponentManager.LoginWithHuaweiIDButtonController() |
| 37 | /** | 37 | /** |
| 38 | * 当应用使用自定义的登录页时,如果用户未同意协议,需要设置协议状态为NOT_ACCEPTED,当用户同意协议后再设置 | 38 | * 当应用使用自定义的登录页时,如果用户未同意协议,需要设置协议状态为NOT_ACCEPTED,当用户同意协议后再设置 |
| 39 | - * 协议状态为ACCEPTED,才可以使用华为帐号一键登录功能。 | 39 | + * 协议状态为ACCEPTED,才可以使用华为账号一键登录功能。 |
| 40 | */ | 40 | */ |
| 41 | .setAgreementStatus(loginComponentManager.AgreementStatus.NOT_ACCEPTED) | 41 | .setAgreementStatus(loginComponentManager.AgreementStatus.NOT_ACCEPTED) |
| 42 | .onClickLoginWithHuaweiIDButton((error: BusinessError, response: loginComponentManager.HuaweiIDCredential) => { | 42 | .onClickLoginWithHuaweiIDButton((error: BusinessError, response: loginComponentManager.HuaweiIDCredential) => { |
| 43 | - if (error) { | 43 | + if (error || !response) { |
| 44 | Logger.debug("HuaweiOneKeyAuth", "onClickLoginWithHuaweiIDButton error: " + JSON.stringify(error)) | 44 | Logger.debug("HuaweiOneKeyAuth", "onClickLoginWithHuaweiIDButton error: " + JSON.stringify(error)) |
| 45 | - this.toastText = "请阅读并勾选用户协议、隐私政策和华为账号用户认证协议" | ||
| 46 | - this.dialogToast.open() | 45 | + if (!this.agreeProtocol) { |
| 46 | + this.showToastTip("请阅读并勾选用户协议、隐私政策和华为账号用户认证协议") | ||
| 47 | + return | ||
| 48 | + } | ||
| 49 | + this.showToastTip("登录失败") | ||
| 47 | return; | 50 | return; |
| 48 | } | 51 | } |
| 49 | - if (response) { | 52 | + |
| 50 | // 获取到Authorization Code | 53 | // 获取到Authorization Code |
| 51 | let authorizationCode = response.authorizationCode; | 54 | let authorizationCode = response.authorizationCode; |
| 55 | + Logger.debug("HuaweiOneKeyAuth", "第一次授权码: " + authorizationCode) | ||
| 52 | // hilog.info(0x0000, 'testTag', 'response: %{public}s', JSON.stringify(response)); | 56 | // hilog.info(0x0000, 'testTag', 'response: %{public}s', JSON.stringify(response)); |
| 53 | TrackingButton.click("oneClickLoginPageLoginButton", TrackConstants.PageName.OneClick_Login, TrackConstants.PageName.OneClick_Login) | 57 | TrackingButton.click("oneClickLoginPageLoginButton", TrackConstants.PageName.OneClick_Login, TrackConstants.PageName.OneClick_Login) |
| 54 | - this.requestLogin() | ||
| 55 | - return; | ||
| 56 | - } | 58 | + this.requestLogin(authorizationCode) |
| 57 | }); | 59 | }); |
| 58 | 60 | ||
| 59 | // 埋点计算页面浏览时长 | 61 | // 埋点计算页面浏览时长 |
| @@ -158,7 +160,7 @@ struct OneKeyLoginPage { | @@ -158,7 +160,7 @@ struct OneKeyLoginPage { | ||
| 158 | Row() { | 160 | Row() { |
| 159 | Image($r("app.media.huawei_one_key_login_icon")) | 161 | Image($r("app.media.huawei_one_key_login_icon")) |
| 160 | .width(24).height(24) | 162 | .width(24).height(24) |
| 161 | - Text("华为账号快速登录") | 163 | + Text("华为账号一键登录") |
| 162 | .fontColor(Color.White) | 164 | .fontColor(Color.White) |
| 163 | .margin({left:5}) | 165 | .margin({left:5}) |
| 164 | } | 166 | } |
| @@ -167,41 +169,31 @@ struct OneKeyLoginPage { | @@ -167,41 +169,31 @@ struct OneKeyLoginPage { | ||
| 167 | .height(48) | 169 | .height(48) |
| 168 | .borderRadius(4) | 170 | .borderRadius(4) |
| 169 | .type(ButtonType.Normal) | 171 | .type(ButtonType.Normal) |
| 170 | - .backgroundColor("#ED2800") | ||
| 171 | - .onClick(() => { | 172 | + .backgroundColor(!this.agreeProtocol ? "#60ED2800" : "#ED2800") |
| 172 | 173 | ||
| 173 | - if (!this.agreeProtocol) { | ||
| 174 | - this.toastText = "请阅读并勾选用户协议、隐私政策和华为账号用户认证协议" | ||
| 175 | - this.dialogToast.open() | ||
| 176 | - return | 174 | + Stack(){ |
| 175 | + //目前不支持文字和图标同时展示,后面优化 | ||
| 176 | + LoginWithHuaweiIDButton({ | ||
| 177 | + params: { | ||
| 178 | + // LoginWithHuaweiIDButton支持的样式。 | ||
| 179 | + style: loginComponentManager.Style.BUTTON_CUSTOM, | ||
| 180 | + // LoginWithHuaweiIDButton的边框圆角半径。 | ||
| 181 | + // borderRadius: 4, | ||
| 182 | + // LoginWithHuaweiIDButton支持的登录类型。 | ||
| 183 | + loginType: loginComponentManager.LoginType.QUICK_LOGIN, | ||
| 184 | + // LoginWithHuaweiIDButton支持按钮的样式跟随系统深浅色模式切换。 | ||
| 185 | + // supportDarkMode: true, | ||
| 186 | + customButtonParams: { | ||
| 187 | + fontColor: loginComponentManager.FontColor.WHITE, | ||
| 188 | + // backgroundColor:!this.agreeProtocol ? "#60ED2800" : "#ED2800" | ||
| 189 | + backgroundColor:"#ED2800" | ||
| 177 | } | 190 | } |
| 178 | - TrackingButton.click("oneClickLoginPageLoginButton", TrackConstants.PageName.OneClick_Login, TrackConstants.PageName.OneClick_Login) | ||
| 179 | - this.requestLogin() | ||
| 180 | - }) | ||
| 181 | - | ||
| 182 | - // Stack(){ | ||
| 183 | - // //目前不支持文字和图标同时展示,后面优化 | ||
| 184 | - // LoginWithHuaweiIDButton({ | ||
| 185 | - // params: { | ||
| 186 | - // // LoginWithHuaweiIDButton支持的样式。 | ||
| 187 | - // style: loginComponentManager.Style.BUTTON_CUSTOM, | ||
| 188 | - // // LoginWithHuaweiIDButton的边框圆角半径。 | ||
| 189 | - // // borderRadius: 4, | ||
| 190 | - // // LoginWithHuaweiIDButton支持的登录类型。 | ||
| 191 | - // loginType: loginComponentManager.LoginType.QUICK_LOGIN, | ||
| 192 | - // // LoginWithHuaweiIDButton支持按钮的样式跟随系统深浅色模式切换。 | ||
| 193 | - // // supportDarkMode: true, | ||
| 194 | - // customButtonParams: { | ||
| 195 | - // fontColor: loginComponentManager.FontColor.WHITE, | ||
| 196 | - // // backgroundColor:!this.agreeProtocol ? "#60ED2800" : "#ED2800" | ||
| 197 | - // backgroundColor:"#ED2800" | ||
| 198 | - // } | ||
| 199 | - // }, | ||
| 200 | - // controller: this.controller | ||
| 201 | - // }).opacity(0) | ||
| 202 | - // } | ||
| 203 | - // .width('100%') | ||
| 204 | - // .height('100%') | 191 | + }, |
| 192 | + controller: this.controller | ||
| 193 | + }).opacity(0) | ||
| 194 | + } | ||
| 195 | + .width('100%') | ||
| 196 | + .height('100%') | ||
| 205 | } | 197 | } |
| 206 | } | 198 | } |
| 207 | .height(48) | 199 | .height(48) |
| @@ -261,11 +253,9 @@ struct OneKeyLoginPage { | @@ -261,11 +253,9 @@ struct OneKeyLoginPage { | ||
| 261 | .height(44) | 253 | .height(44) |
| 262 | } | 254 | } |
| 263 | 255 | ||
| 264 | - async requestLogin() { | 256 | + async requestLogin(phoneAuthorizedCode: string) { |
| 265 | try { | 257 | try { |
| 266 | - let authorizeCode = await HuaweiAuth.sharedInstance().requestProfile() | ||
| 267 | - | ||
| 268 | - let data = await this.viewModel.huaweiOneKeyLogin(authorizeCode) | 258 | + let data = await this.viewModel.huaweiOneKeyLogin(phoneAuthorizedCode) |
| 269 | 259 | ||
| 270 | Logger.debug(TAG, "requestLogin: " + data.jwtToken) | 260 | Logger.debug(TAG, "requestLogin: " + data.jwtToken) |
| 271 | this.showToastTip('登录成功') | 261 | this.showToastTip('登录成功') |
| @@ -292,15 +282,16 @@ struct OneKeyLoginPage { | @@ -292,15 +282,16 @@ struct OneKeyLoginPage { | ||
| 292 | } | 282 | } |
| 293 | 283 | ||
| 294 | queryUserDetail(){ | 284 | queryUserDetail(){ |
| 295 | - this.viewModel.queryUserDetail().then(()=>{ | ||
| 296 | - router.back({ | ||
| 297 | - url: `${WDRouterPage.getBundleInfo()}` | ||
| 298 | - } | ||
| 299 | - ) | ||
| 300 | - }).catch(()=>{ | ||
| 301 | - router.back({ | ||
| 302 | - url: `${WDRouterPage.getBundleInfo()}` | ||
| 303 | - }) | ||
| 304 | - }) | 285 | + router.back({ url: `${WDRouterPage.getBundleInfo()}` }) |
| 286 | + // this.viewModel.queryUserDetail().then(()=>{ | ||
| 287 | + // router.back({ | ||
| 288 | + // url: `${WDRouterPage.getBundleInfo()}` | ||
| 289 | + // } | ||
| 290 | + // ) | ||
| 291 | + // }).catch(()=>{ | ||
| 292 | + // router.back({ | ||
| 293 | + // url: `${WDRouterPage.getBundleInfo()}` | ||
| 294 | + // }) | ||
| 295 | + // }) | ||
| 305 | } | 296 | } |
| 306 | } | 297 | } |
| @@ -82,9 +82,8 @@ export default class HuaweiAuth { | @@ -82,9 +82,8 @@ export default class HuaweiAuth { | ||
| 82 | }) | 82 | }) |
| 83 | } | 83 | } |
| 84 | 84 | ||
| 85 | - // 华为账号一键登录授权 | ||
| 86 | - // 返回结果为 Authorization Code | ||
| 87 | - requestProfile() : Promise<string> { | 85 | + // 华为账号获取orofile信息 |
| 86 | + requestProfile() : Promise<WDHuaweiProfileData> { | ||
| 88 | 87 | ||
| 89 | // let loginRequest = new authentication.HuaweiIDProvider().createLoginWithHuaweiIDRequest(); | 88 | // let loginRequest = new authentication.HuaweiIDProvider().createLoginWithHuaweiIDRequest(); |
| 90 | // // 当用户未登录华为帐号时,是否强制拉起华为帐号登录界面 | 89 | // // 当用户未登录华为帐号时,是否强制拉起华为帐号登录界面 |
| @@ -94,7 +93,7 @@ export default class HuaweiAuth { | @@ -94,7 +93,7 @@ export default class HuaweiAuth { | ||
| 94 | // 创建授权请求,并设置参数 | 93 | // 创建授权请求,并设置参数 |
| 95 | let loginRequest = new authentication.HuaweiIDProvider().createAuthorizationWithHuaweiIDRequest(); | 94 | let loginRequest = new authentication.HuaweiIDProvider().createAuthorizationWithHuaweiIDRequest(); |
| 96 | // 获取头像昵称需要传如下scope | 95 | // 获取头像昵称需要传如下scope |
| 97 | - loginRequest.scopes = ['profile', 'phone']; //, 'phone' | 96 | + loginRequest.scopes = ['profile']; |
| 98 | // 若开发者需要进行服务端开发,则需传如下permission获取authorizationCode | 97 | // 若开发者需要进行服务端开发,则需传如下permission获取authorizationCode |
| 99 | loginRequest.permissions = ['serviceauthcode']; | 98 | loginRequest.permissions = ['serviceauthcode']; |
| 100 | // 用户是否需要登录授权,该值为true且用户未登录或未授权时,会拉起用户登录或授权页面 | 99 | // 用户是否需要登录授权,该值为true且用户未登录或未授权时,会拉起用户登录或授权页面 |
| @@ -107,29 +106,31 @@ export default class HuaweiAuth { | @@ -107,29 +106,31 @@ export default class HuaweiAuth { | ||
| 107 | let controller = new authentication.AuthenticationController(getContext(this)); | 106 | let controller = new authentication.AuthenticationController(getContext(this)); |
| 108 | controller.executeRequest(loginRequest, (err, data) => { | 107 | controller.executeRequest(loginRequest, (err, data) => { |
| 109 | if (err) { | 108 | if (err) { |
| 110 | - Logger.error(TAG, 'login fail, ' + JSON.stringify(err)) | 109 | + Logger.error(TAG, 'requestProfile fail, ' + JSON.stringify(err)) |
| 111 | fail(err) | 110 | fail(err) |
| 112 | return; | 111 | return; |
| 113 | } | 112 | } |
| 114 | - let loginWithHuaweiIDResponse = data as authentication.LoginWithHuaweiIDResponse; | 113 | + let loginWithHuaweiIDResponse = data as authentication.AuthorizationWithHuaweiIDResponse; |
| 115 | let state = loginWithHuaweiIDResponse.state; | 114 | let state = loginWithHuaweiIDResponse.state; |
| 116 | if (state != undefined && loginRequest.state != state) { | 115 | if (state != undefined && loginRequest.state != state) { |
| 117 | - Logger.error(TAG, 'login fail, The state is different' + JSON.stringify(loginWithHuaweiIDResponse)) | 116 | + Logger.error(TAG, 'requestProfile fail, The state is different' + JSON.stringify(loginWithHuaweiIDResponse)) |
| 118 | fail({ | 117 | fail({ |
| 119 | code: 99999, | 118 | code: 99999, |
| 120 | - name: "一键登录", | 119 | + name: "一键登录获取用户信息失败", |
| 121 | message:"状态错误:" + `请求状态 ${loginRequest.state}, 结果状态 ${state}` | 120 | message:"状态错误:" + `请求状态 ${loginRequest.state}, 结果状态 ${state}` |
| 122 | } as BusinessError) | 121 | } as BusinessError) |
| 123 | return; | 122 | return; |
| 124 | } | 123 | } |
| 125 | 124 | ||
| 126 | - Logger.info(TAG, 'login success, ' + JSON.stringify(loginWithHuaweiIDResponse)); | ||
| 127 | - let loginWithHuaweiIDCredential = loginWithHuaweiIDResponse.data!; | ||
| 128 | - let authorizationCode = loginWithHuaweiIDCredential.authorizationCode; | ||
| 129 | - resolve(authorizationCode!) | 125 | + Logger.info(TAG, 'requestProfile success, ' + JSON.stringify(loginWithHuaweiIDResponse)); |
| 126 | + let authorizationCode = loginWithHuaweiIDResponse.data?.authorizationCode; | ||
| 127 | + let nickName = loginWithHuaweiIDResponse.data?.nickName | ||
| 128 | + let avatarUri = loginWithHuaweiIDResponse.data?.avatarUri | ||
| 129 | + | ||
| 130 | + resolve({avatarUri: avatarUri, nickName: nickName } as WDHuaweiProfileData) | ||
| 130 | }); | 131 | }); |
| 131 | } catch (error) { | 132 | } catch (error) { |
| 132 | - Logger.error(TAG, 'login fail, ' + JSON.stringify(error)) | 133 | + Logger.error(TAG, 'requestProfile fail, ' + JSON.stringify(error)) |
| 133 | fail(error) | 134 | fail(error) |
| 134 | } | 135 | } |
| 135 | }); | 136 | }); |
| @@ -150,3 +151,8 @@ export default class HuaweiAuth { | @@ -150,3 +151,8 @@ export default class HuaweiAuth { | ||
| 150 | } | 151 | } |
| 151 | } | 152 | } |
| 152 | } | 153 | } |
| 154 | + | ||
| 155 | +export interface WDHuaweiProfileData { | ||
| 156 | + avatarUri?: string | ||
| 157 | + nickName?: string | ||
| 158 | +} |
-
Please register or login to post a comment