Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ android {
compileSdk = libs.versions.compileSdk.get().toInt()

signingConfigs {
// Todo: local properties로 키 옮기기
getByName("debug") {
val debugKeystorePath = System.getProperty("user.home") + "/.android/debug.keystore"
storeFile = file(debugKeystorePath)
Expand Down Expand Up @@ -64,6 +65,7 @@ android {

}
buildTypes {
// Todo: 이거도 하나로 합치기 및 난독화 적용 후 테스트도 해보기
release {
isMinifyEnabled = false
proguardFiles(
Expand Down
44 changes: 0 additions & 44 deletions app/src/main/java/com/kiero/core/common/extension/ModifierExt.kt
Original file line number Diff line number Diff line change
Expand Up @@ -45,50 +45,6 @@ fun Modifier.forcePixelToDp(painter: Painter): Modifier {
)
}

@Composable
fun Modifier.dropShadow(
shape: Shape,
color: Color = Color.Black.copy(0.25f),
blur: Dp = 1.dp,
offsetY: Dp = 1.dp,
offsetX: Dp = 1.dp,
spread: Dp = 1.dp
) = composed {
val density = LocalDensity.current

val paint = remember(color, blur) {
Paint().apply {
this.color = color
val blurPx = with(density) { blur.toPx() }
if (blurPx > 0f) {
this.asFrameworkPaint().maskFilter =
BlurMaskFilter(blurPx, BlurMaskFilter.Blur.NORMAL)
}
}
}

drawBehind {
val spreadPx = spread.toPx()
val offsetXPx = offsetX.toPx()
val offsetYPx = offsetY.toPx()

val shadowWidth = size.width + spreadPx
val shadowHeight = size.height + spreadPx

if (shadowWidth <= 0f || shadowHeight <= 0f) return@drawBehind

val shadowSize = Size(shadowWidth, shadowHeight)
val shadowOutline = shape.createOutline(shadowSize, layoutDirection, this)

drawIntoCanvas { canvas ->
canvas.save()
canvas.translate(offsetXPx, offsetYPx)
canvas.drawOutline(shadowOutline, paint)
canvas.restore()
}
}
}

fun Modifier.systemBarColor(color: Color): Modifier = composed {
val activity = LocalActivity.current

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
package com.kiero.core.designsystem.component

import androidx.compose.foundation.Image
import androidx.compose.foundation.layout.size
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.vector.ImageVector
import androidx.compose.ui.layout.ContentScale
import androidx.compose.ui.platform.LocalInspectionMode
import androidx.compose.ui.res.vectorResource
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import coil.compose.AsyncImage
import com.kiero.R

@Composable
fun UrlImage(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

p1) 함수명이 파일명이랑 달라요!

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

허걱 감사합니당

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

qa의 승재 역시 믿고봅니다

url: String,
modifier: Modifier = Modifier,
contentScale: ContentScale = ContentScale.Fit,
contentDescription: String? = null,
) {
if (LocalInspectionMode.current) {
Image(
imageVector = ImageVector.vectorResource(R.drawable.img_fake_red),
contentDescription = contentDescription,
contentScale = contentScale,
modifier = modifier
)
} else {
AsyncImage(
model = url,
contentDescription = contentDescription,
contentScale = contentScale,
modifier = modifier
)
}
}

@Preview
@Composable
fun UrlImagePreview() {
UrlImage(
url = "",
modifier = Modifier.size(100.dp),
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ interface UserInfoManager {
suspend fun saveParentInfo(parentName: String, parentProfileImage: String)
suspend fun getParentInfo(): ParentInfo?

suspend fun clearParentInfo()

suspend fun saveChildIdInfo(childId : Long)
suspend fun getChildIdInfo(): Long?
}
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,17 @@ class UserInfoManagerImpl @Inject constructor(
}.getOrNull()
}

override suspend fun clearParentInfo() {
suspendRunCatching {
dataStore.edit { preferences ->
preferences.remove(KEY_PARENT_NAME)
preferences.remove(KEY_PARENT_PROFILE_IMAGE)
}
}.onFailure {
Timber.e(it, "Failed to clear parent info")
}
}

override suspend fun saveChildIdInfo(childId: Long) {
suspendRunCatching {
dataStore.edit { preferences ->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ fun NavGraphBuilder.authNavGraph(
navigateUp: () -> Unit,
navigateToParentGraph: () -> Unit,
navigateToParentSignUp: (String, String) -> Unit,
navigateToSelection: () -> Unit,
onEasterEggClick: () -> Unit
) {
navigation<AuthGraph>(
Expand All @@ -63,7 +64,8 @@ fun NavGraphBuilder.authNavGraph(
navigateToParentSignUp = { parentName, parentProfileImage ->
navigateToParentSignUp(parentName, parentProfileImage)
},
navigateToParentGraph = navigateToParentGraph
navigateToParentGraph = navigateToParentGraph,
navigateToSelection = navigateToSelection
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ import com.kiero.presentation.auth.state.AuthSideEffect
fun AuthParentRoute(
paddingValues: PaddingValues,
navigateUp: () -> Unit,
navigateToSelection: () -> Unit,
navigateToParentSignUp: (String, String) -> Unit,
navigateToParentGraph: () -> Unit,
viewModel: AuthParentViewModel = hiltViewModel(),
Expand All @@ -66,15 +67,14 @@ fun AuthParentRoute(
}

AuthSideEffect.NavigateToParentGraph -> navigateToParentGraph()

AuthSideEffect.NavigateToSelection -> navigateToSelection()
else -> {}
}
}

BackHandler(
enabled = true,
onBack = viewModel::navigateUp
)
BackHandler {
viewModel.navigateUp()
}

Box(
modifier = Modifier
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import com.kiero.core.common.extension.toHandleErrorMessage
import com.kiero.core.localstorage.info.UserInfoManager
import com.kiero.core.model.UiState
import com.kiero.data.auth.repository.AuthRepository
import com.kiero.data.sse.manager.SseManager
import com.kiero.presentation.auth.state.AuthSideEffect
import com.kiero.presentation.auth.state.AuthState
import dagger.hilt.android.lifecycle.HiltViewModel
Expand All @@ -27,6 +28,7 @@ import javax.inject.Inject
class AuthParentViewModel @Inject constructor(
private val authRepository: AuthRepository,
private val userInfoManager: UserInfoManager,
private val sseManager: SseManager
) : ViewModel() {

private val _state = MutableStateFlow(AuthState())
Expand Down Expand Up @@ -110,7 +112,8 @@ class AuthParentViewModel @Inject constructor(
fun navigateUp() {
viewModelScope.launch {
Timber.e("navigateUp")
_sideEffect.emit(AuthSideEffect.NavigateUp)
sseManager.stopSubscription()
_sideEffect.emit(AuthSideEffect.NavigateToSelection)
_state.update { it.copy(uiState = UiState.Empty) }
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,6 @@ sealed interface AuthSideEffect {
data object NavigateToParentGraph : AuthSideEffect
data object NavigateToParent : AuthSideEffect
data object NavigateToKid : AuthSideEffect

data object NavigateToSelection : AuthSideEffect
}
Original file line number Diff line number Diff line change
Expand Up @@ -43,22 +43,20 @@ fun KieroNavHost(
modifier = modifier
) {
splashNavGraph(
navigateToAuth = appState::navigateToAuth,
navigateToAuth = {
appState.navigateToAuth(clearStackNavOptions)
},
navigateToParentHome = {
Timber.d("Navigate to Parent Home (Clear Stack)")
appState.navigateToSchedule(clearStackNavOptions)
},
navigateToKidHome = {
Timber.d("Navigate to Kid Home (Clear Stack)")
appState.navigateToJourney(clearStackNavOptions)
},
navigateToParentGraph = {
// 부모 카카오 로그인
Timber.d("Navigate to Parent Graph (Clear Stack)")
appState.navigateToAuthParent(clearStackNavOptions)
},
navigateToKidOnboarding = {
Timber.d("Navigate to Kid Onboarding (Clear Stack)")
appState.navigateToKidOnboarding(clearStackNavOptions)
}
)
Expand All @@ -75,17 +73,18 @@ fun KieroNavHost(
navOptions = clearStackNavOptions
)
},
navigateToSelection = appState::navigateToSelection,
onEasterEggClick = appState::navigateToKidOnboarding
)

parentSignUpNavGraph(
paddingValues = paddingValues,
navigateToParent = appState::navigateToParentGraph,
navigateToParent = {
appState.navigateToClearParentGraph()
},
navigateToSelection = appState::navigateToSelection
)



parentNavGraph(
navController = appState.navController,
paddingValues = paddingValues,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,8 @@ class MainAppState(
popUpTo(AuthGraph) { inclusive = true }
}

fun navigateToClearParentGraph() = navController.navigate(ParentGraph, clearStackNavOptions)

fun navigateToAuthParent(
navOptions: NavOptions? = null,
) = navController.navigateToAuthParent(
Expand All @@ -146,9 +148,11 @@ class MainAppState(
}
}

fun navigateToAuth() {
fun navigateToAuth(
navOptions: NavOptions? = null
) {
navController.navigate(AuthGraph) {
popUpTo<Splash> {
popUpTo(0) {
inclusive = true
}
launchSingleTop = true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,14 @@ 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.dropShadow
import androidx.compose.ui.graphics.Shape
import androidx.compose.ui.graphics.shadow.Shadow
import androidx.compose.ui.graphics.vector.ImageVector
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.res.vectorResource
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.unit.dp
import com.kiero.core.common.extension.dropShadow
import com.kiero.core.common.extension.noRippleClickable
import com.kiero.core.designsystem.theme.KieroTheme
import kotlinx.collections.immutable.ImmutableList
Expand All @@ -52,14 +53,14 @@ fun MainBottomBar(
modifier = Modifier
.then(
if (isVisible && isParentMode) {
Modifier.dropShadow(
shape = RoundedCornerShape(12.dp),
color = KieroTheme.colors.gray800,
offsetX = 0.dp,
offsetY = 4.dp,
blur = 10.dp,
spread = 0.dp
)
Modifier
.dropShadow(
shape = RoundedCornerShape(12.dp),
shadow = Shadow(
radius = 10.dp,
color = KieroTheme.colors.gray800,
)
)
} else {
Modifier
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ import androidx.compose.ui.layout.ContentScale
import androidx.compose.ui.res.vectorResource
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import coil.compose.AsyncImage
import com.kiero.R
import com.kiero.core.common.extension.noRippleClickable
import com.kiero.core.common.extension.toHighlightedText
import com.kiero.core.designsystem.component.UrlImage
import com.kiero.core.designsystem.component.chip.KieroChip
import com.kiero.core.designsystem.component.chip.action.KieroCoinAction
import com.kiero.core.designsystem.theme.KieroTheme
Expand All @@ -40,7 +40,7 @@ fun ParentAlarmCard(
highlightTexts: List<String>,
highlightColor: Color,
coinUsed: Int?,
imageUrl: Any?,
imageUrl: String?,
isExpanded: Boolean,
onExpandClick: () -> Unit,
modifier: Modifier = Modifier
Expand Down Expand Up @@ -119,8 +119,8 @@ fun ParentAlarmCard(
modifier = Modifier
.height(15.dp)
)
AsyncImage(
model = imageUrl,
UrlImage(
url = imageUrl,
contentDescription = null,
modifier = Modifier
.fillMaxWidth()
Expand Down Expand Up @@ -150,7 +150,7 @@ private fun ParentAlarmCardPreview() {
highlightTexts = listOf("과자먹기"),
highlightColor = Color(0xFF00FFE1),
coinUsed = null,
imageUrl = R.drawable.img_kid_journey_piano_background,
imageUrl = "",
isExpanded = true,
onExpandClick = {}
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ data class ParentAlarmUiModel(
val highlightText: String,
val highlightColor: Color,
val coinUsed: Int?,
val imageUrl: Any?,
val imageUrl: String?,
val isExpanded: Boolean = false
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ data class AlarmFeedState(
highlightText = "피아노 학원",
highlightColor = Color(0xFF00FFE1),
coinUsed = null,
imageUrl = R.drawable.img_kid_journey_piano_background,
imageUrl = null,
isExpanded = false
), ParentAlarmUiModel(
id = "2",
Expand Down
Loading