-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor : EventDetail 코드 리팩토링 (#282)
* refactor : EventDetail 코드 리팩토링 * refactor : EventDetail 코드 리팩토링 * refactor : EventDetail 코드 리팩토링 * refactor : EventDetail Mapper 분리 * refactor : 버튼 클릭 함수명 변경 * refactor : viewModel 생성시에 한번만 fetch 하도록 수정 * refactor : mapper 분리에 대한 RepositoryImpl 변경사항 적용 * refactor : init 함수와 프로퍼티 순서 바꿈 * refactor : 부나 피드백 반영 - 함수명 변경 - strings.xml 포맷 변경 - initFragmentStateAdapter 리스트 생성하여 attach 하도록 변경 - imageUrl 을 postImageUrl 로 좀더 명확하게 변경 * refactor : EventDetailApiModel 속성 변경
- Loading branch information
Showing
14 changed files
with
155 additions
and
123 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 5 additions & 3 deletions
8
android/2023-emmsale/app/src/main/java/com/emmsale/data/eventdetail/EventDetail.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,17 @@ | ||
package com.emmsale.data.eventdetail | ||
|
||
import java.time.LocalDateTime | ||
|
||
data class EventDetail( | ||
val id: Long, | ||
val name: String, | ||
val status: String, | ||
val location: String, | ||
val startDate: String, | ||
val endDate: String, | ||
val startDate: LocalDateTime, | ||
val endDate: LocalDateTime, | ||
val informationUrl: String, | ||
val tags: List<String>, | ||
val imageUrl: String?, | ||
val postImageUrl: String?, | ||
val remainingDays: Int, | ||
val type: String, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
...d/2023-emmsale/app/src/main/java/com/emmsale/data/eventdetail/mapper/EventDetailMapper.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package com.emmsale.data.eventdetail.mapper | ||
|
||
import com.emmsale.data.eventdetail.EventDetail | ||
import com.emmsale.data.eventdetail.dto.EventDetailApiModel | ||
import java.time.LocalDateTime | ||
import java.time.format.DateTimeFormatter | ||
|
||
fun EventDetailApiModel.toData(): EventDetail = EventDetail( | ||
id = id, | ||
name = name, | ||
status = status, | ||
location = location, | ||
startDate = startDate.toLocalDateTime(), | ||
endDate = endDate.toLocalDateTime(), | ||
informationUrl = informationUrl, | ||
tags = tags, | ||
postImageUrl = imageUrl, | ||
remainingDays = remainingDays, | ||
type = type, | ||
) | ||
|
||
private fun String.toLocalDateTime(): LocalDateTime { | ||
val format = DateTimeFormatter.ofPattern("yyyy:MM:dd:HH:mm:ss") | ||
return LocalDateTime.parse(this, format) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 34 additions & 18 deletions
52
...emmsale/app/src/main/java/com/emmsale/presentation/ui/eventdetail/EventDetailViewModel.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.