diff --git a/account/src/main/java/com/hms/lib/commonmobileservices/account/SignInUser.kt b/account/src/main/java/com/hms/lib/commonmobileservices/account/SignInUser.kt index 3c09b220..f93711b8 100644 --- a/account/src/main/java/com/hms/lib/commonmobileservices/account/SignInUser.kt +++ b/account/src/main/java/com/hms/lib/commonmobileservices/account/SignInUser.kt @@ -21,24 +21,24 @@ import com.hms.lib.commonmobileservices.account.common.Scope * * @property familyName The family name of the user. * @property givenName The given name of the user. - * @property email The email address of the user, can be null if not available. + * @property email The email address of the user. * @property displayName The display name of the user. - * @property id The unique ID of the user. - * @property photoUrl The URI of the user's profile photo, can be null if not available. - * @property authServiceToken The authentication service token associated with the user. - * @property idToken The ID token associated with the user. - * @property accessToken The access token associated with the user. - * @property scopes The set of scopes granted to the user. + * @property id The unique identifier for the user. + * @property photoUrl The photo URL of the user. + * @property authServiceToken The authentication service token for the user. + * @property idToken The ID token for the user. + * @property accessToken The access token for the user. + * @property scopes The set of granted scopes for the user. */ data class SignInUser( - val familyName: String, - val givenName: String, + val familyName: String?, + val givenName: String?, val email: String?, - val displayName: String, - val id: String, + val displayName: String?, + val id: String?, val photoUrl: Uri?, - val authServiceToken: String, - val idToken: String, - val accessToken: String, - val scopes: Set + val authServiceToken: String?, + val idToken: String?, + val accessToken: String?, + val scopes: Set? ) \ No newline at end of file diff --git a/account/src/main/java/com/hms/lib/commonmobileservices/account/google/GoogleAccountServiceImpl.kt b/account/src/main/java/com/hms/lib/commonmobileservices/account/google/GoogleAccountServiceImpl.kt index 550c50ab..184b3551 100644 --- a/account/src/main/java/com/hms/lib/commonmobileservices/account/google/GoogleAccountServiceImpl.kt +++ b/account/src/main/java/com/hms/lib/commonmobileservices/account/google/GoogleAccountServiceImpl.kt @@ -131,7 +131,7 @@ internal class GoogleAccountServiceImpl(private val context: Context, signInPara val task = GoogleSignIn.getSignedInAccountFromIntent(intent) task.addOnSuccessListener { it.email?.let { it1 -> sharedPrefHelper.setEmail(it1) } - signInUser = mapper.map(task.result!!) + signInUser = mapper.map(task.result) callback.onSuccess(signInUser) } task.addOnFailureListener { callback.onFailure(task.exception!!) } diff --git a/account/src/main/java/com/hms/lib/commonmobileservices/account/google/GoogleUserMapper.kt b/account/src/main/java/com/hms/lib/commonmobileservices/account/google/GoogleUserMapper.kt index f897110d..718a2bb6 100644 --- a/account/src/main/java/com/hms/lib/commonmobileservices/account/google/GoogleUserMapper.kt +++ b/account/src/main/java/com/hms/lib/commonmobileservices/account/google/GoogleUserMapper.kt @@ -32,16 +32,16 @@ internal class GoogleUserMapper : Mapper() { * @throws NullPointerException if any required field in GoogleSignInAccount is null. */ override fun map(from: GoogleSignInAccount): SignInUser = SignInUser( - familyName = from.familyName!!, - givenName = from.givenName!!, - email = if (from.email == null) "" else from.email, - displayName = from.displayName!!, - id = from.id!!, - photoUrl = from.photoUrl!!, - authServiceToken = if (from.idToken == null) "" else from.idToken!!, - idToken = if (from.idToken == null) "" else from.idToken!!, + familyName = from.familyName, + givenName = from.givenName, + email = from.email, + displayName = from.displayName, + id = from.id, + photoUrl = from.photoUrl, + authServiceToken = from.idToken, + idToken = from.idToken, accessToken = "", - scopes = getGrantedScopes(from), + scopes = getGrantedScopes(from) ) /** diff --git a/account/src/main/java/com/hms/lib/commonmobileservices/account/huawei/HuaweiUserMapper.kt b/account/src/main/java/com/hms/lib/commonmobileservices/account/huawei/HuaweiUserMapper.kt index 2f5601c3..e210f43e 100644 --- a/account/src/main/java/com/hms/lib/commonmobileservices/account/huawei/HuaweiUserMapper.kt +++ b/account/src/main/java/com/hms/lib/commonmobileservices/account/huawei/HuaweiUserMapper.kt @@ -33,13 +33,13 @@ internal class HuaweiUserMapper : Mapper() { override fun map(from: AuthHuaweiId): SignInUser = SignInUser( familyName = from.familyName, givenName = from.givenName, - email = if (from.email == null) "" else from.email, + email = from.email, displayName = from.displayName, id = from.unionId, photoUrl = from.avatarUri, - authServiceToken = if (from.accessToken == null) "" else from.accessToken, - idToken = if (from.idToken == null) "" else from.idToken, - accessToken = if (from.accessToken == null) "" else from.accessToken, + authServiceToken = from.accessToken, + idToken = from.idToken, + accessToken = from.accessToken, scopes = getGrantedScopes(from) )