44 * @author Abel García de Prada
55 * @author Juan Carlos Garrote Gascón
66 * @author Aitor Ballesteros Pavón
7+ * @author Jorge Aguado Recio
78 *
8- * Copyright (C) 2024 ownCloud GmbH.
9+ * Copyright (C) 2025 ownCloud GmbH.
910 *
1011 * This program is free software: you can redistribute it and/or modify
1112 * it under the terms of the GNU General Public License version 2,
@@ -107,6 +108,8 @@ class FileDetailsFragment : FileFragment() {
107108
108109 private var openInWebProviders: Map <String , Int > = hashMapOf()
109110
111+ private var isMultiPersonal = false
112+
110113 override fun onCreateView (
111114 inflater : LayoutInflater , container : ViewGroup ? ,
112115 savedInstanceState : Bundle ?
@@ -121,15 +124,9 @@ class FileDetailsFragment : FileFragment() {
121124
122125 override fun onViewCreated (view : View , savedInstanceState : Bundle ? ) {
123126 super .onViewCreated(view, savedInstanceState)
127+ isMultiPersonal = requireArguments().getBoolean(ARG_IS_MULTIPERSONAL )
124128
125- collectLatestLifecycleFlow(fileDetailsViewModel.currentFile) { ocFileWithSyncInfo: OCFileWithSyncInfo ? ->
126- if (ocFileWithSyncInfo != null ) {
127- file = ocFileWithSyncInfo.file
128- updateDetails(ocFileWithSyncInfo)
129- } else {
130- requireActivity().onBackPressed()
131- }
132- }
129+ observeCurrentFile()
133130
134131 collectLatestLifecycleFlow(fileDetailsViewModel.appRegistryMimeType) { appRegistryMimeType ->
135132 if (appRegistryMimeType != null ) {
@@ -382,7 +379,7 @@ class FileDetailsFragment : FileFragment() {
382379 binding.fdSpace.visibility = View .VISIBLE
383380 binding.fdSpaceLabel.visibility = View .VISIBLE
384381 binding.fdIconSpace.visibility = View .VISIBLE
385- if (space.isPersonal) {
382+ if (space.isPersonal && ! isMultiPersonal ) {
386383 binding.fdSpace.text = getString(R .string.bottom_nav_personal)
387384 } else {
388385 binding.fdSpace.text = space.name
@@ -598,6 +595,17 @@ class FileDetailsFragment : FileFragment() {
598595 fileOperationsViewModel.setLastUsageFile(fileWaitingToPreview)
599596 }
600597
598+ private fun observeCurrentFile () {
599+ collectLatestLifecycleFlow(fileDetailsViewModel.currentFile) { ocFileWithSyncInfo: OCFileWithSyncInfo ? ->
600+ if (ocFileWithSyncInfo != null ) {
601+ file = ocFileWithSyncInfo.file
602+ updateDetails(ocFileWithSyncInfo)
603+ } else {
604+ requireActivity().onBackPressed()
605+ }
606+ }
607+ }
608+
601609 override fun updateViewForSyncInProgress () {
602610 // Not yet implemented
603611 }
@@ -622,6 +630,7 @@ class FileDetailsFragment : FileFragment() {
622630 private const val ARG_FILE = " FILE"
623631 private const val ARG_ACCOUNT = " ACCOUNT"
624632 private const val ARG_SYNC_FILE_AT_OPEN = " SYNC_FILE_AT_OPEN"
633+ private const val ARG_IS_MULTIPERSONAL = " IS_MULTIPERSONAL"
625634 private const val ZERO_MILLISECOND_TIME = 0
626635
627636 /* *
@@ -632,12 +641,13 @@ class FileDetailsFragment : FileFragment() {
632641 * @param account An ownCloud account; needed to start downloads
633642 * @return New fragment with arguments set
634643 */
635- fun newInstance (fileToDetail : OCFile , account : Account , syncFileAtOpen : Boolean = true): FileDetailsFragment =
644+ fun newInstance (fileToDetail : OCFile , account : Account , syncFileAtOpen : Boolean = true, isMultiPersonal : Boolean ): FileDetailsFragment =
636645 FileDetailsFragment ().apply {
637646 arguments = Bundle ().apply {
638647 putParcelable(ARG_FILE , fileToDetail)
639648 putParcelable(ARG_ACCOUNT , account)
640649 putBoolean(ARG_SYNC_FILE_AT_OPEN , syncFileAtOpen)
650+ putBoolean(ARG_IS_MULTIPERSONAL , isMultiPersonal)
641651 }
642652 }
643653 }
0 commit comments