MainViewModel

class MainViewModel @Inject constructor(apiService: CoreApiService, dataService: CoreDataService, dataServices: Set<@JvmSuppressWildcards IAppDatabase>, preferences: Set<@JvmSuppressWildcards IAppPreferences>) : ViewModel

Main ViewModel for app

Author

Vitaliy Zarubin

Constructors

MainViewModel
Link copied to clipboard
@Inject
fun MainViewModel(apiService: CoreApiService, dataService: CoreDataService, dataServices: Set<@JvmSuppressWildcards IAppDatabase>, preferences: Set<@JvmSuppressWildcards IAppPreferences>)

Functions

login
Link copied to clipboard
fun login(userId: String, token: String)

Update status user guest to member

logout
Link copied to clipboard
fun logout()

Logout user

updateSettings
Link copied to clipboard
fun updateSettings()

Update common for application settings

Properties

_hasNetwork
Link copied to clipboard
private val _hasNetwork: MutableStateFlow<Boolean>

MutableStateFlow for listen has network

_isReady
Link copied to clipboard
private val _isReady: MutableStateFlow<Boolean>

MutableStateFlow for start app and end splash

_loading
Link copied to clipboard
private val _loading: MutableStateFlow<Boolean>

MutableStateFlow for loading state

apiService
Link copied to clipboard
private val apiService: CoreApiService

service http query

dataService
Link copied to clipboard
private val dataService: CoreDataService

service db room

dataServices
Link copied to clipboard
private var dataServices: Set<@JvmSuppressWildcards IAppDatabase>

group services db room

hasNetwork
Link copied to clipboard
val hasNetwork: StateFlow<Boolean>

StateFlow for _hasNetwork

isLogin
Link copied to clipboard
val isLogin: Flow<Boolean>

Flow for listen change status user

isReady
Link copied to clipboard
val isReady: StateFlow<Boolean>

StateFlow for _isReady

loading
Link copied to clipboard
val loading: StateFlow<Boolean>

StateFlow for _loading

preferences
Link copied to clipboard
private var preferences: Set<@JvmSuppressWildcards IAppPreferences>

group services shared preference