Skip to content

Commit

Permalink
Merge pull request #154 from WithPeace/feat/#153-102-개선-진행
Browse files Browse the repository at this point in the history
Feat/#153 102 개선 진행
  • Loading branch information
rhkrwngud445 authored Jun 30, 2024
2 parents 63cab54 + 25c8474 commit ec9c724
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 21 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ android {
defaultConfig {
applicationId = "com.withpeace.withpeace"
targetSdk = 34
versionCode = 6
versionName = "1.0.1"
versionCode = 7
versionName = "1.0.2"

testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables {
Expand Down
5 changes: 1 addition & 4 deletions app/src/main/java/com/withpeace/withpeace/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ class MainActivity : ComponentActivity() {
super.onCreate(savedInstanceState)
// System Bar에 가려지는 뷰 영역을 개발자가 제어하겠다.
WindowCompat.setDecorFitsSystemWindows(window, false)

lifecycleScope.launch {
splashScreen = installSplashScreen()
splashScreen.setKeepOnScreenCondition { true }
Expand All @@ -63,9 +62,7 @@ class MainActivity : ComponentActivity() {
when (uiState) {
MainUiState.Home -> composeStart(HOME_ROUTE)
MainUiState.Login -> composeStart(LOGIN_ROUTE)
MainUiState.Update -> {
compulsionUpdate()
}
MainUiState.Update -> {}

MainUiState.Error -> finish()
MainUiState.Loading -> {}
Expand Down
16 changes: 10 additions & 6 deletions app/src/main/java/com/withpeace/withpeace/MainViewModel.kt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@ import com.withpeace.withpeace.core.domain.usecase.CheckAppUpdateUseCase
import com.withpeace.withpeace.core.domain.usecase.IsLoginUseCase
import dagger.hilt.android.lifecycle.HiltViewModel
import kotlinx.coroutines.channels.Channel
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.StateFlow
import kotlinx.coroutines.flow.asStateFlow
import kotlinx.coroutines.flow.receiveAsFlow
import kotlinx.coroutines.flow.update
import kotlinx.coroutines.launch
import javax.inject.Inject

Expand All @@ -15,8 +19,8 @@ class MainViewModel @Inject constructor(
private val isLoginUseCase: IsLoginUseCase,
private val checkAppUpdateUseCase: CheckAppUpdateUseCase,
) : ViewModel() {
private val _uiState: Channel<MainUiState> = Channel()
val uiState = _uiState.receiveAsFlow()
private val _uiState: MutableStateFlow<MainUiState> = MutableStateFlow(MainUiState.Loading)
val uiState = _uiState.asStateFlow()

init {
checkUpdate()
Expand All @@ -27,18 +31,18 @@ class MainViewModel @Inject constructor(
checkAppUpdateUseCase(
currentVersion = BuildConfig.VERSION_CODE,
onError = {
_uiState.send(MainUiState.Error)
_uiState.update { MainUiState.Error }
},
).collect { shouldUpdate ->
if (shouldUpdate) {
_uiState.send(MainUiState.Update)
_uiState.update {MainUiState.Update }
return@collect
}
val isLogin = isLoginUseCase()
if (isLogin) {
_uiState.send(MainUiState.Home)
_uiState.update { MainUiState.Home }
} else {
_uiState.send(MainUiState.Login)
_uiState.update { MainUiState.Login }
}
}
}
Expand Down
16 changes: 7 additions & 9 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
[versions]
androidGradlePlugin = "8.2.2"
androidDesugarJdkLibs = "1.2.2"
androidxCore = "1.12.0"
androidxAppCompat = "1.6.1"
androidxLifecycle = "2.7.0"
androidxComposeBom = "2023.10.01"
androidxComposeBom = "2024.06.00"
androidxComposeCompiler = "1.5.1"
androidxComposeNavigation = "2.7.6"
androidxComposeNavigation = "2.7.7"
composeIconExtended = "1.5.4"
androidxActivity = "1.8.2"
coreSplashscreen = "1.0.1"
hilt = "2.48"
hiltNavigationCompose = "1.1.0"
hilt = "2.51.1"
hiltNavigationCompose = "1.2.0"
androidxConstraintlayout = "1.0.1"

lifecycleRuntimeKtx = "2.7.0"
Expand Down Expand Up @@ -54,15 +53,15 @@ androidxGlance = "1.0.0-beta01"
glanceExperimentalTools = "0.2.2"
junit = "1.1.5"
material = "1.12.0"
material3Android = "1.3.0-beta03"
material3 = "1.3.0-beta03"
material3Android = "1.3.0-beta04"
material3 = "1.3.0-beta04"
multidex = "2.0.1"

google-login = "1.1.0"

credential = "1.2.0"

paging = "3.3.0-alpha02"
paging = "3.3.0"
coreTesting = "2.2.0"

dependencyGraph = "0.8.0"
Expand All @@ -77,7 +76,6 @@ benchmarkMacroJunit4 = "1.2.0-beta01"

[libraries]
android-gradlePlugin = { group = "com.android.tools.build", name = "gradle", version.ref = "androidGradlePlugin" }
android-desugarJdkLibs = { group = "com.android.tools", name = "desugar_jdk_libs", version.ref = "androidDesugarJdkLibs" }
kotlin-gradlePlugin = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin", version.ref = "kotlin" }
hilt-gradlePlugin = { module = "com.google.dagger:hilt-android-gradle-plugin", version.ref = "hilt" }

Expand Down

0 comments on commit ec9c724

Please sign in to comment.