add setup wizard, remove stoage api permission since root is used for that
This commit is contained in:
@@ -45,11 +45,9 @@ class MainViewModel(application: Application) : AndroidViewModel(application) {
|
||||
private val DEFAULT_ISO_DIRECTORY = "${Environment.getExternalStorageDirectory().absolutePath}/isodrive"
|
||||
}
|
||||
|
||||
init {
|
||||
viewModelScope.launch {
|
||||
initialize()
|
||||
}
|
||||
private var initialized = false
|
||||
|
||||
init {
|
||||
// Observe mount events from notification actions
|
||||
viewModelScope.launch {
|
||||
MountEventBus.events.collect { event ->
|
||||
@@ -66,7 +64,15 @@ class MainViewModel(application: Application) : AndroidViewModel(application) {
|
||||
}
|
||||
}
|
||||
|
||||
private suspend fun initialize() {
|
||||
fun initialize() {
|
||||
if (initialized) return
|
||||
initialized = true
|
||||
viewModelScope.launch {
|
||||
doInitialize()
|
||||
}
|
||||
}
|
||||
|
||||
private suspend fun doInitialize() {
|
||||
_uiState.update { it.copy(isLoading = true) }
|
||||
|
||||
// Load saved ISO directory
|
||||
@@ -77,8 +83,8 @@ class MainViewModel(application: Application) : AndroidViewModel(application) {
|
||||
_uiState.update { it.copy(isoDirectory = savedDirectory, currentPath = savedDirectory) }
|
||||
navigationStack.add(savedDirectory)
|
||||
|
||||
// Check root access
|
||||
val hasRoot = RootManager.requestRoot()
|
||||
// Check root access (don't request, just check - wizard handles requesting)
|
||||
val hasRoot = RootManager.hasRoot()
|
||||
_uiState.update { it.copy(hasRoot = hasRoot) }
|
||||
|
||||
if (hasRoot) {
|
||||
|
||||
Reference in New Issue
Block a user