From 98fc308ef44228050ed1509b693804bf8d66d80b Mon Sep 17 00:00:00 2001 From: winter223 Date: Fri, 5 Aug 2022 00:22:19 +0900 Subject: [PATCH] =?UTF-8?q?[#30]=20=EB=A1=9C=EA=B7=B8=EC=9D=B8=20=EA=B8=B0?= =?UTF-8?q?=EB=8A=A5=20=EC=B6=94=EA=B0=80=20-=20converter=20=EC=A0=81?= =?UTF-8?q?=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../moyeorun_android/login/data/AuthRepository.kt | 4 ++-- .../login/data/impl/AuthRepositoryImpl.kt | 9 ++++----- .../moyerun/moyeorun_android/login/ui/LoginViewModel.kt | 2 +- .../network/MoyeorunNetworkDataSource.kt | 4 ++-- .../network/MoyeorunNetworkDataSourceImpl.kt | 4 ++-- .../moyerun/moyeorun_android/network/MoyeorunService.kt | 4 ++-- .../moyeorun_android/profile/ui/ProfileEditViewModel.kt | 2 +- 7 files changed, 14 insertions(+), 15 deletions(-) diff --git a/app/src/main/java/com/moyerun/moyeorun_android/login/data/AuthRepository.kt b/app/src/main/java/com/moyerun/moyeorun_android/login/data/AuthRepository.kt index 69fe49f..d39db81 100644 --- a/app/src/main/java/com/moyerun/moyeorun_android/login/data/AuthRepository.kt +++ b/app/src/main/java/com/moyerun/moyeorun_android/login/data/AuthRepository.kt @@ -10,7 +10,7 @@ interface AuthRepository { suspend fun signIn( idToken: String, providerType: ProviderType - ): ApiResult> + ): ApiResult - suspend fun signUp(signUpRequest: SignUpRequest): ApiResult> + suspend fun signUp(signUpRequest: SignUpRequest): ApiResult } \ No newline at end of file diff --git a/app/src/main/java/com/moyerun/moyeorun_android/login/data/impl/AuthRepositoryImpl.kt b/app/src/main/java/com/moyerun/moyeorun_android/login/data/impl/AuthRepositoryImpl.kt index 5755c7b..7742e9f 100644 --- a/app/src/main/java/com/moyerun/moyeorun_android/login/data/impl/AuthRepositoryImpl.kt +++ b/app/src/main/java/com/moyerun/moyeorun_android/login/data/impl/AuthRepositoryImpl.kt @@ -1,12 +1,11 @@ package com.moyerun.moyeorun_android.login.data.impl -import com.moyerun.moyeorun_android.common.Lg import com.moyerun.moyeorun_android.common.di.IODispatcher import com.moyerun.moyeorun_android.login.ProviderType import com.moyerun.moyeorun_android.login.data.AuthRepository -import com.moyerun.moyeorun_android.login.data.model.* +import com.moyerun.moyeorun_android.login.data.model.SignInResponse +import com.moyerun.moyeorun_android.login.data.model.SignUpRequest import com.moyerun.moyeorun_android.network.MoyeorunNetworkDataSource -import com.moyerun.moyeorun_android.network.api.Success import com.moyerun.moyeorun_android.network.calladapter.ApiResult import kotlinx.coroutines.CoroutineDispatcher import kotlinx.coroutines.withContext @@ -20,13 +19,13 @@ class AuthRepositoryImpl @Inject constructor( override suspend fun signIn( idToken: String, providerType: ProviderType - ): ApiResult> { + ): ApiResult { return withContext(coroutineDispatcher) { network.signIn(idToken = idToken, providerType = providerType) } } - override suspend fun signUp(signUpRequest: SignUpRequest): ApiResult> { + override suspend fun signUp(signUpRequest: SignUpRequest): ApiResult { return withContext(coroutineDispatcher) { network.signUp(signUpRequest) } diff --git a/app/src/main/java/com/moyerun/moyeorun_android/login/ui/LoginViewModel.kt b/app/src/main/java/com/moyerun/moyeorun_android/login/ui/LoginViewModel.kt index d14f3ac..0ddb415 100644 --- a/app/src/main/java/com/moyerun/moyeorun_android/login/ui/LoginViewModel.kt +++ b/app/src/main/java/com/moyerun/moyeorun_android/login/ui/LoginViewModel.kt @@ -37,7 +37,7 @@ class LoginViewModel @Inject constructor( _isLoading.value = true authRepository.signIn(idToken, providerType) .onSuccess { - _loginEvent.event = if (it.data.isNewUser) { + _loginEvent.event = if (it.isNewUser) { LoginEvent.NewUser(SignUpMetaData(idToken, providerType)) } else { LoginEvent.RegisteredUser diff --git a/app/src/main/java/com/moyerun/moyeorun_android/network/MoyeorunNetworkDataSource.kt b/app/src/main/java/com/moyerun/moyeorun_android/network/MoyeorunNetworkDataSource.kt index 3af2ea2..4a0d909 100644 --- a/app/src/main/java/com/moyerun/moyeorun_android/network/MoyeorunNetworkDataSource.kt +++ b/app/src/main/java/com/moyerun/moyeorun_android/network/MoyeorunNetworkDataSource.kt @@ -11,7 +11,7 @@ interface MoyeorunNetworkDataSource { suspend fun signIn( idToken: String, providerType: ProviderType - ): ApiResult> + ): ApiResult - suspend fun signUp(signUpRequest: SignUpRequest): ApiResult> + suspend fun signUp(signUpRequest: SignUpRequest): ApiResult } \ No newline at end of file diff --git a/app/src/main/java/com/moyerun/moyeorun_android/network/MoyeorunNetworkDataSourceImpl.kt b/app/src/main/java/com/moyerun/moyeorun_android/network/MoyeorunNetworkDataSourceImpl.kt index 9c0a691..a16e6fa 100644 --- a/app/src/main/java/com/moyerun/moyeorun_android/network/MoyeorunNetworkDataSourceImpl.kt +++ b/app/src/main/java/com/moyerun/moyeorun_android/network/MoyeorunNetworkDataSourceImpl.kt @@ -14,7 +14,7 @@ class MoyeorunNetworkDataSourceImpl( override suspend fun signIn( idToken: String, providerType: ProviderType - ): ApiResult> { + ): ApiResult { return moyeorunService.signIn( SignInRequest( idToken = idToken, @@ -23,7 +23,7 @@ class MoyeorunNetworkDataSourceImpl( ) } - override suspend fun signUp(signUpRequest: SignUpRequest): ApiResult> { + override suspend fun signUp(signUpRequest: SignUpRequest): ApiResult { return moyeorunService.signUp(signUpRequest) } } \ No newline at end of file diff --git a/app/src/main/java/com/moyerun/moyeorun_android/network/MoyeorunService.kt b/app/src/main/java/com/moyerun/moyeorun_android/network/MoyeorunService.kt index dbbe324..7e00e6c 100644 --- a/app/src/main/java/com/moyerun/moyeorun_android/network/MoyeorunService.kt +++ b/app/src/main/java/com/moyerun/moyeorun_android/network/MoyeorunService.kt @@ -11,8 +11,8 @@ import retrofit2.http.POST interface MoyeorunService { @POST("/api/auth/sign-in") - suspend fun signIn(@Body signInRequest: SignInRequest): ApiResult> + suspend fun signIn(@Body signInRequest: SignInRequest): ApiResult @POST("/api/auth/sign-up") - suspend fun signUp(@Body signUpRequest: SignUpRequest): ApiResult> + suspend fun signUp(@Body signUpRequest: SignUpRequest): ApiResult } \ No newline at end of file diff --git a/app/src/main/java/com/moyerun/moyeorun_android/profile/ui/ProfileEditViewModel.kt b/app/src/main/java/com/moyerun/moyeorun_android/profile/ui/ProfileEditViewModel.kt index 873f5f7..7c386f2 100644 --- a/app/src/main/java/com/moyerun/moyeorun_android/profile/ui/ProfileEditViewModel.kt +++ b/app/src/main/java/com/moyerun/moyeorun_android/profile/ui/ProfileEditViewModel.kt @@ -95,7 +95,7 @@ class ProfileEditViewModel @Inject constructor( authRepository.signUp(profileUiModel.value.toSignUpRequest(metaData)) .onSuccess { _profileEvent.event = ProfileEvent.SUCCESS_SIGN_UP - Lg.d(it.data.toString()) + Lg.d(it.toString()) } .onFailure { throwable -> when (throwable) {