Skip to content

Commit 371dbfd

Browse files
authored
Merge pull request #71 from Nexters/release/0.1.0
Release 0.1.0 to main
2 parents 138879b + 415edd7 commit 371dbfd

File tree

27 files changed

+1055
-396
lines changed

27 files changed

+1055
-396
lines changed

β€Žapp/build.gradle.ktsβ€Ž

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ android {
2222

2323
defaultConfig {
2424
applicationId = "com.sseotdabwa.buyornot"
25-
versionCode = 3
26-
versionName = "0.0.2"
25+
versionCode = 4
26+
versionName = "0.1.0"
2727

2828
buildConfigField("String", "KAKAO_NATIVE_APP_KEY", "\"${localProperties.getProperty("kakao.nativeAppKey", "")}\"")
2929
manifestPlaceholders["NATIVE_APP_KEY"] = localProperties.getProperty("kakao.nativeAppKey", "")

β€Žapp/src/main/java/com/sseotdabwa/buyornot/navigation/BuyOrNotNavHost.ktβ€Ž

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import com.sseotdabwa.buyornot.core.ui.snackbar.LocalSnackbarState
1212
import com.sseotdabwa.buyornot.core.ui.webview.navigateToPrivacyPolicy
1313
import com.sseotdabwa.buyornot.core.ui.webview.navigateToTerms
1414
import com.sseotdabwa.buyornot.core.ui.webview.webViewScreen
15+
import com.sseotdabwa.buyornot.feature.auth.navigation.AUTH_ROUTE
1516
import com.sseotdabwa.buyornot.feature.auth.navigation.SPLASH_ROUTE
1617
import com.sseotdabwa.buyornot.feature.auth.navigation.authScreen
1718
import com.sseotdabwa.buyornot.feature.auth.navigation.navigateForceToLogin
@@ -26,6 +27,7 @@ import com.sseotdabwa.buyornot.feature.mypage.navigation.navigateToMyPage
2627
import com.sseotdabwa.buyornot.feature.notification.navigation.navigateToNotification
2728
import com.sseotdabwa.buyornot.feature.notification.navigation.navigateToNotificationDetail
2829
import com.sseotdabwa.buyornot.feature.notification.navigation.notificationGraph
30+
import com.sseotdabwa.buyornot.feature.upload.navigation.UPLOAD_ROUTE
2931
import com.sseotdabwa.buyornot.feature.upload.navigation.navigateToUpload
3032
import com.sseotdabwa.buyornot.feature.upload.navigation.uploadScreen
3133

@@ -79,7 +81,7 @@ fun BuyOrNotNavHost(
7981
navController.navigateToHome(
8082
navOptions =
8183
androidx.navigation.navOptions {
82-
popUpTo(SPLASH_ROUTE) { inclusive = true }
84+
popUpTo(AUTH_ROUTE) { inclusive = true }
8385
launchSingleTop = true
8486
},
8587
)
@@ -105,11 +107,10 @@ fun BuyOrNotNavHost(
105107
tab = HomeTab.MY_FEED,
106108
navOptions =
107109
androidx.navigation.navOptions {
108-
popUpTo(navController.graph.startDestinationId) {
109-
saveState = false
110+
popUpTo(UPLOAD_ROUTE) {
111+
inclusive = true
110112
}
111113
launchSingleTop = true
112-
restoreState = false
113114
},
114115
)
115116
},

β€Žcore/data/src/main/java/com/sseotdabwa/buyornot/core/data/repository/UserRepositoryImpl.ktβ€Ž

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,11 @@ import com.sseotdabwa.buyornot.core.network.api.UserApiService
44
import com.sseotdabwa.buyornot.core.network.dto.request.FcmTokenRequest
55
import com.sseotdabwa.buyornot.core.network.dto.response.User
66
import com.sseotdabwa.buyornot.core.network.dto.response.getOrThrow
7+
import com.sseotdabwa.buyornot.domain.model.BlockedUser
78
import com.sseotdabwa.buyornot.domain.model.UserProfile
89
import com.sseotdabwa.buyornot.domain.repository.UserRepository
910
import javax.inject.Inject
11+
import com.sseotdabwa.buyornot.core.network.dto.response.BlockedUser as BlockedUserResponse
1012

1113
class UserRepositoryImpl @Inject constructor(
1214
private val userApiService: UserApiService,
@@ -21,6 +23,16 @@ class UserRepositoryImpl @Inject constructor(
2123
userApiService.updateFcmToken(FcmTokenRequest(fcmToken)).getOrThrow()
2224
}
2325

26+
override suspend fun getBlockedUsers(): List<BlockedUser> = userApiService.getBlockedUsers().getOrThrow().map { it.toDomain() }
27+
28+
override suspend fun blockUser(userId: Long) {
29+
userApiService.blockUser(userId).getOrThrow()
30+
}
31+
32+
override suspend fun unblockUser(userId: Long) {
33+
userApiService.unblockUser(userId).getOrThrow()
34+
}
35+
2436
private fun User.toDomain(): UserProfile =
2537
UserProfile(
2638
id = id,
@@ -29,4 +41,11 @@ class UserRepositoryImpl @Inject constructor(
2941
socialAccount = socialAccount,
3042
email = email,
3143
)
44+
45+
private fun BlockedUserResponse.toDomain(): BlockedUser =
46+
BlockedUser(
47+
userId = userId,
48+
nickname = nickname,
49+
profileImage = profileImage,
50+
)
3251
}

β€Žcore/designsystem/src/main/java/com/sseotdabwa/buyornot/core/designsystem/components/AlertDialog.ktβ€Ž

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ fun BuyOrNotAlertDialog(
2929
onConfirm: () -> Unit,
3030
onDismiss: () -> Unit,
3131
modifier: Modifier = Modifier,
32+
confirmButtonColors: BuyOrNotButtonColors = BuyOrNotButtonDefaults.primaryButtonColors(),
3233
) {
3334
Dialog(
3435
onDismissRequest = onDismissRequest,
@@ -80,13 +81,38 @@ fun BuyOrNotAlertDialog(
8081
text = confirmText,
8182
onClick = onConfirm,
8283
modifier = Modifier.weight(1f),
84+
colors = confirmButtonColors,
8385
)
8486
}
8587
}
8688
}
8789
}
8890
}
8991

92+
@Preview(showBackground = true)
93+
@Composable
94+
private fun BuyOrNotDestructiveAlertDialogPreview() {
95+
BuyOrNotTheme {
96+
Box(
97+
modifier =
98+
Modifier
99+
.background(BuyOrNotTheme.colors.gray1000)
100+
.padding(10.dp),
101+
) {
102+
BuyOrNotAlertDialog(
103+
onDismissRequest = { /* Handle dismiss */ },
104+
title = "ν”Όλ“œλ₯Ό μ‚­μ œν• κΉŒμš”?",
105+
subText = "μ‚­μ œλœ ν”Όλ“œλŠ” 볡ꡬ할 수 μ—†μ–΄μš”.",
106+
confirmText = "μ‚­μ œ",
107+
dismissText = "μ·¨μ†Œ",
108+
onConfirm = { /* Handle confirm */ },
109+
onDismiss = { /* Handle dismiss */ },
110+
confirmButtonColors = BuyOrNotButtonDefaults.destructiveButtonColors(),
111+
)
112+
}
113+
}
114+
}
115+
90116
@Preview(showBackground = true)
91117
@Composable
92118
private fun BuyOrNotAlertDialogPreview() {

β€Žcore/designsystem/src/main/java/com/sseotdabwa/buyornot/core/designsystem/components/Button.ktβ€Ž

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,17 @@ object BuyOrNotButtonDefaults {
7777
)
7878
}
7979

80+
@Composable
81+
fun destructiveButtonColors() =
82+
BuyOrNotButtonColors(
83+
defaultContainer = BuyOrNotTheme.colors.red100,
84+
hoverContainer = BuyOrNotTheme.colors.red100,
85+
pressedContainer = BuyOrNotTheme.colors.red100,
86+
disabledContainer = BuyOrNotTheme.colors.gray200,
87+
content = BuyOrNotTheme.colors.gray0,
88+
disabledContent = BuyOrNotTheme.colors.gray600,
89+
)
90+
8091
@Composable
8192
fun secondaryOutlinedButtonColors() =
8293
BuyOrNotButtonColors(
@@ -142,6 +153,7 @@ fun PrimaryButton(
142153
enabled: Boolean = true,
143154
interactionSource: MutableInteractionSource = remember { MutableInteractionSource() },
144155
size: ButtonSize = ButtonSize.Large,
156+
colors: BuyOrNotButtonColors = BuyOrNotButtonDefaults.primaryButtonColors(),
145157
onClick: () -> Unit,
146158
) {
147159
val height =
@@ -160,7 +172,7 @@ fun PrimaryButton(
160172
enabled = enabled,
161173
height = height,
162174
shape = RoundedCornerShape(cornerRadius),
163-
buttonColors = BuyOrNotButtonDefaults.primaryButtonColors(),
175+
buttonColors = colors,
164176
contentPadding = PaddingValues(horizontal = 24.dp), // μ‹œμ•ˆμ— 맞게 νŒ¨λ”© 쑰절
165177
interactionSource = interactionSource,
166178
) {

β€Žcore/designsystem/src/main/java/com/sseotdabwa/buyornot/core/designsystem/components/FeedCard.ktβ€Ž

Lines changed: 56 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,8 @@ fun FeedCard(
7575
voterProfileImageUrl: String = "", // μ‚¬μš©μžκ°€ νˆ¬ν‘œν•œ 경우의 ν”„λ‘œν•„ 이미지 URL
7676
onDeleteClick: () -> Unit = {}, // μ‚­μ œ 클릭 콜백 μΆ”κ°€
7777
onReportClick: () -> Unit = {}, // μ‹ κ³  클릭 콜백 μΆ”κ°€
78+
onBlockClick: () -> Unit = {}, // 차단 클릭 콜백 μΆ”κ°€
79+
showMoreButton: Boolean = true,
7880
) {
7981
val hasVoted = userVotedOptionIndex != null
8082
val buyPercentage = if (totalVoteCount > 0) (buyVoteCount * 100 / totalVoteCount) else 0
@@ -139,25 +141,41 @@ fun FeedCard(
139141
)
140142
}
141143
}
142-
Box {
143-
Icon(
144-
imageVector = BuyOrNotIcons.More.asImageVector(),
145-
contentDescription = "More",
146-
modifier =
147-
Modifier
148-
.size(20.dp)
149-
.clickable { showMenu = true },
150-
tint = BuyOrNotTheme.colors.gray500,
151-
)
152-
if (showMenu) {
153-
FeedActionPopup(
154-
label = if (isOwner) "μ‚­μ œν•˜κΈ°" else "μ‹ κ³ ν•˜κΈ°",
155-
onDismiss = { showMenu = false },
156-
onClick = {
157-
showMenu = false
158-
if (isOwner) onDeleteClick() else onReportClick()
159-
},
144+
if (showMoreButton) {
145+
Box {
146+
Icon(
147+
imageVector = BuyOrNotIcons.More.asImageVector(),
148+
contentDescription = "More",
149+
modifier =
150+
Modifier
151+
.size(20.dp)
152+
.clickable { showMenu = true },
153+
tint = BuyOrNotTheme.colors.gray500,
160154
)
155+
val ownerMenuItems =
156+
listOf(
157+
"μ‚­μ œν•˜κΈ°" to {
158+
showMenu = false
159+
onDeleteClick()
160+
},
161+
)
162+
val userMenuItems =
163+
listOf(
164+
"μ‹ κ³ ν•˜κΈ°" to {
165+
showMenu = false
166+
onReportClick()
167+
},
168+
"μ°¨λ‹¨ν•˜κΈ°" to {
169+
showMenu = false
170+
onBlockClick()
171+
},
172+
)
173+
if (showMenu) {
174+
FeedActionPopup(
175+
items = if (isOwner) ownerMenuItems else userMenuItems,
176+
onDismiss = { showMenu = false },
177+
)
178+
}
161179
}
162180
}
163181
}
@@ -427,9 +445,8 @@ private fun VoteOption(
427445
*/
428446
@Composable
429447
private fun FeedActionPopup(
430-
label: String,
448+
items: List<Pair<String, () -> Unit>>,
431449
onDismiss: () -> Unit,
432-
onClick: () -> Unit,
433450
) {
434451
val density = LocalDensity.current
435452
val navHeight = 20.dp // Anchor icon height
@@ -451,8 +468,7 @@ private fun FeedActionPopup(
451468
properties = PopupProperties(focusable = true),
452469
) {
453470
FeedActionPopupContent(
454-
label = label,
455-
onClick = onClick,
471+
items = items,
456472
tonalElevation = 8.dp,
457473
shadowElevation = 8.dp,
458474
)
@@ -464,8 +480,7 @@ private fun FeedActionPopup(
464480
*/
465481
@Composable
466482
private fun FeedActionPopupContent(
467-
label: String,
468-
onClick: () -> Unit,
483+
items: List<Pair<String, () -> Unit>>,
469484
modifier: Modifier = Modifier,
470485
tonalElevation: Dp = 0.dp,
471486
shadowElevation: Dp = 0.dp,
@@ -482,22 +497,21 @@ private fun FeedActionPopupContent(
482497
tonalElevation = tonalElevation,
483498
shadowElevation = shadowElevation,
484499
) {
485-
Box(
486-
modifier = Modifier.padding(vertical = 14.dp),
487-
contentAlignment = Alignment.Center,
488-
) {
489-
Text(
490-
text = label,
491-
modifier =
492-
Modifier
493-
.clickable { onClick() }
494-
.padding(
495-
horizontal = 20.dp,
496-
vertical = 8.dp,
497-
),
498-
style = BuyOrNotTheme.typography.bodyB3Medium,
499-
color = BuyOrNotTheme.colors.gray800,
500-
)
500+
Column(modifier = Modifier.padding(vertical = 14.dp)) {
501+
items.forEach { (label, onClick) ->
502+
Text(
503+
text = label,
504+
modifier =
505+
Modifier
506+
.clickable { onClick() }
507+
.padding(
508+
horizontal = 20.dp,
509+
vertical = 8.dp,
510+
),
511+
style = BuyOrNotTheme.typography.bodyB3Medium,
512+
color = BuyOrNotTheme.colors.gray800,
513+
)
514+
}
501515
}
502516
}
503517
}
@@ -569,8 +583,7 @@ private fun FeedCardSquareInteractivePreview() {
569583
private fun FeedActionPopupContentOwnerPreview() {
570584
BuyOrNotTheme {
571585
FeedActionPopupContent(
572-
label = "μ‚­μ œν•˜κΈ°",
573-
onClick = { /* do nothing */ },
586+
items = listOf("μ‚­μ œν•˜κΈ°" to {}),
574587
)
575588
}
576589
}
@@ -584,8 +597,7 @@ private fun FeedActionPopupContentOwnerPreview() {
584597
private fun FeedActionPopupContentUserPreview() {
585598
BuyOrNotTheme {
586599
FeedActionPopupContent(
587-
label = "μ‹ κ³ ν•˜κΈ°",
588-
onClick = { /* do nothing */ },
600+
items = listOf("μ‹ κ³ ν•˜κΈ°" to {}, "μ°¨λ‹¨ν•˜κΈ°" to {}),
589601
)
590602
}
591603
}

β€Žcore/designsystem/src/main/java/com/sseotdabwa/buyornot/core/designsystem/components/SnackBar.ktβ€Ž

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import androidx.compose.foundation.layout.Row
1515
import androidx.compose.foundation.layout.Spacer
1616
import androidx.compose.foundation.layout.fillMaxSize
1717
import androidx.compose.foundation.layout.fillMaxWidth
18+
import androidx.compose.foundation.layout.navigationBarsPadding
1819
import androidx.compose.foundation.layout.padding
1920
import androidx.compose.foundation.layout.size
2021
import androidx.compose.foundation.layout.width
@@ -121,7 +122,10 @@ fun BuyOrNotSnackBar(
121122
fun BuyOrNotSnackBarHost(hostState: SnackbarHostState) {
122123
AnimatedContent(
123124
targetState = hostState.currentSnackbarData,
124-
modifier = Modifier.fillMaxWidth(),
125+
modifier =
126+
Modifier
127+
.fillMaxWidth()
128+
.navigationBarsPadding(),
125129
contentAlignment = Alignment.BottomCenter,
126130
transitionSpec = {
127131
(slideInVertically { it } + fadeIn(tween(400)))

β€Žcore/designsystem/src/main/java/com/sseotdabwa/buyornot/core/designsystem/icon/BuyOrNotImgs.ktβ€Ž

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ object BuyOrNotImgs {
3333
val Error = ImgsResource(R.drawable.img_error)
3434

3535
val NoNotification = ImgsResource(R.drawable.img_no_bell)
36+
37+
val NoBlockedUser = ImgsResource(R.drawable.img_blocked_user_empty)
3638
}
3739

3840
/**

0 commit comments

Comments
Β (0)