-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[FIX/#220] Group / state 변경 #224
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
38 changes: 38 additions & 0 deletions
38
feature/mygroup/src/main/java/com/boostcamp/mapisode/mygroup/model/GroupUiModel.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,38 @@ | ||
package com.boostcamp.mapisode.mygroup.model | ||
|
||
import androidx.compose.runtime.Immutable | ||
import com.boostcamp.mapisode.model.GroupModel | ||
import kotlinx.collections.immutable.ImmutableList | ||
import kotlinx.collections.immutable.toImmutableList | ||
import java.util.Date | ||
|
||
@Immutable | ||
data class GroupUiModel( | ||
val id: String, | ||
val adminUser: String, | ||
val createdAt: Date, | ||
val description: String, | ||
val imageUrl: String, | ||
val name: String, | ||
val members: ImmutableList<String>, | ||
) { | ||
fun toGroupModel(): GroupModel = GroupModel( | ||
id = id, | ||
adminUser = adminUser, | ||
createdAt = createdAt, | ||
description = description, | ||
imageUrl = imageUrl, | ||
name = name, | ||
members = members.toList(), | ||
) | ||
} | ||
|
||
fun GroupModel.toGroupUiModel(): GroupUiModel = GroupUiModel( | ||
id = id, | ||
adminUser = adminUser, | ||
createdAt = createdAt, | ||
description = description, | ||
imageUrl = imageUrl, | ||
name = name, | ||
members = members.toImmutableList(), | ||
) |
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
10 changes: 6 additions & 4 deletions
10
feature/mygroup/src/main/java/com/boostcamp/mapisode/mygroup/state/GroupDetailState.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,17 +1,19 @@ | ||
package com.boostcamp.mapisode.mygroup.state | ||
|
||
import androidx.compose.runtime.Immutable | ||
import com.boostcamp.mapisode.model.GroupModel | ||
import com.boostcamp.mapisode.mygroup.model.GroupUiEpisodeModel | ||
import com.boostcamp.mapisode.mygroup.model.GroupUiMemberModel | ||
import com.boostcamp.mapisode.mygroup.model.GroupUiModel | ||
import com.boostcamp.mapisode.ui.base.UiState | ||
import kotlinx.collections.immutable.ImmutableList | ||
import kotlinx.collections.immutable.persistentListOf | ||
|
||
@Immutable | ||
data class GroupDetailState( | ||
val isGroupIdCaching: Boolean = true, | ||
val isGroupLoading: Boolean = false, | ||
val isGroupOwner: Boolean = false, | ||
val group: GroupModel? = null, | ||
val membersInfo: List<GroupUiMemberModel> = emptyList(), | ||
val episodes: List<GroupUiEpisodeModel> = emptyList(), | ||
val group: GroupUiModel? = null, | ||
val membersInfo: ImmutableList<GroupUiMemberModel> = persistentListOf(), | ||
val episodes: ImmutableList<GroupUiEpisodeModel> = persistentListOf(), | ||
) : UiState |
4 changes: 2 additions & 2 deletions
4
feature/mygroup/src/main/java/com/boostcamp/mapisode/mygroup/state/GroupJoinState.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,13 +1,13 @@ | ||
package com.boostcamp.mapisode.mygroup.state | ||
|
||
import androidx.compose.runtime.Immutable | ||
import com.boostcamp.mapisode.model.GroupModel | ||
import com.boostcamp.mapisode.mygroup.model.GroupCreationModel | ||
import com.boostcamp.mapisode.ui.base.UiState | ||
|
||
@Immutable | ||
data class GroupJoinState( | ||
val isGroupExist: Boolean = false, | ||
val isGroupLoading: Boolean = false, | ||
val isJoinedSuccess: Boolean = false, | ||
val group: GroupModel? = null, | ||
val group: GroupCreationModel? = null, | ||
) : UiState |
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
GroupUiModel에 꼭 Immutable을 붙여야 하는 이유가 Date 때문인가요?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
이렇게 Immutable을 선언해도 해도 Date 객체가 java.util 에서 제공하는 거라 객체는 unstable이겠네요.
java.util 의 Date 대신 kotlinx 에서 제공하는 LocalDate 타입 쓰면 immutable 타입으로 사용 가능하다 하는데 이거로 대체하기에는 시간이 없네요 ㅠㅠ