Fix flickering status card on app startup
This commit is contained in:
@@ -178,6 +178,8 @@ class MainViewModel(application: Application) : AndroidViewModel(application) {
|
||||
loadFiles()
|
||||
checkMountStatus()
|
||||
}
|
||||
} else {
|
||||
_uiState.update { it.copy(isSupported = false) }
|
||||
}
|
||||
|
||||
_uiState.update { it.copy(isLoading = false) }
|
||||
@@ -380,7 +382,7 @@ class MainViewModel(application: Application) : AndroidViewModel(application) {
|
||||
viewModelScope.launch {
|
||||
// Check cached status (no popup)
|
||||
val cachedStatus = RootManager.isRootGrantedCached()
|
||||
if (cachedStatus == true && !_uiState.value.hasRoot) {
|
||||
if (cachedStatus == true && _uiState.value.hasRoot != true) {
|
||||
// Root was granted externally (e.g., in Magisk settings)
|
||||
_uiState.update { it.copy(hasRoot = true, rootDenied = false) }
|
||||
|
||||
@@ -546,9 +548,9 @@ class MainViewModel(application: Application) : AndroidViewModel(application) {
|
||||
|
||||
data class MainUiState(
|
||||
val isLoading: Boolean = true,
|
||||
val hasRoot: Boolean = false,
|
||||
val hasRoot: Boolean? = null, // null = checking, true = granted, false = denied
|
||||
val rootDenied: Boolean = false, // True if user denied root in Magisk
|
||||
val isSupported: Boolean = false,
|
||||
val isSupported: Boolean? = null, // null = checking, true = supported, false = not supported
|
||||
val mountStatus: MountStatus = MountStatus.UNMOUNTED,
|
||||
val isoFiles: List<IsoFile> = emptyList(),
|
||||
val currentPath: String = "",
|
||||
|
||||
Reference in New Issue
Block a user