File tree Expand file tree Collapse file tree
data/src/main/kotlin/com/theapache64/stackzy/data/remote
src/main/kotlin/com/theapache64/stackzy/ui/feature/splash Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -17,4 +17,8 @@ data class Config(
1717 val isPlayStoreEnabled : Boolean ,
1818 @Json(name = " is_libs_tracking_enabled" )
1919 val isLibsTrackingEnabled : Boolean ,
20+ @Json(name = " is_down" )
21+ val isDown : Boolean ,
22+ @Json(name = " down_reason" )
23+ val downReason : String ,
2024)
Original file line number Diff line number Diff line change 11package com.theapache64.stackzy.ui.feature.splash
22
3+ import androidx.compose.desktop.ui.tooling.preview.Preview
34import androidx.compose.foundation.ExperimentalFoundationApi
45import androidx.compose.foundation.layout.Box
56import androidx.compose.foundation.layout.fillMaxSize
@@ -16,6 +17,7 @@ import com.theapache64.stackzy.ui.common.ErrorSnackBar
1617import com.theapache64.stackzy.ui.common.LoadingText
1718import com.theapache64.stackzy.ui.common.Logo
1819
20+
1921/* *
2022 * Renders SplashScreen
2123 */
Original file line number Diff line number Diff line change @@ -13,8 +13,8 @@ import kotlinx.coroutines.CoroutineScope
1313import kotlinx.coroutines.flow.MutableStateFlow
1414import kotlinx.coroutines.flow.SharedFlow
1515import kotlinx.coroutines.flow.StateFlow
16- import kotlinx.coroutines.launch
1716import kotlinx.coroutines.flow.collect
17+ import kotlinx.coroutines.launch
1818import java.io.IOException
1919import javax.inject.Inject
2020
@@ -156,13 +156,20 @@ class SplashViewModel @Inject constructor(
156156 val shouldUpdate: SharedFlow <Boolean > = _shouldUpdate
157157
158158 private fun verifyConfig (config : Config ): Boolean {
159+ // Checking if app is down or not
160+ if (config.isDown) {
161+ _syncFailedMsg .tryEmit(config.downReason)
162+ return false
163+ }
164+
165+ // Checking if update needed
159166 val isUpdateNeeded = App .appArgs.versionCode < config.mandatoryVersionCode // currentVersion < mandatoryVersion
160- return if (isUpdateNeeded) {
167+ if (isUpdateNeeded) {
161168 _shouldUpdate .tryEmit(true )
162- false
163- } else {
164- true
169+ return false
165170 }
171+
172+ return true
166173 }
167174
168175 private suspend fun checkAndFixAdb (
You can’t perform that action at this time.
0 commit comments