diff --git a/android/2023-emmsale/app/build.gradle.kts b/android/2023-emmsale/app/build.gradle.kts
index ca9a00d09..139c209d7 100644
--- a/android/2023-emmsale/app/build.gradle.kts
+++ b/android/2023-emmsale/app/build.gradle.kts
@@ -20,8 +20,8 @@ android {
applicationId = "com.emmsale"
minSdk = 28
targetSdk = 33
- versionCode = 58
- versionName = "2.1.5"
+ versionCode = 59
+ versionName = "2.2.5"
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
@@ -36,11 +36,11 @@ android {
}
buildTypes {
debug {
- buildConfigField("String", "BASE_URL", "\"https://kerdy.kro.kr\"")
+ buildConfigField("String", "BASE_URL", "\"https://dev.kerdy.kro.kr\"")
buildConfigField(
"String",
"IMAGE_URL_PREFIX",
- "\"https://d3ms3abrjbgefs.cloudfront.net/dev/\"",
+ "\"https://kerdy-dev.s3.ap-northeast-2.amazonaws.com/dev/\"",
)
}
release {
diff --git a/android/2023-emmsale/app/src/main/AndroidManifest.xml b/android/2023-emmsale/app/src/main/AndroidManifest.xml
index dff978782..1e3c673e0 100644
--- a/android/2023-emmsale/app/src/main/AndroidManifest.xml
+++ b/android/2023-emmsale/app/src/main/AndroidManifest.xml
@@ -29,7 +29,7 @@
android:launchMode="singleTask"
android:parentActivityName=".presentation.ui.main.MainActivity"
android:windowSoftInputMode="adjustResize" />
-
+
diff --git a/android/2023-emmsale/app/src/main/java/com/emmsale/data/apiModel/request/MemberRequest.kt b/android/2023-emmsale/app/src/main/java/com/emmsale/data/apiModel/request/MemberRequest.kt
index 51fd70db6..8a240da0e 100644
--- a/android/2023-emmsale/app/src/main/java/com/emmsale/data/apiModel/request/MemberRequest.kt
+++ b/android/2023-emmsale/app/src/main/java/com/emmsale/data/apiModel/request/MemberRequest.kt
@@ -12,17 +12,11 @@ data class MemberCreateRequest(
)
@Serializable
-data class MemberActivitiesUpdateRequest(
+data class MemberActivitiesAddRequest(
@SerialName("activityIds")
val activityIds: List,
)
-@Serializable
-data class MemberOpenProfileUrlUpdateRequest(
- @SerialName("openProfileUrl")
- val openProfileUrl: String,
-)
-
@Serializable
data class MemberDescriptionUpdateRequest(
@SerialName("description")
diff --git a/android/2023-emmsale/app/src/main/java/com/emmsale/data/apiModel/response/ActivityResponse.kt b/android/2023-emmsale/app/src/main/java/com/emmsale/data/apiModel/response/ActivityResponse.kt
index 0eaa15e21..d401365b9 100644
--- a/android/2023-emmsale/app/src/main/java/com/emmsale/data/apiModel/response/ActivityResponse.kt
+++ b/android/2023-emmsale/app/src/main/java/com/emmsale/data/apiModel/response/ActivityResponse.kt
@@ -3,26 +3,23 @@ package com.emmsale.data.apiModel.response
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
-@Serializable
-data class ActivitiesResponse(
- @SerialName("activityType")
- val category: String = "-",
- @SerialName("activityResponses")
- val activities: List = emptyList(),
-)
-
@Serializable
data class ActivityResponse(
@SerialName("id")
val id: Long,
@SerialName("name")
val name: String,
-)
-
-@Serializable
-data class MemberActivitiesResponse(
@SerialName("activityType")
- val activityType: String,
- @SerialName("memberActivityResponses")
- val memberActivityResponses: List,
-)
+ val activityType: ActivityType,
+) {
+ enum class ActivityType {
+ @SerialName("동아리")
+ CLUB,
+
+ @SerialName("교육")
+ EDUCATION,
+
+ @SerialName("직무")
+ INTEREST_FIELD,
+ }
+}
diff --git a/android/2023-emmsale/app/src/main/java/com/emmsale/data/apiModel/response/EventResponse.kt b/android/2023-emmsale/app/src/main/java/com/emmsale/data/apiModel/response/EventResponse.kt
index 4b7220a7c..e31758ca0 100644
--- a/android/2023-emmsale/app/src/main/java/com/emmsale/data/apiModel/response/EventResponse.kt
+++ b/android/2023-emmsale/app/src/main/java/com/emmsale/data/apiModel/response/EventResponse.kt
@@ -4,99 +4,7 @@ import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
@Serializable
-data class ConferenceResponse(
- @SerialName("id")
- val id: Long,
- @SerialName("name")
- val name: String,
- @SerialName("eventStartDate")
- val startDate: String, // format : "2023:09:03:12:00:00",
- @SerialName("eventEndDate")
- val endDate: String, // format : "2023:09:03:12:00:00",
- @SerialName("applyStartDate")
- val applyStartDate: String, // format : "2023:09:03:12:00:00"
- @SerialName("applyEndDate")
- val applyEndDate: String, // format : "2023:09:03:12:00:00"
- @SerialName("tags")
- val tags: List,
- @SerialName("thumbnailUrl")
- val posterUrl: String? = null,
- @SerialName("eventMode")
- val onOfflineMode: OnOfflineMode,
- @SerialName("paymentType")
- val paymentType: PaymentType,
-) {
- enum class OnOfflineMode {
- @SerialName("온라인")
- ONLINE,
-
- @SerialName("오프라인")
- OFFLINE,
-
- @SerialName("온오프라인")
- ON_OFFLINE,
- }
-
- enum class PaymentType {
- @SerialName("유료")
- PAID,
-
- @SerialName("무료")
- FREE,
-
- @SerialName("유무료")
- PAID_OR_FREE,
- }
-}
-
-@Serializable
-data class CompetitionResponse(
- @SerialName("id")
- val id: Long,
- @SerialName("name")
- val name: String,
- @SerialName("eventStartDate")
- val startDate: String, // format : "2023:09:03:12:00:00",
- @SerialName("eventEndDate")
- val endDate: String, // format : "2023:09:03:12:00:00",
- @SerialName("applyStartDate")
- val applyStartDate: String, // format : "2023:09:03:12:00:00"
- @SerialName("applyEndDate")
- val applyEndDate: String, // format : "2023:09:03:12:00:00"
- @SerialName("tags")
- val tags: List,
- @SerialName("thumbnailUrl")
- val posterUrl: String? = null,
- @SerialName("eventMode")
- val onOfflineMode: OnOfflineMode,
- @SerialName("paymentType")
- val paymentType: PaymentType,
-) {
- enum class OnOfflineMode {
- @SerialName("온라인")
- ONLINE,
-
- @SerialName("오프라인")
- OFFLINE,
-
- @SerialName("온오프라인")
- ON_OFFLINE,
- }
-
- enum class PaymentType {
- @SerialName("유료")
- PAID,
-
- @SerialName("무료")
- FREE,
-
- @SerialName("유무료")
- PAID_OR_FREE,
- }
-}
-
-@Serializable
-data class EventDetailResponse(
+data class EventResponse(
@SerialName("id")
val id: Long,
@SerialName("name")
diff --git a/android/2023-emmsale/app/src/main/java/com/emmsale/data/apiModel/response/FeedDetailResponse.kt b/android/2023-emmsale/app/src/main/java/com/emmsale/data/apiModel/response/FeedResponse.kt
similarity index 67%
rename from android/2023-emmsale/app/src/main/java/com/emmsale/data/apiModel/response/FeedDetailResponse.kt
rename to android/2023-emmsale/app/src/main/java/com/emmsale/data/apiModel/response/FeedResponse.kt
index 816fa925e..c8d8fc2fc 100644
--- a/android/2023-emmsale/app/src/main/java/com/emmsale/data/apiModel/response/FeedDetailResponse.kt
+++ b/android/2023-emmsale/app/src/main/java/com/emmsale/data/apiModel/response/FeedResponse.kt
@@ -4,31 +4,23 @@ import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
@Serializable
-data class FeedDetailResponse(
+data class FeedResponse(
@SerialName("id")
val id: Long,
@SerialName("eventId")
val eventId: Long,
- @SerialName("writer")
- val writer: WriterResponse,
@SerialName("title")
val title: String,
@SerialName("content")
val content: String,
+ @SerialName("writer")
+ val writer: MemberResponse,
@SerialName("images")
val imageUrls: List,
+ @SerialName("commentCount")
+ val commentCount: Int,
@SerialName("createdAt")
val createdAt: String,
@SerialName("updatedAt")
val updatedAt: String,
)
-
-@Serializable
-data class WriterResponse(
- @SerialName("memberId")
- val memberId: Long,
- @SerialName("name")
- val name: String,
- @SerialName("imageUrl")
- val imageUrl: String,
-)
diff --git a/android/2023-emmsale/app/src/main/java/com/emmsale/data/apiModel/response/MemberResponse.kt b/android/2023-emmsale/app/src/main/java/com/emmsale/data/apiModel/response/MemberResponse.kt
index d7e611e29..b071b8874 100644
--- a/android/2023-emmsale/app/src/main/java/com/emmsale/data/apiModel/response/MemberResponse.kt
+++ b/android/2023-emmsale/app/src/main/java/com/emmsale/data/apiModel/response/MemberResponse.kt
@@ -15,6 +15,6 @@ data class MemberResponse(
val description: String = "",
@SerialName("imageUrl")
val imageUrl: String,
- @SerialName("openProfileUrl")
- val openProfileUrl: String = "",
+ @SerialName("activities")
+ val activities: List = emptyList(),
)
diff --git a/android/2023-emmsale/app/src/main/java/com/emmsale/data/apiModel/response/MessageRoomResponse.kt b/android/2023-emmsale/app/src/main/java/com/emmsale/data/apiModel/response/MessageRoomResponse.kt
index 931267ed5..0662f5471 100644
--- a/android/2023-emmsale/app/src/main/java/com/emmsale/data/apiModel/response/MessageRoomResponse.kt
+++ b/android/2023-emmsale/app/src/main/java/com/emmsale/data/apiModel/response/MessageRoomResponse.kt
@@ -7,30 +7,26 @@ import kotlinx.serialization.Serializable
data class MessageRoomResponse(
@SerialName("roomId")
val roomId: String,
- @SerialName("interlocutorId")
- val senderId: Long,
- @SerialName("interlocutorName")
- val senderName: String,
- @SerialName("interlocutorProfile")
- val senderProfileImageUrl: String,
+ @SerialName("interlocutor")
+ val interlocutor: MemberResponse,
@SerialName("recentlyMessage")
- val recentMessage: String,
- @SerialName("recentlyMessageTime")
- val recentMessageTime: String,
+ val recentMessage: MessageResponse,
+)
+
+@Serializable
+data class MessageSendResponse(
+ @SerialName("roomId")
+ val roomId: String,
)
@Serializable
data class MessageResponse(
- @SerialName("senderId")
- val senderId: Long,
+ @SerialName("id")
+ val id: Long,
+ @SerialName("sender")
+ val sender: MemberResponse,
@SerialName("content")
- val message: String,
+ val content: String,
@SerialName("createdAt")
val createdAt: String,
)
-
-@Serializable
-data class MessageSendResponse(
- @SerialName("roomId")
- val roomId: String,
-)
diff --git a/android/2023-emmsale/app/src/main/java/com/emmsale/data/apiModel/response/PostResponse.kt b/android/2023-emmsale/app/src/main/java/com/emmsale/data/apiModel/response/PostResponse.kt
deleted file mode 100644
index d58a10880..000000000
--- a/android/2023-emmsale/app/src/main/java/com/emmsale/data/apiModel/response/PostResponse.kt
+++ /dev/null
@@ -1,32 +0,0 @@
-package com.emmsale.data.apiModel.response
-
-import kotlinx.serialization.SerialName
-import kotlinx.serialization.Serializable
-
-@Serializable
-data class PostResponse(
- @SerialName("id")
- val id: Long,
- @SerialName("title")
- val title: String,
- @SerialName("writerId")
- val writerId: Long,
- @SerialName("commentCount")
- val commentCount: Int = 0,
- @SerialName("content")
- val content: String = "",
- @SerialName("images")
- val imageUrls: List = emptyList(),
- @SerialName("createdAt")
- val createdAt: String,
- @SerialName("updatedAt")
- val updatedAt: String,
-)
-
-@Serializable
-data class PostsResponse(
- @SerialName("eventId")
- val eventId: Long,
- @SerialName("feeds")
- val posts: List = emptyList(),
-)
diff --git a/android/2023-emmsale/app/src/main/java/com/emmsale/data/apiModel/response/RecruitmentResponse.kt b/android/2023-emmsale/app/src/main/java/com/emmsale/data/apiModel/response/RecruitmentResponse.kt
index deadb217c..a30773b3c 100644
--- a/android/2023-emmsale/app/src/main/java/com/emmsale/data/apiModel/response/RecruitmentResponse.kt
+++ b/android/2023-emmsale/app/src/main/java/com/emmsale/data/apiModel/response/RecruitmentResponse.kt
@@ -5,18 +5,16 @@ import kotlinx.serialization.Serializable
@Serializable
data class RecruitmentResponse(
- @SerialName("id")
+ @SerialName("postId")
val id: Long,
- @SerialName("memberId")
- val memberId: Long,
- @SerialName("name")
- val name: String,
- @SerialName("imageUrl")
- val imageUrl: String,
@SerialName("content")
val content: String,
@SerialName("updatedAt")
val updatedAt: String,
+ @SerialName("member")
+ val member: MemberResponse,
+ @SerialName("eventId")
+ val eventId: Long,
)
@Serializable
diff --git a/android/2023-emmsale/app/src/main/java/com/emmsale/data/apiModel/response/ScrappedEventResponse.kt b/android/2023-emmsale/app/src/main/java/com/emmsale/data/apiModel/response/ScrappedEventResponse.kt
deleted file mode 100644
index d663d0203..000000000
--- a/android/2023-emmsale/app/src/main/java/com/emmsale/data/apiModel/response/ScrappedEventResponse.kt
+++ /dev/null
@@ -1,50 +0,0 @@
-package com.emmsale.data.apiModel.response
-
-import kotlinx.serialization.SerialName
-import kotlinx.serialization.Serializable
-
-@Serializable
-data class ScrappedEventResponse(
- @SerialName("id")
- val id: Long,
- @SerialName("name")
- val name: String,
- @SerialName("eventStartDate")
- val startDate: String, // format : "2023:09:03:12:00:00",
- @SerialName("eventEndDate")
- val endDate: String, // format : "2023:09:03:12:00:00",
- @SerialName("applyStartDate")
- val applyStartDate: String,
- @SerialName("applyEndDate")
- val applyEndDate: String,
- @SerialName("tags")
- val tags: List,
- @SerialName("thumbnailUrl")
- val posterUrl: String? = null,
- @SerialName("eventMode")
- val eventMode: EventMode,
- @SerialName("paymentType")
- val paymentType: PaymentType,
-) {
- enum class EventMode {
- @SerialName("온라인")
- ONLINE,
-
- @SerialName("오프라인")
- OFFLINE,
-
- @SerialName("온오프라인")
- ON_OFFLINE,
- }
-
- enum class PaymentType {
- @SerialName("유료")
- PAID,
-
- @SerialName("무료")
- FREE,
-
- @SerialName("유무료")
- PAID_OR_FREE,
- }
-}
diff --git a/android/2023-emmsale/app/src/main/java/com/emmsale/data/mapper/ActivityMapper.kt b/android/2023-emmsale/app/src/main/java/com/emmsale/data/mapper/ActivityMapper.kt
index 780aa5693..4440faad5 100644
--- a/android/2023-emmsale/app/src/main/java/com/emmsale/data/mapper/ActivityMapper.kt
+++ b/android/2023-emmsale/app/src/main/java/com/emmsale/data/mapper/ActivityMapper.kt
@@ -1,30 +1,19 @@
package com.emmsale.data.mapper
-import com.emmsale.data.apiModel.response.ActivitiesResponse
import com.emmsale.data.apiModel.response.ActivityResponse
-import com.emmsale.data.apiModel.response.MemberActivitiesResponse
import com.emmsale.data.model.Activity
import com.emmsale.data.model.ActivityType
-fun List.toData(): List = flatMap { it.toData() }
+fun List.toData(): List = map { it.toData() }
-fun ActivitiesResponse.toData(): List = activities.map { it.toData(category) }
-
-@JvmName("mapMemberActivitiesApiModelToData")
-fun List.toData(): List = flatMap { it.toData() }
-
-fun MemberActivitiesResponse.toData(): List =
- memberActivityResponses.map { it.toData(activityType) }
-
-fun ActivityResponse.toData(category: String): Activity = Activity(
+fun ActivityResponse.toData(): Activity = Activity(
id = id,
- activityType = category.toData(),
+ activityType = activityType.toData(),
name = name,
)
-private fun String.toData(): ActivityType = when (this) {
- "동아리" -> ActivityType.CLUB
- "교육" -> ActivityType.EDUCATION
- "직무" -> ActivityType.FIELD
- else -> throw IllegalStateException("회원의 활동 Json 데이터를 도메인 모델로 매핑하는 데 실패했습니다. 서버와 Api 스펙을 다시 상의해보세요.")
+private fun ActivityResponse.ActivityType.toData(): ActivityType = when (this) {
+ ActivityResponse.ActivityType.CLUB -> ActivityType.CLUB
+ ActivityResponse.ActivityType.EDUCATION -> ActivityType.EDUCATION
+ ActivityResponse.ActivityType.INTEREST_FIELD -> ActivityType.INTEREST_FIELD
}
diff --git a/android/2023-emmsale/app/src/main/java/com/emmsale/data/mapper/CompetitionMapper.kt b/android/2023-emmsale/app/src/main/java/com/emmsale/data/mapper/CompetitionMapper.kt
deleted file mode 100644
index d9b614b55..000000000
--- a/android/2023-emmsale/app/src/main/java/com/emmsale/data/mapper/CompetitionMapper.kt
+++ /dev/null
@@ -1,39 +0,0 @@
-package com.emmsale.data.mapper
-
-import com.emmsale.BuildConfig
-import com.emmsale.data.apiModel.response.CompetitionResponse
-import com.emmsale.data.model.Event
-import com.emmsale.data.model.OnOfflineMode
-import com.emmsale.data.model.PaymentType
-import java.time.LocalDateTime
-import java.time.format.DateTimeFormatter
-
-private const val DATE_TIME_FORMAT = "yyyy:MM:dd:HH:mm:ss"
-
-fun List.toData(): List = map { it.toData() }
-
-fun CompetitionResponse.toData(): Event = Event(
- id = id,
- name = name,
- startDate = parseDate(startDate),
- endDate = parseDate(endDate),
- applyingStartDate = parseDate(applyStartDate),
- applyingEndDate = parseDate(applyEndDate),
- tags = tags,
- posterUrl = posterUrl?.let { BuildConfig.IMAGE_URL_PREFIX + it },
- onOfflineMode = when (onOfflineMode) {
- CompetitionResponse.OnOfflineMode.ONLINE -> OnOfflineMode.ONLINE
- CompetitionResponse.OnOfflineMode.OFFLINE -> OnOfflineMode.OFFLINE
- CompetitionResponse.OnOfflineMode.ON_OFFLINE -> OnOfflineMode.ON_OFFLINE
- },
- paymentType = when (paymentType) {
- CompetitionResponse.PaymentType.FREE -> PaymentType.FREE
- CompetitionResponse.PaymentType.PAID -> PaymentType.PAID
- CompetitionResponse.PaymentType.PAID_OR_FREE -> PaymentType.PAID_OR_FREE
- },
-)
-
-private fun parseDate(date: String): LocalDateTime {
- val dateTimeFormatter = DateTimeFormatter.ofPattern(DATE_TIME_FORMAT)
- return LocalDateTime.parse(date, dateTimeFormatter)
-}
diff --git a/android/2023-emmsale/app/src/main/java/com/emmsale/data/mapper/ConferenceMapper.kt b/android/2023-emmsale/app/src/main/java/com/emmsale/data/mapper/ConferenceMapper.kt
deleted file mode 100644
index 18d34a2a2..000000000
--- a/android/2023-emmsale/app/src/main/java/com/emmsale/data/mapper/ConferenceMapper.kt
+++ /dev/null
@@ -1,39 +0,0 @@
-package com.emmsale.data.mapper
-
-import com.emmsale.BuildConfig
-import com.emmsale.data.apiModel.response.ConferenceResponse
-import com.emmsale.data.model.Event
-import com.emmsale.data.model.OnOfflineMode
-import com.emmsale.data.model.PaymentType
-import java.time.LocalDateTime
-import java.time.format.DateTimeFormatter
-
-private const val DATE_TIME_FORMAT = "yyyy:MM:dd:HH:mm:ss"
-
-fun List.toData(): List = map { it.toData() }
-
-fun ConferenceResponse.toData(): Event = Event(
- id = id,
- name = name,
- startDate = parseDate(startDate),
- endDate = parseDate(endDate),
- applyingStartDate = parseDate(applyStartDate),
- applyingEndDate = parseDate(applyEndDate),
- tags = tags,
- posterUrl = posterUrl?.let { BuildConfig.IMAGE_URL_PREFIX + it },
- onOfflineMode = when (onOfflineMode) {
- ConferenceResponse.OnOfflineMode.ONLINE -> OnOfflineMode.ONLINE
- ConferenceResponse.OnOfflineMode.OFFLINE -> OnOfflineMode.OFFLINE
- ConferenceResponse.OnOfflineMode.ON_OFFLINE -> OnOfflineMode.ON_OFFLINE
- },
- paymentType = when (paymentType) {
- ConferenceResponse.PaymentType.FREE -> PaymentType.FREE
- ConferenceResponse.PaymentType.PAID -> PaymentType.PAID
- ConferenceResponse.PaymentType.PAID_OR_FREE -> PaymentType.PAID_OR_FREE
- },
-)
-
-private fun parseDate(date: String): LocalDateTime {
- val dateTimeFormatter = DateTimeFormatter.ofPattern(DATE_TIME_FORMAT)
- return LocalDateTime.parse(date, dateTimeFormatter)
-}
diff --git a/android/2023-emmsale/app/src/main/java/com/emmsale/data/mapper/EventDetailMapper.kt b/android/2023-emmsale/app/src/main/java/com/emmsale/data/mapper/EventMapper.kt
similarity index 57%
rename from android/2023-emmsale/app/src/main/java/com/emmsale/data/mapper/EventDetailMapper.kt
rename to android/2023-emmsale/app/src/main/java/com/emmsale/data/mapper/EventMapper.kt
index 9a2a46f44..d626aa8e2 100644
--- a/android/2023-emmsale/app/src/main/java/com/emmsale/data/mapper/EventDetailMapper.kt
+++ b/android/2023-emmsale/app/src/main/java/com/emmsale/data/mapper/EventMapper.kt
@@ -1,14 +1,16 @@
package com.emmsale.data.mapper
import com.emmsale.BuildConfig
-import com.emmsale.data.apiModel.response.EventDetailResponse
-import com.emmsale.data.model.EventDetail
+import com.emmsale.data.apiModel.response.EventResponse
+import com.emmsale.data.model.Event
import com.emmsale.data.model.OnOfflineMode
import com.emmsale.data.model.PaymentType
import java.time.LocalDateTime
import java.time.format.DateTimeFormatter
-fun EventDetailResponse.toData(): EventDetail = EventDetail(
+fun List.toData(): List = map { it.toData() }
+
+fun EventResponse.toData(): Event = Event(
id = id,
name = name,
organization = organization,
@@ -31,14 +33,14 @@ private fun String.toLocalDateTime(): LocalDateTime {
return LocalDateTime.parse(this, format)
}
-private fun EventDetailResponse.PaymentType.toPaymentType(): PaymentType = when (this) {
- EventDetailResponse.PaymentType.PAID -> PaymentType.PAID
- EventDetailResponse.PaymentType.FREE -> PaymentType.FREE
- EventDetailResponse.PaymentType.PAID_OR_FREE -> PaymentType.PAID_OR_FREE
+private fun EventResponse.PaymentType.toPaymentType(): PaymentType = when (this) {
+ EventResponse.PaymentType.PAID -> PaymentType.PAID
+ EventResponse.PaymentType.FREE -> PaymentType.FREE
+ EventResponse.PaymentType.PAID_OR_FREE -> PaymentType.PAID_OR_FREE
}
-private fun EventDetailResponse.OnOfflineMode.toData(): OnOfflineMode = when (this) {
- EventDetailResponse.OnOfflineMode.ONLINE -> OnOfflineMode.ONLINE
- EventDetailResponse.OnOfflineMode.OFFLINE -> OnOfflineMode.OFFLINE
- EventDetailResponse.OnOfflineMode.ON_OFFLINE -> OnOfflineMode.ON_OFFLINE
+private fun EventResponse.OnOfflineMode.toData(): OnOfflineMode = when (this) {
+ EventResponse.OnOfflineMode.ONLINE -> OnOfflineMode.ONLINE
+ EventResponse.OnOfflineMode.OFFLINE -> OnOfflineMode.OFFLINE
+ EventResponse.OnOfflineMode.ON_OFFLINE -> OnOfflineMode.ON_OFFLINE
}
diff --git a/android/2023-emmsale/app/src/main/java/com/emmsale/data/mapper/FeedMapper.kt b/android/2023-emmsale/app/src/main/java/com/emmsale/data/mapper/FeedMapper.kt
index e9bdb65c0..6ef70715e 100644
--- a/android/2023-emmsale/app/src/main/java/com/emmsale/data/mapper/FeedMapper.kt
+++ b/android/2023-emmsale/app/src/main/java/com/emmsale/data/mapper/FeedMapper.kt
@@ -1,18 +1,21 @@
package com.emmsale.data.mapper
import com.emmsale.BuildConfig
-import com.emmsale.data.apiModel.response.FeedDetailResponse
-import com.emmsale.data.model.FeedDetail
+import com.emmsale.data.apiModel.response.FeedResponse
+import com.emmsale.data.model.Feed
import java.time.LocalDateTime
import java.time.format.DateTimeFormatter
-fun FeedDetailResponse.toData(): FeedDetail = FeedDetail(
+fun List.toData(): List = map { it.toData() }
+
+fun FeedResponse.toData(): Feed = Feed(
id = id,
eventId = eventId,
title = title,
content = content,
writer = writer.toData(),
imageUrls = imageUrls.map { BuildConfig.IMAGE_URL_PREFIX + it },
+ commentCount = commentCount,
createdAt = LocalDateTime.parse(createdAt, dateTimeFormatter),
updatedAt = LocalDateTime.parse(updatedAt, dateTimeFormatter),
)
diff --git a/android/2023-emmsale/app/src/main/java/com/emmsale/data/mapper/MemberMapper.kt b/android/2023-emmsale/app/src/main/java/com/emmsale/data/mapper/MemberMapper.kt
index ecabd6137..99fb8cc78 100644
--- a/android/2023-emmsale/app/src/main/java/com/emmsale/data/mapper/MemberMapper.kt
+++ b/android/2023-emmsale/app/src/main/java/com/emmsale/data/mapper/MemberMapper.kt
@@ -9,4 +9,5 @@ fun MemberResponse.toData() = Member(
name = name,
description = description,
profileImageUrl = imageUrl,
+ activities = activities.toData(),
)
diff --git a/android/2023-emmsale/app/src/main/java/com/emmsale/data/mapper/MessageMapper.kt b/android/2023-emmsale/app/src/main/java/com/emmsale/data/mapper/MessageMapper.kt
index bfc129a9e..7d0f5b09e 100644
--- a/android/2023-emmsale/app/src/main/java/com/emmsale/data/mapper/MessageMapper.kt
+++ b/android/2023-emmsale/app/src/main/java/com/emmsale/data/mapper/MessageMapper.kt
@@ -6,7 +6,8 @@ import com.emmsale.data.model.Message
fun List.toData(): List = map { it.toData() }
fun MessageResponse.toData(): Message = Message.create(
- senderId = senderId,
- message = message,
+ id = id,
+ sender = sender.toData(),
+ content = content,
createdAt = createdAt,
)
diff --git a/android/2023-emmsale/app/src/main/java/com/emmsale/data/mapper/MessageRoomMapper.kt b/android/2023-emmsale/app/src/main/java/com/emmsale/data/mapper/MessageRoomMapper.kt
index ba59a3b5c..a095b9ce1 100644
--- a/android/2023-emmsale/app/src/main/java/com/emmsale/data/mapper/MessageRoomMapper.kt
+++ b/android/2023-emmsale/app/src/main/java/com/emmsale/data/mapper/MessageRoomMapper.kt
@@ -1,18 +1,12 @@
package com.emmsale.data.mapper
import com.emmsale.data.apiModel.response.MessageRoomResponse
-import com.emmsale.data.model.Message
import com.emmsale.data.model.MessageRoom
fun List.toData(): List = map { it.toData() }
fun MessageRoomResponse.toData(): MessageRoom = MessageRoom(
roomId = roomId,
- senderName = senderName,
- messageRoomImageUrl = senderProfileImageUrl,
- recentMessage = Message.create(
- senderId = senderId,
- message = recentMessage,
- createdAt = recentMessageTime,
- ),
+ interlocutor = interlocutor.toData(),
+ recentMessage = recentMessage.toData(),
)
diff --git a/android/2023-emmsale/app/src/main/java/com/emmsale/data/mapper/PostMapper.kt b/android/2023-emmsale/app/src/main/java/com/emmsale/data/mapper/PostMapper.kt
deleted file mode 100644
index 5f16ccc9c..000000000
--- a/android/2023-emmsale/app/src/main/java/com/emmsale/data/mapper/PostMapper.kt
+++ /dev/null
@@ -1,29 +0,0 @@
-package com.emmsale.data.mapper
-
-import com.emmsale.BuildConfig
-import com.emmsale.data.apiModel.response.PostsResponse
-import com.emmsale.data.model.Post
-import java.time.LocalDateTime
-import java.time.format.DateTimeFormatter
-
-fun PostsResponse.toData(): List {
- return posts.map { postResponse ->
- Post(
- id = postResponse.id,
- eventId = eventId,
- title = postResponse.title,
- content = postResponse.content,
- titleImageUrl = getTitleImageUrl(postResponse.imageUrls),
- createdAt = LocalDateTime.parse(postResponse.createdAt, dateTimeFormatter),
- updatedAt = LocalDateTime.parse(postResponse.updatedAt, dateTimeFormatter),
- commentCount = postResponse.commentCount,
- )
- }
-}
-
-private fun getTitleImageUrl(images: List): String? {
- if (images.isEmpty()) return null
- return BuildConfig.IMAGE_URL_PREFIX + images.firstOrNull()
-}
-
-private val dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy:MM:dd:HH:mm:ss")
diff --git a/android/2023-emmsale/app/src/main/java/com/emmsale/data/mapper/RecruitmentMapper.kt b/android/2023-emmsale/app/src/main/java/com/emmsale/data/mapper/RecruitmentMapper.kt
index 9c887ba4c..1af0d6b2f 100644
--- a/android/2023-emmsale/app/src/main/java/com/emmsale/data/mapper/RecruitmentMapper.kt
+++ b/android/2023-emmsale/app/src/main/java/com/emmsale/data/mapper/RecruitmentMapper.kt
@@ -1,6 +1,7 @@
package com.emmsale.data.mapper
import com.emmsale.data.apiModel.response.RecruitmentResponse
+import com.emmsale.data.model.Event
import com.emmsale.data.model.Recruitment
import java.time.LocalDate
import java.time.format.DateTimeFormatter
@@ -11,11 +12,10 @@ fun List.toData(): List = map {
fun RecruitmentResponse.toData(): Recruitment = Recruitment(
id = id,
- memberId = memberId,
- name = name,
- imageUrl = imageUrl,
content = content,
updatedDate = updatedAt.toLocalDate(),
+ writer = member.toData(),
+ event = Event(id = eventId),
)
private fun String.toLocalDate(): LocalDate {
diff --git a/android/2023-emmsale/app/src/main/java/com/emmsale/data/mapper/ScrappedEventMapper.kt b/android/2023-emmsale/app/src/main/java/com/emmsale/data/mapper/ScrappedEventMapper.kt
deleted file mode 100644
index 0b66471c2..000000000
--- a/android/2023-emmsale/app/src/main/java/com/emmsale/data/mapper/ScrappedEventMapper.kt
+++ /dev/null
@@ -1,41 +0,0 @@
-package com.emmsale.data.mapper
-
-import com.emmsale.BuildConfig
-import com.emmsale.data.apiModel.response.ScrappedEventResponse
-import com.emmsale.data.model.OnOfflineMode
-import com.emmsale.data.model.PaymentType
-import com.emmsale.data.model.ScrappedEvent
-import java.time.LocalDateTime
-import java.time.format.DateTimeFormatter
-
-private const val DATE_TIME_FORMAT = "yyyy:MM:dd:HH:mm:ss"
-
-fun ScrappedEventResponse.toData(): ScrappedEvent = ScrappedEvent(
- id = id,
- name = name,
- startDate = parseDate(startDate),
- endDate = parseDate(endDate),
- applyingStartDate = parseDate(applyStartDate),
- applyingEndDate = parseDate(applyEndDate),
- tags = tags,
- posterUrl = posterUrl?.let { BuildConfig.IMAGE_URL_PREFIX + it },
- onOfflineMode = when (eventMode) {
- ScrappedEventResponse.EventMode.ONLINE -> OnOfflineMode.ONLINE
- ScrappedEventResponse.EventMode.OFFLINE -> OnOfflineMode.OFFLINE
- ScrappedEventResponse.EventMode.ON_OFFLINE -> OnOfflineMode.ON_OFFLINE
- },
- paymentType = when (paymentType) {
- ScrappedEventResponse.PaymentType.FREE -> PaymentType.FREE
- ScrappedEventResponse.PaymentType.PAID -> PaymentType.PAID
- ScrappedEventResponse.PaymentType.PAID_OR_FREE -> PaymentType.PAID_OR_FREE
- },
-)
-
-private fun parseDate(date: String): LocalDateTime {
- val dateTimeFormatter = DateTimeFormatter.ofPattern(DATE_TIME_FORMAT)
- return LocalDateTime.parse(date, dateTimeFormatter)
-}
-
-fun List.toData(): List = map {
- it.toData()
-}
diff --git a/android/2023-emmsale/app/src/main/java/com/emmsale/data/mapper/WriterMapper.kt b/android/2023-emmsale/app/src/main/java/com/emmsale/data/mapper/WriterMapper.kt
deleted file mode 100644
index 2253d8aae..000000000
--- a/android/2023-emmsale/app/src/main/java/com/emmsale/data/mapper/WriterMapper.kt
+++ /dev/null
@@ -1,10 +0,0 @@
-package com.emmsale.data.mapper
-
-import com.emmsale.data.apiModel.response.WriterResponse
-import com.emmsale.data.model.Writer
-
-fun WriterResponse.toData(): Writer = Writer(
- id = memberId,
- name = name,
- imageUrl = imageUrl,
-)
diff --git a/android/2023-emmsale/app/src/main/java/com/emmsale/data/model/ActivityType.kt b/android/2023-emmsale/app/src/main/java/com/emmsale/data/model/ActivityType.kt
index 93b60f44e..de497df9f 100644
--- a/android/2023-emmsale/app/src/main/java/com/emmsale/data/model/ActivityType.kt
+++ b/android/2023-emmsale/app/src/main/java/com/emmsale/data/model/ActivityType.kt
@@ -1,5 +1,5 @@
package com.emmsale.data.model
enum class ActivityType {
- FIELD, EDUCATION, CLUB
+ INTEREST_FIELD, EDUCATION, CLUB
}
diff --git a/android/2023-emmsale/app/src/main/java/com/emmsale/data/model/Event.kt b/android/2023-emmsale/app/src/main/java/com/emmsale/data/model/Event.kt
index 809361db6..288cbba09 100644
--- a/android/2023-emmsale/app/src/main/java/com/emmsale/data/model/Event.kt
+++ b/android/2023-emmsale/app/src/main/java/com/emmsale/data/model/Event.kt
@@ -4,19 +4,30 @@ import java.time.LocalDateTime
data class Event(
val id: Long,
- val name: String,
- val startDate: LocalDateTime,
- val endDate: LocalDateTime,
- val applyingStartDate: LocalDateTime,
- val applyingEndDate: LocalDateTime,
- val tags: List,
- val posterUrl: String?,
- val onOfflineMode: OnOfflineMode,
- val paymentType: PaymentType,
+ val name: String = "",
+ val informationUrl: String = "",
+ val organization: String? = null,
+ val startDate: LocalDateTime = DEFAULT_LOCAL_DATE_TIME,
+ val endDate: LocalDateTime = DEFAULT_LOCAL_DATE_TIME,
+ val applyingStartDate: LocalDateTime = DEFAULT_LOCAL_DATE_TIME,
+ val applyingEndDate: LocalDateTime = DEFAULT_LOCAL_DATE_TIME,
+ val location: String = "",
+ val tags: List = emptyList(),
+ val posterImageUrl: String? = "",
+ val paymentType: PaymentType = DEFAULT_PAYMENT_TYPE,
+ val onOfflineMode: OnOfflineMode = DEFAULT_ON_OFFLINE_MODE,
+ val type: String = "",
+ val detailImageUrls: List = emptyList(),
) {
val progressStatus: EventProgressStatus
get() = EventProgressStatus.create(startDate, endDate)
val applicationStatus: EventApplyingStatus
get() = EventApplyingStatus.create(applyingStartDate, applyingEndDate)
+
+ companion object {
+ private val DEFAULT_LOCAL_DATE_TIME = LocalDateTime.MAX
+ private val DEFAULT_PAYMENT_TYPE = PaymentType.PAID
+ private val DEFAULT_ON_OFFLINE_MODE = OnOfflineMode.ON_OFFLINE
+ }
}
diff --git a/android/2023-emmsale/app/src/main/java/com/emmsale/data/model/EventDetail.kt b/android/2023-emmsale/app/src/main/java/com/emmsale/data/model/EventDetail.kt
deleted file mode 100644
index 9e628c9af..000000000
--- a/android/2023-emmsale/app/src/main/java/com/emmsale/data/model/EventDetail.kt
+++ /dev/null
@@ -1,27 +0,0 @@
-package com.emmsale.data.model
-
-import java.time.LocalDateTime
-
-data class EventDetail(
- val id: Long,
- val name: String,
- val informationUrl: String,
- val organization: String? = null,
- val startDate: LocalDateTime,
- val endDate: LocalDateTime,
- val applyingStartDate: LocalDateTime,
- val applyingEndDate: LocalDateTime,
- val location: String,
- val tags: List,
- val posterImageUrl: String?,
- val paymentType: PaymentType,
- val onOfflineMode: OnOfflineMode,
- val type: String,
- val detailImageUrls: List,
-) {
- val progressStatus: EventProgressStatus
- get() = EventProgressStatus.create(startDate, endDate)
-
- val applicationStatus: EventApplyingStatus
- get() = EventApplyingStatus.create(applyingStartDate, applyingEndDate)
-}
diff --git a/android/2023-emmsale/app/src/main/java/com/emmsale/data/model/FeedDetail.kt b/android/2023-emmsale/app/src/main/java/com/emmsale/data/model/Feed.kt
similarity index 67%
rename from android/2023-emmsale/app/src/main/java/com/emmsale/data/model/FeedDetail.kt
rename to android/2023-emmsale/app/src/main/java/com/emmsale/data/model/Feed.kt
index 59ddd4f44..4aa08e9db 100644
--- a/android/2023-emmsale/app/src/main/java/com/emmsale/data/model/FeedDetail.kt
+++ b/android/2023-emmsale/app/src/main/java/com/emmsale/data/model/Feed.kt
@@ -2,13 +2,16 @@ package com.emmsale.data.model
import java.time.LocalDateTime
-data class FeedDetail(
+data class Feed(
val id: Long,
val eventId: Long,
val title: String,
val content: String,
- val writer: Writer,
+ val writer: Member,
val imageUrls: List,
+ val commentCount: Int,
val createdAt: LocalDateTime,
val updatedAt: LocalDateTime,
-)
+) {
+ val titleImageUrl = imageUrls.firstOrNull()
+}
diff --git a/android/2023-emmsale/app/src/main/java/com/emmsale/data/model/Member.kt b/android/2023-emmsale/app/src/main/java/com/emmsale/data/model/Member.kt
index 7109ae0d9..fae72c561 100644
--- a/android/2023-emmsale/app/src/main/java/com/emmsale/data/model/Member.kt
+++ b/android/2023-emmsale/app/src/main/java/com/emmsale/data/model/Member.kt
@@ -9,7 +9,7 @@ data class Member(
val activities: List = emptyList(),
) {
val fields: List
- get() = activities.filter { it.activityType == ActivityType.FIELD }
+ get() = activities.filter { it.activityType == ActivityType.INTEREST_FIELD }
val educations: List
get() = activities.filter { it.activityType == ActivityType.EDUCATION }
diff --git a/android/2023-emmsale/app/src/main/java/com/emmsale/data/model/Message.kt b/android/2023-emmsale/app/src/main/java/com/emmsale/data/model/Message.kt
index 26b527d87..bb36b4076 100644
--- a/android/2023-emmsale/app/src/main/java/com/emmsale/data/model/Message.kt
+++ b/android/2023-emmsale/app/src/main/java/com/emmsale/data/model/Message.kt
@@ -4,8 +4,9 @@ import java.time.LocalDateTime
import java.time.format.DateTimeFormatter
data class Message(
- val senderId: Long,
- val message: String,
+ val id: Long,
+ val sender: Member,
+ val content: String,
val createdAt: LocalDateTime,
) {
fun isSameDateTime(other: Message): Boolean {
@@ -13,7 +14,7 @@ data class Message(
}
fun isDifferentSender(other: Message): Boolean {
- return senderId != other.senderId
+ return sender.id != other.sender.id
}
fun isDifferentDate(other: Message): Boolean {
@@ -23,9 +24,15 @@ data class Message(
companion object {
private const val MESSAGE_DATE_FORMAT = "yyyy:MM:dd:HH:mm:ss"
- fun create(senderId: Long, message: String, createdAt: String): Message = Message(
- senderId,
- message,
+ fun create(
+ id: Long,
+ sender: Member,
+ content: String,
+ createdAt: String,
+ ): Message = Message(
+ id = id,
+ sender = sender,
+ content = content,
LocalDateTime.parse(createdAt, DateTimeFormatter.ofPattern(MESSAGE_DATE_FORMAT)),
)
}
diff --git a/android/2023-emmsale/app/src/main/java/com/emmsale/data/model/MessageRoom.kt b/android/2023-emmsale/app/src/main/java/com/emmsale/data/model/MessageRoom.kt
index 370ebbfb5..c40b4a1dd 100644
--- a/android/2023-emmsale/app/src/main/java/com/emmsale/data/model/MessageRoom.kt
+++ b/android/2023-emmsale/app/src/main/java/com/emmsale/data/model/MessageRoom.kt
@@ -2,7 +2,6 @@ package com.emmsale.data.model
data class MessageRoom(
val roomId: String,
- val senderName: String,
- val messageRoomImageUrl: String,
+ val interlocutor: Member,
val recentMessage: Message,
)
diff --git a/android/2023-emmsale/app/src/main/java/com/emmsale/data/model/Post.kt b/android/2023-emmsale/app/src/main/java/com/emmsale/data/model/Post.kt
deleted file mode 100644
index 818d3b312..000000000
--- a/android/2023-emmsale/app/src/main/java/com/emmsale/data/model/Post.kt
+++ /dev/null
@@ -1,14 +0,0 @@
-package com.emmsale.data.model
-
-import java.time.LocalDateTime
-
-data class Post(
- val id: Long,
- val eventId: Long,
- val title: String,
- val content: String,
- val titleImageUrl: String?,
- val createdAt: LocalDateTime,
- val updatedAt: LocalDateTime,
- val commentCount: Int,
-)
diff --git a/android/2023-emmsale/app/src/main/java/com/emmsale/data/model/Recruitment.kt b/android/2023-emmsale/app/src/main/java/com/emmsale/data/model/Recruitment.kt
index bcba30640..de3f84e7a 100644
--- a/android/2023-emmsale/app/src/main/java/com/emmsale/data/model/Recruitment.kt
+++ b/android/2023-emmsale/app/src/main/java/com/emmsale/data/model/Recruitment.kt
@@ -4,9 +4,8 @@ import java.time.LocalDate
data class Recruitment(
val id: Long,
- val memberId: Long,
- val name: String,
- val imageUrl: String,
+ val writer: Member,
+ val event: Event,
val content: String?,
val updatedDate: LocalDate,
)
diff --git a/android/2023-emmsale/app/src/main/java/com/emmsale/data/model/ScrappedEvent.kt b/android/2023-emmsale/app/src/main/java/com/emmsale/data/model/ScrappedEvent.kt
deleted file mode 100644
index edd4d2705..000000000
--- a/android/2023-emmsale/app/src/main/java/com/emmsale/data/model/ScrappedEvent.kt
+++ /dev/null
@@ -1,22 +0,0 @@
-package com.emmsale.data.model
-
-import java.time.LocalDateTime
-
-data class ScrappedEvent(
- val id: Long,
- val name: String,
- val startDate: LocalDateTime,
- val endDate: LocalDateTime,
- val applyingStartDate: LocalDateTime,
- val applyingEndDate: LocalDateTime,
- val tags: List,
- val posterUrl: String?,
- val onOfflineMode: OnOfflineMode,
- val paymentType: PaymentType,
-) {
- val progressStatus: EventProgressStatus
- get() = EventProgressStatus.create(startDate, endDate)
-
- val applicationStatus: EventApplyingStatus
- get() = EventApplyingStatus.create(applyingStartDate, applyingEndDate)
-}
diff --git a/android/2023-emmsale/app/src/main/java/com/emmsale/data/model/Writer.kt b/android/2023-emmsale/app/src/main/java/com/emmsale/data/model/Writer.kt
deleted file mode 100644
index a75279b55..000000000
--- a/android/2023-emmsale/app/src/main/java/com/emmsale/data/model/Writer.kt
+++ /dev/null
@@ -1,7 +0,0 @@
-package com.emmsale.data.model
-
-data class Writer(
- val id: Long,
- val name: String,
- val imageUrl: String,
-)
diff --git a/android/2023-emmsale/app/src/main/java/com/emmsale/data/repository/concretes/DefaultActivityRepository.kt b/android/2023-emmsale/app/src/main/java/com/emmsale/data/repository/concretes/DefaultActivityRepository.kt
index 09caee3b7..b082aa419 100644
--- a/android/2023-emmsale/app/src/main/java/com/emmsale/data/repository/concretes/DefaultActivityRepository.kt
+++ b/android/2023-emmsale/app/src/main/java/com/emmsale/data/repository/concretes/DefaultActivityRepository.kt
@@ -1,6 +1,6 @@
package com.emmsale.data.repository.concretes
-import com.emmsale.data.apiModel.response.ActivitiesResponse
+import com.emmsale.data.apiModel.response.ActivityResponse
import com.emmsale.data.common.retrofit.callAdapter.ApiResponse
import com.emmsale.data.common.retrofit.callAdapter.Success
import com.emmsale.data.mapper.toData
@@ -22,7 +22,7 @@ class DefaultActivityRepository @Inject constructor(
if (allActivities.isNotEmpty()) return@withContext Success(allActivities)
val result = activityService
.getActivities()
- .map(List::toData)
+ .map(List::toData)
if (result is Success) {
allActivities = result.data
diff --git a/android/2023-emmsale/app/src/main/java/com/emmsale/data/repository/concretes/DefaultEventRepository.kt b/android/2023-emmsale/app/src/main/java/com/emmsale/data/repository/concretes/DefaultEventRepository.kt
index 7954ef62d..3fae05231 100644
--- a/android/2023-emmsale/app/src/main/java/com/emmsale/data/repository/concretes/DefaultEventRepository.kt
+++ b/android/2023-emmsale/app/src/main/java/com/emmsale/data/repository/concretes/DefaultEventRepository.kt
@@ -1,16 +1,18 @@
package com.emmsale.data.repository.concretes
-import com.emmsale.data.apiModel.response.CompetitionResponse
-import com.emmsale.data.apiModel.response.ConferenceResponse
-import com.emmsale.data.apiModel.response.EventDetailResponse
+import com.emmsale.data.apiModel.request.ScrappedEventCreateRequest
+import com.emmsale.data.apiModel.response.EventResponse
import com.emmsale.data.common.retrofit.callAdapter.ApiResponse
+import com.emmsale.data.common.retrofit.callAdapter.Failure
+import com.emmsale.data.common.retrofit.callAdapter.NetworkError
+import com.emmsale.data.common.retrofit.callAdapter.Success
+import com.emmsale.data.common.retrofit.callAdapter.Unexpected
import com.emmsale.data.mapper.toApiModel
import com.emmsale.data.mapper.toData
import com.emmsale.data.model.CompetitionStatus
import com.emmsale.data.model.ConferenceStatus
import com.emmsale.data.model.Event
import com.emmsale.data.model.EventCategory
-import com.emmsale.data.model.EventDetail
import com.emmsale.data.model.EventTag
import com.emmsale.data.repository.interfaces.EventRepository
import com.emmsale.data.service.EventService
@@ -38,7 +40,7 @@ class DefaultEventRepository @Inject constructor(
tags = tags.map { it.name },
startDate = startDate?.toRequestFormat(),
endDate = endDate?.toRequestFormat(),
- ).map(List::toData)
+ ).map { it.toData() }
}
override suspend fun getCompetitions(
@@ -53,13 +55,13 @@ class DefaultEventRepository @Inject constructor(
tags = tags.map { it.name },
startDate = startDate?.toRequestFormat(),
endDate = endDate?.toRequestFormat(),
- ).map(List::toData)
+ ).map { it.toData() }
}
- override suspend fun getEventDetail(eventId: Long): ApiResponse {
+ override suspend fun getEventDetail(eventId: Long): ApiResponse {
return eventService
.getEventDetail(eventId)
- .map(EventDetailResponse::toData)
+ .map(EventResponse::toData)
}
override suspend fun searchEvents(
@@ -77,7 +79,7 @@ class DefaultEventRepository @Inject constructor(
tags = tags.map { it.name },
statuses = statuses.toApiModel(),
category = category,
- ).map(List::toData)
+ ).map { it.toData() }
}
private fun EventCategory.toApiModel(): String = when (this) {
@@ -88,4 +90,31 @@ class DefaultEventRepository @Inject constructor(
private fun LocalDate?.toRequestFormat(): String? {
return DateTimeFormatter.ofPattern("yyyy-MM-dd").format(this)
}
+
+ override suspend fun getScrappedEvents(): ApiResponse> {
+ return eventService
+ .getScrappedEvents()
+ .map(List::toData)
+ }
+
+ override suspend fun scrapEvent(eventId: Long): ApiResponse {
+ return eventService.scrapEvent(
+ ScrappedEventCreateRequest(eventId),
+ )
+ }
+
+ override suspend fun deleteScrap(eventId: Long): ApiResponse {
+ return eventService.deleteScrap(eventId)
+ }
+
+ override suspend fun isScraped(eventId: Long): ApiResponse {
+ return when (val response = getScrappedEvents()) {
+ is Failure -> response
+ is NetworkError -> response
+ is Unexpected -> response
+ is Success -> Success(
+ response.data.any { it.id == eventId },
+ )
+ }
+ }
}
diff --git a/android/2023-emmsale/app/src/main/java/com/emmsale/data/repository/concretes/DefaultFeedRepository.kt b/android/2023-emmsale/app/src/main/java/com/emmsale/data/repository/concretes/DefaultFeedRepository.kt
index 13d4a55be..c0e3ed3ab 100644
--- a/android/2023-emmsale/app/src/main/java/com/emmsale/data/repository/concretes/DefaultFeedRepository.kt
+++ b/android/2023-emmsale/app/src/main/java/com/emmsale/data/repository/concretes/DefaultFeedRepository.kt
@@ -1,14 +1,20 @@
package com.emmsale.data.repository.concretes
-import com.emmsale.data.apiModel.response.FeedDetailResponse
+import com.emmsale.data.apiModel.response.FeedResponse
import com.emmsale.data.common.retrofit.callAdapter.ApiResponse
import com.emmsale.data.mapper.toData
-import com.emmsale.data.model.FeedDetail
+import com.emmsale.data.model.Feed
import com.emmsale.data.repository.interfaces.FeedRepository
import com.emmsale.data.service.FeedService
import com.emmsale.di.modules.other.IoDispatcher
import kotlinx.coroutines.CoroutineDispatcher
import kotlinx.coroutines.withContext
+import okhttp3.MediaType.Companion.toMediaTypeOrNull
+import okhttp3.MultipartBody
+import okhttp3.RequestBody
+import okhttp3.RequestBody.Companion.asRequestBody
+import okhttp3.RequestBody.Companion.toRequestBody
+import java.io.File
import javax.inject.Inject
class DefaultFeedRepository @Inject constructor(
@@ -16,12 +22,18 @@ class DefaultFeedRepository @Inject constructor(
private val feedService: FeedService,
) : FeedRepository {
+ override suspend fun getFeeds(eventId: Long): ApiResponse> {
+ return feedService
+ .getFeeds(eventId)
+ .map { it.toData() }
+ }
+
override suspend fun getFeed(
feedId: Long,
- ): ApiResponse = withContext(dispatcher) {
+ ): ApiResponse = withContext(dispatcher) {
feedService
.getFeed(feedId)
- .map(FeedDetailResponse::toData)
+ .map(FeedResponse::toData)
}
override suspend fun deleteFeed(
@@ -29,4 +41,36 @@ class DefaultFeedRepository @Inject constructor(
): ApiResponse = withContext(dispatcher) {
feedService.deleteFeed(feedId)
}
+
+ override suspend fun uploadFeed(
+ eventId: Long,
+ title: String,
+ content: String,
+ imageFiles: List,
+ ): ApiResponse {
+ val imageRequestBodies = imageFiles.map { file ->
+ val requestFile = file.asRequestBody("image/*".toMediaTypeOrNull())
+ MultipartBody.Part.createFormData(
+ IMAGES_KEY,
+ file.name,
+ requestFile,
+ )
+ }
+
+ val contentRequestBodies = HashMap()
+ contentRequestBodies[EVENT_ID_KEY] =
+ eventId.toString().toRequestBody("application/json".toMediaTypeOrNull())
+ contentRequestBodies[TITLE_KEY] =
+ title.toRequestBody("application/json".toMediaTypeOrNull())
+ contentRequestBodies[CONTENT_KEY] =
+ content.toRequestBody("application/json".toMediaTypeOrNull())
+ return feedService.uploadFeed(contentRequestBodies, imageRequestBodies)
+ }
+
+ companion object {
+ const val EVENT_ID_KEY = "eventId"
+ const val TITLE_KEY = "title"
+ const val CONTENT_KEY = "content"
+ const val IMAGES_KEY = "images"
+ }
}
diff --git a/android/2023-emmsale/app/src/main/java/com/emmsale/data/repository/concretes/DefaultMemberRepository.kt b/android/2023-emmsale/app/src/main/java/com/emmsale/data/repository/concretes/DefaultMemberRepository.kt
index 285c13063..dbd48f493 100644
--- a/android/2023-emmsale/app/src/main/java/com/emmsale/data/repository/concretes/DefaultMemberRepository.kt
+++ b/android/2023-emmsale/app/src/main/java/com/emmsale/data/repository/concretes/DefaultMemberRepository.kt
@@ -1,6 +1,6 @@
package com.emmsale.data.repository.concretes
-import com.emmsale.data.apiModel.request.MemberActivitiesUpdateRequest
+import com.emmsale.data.apiModel.request.MemberActivitiesAddRequest
import com.emmsale.data.apiModel.request.MemberBlockCreateRequest
import com.emmsale.data.apiModel.request.MemberCreateRequest
import com.emmsale.data.apiModel.request.MemberDescriptionUpdateRequest
@@ -105,8 +105,8 @@ class DefaultMemberRepository @Inject constructor(
activityIds: List,
): ApiResponse = withContext(dispatcher) {
memberService.addMemberActivities(
- MemberActivitiesUpdateRequest(activityIds),
- )
+ body = MemberActivitiesAddRequest(activityIds),
+ ).map { }
}
override suspend fun deleteMemberActivities(
diff --git a/android/2023-emmsale/app/src/main/java/com/emmsale/data/repository/concretes/DefaultMessageRoomRepository.kt b/android/2023-emmsale/app/src/main/java/com/emmsale/data/repository/concretes/DefaultMessageRoomRepository.kt
index a0bee2698..088d43a8d 100644
--- a/android/2023-emmsale/app/src/main/java/com/emmsale/data/repository/concretes/DefaultMessageRoomRepository.kt
+++ b/android/2023-emmsale/app/src/main/java/com/emmsale/data/repository/concretes/DefaultMessageRoomRepository.kt
@@ -18,11 +18,12 @@ class DefaultMessageRoomRepository @Inject constructor(
@IoDispatcher private val dispatcher: CoroutineDispatcher,
private val messageRoomService: MessageRoomService,
) : MessageRoomRepository {
+
override suspend fun getMessageRooms(
memberId: Long,
): ApiResponse> = withContext(dispatcher) {
messageRoomService
- .getMessageRooms(memberId)
+ .getMessageRooms2(memberId)
.map(List::toData)
}
@@ -31,7 +32,7 @@ class DefaultMessageRoomRepository @Inject constructor(
memberId: Long,
): ApiResponse> = withContext(dispatcher) {
messageRoomService
- .getMessagesByRoomId(roomId, memberId)
+ .getMessagesByRoomId2(roomId, memberId)
.map(List::toData)
}
diff --git a/android/2023-emmsale/app/src/main/java/com/emmsale/data/repository/concretes/DefaultPostRepository.kt b/android/2023-emmsale/app/src/main/java/com/emmsale/data/repository/concretes/DefaultPostRepository.kt
deleted file mode 100644
index 99987cca1..000000000
--- a/android/2023-emmsale/app/src/main/java/com/emmsale/data/repository/concretes/DefaultPostRepository.kt
+++ /dev/null
@@ -1,55 +0,0 @@
-package com.emmsale.data.repository.concretes
-
-import com.emmsale.data.common.retrofit.callAdapter.ApiResponse
-import com.emmsale.data.mapper.toData
-import com.emmsale.data.model.Post
-import com.emmsale.data.repository.interfaces.PostRepository
-import com.emmsale.data.service.PostService
-import okhttp3.MediaType.Companion.toMediaTypeOrNull
-import okhttp3.MultipartBody
-import okhttp3.RequestBody
-import okhttp3.RequestBody.Companion.asRequestBody
-import okhttp3.RequestBody.Companion.toRequestBody
-import java.io.File
-import javax.inject.Inject
-
-class DefaultPostRepository @Inject constructor(
- private val postService: PostService,
-) : PostRepository {
-
- override suspend fun getPosts(eventId: Long): ApiResponse> {
- return postService
- .getPosts(eventId)
- .map { it.toData() }
- }
-
- override suspend fun uploadPost(
- eventId: Long,
- title: String,
- content: String,
- imageFiles: List,
- ): ApiResponse {
- val imageRequestBodies = imageFiles.map { file ->
- val requestFile = file.asRequestBody("image/*".toMediaTypeOrNull())
- MultipartBody.Part.createFormData(
- IMAGES_KEY,
- file.name,
- requestFile,
- )
- }
-
- val contentRequestBodies = HashMap()
- contentRequestBodies[EVENT_ID_KEY] =
- eventId.toString().toRequestBody("application/json".toMediaTypeOrNull())
- contentRequestBodies[TITLE_KEY] = title.toRequestBody("application/json".toMediaTypeOrNull())
- contentRequestBodies[CONTENT_KEY] = content.toRequestBody("application/json".toMediaTypeOrNull())
- return postService.uploadPost(contentRequestBodies, imageRequestBodies)
- }
-
- companion object {
- const val EVENT_ID_KEY = "eventId"
- const val TITLE_KEY = "title"
- const val CONTENT_KEY = "content"
- const val IMAGES_KEY = "images"
- }
-}
diff --git a/android/2023-emmsale/app/src/main/java/com/emmsale/data/repository/concretes/DefaultRecruitmentRepository.kt b/android/2023-emmsale/app/src/main/java/com/emmsale/data/repository/concretes/DefaultRecruitmentRepository.kt
index feefd6d77..6a39475f0 100644
--- a/android/2023-emmsale/app/src/main/java/com/emmsale/data/repository/concretes/DefaultRecruitmentRepository.kt
+++ b/android/2023-emmsale/app/src/main/java/com/emmsale/data/repository/concretes/DefaultRecruitmentRepository.kt
@@ -3,7 +3,6 @@ package com.emmsale.data.repository.concretes
import com.emmsale.data.apiModel.request.RecruitmentCreateRequest
import com.emmsale.data.apiModel.request.RecruitmentDeleteRequest
import com.emmsale.data.apiModel.request.RecruitmentReportCreateRequest
-import com.emmsale.data.apiModel.request.RecruitmentRequestCreateRequest
import com.emmsale.data.apiModel.response.RecruitmentResponse
import com.emmsale.data.common.retrofit.callAdapter.ApiResponse
import com.emmsale.data.common.retrofit.callAdapter.Failure
@@ -89,29 +88,6 @@ class DefaultRecruitmentRepository @Inject constructor(
recruitmentDeleteRequest = RecruitmentDeleteRequest(content),
)
- override suspend fun requestCompanion(
- eventId: Long,
- memberId: Long,
- message: String,
- ): ApiResponse = recruitmentService.postCompanion(
- RecruitmentRequestCreateRequest(
- senderId = myUid,
- receiverId = memberId,
- eventId = eventId,
- message = message,
- ),
- )
-
- override suspend fun checkIsAlreadyRequestCompanion(
- eventId: Long,
- senderId: Long,
- receiverId: Long,
- ): ApiResponse = recruitmentService.checkIsAlreadyRequestCompanion(
- eventId = eventId,
- senderId = senderId,
- receiverId = receiverId,
- )
-
override suspend fun checkIsAlreadyPostRecruitment(
eventId: Long,
): ApiResponse = recruitmentService
diff --git a/android/2023-emmsale/app/src/main/java/com/emmsale/data/repository/concretes/DefaultScrappedEventRepository.kt b/android/2023-emmsale/app/src/main/java/com/emmsale/data/repository/concretes/DefaultScrappedEventRepository.kt
deleted file mode 100644
index 46d1d10cf..000000000
--- a/android/2023-emmsale/app/src/main/java/com/emmsale/data/repository/concretes/DefaultScrappedEventRepository.kt
+++ /dev/null
@@ -1,46 +0,0 @@
-package com.emmsale.data.repository.concretes
-
-import com.emmsale.data.apiModel.request.ScrappedEventCreateRequest
-import com.emmsale.data.apiModel.response.ScrappedEventResponse
-import com.emmsale.data.common.retrofit.callAdapter.ApiResponse
-import com.emmsale.data.common.retrofit.callAdapter.Failure
-import com.emmsale.data.common.retrofit.callAdapter.NetworkError
-import com.emmsale.data.common.retrofit.callAdapter.Success
-import com.emmsale.data.common.retrofit.callAdapter.Unexpected
-import com.emmsale.data.mapper.toData
-import com.emmsale.data.model.ScrappedEvent
-import com.emmsale.data.repository.interfaces.ScrappedEventRepository
-import com.emmsale.data.service.ScrappedEventService
-import javax.inject.Inject
-
-class DefaultScrappedEventRepository @Inject constructor(
- private val scrappedEventService: ScrappedEventService,
-) : ScrappedEventRepository {
-
- override suspend fun getScrappedEvents(): ApiResponse> {
- return scrappedEventService
- .getScrappedEvents()
- .map(List::toData)
- }
-
- override suspend fun scrapEvent(eventId: Long): ApiResponse {
- return scrappedEventService.scrapEvent(
- ScrappedEventCreateRequest(eventId),
- )
- }
-
- override suspend fun deleteScrap(eventId: Long): ApiResponse {
- return scrappedEventService.deleteScrap(eventId)
- }
-
- override suspend fun isScraped(eventId: Long): ApiResponse {
- return when (val response = getScrappedEvents()) {
- is Failure -> response
- is NetworkError -> response
- is Unexpected -> response
- is Success -> Success(
- response.data.any { it.id == eventId },
- )
- }
- }
-}
diff --git a/android/2023-emmsale/app/src/main/java/com/emmsale/data/repository/interfaces/EventRepository.kt b/android/2023-emmsale/app/src/main/java/com/emmsale/data/repository/interfaces/EventRepository.kt
index 013826957..4a8bf85d9 100644
--- a/android/2023-emmsale/app/src/main/java/com/emmsale/data/repository/interfaces/EventRepository.kt
+++ b/android/2023-emmsale/app/src/main/java/com/emmsale/data/repository/interfaces/EventRepository.kt
@@ -4,7 +4,6 @@ import com.emmsale.data.common.retrofit.callAdapter.ApiResponse
import com.emmsale.data.model.CompetitionStatus
import com.emmsale.data.model.ConferenceStatus
import com.emmsale.data.model.Event
-import com.emmsale.data.model.EventDetail
import com.emmsale.data.model.EventTag
import java.time.LocalDate
@@ -24,7 +23,7 @@ interface EventRepository {
endDate: LocalDate? = null,
): ApiResponse>
- suspend fun getEventDetail(eventId: Long): ApiResponse
+ suspend fun getEventDetail(eventId: Long): ApiResponse
suspend fun searchEvents(
keyword: String,
@@ -34,4 +33,12 @@ interface EventRepository {
statuses: List = emptyList(),
category: String? = null,
): ApiResponse>
+
+ suspend fun getScrappedEvents(): ApiResponse>
+
+ suspend fun scrapEvent(eventId: Long): ApiResponse
+
+ suspend fun deleteScrap(eventId: Long): ApiResponse
+
+ suspend fun isScraped(eventId: Long): ApiResponse
}
diff --git a/android/2023-emmsale/app/src/main/java/com/emmsale/data/repository/interfaces/FeedRepository.kt b/android/2023-emmsale/app/src/main/java/com/emmsale/data/repository/interfaces/FeedRepository.kt
index 5b009eb4b..19c5250e4 100644
--- a/android/2023-emmsale/app/src/main/java/com/emmsale/data/repository/interfaces/FeedRepository.kt
+++ b/android/2023-emmsale/app/src/main/java/com/emmsale/data/repository/interfaces/FeedRepository.kt
@@ -1,11 +1,21 @@
package com.emmsale.data.repository.interfaces
import com.emmsale.data.common.retrofit.callAdapter.ApiResponse
-import com.emmsale.data.model.FeedDetail
+import com.emmsale.data.model.Feed
+import java.io.File
interface FeedRepository {
- suspend fun getFeed(feedId: Long): ApiResponse
+ suspend fun getFeeds(eventId: Long): ApiResponse>
+
+ suspend fun getFeed(feedId: Long): ApiResponse
suspend fun deleteFeed(feedId: Long): ApiResponse
+
+ suspend fun uploadFeed(
+ eventId: Long,
+ title: String,
+ content: String,
+ imageFiles: List,
+ ): ApiResponse
}
diff --git a/android/2023-emmsale/app/src/main/java/com/emmsale/data/repository/interfaces/MessageRoomRepository.kt b/android/2023-emmsale/app/src/main/java/com/emmsale/data/repository/interfaces/MessageRoomRepository.kt
index 51c816bee..c136dc0a6 100644
--- a/android/2023-emmsale/app/src/main/java/com/emmsale/data/repository/interfaces/MessageRoomRepository.kt
+++ b/android/2023-emmsale/app/src/main/java/com/emmsale/data/repository/interfaces/MessageRoomRepository.kt
@@ -5,6 +5,12 @@ import com.emmsale.data.model.Message
import com.emmsale.data.model.MessageRoom
interface MessageRoomRepository {
+ suspend fun sendMessage(
+ senderId: Long,
+ receiverId: Long,
+ message: String,
+ ): ApiResponse
+
suspend fun getMessageRooms(
memberId: Long,
): ApiResponse>
@@ -13,10 +19,4 @@ interface MessageRoomRepository {
roomId: String,
memberId: Long,
): ApiResponse>
-
- suspend fun sendMessage(
- senderId: Long,
- receiverId: Long,
- message: String,
- ): ApiResponse
}
diff --git a/android/2023-emmsale/app/src/main/java/com/emmsale/data/repository/interfaces/PostRepository.kt b/android/2023-emmsale/app/src/main/java/com/emmsale/data/repository/interfaces/PostRepository.kt
deleted file mode 100644
index 64c315b7f..000000000
--- a/android/2023-emmsale/app/src/main/java/com/emmsale/data/repository/interfaces/PostRepository.kt
+++ /dev/null
@@ -1,16 +0,0 @@
-package com.emmsale.data.repository.interfaces
-
-import com.emmsale.data.common.retrofit.callAdapter.ApiResponse
-import com.emmsale.data.model.Post
-import java.io.File
-
-interface PostRepository {
- suspend fun getPosts(eventId: Long): ApiResponse>
-
- suspend fun uploadPost(
- eventId: Long,
- title: String,
- content: String,
- imageFiles: List,
- ): ApiResponse
-}
diff --git a/android/2023-emmsale/app/src/main/java/com/emmsale/data/repository/interfaces/RecruitmentRepository.kt b/android/2023-emmsale/app/src/main/java/com/emmsale/data/repository/interfaces/RecruitmentRepository.kt
index e5104e1ed..8078d1475 100644
--- a/android/2023-emmsale/app/src/main/java/com/emmsale/data/repository/interfaces/RecruitmentRepository.kt
+++ b/android/2023-emmsale/app/src/main/java/com/emmsale/data/repository/interfaces/RecruitmentRepository.kt
@@ -30,18 +30,6 @@ interface RecruitmentRepository {
recruitmentId: Long,
): ApiResponse
- suspend fun requestCompanion(
- eventId: Long,
- memberId: Long,
- message: String,
- ): ApiResponse
-
- suspend fun checkIsAlreadyRequestCompanion(
- eventId: Long,
- senderId: Long,
- receiverId: Long,
- ): ApiResponse
-
suspend fun checkIsAlreadyPostRecruitment(eventId: Long): ApiResponse
suspend fun reportRecruitment(
diff --git a/android/2023-emmsale/app/src/main/java/com/emmsale/data/repository/interfaces/ScrappedEventRepository.kt b/android/2023-emmsale/app/src/main/java/com/emmsale/data/repository/interfaces/ScrappedEventRepository.kt
deleted file mode 100644
index e63a0baf9..000000000
--- a/android/2023-emmsale/app/src/main/java/com/emmsale/data/repository/interfaces/ScrappedEventRepository.kt
+++ /dev/null
@@ -1,15 +0,0 @@
-package com.emmsale.data.repository.interfaces
-
-import com.emmsale.data.common.retrofit.callAdapter.ApiResponse
-import com.emmsale.data.model.ScrappedEvent
-
-interface ScrappedEventRepository {
-
- suspend fun getScrappedEvents(): ApiResponse>
-
- suspend fun scrapEvent(eventId: Long): ApiResponse
-
- suspend fun deleteScrap(eventId: Long): ApiResponse
-
- suspend fun isScraped(eventId: Long): ApiResponse
-}
diff --git a/android/2023-emmsale/app/src/main/java/com/emmsale/data/service/ActivityService.kt b/android/2023-emmsale/app/src/main/java/com/emmsale/data/service/ActivityService.kt
index 8a5db0c3e..a1cfdc44f 100644
--- a/android/2023-emmsale/app/src/main/java/com/emmsale/data/service/ActivityService.kt
+++ b/android/2023-emmsale/app/src/main/java/com/emmsale/data/service/ActivityService.kt
@@ -1,17 +1,16 @@
package com.emmsale.data.service
-import com.emmsale.data.apiModel.response.ActivitiesResponse
-import com.emmsale.data.apiModel.response.MemberActivitiesResponse
+import com.emmsale.data.apiModel.response.ActivityResponse
import com.emmsale.data.common.retrofit.callAdapter.ApiResponse
import retrofit2.http.GET
import retrofit2.http.Path
interface ActivityService {
@GET("/activities")
- suspend fun getActivities(): ApiResponse>
+ suspend fun getActivities(): ApiResponse>
@GET("/members/{memberId}/activities")
suspend fun getActivities(
@Path("memberId") memberId: Long,
- ): ApiResponse>
+ ): ApiResponse>
}
diff --git a/android/2023-emmsale/app/src/main/java/com/emmsale/data/service/EventService.kt b/android/2023-emmsale/app/src/main/java/com/emmsale/data/service/EventService.kt
index cba488fdc..64ab5c44d 100644
--- a/android/2023-emmsale/app/src/main/java/com/emmsale/data/service/EventService.kt
+++ b/android/2023-emmsale/app/src/main/java/com/emmsale/data/service/EventService.kt
@@ -1,10 +1,12 @@
package com.emmsale.data.service
-import com.emmsale.data.apiModel.response.CompetitionResponse
-import com.emmsale.data.apiModel.response.ConferenceResponse
-import com.emmsale.data.apiModel.response.EventDetailResponse
+import com.emmsale.data.apiModel.request.ScrappedEventCreateRequest
+import com.emmsale.data.apiModel.response.EventResponse
import com.emmsale.data.common.retrofit.callAdapter.ApiResponse
+import retrofit2.http.Body
+import retrofit2.http.DELETE
import retrofit2.http.GET
+import retrofit2.http.POST
import retrofit2.http.Path
import retrofit2.http.Query
@@ -16,7 +18,7 @@ interface EventService {
@Query("tags") tags: List = emptyList(),
@Query("start_date") startDate: String? = null,
@Query("end_date") endDate: String? = null,
- ): ApiResponse>
+ ): ApiResponse>
@GET("/events")
suspend fun getCompetitions(
@@ -25,12 +27,12 @@ interface EventService {
@Query("tags") tags: List = emptyList(),
@Query("start_date") startDate: String? = null,
@Query("end_date") endDate: String? = null,
- ): ApiResponse>
+ ): ApiResponse>
@GET("/events/{eventId}")
suspend fun getEventDetail(
@Path("eventId") eventId: Long,
- ): ApiResponse
+ ): ApiResponse
@GET("/events")
suspend fun searchEvents(
@@ -40,5 +42,18 @@ interface EventService {
@Query("tags") tags: List = emptyList(),
@Query("statuses") statuses: List = emptyList(),
@Query("category") category: String? = null,
- ): ApiResponse>
+ ): ApiResponse>
+
+ @GET("/scraps")
+ suspend fun getScrappedEvents(): ApiResponse>
+
+ @POST("/scraps")
+ suspend fun scrapEvent(
+ @Body scrappedEventCreateRequest: ScrappedEventCreateRequest,
+ ): ApiResponse
+
+ @DELETE("/scraps")
+ suspend fun deleteScrap(
+ @Query("event-id") eventId: Long,
+ ): ApiResponse
}
diff --git a/android/2023-emmsale/app/src/main/java/com/emmsale/data/service/FeedService.kt b/android/2023-emmsale/app/src/main/java/com/emmsale/data/service/FeedService.kt
index 3322dfab1..fdedfb756 100644
--- a/android/2023-emmsale/app/src/main/java/com/emmsale/data/service/FeedService.kt
+++ b/android/2023-emmsale/app/src/main/java/com/emmsale/data/service/FeedService.kt
@@ -1,20 +1,39 @@
package com.emmsale.data.service
-import com.emmsale.data.apiModel.response.FeedDetailResponse
+import com.emmsale.data.apiModel.response.FeedResponse
import com.emmsale.data.common.retrofit.callAdapter.ApiResponse
+import okhttp3.MultipartBody
+import okhttp3.RequestBody
import retrofit2.http.DELETE
import retrofit2.http.GET
+import retrofit2.http.Multipart
+import retrofit2.http.POST
+import retrofit2.http.Part
+import retrofit2.http.PartMap
import retrofit2.http.Path
+import retrofit2.http.Query
interface FeedService {
+ @GET("/feeds?")
+ suspend fun getFeeds(
+ @Query("event-id") eventId: Long,
+ ): ApiResponse>
+
@GET("/feeds/{feedId}")
suspend fun getFeed(
@Path("feedId") feedId: Long,
- ): ApiResponse
+ ): ApiResponse
@DELETE("/feeds/{feedId}")
suspend fun deleteFeed(
@Path("feedId") feedId: Long,
): ApiResponse
+
+ @Multipart // <- 이 부분이 중요
+ @POST("/feeds")
+ suspend fun uploadFeed(
+ @PartMap feedPostRequest: HashMap,
+ @Part images: List,
+ ): ApiResponse
}
diff --git a/android/2023-emmsale/app/src/main/java/com/emmsale/data/service/MemberService.kt b/android/2023-emmsale/app/src/main/java/com/emmsale/data/service/MemberService.kt
index 97d5eca4f..c8e4fd3d0 100644
--- a/android/2023-emmsale/app/src/main/java/com/emmsale/data/service/MemberService.kt
+++ b/android/2023-emmsale/app/src/main/java/com/emmsale/data/service/MemberService.kt
@@ -1,11 +1,10 @@
package com.emmsale.data.service
-import com.emmsale.data.apiModel.request.MemberActivitiesUpdateRequest
+import com.emmsale.data.apiModel.request.MemberActivitiesAddRequest
import com.emmsale.data.apiModel.request.MemberBlockCreateRequest
import com.emmsale.data.apiModel.request.MemberCreateRequest
import com.emmsale.data.apiModel.request.MemberDescriptionUpdateRequest
-import com.emmsale.data.apiModel.request.MemberOpenProfileUrlUpdateRequest
-import com.emmsale.data.apiModel.response.MemberActivitiesResponse
+import com.emmsale.data.apiModel.response.ActivityResponse
import com.emmsale.data.apiModel.response.MemberResponse
import com.emmsale.data.apiModel.response.ProfileImageUrlResponse
import com.emmsale.data.common.retrofit.callAdapter.ApiResponse
@@ -38,11 +37,6 @@ interface MemberService {
@Body memberDescriptionUpdateRequest: MemberDescriptionUpdateRequest,
): ApiResponse
- @PUT("/members/open-profile-url")
- suspend fun updateMemberOpenProfileUrl(
- @Body memberOpenProfileUrlUpdateRequest: MemberOpenProfileUrlUpdateRequest,
- ): ApiResponse
-
@Multipart // <- 이 부분이 중요
@PATCH("/members/{memberId}/profile")
suspend fun updateMemberProfileImage(
@@ -52,13 +46,13 @@ interface MemberService {
@POST("/members/activities")
suspend fun addMemberActivities(
- @Body memberActivitiesUpdateRequest: MemberActivitiesUpdateRequest,
- ): ApiResponse
+ @Body body: MemberActivitiesAddRequest,
+ ): ApiResponse>
@DELETE("/members/activities")
suspend fun deleteMemberActivities(
@Query("activity-ids") ids: List,
- ): ApiResponse>
+ ): ApiResponse>
@DELETE("/members/{memberId}")
suspend fun deleteMember(
diff --git a/android/2023-emmsale/app/src/main/java/com/emmsale/data/service/MessageRoomService.kt b/android/2023-emmsale/app/src/main/java/com/emmsale/data/service/MessageRoomService.kt
index 7213fdb06..73c70c014 100644
--- a/android/2023-emmsale/app/src/main/java/com/emmsale/data/service/MessageRoomService.kt
+++ b/android/2023-emmsale/app/src/main/java/com/emmsale/data/service/MessageRoomService.kt
@@ -13,22 +13,16 @@ import retrofit2.http.Query
interface MessageRoomService {
@GET("/rooms/overview")
- suspend fun getMessageRooms(
+ suspend fun getMessageRooms2(
@Query("member-id") memberId: Long,
): ApiResponse>
@GET("/rooms/{roomId}")
- suspend fun getMessagesByRoomId(
+ suspend fun getMessagesByRoomId2(
@Path("roomId") roomId: String,
@Query("member-id") memberId: Long,
): ApiResponse>
- @GET("/rooms")
- suspend fun getMessagesByMemberIds(
- @Query("member-id") myUid: Long,
- @Query("receiver-id") otherUid: Long,
- ): ApiResponse>
-
@POST("/messages")
suspend fun sendMessage(
@Body message: MessageRequest,
diff --git a/android/2023-emmsale/app/src/main/java/com/emmsale/data/service/PostService.kt b/android/2023-emmsale/app/src/main/java/com/emmsale/data/service/PostService.kt
deleted file mode 100644
index 838555fa3..000000000
--- a/android/2023-emmsale/app/src/main/java/com/emmsale/data/service/PostService.kt
+++ /dev/null
@@ -1,26 +0,0 @@
-package com.emmsale.data.service
-
-import com.emmsale.data.apiModel.response.PostsResponse
-import com.emmsale.data.common.retrofit.callAdapter.ApiResponse
-import okhttp3.MultipartBody
-import okhttp3.RequestBody
-import retrofit2.http.GET
-import retrofit2.http.Multipart
-import retrofit2.http.POST
-import retrofit2.http.Part
-import retrofit2.http.PartMap
-import retrofit2.http.Query
-
-interface PostService {
- @GET("/feeds?")
- suspend fun getPosts(
- @Query("event-id") eventId: Long,
- ): ApiResponse
-
- @Multipart // <- 이 부분이 중요
- @POST("/feeds")
- suspend fun uploadPost(
- @PartMap feedPostRequest: HashMap,
- @Part images: List,
- ): ApiResponse
-}
diff --git a/android/2023-emmsale/app/src/main/java/com/emmsale/data/service/RecruitmentService.kt b/android/2023-emmsale/app/src/main/java/com/emmsale/data/service/RecruitmentService.kt
index 24145f15a..acf03378e 100644
--- a/android/2023-emmsale/app/src/main/java/com/emmsale/data/service/RecruitmentService.kt
+++ b/android/2023-emmsale/app/src/main/java/com/emmsale/data/service/RecruitmentService.kt
@@ -3,7 +3,6 @@ package com.emmsale.data.service
import com.emmsale.data.apiModel.request.RecruitmentCreateRequest
import com.emmsale.data.apiModel.request.RecruitmentDeleteRequest
import com.emmsale.data.apiModel.request.RecruitmentReportCreateRequest
-import com.emmsale.data.apiModel.request.RecruitmentRequestCreateRequest
import com.emmsale.data.apiModel.response.RecruitmentReportResponse
import com.emmsale.data.apiModel.response.RecruitmentResponse
import com.emmsale.data.common.retrofit.callAdapter.ApiResponse
@@ -53,18 +52,6 @@ interface RecruitmentService {
@Query("member-id") memberId: Long,
): ApiResponse
- @POST("/request-notifications")
- suspend fun postCompanion(
- @Body recruitmentRequestCreateRequest: RecruitmentRequestCreateRequest,
- ): ApiResponse
-
- @GET("/request-notifications/existed")
- suspend fun checkIsAlreadyRequestCompanion(
- @Query("receiverId") receiverId: Long,
- @Query("eventId") eventId: Long,
- @Query("senderId") senderId: Long,
- ): ApiResponse
-
@POST("/reports")
suspend fun reportRecruitment(
@Body recruitmentReportCreateRequest: RecruitmentReportCreateRequest,
diff --git a/android/2023-emmsale/app/src/main/java/com/emmsale/data/service/ScrappedEventService.kt b/android/2023-emmsale/app/src/main/java/com/emmsale/data/service/ScrappedEventService.kt
deleted file mode 100644
index 3c5b05726..000000000
--- a/android/2023-emmsale/app/src/main/java/com/emmsale/data/service/ScrappedEventService.kt
+++ /dev/null
@@ -1,25 +0,0 @@
-package com.emmsale.data.service
-
-import com.emmsale.data.apiModel.request.ScrappedEventCreateRequest
-import com.emmsale.data.apiModel.response.ScrappedEventResponse
-import com.emmsale.data.common.retrofit.callAdapter.ApiResponse
-import retrofit2.http.Body
-import retrofit2.http.DELETE
-import retrofit2.http.GET
-import retrofit2.http.POST
-import retrofit2.http.Query
-
-interface ScrappedEventService {
- @GET("/scraps")
- suspend fun getScrappedEvents(): ApiResponse>
-
- @POST("/scraps")
- suspend fun scrapEvent(
- @Body scrappedEventCreateRequest: ScrappedEventCreateRequest,
- ): ApiResponse
-
- @DELETE("/scraps")
- suspend fun deleteScrap(
- @Query("event-id") eventId: Long,
- ): ApiResponse
-}
diff --git a/android/2023-emmsale/app/src/main/java/com/emmsale/di/modules/repository/RepositoryModule.kt b/android/2023-emmsale/app/src/main/java/com/emmsale/di/modules/repository/RepositoryModule.kt
index a6cdb09d4..e93089335 100644
--- a/android/2023-emmsale/app/src/main/java/com/emmsale/di/modules/repository/RepositoryModule.kt
+++ b/android/2023-emmsale/app/src/main/java/com/emmsale/di/modules/repository/RepositoryModule.kt
@@ -16,9 +16,7 @@ import com.emmsale.data.repository.concretes.DefaultMemberRepository
import com.emmsale.data.repository.concretes.DefaultMessageRoomRepository
import com.emmsale.data.repository.concretes.DefaultMyPostRepository
import com.emmsale.data.repository.concretes.DefaultNotificationRepository
-import com.emmsale.data.repository.concretes.DefaultPostRepository
import com.emmsale.data.repository.concretes.DefaultRecruitmentRepository
-import com.emmsale.data.repository.concretes.DefaultScrappedEventRepository
import com.emmsale.data.repository.concretes.DefaultTokenRepository
import com.emmsale.data.repository.interfaces.ActivityRepository
import com.emmsale.data.repository.interfaces.BlockedMemberRepository
@@ -36,9 +34,7 @@ import com.emmsale.data.repository.interfaces.MemberRepository
import com.emmsale.data.repository.interfaces.MessageRoomRepository
import com.emmsale.data.repository.interfaces.MyPostRepository
import com.emmsale.data.repository.interfaces.NotificationRepository
-import com.emmsale.data.repository.interfaces.PostRepository
import com.emmsale.data.repository.interfaces.RecruitmentRepository
-import com.emmsale.data.repository.interfaces.ScrappedEventRepository
import com.emmsale.data.repository.interfaces.TokenRepository
import dagger.Binds
import dagger.Module
@@ -132,12 +128,6 @@ abstract class RepositoryModule {
impl: DefaultNotificationRepository,
): NotificationRepository
- @Binds
- @Singleton
- abstract fun bindScrappedEventRepository(
- impl: DefaultScrappedEventRepository,
- ): ScrappedEventRepository
-
@Binds
@Singleton
abstract fun bindBlockedMemberRepository(
@@ -156,12 +146,6 @@ abstract class RepositoryModule {
impl: DefaultMyPostRepository,
): MyPostRepository
- @Binds
- @Singleton
- abstract fun bindPostRepository(
- impl: DefaultPostRepository,
- ): PostRepository
-
@Binds
@Singleton
abstract fun bindMessageRoomRepository(
diff --git a/android/2023-emmsale/app/src/main/java/com/emmsale/di/modules/service/ServiceModule.kt b/android/2023-emmsale/app/src/main/java/com/emmsale/di/modules/service/ServiceModule.kt
index f4ae0eff3..24a00e194 100644
--- a/android/2023-emmsale/app/src/main/java/com/emmsale/di/modules/service/ServiceModule.kt
+++ b/android/2023-emmsale/app/src/main/java/com/emmsale/di/modules/service/ServiceModule.kt
@@ -13,9 +13,7 @@ import com.emmsale.data.service.MemberService
import com.emmsale.data.service.MessageRoomService
import com.emmsale.data.service.MyPostService
import com.emmsale.data.service.NotificationService
-import com.emmsale.data.service.PostService
import com.emmsale.data.service.RecruitmentService
-import com.emmsale.data.service.ScrappedEventService
import dagger.Module
import dagger.Provides
import dagger.hilt.InstallIn
@@ -84,12 +82,6 @@ class ServiceModule {
serviceFactory: ServiceFactory,
): NotificationService = serviceFactory.create(NotificationService::class.java)
- @Provides
- @Singleton
- fun provideScrappedEventService(
- serviceFactory: ServiceFactory,
- ): ScrappedEventService = serviceFactory.create(ScrappedEventService::class.java)
-
@Provides
@Singleton
fun provideBlockedMemberService(
@@ -102,12 +94,6 @@ class ServiceModule {
serviceFactory: ServiceFactory,
): MyPostService = serviceFactory.create(MyPostService::class.java)
- @Provides
- @Singleton
- fun providePostService(
- serviceFactory: ServiceFactory,
- ): PostService = serviceFactory.create(PostService::class.java)
-
@Provides
@Singleton
fun provideMessageRoomService(
diff --git a/android/2023-emmsale/app/src/main/java/com/emmsale/presentation/common/Event.kt b/android/2023-emmsale/app/src/main/java/com/emmsale/presentation/common/UiEvent.kt
similarity index 79%
rename from android/2023-emmsale/app/src/main/java/com/emmsale/presentation/common/Event.kt
rename to android/2023-emmsale/app/src/main/java/com/emmsale/presentation/common/UiEvent.kt
index d00a9431b..46ae3d0c4 100644
--- a/android/2023-emmsale/app/src/main/java/com/emmsale/presentation/common/Event.kt
+++ b/android/2023-emmsale/app/src/main/java/com/emmsale/presentation/common/UiEvent.kt
@@ -2,7 +2,7 @@ package com.emmsale.presentation.common
import androidx.lifecycle.Observer
-class Event(private val content: T) {
+class UiEvent(private val content: T) {
var hasBeenHandled = false
private set
@@ -17,8 +17,8 @@ class Event(private val content: T) {
fun peekContent(): T = content
}
-class EventObserver(private val onEventUnhandledContent: (T) -> Unit) : Observer> {
- override fun onChanged(value: Event) {
+class EventObserver(private val onEventUnhandledContent: (T) -> Unit) : Observer> {
+ override fun onChanged(value: UiEvent) {
value.getContentIfNotHandled()?.let { event ->
onEventUnhandledContent(event)
}
diff --git a/android/2023-emmsale/app/src/main/java/com/emmsale/presentation/ui/competitionList/recyclerView/CompetitionRecyclerViewAdapter.kt b/android/2023-emmsale/app/src/main/java/com/emmsale/presentation/ui/competitionList/recyclerView/CompetitionRecyclerViewAdapter.kt
index 3880ec0cc..db3b7bbc6 100644
--- a/android/2023-emmsale/app/src/main/java/com/emmsale/presentation/ui/competitionList/recyclerView/CompetitionRecyclerViewAdapter.kt
+++ b/android/2023-emmsale/app/src/main/java/com/emmsale/presentation/ui/competitionList/recyclerView/CompetitionRecyclerViewAdapter.kt
@@ -25,7 +25,7 @@ class CompetitionRecyclerViewAdapter(
currentList
.subList(currentPosition, endPosition)
- .forEach { event -> preload(context, event.posterUrl) }
+ .forEach { event -> preload(context, event.posterImageUrl) }
}
private fun preload(context: Context, url: String?) {
diff --git a/android/2023-emmsale/app/src/main/java/com/emmsale/presentation/ui/conferenceList/recyclerView/ConferenceRecyclerViewAdapter.kt b/android/2023-emmsale/app/src/main/java/com/emmsale/presentation/ui/conferenceList/recyclerView/ConferenceRecyclerViewAdapter.kt
index 02454ae81..1e96a6f3c 100644
--- a/android/2023-emmsale/app/src/main/java/com/emmsale/presentation/ui/conferenceList/recyclerView/ConferenceRecyclerViewAdapter.kt
+++ b/android/2023-emmsale/app/src/main/java/com/emmsale/presentation/ui/conferenceList/recyclerView/ConferenceRecyclerViewAdapter.kt
@@ -26,7 +26,7 @@ class ConferenceRecyclerViewAdapter(
currentList
.subList(currentPosition, endPosition)
- .forEach { event -> preload(context, event.posterUrl) }
+ .forEach { event -> preload(context, event.posterImageUrl) }
}
private fun preload(context: Context, url: String?) {
diff --git a/android/2023-emmsale/app/src/main/java/com/emmsale/presentation/ui/editMyProfile/EditMyProfileViewModel.kt b/android/2023-emmsale/app/src/main/java/com/emmsale/presentation/ui/editMyProfile/EditMyProfileViewModel.kt
index 90e737269..192a9cf0e 100644
--- a/android/2023-emmsale/app/src/main/java/com/emmsale/presentation/ui/editMyProfile/EditMyProfileViewModel.kt
+++ b/android/2023-emmsale/app/src/main/java/com/emmsale/presentation/ui/editMyProfile/EditMyProfileViewModel.kt
@@ -158,10 +158,7 @@ class EditMyProfileViewModel @Inject constructor(
private suspend fun updateMemberActivities(activityIds: List) {
when (val result = memberRepository.addMemberActivities(activityIds)) {
- is Failure, NetworkError ->
- _errorEvents.value =
- EditMyProfileErrorEvent.ACTIVITIES_ADD
-
+ is Failure, NetworkError -> _errorEvents.value = EditMyProfileErrorEvent.ACTIVITIES_ADD
is Success -> refresh()
is Unexpected -> throw Throwable(result.error)
}
diff --git a/android/2023-emmsale/app/src/main/java/com/emmsale/presentation/ui/editMyProfile/uiState/ActivitiesUiState.kt b/android/2023-emmsale/app/src/main/java/com/emmsale/presentation/ui/editMyProfile/uiState/ActivitiesUiState.kt
index cafd9a29a..6f9496285 100644
--- a/android/2023-emmsale/app/src/main/java/com/emmsale/presentation/ui/editMyProfile/uiState/ActivitiesUiState.kt
+++ b/android/2023-emmsale/app/src/main/java/com/emmsale/presentation/ui/editMyProfile/uiState/ActivitiesUiState.kt
@@ -3,14 +3,14 @@ package com.emmsale.presentation.ui.editMyProfile.uiState
import com.emmsale.data.model.Activity
import com.emmsale.data.model.ActivityType.CLUB
import com.emmsale.data.model.ActivityType.EDUCATION
-import com.emmsale.data.model.ActivityType.FIELD
+import com.emmsale.data.model.ActivityType.INTEREST_FIELD
data class ActivitiesUiState(
val isLoading: Boolean = false,
val isError: Boolean = false,
val activities: List = emptyList(),
) {
- val fields = activities.filter { it.activity.activityType == FIELD }
+ val fields = activities.filter { it.activity.activityType == INTEREST_FIELD }
val selectedFieldsSize: Int = fields.count { it.isSelected }
diff --git a/android/2023-emmsale/app/src/main/java/com/emmsale/presentation/ui/eventDetail/EventDetailActivity.kt b/android/2023-emmsale/app/src/main/java/com/emmsale/presentation/ui/eventDetail/EventDetailActivity.kt
index dc3c1780b..f12668014 100644
--- a/android/2023-emmsale/app/src/main/java/com/emmsale/presentation/ui/eventDetail/EventDetailActivity.kt
+++ b/android/2023-emmsale/app/src/main/java/com/emmsale/presentation/ui/eventDetail/EventDetailActivity.kt
@@ -9,15 +9,15 @@ import androidx.activity.viewModels
import androidx.appcompat.app.AppCompatActivity
import com.emmsale.R
import com.emmsale.databinding.ActivityEventDetailBinding
-import com.emmsale.presentation.common.Event
+import com.emmsale.presentation.common.UiEvent
import com.emmsale.presentation.common.extension.showSnackBar
import com.emmsale.presentation.common.firebase.analytics.FirebaseAnalyticsDelegate
import com.emmsale.presentation.common.firebase.analytics.FirebaseAnalyticsDelegateImpl
import com.emmsale.presentation.ui.eventDetail.EventDetailViewModel.Companion.EVENT_ID_KEY
import com.emmsale.presentation.ui.eventDetail.uiState.EventDetailScreenUiState
import com.emmsale.presentation.ui.eventDetailInfo.uiState.EventInfoUiEvent
+import com.emmsale.presentation.ui.feedWriting.FeedWritingActivity
import com.emmsale.presentation.ui.main.MainActivity
-import com.emmsale.presentation.ui.postWriting.PostWritingActivity
import com.emmsale.presentation.ui.recruitmentWriting.RecruitmentPostWritingActivity
import com.google.android.material.tabs.TabLayout
import com.google.android.material.tabs.TabLayoutMediator
@@ -60,7 +60,7 @@ class EventDetailActivity :
}
}
- private fun handleEvent(event: Event) {
+ private fun handleEvent(event: UiEvent) {
val content = event.getContentIfNotHandled() ?: return
when (content) {
EventInfoUiEvent.SCRAP_ERROR -> binding.root.showSnackBar("스크랩 불가")
@@ -88,7 +88,7 @@ class EventDetailActivity :
EventDetailScreenUiState.INFORMATION -> Unit
EventDetailScreenUiState.RECRUITMENT -> viewModel.fetchHasWritingPermission()
EventDetailScreenUiState.POST -> {
- PostWritingActivity.startActivity(this, viewModel.eventId)
+ FeedWritingActivity.startActivity(this, viewModel.eventId)
}
}
}
diff --git a/android/2023-emmsale/app/src/main/java/com/emmsale/presentation/ui/eventDetail/EventDetailFragmentStateAdapter.kt b/android/2023-emmsale/app/src/main/java/com/emmsale/presentation/ui/eventDetail/EventDetailFragmentStateAdapter.kt
index 1fd1bb8e3..61447cdd5 100644
--- a/android/2023-emmsale/app/src/main/java/com/emmsale/presentation/ui/eventDetail/EventDetailFragmentStateAdapter.kt
+++ b/android/2023-emmsale/app/src/main/java/com/emmsale/presentation/ui/eventDetail/EventDetailFragmentStateAdapter.kt
@@ -8,7 +8,7 @@ import com.emmsale.presentation.ui.eventDetail.uiState.EventDetailScreenUiState.
import com.emmsale.presentation.ui.eventDetail.uiState.EventDetailScreenUiState.POST
import com.emmsale.presentation.ui.eventDetail.uiState.EventDetailScreenUiState.RECRUITMENT
import com.emmsale.presentation.ui.eventDetailInfo.EventInfoFragment
-import com.emmsale.presentation.ui.postList.PostListFragment
+import com.emmsale.presentation.ui.feedList.FeedListFragment
import com.emmsale.presentation.ui.recruitmentList.EventRecruitmentFragment
class EventDetailFragmentStateAdapter(
@@ -21,7 +21,7 @@ class EventDetailFragmentStateAdapter(
override fun createFragment(position: Int): Fragment {
return when (EventDetailScreenUiState.from(position)) {
INFORMATION -> EventInfoFragment.create()
- POST -> PostListFragment.create(eventId)
+ POST -> FeedListFragment.create(eventId)
RECRUITMENT -> EventRecruitmentFragment.create(eventId)
}
}
diff --git a/android/2023-emmsale/app/src/main/java/com/emmsale/presentation/ui/eventDetail/EventDetailViewModel.kt b/android/2023-emmsale/app/src/main/java/com/emmsale/presentation/ui/eventDetail/EventDetailViewModel.kt
index 9e3b660e6..c1abeeb28 100644
--- a/android/2023-emmsale/app/src/main/java/com/emmsale/presentation/ui/eventDetail/EventDetailViewModel.kt
+++ b/android/2023-emmsale/app/src/main/java/com/emmsale/presentation/ui/eventDetail/EventDetailViewModel.kt
@@ -9,14 +9,13 @@ import com.emmsale.data.common.retrofit.callAdapter.Failure
import com.emmsale.data.common.retrofit.callAdapter.NetworkError
import com.emmsale.data.common.retrofit.callAdapter.Success
import com.emmsale.data.common.retrofit.callAdapter.Unexpected
-import com.emmsale.data.model.EventDetail
+import com.emmsale.data.model.Event
import com.emmsale.data.repository.interfaces.EventRepository
import com.emmsale.data.repository.interfaces.RecruitmentRepository
-import com.emmsale.data.repository.interfaces.ScrappedEventRepository
-import com.emmsale.presentation.common.Event
import com.emmsale.presentation.common.FetchResult.ERROR
import com.emmsale.presentation.common.FetchResult.LOADING
import com.emmsale.presentation.common.FetchResult.SUCCESS
+import com.emmsale.presentation.common.UiEvent
import com.emmsale.presentation.common.firebase.analytics.logEventClick
import com.emmsale.presentation.common.livedata.NotNullLiveData
import com.emmsale.presentation.common.livedata.NotNullMutableLiveData
@@ -32,7 +31,6 @@ import javax.inject.Inject
class EventDetailViewModel @Inject constructor(
stateHandle: SavedStateHandle,
private val eventRepository: EventRepository,
- private val scrappedEventRepository: ScrappedEventRepository,
private val recruitmentRepository: RecruitmentRepository,
) : ViewModel(), Refreshable {
val eventId = stateHandle[EVENT_ID_KEY] ?: DEFAULT_EVENT_ID
@@ -41,8 +39,8 @@ class EventDetailViewModel @Inject constructor(
NotNullMutableLiveData(EventDetailUiState())
val eventDetail: NotNullLiveData = _eventDetail
- private val _scrapUiEvent = MutableLiveData>()
- val scrapUiEvent: LiveData> = _scrapUiEvent
+ private val _scrapUiEvent = MutableLiveData>()
+ val scrapUiEvent: LiveData> = _scrapUiEvent
private val _isScraped: MutableLiveData = MutableLiveData(false)
val isScraped: LiveData = _isScraped
@@ -50,8 +48,8 @@ class EventDetailViewModel @Inject constructor(
private val _currentScreen = NotNullMutableLiveData(EventDetailScreenUiState.INFORMATION)
val currentScreen: NotNullLiveData = _currentScreen
- private val _hasWritingPermission: MutableLiveData> = MutableLiveData()
- val hasWritingPermission: LiveData> = _hasWritingPermission
+ private val _hasWritingPermission: MutableLiveData> = MutableLiveData()
+ val hasWritingPermission: LiveData> = _hasWritingPermission
init {
refresh()
@@ -78,7 +76,7 @@ class EventDetailViewModel @Inject constructor(
private fun fetchIsScrapped() {
viewModelScope.launch {
- when (val isScrappedFetchResult = scrappedEventRepository.isScraped(eventId)) {
+ when (val isScrappedFetchResult = eventRepository.isScraped(eventId)) {
is Success -> _isScraped.value = isScrappedFetchResult.data
is Failure, NetworkError, is Unexpected -> {}
}
@@ -94,26 +92,26 @@ class EventDetailViewModel @Inject constructor(
private fun scrapEvent() {
viewModelScope.launch {
- when (scrappedEventRepository.scrapEvent(eventId = eventId)) {
+ when (eventRepository.scrapEvent(eventId = eventId)) {
is Success -> _isScraped.value = true
- else -> _scrapUiEvent.value = Event(EventInfoUiEvent.SCRAP_ERROR)
+ else -> _scrapUiEvent.value = UiEvent(EventInfoUiEvent.SCRAP_ERROR)
}
}
}
private fun deleteScrap() {
viewModelScope.launch {
- when (scrappedEventRepository.deleteScrap(eventId = eventId)) {
+ when (eventRepository.deleteScrap(eventId = eventId)) {
is Success -> _isScraped.value = false
- else -> _scrapUiEvent.value = Event(EventInfoUiEvent.SCRAP_DELETE_ERROR)
+ else -> _scrapUiEvent.value = UiEvent(EventInfoUiEvent.SCRAP_DELETE_ERROR)
}
}
}
- private fun changeToSuccessState(eventDetail: EventDetail) {
+ private fun changeToSuccessState(event: Event) {
_eventDetail.value =
- _eventDetail.value.copy(fetchResult = SUCCESS, eventDetail = eventDetail)
- logEventClick(eventDetail.name, eventDetail.id)
+ _eventDetail.value.copy(fetchResult = SUCCESS, eventDetail = event)
+ logEventClick(event.name, event.id)
}
private fun changeToLoadingState() {
@@ -134,7 +132,7 @@ class EventDetailViewModel @Inject constructor(
}
private fun setHasPermissionWritingState(state: Boolean) {
- _hasWritingPermission.value = Event(state)
+ _hasWritingPermission.value = UiEvent(state)
}
companion object {
diff --git a/android/2023-emmsale/app/src/main/java/com/emmsale/presentation/ui/eventDetail/uiState/EventDetailUiState.kt b/android/2023-emmsale/app/src/main/java/com/emmsale/presentation/ui/eventDetail/uiState/EventDetailUiState.kt
index a1f409d98..4812bf04a 100644
--- a/android/2023-emmsale/app/src/main/java/com/emmsale/presentation/ui/eventDetail/uiState/EventDetailUiState.kt
+++ b/android/2023-emmsale/app/src/main/java/com/emmsale/presentation/ui/eventDetail/uiState/EventDetailUiState.kt
@@ -1,10 +1,10 @@
package com.emmsale.presentation.ui.eventDetail.uiState
-import com.emmsale.data.model.EventDetail
+import com.emmsale.data.model.Event
import com.emmsale.presentation.common.FetchResult
import com.emmsale.presentation.common.FetchResultUiState
data class EventDetailUiState(
override val fetchResult: FetchResult = FetchResult.SUCCESS,
- val eventDetail: EventDetail? = null,
+ val eventDetail: Event? = null,
) : FetchResultUiState()
diff --git a/android/2023-emmsale/app/src/main/java/com/emmsale/presentation/ui/feedDetail/FeedDetailActivity.kt b/android/2023-emmsale/app/src/main/java/com/emmsale/presentation/ui/feedDetail/FeedDetailActivity.kt
index 12ece7cda..ddde7a25b 100644
--- a/android/2023-emmsale/app/src/main/java/com/emmsale/presentation/ui/feedDetail/FeedDetailActivity.kt
+++ b/android/2023-emmsale/app/src/main/java/com/emmsale/presentation/ui/feedDetail/FeedDetailActivity.kt
@@ -10,7 +10,7 @@ import androidx.recyclerview.widget.ConcatAdapter
import androidx.recyclerview.widget.RecyclerView
import com.emmsale.R
import com.emmsale.databinding.ActivityFeedDetailBinding
-import com.emmsale.presentation.common.Event
+import com.emmsale.presentation.common.UiEvent
import com.emmsale.presentation.common.extension.showKeyboard
import com.emmsale.presentation.common.extension.showSnackBar
import com.emmsale.presentation.common.extension.showToast
@@ -258,7 +258,7 @@ class FeedDetailActivity : AppCompatActivity() {
viewModel.uiEvent.observe(this, ::handleUiEvent)
}
- private fun handleUiEvent(event: Event) {
+ private fun handleUiEvent(event: UiEvent) {
val content = event.getContentIfNotHandled() ?: return
when (content) {
FeedDetailUiEvent.None -> {}
diff --git a/android/2023-emmsale/app/src/main/java/com/emmsale/presentation/ui/feedDetail/FeedDetailViewModel.kt b/android/2023-emmsale/app/src/main/java/com/emmsale/presentation/ui/feedDetail/FeedDetailViewModel.kt
index c42de4d1c..ceacb7b75 100644
--- a/android/2023-emmsale/app/src/main/java/com/emmsale/presentation/ui/feedDetail/FeedDetailViewModel.kt
+++ b/android/2023-emmsale/app/src/main/java/com/emmsale/presentation/ui/feedDetail/FeedDetailViewModel.kt
@@ -13,8 +13,8 @@ import com.emmsale.data.common.retrofit.callAdapter.Unexpected
import com.emmsale.data.repository.interfaces.CommentRepository
import com.emmsale.data.repository.interfaces.FeedRepository
import com.emmsale.data.repository.interfaces.TokenRepository
-import com.emmsale.presentation.common.Event
import com.emmsale.presentation.common.FetchResult
+import com.emmsale.presentation.common.UiEvent
import com.emmsale.presentation.common.firebase.analytics.logComment
import com.emmsale.presentation.common.livedata.NotNullLiveData
import com.emmsale.presentation.common.livedata.NotNullMutableLiveData
@@ -55,9 +55,9 @@ class FeedDetailViewModel @Inject constructor(
_feedDetail.value.comments.find { commentUiState -> commentUiState.comment.id == it }?.comment?.content
}
- private val _uiEvent: NotNullMutableLiveData> =
- NotNullMutableLiveData(Event(FeedDetailUiEvent.None))
- val uiEvent: NotNullLiveData> = _uiEvent
+ private val _uiEvent: NotNullMutableLiveData> =
+ NotNullMutableLiveData(UiEvent(FeedDetailUiEvent.None))
+ val uiEvent: NotNullLiveData> = _uiEvent
init {
refresh()
@@ -73,7 +73,7 @@ class FeedDetailViewModel @Inject constructor(
when (val result = feedRepository.getFeed(feedId)) {
is Failure -> {
if (result.code == DELETED_FEED_FETCH_ERROR_CODE) {
- _uiEvent.value = Event(FeedDetailUiEvent.DeletedFeedFetch)
+ _uiEvent.value = UiEvent(FeedDetailUiEvent.DeletedFeedFetch)
} else {
_feedDetail.value = _feedDetail.value.copy(fetchResult = FetchResult.ERROR)
}
@@ -89,7 +89,7 @@ class FeedDetailViewModel @Inject constructor(
is Unexpected ->
_uiEvent.value =
- Event(FeedDetailUiEvent.UnexpectedError(result.error.toString()))
+ UiEvent(FeedDetailUiEvent.UnexpectedError(result.error.toString()))
}
}
}
@@ -110,7 +110,7 @@ class FeedDetailViewModel @Inject constructor(
is Unexpected ->
_uiEvent.value =
- Event(FeedDetailUiEvent.UnexpectedError(result.error.toString()))
+ UiEvent(FeedDetailUiEvent.UnexpectedError(result.error.toString()))
}
}
}
@@ -120,7 +120,7 @@ class FeedDetailViewModel @Inject constructor(
_feedDetail.value = _feedDetail.value.copy(fetchResult = FetchResult.LOADING)
when (val result = feedRepository.deleteFeed(feedId)) {
is Failure -> {
- _uiEvent.value = Event(FeedDetailUiEvent.FeedDeleteFail)
+ _uiEvent.value = UiEvent(FeedDetailUiEvent.FeedDeleteFail)
_feedDetail.value = _feedDetail.value.copy(fetchResult = FetchResult.SUCCESS)
}
@@ -128,11 +128,11 @@ class FeedDetailViewModel @Inject constructor(
_feedDetail.value = _feedDetail.value.copy(fetchResult = FetchResult.ERROR)
is Success ->
- _uiEvent.value = Event(FeedDetailUiEvent.FeedDeleteComplete)
+ _uiEvent.value = UiEvent(FeedDetailUiEvent.FeedDeleteComplete)
is Unexpected ->
_uiEvent.value =
- Event(FeedDetailUiEvent.UnexpectedError(result.error.toString()))
+ UiEvent(FeedDetailUiEvent.UnexpectedError(result.error.toString()))
}
}
}
@@ -142,7 +142,7 @@ class FeedDetailViewModel @Inject constructor(
_feedDetail.value = _feedDetail.value.copy(fetchResult = FetchResult.LOADING)
when (val result = commentRepository.saveComment(content, feedId)) {
is Failure -> {
- _uiEvent.value = Event(FeedDetailUiEvent.CommentPostFail)
+ _uiEvent.value = UiEvent(FeedDetailUiEvent.CommentPostFail)
_feedDetail.value = _feedDetail.value.copy(fetchResult = FetchResult.SUCCESS)
logComment(content, feedId)
}
@@ -152,12 +152,12 @@ class FeedDetailViewModel @Inject constructor(
is Success -> {
refresh()
- _uiEvent.value = Event(FeedDetailUiEvent.CommentPostComplete)
+ _uiEvent.value = UiEvent(FeedDetailUiEvent.CommentPostComplete)
}
is Unexpected ->
_uiEvent.value =
- Event(FeedDetailUiEvent.UnexpectedError(result.error.toString()))
+ UiEvent(FeedDetailUiEvent.UnexpectedError(result.error.toString()))
}
}
}
@@ -167,7 +167,7 @@ class FeedDetailViewModel @Inject constructor(
_feedDetail.value = _feedDetail.value.copy(fetchResult = FetchResult.LOADING)
when (val result = commentRepository.updateComment(commentId, content)) {
is Failure -> {
- _uiEvent.value = Event(FeedDetailUiEvent.CommentUpdateFail)
+ _uiEvent.value = UiEvent(FeedDetailUiEvent.CommentUpdateFail)
_feedDetail.value = _feedDetail.value.copy(fetchResult = FetchResult.SUCCESS)
}
@@ -181,7 +181,7 @@ class FeedDetailViewModel @Inject constructor(
is Unexpected ->
_uiEvent.value =
- Event(FeedDetailUiEvent.UnexpectedError(result.error.toString()))
+ UiEvent(FeedDetailUiEvent.UnexpectedError(result.error.toString()))
}
}
}
@@ -191,7 +191,7 @@ class FeedDetailViewModel @Inject constructor(
_feedDetail.value = _feedDetail.value.copy(fetchResult = FetchResult.LOADING)
when (val result = commentRepository.deleteComment(commentId)) {
is Failure -> {
- _uiEvent.value = Event(FeedDetailUiEvent.CommentDeleteFail)
+ _uiEvent.value = UiEvent(FeedDetailUiEvent.CommentDeleteFail)
_feedDetail.value = _feedDetail.value.copy(fetchResult = FetchResult.SUCCESS)
}
@@ -201,7 +201,7 @@ class FeedDetailViewModel @Inject constructor(
is Success -> refresh()
is Unexpected ->
_uiEvent.value =
- Event(FeedDetailUiEvent.UnexpectedError(result.error.toString()))
+ UiEvent(FeedDetailUiEvent.UnexpectedError(result.error.toString()))
}
}
}
@@ -223,9 +223,9 @@ class FeedDetailViewModel @Inject constructor(
when (val result = commentRepository.reportComment(commentId, authorId, uid)) {
is Failure -> {
if (result.code == REPORT_DUPLICATE_ERROR_CODE) {
- _uiEvent.value = Event(FeedDetailUiEvent.CommentReportDuplicate)
+ _uiEvent.value = UiEvent(FeedDetailUiEvent.CommentReportDuplicate)
} else {
- _uiEvent.value = Event(FeedDetailUiEvent.CommentReportFail)
+ _uiEvent.value = UiEvent(FeedDetailUiEvent.CommentReportFail)
}
_feedDetail.value = _feedDetail.value.copy(fetchResult = FetchResult.SUCCESS)
}
@@ -233,10 +233,10 @@ class FeedDetailViewModel @Inject constructor(
NetworkError ->
_feedDetail.value = _feedDetail.value.copy(fetchResult = FetchResult.ERROR)
- is Success -> _uiEvent.value = Event(FeedDetailUiEvent.CommentReportComplete)
+ is Success -> _uiEvent.value = UiEvent(FeedDetailUiEvent.CommentReportComplete)
is Unexpected ->
_uiEvent.value =
- Event(FeedDetailUiEvent.UnexpectedError(result.error.toString()))
+ UiEvent(FeedDetailUiEvent.UnexpectedError(result.error.toString()))
}
}
}
diff --git a/android/2023-emmsale/app/src/main/java/com/emmsale/presentation/ui/feedDetail/uiState/FeedDetailUiState.kt b/android/2023-emmsale/app/src/main/java/com/emmsale/presentation/ui/feedDetail/uiState/FeedDetailUiState.kt
index 8f1dc3805..8c9269128 100644
--- a/android/2023-emmsale/app/src/main/java/com/emmsale/presentation/ui/feedDetail/uiState/FeedDetailUiState.kt
+++ b/android/2023-emmsale/app/src/main/java/com/emmsale/presentation/ui/feedDetail/uiState/FeedDetailUiState.kt
@@ -1,14 +1,14 @@
package com.emmsale.presentation.ui.feedDetail.uiState
-import com.emmsale.data.model.FeedDetail
-import com.emmsale.data.model.Writer
+import com.emmsale.data.model.Feed
+import com.emmsale.data.model.Member
import com.emmsale.presentation.common.FetchResult
import com.emmsale.presentation.common.FetchResultUiState
import java.time.LocalDateTime
data class FeedDetailUiState(
override val fetchResult: FetchResult,
- val feedDetail: FeedDetail,
+ val feedDetail: Feed,
val comments: List,
) : FetchResultUiState() {
@@ -27,17 +27,14 @@ data class FeedDetailUiState(
companion object {
val Loading: FeedDetailUiState = FeedDetailUiState(
fetchResult = FetchResult.LOADING,
- feedDetail = FeedDetail(
- id = -1,
- eventId = -1,
+ feedDetail = Feed(
+ id = 0,
+ eventId = 0,
title = "",
content = "",
- writer = Writer(
- id = -1,
- name = "",
- imageUrl = "",
- ),
+ writer = Member(),
imageUrls = emptyList(),
+ commentCount = 0,
createdAt = LocalDateTime.now(),
updatedAt = LocalDateTime.now(),
),
diff --git a/android/2023-emmsale/app/src/main/java/com/emmsale/presentation/ui/feedList/FeedListFragment.kt b/android/2023-emmsale/app/src/main/java/com/emmsale/presentation/ui/feedList/FeedListFragment.kt
new file mode 100644
index 000000000..9dbe7e2b6
--- /dev/null
+++ b/android/2023-emmsale/app/src/main/java/com/emmsale/presentation/ui/feedList/FeedListFragment.kt
@@ -0,0 +1,52 @@
+package com.emmsale.presentation.ui.feedList
+
+import android.os.Bundle
+import android.view.View
+import androidx.fragment.app.viewModels
+import com.emmsale.R
+import com.emmsale.databinding.FragmentFeedListBinding
+import com.emmsale.presentation.base.BaseFragment
+import com.emmsale.presentation.ui.feedDetail.FeedDetailActivity
+import com.emmsale.presentation.ui.feedList.FeedListViewModel.Companion.EVENT_ID_KEY
+import com.emmsale.presentation.ui.feedList.recyclerView.FeedListAdapter
+import dagger.hilt.android.AndroidEntryPoint
+
+@AndroidEntryPoint
+class FeedListFragment : BaseFragment() {
+ override val layoutResId: Int = R.layout.fragment_feed_list
+ private val viewModel: FeedListViewModel by viewModels()
+
+ private val feedListAdapter: FeedListAdapter by lazy {
+ FeedListAdapter(navigateToFeedDetail = ::navigateToFeedDetail)
+ }
+
+ override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
+ super.onViewCreated(view, savedInstanceState)
+ binding.vm = viewModel
+ binding.rvFeedList.adapter = feedListAdapter
+ setUpFeeds()
+ }
+
+ override fun onResume() {
+ super.onResume()
+ viewModel.refresh()
+ }
+
+ private fun setUpFeeds() {
+ viewModel.feeds.observe(viewLifecycleOwner) {
+ feedListAdapter.submitList(it.feeds)
+ }
+ }
+
+ private fun navigateToFeedDetail(feedId: Long) {
+ FeedDetailActivity.startActivity(requireContext(), feedId)
+ }
+
+ companion object {
+ fun create(eventId: Long): FeedListFragment = FeedListFragment().apply {
+ arguments = Bundle().apply {
+ putLong(EVENT_ID_KEY, eventId)
+ }
+ }
+ }
+}
diff --git a/android/2023-emmsale/app/src/main/java/com/emmsale/presentation/ui/feedList/FeedListViewModel.kt b/android/2023-emmsale/app/src/main/java/com/emmsale/presentation/ui/feedList/FeedListViewModel.kt
new file mode 100644
index 000000000..242b299cb
--- /dev/null
+++ b/android/2023-emmsale/app/src/main/java/com/emmsale/presentation/ui/feedList/FeedListViewModel.kt
@@ -0,0 +1,53 @@
+package com.emmsale.presentation.ui.feedList
+
+import androidx.lifecycle.SavedStateHandle
+import androidx.lifecycle.ViewModel
+import androidx.lifecycle.viewModelScope
+import com.emmsale.data.common.retrofit.callAdapter.Success
+import com.emmsale.data.repository.interfaces.FeedRepository
+import com.emmsale.presentation.common.FetchResult
+import com.emmsale.presentation.common.livedata.NotNullLiveData
+import com.emmsale.presentation.common.livedata.NotNullMutableLiveData
+import com.emmsale.presentation.common.viewModel.Refreshable
+import com.emmsale.presentation.ui.feedList.uiState.FeedsUiState
+import dagger.hilt.android.lifecycle.HiltViewModel
+import kotlinx.coroutines.launch
+import javax.inject.Inject
+
+@HiltViewModel
+class FeedListViewModel @Inject constructor(
+ savedStateHandle: SavedStateHandle,
+ private val feedRepository: FeedRepository,
+) : ViewModel(), Refreshable {
+ val eventId: Long = savedStateHandle[EVENT_ID_KEY] ?: DEFAULT_EVENT_ID
+
+ private val _feeds = NotNullMutableLiveData(FeedsUiState())
+ val feeds: NotNullLiveData = _feeds
+
+ init {
+ refresh()
+ }
+
+ override fun refresh() {
+ fetchFeeds()
+ }
+
+ private fun fetchFeeds() {
+ _feeds.value = feeds.value.copy(fetchResult = FetchResult.LOADING)
+ viewModelScope.launch {
+ when (val result = feedRepository.getFeeds(eventId)) {
+ is Success -> _feeds.value = feeds.value.copy(
+ fetchResult = FetchResult.SUCCESS,
+ feeds = result.data,
+ )
+
+ else -> _feeds.value = feeds.value.copy(fetchResult = FetchResult.ERROR)
+ }
+ }
+ }
+
+ companion object {
+ const val EVENT_ID_KEY = "EVENT_ID_KEY"
+ private const val DEFAULT_EVENT_ID = -1L
+ }
+}
diff --git a/android/2023-emmsale/app/src/main/java/com/emmsale/presentation/ui/feedList/recyclerView/FeedListAdapter.kt b/android/2023-emmsale/app/src/main/java/com/emmsale/presentation/ui/feedList/recyclerView/FeedListAdapter.kt
new file mode 100644
index 000000000..5ce47a58e
--- /dev/null
+++ b/android/2023-emmsale/app/src/main/java/com/emmsale/presentation/ui/feedList/recyclerView/FeedListAdapter.kt
@@ -0,0 +1,33 @@
+package com.emmsale.presentation.ui.feedList.recyclerView
+
+import android.view.ViewGroup
+import androidx.recyclerview.widget.DiffUtil
+import androidx.recyclerview.widget.ListAdapter
+import com.emmsale.data.model.Feed
+
+class FeedListAdapter(
+ private val navigateToFeedDetail: (postId: Long) -> Unit,
+) : ListAdapter(diffUtil) {
+
+ override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): FeedViewHolder {
+ return FeedViewHolder.create(parent, navigateToFeedDetail)
+ }
+
+ override fun onBindViewHolder(holder: FeedViewHolder, position: Int) {
+ holder.bind(getItem(position))
+ }
+
+ companion object {
+ val diffUtil = object : DiffUtil.ItemCallback() {
+ override fun areItemsTheSame(
+ oldItem: Feed,
+ newItem: Feed,
+ ): Boolean = oldItem == newItem
+
+ override fun areContentsTheSame(
+ oldItem: Feed,
+ newItem: Feed,
+ ): Boolean = oldItem.id == newItem.id
+ }
+ }
+}
diff --git a/android/2023-emmsale/app/src/main/java/com/emmsale/presentation/ui/feedList/recyclerView/FeedViewHolder.kt b/android/2023-emmsale/app/src/main/java/com/emmsale/presentation/ui/feedList/recyclerView/FeedViewHolder.kt
new file mode 100644
index 000000000..33ffea2ef
--- /dev/null
+++ b/android/2023-emmsale/app/src/main/java/com/emmsale/presentation/ui/feedList/recyclerView/FeedViewHolder.kt
@@ -0,0 +1,36 @@
+package com.emmsale.presentation.ui.feedList.recyclerView
+
+import android.view.LayoutInflater
+import android.view.ViewGroup
+import androidx.recyclerview.widget.RecyclerView
+import com.emmsale.data.model.Feed
+import com.emmsale.databinding.ItemFeedBinding
+
+class FeedViewHolder(
+ private val binding: ItemFeedBinding,
+ navigateToFeedDetail: (feedId: Long) -> Unit,
+) : RecyclerView.ViewHolder(binding.root) {
+
+ init {
+ itemView.setOnClickListener {
+ navigateToFeedDetail(
+ binding.feed?.id ?: return@setOnClickListener,
+ )
+ }
+ }
+
+ fun bind(feed: Feed) {
+ binding.feed = feed
+ }
+
+ companion object {
+ fun create(
+ parent: ViewGroup,
+ navigateToFeedDetail: (postId: Long) -> Unit,
+ ): FeedViewHolder {
+ val binding =
+ ItemFeedBinding.inflate(LayoutInflater.from(parent.context), parent, false)
+ return FeedViewHolder(binding, navigateToFeedDetail)
+ }
+ }
+}
diff --git a/android/2023-emmsale/app/src/main/java/com/emmsale/presentation/ui/postList/uiState/PostsUiState.kt b/android/2023-emmsale/app/src/main/java/com/emmsale/presentation/ui/feedList/uiState/FeedsUiState.kt
similarity index 56%
rename from android/2023-emmsale/app/src/main/java/com/emmsale/presentation/ui/postList/uiState/PostsUiState.kt
rename to android/2023-emmsale/app/src/main/java/com/emmsale/presentation/ui/feedList/uiState/FeedsUiState.kt
index b5f34d9ec..0e657d52a 100644
--- a/android/2023-emmsale/app/src/main/java/com/emmsale/presentation/ui/postList/uiState/PostsUiState.kt
+++ b/android/2023-emmsale/app/src/main/java/com/emmsale/presentation/ui/feedList/uiState/FeedsUiState.kt
@@ -1,10 +1,10 @@
-package com.emmsale.presentation.ui.postList.uiState
+package com.emmsale.presentation.ui.feedList.uiState
-import com.emmsale.data.model.Post
+import com.emmsale.data.model.Feed
import com.emmsale.presentation.common.FetchResult
import com.emmsale.presentation.common.FetchResultUiState
-data class PostsUiState(
+data class FeedsUiState(
override val fetchResult: FetchResult = FetchResult.LOADING,
- val posts: List = emptyList(),
+ val feeds: List = emptyList(),
) : FetchResultUiState()
diff --git a/android/2023-emmsale/app/src/main/java/com/emmsale/presentation/ui/postWriting/PostWritingActivity.kt b/android/2023-emmsale/app/src/main/java/com/emmsale/presentation/ui/feedWriting/FeedWritingActivity.kt
similarity index 85%
rename from android/2023-emmsale/app/src/main/java/com/emmsale/presentation/ui/postWriting/PostWritingActivity.kt
rename to android/2023-emmsale/app/src/main/java/com/emmsale/presentation/ui/feedWriting/FeedWritingActivity.kt
index 9d8f813e7..4ddc1e1d9 100644
--- a/android/2023-emmsale/app/src/main/java/com/emmsale/presentation/ui/postWriting/PostWritingActivity.kt
+++ b/android/2023-emmsale/app/src/main/java/com/emmsale/presentation/ui/feedWriting/FeedWritingActivity.kt
@@ -1,4 +1,4 @@
-package com.emmsale.presentation.ui.postWriting
+package com.emmsale.presentation.ui.feedWriting
import android.content.Context
import android.content.Intent
@@ -10,9 +10,9 @@ import androidx.activity.result.contract.ActivityResultContracts
import androidx.activity.viewModels
import androidx.appcompat.app.AppCompatActivity
import com.emmsale.R
-import com.emmsale.databinding.ActivityPostWritingBinding
-import com.emmsale.presentation.common.Event
+import com.emmsale.databinding.ActivityFeedWritingBinding
import com.emmsale.presentation.common.FetchResult
+import com.emmsale.presentation.common.UiEvent
import com.emmsale.presentation.common.extension.navigateToApplicationDetailSetting
import com.emmsale.presentation.common.extension.showPermissionRequestDialog
import com.emmsale.presentation.common.extension.showToast
@@ -20,18 +20,18 @@ import com.emmsale.presentation.common.imageUtil.getImageFileFromUri
import com.emmsale.presentation.common.imageUtil.isImagePermissionGrantedCompat
import com.emmsale.presentation.common.imageUtil.onImagePermissionCompat
import com.emmsale.presentation.ui.feedDetail.FeedDetailActivity
-import com.emmsale.presentation.ui.postWriting.PostWritingViewModel.Companion.EVENT_ID_KEY
-import com.emmsale.presentation.ui.postWriting.recyclerView.PostWritingImageAdapter
-import com.emmsale.presentation.ui.postWriting.uiState.PostUploadResultUiState
+import com.emmsale.presentation.ui.feedWriting.FeedWritingViewModel.Companion.EVENT_ID_KEY
+import com.emmsale.presentation.ui.feedWriting.recyclerView.FeedWritingImageAdapter
+import com.emmsale.presentation.ui.feedWriting.uiState.FeedUploadResultUiEvent
import dagger.hilt.android.AndroidEntryPoint
@AndroidEntryPoint
-class PostWritingActivity : AppCompatActivity() {
- private val binding by lazy { ActivityPostWritingBinding.inflate(layoutInflater) }
- private val viewModel: PostWritingViewModel by viewModels()
+class FeedWritingActivity : AppCompatActivity() {
+ private val binding by lazy { ActivityFeedWritingBinding.inflate(layoutInflater) }
+ private val viewModel: FeedWritingViewModel by viewModels()
- private val adapter: PostWritingImageAdapter by lazy {
- PostWritingImageAdapter(deleteImage = viewModel::deleteImageUrl)
+ private val adapter: FeedWritingImageAdapter by lazy {
+ FeedWritingImageAdapter(deleteImage = viewModel::deleteImageUrl)
}
private val imagePermissionLauncher = registerForActivityResult(
@@ -76,17 +76,17 @@ class PostWritingActivity : AppCompatActivity() {
private fun setUpBinding() {
setContentView(binding.root)
- binding.rvPostWritingImageList.adapter = adapter
+ binding.rvFeedWritingImageList.adapter = adapter
binding.vm = viewModel
binding.showAlbum = ::showAlbum
binding.lifecycleOwner = this
}
private fun setUpPostUploadResult() {
- viewModel.postUploadResult.observe(this, ::handleUploadPostResult)
+ viewModel.feedUploadResult.observe(this, ::handleUploadPostResult)
}
- private fun handleUploadPostResult(event: Event) {
+ private fun handleUploadPostResult(event: UiEvent) {
val content = event.getContentIfNotHandled() ?: return
when (content.fetchResult) {
FetchResult.SUCCESS -> {
@@ -166,7 +166,7 @@ class PostWritingActivity : AppCompatActivity() {
private const val MAX_IMAGE_COUNT = 5
fun startActivity(context: Context, eventId: Long) {
- val intent = Intent(context, PostWritingActivity::class.java)
+ val intent = Intent(context, FeedWritingActivity::class.java)
.putExtra(EVENT_ID_KEY, eventId)
context.startActivity(intent)
}
diff --git a/android/2023-emmsale/app/src/main/java/com/emmsale/presentation/ui/postWriting/PostWritingViewModel.kt b/android/2023-emmsale/app/src/main/java/com/emmsale/presentation/ui/feedWriting/FeedWritingViewModel.kt
similarity index 70%
rename from android/2023-emmsale/app/src/main/java/com/emmsale/presentation/ui/postWriting/PostWritingViewModel.kt
rename to android/2023-emmsale/app/src/main/java/com/emmsale/presentation/ui/feedWriting/FeedWritingViewModel.kt
index 7f1486c36..71bd6243c 100644
--- a/android/2023-emmsale/app/src/main/java/com/emmsale/presentation/ui/postWriting/PostWritingViewModel.kt
+++ b/android/2023-emmsale/app/src/main/java/com/emmsale/presentation/ui/feedWriting/FeedWritingViewModel.kt
@@ -1,4 +1,4 @@
-package com.emmsale.presentation.ui.postWriting
+package com.emmsale.presentation.ui.feedWriting
import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData
@@ -6,21 +6,21 @@ import androidx.lifecycle.SavedStateHandle
import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
import com.emmsale.data.common.retrofit.callAdapter.Success
-import com.emmsale.data.repository.interfaces.PostRepository
-import com.emmsale.presentation.common.Event
+import com.emmsale.data.repository.interfaces.FeedRepository
import com.emmsale.presentation.common.FetchResult
+import com.emmsale.presentation.common.UiEvent
import com.emmsale.presentation.common.livedata.NotNullLiveData
import com.emmsale.presentation.common.livedata.NotNullMutableLiveData
-import com.emmsale.presentation.ui.postWriting.uiState.PostUploadResultUiState
+import com.emmsale.presentation.ui.feedWriting.uiState.FeedUploadResultUiEvent
import dagger.hilt.android.lifecycle.HiltViewModel
import kotlinx.coroutines.launch
import java.io.File
import javax.inject.Inject
@HiltViewModel
-class PostWritingViewModel @Inject constructor(
+class FeedWritingViewModel @Inject constructor(
savedStateHandle: SavedStateHandle,
- private val postRepository: PostRepository,
+ private val feedRepository: FeedRepository,
) : ViewModel() {
private val eventId = savedStateHandle[EVENT_ID_KEY] ?: DEFAULT_ID
@@ -28,19 +28,19 @@ class PostWritingViewModel @Inject constructor(
NotNullMutableLiveData(emptyList())
val imageUris: NotNullLiveData> = _imageUris
- private val _postUploadResult: MutableLiveData> =
+ private val _feedUploadResult: MutableLiveData> =
MutableLiveData()
- val postUploadResult: LiveData> = _postUploadResult
+ val feedUploadResult: LiveData> = _feedUploadResult
val title = MutableLiveData()
val content = MutableLiveData()
fun uploadPost(imageFiles: List) {
- _postUploadResult.value = Event(PostUploadResultUiState(FetchResult.LOADING))
+ _feedUploadResult.value = UiEvent(FeedUploadResultUiEvent(FetchResult.LOADING))
viewModelScope.launch {
when (
val fetchResult =
- postRepository.uploadPost(
+ feedRepository.uploadFeed(
eventId,
title.value ?: DEFAULT_TITLE,
content.value ?: DEFAULT_CONTENT,
@@ -48,10 +48,12 @@ class PostWritingViewModel @Inject constructor(
)
) {
is Success ->
- _postUploadResult.value =
- Event(PostUploadResultUiState(FetchResult.SUCCESS, fetchResult.data))
+ _feedUploadResult.value =
+ UiEvent(FeedUploadResultUiEvent(FetchResult.SUCCESS, fetchResult.data))
- else -> _postUploadResult.value = Event(PostUploadResultUiState(FetchResult.ERROR))
+ else ->
+ _feedUploadResult.value =
+ UiEvent(FeedUploadResultUiEvent(FetchResult.ERROR))
}
}
}
diff --git a/android/2023-emmsale/app/src/main/java/com/emmsale/presentation/ui/postWriting/recyclerView/PostWritingImageAdapter.kt b/android/2023-emmsale/app/src/main/java/com/emmsale/presentation/ui/feedWriting/recyclerView/FeedWritingImageAdapter.kt
similarity index 91%
rename from android/2023-emmsale/app/src/main/java/com/emmsale/presentation/ui/postWriting/recyclerView/PostWritingImageAdapter.kt
rename to android/2023-emmsale/app/src/main/java/com/emmsale/presentation/ui/feedWriting/recyclerView/FeedWritingImageAdapter.kt
index fdcadecee..c56d22cca 100644
--- a/android/2023-emmsale/app/src/main/java/com/emmsale/presentation/ui/postWriting/recyclerView/PostWritingImageAdapter.kt
+++ b/android/2023-emmsale/app/src/main/java/com/emmsale/presentation/ui/feedWriting/recyclerView/FeedWritingImageAdapter.kt
@@ -1,10 +1,10 @@
-package com.emmsale.presentation.ui.postWriting.recyclerView
+package com.emmsale.presentation.ui.feedWriting.recyclerView
import android.view.ViewGroup
import androidx.recyclerview.widget.DiffUtil
import androidx.recyclerview.widget.ListAdapter
-class PostWritingImageAdapter(
+class FeedWritingImageAdapter(
private val deleteImage: (String) -> Unit,
) : ListAdapter(diffUtil) {
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): PostWritingImageViewHolder {
diff --git a/android/2023-emmsale/app/src/main/java/com/emmsale/presentation/ui/postWriting/recyclerView/PostWritingImageViewHolder.kt b/android/2023-emmsale/app/src/main/java/com/emmsale/presentation/ui/feedWriting/recyclerView/PostWritingImageViewHolder.kt
similarity index 93%
rename from android/2023-emmsale/app/src/main/java/com/emmsale/presentation/ui/postWriting/recyclerView/PostWritingImageViewHolder.kt
rename to android/2023-emmsale/app/src/main/java/com/emmsale/presentation/ui/feedWriting/recyclerView/PostWritingImageViewHolder.kt
index 5f5367dd6..ec67258ef 100644
--- a/android/2023-emmsale/app/src/main/java/com/emmsale/presentation/ui/postWriting/recyclerView/PostWritingImageViewHolder.kt
+++ b/android/2023-emmsale/app/src/main/java/com/emmsale/presentation/ui/feedWriting/recyclerView/PostWritingImageViewHolder.kt
@@ -1,4 +1,4 @@
-package com.emmsale.presentation.ui.postWriting.recyclerView
+package com.emmsale.presentation.ui.feedWriting.recyclerView
import android.view.LayoutInflater
import android.view.ViewGroup
diff --git a/android/2023-emmsale/app/src/main/java/com/emmsale/presentation/ui/postWriting/uiState/PostUploadResultUiState.kt b/android/2023-emmsale/app/src/main/java/com/emmsale/presentation/ui/feedWriting/uiState/FeedUploadResultUiEvent.kt
similarity index 69%
rename from android/2023-emmsale/app/src/main/java/com/emmsale/presentation/ui/postWriting/uiState/PostUploadResultUiState.kt
rename to android/2023-emmsale/app/src/main/java/com/emmsale/presentation/ui/feedWriting/uiState/FeedUploadResultUiEvent.kt
index 985abb770..9dd093dae 100644
--- a/android/2023-emmsale/app/src/main/java/com/emmsale/presentation/ui/postWriting/uiState/PostUploadResultUiState.kt
+++ b/android/2023-emmsale/app/src/main/java/com/emmsale/presentation/ui/feedWriting/uiState/FeedUploadResultUiEvent.kt
@@ -1,9 +1,9 @@
-package com.emmsale.presentation.ui.postWriting.uiState
+package com.emmsale.presentation.ui.feedWriting.uiState
import com.emmsale.presentation.common.FetchResult
import com.emmsale.presentation.common.FetchResultUiState
-data class PostUploadResultUiState(
+data class FeedUploadResultUiEvent(
override val fetchResult: FetchResult,
val responseId: Long? = null,
) : FetchResultUiState()
diff --git a/android/2023-emmsale/app/src/main/java/com/emmsale/presentation/ui/messageList/MessageListViewModel.kt b/android/2023-emmsale/app/src/main/java/com/emmsale/presentation/ui/messageList/MessageListViewModel.kt
index 864b27b41..7b05fdb15 100644
--- a/android/2023-emmsale/app/src/main/java/com/emmsale/presentation/ui/messageList/MessageListViewModel.kt
+++ b/android/2023-emmsale/app/src/main/java/com/emmsale/presentation/ui/messageList/MessageListViewModel.kt
@@ -11,7 +11,7 @@ import com.emmsale.data.model.Message
import com.emmsale.data.repository.interfaces.MemberRepository
import com.emmsale.data.repository.interfaces.MessageRoomRepository
import com.emmsale.data.repository.interfaces.TokenRepository
-import com.emmsale.presentation.common.Event
+import com.emmsale.presentation.common.UiEvent
import com.emmsale.presentation.common.livedata.NotNullLiveData
import com.emmsale.presentation.common.livedata.NotNullMutableLiveData
import com.emmsale.presentation.common.viewModel.Refreshable
@@ -45,8 +45,8 @@ class MessageListViewModel @Inject constructor(
private val _messages = NotNullMutableLiveData(MessagesUiState())
val messages: NotNullLiveData = _messages
- private val _uiEvent = MutableLiveData>()
- val uiEvent: LiveData> = _uiEvent
+ private val _uiEvent = MutableLiveData>()
+ val uiEvent: LiveData> = _uiEvent
private val _otherMember = MutableLiveData()
val otherMember: LiveData = _otherMember
@@ -54,7 +54,7 @@ class MessageListViewModel @Inject constructor(
init {
viewModelScope.launch {
fetchMessages()
- _uiEvent.value = Event(MESSAGE_LIST_FIRST_LOADED)
+ _uiEvent.value = UiEvent(MESSAGE_LIST_FIRST_LOADED)
}
}
@@ -79,13 +79,13 @@ class MessageListViewModel @Inject constructor(
private suspend fun fetchOtherMember() {
when (val otherMemberResult = memberRepository.getMember(otherUid)) {
is Success -> _otherMember.value = otherMemberResult.data
- else -> _uiEvent.value = Event(NOT_FOUND_OTHER_MEMBER)
+ else -> _uiEvent.value = UiEvent(NOT_FOUND_OTHER_MEMBER)
}
}
private fun updateMessages(newMessages: List) {
val messagesNotBlank = newMessages
- .filter { it.message.isNotBlank() }
+ .filter { it.content.isNotBlank() }
.toUiState()
_messages.value = messages.value.toSuccess(messagesNotBlank)
}
@@ -125,25 +125,25 @@ class MessageListViewModel @Inject constructor(
private fun Message.createChatMessageUiState(
shouldShowProfile: Boolean = true,
- ): MessageUiState = when (senderId) {
+ ): MessageUiState = when (sender.id) {
myUid -> MyMessageUiState.create(this, shouldShowProfile)
- else -> OtherMessageUiState.create(this, otherMember.value!!, shouldShowProfile)
+ else -> OtherMessageUiState.create(this, shouldShowProfile)
}
fun sendMessage(message: String) {
if (message.isBlank()) return
- _uiEvent.value = Event(MESSAGE_SENDING)
+ _uiEvent.value = UiEvent(MESSAGE_SENDING)
loading()
viewModelScope.launch {
when (messageRoomRepository.sendMessage(myUid, otherUid, message)) {
is Success -> {
fetchMessages()
- _uiEvent.value = Event(MESSAGE_SENT_REFRESHED)
+ _uiEvent.value = UiEvent(MESSAGE_SENT_REFRESHED)
}
- else -> _uiEvent.value = Event(MESSAGE_SENT_FAILED)
+ else -> _uiEvent.value = UiEvent(MESSAGE_SENT_FAILED)
}
}
}
diff --git a/android/2023-emmsale/app/src/main/java/com/emmsale/presentation/ui/messageList/uistate/MessageUiState.kt b/android/2023-emmsale/app/src/main/java/com/emmsale/presentation/ui/messageList/uistate/MessageUiState.kt
index 4385c52db..e7c4934bc 100644
--- a/android/2023-emmsale/app/src/main/java/com/emmsale/presentation/ui/messageList/uistate/MessageUiState.kt
+++ b/android/2023-emmsale/app/src/main/java/com/emmsale/presentation/ui/messageList/uistate/MessageUiState.kt
@@ -3,7 +3,7 @@ package com.emmsale.presentation.ui.messageList.uistate
import java.time.LocalDateTime
sealed class MessageUiState(
- val message: String,
+ val content: String,
val createdAt: LocalDateTime,
) {
abstract val messageType: MessageType
diff --git a/android/2023-emmsale/app/src/main/java/com/emmsale/presentation/ui/messageList/uistate/MyMessageUiState.kt b/android/2023-emmsale/app/src/main/java/com/emmsale/presentation/ui/messageList/uistate/MyMessageUiState.kt
index 06431e13a..eb2287796 100644
--- a/android/2023-emmsale/app/src/main/java/com/emmsale/presentation/ui/messageList/uistate/MyMessageUiState.kt
+++ b/android/2023-emmsale/app/src/main/java/com/emmsale/presentation/ui/messageList/uistate/MyMessageUiState.kt
@@ -1,22 +1,19 @@
package com.emmsale.presentation.ui.messageList.uistate
import com.emmsale.data.model.Message
-import java.time.LocalDateTime
class MyMessageUiState(
override val messageType: MessageType = MessageType.MY,
- message: String,
- createdAt: LocalDateTime,
+ message: Message,
val isFirst: Boolean = true,
-) : MessageUiState(message, createdAt) {
+) : MessageUiState(message.content, message.createdAt) {
companion object {
fun create(
message: Message,
isFirst: Boolean = true,
): MyMessageUiState = MyMessageUiState(
- message = message.message,
- createdAt = message.createdAt,
+ message = message,
isFirst = isFirst,
)
}
diff --git a/android/2023-emmsale/app/src/main/java/com/emmsale/presentation/ui/messageList/uistate/OtherMessageUiState.kt b/android/2023-emmsale/app/src/main/java/com/emmsale/presentation/ui/messageList/uistate/OtherMessageUiState.kt
index be1b553a6..e3e5fa41a 100644
--- a/android/2023-emmsale/app/src/main/java/com/emmsale/presentation/ui/messageList/uistate/OtherMessageUiState.kt
+++ b/android/2023-emmsale/app/src/main/java/com/emmsale/presentation/ui/messageList/uistate/OtherMessageUiState.kt
@@ -1,30 +1,20 @@
package com.emmsale.presentation.ui.messageList.uistate
-import com.emmsale.data.model.Member
import com.emmsale.data.model.Message
-import java.time.LocalDateTime
class OtherMessageUiState(
- override val messageType: MessageType = MessageType.OTHER,
- message: String,
- createdAt: LocalDateTime,
- val senderId: Long,
- val memberName: String,
- val profileImageUrl: String,
+ val message: Message,
val isShownProfile: Boolean = true,
-) : MessageUiState(message, createdAt) {
+) : MessageUiState(message.content, message.createdAt) {
+
+ override val messageType: MessageType = MessageType.OTHER
companion object {
fun create(
message: Message,
- member: Member,
isShownProfile: Boolean,
): OtherMessageUiState = OtherMessageUiState(
- message = message.message,
- createdAt = message.createdAt,
- senderId = message.senderId,
- memberName = member.name,
- profileImageUrl = member.profileImageUrl,
+ message = message,
isShownProfile = isShownProfile,
)
}
diff --git a/android/2023-emmsale/app/src/main/java/com/emmsale/presentation/ui/messageRoomList/MessageRoomViewModel.kt b/android/2023-emmsale/app/src/main/java/com/emmsale/presentation/ui/messageRoomList/MessageRoomViewModel.kt
index 228df028b..f1bca949e 100644
--- a/android/2023-emmsale/app/src/main/java/com/emmsale/presentation/ui/messageRoomList/MessageRoomViewModel.kt
+++ b/android/2023-emmsale/app/src/main/java/com/emmsale/presentation/ui/messageRoomList/MessageRoomViewModel.kt
@@ -11,7 +11,7 @@ import com.emmsale.data.repository.interfaces.TokenRepository
import com.emmsale.presentation.common.livedata.NotNullLiveData
import com.emmsale.presentation.common.livedata.NotNullMutableLiveData
import com.emmsale.presentation.common.viewModel.Refreshable
-import com.emmsale.presentation.ui.messageRoomList.uistate.MemberRoomListUiState
+import com.emmsale.presentation.ui.messageRoomList.uistate.MessageRoomListUiState
import dagger.hilt.android.lifecycle.HiltViewModel
import kotlinx.coroutines.launch
import javax.inject.Inject
@@ -21,8 +21,8 @@ class MessageRoomViewModel @Inject constructor(
private val memberRepository: TokenRepository,
private val messageRoomRepository: MessageRoomRepository,
) : ViewModel(), Refreshable {
- private val _messageRooms = NotNullMutableLiveData(MemberRoomListUiState())
- val messageRooms: NotNullLiveData = _messageRooms
+ private val _messageRooms = NotNullMutableLiveData(MessageRoomListUiState())
+ val messageRooms: NotNullLiveData = _messageRooms
override fun refresh() {
fetchMessageRooms()
diff --git a/android/2023-emmsale/app/src/main/java/com/emmsale/presentation/ui/messageRoomList/uistate/MemberRoomListUiState.kt b/android/2023-emmsale/app/src/main/java/com/emmsale/presentation/ui/messageRoomList/uistate/MessageRoomListUiState.kt
similarity index 89%
rename from android/2023-emmsale/app/src/main/java/com/emmsale/presentation/ui/messageRoomList/uistate/MemberRoomListUiState.kt
rename to android/2023-emmsale/app/src/main/java/com/emmsale/presentation/ui/messageRoomList/uistate/MessageRoomListUiState.kt
index d42ffd951..d29fe883d 100644
--- a/android/2023-emmsale/app/src/main/java/com/emmsale/presentation/ui/messageRoomList/uistate/MemberRoomListUiState.kt
+++ b/android/2023-emmsale/app/src/main/java/com/emmsale/presentation/ui/messageRoomList/uistate/MessageRoomListUiState.kt
@@ -4,13 +4,13 @@ import com.emmsale.data.model.MessageRoom
import com.emmsale.presentation.common.FetchResult
import com.emmsale.presentation.common.FetchResultUiState
-data class MemberRoomListUiState(
+data class MessageRoomListUiState(
override val fetchResult: FetchResult = FetchResult.LOADING,
val messageRooms: List = emptyList(),
) : FetchResultUiState() {
fun toSuccess(
messageRooms: List,
- ): MemberRoomListUiState = copy(
+ ): MessageRoomListUiState = copy(
fetchResult = FetchResult.SUCCESS,
messageRooms = messageRooms,
)
diff --git a/android/2023-emmsale/app/src/main/java/com/emmsale/presentation/ui/notificationConfig/NotificationConfigActivity.kt b/android/2023-emmsale/app/src/main/java/com/emmsale/presentation/ui/notificationConfig/NotificationConfigActivity.kt
index 551c5ec3e..34c6917bc 100644
--- a/android/2023-emmsale/app/src/main/java/com/emmsale/presentation/ui/notificationConfig/NotificationConfigActivity.kt
+++ b/android/2023-emmsale/app/src/main/java/com/emmsale/presentation/ui/notificationConfig/NotificationConfigActivity.kt
@@ -10,7 +10,7 @@ import androidx.core.view.isVisible
import com.emmsale.R
import com.emmsale.data.model.EventTag
import com.emmsale.databinding.ActivityNotificationConfigBinding
-import com.emmsale.presentation.common.Event
+import com.emmsale.presentation.common.UiEvent
import com.emmsale.presentation.common.extension.checkPostNotificationPermission
import com.emmsale.presentation.common.extension.navigateToNotificationSettings
import com.emmsale.presentation.common.extension.showPermissionRequestDialog
@@ -149,7 +149,7 @@ class NotificationConfigActivity :
}
}
- private fun handleNotificationTagsErrors(event: Event) {
+ private fun handleNotificationTagsErrors(event: UiEvent) {
val content = event.getContentIfNotHandled() ?: return
when (content) {
NotificationConfigUiEvent.INTEREST_TAG_REMOVE_ERROR -> showTagRemovingErrorMessage()
diff --git a/android/2023-emmsale/app/src/main/java/com/emmsale/presentation/ui/notificationConfig/NotificationConfigViewModel.kt b/android/2023-emmsale/app/src/main/java/com/emmsale/presentation/ui/notificationConfig/NotificationConfigViewModel.kt
index 598ed911e..f32fda270 100644
--- a/android/2023-emmsale/app/src/main/java/com/emmsale/presentation/ui/notificationConfig/NotificationConfigViewModel.kt
+++ b/android/2023-emmsale/app/src/main/java/com/emmsale/presentation/ui/notificationConfig/NotificationConfigViewModel.kt
@@ -10,7 +10,7 @@ import com.emmsale.data.model.Config
import com.emmsale.data.repository.interfaces.ConfigRepository
import com.emmsale.data.repository.interfaces.EventTagRepository
import com.emmsale.data.repository.interfaces.TokenRepository
-import com.emmsale.presentation.common.Event
+import com.emmsale.presentation.common.UiEvent
import com.emmsale.presentation.common.firebase.analytics.logChangeConfig
import com.emmsale.presentation.common.livedata.NotNullLiveData
import com.emmsale.presentation.common.livedata.NotNullMutableLiveData
@@ -43,9 +43,9 @@ class NotificationConfigViewModel @Inject constructor(
NotNullMutableLiveData(NotificationTagsUiState.Loading)
val notificationTags: NotNullLiveData = _notificationTags
- private val _uiEvent: NotNullMutableLiveData> =
- NotNullMutableLiveData(Event(NotificationConfigUiEvent.NONE))
- val uiEvent: NotNullLiveData> = _uiEvent
+ private val _uiEvent: NotNullMutableLiveData> =
+ NotNullMutableLiveData(UiEvent(NotificationConfigUiEvent.NONE))
+ val uiEvent: NotNullLiveData> = _uiEvent
init {
fetchNotificationTags()
@@ -123,7 +123,7 @@ class NotificationConfigViewModel @Inject constructor(
eventTagRepository.updateInterestEventTags(removedInterestEventTag)
) {
is Failure, NetworkError ->
- _uiEvent.value = Event(NotificationConfigUiEvent.INTEREST_TAG_REMOVE_ERROR)
+ _uiEvent.value = UiEvent(NotificationConfigUiEvent.INTEREST_TAG_REMOVE_ERROR)
is Success -> fetchNotificationTags()
is Unexpected -> throw Throwable(result.error)
diff --git a/android/2023-emmsale/app/src/main/java/com/emmsale/presentation/ui/onboarding/uiState/OnboardingUiState.kt b/android/2023-emmsale/app/src/main/java/com/emmsale/presentation/ui/onboarding/uiState/OnboardingUiState.kt
index ec50b65df..a6644235a 100644
--- a/android/2023-emmsale/app/src/main/java/com/emmsale/presentation/ui/onboarding/uiState/OnboardingUiState.kt
+++ b/android/2023-emmsale/app/src/main/java/com/emmsale/presentation/ui/onboarding/uiState/OnboardingUiState.kt
@@ -17,7 +17,7 @@ data class OnboardingUiState(
companion object {
fun from(activities: List): OnboardingUiState = OnboardingUiState(
- fields = activities.toUiState(ActivityType.FIELD),
+ fields = activities.toUiState(ActivityType.INTEREST_FIELD),
educations = activities.toUiState(ActivityType.EDUCATION),
clubs = activities.toUiState(ActivityType.CLUB),
)
diff --git a/android/2023-emmsale/app/src/main/java/com/emmsale/presentation/ui/postList/PostListFragment.kt b/android/2023-emmsale/app/src/main/java/com/emmsale/presentation/ui/postList/PostListFragment.kt
deleted file mode 100644
index 0ccda8d90..000000000
--- a/android/2023-emmsale/app/src/main/java/com/emmsale/presentation/ui/postList/PostListFragment.kt
+++ /dev/null
@@ -1,52 +0,0 @@
-package com.emmsale.presentation.ui.postList
-
-import android.os.Bundle
-import android.view.View
-import androidx.fragment.app.viewModels
-import com.emmsale.R
-import com.emmsale.databinding.FragmentPostListBinding
-import com.emmsale.presentation.base.BaseFragment
-import com.emmsale.presentation.ui.feedDetail.FeedDetailActivity
-import com.emmsale.presentation.ui.postList.PostListViewModel.Companion.EVENT_ID_KEY
-import com.emmsale.presentation.ui.postList.recyclerView.PostListAdapter
-import dagger.hilt.android.AndroidEntryPoint
-
-@AndroidEntryPoint
-class PostListFragment : BaseFragment() {
- override val layoutResId: Int = R.layout.fragment_post_list
- private val viewModel: PostListViewModel by viewModels()
-
- private val postListAdapter: PostListAdapter by lazy {
- PostListAdapter(navigateToPostDetail = ::navigateToPostDetail)
- }
-
- override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
- super.onViewCreated(view, savedInstanceState)
- binding.vm = viewModel
- binding.rvPostlist.adapter = postListAdapter
- setUpPosts()
- }
-
- override fun onResume() {
- super.onResume()
- viewModel.refresh()
- }
-
- private fun setUpPosts() {
- viewModel.posts.observe(viewLifecycleOwner) {
- postListAdapter.submitList(it.posts)
- }
- }
-
- private fun navigateToPostDetail(feedId: Long) {
- FeedDetailActivity.startActivity(requireContext(), feedId)
- }
-
- companion object {
- fun create(eventId: Long): PostListFragment = PostListFragment().apply {
- arguments = Bundle().apply {
- putLong(EVENT_ID_KEY, eventId)
- }
- }
- }
-}
diff --git a/android/2023-emmsale/app/src/main/java/com/emmsale/presentation/ui/postList/PostListViewModel.kt b/android/2023-emmsale/app/src/main/java/com/emmsale/presentation/ui/postList/PostListViewModel.kt
deleted file mode 100644
index d74c9a0b2..000000000
--- a/android/2023-emmsale/app/src/main/java/com/emmsale/presentation/ui/postList/PostListViewModel.kt
+++ /dev/null
@@ -1,62 +0,0 @@
-package com.emmsale.presentation.ui.postList
-
-import androidx.lifecycle.SavedStateHandle
-import androidx.lifecycle.ViewModel
-import androidx.lifecycle.viewModelScope
-import com.emmsale.data.common.retrofit.callAdapter.Success
-import com.emmsale.data.model.Post
-import com.emmsale.data.repository.interfaces.PostRepository
-import com.emmsale.presentation.common.FetchResult
-import com.emmsale.presentation.common.livedata.NotNullLiveData
-import com.emmsale.presentation.common.livedata.NotNullMutableLiveData
-import com.emmsale.presentation.common.viewModel.Refreshable
-import com.emmsale.presentation.ui.postList.uiState.PostsUiState
-import dagger.hilt.android.lifecycle.HiltViewModel
-import kotlinx.coroutines.launch
-import javax.inject.Inject
-
-@HiltViewModel
-class PostListViewModel @Inject constructor(
- savedStateHandle: SavedStateHandle,
- private val postRepository: PostRepository,
-) : ViewModel(), Refreshable {
- val eventId: Long = savedStateHandle[EVENT_ID_KEY] ?: DEFAULT_EVENT_ID
-
- private val _posts = NotNullMutableLiveData(PostsUiState())
- val posts: NotNullLiveData = _posts
-
- init {
- refresh()
- }
-
- override fun refresh() {
- fetchPosts()
- }
-
- private fun fetchPosts() {
- _posts.toLoadingState()
- viewModelScope.launch {
- when (val postsFetchResult = postRepository.getPosts(eventId)) {
- is Success -> _posts.toSuccessState(postsFetchResult.data)
- else -> _posts.toErrorState()
- }
- }
- }
-
- private fun NotNullMutableLiveData.toSuccessState(posts: List) {
- this.value = PostsUiState(FetchResult.SUCCESS, posts)
- }
-
- private fun NotNullMutableLiveData.toErrorState() {
- this.value = this.value.copy(fetchResult = FetchResult.ERROR)
- }
-
- private fun NotNullMutableLiveData.toLoadingState() {
- this.value = this.value.copy(fetchResult = FetchResult.LOADING)
- }
-
- companion object {
- const val EVENT_ID_KEY = "EVENT_ID_KEY"
- private const val DEFAULT_EVENT_ID = -1L
- }
-}
diff --git a/android/2023-emmsale/app/src/main/java/com/emmsale/presentation/ui/postList/recyclerView/PostListAdapter.kt b/android/2023-emmsale/app/src/main/java/com/emmsale/presentation/ui/postList/recyclerView/PostListAdapter.kt
deleted file mode 100644
index a73b05fad..000000000
--- a/android/2023-emmsale/app/src/main/java/com/emmsale/presentation/ui/postList/recyclerView/PostListAdapter.kt
+++ /dev/null
@@ -1,33 +0,0 @@
-package com.emmsale.presentation.ui.postList.recyclerView
-
-import android.view.ViewGroup
-import androidx.recyclerview.widget.DiffUtil
-import androidx.recyclerview.widget.ListAdapter
-import com.emmsale.data.model.Post
-
-class PostListAdapter(
- private val navigateToPostDetail: (postId: Long) -> Unit,
-) : ListAdapter(diffUtil) {
-
- override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): PostViewHolder {
- return PostViewHolder.create(parent, navigateToPostDetail)
- }
-
- override fun onBindViewHolder(holder: PostViewHolder, position: Int) {
- holder.bind(getItem(position))
- }
-
- companion object {
- val diffUtil = object : DiffUtil.ItemCallback() {
- override fun areItemsTheSame(
- oldItem: Post,
- newItem: Post,
- ): Boolean = oldItem == newItem
-
- override fun areContentsTheSame(
- oldItem: Post,
- newItem: Post,
- ): Boolean = oldItem.id == newItem.id
- }
- }
-}
diff --git a/android/2023-emmsale/app/src/main/java/com/emmsale/presentation/ui/postList/recyclerView/PostViewHolder.kt b/android/2023-emmsale/app/src/main/java/com/emmsale/presentation/ui/postList/recyclerView/PostViewHolder.kt
deleted file mode 100644
index 8c93d5551..000000000
--- a/android/2023-emmsale/app/src/main/java/com/emmsale/presentation/ui/postList/recyclerView/PostViewHolder.kt
+++ /dev/null
@@ -1,36 +0,0 @@
-package com.emmsale.presentation.ui.postList.recyclerView
-
-import android.view.LayoutInflater
-import android.view.ViewGroup
-import androidx.recyclerview.widget.RecyclerView
-import com.emmsale.data.model.Post
-import com.emmsale.databinding.ItemPostBinding
-
-class PostViewHolder(
- private val binding: ItemPostBinding,
- navigateToPostDetail: (postId: Long) -> Unit,
-) : RecyclerView.ViewHolder(binding.root) {
-
- init {
- itemView.setOnClickListener {
- navigateToPostDetail(
- binding.post?.id ?: return@setOnClickListener,
- )
- }
- }
-
- fun bind(post: Post) {
- binding.post = post
- }
-
- companion object {
- fun create(
- parent: ViewGroup,
- navigateToPostDetail: (postId: Long) -> Unit,
- ): PostViewHolder {
- val binding =
- ItemPostBinding.inflate(LayoutInflater.from(parent.context), parent, false)
- return PostViewHolder(binding, navigateToPostDetail)
- }
- }
-}
diff --git a/android/2023-emmsale/app/src/main/java/com/emmsale/presentation/ui/primaryNotificationList/PrimaryNotificationFragment.kt b/android/2023-emmsale/app/src/main/java/com/emmsale/presentation/ui/primaryNotificationList/PrimaryNotificationFragment.kt
index 250ed43a7..0773663a0 100644
--- a/android/2023-emmsale/app/src/main/java/com/emmsale/presentation/ui/primaryNotificationList/PrimaryNotificationFragment.kt
+++ b/android/2023-emmsale/app/src/main/java/com/emmsale/presentation/ui/primaryNotificationList/PrimaryNotificationFragment.kt
@@ -7,7 +7,7 @@ import androidx.recyclerview.widget.ConcatAdapter
import com.emmsale.R
import com.emmsale.databinding.FragmentPrimaryNotificationBinding
import com.emmsale.presentation.base.BaseFragment
-import com.emmsale.presentation.common.Event
+import com.emmsale.presentation.common.UiEvent
import com.emmsale.presentation.common.extension.showSnackBar
import com.emmsale.presentation.common.views.WarningDialog
import com.emmsale.presentation.ui.childCommentList.ChildCommentActivity
@@ -130,7 +130,7 @@ class PrimaryNotificationFragment : BaseFragment) {
+ private fun handleUiEvent(event: UiEvent) {
val content = event.getContentIfNotHandled() ?: return
when (content) {
diff --git a/android/2023-emmsale/app/src/main/java/com/emmsale/presentation/ui/primaryNotificationList/PrimaryNotificationViewModel.kt b/android/2023-emmsale/app/src/main/java/com/emmsale/presentation/ui/primaryNotificationList/PrimaryNotificationViewModel.kt
index 4bfbdc037..166fe8af4 100644
--- a/android/2023-emmsale/app/src/main/java/com/emmsale/presentation/ui/primaryNotificationList/PrimaryNotificationViewModel.kt
+++ b/android/2023-emmsale/app/src/main/java/com/emmsale/presentation/ui/primaryNotificationList/PrimaryNotificationViewModel.kt
@@ -8,7 +8,7 @@ import com.emmsale.data.common.retrofit.callAdapter.Success
import com.emmsale.data.common.retrofit.callAdapter.Unexpected
import com.emmsale.data.repository.interfaces.NotificationRepository
import com.emmsale.data.repository.interfaces.TokenRepository
-import com.emmsale.presentation.common.Event
+import com.emmsale.presentation.common.UiEvent
import com.emmsale.presentation.common.livedata.NotNullLiveData
import com.emmsale.presentation.common.livedata.NotNullMutableLiveData
import com.emmsale.presentation.common.viewModel.Refreshable
@@ -28,8 +28,8 @@ class PrimaryNotificationViewModel @Inject constructor(
NotNullMutableLiveData(PrimaryNotificationScreenUiState.Loading)
val uiState: NotNullLiveData = _allNotificationsUiState
- private val _uiEvent = NotNullMutableLiveData(Event(PrimaryNotificationsUiEvent.NONE))
- val uiEvent: NotNullLiveData> = _uiEvent
+ private val _uiEvent = NotNullMutableLiveData(UiEvent(PrimaryNotificationsUiEvent.NONE))
+ val uiEvent: NotNullLiveData> = _uiEvent
init {
refresh()
@@ -62,7 +62,7 @@ class PrimaryNotificationViewModel @Inject constructor(
notificationRepository.deleteUpdatedNotifications(pastNotificationIds)
) {
is Failure, NetworkError ->
- _uiEvent.value = Event(PrimaryNotificationsUiEvent.DELETE_FAIL)
+ _uiEvent.value = UiEvent(PrimaryNotificationsUiEvent.DELETE_FAIL)
is Success -> refresh()
is Unexpected -> throw Throwable(result.error)
@@ -90,7 +90,7 @@ class PrimaryNotificationViewModel @Inject constructor(
notificationRepository.deleteUpdatedNotifications(listOf(notificationId))
) {
is Failure, NetworkError ->
- _uiEvent.value = Event(PrimaryNotificationsUiEvent.DELETE_FAIL)
+ _uiEvent.value = UiEvent(PrimaryNotificationsUiEvent.DELETE_FAIL)
is Success -> refresh()
is Unexpected -> throw Throwable(result.error)
diff --git a/android/2023-emmsale/app/src/main/java/com/emmsale/presentation/ui/profile/ProfileActivity.kt b/android/2023-emmsale/app/src/main/java/com/emmsale/presentation/ui/profile/ProfileActivity.kt
index 5ff3dbd6b..d983bbb2b 100644
--- a/android/2023-emmsale/app/src/main/java/com/emmsale/presentation/ui/profile/ProfileActivity.kt
+++ b/android/2023-emmsale/app/src/main/java/com/emmsale/presentation/ui/profile/ProfileActivity.kt
@@ -7,7 +7,7 @@ import androidx.activity.viewModels
import androidx.appcompat.app.AppCompatActivity
import com.emmsale.R
import com.emmsale.databinding.ActivityProfileBinding
-import com.emmsale.presentation.common.Event
+import com.emmsale.presentation.common.UiEvent
import com.emmsale.presentation.common.extension.showSnackBar
import com.emmsale.presentation.common.extension.showToast
import com.emmsale.presentation.common.views.CategoryTagChip
@@ -114,7 +114,7 @@ class ProfileActivity : AppCompatActivity() {
}
}
- private fun handleUiEvent(event: Event) {
+ private fun handleUiEvent(event: UiEvent) {
val content = event.getContentIfNotHandled() ?: return
when (content) {
ProfileUiEvent.BlockComplete -> InfoDialog(
diff --git a/android/2023-emmsale/app/src/main/java/com/emmsale/presentation/ui/profile/ProfileViewModel.kt b/android/2023-emmsale/app/src/main/java/com/emmsale/presentation/ui/profile/ProfileViewModel.kt
index 44c5ca6a5..c941cee43 100644
--- a/android/2023-emmsale/app/src/main/java/com/emmsale/presentation/ui/profile/ProfileViewModel.kt
+++ b/android/2023-emmsale/app/src/main/java/com/emmsale/presentation/ui/profile/ProfileViewModel.kt
@@ -11,7 +11,7 @@ import com.emmsale.data.repository.interfaces.BlockedMemberRepository
import com.emmsale.data.repository.interfaces.MemberRepository
import com.emmsale.data.repository.interfaces.MessageRoomRepository
import com.emmsale.data.repository.interfaces.TokenRepository
-import com.emmsale.presentation.common.Event
+import com.emmsale.presentation.common.UiEvent
import com.emmsale.presentation.common.livedata.NotNullLiveData
import com.emmsale.presentation.common.livedata.NotNullMutableLiveData
import com.emmsale.presentation.common.viewModel.Refreshable
@@ -43,9 +43,9 @@ class ProfileViewModel @Inject constructor(
private val _blockedMembers = NotNullMutableLiveData(listOf())
- private val _uiEvent: NotNullMutableLiveData> =
- NotNullMutableLiveData(Event(ProfileUiEvent.None))
- val uiEvent: NotNullLiveData> = _uiEvent
+ private val _uiEvent: NotNullMutableLiveData> =
+ NotNullMutableLiveData(UiEvent(ProfileUiEvent.None))
+ val uiEvent: NotNullLiveData> = _uiEvent
init {
refresh()
@@ -98,16 +98,16 @@ class ProfileViewModel @Inject constructor(
viewModelScope.launch {
_profile.value = _profile.value.copy(isLoading = true)
when (val result = memberRepository.blockMember(memberId)) {
- is Failure -> _uiEvent.value = Event(ProfileUiEvent.BlockFail)
+ is Failure -> _uiEvent.value = UiEvent(ProfileUiEvent.BlockFail)
NetworkError -> _profile.value = _profile.value.copy(isError = true)
is Success -> {
- _uiEvent.value = Event(ProfileUiEvent.BlockComplete)
+ _uiEvent.value = UiEvent(ProfileUiEvent.BlockComplete)
refresh()
}
is Unexpected ->
- _uiEvent.value = Event(ProfileUiEvent.UnexpectedError(result.error.toString()))
+ _uiEvent.value = UiEvent(ProfileUiEvent.UnexpectedError(result.error.toString()))
}
_profile.value = _profile.value.copy(isLoading = false)
}
@@ -119,15 +119,15 @@ class ProfileViewModel @Inject constructor(
val blockId = _blockedMembers.value.find { it.blockedMemberId == memberId }?.blockId
?: return@launch
when (val result = blockedMemberRepository.deleteBlockedMember(blockId)) {
- is Failure -> _uiEvent.value = Event(ProfileUiEvent.UnblockFail)
+ is Failure -> _uiEvent.value = UiEvent(ProfileUiEvent.UnblockFail)
NetworkError -> _profile.value = _profile.value.copy(isError = true)
is Success -> {
- _uiEvent.value = Event(ProfileUiEvent.UnblockSuccess)
+ _uiEvent.value = UiEvent(ProfileUiEvent.UnblockSuccess)
refresh()
}
is Unexpected ->
- _uiEvent.value = Event(ProfileUiEvent.UnexpectedError(result.error.toString()))
+ _uiEvent.value = UiEvent(ProfileUiEvent.UnexpectedError(result.error.toString()))
}
_profile.value = _profile.value.copy(isLoading = false)
}
@@ -141,16 +141,16 @@ class ProfileViewModel @Inject constructor(
messageRoomRepository.sendMessage(uid, _profile.value.member.id, message)
) {
is Failure ->
- _uiEvent.value = Event(ProfileUiEvent.MessageSendFail)
+ _uiEvent.value = UiEvent(ProfileUiEvent.MessageSendFail)
NetworkError -> _profile.value = _profile.value.copy(isError = true)
is Success ->
- _uiEvent.value = Event(
+ _uiEvent.value = UiEvent(
ProfileUiEvent.MessageSendComplete(result.data, _profile.value.member.id),
)
is Unexpected ->
- _uiEvent.value = Event(ProfileUiEvent.UnexpectedError(result.error.toString()))
+ _uiEvent.value = UiEvent(ProfileUiEvent.UnexpectedError(result.error.toString()))
}
_profile.value = _profile.value.copy(isLoading = false)
}
diff --git a/android/2023-emmsale/app/src/main/java/com/emmsale/presentation/ui/recruitmentDetail/RecruitmentPostDetailActivity.kt b/android/2023-emmsale/app/src/main/java/com/emmsale/presentation/ui/recruitmentDetail/RecruitmentPostDetailActivity.kt
index 2c44b7b7b..0f8634c87 100644
--- a/android/2023-emmsale/app/src/main/java/com/emmsale/presentation/ui/recruitmentDetail/RecruitmentPostDetailActivity.kt
+++ b/android/2023-emmsale/app/src/main/java/com/emmsale/presentation/ui/recruitmentDetail/RecruitmentPostDetailActivity.kt
@@ -9,7 +9,7 @@ import androidx.activity.viewModels
import androidx.appcompat.app.AppCompatActivity
import com.emmsale.R
import com.emmsale.databinding.ActivityRecruitmentPostDetailBinding
-import com.emmsale.presentation.common.Event
+import com.emmsale.presentation.common.UiEvent
import com.emmsale.presentation.common.extension.showSnackBar
import com.emmsale.presentation.common.extension.showToast
import com.emmsale.presentation.common.views.InfoDialog
@@ -160,7 +160,7 @@ class RecruitmentPostDetailActivity : AppCompatActivity() {
}
}
- private fun handleUiEvent(event: Event) {
+ private fun handleUiEvent(event: UiEvent) {
val content = event.getContentIfNotHandled() ?: return
when (content) {
is RecruitmentPostDetailUiEvent.MessageSendComplete -> {
diff --git a/android/2023-emmsale/app/src/main/java/com/emmsale/presentation/ui/recruitmentDetail/RecruitmentPostDetailViewModel.kt b/android/2023-emmsale/app/src/main/java/com/emmsale/presentation/ui/recruitmentDetail/RecruitmentPostDetailViewModel.kt
index 441dac8d7..5f8ff7c82 100644
--- a/android/2023-emmsale/app/src/main/java/com/emmsale/presentation/ui/recruitmentDetail/RecruitmentPostDetailViewModel.kt
+++ b/android/2023-emmsale/app/src/main/java/com/emmsale/presentation/ui/recruitmentDetail/RecruitmentPostDetailViewModel.kt
@@ -12,7 +12,7 @@ import com.emmsale.data.common.retrofit.callAdapter.Unexpected
import com.emmsale.data.repository.interfaces.MessageRoomRepository
import com.emmsale.data.repository.interfaces.RecruitmentRepository
import com.emmsale.data.repository.interfaces.TokenRepository
-import com.emmsale.presentation.common.Event
+import com.emmsale.presentation.common.UiEvent
import com.emmsale.presentation.common.livedata.NotNullLiveData
import com.emmsale.presentation.common.livedata.NotNullMutableLiveData
import com.emmsale.presentation.common.viewModel.Refreshable
@@ -46,9 +46,9 @@ class RecruitmentPostDetailViewModel @Inject constructor(
private val _event = MutableLiveData(null)
val event: LiveData = _event
- private val _uiEvent: NotNullMutableLiveData