-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #181 from WithPeace/feat/#180_밸런스_게임_ui_구현
Feat/#180 밸런스 게임 UI 구현
- Loading branch information
Showing
49 changed files
with
1,067 additions
and
38 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
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
18 changes: 18 additions & 0 deletions
18
.../main/kotlin/com/withpeace/withpeace/core/data/repository/DefaultBalanceGameRepository.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,18 @@ | ||
package com.withpeace.withpeace.core.data.repository | ||
|
||
import com.withpeace.withpeace.core.datastore.dataStore.balancegame.BalanceGameDataStore | ||
import com.withpeace.withpeace.core.domain.repository.BalanceGameRepository | ||
import kotlinx.coroutines.flow.Flow | ||
import javax.inject.Inject | ||
|
||
class DefaultBalanceGameRepository @Inject constructor( | ||
private val balanceGameDataStore: BalanceGameDataStore, | ||
): BalanceGameRepository { | ||
override fun isVisited(): Flow<Boolean> { | ||
return balanceGameDataStore.isVisited | ||
} | ||
|
||
override suspend fun updateVisitedStatus(visited: Boolean) { | ||
balanceGameDataStore.updateVisitedStatus(visited) | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
...java/com/withpeace/withpeace/core/datastore/dataStore/balancegame/BalanceGameDataStore.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,12 @@ | ||
package com.withpeace.withpeace.core.datastore.dataStore.balancegame | ||
|
||
import kotlinx.coroutines.flow.Flow | ||
|
||
interface BalanceGameDataStore { | ||
|
||
val isVisited: Flow<Boolean> | ||
|
||
suspend fun updateVisitedStatus(visited: Boolean) | ||
} | ||
|
||
//TODO 구현체 설정 |
28 changes: 28 additions & 0 deletions
28
...m/withpeace/withpeace/core/datastore/dataStore/balancegame/DefaultBalanceGameDataStore.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,28 @@ | ||
package com.withpeace.withpeace.core.datastore.dataStore.balancegame | ||
|
||
import androidx.datastore.core.DataStore | ||
import androidx.datastore.preferences.core.Preferences | ||
import androidx.datastore.preferences.core.booleanPreferencesKey | ||
import androidx.datastore.preferences.core.edit | ||
import kotlinx.coroutines.flow.Flow | ||
import kotlinx.coroutines.flow.map | ||
import javax.inject.Inject | ||
import javax.inject.Named | ||
|
||
class DefaultBalanceGameDataStore @Inject constructor( | ||
@Named("balance_game") private val dataStore: DataStore<Preferences>, | ||
) : BalanceGameDataStore { | ||
override val isVisited: Flow<Boolean> = dataStore.data.map { preferences -> | ||
preferences[BALANCE_GAME_VISITED] ?: false | ||
} | ||
|
||
override suspend fun updateVisitedStatus(visited: Boolean) { | ||
dataStore.edit { preferences -> | ||
preferences[BALANCE_GAME_VISITED] = visited | ||
} | ||
} | ||
|
||
companion object { | ||
private val BALANCE_GAME_VISITED = booleanPreferencesKey("BALANCE_GAME_VISITED") | ||
} | ||
} |
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
9 changes: 9 additions & 0 deletions
9
...ain/src/main/java/com/withpeace/withpeace/core/domain/repository/BalanceGameRepository.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,9 @@ | ||
package com.withpeace.withpeace.core.domain.repository | ||
|
||
import kotlinx.coroutines.flow.Flow | ||
|
||
interface BalanceGameRepository { | ||
fun isVisited(): Flow<Boolean> | ||
|
||
suspend fun updateVisitedStatus(visited: Boolean) | ||
} |
11 changes: 11 additions & 0 deletions
11
...in/src/main/java/com/withpeace/withpeace/core/domain/usecase/BalanceGameVisitedUseCase.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,11 @@ | ||
package com.withpeace.withpeace.core.domain.usecase | ||
|
||
import com.withpeace.withpeace.core.domain.repository.BalanceGameRepository | ||
import kotlinx.coroutines.flow.Flow | ||
import javax.inject.Inject | ||
|
||
class BalanceGameVisitedUseCase @Inject constructor( | ||
private val balanceGameRepository: BalanceGameRepository, | ||
) { | ||
operator fun invoke(): Flow<Boolean> = balanceGameRepository.isVisited() | ||
} |
12 changes: 12 additions & 0 deletions
12
...c/main/java/com/withpeace/withpeace/core/domain/usecase/UpdateBalanceGameVisitedStatus.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,12 @@ | ||
package com.withpeace.withpeace.core.domain.usecase | ||
|
||
import com.withpeace.withpeace.core.domain.repository.BalanceGameRepository | ||
import javax.inject.Inject | ||
|
||
class UpdateBalanceGameVisitedStatus @Inject constructor( | ||
private val balanceGameRepository: BalanceGameRepository, | ||
){ | ||
suspend operator fun invoke(isVisited: Boolean) { | ||
balanceGameRepository.updateVisitedStatus(isVisited) | ||
} | ||
} |
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
37 changes: 37 additions & 0 deletions
37
core/ui/src/main/java/com/withpeace/withpeace/core/ui/comment/CommentSize.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,37 @@ | ||
package com.withpeace.withpeace.core.ui.comment | ||
|
||
import androidx.compose.foundation.layout.Arrangement | ||
import androidx.compose.foundation.layout.Row | ||
import androidx.compose.foundation.layout.padding | ||
import androidx.compose.material3.Icon | ||
import androidx.compose.material3.Text | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.Alignment | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.res.painterResource | ||
import androidx.compose.ui.unit.dp | ||
import com.withpeace.withpeace.core.designsystem.theme.WithpeaceTheme | ||
import com.withpeace.withpeace.core.ui.R | ||
|
||
@Composable | ||
fun CommentSize( | ||
modifier: Modifier = Modifier, | ||
commentSize: Int, | ||
horizontalArrangement: Arrangement.Horizontal = Arrangement.Start | ||
) { | ||
Row( | ||
modifier = modifier.padding(horizontal = WithpeaceTheme.padding.BasicHorizontalPadding), | ||
verticalAlignment = Alignment.CenterVertically, | ||
horizontalArrangement = horizontalArrangement | ||
) { | ||
Icon( | ||
painter = painterResource(id = R.drawable.ic_chat), | ||
contentDescription = "댓글 개수", | ||
modifier = Modifier.padding(end = 4.dp), | ||
) | ||
Text( | ||
text = "$commentSize", | ||
style = WithpeaceTheme.typography.caption, | ||
) | ||
} | ||
} |
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
62 changes: 62 additions & 0 deletions
62
core/ui/src/main/java/com/withpeace/withpeace/core/ui/report/PostDetailReportBottomSheet.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,62 @@ | ||
package com.withpeace.withpeace.core.ui.report | ||
|
||
import androidx.compose.foundation.layout.Column | ||
import androidx.compose.foundation.layout.WindowInsets | ||
import androidx.compose.foundation.layout.fillMaxSize | ||
import androidx.compose.foundation.layout.fillMaxWidth | ||
import androidx.compose.foundation.layout.padding | ||
import androidx.compose.material3.ExperimentalMaterial3Api | ||
import androidx.compose.material3.HorizontalDivider | ||
import androidx.compose.material3.ModalBottomSheet | ||
import androidx.compose.material3.Text | ||
import androidx.compose.material3.rememberModalBottomSheetState | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.graphics.RectangleShape | ||
import com.withpeace.withpeace.core.designsystem.theme.WithpeaceTheme | ||
import com.withpeace.withpeace.core.designsystem.ui.WithPeaceBackButtonTopAppBar | ||
import com.withpeace.withpeace.core.ui.post.ReportTypeUiModel | ||
|
||
@OptIn(ExperimentalMaterial3Api::class) | ||
@Composable | ||
fun PostDetailReportBottomSheet( | ||
isPostReport: Boolean, | ||
id: Long, | ||
onDismissRequest: () -> Unit, | ||
onClickReportType: (id: Long, ReportTypeUiModel) -> Unit, | ||
) { | ||
val bottomSheetState = rememberModalBottomSheetState(skipPartiallyExpanded = true) | ||
ModalBottomSheet( | ||
contentWindowInsets = { WindowInsets(0, 0, 0, 0) }, | ||
containerColor = WithpeaceTheme.colors.SystemWhite, | ||
onDismissRequest = onDismissRequest, | ||
sheetState = bottomSheetState, | ||
shape = RectangleShape, | ||
) { | ||
Column( | ||
modifier = Modifier.fillMaxSize(), | ||
) { | ||
WithPeaceBackButtonTopAppBar( | ||
onClickBackButton = onDismissRequest, | ||
title = { | ||
Text(text = "신고하는 이유를 선택해주세요", style = WithpeaceTheme.typography.title1) | ||
}, | ||
) | ||
HorizontalDivider(Modifier.padding(horizontal = WithpeaceTheme.padding.BasicHorizontalPadding)) | ||
Column( | ||
modifier = Modifier | ||
.fillMaxWidth(), | ||
) { | ||
ReportTypeUiModel.entries.forEach { reportTypeUiModel -> | ||
ReportTypeItem( | ||
isPostReport = isPostReport, | ||
id = id, | ||
reportTypeUiModel = reportTypeUiModel, | ||
onClickReportType = onClickReportType, | ||
onDismissRequest = onDismissRequest, | ||
) | ||
} | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.