-
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 branch 'develop' into feat/#12-빌드속도_빠르게
- Loading branch information
Showing
93 changed files
with
1,349 additions
and
257 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
[*.{kt,kts}] | ||
ij_kotlin_allow_trailing_comma = true | ||
ij_kotlin_allow_trailing_comma_on_call_site = true | ||
ktlint_function_naming_ignore_when_annotated_with = Composable, Test |
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 |
---|---|---|
@@ -1,8 +1,11 @@ | ||
## 관련 이슈번호 | ||
|
||
<br/> close # | ||
|
||
## 작업 사항 | ||
|
||
<br/> | ||
|
||
## 기타 사항 | ||
|
||
<br/> |
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
6 changes: 2 additions & 4 deletions
6
app/src/androidTest/java/com/withpeace/withpeace/ExampleInstrumentedTest.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
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
60 changes: 29 additions & 31 deletions
60
app/src/main/java/com/withpeace/withpeace/MainActivity.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 |
---|---|---|
@@ -1,48 +1,46 @@ | ||
package com.withpeace.withpeace | ||
|
||
import android.os.Bundle | ||
import android.util.Log | ||
import androidx.activity.ComponentActivity | ||
import androidx.activity.compose.setContent | ||
import androidx.compose.foundation.layout.fillMaxSize | ||
import androidx.compose.material3.MaterialTheme | ||
import androidx.compose.material3.Surface | ||
import androidx.compose.material3.Text | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.tooling.preview.Preview | ||
import com.withpeace.withpeace.ui.theme.WithpeaceTheme | ||
import androidx.activity.viewModels | ||
import androidx.core.splashscreen.SplashScreen.Companion.installSplashScreen | ||
import androidx.lifecycle.Lifecycle | ||
import androidx.lifecycle.lifecycleScope | ||
import androidx.lifecycle.repeatOnLifecycle | ||
import com.withpeace.withpeace.core.designsystem.theme.WithpeaceTheme | ||
import com.withpeace.withpeace.feature.login.navigation.LOGIN_ROUTE | ||
import dagger.hilt.android.AndroidEntryPoint | ||
import kotlinx.coroutines.delay | ||
import kotlinx.coroutines.launch | ||
|
||
@AndroidEntryPoint | ||
class MainActivity : ComponentActivity() { | ||
private val viewModel by viewModels<MainViewModel>() | ||
override fun onCreate(savedInstanceState: Bundle?) { | ||
super.onCreate(savedInstanceState) | ||
val splashScreen = installSplashScreen() | ||
splashScreen.setKeepOnScreenCondition { true } | ||
lifecycleScope.launch { | ||
repeatOnLifecycle(Lifecycle.State.STARTED){ | ||
viewModel.isLogin.collect { isLogin -> | ||
if(isLogin) { | ||
Log.d("covy","Main 화면으로 이동") | ||
} else { | ||
composeStart(LOGIN_ROUTE) | ||
} | ||
delay(2000L) | ||
splashScreen.setKeepOnScreenCondition { false } | ||
} | ||
} | ||
} | ||
} | ||
private fun ComponentActivity.composeStart(startDestination: String) { | ||
setContent { | ||
WithpeaceTheme { | ||
// A surface container using the 'background' color from the theme | ||
Surface( | ||
modifier = Modifier.fillMaxSize(), | ||
color = MaterialTheme.colorScheme.background | ||
) { | ||
Greeting("Android") | ||
} | ||
WithpeaceApp(startDestination = startDestination) | ||
} | ||
} | ||
} | ||
} | ||
|
||
@Composable | ||
fun Greeting(name: String, modifier: Modifier = Modifier) { | ||
Text( | ||
text = "Hello $name!", | ||
modifier = modifier | ||
) | ||
} | ||
|
||
@Preview(showBackground = true) | ||
@Composable | ||
fun GreetingPreview() { | ||
WithpeaceTheme { | ||
Greeting("Android") | ||
} | ||
} |
31 changes: 31 additions & 0 deletions
31
app/src/main/java/com/withpeace/withpeace/MainViewModel.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,31 @@ | ||
package com.withpeace.withpeace | ||
|
||
import androidx.lifecycle.ViewModel | ||
import androidx.lifecycle.viewModelScope | ||
import com.withpeace.withpeace.core.domain.repository.TokenRepository | ||
import dagger.hilt.android.lifecycle.HiltViewModel | ||
import kotlinx.coroutines.flow.MutableSharedFlow | ||
import kotlinx.coroutines.flow.SharedFlow | ||
import kotlinx.coroutines.flow.asSharedFlow | ||
import kotlinx.coroutines.flow.firstOrNull | ||
import kotlinx.coroutines.launch | ||
import javax.inject.Inject | ||
|
||
@HiltViewModel | ||
class MainViewModel @Inject constructor( | ||
private val tokenRepository: TokenRepository | ||
) : ViewModel() { | ||
private val _isLogin: MutableSharedFlow<Boolean> = MutableSharedFlow() | ||
val isLogin = _isLogin.asSharedFlow() | ||
|
||
init { | ||
viewModelScope.launch { | ||
val token = tokenRepository.getAccessToken().firstOrNull() | ||
if(token==null) { | ||
_isLogin.emit(false) | ||
} else { | ||
_isLogin.emit(true) | ||
} | ||
} | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package com.withpeace.withpeace | ||
|
||
import androidx.compose.foundation.layout.fillMaxSize | ||
import androidx.compose.material3.Scaffold | ||
import androidx.compose.material3.SnackbarHost | ||
import androidx.compose.material3.SnackbarHostState | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.runtime.remember | ||
import androidx.compose.runtime.rememberCoroutineScope | ||
import androidx.compose.ui.Modifier | ||
import com.withpeace.withpeace.navigation.WithpeaceNavHost | ||
import kotlinx.coroutines.launch | ||
|
||
|
||
@Composable | ||
fun WithpeaceApp( | ||
startDestination: String | ||
) { | ||
val snackBarHostState = remember { SnackbarHostState() } | ||
val coroutineScope = rememberCoroutineScope() | ||
fun showSnackBar(message: String) = coroutineScope.launch { | ||
snackBarHostState.showSnackbar(message) | ||
} | ||
|
||
Scaffold( | ||
modifier = Modifier.fillMaxSize(), | ||
snackbarHost = { SnackbarHost(snackBarHostState) }, | ||
) { | ||
WithpeaceNavHost( | ||
onShowSnackBar = ::showSnackBar, | ||
) | ||
it | ||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
app/src/main/java/com/withpeace/withpeace/navigation/NavHost.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,26 @@ | ||
package com.withpeace.withpeace.navigation | ||
|
||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.Modifier | ||
import androidx.navigation.NavHostController | ||
import androidx.navigation.compose.NavHost | ||
import androidx.navigation.compose.rememberNavController | ||
import com.withpeace.withpeace.feature.login.navigation.LOGIN_ROUTE | ||
import com.withpeace.withpeace.feature.login.navigation.loginNavGraph | ||
|
||
|
||
@Composable | ||
fun WithpeaceNavHost( | ||
modifier: Modifier = Modifier, | ||
navController: NavHostController = rememberNavController(), | ||
startDestination: String = LOGIN_ROUTE, | ||
onShowSnackBar: (message: String) -> Unit, | ||
) { | ||
NavHost( | ||
modifier = modifier, | ||
navController = navController, | ||
startDestination = startDestination, | ||
) { | ||
loginNavGraph(onShowSnackBar = onShowSnackBar) | ||
} | ||
} |
11 changes: 0 additions & 11 deletions
11
app/src/main/java/com/withpeace/withpeace/ui/theme/Color.kt
This file was deleted.
Oops, something went wrong.
70 changes: 0 additions & 70 deletions
70
app/src/main/java/com/withpeace/withpeace/ui/theme/Theme.kt
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.