diff --git a/owncloudApp/src/main/java/com/owncloud/android/presentation/previews/PreviewTextViewModel.kt b/owncloudApp/src/main/java/com/owncloud/android/presentation/previews/PreviewTextViewModel.kt index 0fbeb730114..57af51248c4 100644 --- a/owncloudApp/src/main/java/com/owncloud/android/presentation/previews/PreviewTextViewModel.kt +++ b/owncloudApp/src/main/java/com/owncloud/android/presentation/previews/PreviewTextViewModel.kt @@ -41,13 +41,13 @@ class PreviewTextViewModel( private val contextProvider: ContextProvider, private val coroutinesDispatcherProvider: CoroutinesDispatcherProvider, getFileByIdAsStreamUseCase: GetFileByIdAsStreamUseCase, - idFile: Long + ocFile: OCFile ) : ViewModel() { private val _menuOptions: MutableStateFlow> = MutableStateFlow(emptyList()) val menuOptions: StateFlow> = _menuOptions - private val currentFile: Flow = getFileByIdAsStreamUseCase(GetFileByIdAsStreamUseCase.Params(idFile)) + private val currentFile: Flow = getFileByIdAsStreamUseCase(GetFileByIdAsStreamUseCase.Params(ocFile.id!!)) fun getCurrentFile(): Flow = currentFile diff --git a/owncloudApp/src/main/java/com/owncloud/android/ui/preview/PreviewTextFragment.kt b/owncloudApp/src/main/java/com/owncloud/android/ui/preview/PreviewTextFragment.kt index 7be4610d580..865e50af86a 100644 --- a/owncloudApp/src/main/java/com/owncloud/android/ui/preview/PreviewTextFragment.kt +++ b/owncloudApp/src/main/java/com/owncloud/android/ui/preview/PreviewTextFragment.kt @@ -69,7 +69,7 @@ class PreviewTextFragment : FileFragment() { private lateinit var textLoadTask: TextLoadAsyncTask private val previewTextViewModel by viewModel { - parametersOf(file.id) + parametersOf(requireArguments().getParcelable(EXTRA_FILE)) } private val fileOperationsViewModel by viewModel()