Skip to content

Commit

Permalink
Leave the method early if we're navigating to ROOT_ID anyway
Browse files Browse the repository at this point in the history
  • Loading branch information
LunarX committed Feb 22, 2024
1 parent fd04d03 commit ff30d4d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions app/src/main/java/com/infomaniak/drive/ui/MainViewModel.kt
Original file line number Diff line number Diff line change
Expand Up @@ -87,12 +87,12 @@ class MainViewModel(appContext: Application) : AndroidViewModel(appContext) {
// Clear FileListFragment stack
navController.popBackStack(R.id.rootFilesFragment, false)

if (fileId == Utils.ROOT_ID) return
if (fileId <= Utils.ROOT_ID) return // Deeplinks could lead us to navigating to the true root

// Emit destination folder id
viewModelScope.launch(Dispatchers.IO) {
val file = FileController.getFileById(fileId) ?: FileController.getFileDetails(fileId) ?: return@launch
if (fileId > Utils.ROOT_ID) navigateFileListTo.postValue(file)
navigateFileListTo.postValue(file)
}
}

Expand Down

0 comments on commit ff30d4d

Please sign in to comment.