Skip to content

Commit

Permalink
Merge branch 'develop' into feature/improve-developer-mode
Browse files Browse the repository at this point in the history
  • Loading branch information
dongx0915 committed May 2, 2024
2 parents 131c747 + ff8c1c5 commit fc68223
Show file tree
Hide file tree
Showing 41 changed files with 1,291 additions and 810 deletions.
7 changes: 4 additions & 3 deletions app/src/debug/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,16 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">

<uses-permission android:name="android.permission.READ_PRIVILEGED_PHONE_STATE"
<uses-permission
android:name="android.permission.READ_PRIVILEGED_PHONE_STATE"
tools:ignore="ProtectedPermissions" />

<application
android:name=".application.ApplicationClass"
android:allowBackup="true"
android:allowBackup="false"
android:dataExtractionRules="@xml/data_extraction_rules"
android:enableOnBackInvokedCallback="true"
android:fullBackupContent="@xml/backup_rules"
android:fullBackupContent="false"
android:icon="@mipmap/ic_runnect_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_runnect_launcher_round"
Expand Down
42 changes: 26 additions & 16 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@

<application
android:name=".application.ApplicationClass"
android:allowBackup="true"
android:allowBackup="false"
android:dataExtractionRules="@xml/data_extraction_rules"
android:enableOnBackInvokedCallback="true"
android:fullBackupContent="@xml/backup_rules"
android:fullBackupContent="false"
android:icon="@mipmap/ic_runnect_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_runnect_launcher_round"
Expand Down Expand Up @@ -58,21 +58,43 @@
android:scheme="@string/kakao_redirection_scheme" />
</intent-filter>
</activity>

<activity
android:name=".presentation.login.LoginActivity"
android:exported="false" />

<activity
android:name=".presentation.mydrawdetail.MyDrawDetailActivity"
android:name=".presentation.storage.mydrawdetail.MyDrawDetailActivity"
android:exported="false" />

<activity
android:name=".presentation.scheme.SchemeActivity"
android:exported="true">

<intent-filter>
<action android:name="android.intent.action.VIEW" />

<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />

<data
android:host="rnnt.page.link"
android:scheme="https" />
</intent-filter>

</activity>

<activity
android:name=".presentation.splash.SplashActivity"
android:exported="true"
android:theme="@style/SplashTheme">

<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>

</activity>
<activity
android:name=".presentation.endrun.EndRunActivity"
Expand Down Expand Up @@ -111,19 +133,7 @@
android:windowSoftInputMode="adjustResize" />
<activity
android:name=".presentation.detail.CourseDetailActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.VIEW" />

<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />

<data
android:host="rnnt.page.link"
android:scheme="https" />
</intent-filter>
</activity>

android:exported="false" />
<activity
android:name=".presentation.mypage.reward.MyRewardActivity"
android:exported="false" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ class ApplicationClass : Application() {
!::appContext.isInitialized -> BuildConfig.RUNNECT_PROD_URL
else -> {
val mode = ApiMode.getCurrentApiMode(appContext)
Timber.d("현재 서버: ${mode}")
when (mode) {
ApiMode.JAVA -> BuildConfig.RUNNECT_PROD_URL
ApiMode.TEST -> BuildConfig.RUNNECT_DEV_URL
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,10 @@ import androidx.annotation.Keep
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable

@Keep
@Serializable
data class UploadLatLng(
@SerialName("lat")
val lat: Double,
@SerialName("long")
val long: Double,
@SerialName("latitude")
val latitude: Double,
@SerialName("longitude")
val longitude: Double
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package com.runnect.runnect.data.dto.request

import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable

@Serializable
data class RequestPatchMyDrawCourseTitle(
@SerialName("title")
val title: String
)
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
package com.runnect.runnect.data.dto.response

import com.runnect.runnect.domain.entity.MyDrawCourseDetail
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable

@Serializable
data class ResponseGetMyDrawDetail(
@SerialName("course")
val course: Course,
@SerialName("user")
val user: User,
@SerialName("course")
val course: Course
) {
@Serializable
data class User(
Expand All @@ -20,6 +21,8 @@ data class ResponseGetMyDrawDetail(
data class Course(
@SerialName("id")
val id: Int,
@SerialName("isNowUser")
val isNowUser: Boolean,
@SerialName("createdAt")
val createdAt: String,
@SerialName("path")
Expand All @@ -42,8 +45,17 @@ data class ResponseGetMyDrawDetail(
@SerialName("town")
val town: String,
@SerialName("name")
val name: String,
val name: String?,
)
}

fun toMyDrawCourseDetail() = MyDrawCourseDetail(
title = course.title,
imgUrl = course.image,
isNowUser = course.isNowUser,
distance = course.distance,
courseId = course.id,
path = course.path,
departureName = course.departure.name
)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package com.runnect.runnect.data.dto.response

import com.runnect.runnect.domain.entity.EditableMyDrawCourseDetail
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable

@Serializable
data class ResponsePatchMyDrawCourseTitle(
@SerialName("course")
val course: Course
) {
@Serializable
data class Course(
@SerialName("id")
val id: Int,
@SerialName("title")
val title: String
)

fun toEditableMyDrawCourseDetail() = EditableMyDrawCourseDetail(
title = course.title
)
}
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
package com.runnect.runnect.data.repository

import com.runnect.runnect.data.dto.request.RequestPatchMyDrawCourseTitle
import com.runnect.runnect.data.dto.request.RequestPatchPublicCourse
import com.runnect.runnect.data.dto.request.RequestPostCourseScrap
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.network.mapToFlowResult
import com.runnect.runnect.data.source.remote.RemoteCourseDataSource
import com.runnect.runnect.domain.entity.CourseDetail
import com.runnect.runnect.domain.entity.DiscoverMultiViewItem.MarathonCourse
import com.runnect.runnect.domain.entity.DiscoverSearchCourse
import com.runnect.runnect.domain.entity.DiscoverUploadCourse
import com.runnect.runnect.domain.entity.EditableCourseDetail
import com.runnect.runnect.domain.entity.EditableMyDrawCourseDetail
import com.runnect.runnect.domain.entity.MyDrawCourseDetail
import com.runnect.runnect.domain.entity.PostScrap
import com.runnect.runnect.domain.entity.RecommendCoursePagingData
import com.runnect.runnect.domain.repository.CourseRepository
Expand Down Expand Up @@ -59,8 +61,10 @@ class CourseRepositoryImpl @Inject constructor(
}
}

override suspend fun getMyDrawDetail(courseId: Int): Flow<Result<ResponseGetMyDrawDetail>> {
return remoteCourseDataSource.getMyDrawDetail(courseId = courseId).mapToFlowResult { it }
override suspend fun getMyDrawDetail(courseId: Int): Flow<Result<MyDrawCourseDetail>> {
return remoteCourseDataSource.getMyDrawDetail(courseId = courseId).mapToFlowResult {
it.toMyDrawCourseDetail()
}
}

override suspend fun deleteMyDrawCourse(deleteCourseList: RequestPutMyDrawCourse): Flow<Result<Unit>> {
Expand All @@ -79,6 +83,14 @@ class CourseRepositoryImpl @Inject constructor(
return remoteCourseDataSource.postUploadMyCourse(requestPostPublicCourse = requestPostPublicCourse).mapToFlowResult {}
}

override suspend fun patchMyDrawCourseTitle(
courseId: Int,
requestPatchMyDrawCourseTitle: RequestPatchMyDrawCourseTitle
): Flow<Result<EditableMyDrawCourseDetail>> =
remoteCourseDataSource.patchMyDrawCourseTitle(courseId, requestPatchMyDrawCourseTitle).mapToFlowResult {
it.toEditableMyDrawCourseDetail()
}

override suspend fun patchPublicCourse(
publicCourseId: Int,
requestPatchPublicCourse: RequestPatchPublicCourse
Expand Down
38 changes: 24 additions & 14 deletions app/src/main/java/com/runnect/runnect/data/service/CourseService.kt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.runnect.runnect.data.service

import com.runnect.runnect.data.dto.request.RequestPatchMyDrawCourseTitle
import com.runnect.runnect.data.dto.request.RequestPatchPublicCourse
import com.runnect.runnect.data.dto.request.RequestPostCourseScrap
import com.runnect.runnect.data.dto.request.RequestPostPublicCourse
Expand All @@ -13,12 +14,14 @@ import com.runnect.runnect.data.dto.response.ResponseGetDiscoverUploadCourse
import com.runnect.runnect.data.dto.response.ResponseGetMyDrawCourse
import com.runnect.runnect.data.dto.response.ResponseGetMyDrawDetail
import com.runnect.runnect.data.dto.response.ResponseGetMyScrapCourse
import com.runnect.runnect.data.dto.response.ResponsePatchMyDrawCourseTitle
import com.runnect.runnect.data.dto.response.ResponsePatchPublicCourse
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.ResponsePostScrap
import com.runnect.runnect.data.dto.response.ResponsePutMyDrawCourse
import com.runnect.runnect.data.dto.response.base.BaseResponse
import okhttp3.MultipartBody
import okhttp3.RequestBody
import retrofit2.http.Body
Expand Down Expand Up @@ -79,29 +82,36 @@ interface CourseService {
@Body requestPostCourseScrap: RequestPostCourseScrap,
): Result<ResponsePostScrap>

@PATCH("/api/public-course/{publicCourseId}")
suspend fun patchPublicCourse(
@Path("publicCourseId") publicCourseId: Int,
@Body requestPatchPublicCourse: RequestPatchPublicCourse
): Result<ResponsePatchPublicCourse>

//내가 그린 코스 삭제
@PUT("/api/course")
suspend fun deleteMyDrawCourse(
@Body deleteCourseList: RequestPutMyDrawCourse
): Result<ResponsePutMyDrawCourse>

//기록 업로드
// 기록 업로드
@POST("/api/record")
suspend fun postRecord(
@Body request: RequestPostRunningHistory
): Result<ResponsePostMyHistory>

//코스 업로드
// 코스 업로드
@Multipart
@POST("/api/course")
suspend fun uploadCourse(
@Part image: MultipartBody.Part,
@Part("data") data: RequestBody,
): Result<ResponsePostMyDrawCourse>

@PATCH("/api/public-course/{publicCourseId}")
suspend fun patchPublicCourse(
@Path("publicCourseId") publicCourseId: Int,
@Body requestPatchPublicCourse: RequestPatchPublicCourse
): Result<ResponsePatchPublicCourse>

// 내가 그린 코스 제목 수정
@PATCH("/api/course/{courseId}")
suspend fun patchMyDrawCourseTitle(
@Path("courseId") courseId: Int,
@Body requestPatchMyDrawCourseTitle: RequestPatchMyDrawCourseTitle
): Result<ResponsePatchMyDrawCourseTitle>

// 내가 그린 코스 삭제
@PUT("/api/course")
suspend fun deleteMyDrawCourse(
@Body deleteCourseList: RequestPutMyDrawCourse
): Result<ResponsePutMyDrawCourse>
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.runnect.runnect.data.source.remote

import com.runnect.runnect.data.dto.request.RequestPatchMyDrawCourseTitle
import com.runnect.runnect.data.dto.request.RequestPatchPublicCourse
import com.runnect.runnect.data.dto.request.RequestPostCourseScrap
import com.runnect.runnect.data.dto.request.RequestPostPublicCourse
Expand All @@ -8,6 +9,7 @@ import com.runnect.runnect.data.dto.request.RequestPutMyDrawCourse
import com.runnect.runnect.data.dto.response.ResponseGetCourseDetail
import com.runnect.runnect.data.dto.response.ResponseGetDiscoverMarathon
import com.runnect.runnect.data.dto.response.ResponseGetDiscoverRecommend
import com.runnect.runnect.data.dto.response.ResponsePatchMyDrawCourseTitle
import com.runnect.runnect.data.dto.response.ResponsePatchPublicCourse
import com.runnect.runnect.data.dto.response.ResponsePostScrap
import com.runnect.runnect.data.service.CourseService
Expand Down Expand Up @@ -51,6 +53,11 @@ class RemoteCourseDataSource @Inject constructor(

suspend fun getMyDrawDetail(courseId: Int) = courseService.getMyDrawDetail(courseId)

suspend fun patchMyDrawCourseTitle(
courseId: Int,
requestPatchMyDrawCourseTitle: RequestPatchMyDrawCourseTitle
): Result<ResponsePatchMyDrawCourseTitle> = courseService.patchMyDrawCourseTitle(courseId, requestPatchMyDrawCourseTitle)

suspend fun postRecord(request: RequestPostRunningHistory) = courseService.postRecord(request)

suspend fun uploadCourse(image: MultipartBody.Part, data: RequestBody) =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,18 @@ sealed class DiscoverMultiViewItem(
data class MarathonCourse(
override val id: Int,
val courseId: Int,
var title: String,
val title: String,
val image: String,
var scrap: Boolean,
val scrap: Boolean,
val departure: String,
) : DiscoverMultiViewItem(id)

data class RecommendCourse(
override val id: Int,
val courseId: Int,
var title: String,
val title: String,
val image: String,
var scrap: Boolean,
val scrap: Boolean,
val departure: String,
) : DiscoverMultiViewItem(id)
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package com.runnect.runnect.domain.entity
data class DiscoverSearchCourse(
val id: Int,
val courseId: Int,
var title: String,
val title: String,
val image: String,
var scrap: Boolean,
val scrap: Boolean,
val departure: String,
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package com.runnect.runnect.domain.entity

data class EditableMyDrawCourseDetail(
val title: String
)
Loading

0 comments on commit fc68223

Please sign in to comment.