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

Feat:[snsproject] navigation-compose, hilt-navigation-compose 의존성 추가 … #24

Merged
merged 2 commits into from
Apr 18, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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 @@ -75,6 +75,8 @@ dependencies {
implementation(libs.converter.gson)
implementation(libs.hilt.android)
ksp(libs.hilt.android.compiler)
implementation(libs.androidx.hilt.navigation.compose)
implementation (libs.androidx.navigation.compose)

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 "("

implementation(libs.orbit.viewmodel)
implementation(libs.coil.compose)
implementation(libs.androidx.paging.compose)
Expand Down
4 changes: 4 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,13 @@ converter-gson = "2.9.0"
core-ktx = "1.12.0"
espresso-core = "3.5.1"
hilt-android = "2.48"
hilt-navigation-compose = "1.2.0"
junit = "4.13.2"
kotlinx-coroutines-core = "1.8.0"
lifecycle-runtime-ktx = "2.7.0"
material = "1.11.0"

navigation-compose = "2.7.7"
orbit-viewmodel = "7.0.1"
paging-compose = "3.3.0-beta01"
paging-runtime = "3.2.1"
Expand All @@ -34,8 +36,10 @@ androidx-appcompat = { module = "androidx.appcompat:appcompat", version.ref = "a
androidx-constraintlayout = { module = "androidx.constraintlayout:constraintlayout", version.ref = "constraintlayout" }
androidx-core-ktx = { module = "androidx.core:core-ktx", version.ref = "core-ktx" }
androidx-espresso-core = { module = "androidx.test.espresso:espresso-core", version.ref = "espresso-core" }
androidx-hilt-navigation-compose = { module = "androidx.hilt:hilt-navigation-compose", version.ref = "hilt-navigation-compose" }
androidx-junit = { module = "androidx.test.ext:junit", version.ref = "androidx-junit" }
androidx-lifecycle-runtime-ktx = { module = "androidx.lifecycle:lifecycle-runtime-ktx", version.ref = "lifecycle-runtime-ktx" }
androidx-navigation-compose = { module = "androidx.navigation:navigation-compose", version.ref = "navigation-compose" }
androidx-paging-common = { module = "androidx.paging:paging-common", version.ref = "paging-runtime" }
androidx-paging-compose = { module = "androidx.paging:paging-compose", version.ref = "paging-compose" }
androidx-paging-runtime = { module = "androidx.paging:paging-runtime", version.ref = "paging-runtime" }
Expand Down
2 changes: 2 additions & 0 deletions presentation/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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)

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 "("

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)
}
}

Choose a reason for hiding this comment

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

🚫 [ktlint] standard:no-trailing-spaces reported by reviewdog 🐶
Trailing space(s)

composable(route = LoginRoute.LoginScreen.route) {
LoginScreen()
}

Choose a reason for hiding this comment

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

🚫 [ktlint] standard:no-trailing-spaces reported by reviewdog 🐶
Trailing space(s)

composable(route = LoginRoute.SignUpScreen.route) {
SignUpScreen(id = "", username = "", password1 = "", password2 = "", {}, {}, {}, {}, {})
}

Choose a reason for hiding this comment

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

🚫 [ktlint] standard:no-trailing-spaces reported by reviewdog 🐶
Trailing space(s)

Choose a reason for hiding this comment

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

🚫 [ktlint] standard:no-blank-line-before-rbrace reported by reviewdog 🐶
Unexpected blank line(s) before "}"

}
}
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")

Choose a reason for hiding this comment

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

🚫 [ktlint] standard:blank-line-before-declaration reported by reviewdog 🐶
Expected a blank line for this declaration

data object SignUpScreen : LoginRoute("SignUpScreen")

Choose a reason for hiding this comment

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

🚫 [ktlint] standard:blank-line-before-declaration reported by reviewdog 🐶
Expected a blank line for this declaration

}
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Choose a reason for hiding this comment

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

🚫 [ktlint] standard:function-signature reported by reviewdog 🐶
No whitespace expected between opening parenthesis and first parameter name

Choose a reason for hiding this comment

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

🚫 [ktlint] standard:function-signature reported by reviewdog 🐶
No whitespace expected between last parameter and closing parenthesis

Choose a reason for hiding this comment

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

🚫 [ktlint] standard:trailing-comma-on-declaration-site reported by reviewdog 🐶
Missing trailing comma before ")"

) {
LoginScreen(
id = "",
password = "",
onIdChange = {},
passwordChange = {},
onNavigationToSignUpScreen = { viewmodel.onLoginClick() }

Choose a reason for hiding this comment

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

🚫 [ktlint] standard:trailing-comma-on-call-site reported by reviewdog 🐶
Missing trailing comma before ")"

)
}

@Composable
fun LoginScreen(
id: String,
Expand All @@ -38,58 +52,61 @@ fun LoginScreen(
Text(text = "Connected", style = MaterialTheme.typography.displaySmall)
Text(text = "Your favorite social network", style = MaterialTheme.typography.labelSmall)
}

Choose a reason for hiding this comment

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

🚫 [ktlint] standard:no-trailing-spaces reported by reviewdog 🐶
Trailing space(s)

Column(
modifier =
Modifier
.padding(top = 24.dp)
.padding(horizontal = 16.dp),
Modifier

Choose a reason for hiding this comment

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

🚫 [ktlint] standard:indent reported by reviewdog 🐶
Unexpected indentation (16) (should be 20)

.padding(top = 24.dp)

Choose a reason for hiding this comment

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

🚫 [ktlint] standard:indent reported by reviewdog 🐶
Unexpected indentation (20) (should be 24)

.padding(horizontal = 16.dp),

Choose a reason for hiding this comment

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

🚫 [ktlint] standard:indent reported by reviewdog 🐶
Unexpected indentation (20) (should be 24)

) {
Text(
modifier = Modifier.padding(36.dp),
text = "Log in",
style = MaterialTheme.typography.headlineMedium,
)

Choose a reason for hiding this comment

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

🚫 [ktlint] standard:no-trailing-spaces reported by reviewdog 🐶
Trailing space(s)

Text(
modifier = Modifier.padding(16.dp),
text = "Id",
style = MaterialTheme.typography.labelLarge,
)
LoginTextField(
modifier =
Modifier
.padding(8.dp)
.fillMaxWidth(),
Modifier

Choose a reason for hiding this comment

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

🚫 [ktlint] standard:indent reported by reviewdog 🐶
Unexpected indentation (20) (should be 24)

.padding(8.dp)

Choose a reason for hiding this comment

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

🚫 [ktlint] standard:indent reported by reviewdog 🐶
Unexpected indentation (24) (should be 28)

.fillMaxWidth(),

Choose a reason for hiding this comment

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

🚫 [ktlint] standard:indent reported by reviewdog 🐶
Unexpected indentation (24) (should be 28)

value = id,
onValueString = onIdChange,
)

Choose a reason for hiding this comment

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

🚫 [ktlint] standard:no-trailing-spaces reported by reviewdog 🐶
Trailing space(s)

Text(
modifier = Modifier.padding(16.dp),
text = "password",
style = MaterialTheme.typography.labelLarge,
)
LoginTextField(
modifier =
Modifier
.padding(8.dp)
.fillMaxWidth(),
Modifier

Choose a reason for hiding this comment

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

🚫 [ktlint] standard:indent reported by reviewdog 🐶
Unexpected indentation (20) (should be 24)

.padding(8.dp)

Choose a reason for hiding this comment

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

🚫 [ktlint] standard:indent reported by reviewdog 🐶
Unexpected indentation (24) (should be 28)

.fillMaxWidth(),

Choose a reason for hiding this comment

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

🚫 [ktlint] standard:indent reported by reviewdog 🐶
Unexpected indentation (24) (should be 28)

value = password,
onValueString = passwordChange,
)

Choose a reason for hiding this comment

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

🚫 [ktlint] standard:no-trailing-spaces reported by reviewdog 🐶
Trailing space(s)

SubmitButton(
modifier =
Modifier
.padding(top = 24.dp)
.fillMaxWidth(),
Modifier

Choose a reason for hiding this comment

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

🚫 [ktlint] standard:indent reported by reviewdog 🐶
Unexpected indentation (20) (should be 24)

.padding(top = 24.dp)

Choose a reason for hiding this comment

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

🚫 [ktlint] standard:indent reported by reviewdog 🐶
Unexpected indentation (24) (should be 28)

.fillMaxWidth(),

Choose a reason for hiding this comment

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

🚫 [ktlint] standard:indent reported by reviewdog 🐶
Unexpected indentation (24) (should be 28)

text = "로그인",
onClick = {},
)

Choose a reason for hiding this comment

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

🚫 [ktlint] standard:no-trailing-spaces reported by reviewdog 🐶
Trailing space(s)

Spacer(modifier = Modifier.weight(1f))
Row(modifier = Modifier.align(Alignment.CenterHorizontally).padding(bottom = 24.dp).clickable(onClick = onNavigationToSignUpScreen)) {
Row(modifier = Modifier

Choose a reason for hiding this comment

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

🚫 [ktlint] standard:wrapping reported by reviewdog 🐶
Missing newline after "("

.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)
}
Expand Down
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)
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ import com.example.presentation.component.SubmitButton
import com.example.presentation.ui.theme.SnsProjectTheme

@Composable
fun WelcomeScreen() {
fun WelcomeScreen(
onNavigationToLoginScreen: () -> Unit
) {
Surface {
Box(
modifier = Modifier.fillMaxSize(),
Expand All @@ -39,7 +41,7 @@ fun WelcomeScreen() {
.padding(bottom = 24.dp)
.align(Alignment.BottomCenter),
text = "로그인",
onClick = {},
onClick = onNavigationToLoginScreen,
)
}
}
Expand All @@ -49,6 +51,6 @@ fun WelcomeScreen() {
@Composable
private fun WelcomeScreenPreview() {
SnsProjectTheme {
WelcomeScreen()
WelcomeScreen({})
}
}
Loading