From 6d735ff9e68e102872501714c5f54348a0cfb44a Mon Sep 17 00:00:00 2001 From: Donghyeon0915 Date: Sat, 13 Apr 2024 18:15:20 +0900 Subject: [PATCH 01/13] =?UTF-8?q?[refactor]=20#346=20=EC=BD=94=EC=8A=A4=20?= =?UTF-8?q?=EC=A0=9C=EB=AA=A9=20=EC=88=98=EC=A0=95=20Response=20=EC=A0=9C?= =?UTF-8?q?=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../runnect/data/repository/UserRepositoryImpl.kt | 6 ++++-- .../mypage/history/detail/MyHistoryDetailActivity.kt | 3 +-- .../mypage/history/detail/MyHistoryDetailViewModel.kt | 10 +++++----- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/app/src/main/java/com/runnect/runnect/data/repository/UserRepositoryImpl.kt b/app/src/main/java/com/runnect/runnect/data/repository/UserRepositoryImpl.kt index 045cc4bc8..f9728027e 100644 --- a/app/src/main/java/com/runnect/runnect/data/repository/UserRepositoryImpl.kt +++ b/app/src/main/java/com/runnect/runnect/data/repository/UserRepositoryImpl.kt @@ -45,8 +45,10 @@ class UserRepositoryImpl @Inject constructor(private val remoteUserDataSource: R override suspend fun patchHistoryTitle( historyId: Int, requestPatchHistoryTitle: RequestPatchHistoryTitle - ): Flow> = - remoteUserDataSource.patchHistoryTitle(historyId, requestPatchHistoryTitle).mapToFlowResult { it } + ): Flow> = + remoteUserDataSource.patchHistoryTitle(historyId, requestPatchHistoryTitle).mapToFlowResult { + it.record.title + } override suspend fun deleteUser(): Flow> { return remoteUserDataSource.deleteUser().mapToFlowResult { it } diff --git a/app/src/main/java/com/runnect/runnect/presentation/mypage/history/detail/MyHistoryDetailActivity.kt b/app/src/main/java/com/runnect/runnect/presentation/mypage/history/detail/MyHistoryDetailActivity.kt index 87c9b6914..a918ea023 100644 --- a/app/src/main/java/com/runnect/runnect/presentation/mypage/history/detail/MyHistoryDetailActivity.kt +++ b/app/src/main/java/com/runnect/runnect/presentation/mypage/history/detail/MyHistoryDetailActivity.kt @@ -202,8 +202,7 @@ class MyHistoryDetailActivity : dismissLoadingProgressBar() enterReadMode() - val response = state.data ?: return@observe - val newTitle = response.record.title + val newTitle = state.data viewModel.updateHistoryTitle(newTitle) showToast(getString(R.string.course_detail_title_edit_success_msg)) diff --git a/app/src/main/java/com/runnect/runnect/presentation/mypage/history/detail/MyHistoryDetailViewModel.kt b/app/src/main/java/com/runnect/runnect/presentation/mypage/history/detail/MyHistoryDetailViewModel.kt index d2a13284c..8118bdc93 100644 --- a/app/src/main/java/com/runnect/runnect/presentation/mypage/history/detail/MyHistoryDetailViewModel.kt +++ b/app/src/main/java/com/runnect/runnect/presentation/mypage/history/detail/MyHistoryDetailViewModel.kt @@ -8,6 +8,7 @@ import com.runnect.runnect.data.dto.request.RequestPatchHistoryTitle import com.runnect.runnect.data.dto.response.ResponseDeleteHistory import com.runnect.runnect.data.dto.response.ResponsePatchHistoryTitle import com.runnect.runnect.domain.common.toLog +import com.runnect.runnect.domain.entity.CourseTitle import com.runnect.runnect.domain.repository.UserRepository import com.runnect.runnect.presentation.base.BaseViewModel import com.runnect.runnect.presentation.state.UiStateV2 @@ -22,13 +23,12 @@ class MyHistoryDetailViewModel @Inject constructor( private val userRepository: UserRepository ) : BaseViewModel() { - private val _historyDeleteState = - MutableLiveData>() - val historyDeleteState: LiveData> + private val _historyDeleteState = MutableLiveData>() + val historyDeleteState: LiveData> get() = _historyDeleteState - private val _titlePatchState = MutableLiveData>() - val titlePatchState: LiveData> + private val _titlePatchState = MutableLiveData>() + val titlePatchState: LiveData> get() = _titlePatchState val _title = MutableLiveData("") From 795e73866e8921beae6864ff2452b48b7af13536 Mon Sep 17 00:00:00 2001 From: Donghyeon0915 Date: Sat, 13 Apr 2024 18:17:25 +0900 Subject: [PATCH 02/13] =?UTF-8?q?[refactor]=20#346=20=EA=B8=B0=EB=A1=9D=20?= =?UTF-8?q?=EC=97=85=EB=A1=9C=EB=93=9C=20Response=20=EC=A0=9C=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../runnect/runnect/data/repository/CourseRepositoryImpl.kt | 4 ++-- .../com/runnect/runnect/domain/repository/CourseRepository.kt | 2 +- .../runnect/runnect/presentation/endrun/EndRunViewModel.kt | 2 -- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/com/runnect/runnect/data/repository/CourseRepositoryImpl.kt b/app/src/main/java/com/runnect/runnect/data/repository/CourseRepositoryImpl.kt index 1bde045ea..a20378cc0 100644 --- a/app/src/main/java/com/runnect/runnect/data/repository/CourseRepositoryImpl.kt +++ b/app/src/main/java/com/runnect/runnect/data/repository/CourseRepositoryImpl.kt @@ -93,8 +93,8 @@ class CourseRepositoryImpl @Inject constructor(private val remoteCourseDataSourc it.toEditableCourseDetail() } - override suspend fun postRecord(request: RequestPostRunningHistory): Flow> { - return remoteCourseDataSource.postRecord(request = request).mapToFlowResult { it } + override suspend fun postRecord(request: RequestPostRunningHistory): Flow> { + return remoteCourseDataSource.postRecord(request = request).mapToFlowResult {} } override suspend fun uploadCourse( diff --git a/app/src/main/java/com/runnect/runnect/domain/repository/CourseRepository.kt b/app/src/main/java/com/runnect/runnect/domain/repository/CourseRepository.kt index 6163542b9..cacbc5fc8 100644 --- a/app/src/main/java/com/runnect/runnect/domain/repository/CourseRepository.kt +++ b/app/src/main/java/com/runnect/runnect/domain/repository/CourseRepository.kt @@ -48,7 +48,7 @@ interface CourseRepository { requestPatchPublicCourse: RequestPatchPublicCourse ): Flow> - suspend fun postRecord(request: RequestPostRunningHistory): Flow> + suspend fun postRecord(request: RequestPostRunningHistory): Flow> suspend fun uploadCourse( image: MultipartBody.Part, data: RequestBody diff --git a/app/src/main/java/com/runnect/runnect/presentation/endrun/EndRunViewModel.kt b/app/src/main/java/com/runnect/runnect/presentation/endrun/EndRunViewModel.kt index 03ca0c344..dc115ac08 100644 --- a/app/src/main/java/com/runnect/runnect/presentation/endrun/EndRunViewModel.kt +++ b/app/src/main/java/com/runnect/runnect/presentation/endrun/EndRunViewModel.kt @@ -25,7 +25,6 @@ class EndRunViewModel @Inject constructor(private val courseRepository: CourseRe val courseId = MutableLiveData() val publicCourseId = MutableLiveData() val editTextValue = MutableLiveData() - val uploadResult = MutableLiveData() val errorMessage = MutableLiveData() val currentTime = MutableLiveData() val dataFrom = MutableLiveData() @@ -49,7 +48,6 @@ class EndRunViewModel @Inject constructor(private val courseRepository: CourseRe _endRunState.value = UiState.Loading }.collectResult( onSuccess = { - uploadResult.value = it _endRunState.value = UiState.Success }, onFailure = { From 826f4f115827665da81ec4ac0b036f55a7dc0f8e Mon Sep 17 00:00:00 2001 From: Donghyeon0915 Date: Sat, 13 Apr 2024 18:18:34 +0900 Subject: [PATCH 03/13] =?UTF-8?q?[refactor]=20#346=20=EC=BD=94=EC=8A=A4=20?= =?UTF-8?q?=EC=82=AD=EC=A0=9C=20Response=20=EC=A0=9C=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../runnect/runnect/data/repository/CourseRepositoryImpl.kt | 4 ++-- .../com/runnect/runnect/domain/repository/CourseRepository.kt | 2 +- .../runnect/presentation/detail/CourseDetailViewModel.kt | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/com/runnect/runnect/data/repository/CourseRepositoryImpl.kt b/app/src/main/java/com/runnect/runnect/data/repository/CourseRepositoryImpl.kt index a20378cc0..35c935c2e 100644 --- a/app/src/main/java/com/runnect/runnect/data/repository/CourseRepositoryImpl.kt +++ b/app/src/main/java/com/runnect/runnect/data/repository/CourseRepositoryImpl.kt @@ -66,8 +66,8 @@ class CourseRepositoryImpl @Inject constructor(private val remoteCourseDataSourc return remoteCourseDataSource.getMyDrawDetail(courseId = courseId).mapToFlowResult { it } } - override suspend fun deleteMyDrawCourse(deleteCourseList: RequestPutMyDrawCourse): Flow> { - return remoteCourseDataSource.deleteMyDrawCourse(deleteCourseList = deleteCourseList).mapToFlowResult { it } + override suspend fun deleteMyDrawCourse(deleteCourseList: RequestPutMyDrawCourse): Flow> { + return remoteCourseDataSource.deleteMyDrawCourse(deleteCourseList = deleteCourseList).mapToFlowResult {} } override suspend fun postCourseScrap( diff --git a/app/src/main/java/com/runnect/runnect/domain/repository/CourseRepository.kt b/app/src/main/java/com/runnect/runnect/domain/repository/CourseRepository.kt index cacbc5fc8..b3d92a744 100644 --- a/app/src/main/java/com/runnect/runnect/domain/repository/CourseRepository.kt +++ b/app/src/main/java/com/runnect/runnect/domain/repository/CourseRepository.kt @@ -37,7 +37,7 @@ interface CourseRepository { suspend fun getMyDrawDetail(courseId: Int): Flow> - suspend fun deleteMyDrawCourse(deleteCourseList: RequestPutMyDrawCourse): Flow> + suspend fun deleteMyDrawCourse(deleteCourseList: RequestPutMyDrawCourse): Flow> suspend fun postCourseScrap(requestPostCourseScrap: RequestPostCourseScrap): Flow> diff --git a/app/src/main/java/com/runnect/runnect/presentation/detail/CourseDetailViewModel.kt b/app/src/main/java/com/runnect/runnect/presentation/detail/CourseDetailViewModel.kt index 1759be7ba..c9cc9532d 100644 --- a/app/src/main/java/com/runnect/runnect/presentation/detail/CourseDetailViewModel.kt +++ b/app/src/main/java/com/runnect/runnect/presentation/detail/CourseDetailViewModel.kt @@ -35,8 +35,8 @@ class CourseDetailViewModel @Inject constructor( val coursePatchState: LiveData> get() = _coursePatchState - private val _courseDeleteState = MutableLiveData>() - val courseDeleteState: LiveData> + private val _courseDeleteState = MutableLiveData>() + val courseDeleteState: LiveData> get() = _courseDeleteState private val _courseScrapState = MutableLiveData>() From b75fdeb558a67b61e56ad4db2f51c7b0cc865878 Mon Sep 17 00:00:00 2001 From: Donghyeon0915 Date: Sat, 13 Apr 2024 18:19:28 +0900 Subject: [PATCH 04/13] =?UTF-8?q?[refactor]=20#346=20=EB=82=B4=EA=B0=80=20?= =?UTF-8?q?=EA=B7=B8=EB=A6=B0=20=EC=BD=94=EC=8A=A4=20=EC=97=85=EB=A1=9C?= =?UTF-8?q?=EB=93=9C=20Response=20=EC=A0=9C=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../runnect/runnect/data/repository/CourseRepositoryImpl.kt | 4 ++-- .../com/runnect/runnect/domain/repository/CourseRepository.kt | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/com/runnect/runnect/data/repository/CourseRepositoryImpl.kt b/app/src/main/java/com/runnect/runnect/data/repository/CourseRepositoryImpl.kt index 35c935c2e..c74444538 100644 --- a/app/src/main/java/com/runnect/runnect/data/repository/CourseRepositoryImpl.kt +++ b/app/src/main/java/com/runnect/runnect/data/repository/CourseRepositoryImpl.kt @@ -78,8 +78,8 @@ class CourseRepositoryImpl @Inject constructor(private val remoteCourseDataSourc } } - override suspend fun postUploadMyCourse(requestPostPublicCourse: RequestPostPublicCourse): Flow> { - return remoteCourseDataSource.postUploadMyCourse(requestPostPublicCourse = requestPostPublicCourse).mapToFlowResult { it } + override suspend fun postUploadMyCourse(requestPostPublicCourse: RequestPostPublicCourse): Flow> { + return remoteCourseDataSource.postUploadMyCourse(requestPostPublicCourse = requestPostPublicCourse).mapToFlowResult {} } override suspend fun patchPublicCourse( diff --git a/app/src/main/java/com/runnect/runnect/domain/repository/CourseRepository.kt b/app/src/main/java/com/runnect/runnect/domain/repository/CourseRepository.kt index b3d92a744..7b36aec68 100644 --- a/app/src/main/java/com/runnect/runnect/domain/repository/CourseRepository.kt +++ b/app/src/main/java/com/runnect/runnect/domain/repository/CourseRepository.kt @@ -41,7 +41,7 @@ interface CourseRepository { suspend fun postCourseScrap(requestPostCourseScrap: RequestPostCourseScrap): Flow> - suspend fun postUploadMyCourse(requestPostPublicCourse: RequestPostPublicCourse): Flow> + suspend fun postUploadMyCourse(requestPostPublicCourse: RequestPostPublicCourse): Flow> suspend fun patchPublicCourse( publicCourseId: Int, From f08a5ab96a2c2a88139cf558dfe0051db4941025 Mon Sep 17 00:00:00 2001 From: Donghyeon0915 Date: Sat, 13 Apr 2024 18:21:09 +0900 Subject: [PATCH 05/13] =?UTF-8?q?[refactor]=20#346=20=EC=BD=94=EC=8A=A4=20?= =?UTF-8?q?=EC=97=85=EB=A1=9C=EB=93=9C=20Response=20=EC=A0=9C=EA=B1=B0=20+?= =?UTF-8?q?=20=EC=BD=94=EB=93=9C=20=EC=A0=95=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../data/repository/CourseRepositoryImpl.kt | 6 ++- .../domain/repository/CourseRepository.kt | 2 +- .../runnect/presentation/draw/DrawActivity.kt | 18 ++++----- .../presentation/draw/DrawViewModel.kt | 37 +++++++++---------- .../presentation/endrun/EndRunActivity.kt | 1 - 5 files changed, 31 insertions(+), 33 deletions(-) diff --git a/app/src/main/java/com/runnect/runnect/data/repository/CourseRepositoryImpl.kt b/app/src/main/java/com/runnect/runnect/data/repository/CourseRepositoryImpl.kt index c74444538..021271227 100644 --- a/app/src/main/java/com/runnect/runnect/data/repository/CourseRepositoryImpl.kt +++ b/app/src/main/java/com/runnect/runnect/data/repository/CourseRepositoryImpl.kt @@ -100,7 +100,9 @@ class CourseRepositoryImpl @Inject constructor(private val remoteCourseDataSourc override suspend fun uploadCourse( image: MultipartBody.Part, data: RequestBody - ): Flow> { - return remoteCourseDataSource.uploadCourse(image = image, data = data).mapToFlowResult { it } + ): Flow> { + return remoteCourseDataSource.uploadCourse(image = image, data = data).mapToFlowResult { + it.id + } } } \ No newline at end of file diff --git a/app/src/main/java/com/runnect/runnect/domain/repository/CourseRepository.kt b/app/src/main/java/com/runnect/runnect/domain/repository/CourseRepository.kt index 7b36aec68..0bace98ab 100644 --- a/app/src/main/java/com/runnect/runnect/domain/repository/CourseRepository.kt +++ b/app/src/main/java/com/runnect/runnect/domain/repository/CourseRepository.kt @@ -52,5 +52,5 @@ interface CourseRepository { suspend fun uploadCourse( image: MultipartBody.Part, data: RequestBody - ): Flow> + ): Flow> } \ No newline at end of file diff --git a/app/src/main/java/com/runnect/runnect/presentation/draw/DrawActivity.kt b/app/src/main/java/com/runnect/runnect/presentation/draw/DrawActivity.kt index 1a17535d2..2f99636a7 100644 --- a/app/src/main/java/com/runnect/runnect/presentation/draw/DrawActivity.kt +++ b/app/src/main/java/com/runnect/runnect/presentation/draw/DrawActivity.kt @@ -162,7 +162,7 @@ class DrawActivity : BindingActivity(R.layout.activity_draw binding.tvGuide.isVisible = false viewModel.searchResult.value = searchResult - viewModel.departureName.value = searchResult.name + viewModel.departureName = searchResult.name setDepartureLatLng( latLng = LatLng( @@ -515,11 +515,11 @@ class DrawActivity : BindingActivity(R.layout.activity_draw if (isCustomLocationMode) departureLatLng = customDepartureLatLng val courseData = CourseData( - courseId = viewModel.uploadResult.value?.data?.id, + courseId = viewModel.uploadCourseId, publicCourseId = null, //직접 생성하는 코스는 publicCourseId가 없지만 코스 발견 -> 러닝 등의 루트로 넘어올 시 기록 업로드에서 requestBody에 필요함 touchList = touchList, startLatLng = departureLatLng, - departure = viewModel.departureName.value, + departure = viewModel.departureName, distance = viewModel.distanceSum.value, image = captureUri.toString(), dataFrom = "fromDrawCourse" @@ -791,18 +791,18 @@ class DrawActivity : BindingActivity(R.layout.activity_draw val uploadLatLngList: List = distanceList.map { latLng -> UploadLatLng(latLng.latitude, latLng.longitude) } - viewModel.path.value = uploadLatLngList + viewModel.path = uploadLatLngList when { isSearchLocationMode -> { - viewModel.departureAddress.value = searchResult.fullAddress - viewModel.departureName.value = searchResult.name + viewModel.departureAddress = searchResult.fullAddress + viewModel.departureName = searchResult.name } isCurrentLocationMode || isCustomLocationMode -> { - viewModel.departureAddress.value = - viewModel.reverseGeocodingResult.value?.fullAddress - viewModel.departureName.value = + viewModel.departureAddress = + viewModel.reverseGeocodingResult.value?.fullAddress ?: "" + viewModel.departureName = viewModel.reverseGeocodingResult.value?.buildingName ?: "내가 설정한 출발지" } } diff --git a/app/src/main/java/com/runnect/runnect/presentation/draw/DrawViewModel.kt b/app/src/main/java/com/runnect/runnect/presentation/draw/DrawViewModel.kt index 149bb7869..e7acb1752 100644 --- a/app/src/main/java/com/runnect/runnect/presentation/draw/DrawViewModel.kt +++ b/app/src/main/java/com/runnect/runnect/presentation/draw/DrawViewModel.kt @@ -4,7 +4,6 @@ import androidx.lifecycle.LiveData import androidx.lifecycle.MutableLiveData import com.runnect.runnect.data.dto.SearchResultEntity import com.runnect.runnect.data.dto.UploadLatLng -import com.runnect.runnect.data.dto.response.ResponsePostMyDrawCourse import com.runnect.runnect.domain.common.toLog import com.runnect.runnect.domain.entity.LocationData import com.runnect.runnect.domain.repository.CourseRepository @@ -15,6 +14,7 @@ import com.runnect.runnect.util.extension.collectResult import com.runnect.runnect.util.multipart.ContentUriRequestBody import dagger.hilt.android.lifecycle.HiltViewModel import kotlinx.coroutines.flow.onStart +import timber.log.Timber import javax.inject.Inject import kotlin.math.acos @@ -30,15 +30,20 @@ class DrawViewModel @Inject constructor( val searchResult = MutableLiveData() - val path = MutableLiveData>() + var path: List = listOf( + UploadLatLng( + 37.52901832956373, + 126.9136196847032 + ) + ) var distanceSum = MutableLiveData(0.0f) - val departureAddress = MutableLiveData() - var courseTitle = "" - val departureName = MutableLiveData("내가 설정한 출발지") val isBtnAvailable = MutableLiveData(false) - val reverseGeocodingResult = MutableLiveData() + var departureAddress: String = "" + var departureName: String = "내가 설정한 출발지" + var courseTitle: String = "" + var uploadCourseId: Int? = null private val _image = MutableLiveData() val image: LiveData @@ -48,9 +53,6 @@ class DrawViewModel @Inject constructor( _image.value = requestBody } - val uploadResult = MutableLiveData() - val errorMessage = MutableLiveData() - fun distance(lat1: Double, lon1: Double, lat2: Double, lon2: Double, unit: String): Double { @@ -87,27 +89,22 @@ class DrawViewModel @Inject constructor( courseRepository.uploadCourse( image = _image.value!!.toFormData(), data = CourseCreateRequestDto( - path = path.value ?: listOf( - UploadLatLng( - 37.52901832956373, - 126.9136196847032 - ) - ), + path = path, title = courseTitle, distance = distanceSum.value!!, - departureAddress = departureAddress.value!!, - departureName = departureName.value!! + departureAddress = departureAddress, + departureName = departureName ).toRequestBody() ).onStart { _drawState.value = UiState.Loading }.collectResult( onSuccess = { - uploadResult.value = it + uploadCourseId = it _drawState.value = UiState.Success }, onFailure = { - errorMessage.value = it.message _drawState.value = UiState.Failure + Timber.e(it.toLog()) } ) } @@ -122,7 +119,7 @@ class DrawViewModel @Inject constructor( reverseGeocodingResult.value = it }, onFailure = { - errorMessage.value = it.toLog() + Timber.e(it.toLog()) } ) } diff --git a/app/src/main/java/com/runnect/runnect/presentation/endrun/EndRunActivity.kt b/app/src/main/java/com/runnect/runnect/presentation/endrun/EndRunActivity.kt index d5ab7b3c7..56eec2de3 100644 --- a/app/src/main/java/com/runnect/runnect/presentation/endrun/EndRunActivity.kt +++ b/app/src/main/java/com/runnect/runnect/presentation/endrun/EndRunActivity.kt @@ -200,7 +200,6 @@ class EndRunActivity: BindingActivity(R.layout.activity_e private fun notifyUploadFinish() { RunnectToast.createToast(this@EndRunActivity, "저장한 러닝 기록은 마이페이지에서 볼 수 있어요").show() - Timber.tag(ContentValues.TAG).d("서버 성공 : ${viewModel.uploadResult.value!!.message}") } private fun showErrorMessage() { From c5fb75b2ae6f29df2842d51bce95017f127ffe36 Mon Sep 17 00:00:00 2001 From: Donghyeon0915 Date: Sat, 13 Apr 2024 18:21:41 +0900 Subject: [PATCH 06/13] =?UTF-8?q?[refactor]=20#346=20=EC=97=85=EB=A1=9C?= =?UTF-8?q?=EB=93=9C=ED=95=9C=20=EC=BD=94=EB=93=9C=20=EC=82=AD=EC=A0=9C=20?= =?UTF-8?q?Response=20=EC=A0=9C=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/runnect/runnect/data/repository/UserRepositoryImpl.kt | 4 ++-- .../com/runnect/runnect/domain/repository/UserRepository.kt | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/com/runnect/runnect/data/repository/UserRepositoryImpl.kt b/app/src/main/java/com/runnect/runnect/data/repository/UserRepositoryImpl.kt index f9728027e..a8302f01d 100644 --- a/app/src/main/java/com/runnect/runnect/data/repository/UserRepositoryImpl.kt +++ b/app/src/main/java/com/runnect/runnect/data/repository/UserRepositoryImpl.kt @@ -33,8 +33,8 @@ class UserRepositoryImpl @Inject constructor(private val remoteUserDataSource: R override suspend fun putDeleteUploadCourse( requestDeleteUploadCourse: RequestDeleteUploadCourse - ): Flow> { - return remoteUserDataSource.putDeleteUploadCourse(requestDeleteUploadCourse).mapToFlowResult { it } + ): Flow> { + return remoteUserDataSource.putDeleteUploadCourse(requestDeleteUploadCourse).mapToFlowResult {} } override suspend fun putDeleteHistory( diff --git a/app/src/main/java/com/runnect/runnect/domain/repository/UserRepository.kt b/app/src/main/java/com/runnect/runnect/domain/repository/UserRepository.kt index 45fb41834..b570fd64e 100644 --- a/app/src/main/java/com/runnect/runnect/domain/repository/UserRepository.kt +++ b/app/src/main/java/com/runnect/runnect/domain/repository/UserRepository.kt @@ -22,7 +22,7 @@ interface UserRepository { suspend fun putDeleteUploadCourse( requestDeleteUploadCourse: RequestDeleteUploadCourse - ): Flow> + ): Flow> suspend fun putDeleteHistory(requestDeleteHistory: RequestDeleteHistory): Flow> From 3f0a758f33a428fae3ca2e20f1aae924054a3c73 Mon Sep 17 00:00:00 2001 From: Donghyeon0915 Date: Sat, 13 Apr 2024 18:22:04 +0900 Subject: [PATCH 07/13] =?UTF-8?q?[refactor]=20#346=20=EB=82=B4=EA=B0=80=20?= =?UTF-8?q?=EA=B7=B8=EB=A6=B0=20=EC=BD=94=EC=8A=A4=20=EC=82=AD=EC=A0=9C=20?= =?UTF-8?q?Response=20=EC=A0=9C=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../runnect/runnect/data/repository/StorageRepositoryImpl.kt | 4 ++-- .../runnect/runnect/domain/repository/StorageRepository.kt | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/com/runnect/runnect/data/repository/StorageRepositoryImpl.kt b/app/src/main/java/com/runnect/runnect/data/repository/StorageRepositoryImpl.kt index 94fb3a28a..81efb18c7 100644 --- a/app/src/main/java/com/runnect/runnect/data/repository/StorageRepositoryImpl.kt +++ b/app/src/main/java/com/runnect/runnect/data/repository/StorageRepositoryImpl.kt @@ -18,8 +18,8 @@ class StorageRepositoryImpl @Inject constructor( override suspend fun getMyDrawCourse(): Flow>> = remoteStorageDataSource.getMyDrawCourse().mapToFlowResult { it.toMyDrawCourse() } - override suspend fun deleteMyDrawCourse(deleteCourseList: RequestPutMyDrawCourse): Flow> { - return remoteStorageDataSource.deleteMyDrawCourse(deleteCourseList = deleteCourseList).mapToFlowResult { it } + override suspend fun deleteMyDrawCourse(deleteCourseList: RequestPutMyDrawCourse): Flow> { + return remoteStorageDataSource.deleteMyDrawCourse(deleteCourseList = deleteCourseList).mapToFlowResult {} } override suspend fun getMyScrapCourse(): Flow>> = diff --git a/app/src/main/java/com/runnect/runnect/domain/repository/StorageRepository.kt b/app/src/main/java/com/runnect/runnect/domain/repository/StorageRepository.kt index 258841be9..6001dcc5b 100644 --- a/app/src/main/java/com/runnect/runnect/domain/repository/StorageRepository.kt +++ b/app/src/main/java/com/runnect/runnect/domain/repository/StorageRepository.kt @@ -9,5 +9,5 @@ import kotlinx.coroutines.flow.Flow interface StorageRepository { suspend fun getMyDrawCourse(): Flow>> suspend fun getMyScrapCourse(): Flow>> - suspend fun deleteMyDrawCourse(deleteCourseList: RequestPutMyDrawCourse) : Flow> + suspend fun deleteMyDrawCourse(deleteCourseList: RequestPutMyDrawCourse) : Flow> } \ No newline at end of file From e91e89ef66580489c11918da531b107b6051271e Mon Sep 17 00:00:00 2001 From: Donghyeon0915 Date: Sat, 13 Apr 2024 18:22:26 +0900 Subject: [PATCH 08/13] =?UTF-8?q?[refactor]=20#346=20=EA=B8=B0=EB=A1=9D=20?= =?UTF-8?q?=EC=82=AD=EC=A0=9C=20Response=20=EC=A0=9C=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/runnect/runnect/data/repository/UserRepositoryImpl.kt | 4 ++-- .../com/runnect/runnect/domain/repository/UserRepository.kt | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/com/runnect/runnect/data/repository/UserRepositoryImpl.kt b/app/src/main/java/com/runnect/runnect/data/repository/UserRepositoryImpl.kt index a8302f01d..8b925aaa2 100644 --- a/app/src/main/java/com/runnect/runnect/data/repository/UserRepositoryImpl.kt +++ b/app/src/main/java/com/runnect/runnect/data/repository/UserRepositoryImpl.kt @@ -39,8 +39,8 @@ class UserRepositoryImpl @Inject constructor(private val remoteUserDataSource: R override suspend fun putDeleteHistory( requestDeleteHistory: RequestDeleteHistory - ): Flow> { - return remoteUserDataSource.putDeleteHistory(requestDeleteHistory).mapToFlowResult { it } + ): Flow> { + return remoteUserDataSource.putDeleteHistory(requestDeleteHistory).mapToFlowResult {} } override suspend fun patchHistoryTitle( diff --git a/app/src/main/java/com/runnect/runnect/domain/repository/UserRepository.kt b/app/src/main/java/com/runnect/runnect/domain/repository/UserRepository.kt index b570fd64e..abbc98b6c 100644 --- a/app/src/main/java/com/runnect/runnect/domain/repository/UserRepository.kt +++ b/app/src/main/java/com/runnect/runnect/domain/repository/UserRepository.kt @@ -24,7 +24,7 @@ interface UserRepository { requestDeleteUploadCourse: RequestDeleteUploadCourse ): Flow> - suspend fun putDeleteHistory(requestDeleteHistory: RequestDeleteHistory): Flow> + suspend fun putDeleteHistory(requestDeleteHistory: RequestDeleteHistory): Flow> suspend fun deleteUser(): Flow> From ec158f545c465f07d3151d94d12d4a4545a0aae4 Mon Sep 17 00:00:00 2001 From: Donghyeon0915 Date: Sat, 13 Apr 2024 18:22:49 +0900 Subject: [PATCH 09/13] =?UTF-8?q?[refactor]=20#346=20=ED=9A=8C=EC=9B=90=20?= =?UTF-8?q?=ED=83=88=ED=87=B4=20Response=20=EC=A0=9C=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/runnect/runnect/data/repository/UserRepositoryImpl.kt | 4 ++-- .../com/runnect/runnect/domain/repository/UserRepository.kt | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/com/runnect/runnect/data/repository/UserRepositoryImpl.kt b/app/src/main/java/com/runnect/runnect/data/repository/UserRepositoryImpl.kt index 8b925aaa2..ea257ed5a 100644 --- a/app/src/main/java/com/runnect/runnect/data/repository/UserRepositoryImpl.kt +++ b/app/src/main/java/com/runnect/runnect/data/repository/UserRepositoryImpl.kt @@ -50,8 +50,8 @@ class UserRepositoryImpl @Inject constructor(private val remoteUserDataSource: R it.record.title } - override suspend fun deleteUser(): Flow> { - return remoteUserDataSource.deleteUser().mapToFlowResult { it } + override suspend fun deleteUser(): Flow> { + return remoteUserDataSource.deleteUser().mapToFlowResult {} } override suspend fun updateNickName( diff --git a/app/src/main/java/com/runnect/runnect/domain/repository/UserRepository.kt b/app/src/main/java/com/runnect/runnect/domain/repository/UserRepository.kt index abbc98b6c..9532a4871 100644 --- a/app/src/main/java/com/runnect/runnect/domain/repository/UserRepository.kt +++ b/app/src/main/java/com/runnect/runnect/domain/repository/UserRepository.kt @@ -26,7 +26,7 @@ interface UserRepository { suspend fun putDeleteHistory(requestDeleteHistory: RequestDeleteHistory): Flow> - suspend fun deleteUser(): Flow> + suspend fun deleteUser(): Flow> suspend fun getRecord(): Flow>> From b5639b77f330e328354f49791671f70b48ff316c Mon Sep 17 00:00:00 2001 From: Donghyeon0915 Date: Sat, 13 Apr 2024 18:23:27 +0900 Subject: [PATCH 10/13] =?UTF-8?q?[refactor]=20#346=20=EA=B8=B0=EB=A1=9D=20?= =?UTF-8?q?=EC=A0=9C=EB=AA=A9=20=EC=88=98=EC=A0=95=20Response=20=EC=A0=9C?= =?UTF-8?q?=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/runnect/runnect/domain/repository/UserRepository.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/java/com/runnect/runnect/domain/repository/UserRepository.kt b/app/src/main/java/com/runnect/runnect/domain/repository/UserRepository.kt index 9532a4871..a263d6837 100644 --- a/app/src/main/java/com/runnect/runnect/domain/repository/UserRepository.kt +++ b/app/src/main/java/com/runnect/runnect/domain/repository/UserRepository.kt @@ -35,7 +35,7 @@ interface UserRepository { suspend fun patchHistoryTitle( historyId: Int, requestPatchHistoryTitle: RequestPatchHistoryTitle - ): Flow> + ): Flow> suspend fun updateNickName( requestPatchNickName: RequestPatchNickName From 552d54b2ef7b9bd71dee089f5179a77e3191ef74 Mon Sep 17 00:00:00 2001 From: Donghyeon0915 Date: Sat, 13 Apr 2024 18:24:06 +0900 Subject: [PATCH 11/13] =?UTF-8?q?[refactor]=20#346=20=EB=8B=89=EB=84=A4?= =?UTF-8?q?=EC=9E=84=20=EC=88=98=EC=A0=95=20Response=20=EC=A0=9C=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/runnect/runnect/data/repository/UserRepositoryImpl.kt | 4 ++-- .../com/runnect/runnect/domain/repository/UserRepository.kt | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/com/runnect/runnect/data/repository/UserRepositoryImpl.kt b/app/src/main/java/com/runnect/runnect/data/repository/UserRepositoryImpl.kt index ea257ed5a..f77e22756 100644 --- a/app/src/main/java/com/runnect/runnect/data/repository/UserRepositoryImpl.kt +++ b/app/src/main/java/com/runnect/runnect/data/repository/UserRepositoryImpl.kt @@ -56,8 +56,8 @@ class UserRepositoryImpl @Inject constructor(private val remoteUserDataSource: R override suspend fun updateNickName( requestPatchNickName: RequestPatchNickName - ): Flow> = - remoteUserDataSource.updateNickName(requestPatchNickName).mapToFlowResult { it } + ): Flow> = + remoteUserDataSource.updateNickName(requestPatchNickName).mapToFlowResult {} override suspend fun getRecord(): Flow>> { return remoteUserDataSource.getRecord().mapToFlowResult { diff --git a/app/src/main/java/com/runnect/runnect/domain/repository/UserRepository.kt b/app/src/main/java/com/runnect/runnect/domain/repository/UserRepository.kt index a263d6837..a8dde08cf 100644 --- a/app/src/main/java/com/runnect/runnect/domain/repository/UserRepository.kt +++ b/app/src/main/java/com/runnect/runnect/domain/repository/UserRepository.kt @@ -39,7 +39,7 @@ interface UserRepository { suspend fun updateNickName( requestPatchNickName: RequestPatchNickName - ): Flow> + ): Flow> suspend fun getUserProfile(userId: Int): Flow> } \ No newline at end of file From 24749230df3a5bbb21ac461c7c9ae1b2f0bde254 Mon Sep 17 00:00:00 2001 From: Donghyeon0915 Date: Sat, 13 Apr 2024 18:24:24 +0900 Subject: [PATCH 12/13] =?UTF-8?q?[refactor]=20#346=20=EC=BD=94=EB=93=9C=20?= =?UTF-8?q?=EC=A0=95=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dto/response/ResponsePostMyDrawCourse.kt | 16 +++++----------- .../data/repository/CourseRepositoryImpl.kt | 9 +++------ .../data/repository/UserRepositoryImpl.kt | 12 ++++-------- .../domain/repository/CourseRepository.kt | 4 ---- .../runnect/domain/repository/UserRepository.kt | 7 +------ 5 files changed, 13 insertions(+), 35 deletions(-) diff --git a/app/src/main/java/com/runnect/runnect/data/dto/response/ResponsePostMyDrawCourse.kt b/app/src/main/java/com/runnect/runnect/data/dto/response/ResponsePostMyDrawCourse.kt index 2cc953674..f5bc6775b 100644 --- a/app/src/main/java/com/runnect/runnect/data/dto/response/ResponsePostMyDrawCourse.kt +++ b/app/src/main/java/com/runnect/runnect/data/dto/response/ResponsePostMyDrawCourse.kt @@ -5,14 +5,8 @@ import kotlinx.serialization.Serializable @Serializable data class ResponsePostMyDrawCourse( - @SerialName("data") - val data: Data -) { - @Serializable - data class Data( - @SerialName("id") - val id: Int, - @SerialName("createdAt") - val createdAt: String - ) -} \ No newline at end of file + @SerialName("id") + val id: Int, + @SerialName("createdAt") + val createdAt: String +) \ No newline at end of file diff --git a/app/src/main/java/com/runnect/runnect/data/repository/CourseRepositoryImpl.kt b/app/src/main/java/com/runnect/runnect/data/repository/CourseRepositoryImpl.kt index 021271227..09de93431 100644 --- a/app/src/main/java/com/runnect/runnect/data/repository/CourseRepositoryImpl.kt +++ b/app/src/main/java/com/runnect/runnect/data/repository/CourseRepositoryImpl.kt @@ -6,10 +6,6 @@ import com.runnect.runnect.data.dto.request.RequestPostPublicCourse import com.runnect.runnect.data.dto.request.RequestPostRunningHistory import com.runnect.runnect.data.dto.request.RequestPutMyDrawCourse import com.runnect.runnect.data.dto.response.ResponseGetMyDrawDetail -import com.runnect.runnect.data.dto.response.ResponsePostDiscoverUpload -import com.runnect.runnect.data.dto.response.ResponsePostMyDrawCourse -import com.runnect.runnect.data.dto.response.ResponsePostMyHistory -import com.runnect.runnect.data.dto.response.ResponsePutMyDrawCourse import com.runnect.runnect.data.network.mapToFlowResult import com.runnect.runnect.data.source.remote.RemoteCourseDataSource import com.runnect.runnect.domain.entity.CourseDetail @@ -25,8 +21,9 @@ import okhttp3.MultipartBody import okhttp3.RequestBody import javax.inject.Inject -class CourseRepositoryImpl @Inject constructor(private val remoteCourseDataSource: RemoteCourseDataSource) : - CourseRepository { +class CourseRepositoryImpl @Inject constructor( + private val remoteCourseDataSource: RemoteCourseDataSource +) : CourseRepository { override suspend fun getMarathonCourse(): Flow>> { return remoteCourseDataSource.getMarathonCourse().mapToFlowResult { diff --git a/app/src/main/java/com/runnect/runnect/data/repository/UserRepositoryImpl.kt b/app/src/main/java/com/runnect/runnect/data/repository/UserRepositoryImpl.kt index f77e22756..dba12a12e 100644 --- a/app/src/main/java/com/runnect/runnect/data/repository/UserRepositoryImpl.kt +++ b/app/src/main/java/com/runnect/runnect/data/repository/UserRepositoryImpl.kt @@ -1,26 +1,22 @@ package com.runnect.runnect.data.repository import com.runnect.runnect.data.dto.HistoryInfoDTO -import com.runnect.runnect.domain.entity.UserProfile import com.runnect.runnect.data.dto.request.RequestDeleteHistory import com.runnect.runnect.data.dto.request.RequestDeleteUploadCourse import com.runnect.runnect.data.dto.request.RequestPatchHistoryTitle import com.runnect.runnect.data.dto.request.RequestPatchNickName -import com.runnect.runnect.data.dto.response.ResponseDeleteHistory -import com.runnect.runnect.data.dto.response.ResponseDeleteUploadCourse -import com.runnect.runnect.data.dto.response.ResponseDeleteUser -import com.runnect.runnect.data.dto.response.ResponsePatchHistoryTitle -import com.runnect.runnect.data.dto.response.ResponsePatchUserNickName import com.runnect.runnect.data.network.mapToFlowResult import com.runnect.runnect.data.source.remote.RemoteUserDataSource import com.runnect.runnect.domain.entity.User +import com.runnect.runnect.domain.entity.UserProfile import com.runnect.runnect.domain.entity.UserUploadCourse import com.runnect.runnect.domain.repository.UserRepository import kotlinx.coroutines.flow.Flow import javax.inject.Inject -class UserRepositoryImpl @Inject constructor(private val remoteUserDataSource: RemoteUserDataSource) : - UserRepository { +class UserRepositoryImpl @Inject constructor( + private val remoteUserDataSource: RemoteUserDataSource +) : UserRepository { override suspend fun getUserInfo(): Flow> = remoteUserDataSource.getUserInfo() .mapToFlowResult { it.toUser() } diff --git a/app/src/main/java/com/runnect/runnect/domain/repository/CourseRepository.kt b/app/src/main/java/com/runnect/runnect/domain/repository/CourseRepository.kt index 0bace98ab..5363d2ca4 100644 --- a/app/src/main/java/com/runnect/runnect/domain/repository/CourseRepository.kt +++ b/app/src/main/java/com/runnect/runnect/domain/repository/CourseRepository.kt @@ -6,10 +6,6 @@ import com.runnect.runnect.data.dto.request.RequestPostPublicCourse import com.runnect.runnect.data.dto.request.RequestPostRunningHistory import com.runnect.runnect.data.dto.request.RequestPutMyDrawCourse import com.runnect.runnect.data.dto.response.ResponseGetMyDrawDetail -import com.runnect.runnect.data.dto.response.ResponsePostDiscoverUpload -import com.runnect.runnect.data.dto.response.ResponsePostMyDrawCourse -import com.runnect.runnect.data.dto.response.ResponsePostMyHistory -import com.runnect.runnect.data.dto.response.ResponsePutMyDrawCourse import com.runnect.runnect.domain.entity.CourseDetail import com.runnect.runnect.domain.entity.DiscoverMultiViewItem.MarathonCourse import com.runnect.runnect.domain.entity.DiscoverSearchCourse diff --git a/app/src/main/java/com/runnect/runnect/domain/repository/UserRepository.kt b/app/src/main/java/com/runnect/runnect/domain/repository/UserRepository.kt index a8dde08cf..ce5316abb 100644 --- a/app/src/main/java/com/runnect/runnect/domain/repository/UserRepository.kt +++ b/app/src/main/java/com/runnect/runnect/domain/repository/UserRepository.kt @@ -1,17 +1,12 @@ package com.runnect.runnect.domain.repository import com.runnect.runnect.data.dto.HistoryInfoDTO -import com.runnect.runnect.domain.entity.UserProfile import com.runnect.runnect.data.dto.request.RequestDeleteHistory import com.runnect.runnect.data.dto.request.RequestDeleteUploadCourse import com.runnect.runnect.data.dto.request.RequestPatchHistoryTitle import com.runnect.runnect.data.dto.request.RequestPatchNickName -import com.runnect.runnect.data.dto.response.ResponseDeleteHistory -import com.runnect.runnect.data.dto.response.ResponseDeleteUploadCourse -import com.runnect.runnect.data.dto.response.ResponseDeleteUser -import com.runnect.runnect.data.dto.response.ResponsePatchHistoryTitle -import com.runnect.runnect.data.dto.response.ResponsePatchUserNickName import com.runnect.runnect.domain.entity.User +import com.runnect.runnect.domain.entity.UserProfile import com.runnect.runnect.domain.entity.UserUploadCourse import kotlinx.coroutines.flow.Flow From f16c18ad00e8b2e369c6b6ce2cfe97ca935d4862 Mon Sep 17 00:00:00 2001 From: Donghyeon0915 Date: Sat, 13 Apr 2024 22:56:17 +0900 Subject: [PATCH 13/13] =?UTF-8?q?[refactor]=20#346=20=EC=BD=94=EB=93=9C=20?= =?UTF-8?q?=EC=A0=95=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../runnect/runnect/data/repository/StorageRepositoryImpl.kt | 1 - .../mypage/history/detail/MyHistoryDetailViewModel.kt | 3 --- 2 files changed, 4 deletions(-) diff --git a/app/src/main/java/com/runnect/runnect/data/repository/StorageRepositoryImpl.kt b/app/src/main/java/com/runnect/runnect/data/repository/StorageRepositoryImpl.kt index 81efb18c7..d03f88a53 100644 --- a/app/src/main/java/com/runnect/runnect/data/repository/StorageRepositoryImpl.kt +++ b/app/src/main/java/com/runnect/runnect/data/repository/StorageRepositoryImpl.kt @@ -1,7 +1,6 @@ package com.runnect.runnect.data.repository import com.runnect.runnect.data.dto.request.RequestPutMyDrawCourse -import com.runnect.runnect.data.dto.response.ResponsePutMyDrawCourse import com.runnect.runnect.data.dto.response.toMyDrawCourse import com.runnect.runnect.data.network.mapToFlowResult import com.runnect.runnect.data.source.remote.RemoteStorageDataSource diff --git a/app/src/main/java/com/runnect/runnect/presentation/mypage/history/detail/MyHistoryDetailViewModel.kt b/app/src/main/java/com/runnect/runnect/presentation/mypage/history/detail/MyHistoryDetailViewModel.kt index 8118bdc93..1e8edc183 100644 --- a/app/src/main/java/com/runnect/runnect/presentation/mypage/history/detail/MyHistoryDetailViewModel.kt +++ b/app/src/main/java/com/runnect/runnect/presentation/mypage/history/detail/MyHistoryDetailViewModel.kt @@ -5,10 +5,7 @@ import androidx.lifecycle.MutableLiveData import androidx.lifecycle.map import com.runnect.runnect.data.dto.request.RequestDeleteHistory import com.runnect.runnect.data.dto.request.RequestPatchHistoryTitle -import com.runnect.runnect.data.dto.response.ResponseDeleteHistory -import com.runnect.runnect.data.dto.response.ResponsePatchHistoryTitle import com.runnect.runnect.domain.common.toLog -import com.runnect.runnect.domain.entity.CourseTitle import com.runnect.runnect.domain.repository.UserRepository import com.runnect.runnect.presentation.base.BaseViewModel import com.runnect.runnect.presentation.state.UiStateV2