Skip to content

Commit

Permalink
feat: show correct toolbar and apply correct navigation in personal s…
Browse files Browse the repository at this point in the history
…paces of multi-personal accounts
  • Loading branch information
JuancaG05 committed Jan 7, 2025
1 parent f9f1804 commit 7a48335
Showing 1 changed file with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,7 @@ class FileDisplayActivity : FileActivity(),
private lateinit var binding: ActivityMainBinding

private var isLightUser = false
private var isMultiPersonal = false

override fun onCreate(savedInstanceState: Bundle?) {
Timber.v("onCreate() start")
Expand Down Expand Up @@ -324,6 +325,7 @@ class FileDisplayActivity : FileActivity(),
onCapabilitiesOperationFinish(it)
})
isLightUser = manageAccountsViewModel.checkUserLight(account.name)
isMultiPersonal = capabilitiesViewModel.checkMultiPersonal()
navigateTo(fileListOption, initialState = true)

}
Expand Down Expand Up @@ -762,8 +764,9 @@ class FileDisplayActivity : FileActivity(),
}
// If current file is root folder
else if (currentDirDisplayed.parentId == ROOT_PARENT_ID) {
// If current space is a project space (not personal, not shares), navigate back to the spaces list
if (mainFileListFragment?.getCurrentSpace()?.isProject == true) {
// If current space is a project space or personal in a multi-personal account, navigate back to the spaces list
if (mainFileListFragment?.getCurrentSpace()?.isProject == true ||
(mainFileListFragment?.getCurrentSpace()?.isPersonal == true && isMultiPersonal)) {
navigateTo(FileListOption.SPACES_LIST)
}
// If current space is not a project space (personal or shares) or it is null ("Files" in oC10), close the app
Expand Down Expand Up @@ -965,7 +968,8 @@ class FileDisplayActivity : FileActivity(),
// If we come from a preview activity (image or video), not updating toolbar when initializing this activity or it will show the root folder one
if (intent.action == ACTION_DETAILS && chosenFile?.remotePath == OCFile.ROOT_PATH && secondFragment is FileDetailsFragment) return

if (chosenFile == null || (chosenFile.remotePath == OCFile.ROOT_PATH && (space == null || !space.isProject))) {
if (chosenFile == null || (chosenFile.remotePath == OCFile.ROOT_PATH && (space == null ||
(!space.isProject && !(space.isPersonal && isMultiPersonal))))) {
val title =
when (fileListOption) {
FileListOption.AV_OFFLINE -> getString(R.string.drawer_item_only_available_offline)
Expand All @@ -980,7 +984,7 @@ class FileDisplayActivity : FileActivity(),
}
setTitle(title)
setupRootToolbar(title = title, isSearchEnabled = true, isAvatarRequested = false)
} else if (space?.isProject == true && chosenFile.remotePath == OCFile.ROOT_PATH) {
} else if ((space?.isProject == true || (space?.isPersonal == true && isMultiPersonal)) && chosenFile.remotePath == OCFile.ROOT_PATH) {
updateStandardToolbar(title = space.name, displayHomeAsUpEnabled = true, homeButtonEnabled = true)
} else {
updateStandardToolbar(title = chosenFile.fileName, displayHomeAsUpEnabled = true, homeButtonEnabled = true)
Expand Down

0 comments on commit 7a48335

Please sign in to comment.