Skip to content
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

Feature/boolti 264 마이페이지 고도화 #266

Merged
merged 8 commits into from
Jul 24, 2024
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ internal class AuthDataSource @Inject constructor(
nickname = it.nickname ?: "",
email = it.email ?: "",
imgPath = it.photo,
userCode = it.userCode,
)
}
}
Expand All @@ -61,6 +62,7 @@ internal class AuthDataSource @Inject constructor(
email = null,
phoneNumber = null,
photo = null,
userCode = null,
accessToken = "",
refreshToken = "",
)
Expand All @@ -80,6 +82,7 @@ internal class AuthDataSource @Inject constructor(
nickname = user.nickname,
email = user.email,
photo = user.imgPath,
userCode = user.userCode,
)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ internal data class AppSettings(
val email: String? = null,
val phoneNumber: String? = null,
val photo: String? = null,
val userCode: String? = null,
val accessToken: String = "",
val refreshToken: String = "",
val refundPolicy: List<String> = emptyList(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,15 @@ internal data class UserResponse(
val nickname: String? = null,
val email: String? = null,
val imgPath: String? = null,
val userCode: String? = null,
) {
fun toDomain(): User {
return User(
id = id,
nickname = nickname ?: "",
email = email ?: "",
photo = imgPath,
userCode = userCode ?: "",
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ data class User(
val nickname: String = "",
val email: String = "",
val photo: String? = null,
val userCode: String = "",
)
1 change: 1 addition & 0 deletions presentation/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ android {
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles("consumer-rules.pro")
buildConfigField("String", "PACKAGE_NAME", "\"${libs.versions.packageName.get()}\"")
buildConfigField("String", "VERSION_NAME", "\"${libs.versions.versionName.get()}\"")
}

buildTypes {
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
package com.nexters.boolti.presentation.component

import androidx.annotation.DrawableRes
import androidx.compose.foundation.background
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material3.Icon
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.TextStyle
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import com.nexters.boolti.presentation.R
import com.nexters.boolti.presentation.theme.BooltiTheme
import com.nexters.boolti.presentation.theme.Grey05
import com.nexters.boolti.presentation.theme.Grey50
import com.nexters.boolti.presentation.theme.Grey80
import com.nexters.boolti.presentation.theme.Grey85

@Composable
fun SmallButton(
label: String,
modifier: Modifier = Modifier,
@DrawableRes iconRes: Int? = null,
backgroundColor: Color = Grey85,
iconTint: Color = Grey50,
labelStyle: TextStyle = MaterialTheme.typography.labelMedium.copy(color = Grey05),
onClick: () -> Unit,
) {
Row(
modifier = modifier
.clip(shape = RoundedCornerShape(4.dp))
.clickable(onClick = onClick)
.height(30.dp)
.background(color = backgroundColor)
.padding(horizontal = 12.dp),
verticalAlignment = Alignment.CenterVertically,
) {
iconRes?.let { id ->
Icon(
modifier = modifier.padding(end = 6.dp),
painter = painterResource(id = id),
tint = iconTint,
contentDescription = label,
)
}
Text(
text = label,
style = labelStyle,
)
}
}

@Preview
@Composable
private fun CopyButtonPreview() {
BooltiTheme {
SmallButton(
label = stringResource(R.string.ticketing_copy_address),
iconRes = R.drawable.ic_copy,
) { }
}
}

@Preview
@Composable
private fun LoginButtonPreview() {
BooltiTheme {
SmallButton(
label = stringResource(R.string.login),
backgroundColor = Grey80,
) { }
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package com.nexters.boolti.presentation.extension

import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.SharingStarted
import kotlinx.coroutines.flow.stateIn

fun <T> Flow<T>.stateInUi(
scope: CoroutineScope,
initialValue: T
) = stateIn(scope, SharingStarted.WhileSubscribed(5000), initialValue)
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import com.nexters.boolti.presentation.component.ToastSnackbarHost
import com.nexters.boolti.presentation.extension.navigateToHome
import com.nexters.boolti.presentation.screen.MainDestination.Home
import com.nexters.boolti.presentation.screen.MainDestination.ShowDetail
import com.nexters.boolti.presentation.screen.accountsetting.AccountSettingScreen
import com.nexters.boolti.presentation.screen.business.BusinessScreen
import com.nexters.boolti.presentation.screen.gift.addGiftScreen
import com.nexters.boolti.presentation.screen.giftcomplete.addGiftCompleteScreen
Expand Down Expand Up @@ -192,6 +193,10 @@ fun MainNavigation(modifier: Modifier, onClickQrScan: (showId: String, showName:
popBackStack = { navController.popBackStack(MainDestination.Gift.route, true)}
)
BusinessScreen(popBackStack = navController::popBackStack)
AccountSettingScreen(
navigateTo = navController::navigateTo,
popBackStack = navController::popBackStack,
)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ sealed class MainDestination(val route: String) {
)
}

data object Gift : MainDestination(route = "gift/{$showId}?salesTicketId={$salesTicketId}&ticketCount={$ticketCount}") {
data object Gift :
MainDestination(route = "gift/{$showId}?salesTicketId={$salesTicketId}&ticketCount={$ticketCount}") {
val arguments = listOf(
navArgument(showId) { type = NavType.StringType },
navArgument(salesTicketId) { type = NavType.StringType },
Expand Down Expand Up @@ -70,6 +71,7 @@ sealed class MainDestination(val route: String) {
data object SignOut : MainDestination(route = "signout")
data object Login : MainDestination(route = "login")
data object Business : MainDestination(route = "business")
data object AccountSetting : MainDestination(route = "accountSetting")
}

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package com.nexters.boolti.presentation.screen.accountsetting

import androidx.navigation.NavGraphBuilder
import androidx.navigation.compose.composable
import com.nexters.boolti.presentation.screen.MainDestination

fun NavGraphBuilder.AccountSettingScreen(
navigateTo: (String) -> Unit,
popBackStack: () -> Unit,
) {
composable(
route = MainDestination.AccountSetting.route,
) {
AccountSettingScreen(
navigateBack = popBackStack,
onClickResign = { navigateTo(MainDestination.SignOut.route) },
)
}
}
Loading
Loading