-
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 #268 from Nexters/feature/255
Feature/255 선물 등록하기
- Loading branch information
Showing
12 changed files
with
337 additions
and
62 deletions.
There are no files selected for viewing
3 changes: 3 additions & 0 deletions
3
data/src/main/java/com/nexters/boolti/data/network/request/GiftReceiveRequest.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,5 +1,8 @@ | ||
package com.nexters.boolti.data.network.request | ||
|
||
import kotlinx.serialization.Serializable | ||
|
||
@Serializable | ||
data class GiftReceiveRequest( | ||
val giftUuid: 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
53 changes: 0 additions & 53 deletions
53
presentation/src/main/java/com/nexters/boolti/presentation/screen/HomeViewModel.kt
This file was deleted.
Oops, something went wrong.
82 changes: 82 additions & 0 deletions
82
presentation/src/main/java/com/nexters/boolti/presentation/screen/home/GiftDialog.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,82 @@ | ||
package com.nexters.boolti.presentation.screen.home | ||
|
||
import androidx.compose.foundation.layout.padding | ||
import androidx.compose.material3.MaterialTheme | ||
import androidx.compose.material3.Text | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.res.stringResource | ||
import androidx.compose.ui.text.style.TextAlign | ||
import androidx.compose.ui.unit.dp | ||
import com.nexters.boolti.presentation.R | ||
import com.nexters.boolti.presentation.component.BTDialog | ||
import com.nexters.boolti.presentation.theme.Grey15 | ||
import com.nexters.boolti.presentation.theme.Grey50 | ||
|
||
@Composable | ||
fun GiftDialog( | ||
status: GiftStatus, | ||
onDismiss: () -> Unit, | ||
receiveGift: () -> Unit, | ||
requireLogin: () -> Unit, | ||
onFailed: () -> Unit, | ||
) { | ||
val buttonTextRes = when (status) { | ||
GiftStatus.SELF, GiftStatus.CAN_REGISTER -> R.string.gift_register | ||
GiftStatus.NEED_LOGIN -> R.string.gift_login | ||
GiftStatus.FAILED -> R.string.description_close_button | ||
} | ||
|
||
val textRes = when (status) { | ||
GiftStatus.SELF -> R.string.gift_self_dialog | ||
GiftStatus.NEED_LOGIN -> R.string.gift_need_login | ||
GiftStatus.CAN_REGISTER -> R.string.gift_register_dialog | ||
GiftStatus.FAILED -> R.string.gift_registration_failed | ||
} | ||
|
||
val action: () -> Unit = when (status) { | ||
GiftStatus.SELF -> { | ||
{ | ||
receiveGift() | ||
onDismiss() | ||
} | ||
} | ||
|
||
GiftStatus.NEED_LOGIN -> requireLogin | ||
GiftStatus.CAN_REGISTER -> { | ||
{ | ||
receiveGift() | ||
onDismiss() | ||
} | ||
} | ||
|
||
GiftStatus.FAILED -> onDismiss | ||
} | ||
|
||
val hasNegativeButton = status in listOf(GiftStatus.SELF, GiftStatus.CAN_REGISTER) | ||
|
||
BTDialog( | ||
onDismiss = onDismiss, | ||
onClickPositiveButton = action, | ||
positiveButtonLabel = stringResource(id = buttonTextRes), | ||
onClickNegativeButton = if(hasNegativeButton) onFailed else null | ||
) { | ||
Text( | ||
text = stringResource(id = textRes), | ||
style = MaterialTheme.typography.titleLarge.copy( | ||
color = Grey15, | ||
textAlign = TextAlign.Center | ||
), | ||
) | ||
if (status == GiftStatus.FAILED) { | ||
Text( | ||
modifier = Modifier.padding(top = 4.dp), | ||
text = stringResource(id = R.string.gift_registration_failed_dialog), | ||
style = MaterialTheme.typography.bodySmall.copy( | ||
color = Grey50, | ||
textAlign = TextAlign.Center | ||
), | ||
) | ||
} | ||
} | ||
} |
8 changes: 8 additions & 0 deletions
8
presentation/src/main/java/com/nexters/boolti/presentation/screen/home/GiftStatus.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,8 @@ | ||
package com.nexters.boolti.presentation.screen.home | ||
|
||
enum class GiftStatus { | ||
NEED_LOGIN, | ||
FAILED, | ||
SELF, | ||
CAN_REGISTER, | ||
} |
11 changes: 11 additions & 0 deletions
11
presentation/src/main/java/com/nexters/boolti/presentation/screen/home/HomeEvent.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.nexters.boolti.presentation.screen.home | ||
|
||
sealed interface HomeEvent { | ||
data class DeepLinkEvent( | ||
val deepLink: String, | ||
) : HomeEvent | ||
|
||
data class ShowMessage( | ||
val status: GiftStatus | ||
) : HomeEvent | ||
} |
Oops, something went wrong.