-
Notifications
You must be signed in to change notification settings - Fork 0
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
Feat:[snsproject] navigation-compose, hilt-navigation-compose 의존성 추가 … #24
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -65,5 +65,7 @@ dependencies { | |
debugImplementation(libs.androidx.compose.ui.ui.test.manifest) | ||
implementation(libs.hilt.android) | ||
ksp(libs.hilt.android.compiler) | ||
implementation(libs.androidx.hilt.navigation.compose) | ||
implementation (libs.androidx.navigation.compose) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🚫 [ktlint] standard:paren-spacing reported by reviewdog 🐶 |
||
implementation(project(":domain")) | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,17 @@ | ||
package com.example.presentation.login | ||
|
||
import android.os.Bundle | ||
import androidx.activity.compose.setContent | ||
import androidx.appcompat.app.AppCompatActivity | ||
import com.example.presentation.ui.theme.SnsProjectTheme | ||
|
||
class LoginActivity : AppCompatActivity() { | ||
override fun onCreate(savedInstanceState: Bundle?) { | ||
super.onCreate(savedInstanceState) | ||
setContent { | ||
SnsProjectTheme { | ||
LoginNavHost() | ||
} | ||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package com.example.presentation.login | ||
|
||
import androidx.compose.runtime.Composable | ||
import androidx.navigation.compose.NavHost | ||
import androidx.navigation.compose.composable | ||
import androidx.navigation.compose.rememberNavController | ||
|
||
@Composable | ||
fun LoginNavHost() { | ||
val navController = rememberNavController() | ||
NavHost( | ||
navController = navController, | ||
startDestination = LoginRoute.WelcomeScreen.route, | ||
) { | ||
composable(route = LoginRoute.WelcomeScreen.route) { | ||
WelcomeScreen { | ||
navController.navigate(LoginRoute.LoginScreen.route) | ||
} | ||
} | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🚫 [ktlint] standard:no-trailing-spaces reported by reviewdog 🐶 |
||
composable(route = LoginRoute.LoginScreen.route) { | ||
LoginScreen() | ||
} | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🚫 [ktlint] standard:no-trailing-spaces reported by reviewdog 🐶 |
||
composable(route = LoginRoute.SignUpScreen.route) { | ||
SignUpScreen(id = "", username = "", password1 = "", password2 = "", {}, {}, {}, {}, {}) | ||
} | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🚫 [ktlint] standard:no-trailing-spaces reported by reviewdog 🐶 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🚫 [ktlint] standard:no-blank-line-before-rbrace reported by reviewdog 🐶 |
||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package com.example.presentation.login | ||
|
||
sealed class LoginRoute(val route: String) { | ||
data object WelcomeScreen : LoginRoute("WelcomeScreen") | ||
data object LoginScreen : LoginRoute("LoginScreen") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🚫 [ktlint] standard:blank-line-before-declaration reported by reviewdog 🐶 |
||
data object SignUpScreen : LoginRoute("SignUpScreen") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🚫 [ktlint] standard:blank-line-before-declaration reported by reviewdog 🐶 |
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,10 +14,24 @@ import androidx.compose.ui.Alignment | |
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.tooling.preview.Preview | ||
import androidx.compose.ui.unit.dp | ||
import androidx.hilt.navigation.compose.hiltViewModel | ||
import com.example.presentation.component.LoginTextField | ||
import com.example.presentation.component.SubmitButton | ||
import com.example.presentation.ui.theme.SnsProjectTheme | ||
|
||
@Composable | ||
fun LoginScreen( | ||
viewmodel: LoginViewModel = hiltViewModel() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🚫 [ktlint] standard:function-signature reported by reviewdog 🐶 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🚫 [ktlint] standard:function-signature reported by reviewdog 🐶 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🚫 [ktlint] standard:trailing-comma-on-declaration-site reported by reviewdog 🐶 |
||
) { | ||
LoginScreen( | ||
id = "", | ||
password = "", | ||
onIdChange = {}, | ||
passwordChange = {}, | ||
onNavigationToSignUpScreen = { viewmodel.onLoginClick() } | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🚫 [ktlint] standard:trailing-comma-on-call-site reported by reviewdog 🐶 |
||
) | ||
} | ||
|
||
@Composable | ||
fun LoginScreen( | ||
id: String, | ||
|
@@ -38,58 +52,61 @@ fun LoginScreen( | |
Text(text = "Connected", style = MaterialTheme.typography.displaySmall) | ||
Text(text = "Your favorite social network", style = MaterialTheme.typography.labelSmall) | ||
} | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🚫 [ktlint] standard:no-trailing-spaces reported by reviewdog 🐶 |
||
Column( | ||
modifier = | ||
Modifier | ||
.padding(top = 24.dp) | ||
.padding(horizontal = 16.dp), | ||
Modifier | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🚫 [ktlint] standard:indent reported by reviewdog 🐶 |
||
.padding(top = 24.dp) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🚫 [ktlint] standard:indent reported by reviewdog 🐶 |
||
.padding(horizontal = 16.dp), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🚫 [ktlint] standard:indent reported by reviewdog 🐶 |
||
) { | ||
Text( | ||
modifier = Modifier.padding(36.dp), | ||
text = "Log in", | ||
style = MaterialTheme.typography.headlineMedium, | ||
) | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🚫 [ktlint] standard:no-trailing-spaces reported by reviewdog 🐶 |
||
Text( | ||
modifier = Modifier.padding(16.dp), | ||
text = "Id", | ||
style = MaterialTheme.typography.labelLarge, | ||
) | ||
LoginTextField( | ||
modifier = | ||
Modifier | ||
.padding(8.dp) | ||
.fillMaxWidth(), | ||
Modifier | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🚫 [ktlint] standard:indent reported by reviewdog 🐶 |
||
.padding(8.dp) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🚫 [ktlint] standard:indent reported by reviewdog 🐶 |
||
.fillMaxWidth(), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🚫 [ktlint] standard:indent reported by reviewdog 🐶 |
||
value = id, | ||
onValueString = onIdChange, | ||
) | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🚫 [ktlint] standard:no-trailing-spaces reported by reviewdog 🐶 |
||
Text( | ||
modifier = Modifier.padding(16.dp), | ||
text = "password", | ||
style = MaterialTheme.typography.labelLarge, | ||
) | ||
LoginTextField( | ||
modifier = | ||
Modifier | ||
.padding(8.dp) | ||
.fillMaxWidth(), | ||
Modifier | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🚫 [ktlint] standard:indent reported by reviewdog 🐶 |
||
.padding(8.dp) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🚫 [ktlint] standard:indent reported by reviewdog 🐶 |
||
.fillMaxWidth(), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🚫 [ktlint] standard:indent reported by reviewdog 🐶 |
||
value = password, | ||
onValueString = passwordChange, | ||
) | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🚫 [ktlint] standard:no-trailing-spaces reported by reviewdog 🐶 |
||
SubmitButton( | ||
modifier = | ||
Modifier | ||
.padding(top = 24.dp) | ||
.fillMaxWidth(), | ||
Modifier | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🚫 [ktlint] standard:indent reported by reviewdog 🐶 |
||
.padding(top = 24.dp) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🚫 [ktlint] standard:indent reported by reviewdog 🐶 |
||
.fillMaxWidth(), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🚫 [ktlint] standard:indent reported by reviewdog 🐶 |
||
text = "로그인", | ||
onClick = {}, | ||
) | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🚫 [ktlint] standard:no-trailing-spaces reported by reviewdog 🐶 |
||
Spacer(modifier = Modifier.weight(1f)) | ||
Row(modifier = Modifier.align(Alignment.CenterHorizontally).padding(bottom = 24.dp).clickable(onClick = onNavigationToSignUpScreen)) { | ||
Row(modifier = Modifier | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🚫 [ktlint] standard:wrapping reported by reviewdog 🐶 |
||
.align(Alignment.CenterHorizontally) | ||
.padding(bottom = 24.dp) | ||
.clickable(onClick = onNavigationToSignUpScreen)) { | ||
Text(text = "Don't hava and account?") | ||
Text(text = "Sign up", color = MaterialTheme.colorScheme.primary) | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package com.example.presentation.login | ||
|
||
import androidx.lifecycle.ViewModel | ||
import androidx.lifecycle.viewModelScope | ||
import com.example.domain.usecase.login.LoginUseCase | ||
import dagger.hilt.android.lifecycle.HiltViewModel | ||
import javax.inject.Inject | ||
import kotlinx.coroutines.launch | ||
|
||
@HiltViewModel | ||
class LoginViewModel @Inject constructor( | ||
private val loginUseCase: LoginUseCase | ||
) : ViewModel() { | ||
|
||
fun onLoginClick() { | ||
val id = "" | ||
val pwd = "" | ||
viewModelScope.launch { | ||
loginUseCase(id, pwd) | ||
} | ||
} | ||
|
||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [ktlint] standard:paren-spacing reported by reviewdog 🐶
Unexpected spacing before "("