Skip to content

Commit c919e85

Browse files
committed
splashview model fixes
1 parent 38cc361 commit c919e85

File tree

1 file changed

+5
-19
lines changed

1 file changed

+5
-19
lines changed
Lines changed: 5 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,11 @@
11
package com.songlib.presentation.splash
22

33
import android.content.Context
4-
import androidx.lifecycle.ViewModel
5-
import androidx.lifecycle.viewModelScope
4+
import androidx.lifecycle.*
65
import com.songlib.core.helpers.NetworkUtils
7-
import com.songlib.domain.repository.PrefsRepo
8-
import com.songlib.domain.repository.SubsRepo
9-
import com.songlib.presentation.navigation.Routes
6+
import com.songlib.domain.repository.*
107
import dagger.hilt.android.lifecycle.HiltViewModel
11-
import kotlinx.coroutines.flow.MutableStateFlow
12-
import kotlinx.coroutines.flow.StateFlow
13-
import kotlinx.coroutines.flow.asStateFlow
8+
import kotlinx.coroutines.flow.*
149
import kotlinx.coroutines.launch
1510
import javax.inject.Inject
1611

@@ -30,9 +25,9 @@ class SplashViewModel @Inject constructor(
3025
} else {
3126
checkSubscriptionAndTime(false)
3227
}
33-
determineNextRoute()
28+
_isLoading.value = false
3429
} catch (e: Exception) {
35-
determineNextRoute()
30+
_isLoading.value = false
3631
} finally {
3732
_isLoading.value = false
3833
}
@@ -47,13 +42,4 @@ class SplashViewModel @Inject constructor(
4742
}
4843
prefsRepo.updateAppOpenTime()
4944
}
50-
51-
private fun determineNextRoute() {
52-
_nextRoute.value = when {
53-
prefsRepo.selectAfresh -> Routes.STEP_1
54-
prefsRepo.isDataSelected && prefsRepo.isDataLoaded -> Routes.HOME
55-
prefsRepo.isDataSelected && !prefsRepo.isDataLoaded -> Routes.STEP_2
56-
else -> Routes.HOME
57-
}
58-
}
5945
}

0 commit comments

Comments
 (0)