Skip to content

Commit

Permalink
Merge pull request #171 from PawWithU/refactor/phone-auth
Browse files Browse the repository at this point in the history
refactor/phone-auth : 휴대폰 인증 화면 UI 수정 사항 반영 및 리팩토링
  • Loading branch information
kang9366 authored Nov 12, 2024
2 parents 1a49b55 + 72f49bb commit 81205d4
Show file tree
Hide file tree
Showing 17 changed files with 361 additions and 275 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ private const val TAG = "API Module"
@Module
@InstallIn(SingletonComponent::class)
internal object ApiModule {
private const val BASE_URL = "https://dev-api.connectdog.site"
private const val BASE_URL = "https://dev-api.pawwithu.site/"

@Provides
fun provideNetworkInterceptor(dataStoreRepository: DataStoreRepository): Interceptor = Interceptor { chain ->
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
package com.kusitms.connectdog.core.designsystem.component

import androidx.compose.foundation.Canvas
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.height
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.geometry.RoundRect
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.Path
import androidx.compose.ui.graphics.drawscope.Stroke
import androidx.compose.ui.platform.LocalDensity
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import com.kusitms.connectdog.core.designsystem.theme.PetOrange

@Composable
fun SpeechBubble(
text: String,
fontSize: Int,
fontColor: Color,
fontWeight: FontWeight
) {
Box {
BubbleShape()
Text(
modifier = Modifier.align(Alignment.Center),
text = text,
fontSize = fontSize.sp,
color = fontColor,
fontWeight = fontWeight
)
}
}

@Composable
private fun BubbleShape() {
val density = LocalDensity.current
val tailWidth = with(density) { 10.dp.toPx() }
val tailHeight = with(density) { 9.dp.toPx() }
val strokeWidth = with(density) { 1.dp.toPx() }

Canvas(
modifier = Modifier
.height(28.dp)
.fillMaxSize()
) {
val width = size.width
val height = size.height

val path = Path().apply {
val cornerRadius = 100.dp.toPx()
addRoundRect(RoundRect(0f, 0f, width, height, cornerRadius, cornerRadius))
}

val path2 = Path().apply {
val tailStartX = (width / 2) - (tailWidth / 2)
moveTo(tailStartX + 2f, height)
lineTo(tailStartX + tailWidth - 2f, height)
}

val path3 = Path().apply {
val tailStartX = (width / 2) - (tailWidth / 2)

moveTo(tailStartX, height)
lineTo(tailStartX + tailWidth / 2, height + tailHeight)
lineTo(tailStartX + tailWidth, height)
}

drawPath(
path = path,
color = PetOrange,
style = Stroke(width = strokeWidth)
)

drawPath(
path = path2,
color = Color.White,
style = Stroke(width = strokeWidth + 2.dp.toPx())
)

drawPath(
path = path3,
color = PetOrange,
style = Stroke(width = strokeWidth)
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -105,15 +105,17 @@ fun ConnectDogNormalButton(
fontSize: Int = 16,
modifier: Modifier = Modifier
.fillMaxWidth()
.height(56.dp)
.height(56.dp),
enabled: Boolean = true
) {
ConnectDogBottomButton(
onClick = onClick,
content = content,
enabledColor = color,
modifier = modifier,
textColor = textColor,
fontSize = fontSize
fontSize = fontSize,
enabled = enabled
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,12 @@ import androidx.compose.material3.OutlinedTextField
import androidx.compose.material3.OutlinedTextFieldDefaults
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.ExperimentalComposeUiApi
import androidx.compose.ui.Modifier
import androidx.compose.ui.R
import androidx.compose.ui.graphics.Color
Expand All @@ -38,6 +40,8 @@ import com.kusitms.connectdog.core.designsystem.theme.ConnectDogTheme
import com.kusitms.connectdog.core.designsystem.theme.Gray3
import com.kusitms.connectdog.core.designsystem.theme.Gray4
import com.kusitms.connectdog.core.designsystem.theme.Gray5
import com.kusitms.connectdog.core.designsystem.theme.PetOrange
import kotlinx.coroutines.delay

@Composable
fun ConnectDogTextField(
Expand Down Expand Up @@ -168,7 +172,6 @@ fun ConnectDogTextField(
}
}

@OptIn(ExperimentalComposeUiApi::class)
@Composable
fun ConnectDogIconTextField(
modifier: Modifier = Modifier,
Expand Down Expand Up @@ -258,6 +261,58 @@ fun ConnectDogTextFieldWithButton(
}
}

@Composable
fun ConnectDogTextFieldWithTimer(
initialMinute: Int = 5,
initialSecond: Int = 0,
text: String,
onTextChanged: (String) -> Unit,
textFieldLabel: String,
placeholder: String,
borderColor: Color = Gray5,
keyboardType: KeyboardType = KeyboardType.Text,
isError: Boolean = false
) {
var minute by remember { mutableStateOf(initialMinute) }
var second by remember { mutableStateOf(initialSecond) }

LaunchedEffect(key1 = minute, key2 = second) {
if (minute > 0 || second > 0) {
delay(1000L)
if (second > 0) {
second--
} else {
if (minute > 0) {
minute--
second = 59
}
}
}
}

Box(
contentAlignment = Alignment.Center
) {
ConnectDogTextField(
text = text,
label = textFieldLabel,
placeholder = placeholder,
keyboardType = keyboardType,
onTextChanged = { onTextChanged(it) },
borderColor = borderColor,
isError = isError
)
Text(
text = String.format("%02d:%02d", minute, second),
fontSize = 12.sp,
modifier = Modifier
.align(Alignment.CenterEnd)
.padding(end = 16.dp),
color = PetOrange
)
}
}

@Preview
@Composable
private fun ConnectDogTextFieldPreview() {
Expand All @@ -274,61 +329,3 @@ private fun ConnectDogTextFieldPreview() {
)
}
}

@Preview
@Composable
private fun tesaq() {
ConnectDogTheme {
ConnectDogTextField(
height = 244,
text = "",
onTextChanged = {},
label = "느꼈던 감정, 후기를 작성해주세요",
placeholder = "",
isError = false,
supportingText = null
)
}
}

// @Preview
// @Composable
// private fun ConnectDogTextFieldSupportPreview() {
// val (text, onTextChanged) = remember {
// mutableStateOf("")
// }
// ConnectDogTheme {
// ConnectDogTextField(
// text = text,
// onTextChanged = onTextChanged,
// label = "텍스트"
// supportingText = R.string.untitled
// )
// }
// }
//
// @Preview
// @Composable
// private fun ConnectDogTextFieldErrorPreview() {
// val (text, onTextChanged) = remember {
// mutableStateOf("")
// }
// ConnectDogTheme {
// ConnectDogTextField(
// text = text,
// onTextChanged = onTextChanged,
// // labelRes = androidx.compose.ui.R.string.selected,
// // placeholderRes = R.string.untitled,
// isError = true,
// errorMessageRes = R.string.untitled
// )
// }
// }

// @Preview
// @Composable
// private fun ConnnectDogTextFieldWithButtonPreview() {
// ConnectDogTheme {
// ConnectDogTextFieldWithButton(width = 100, height = 30, label = "test", padding = 10)
// }
// }
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package com.kusitms.connectdog.core.util

val String.Companion.empty
get() = ""

fun emptyString(): String = String.empty
1 change: 1 addition & 0 deletions domain/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
10 changes: 10 additions & 0 deletions domain/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
@Suppress("DSL_SCOPE_VIOLATION") // TODO: Remove once KTIJ-19369 is fixed
plugins {
id("java-library")
alias(libs.plugins.org.jetbrains.kotlin.jvm)
}

java {
sourceCompatibility = JavaVersion.VERSION_1_7
targetCompatibility = JavaVersion.VERSION_1_7
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import com.kusitms.connectdog.feature.home.screen.ApplyScreen
import com.kusitms.connectdog.feature.home.screen.CompleteApplyScreen
import com.kusitms.connectdog.feature.home.screen.DetailScreen
import com.kusitms.connectdog.feature.home.screen.FilterSearchRoute
import com.kusitms.connectdog.feature.home.screen.GuideScreen
import com.kusitms.connectdog.feature.home.screen.HomeRoute
import com.kusitms.connectdog.feature.home.screen.IntermediatorProfileScreen
import com.kusitms.connectdog.feature.home.screen.ReviewScreen
Expand Down Expand Up @@ -221,9 +220,9 @@ fun NavGraphBuilder.homeNavGraph(
}

composable(route = HomeRoute.guide) {
GuideScreen(
onBackClick = onBackClick
)
// GuideScreen(
// onBackClick = onBackClick
// )
}

composable(route = HomeRoute.notification) {
Expand Down
4 changes: 4 additions & 0 deletions feature/login/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@ dependencies {
kapt(libs.hilt.compiler)
implementation(libs.hilt.android)

implementation(libs.orbit.core)
implementation(libs.orbit.compose)
implementation(libs.orbit.viewmodel)

implementation(libs.androidx.compose.navigation)
implementation(libs.hilt.navigation.compose)

Expand Down
Loading

0 comments on commit 81205d4

Please sign in to comment.