-
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 #10 from team-haribo/feature/9-publishing-login
🔀 :: (#9) - publishing login
- Loading branch information
Showing
22 changed files
with
506 additions
and
35 deletions.
There are no files selected for viewing
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
27 changes: 27 additions & 0 deletions
27
app/src/main/java/com/goms/goms_android_v2/navigation/GomsNavHost.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,27 @@ | ||
package com.goms.goms_android_v2.navigation | ||
|
||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.Modifier | ||
import androidx.navigation.compose.NavHost | ||
import com.goms.goms_android_v2.ui.GomsAppState | ||
import com.goms.login.navigation.loginRoute | ||
import com.goms.login.navigation.loginScreen | ||
import com.goms.login.navigation.navigateToLogin | ||
|
||
@Composable | ||
fun GomsNavHost( | ||
appState: GomsAppState, | ||
modifier: Modifier = Modifier, | ||
startDestination: String = loginRoute | ||
) { | ||
val navController = appState.navController | ||
NavHost( | ||
navController = navController, | ||
startDestination = startDestination, | ||
modifier = modifier | ||
) { | ||
loginScreen( | ||
onNumberLoginClick = navController::navigateToLogin // number login 나오면 수정 | ||
) | ||
} | ||
} |
5 changes: 5 additions & 0 deletions
5
app/src/main/java/com/goms/goms_android_v2/navigation/TopLevelDestination.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,5 @@ | ||
package com.goms.goms_android_v2.navigation | ||
|
||
enum class TopLevelDestination { | ||
LOGIN, | ||
} |
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,18 @@ | ||
package com.goms.goms_android_v2.ui | ||
|
||
import androidx.compose.material3.windowsizeclass.WindowSizeClass | ||
import androidx.compose.runtime.Composable | ||
import com.goms.design_system.theme.GomsTheme | ||
import com.goms.goms_android_v2.navigation.GomsNavHost | ||
|
||
@Composable | ||
fun GomsApp( | ||
windowSizeClass: WindowSizeClass, | ||
appState: GomsAppState = rememberBitgoeulAppState( | ||
windowSizeClass = windowSizeClass | ||
) | ||
) { | ||
GomsTheme { _,_ -> | ||
GomsNavHost(appState = appState) | ||
} | ||
} |
56 changes: 56 additions & 0 deletions
56
app/src/main/java/com/goms/goms_android_v2/ui/GomsAppState.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,56 @@ | ||
package com.goms.goms_android_v2.ui | ||
|
||
import androidx.compose.material3.windowsizeclass.WindowSizeClass | ||
import androidx.compose.material3.windowsizeclass.WindowWidthSizeClass | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.runtime.Stable | ||
import androidx.compose.runtime.remember | ||
import androidx.compose.runtime.rememberCoroutineScope | ||
import androidx.navigation.NavDestination | ||
import androidx.navigation.NavHostController | ||
import androidx.navigation.compose.currentBackStackEntryAsState | ||
import androidx.navigation.compose.rememberNavController | ||
import com.goms.goms_android_v2.navigation.TopLevelDestination | ||
import com.goms.login.navigation.loginRoute | ||
import kotlinx.coroutines.CoroutineScope | ||
|
||
@Composable | ||
fun rememberBitgoeulAppState( | ||
windowSizeClass: WindowSizeClass, | ||
coroutineScope: CoroutineScope = rememberCoroutineScope(), | ||
navController: NavHostController = rememberNavController() | ||
) : GomsAppState { | ||
return remember( | ||
navController, | ||
coroutineScope, | ||
windowSizeClass | ||
) { | ||
GomsAppState( | ||
navController, | ||
coroutineScope, | ||
windowSizeClass | ||
) | ||
} | ||
} | ||
|
||
@Stable | ||
class GomsAppState( | ||
val navController: NavHostController, | ||
val coroutineScope: CoroutineScope, | ||
val windowSizeClass: WindowSizeClass | ||
) { | ||
val currentDestination: NavDestination? | ||
@Composable get() = navController | ||
.currentBackStackEntryAsState().value?.destination | ||
|
||
val currentTopLeverDestination: TopLevelDestination? | ||
@Composable get() = when (currentDestination?.route) { | ||
loginRoute -> TopLevelDestination.LOGIN | ||
else -> null | ||
} | ||
|
||
val shouldShowBottomBar: Boolean | ||
get() = windowSizeClass.widthSizeClass == WindowWidthSizeClass.Compact | ||
|
||
val topLevelDestinations: List<TopLevelDestination> = TopLevelDestination.values().asList() | ||
} |
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
Empty file.
17 changes: 17 additions & 0 deletions
17
core/design-system/src/main/java/com/goms/design_system/component/button/GomsButton.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,17 @@ | ||
package com.goms.design_system.component.button | ||
|
||
import androidx.compose.runtime.Composable | ||
import com.msg.gauthsignin.component.GAuthButton | ||
import com.msg.gauthsignin.component.utils.Types | ||
|
||
@Composable | ||
fun AuthButton(onClick: () -> Unit) { | ||
GAuthButton( | ||
style = Types.Style.DEFAULT, | ||
actionType = Types.ActionType.SIGNIN, | ||
colors = Types.Colors.COLORED, | ||
horizontalPercent = 1f | ||
) { | ||
onClick() | ||
} | ||
} |
24 changes: 24 additions & 0 deletions
24
...gn-system/src/main/java/com/goms/design_system/component/modifier/MultipleEventsCutter.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,24 @@ | ||
package com.goms.design_system.component.modifier | ||
|
||
internal interface MultipleEventsCutter { | ||
fun processEvent(event: () -> Unit) | ||
|
||
companion object | ||
} | ||
|
||
internal fun MultipleEventsCutter.Companion.get(): MultipleEventsCutter = | ||
MultipleEventsCutterImpl() | ||
|
||
private class MultipleEventsCutterImpl : MultipleEventsCutter { | ||
private val now: Long | ||
get() = System.currentTimeMillis() | ||
|
||
private var lastEventTimeMs: Long = 0 | ||
|
||
override fun processEvent(event: () -> Unit) { | ||
if (now - lastEventTimeMs >= 1000L) { | ||
event.invoke() | ||
} | ||
lastEventTimeMs = now | ||
} | ||
} |
36 changes: 36 additions & 0 deletions
36
core/design-system/src/main/java/com/goms/design_system/component/modifier/gomsClickable.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,36 @@ | ||
package com.goms.design_system.component.modifier | ||
|
||
import androidx.compose.foundation.LocalIndication | ||
import androidx.compose.foundation.clickable | ||
import androidx.compose.foundation.interaction.MutableInteractionSource | ||
import androidx.compose.runtime.remember | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.composed | ||
import androidx.compose.ui.platform.debugInspectorInfo | ||
import androidx.compose.ui.semantics.Role | ||
|
||
fun Modifier.gomsClickable( | ||
enabled: Boolean = true, | ||
isIndication: Boolean = false, | ||
onClickLabel: String? = null, | ||
role: Role? = null, | ||
onClick: () -> Unit | ||
) = composed( | ||
inspectorInfo = debugInspectorInfo { | ||
name = "clickable" | ||
properties["enabled"] = enabled | ||
properties["onClickLabel"] = onClickLabel | ||
properties["role"] = role | ||
properties["onClick"] = onClick | ||
} | ||
) { | ||
val multipleEventsCutter = remember { MultipleEventsCutter.get() } | ||
Modifier.clickable( | ||
enabled = enabled, | ||
onClickLabel = onClickLabel, | ||
onClick = { multipleEventsCutter.processEvent { onClick() } }, | ||
role = role, | ||
indication = if (isIndication) LocalIndication.current else null, | ||
interactionSource = remember { MutableInteractionSource() } | ||
) | ||
} |
70 changes: 70 additions & 0 deletions
70
core/design-system/src/main/java/com/goms/design_system/component/text/LinkText.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,70 @@ | ||
package com.goms.design_system.component.text | ||
|
||
import androidx.compose.foundation.layout.Box | ||
import androidx.compose.foundation.layout.Column | ||
import androidx.compose.foundation.layout.Row | ||
import androidx.compose.foundation.layout.fillMaxWidth | ||
import androidx.compose.foundation.layout.height | ||
import androidx.compose.foundation.layout.padding | ||
import androidx.compose.material3.Divider | ||
import androidx.compose.material3.Text | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.Alignment | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.text.font.FontWeight | ||
import androidx.compose.ui.unit.dp | ||
import com.goms.design_system.component.modifier.gomsClickable | ||
import com.goms.design_system.theme.GomsTheme | ||
|
||
@Composable | ||
fun LinkText( | ||
text: String, | ||
onLinkTextClick: () -> Unit | ||
) { | ||
GomsTheme { colors, typography -> | ||
Column( | ||
modifier = Modifier.fillMaxWidth(), | ||
horizontalAlignment = Alignment.CenterHorizontally | ||
) { | ||
Row( | ||
modifier = Modifier | ||
.fillMaxWidth() | ||
.height(20.dp), | ||
verticalAlignment = Alignment.CenterVertically | ||
) { | ||
Divider( | ||
modifier = Modifier | ||
.weight(1f) | ||
.height(1.dp), | ||
color = colors.WHITE.copy(0.15f) | ||
) | ||
Text( | ||
modifier = Modifier.padding(horizontal = 4.dp), | ||
text = "또는", | ||
style = typography.caption, | ||
fontWeight = FontWeight.Normal, | ||
color = colors.G4 | ||
) | ||
Divider( | ||
modifier = Modifier | ||
.weight(1f) | ||
.height(1.dp), | ||
color = colors.WHITE.copy(0.15f) | ||
) | ||
} | ||
Box( | ||
modifier = Modifier | ||
.height(48.dp) | ||
.gomsClickable { onLinkTextClick() } | ||
) { | ||
Text( | ||
modifier = Modifier.align(Alignment.Center), | ||
text = text, | ||
style = typography.buttonLarge, | ||
fontWeight = FontWeight.Normal, | ||
color = colors.I5 | ||
) | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.