Skip to content

Commit fcf5a1a

Browse files
authored
๐Ÿ”— :: (#496) ๋ฉด์ ‘ ํ›„๊ธฐ ์ค‘๋ณต ์„ ํƒ ๊ตฌํ˜„
2 parents 59129a6 + 7b88511 commit fcf5a1a

File tree

19 files changed

+278
-274
lines changed

19 files changed

+278
-274
lines changed

โ€Žapp/src/main/java/team/retum/jobisandroidv2/MainActivity.ktโ€Ž

Lines changed: 24 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,12 @@ import android.os.Bundle
44
import androidx.activity.ComponentActivity
55
import androidx.activity.compose.BackHandler
66
import androidx.activity.compose.setContent
7+
import androidx.activity.result.contract.ActivityResultContracts
78
import androidx.core.view.WindowCompat
89
import androidx.lifecycle.lifecycleScope
910
import com.github.anrwatchdog.ANRWatchDog
1011
import com.google.android.play.core.appupdate.AppUpdateManagerFactory
12+
import com.google.android.play.core.appupdate.AppUpdateOptions
1113
import com.google.android.play.core.install.model.AppUpdateType
1214
import com.google.android.play.core.install.model.UpdateAvailability
1315
import dagger.hilt.android.AndroidEntryPoint
@@ -28,6 +30,14 @@ class MainActivity : ComponentActivity() {
2830
@Inject
2931
lateinit var deviceTokenManager: DeviceTokenManager
3032

33+
private val updateLauncher = registerForActivityResult(
34+
ActivityResultContracts.StartIntentSenderForResult(),
35+
) { result ->
36+
if (result.resultCode != RESULT_OK) {
37+
// TODO :: ์—…๋ฐ์ดํŠธ ์‹คํŒจ ์‹œ ๋ชจ๋‹ฌ ํ˜ธ์ถœ
38+
}
39+
}
40+
3141
override fun onCreate(savedInstanceState: Bundle?) {
3242
super.onCreate(savedInstanceState)
3343
/**
@@ -68,17 +78,21 @@ class MainActivity : ComponentActivity() {
6878
val appUpdateManager = AppUpdateManagerFactory.create(this)
6979
val appUpdateInfoTask = appUpdateManager.appUpdateInfo
7080

71-
appUpdateInfoTask.addOnSuccessListener {
72-
val isUpdateAvailable = it.updateAvailability() == UpdateAvailability.UPDATE_AVAILABLE
73-
74-
if (isUpdateAvailable && it.isUpdateTypeAllowed(AppUpdateType.IMMEDIATE)) {
75-
appUpdateManager.startUpdateFlowForResult(
76-
it,
77-
AppUpdateType.IMMEDIATE,
78-
this,
79-
0,
80-
)
81+
appUpdateInfoTask.addOnSuccessListener { appUpdateInfo ->
82+
if (appUpdateInfo.updateAvailability() != UpdateAvailability.UPDATE_AVAILABLE) {
83+
return@addOnSuccessListener
8184
}
85+
86+
val updateOptions = AppUpdateOptions
87+
.newBuilder(AppUpdateType.IMMEDIATE)
88+
.setAllowAssetPackDeletion(true)
89+
.build()
90+
91+
appUpdateManager.startUpdateFlowForResult(
92+
appUpdateInfo,
93+
updateLauncher,
94+
updateOptions,
95+
)
8296
}
8397
}
8498
}
Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
package team.retum.common.enums
22

3-
enum class InterviewLocation {
4-
DAEJEON,
5-
SEOUL,
6-
GYEONGGI,
7-
OTHER,
3+
enum class InterviewLocation(
4+
val value: String,
5+
) {
6+
DAEJEON("๋Œ€์ „"),
7+
SEOUL("์„œ์šธ"),
8+
GYEONGGI("๊ฒฝ๊ธฐ"),
9+
OTHER("๊ธฐํƒ€"),
810
}
Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
package team.retum.common.enums
22

3-
enum class InterviewType {
4-
INDIVIDUAL,
5-
GROUP,
6-
OTHER,
3+
enum class InterviewType(
4+
val value: String,
5+
) {
6+
INDIVIDUAL("๊ฐœ์ธ ๋ฉด์ ‘"),
7+
GROUP("๋‹จ์ฒด ๋ฉด์ ‘"),
8+
OTHER("๊ธฐํƒ€ ๋ฉด์ ‘"),
79
}

โ€Žcore/data/src/main/java/team/retum/data/repository/review/ReviewRepository.ktโ€Ž

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ interface ReviewRepository {
1818
interviewType: InterviewType?,
1919
companyId: Long?,
2020
keyword: String?,
21-
year: Int?,
21+
year: List<Int>?,
2222
code: Long?,
2323
): FetchReviewsResponse
2424

@@ -30,7 +30,7 @@ interface ReviewRepository {
3030
location: InterviewLocation?,
3131
interviewType: InterviewType?,
3232
keyword: String?,
33-
year: Int?,
33+
year: List<Int>?,
3434
code: Long?,
3535
): FetchReviewsCountResponse
3636

โ€Žcore/data/src/main/java/team/retum/data/repository/review/ReviewRepositoryImpl.ktโ€Ž

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class ReviewRepositoryImpl @Inject constructor(
2323
interviewType: InterviewType?,
2424
companyId: Long?,
2525
keyword: String?,
26-
year: Int?,
26+
year: List<Int>?,
2727
code: Long?,
2828
): FetchReviewsResponse =
2929
reviewDataSource.fetchReviews(
@@ -46,7 +46,7 @@ class ReviewRepositoryImpl @Inject constructor(
4646
location: InterviewLocation?,
4747
interviewType: InterviewType?,
4848
keyword: String?,
49-
year: Int?,
49+
year: List<Int>?,
5050
code: Long?,
5151
): FetchReviewsCountResponse =
5252
reviewDataSource.fetchReviewsCount(
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
package team.retum.jobisdesignsystemv2.chip
2+
3+
import androidx.compose.animation.animateColorAsState
4+
import androidx.compose.foundation.background
5+
import androidx.compose.foundation.layout.Box
6+
import androidx.compose.foundation.layout.padding
7+
import androidx.compose.foundation.shape.RoundedCornerShape
8+
import androidx.compose.runtime.Composable
9+
import androidx.compose.runtime.getValue
10+
import androidx.compose.ui.Alignment
11+
import androidx.compose.ui.Modifier
12+
import androidx.compose.ui.draw.clip
13+
import androidx.compose.ui.unit.dp
14+
import team.retum.jobisdesignsystemv2.foundation.JobisTheme
15+
import team.retum.jobisdesignsystemv2.foundation.JobisTypography
16+
import team.retum.jobisdesignsystemv2.text.JobisText
17+
import team.retum.jobisdesignsystemv2.utils.clickable
18+
19+
/**
20+
* This composable function creates a JobisChip element for use in Jobis.
21+
*
22+
* @param text Text to be displayed on the chip
23+
* @param selected Whether the chip is selected
24+
* @param onClick Called when this chip is clicked
25+
* @param modifier The modifier to be applied to the JobisChip
26+
*/
27+
@Composable
28+
fun JobisChip(
29+
modifier: Modifier = Modifier,
30+
text: String,
31+
selected: Boolean,
32+
onClick: () -> Unit,
33+
) {
34+
val background by animateColorAsState(
35+
targetValue = if (selected) JobisTheme.colors.onPrimary else JobisTheme.colors.inverseSurface,
36+
label = "",
37+
)
38+
val textColor by animateColorAsState(
39+
targetValue = if (selected) JobisTheme.colors.background else JobisTheme.colors.onPrimaryContainer,
40+
label = "",
41+
)
42+
43+
Box(
44+
modifier = modifier
45+
.clickable(
46+
enabled = true,
47+
onClick = onClick,
48+
onPressed = {},
49+
)
50+
.clip(RoundedCornerShape(30.dp))
51+
.background(background),
52+
contentAlignment = Alignment.Center,
53+
) {
54+
JobisText(
55+
modifier = Modifier.padding(
56+
horizontal = 12.dp,
57+
vertical = 4.dp,
58+
),
59+
text = text,
60+
style = JobisTypography.Body,
61+
color = textColor,
62+
)
63+
}
64+
}
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
package team.retum.jobisdesignsystemv2.chip
2+
3+
import androidx.compose.foundation.layout.Arrangement
4+
import androidx.compose.foundation.layout.Column
5+
import androidx.compose.foundation.layout.ExperimentalLayoutApi
6+
import androidx.compose.foundation.layout.FlowRow
7+
import androidx.compose.foundation.layout.padding
8+
import androidx.compose.runtime.Composable
9+
import androidx.compose.ui.Modifier
10+
import androidx.compose.ui.unit.dp
11+
import kotlinx.collections.immutable.ImmutableList
12+
import team.retum.jobisdesignsystemv2.foundation.JobisTheme
13+
import team.retum.jobisdesignsystemv2.foundation.JobisTypography
14+
import team.retum.jobisdesignsystemv2.text.JobisText
15+
16+
@OptIn(ExperimentalLayoutApi::class)
17+
@Composable
18+
fun <T> JobisChipGroup(
19+
title: String,
20+
items: ImmutableList<T>,
21+
itemText: (T) -> String,
22+
selectedItem: T?,
23+
onItemClick: (T) -> Unit,
24+
maxItemsInEachRow: Int = 5,
25+
) {
26+
Column(
27+
modifier = Modifier.padding(horizontal = 24.dp),
28+
) {
29+
if (title.isNotBlank()) {
30+
JobisText(
31+
modifier = Modifier.padding(vertical = 8.dp),
32+
text = title,
33+
style = JobisTypography.SubHeadLine,
34+
color = JobisTheme.colors.inverseOnSurface,
35+
)
36+
}
37+
FlowRow(
38+
horizontalArrangement = Arrangement.spacedBy(8.dp),
39+
verticalArrangement = Arrangement.spacedBy(8.dp),
40+
maxItemsInEachRow = maxItemsInEachRow,
41+
) {
42+
items.forEach { item ->
43+
JobisChip(
44+
text = itemText(item),
45+
selected = selectedItem == item,
46+
onClick = { onItemClick(item) },
47+
)
48+
}
49+
}
50+
}
51+
}

โ€Žcore/design-system/src/main/java/team/retum/jobisdesignsystemv2/skills/Skills.ktโ€Ž

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,15 @@ import team.retum.jobisdesignsystemv2.utils.clickable
1919

2020
@Composable
2121
fun Skills(
22+
modifier: Modifier = Modifier,
2223
skills: SnapshotStateList<String>,
2324
checkSkillsId: ImmutableList<Long>? = null,
2425
checkedSkills: ImmutableList<String>,
2526
onCheckedChange: (String, Boolean, Long) -> Unit,
2627
) {
27-
LazyColumn {
28+
LazyColumn(
29+
modifier = modifier,
30+
) {
2831
items(skills.size) { skill ->
2932
val checked = checkedSkills.contains(skills[skill])
3033
SkillContent(

โ€Žcore/domain/src/main/java/team/retum/usecase/usecase/review/FetchReviewsCountUseCase.ktโ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ class FetchReviewsCountUseCase @Inject constructor(
1313
location: InterviewLocation?,
1414
interviewType: InterviewType?,
1515
keyword: String?,
16-
year: Int?,
16+
year: List<Int>?,
1717
code: Long?,
1818
) = runCatching {
1919
reviewRepository.fetchReviewsCount(

โ€Žcore/domain/src/main/java/team/retum/usecase/usecase/review/FetchReviewsUseCase.ktโ€Ž

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,15 @@ import javax.inject.Inject
99
class FetchReviewsUseCase @Inject constructor(
1010
private val reviewRepository: ReviewRepository,
1111
) {
12-
suspend operator fun invoke(page: Int?, location: InterviewLocation?, interviewType: InterviewType?, keyword: String?, year: Int?, companyId: Long?, code: Long?) = runCatching {
12+
suspend operator fun invoke(
13+
page: Int?,
14+
location: InterviewLocation?,
15+
interviewType: InterviewType?,
16+
keyword: String?,
17+
year: List<Int>?,
18+
companyId: Long?,
19+
code: Long?,
20+
) = runCatching {
1321
reviewRepository.fetchReviews(page, location, interviewType, companyId, keyword, year, code).toEntity()
1422
}
1523
}

0 commit comments

Comments
ย (0)