-
-
Notifications
You must be signed in to change notification settings - Fork 2k
fix(file-list): list directory 馃殌 #17438
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| /* | ||
| * Nextcloud - Android Client | ||
| * | ||
| * SPDX-FileCopyrightText: 2026 Alper Ozturk <alper.ozturk@nextcloud.com> | ||
| * SPDX-License-Identifier: AGPL-3.0-or-later | ||
| */ | ||
|
|
||
| package com.nextcloud.client.database.entity.model | ||
|
|
||
| import androidx.room.ColumnInfo | ||
| import com.owncloud.android.lib.resources.shares.ShareType | ||
|
|
||
| data class ShareeKey( | ||
| @ColumnInfo(name = "path") val path: String, | ||
| @ColumnInfo(name = "shate_with") val shareWith: String?, | ||
| @ColumnInfo(name = "share_type") val shareType: Int | ||
| ) { | ||
| companion object { | ||
| val shareableShareTypeValues = listOf( | ||
| ShareType.USER, | ||
| ShareType.GROUP, | ||
| ShareType.EMAIL, | ||
| ShareType.FEDERATED, | ||
| ShareType.FEDERATED_GROUP, | ||
| ShareType.ROOM, | ||
| ShareType.CIRCLE | ||
| ).map { it.value } | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -134,6 +134,11 @@ public class RefreshFolderOperation extends RemoteOperation { | |
| */ | ||
| private boolean mRemoteFolderChanged; | ||
|
|
||
| /** | ||
| * 'True' means that the sharees of at least one child of the folder changed | ||
| */ | ||
| private boolean sharesChanged; | ||
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fixes refresh folder + shares event trigger call for same directory. However only once enough and only second event needs to be fired actually shares updated in local storage.
alperozturk96 marked this conversation as resolved.
|
||
|
|
||
| /** | ||
| * 'True' means that Etag will be ignored | ||
| */ | ||
|
|
@@ -307,10 +312,10 @@ protected RemoteOperationResult run(OwnCloudClient client) { | |
| } | ||
| } | ||
|
|
||
| fileDataStorageManager.saveSharesFromRemoteFile(remoteFiles); | ||
| sharesChanged = fileDataStorageManager.saveSharesFromRemoteFile(remoteFiles); | ||
| } | ||
|
|
||
| if (!mSyncFullAccount && mLocalFolder != null && !isMetadataSyncWorkerRunning) { | ||
| if (!mSyncFullAccount && sharesChanged && mLocalFolder != null && !isMetadataSyncWorkerRunning) { | ||
| sendLocalBroadcast(EVENT_SINGLE_FOLDER_SHARES_SYNCED, mLocalFolder.getRemotePath(), result); | ||
| } | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -227,6 +227,8 @@ class FileDisplayActivity : | |
| private var mPlayerConnection: PlayerServiceConnection? = null | ||
| private var lastDisplayedAccountName: String? = null | ||
|
|
||
| private var listFragmentJustCreated = false | ||
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. fixes first time app launch multiple listing directory |
||
|
|
||
| @Inject | ||
| lateinit var localBroadcastManager: LocalBroadcastManager | ||
|
|
||
|
|
@@ -559,6 +561,7 @@ class FileDisplayActivity : | |
| val transaction = supportFragmentManager.beginTransaction() | ||
| transaction.add(R.id.left_fragment_container, listOfFiles, TAG_LIST_OF_FILES) | ||
| transaction.commit() | ||
| listFragmentJustCreated = true | ||
| } else { | ||
| supportFragmentManager.findFragmentByTag(TAG_LIST_OF_FILES) | ||
| } | ||
|
|
@@ -567,8 +570,11 @@ class FileDisplayActivity : | |
| private fun initFragments() { | ||
| // First fragment | ||
| val listOfFiles = this.listOfFilesFragment | ||
| if (listOfFiles != null && TextUtils.isEmpty(searchQuery)) { | ||
| listOfFiles.listDirectory(getCurrentDir(), file, MainApp.isOnlyOnDevice()) | ||
| if (listOfFiles != null && searchQuery.isNullOrEmpty()) { | ||
| if (!listFragmentJustCreated) { | ||
| listOfFiles.listDirectory(getCurrentDir(), file, MainApp.isOnlyOnDevice()) | ||
| } | ||
| listFragmentJustCreated = true | ||
| } else { | ||
| Log_OC.e(TAG, "Still have a chance to lose the initialization of list fragment >(") | ||
| } | ||
|
|
@@ -610,10 +616,13 @@ class FileDisplayActivity : | |
| if (it::class != OCFileListFragment::class) { | ||
| leftFragment = OCFileListFragment() | ||
| supportFragmentManager.executePendingTransactions() | ||
| listFragmentJustCreated = true | ||
| } | ||
| } | ||
|
|
||
| browseToRoot() | ||
| // The onResume() that always follows this same-activity intent redelivery already | ||
| // lists and re-syncs the current directory, so doing it again here is redundant. | ||
| browseToRoot(performRefresh = false) | ||
| } | ||
|
|
||
| LIST_GROUPFOLDERS == action -> { | ||
|
|
@@ -1370,6 +1379,9 @@ class FileDisplayActivity : | |
|
|
||
| super.onResume() | ||
|
|
||
| val listFragmentJustCreated = this.listFragmentJustCreated | ||
| this.listFragmentJustCreated = false | ||
|
Comment on lines
+1382
to
+1383
|
||
|
|
||
| folderRefreshScheduler.start() | ||
|
|
||
| if (ocFileListFragment?.isSearchFragment == true) { | ||
|
|
@@ -1410,7 +1422,9 @@ class FileDisplayActivity : | |
| if (searchView != null && !TextUtils.isEmpty(searchQuery)) { | ||
| searchView?.setQuery(searchQuery, false) | ||
| } else if (!ocFileListFragment.isSearchFragment && startFile == null) { | ||
| ocFileListFragment.listDirectory(MainApp.isOnlyOnDevice()) | ||
| if (!listFragmentJustCreated) { | ||
| ocFileListFragment.listDirectory(MainApp.isOnlyOnDevice()) | ||
| } | ||
| ocFileListFragment.registerFabListener() | ||
| updateActionBarTitleAndHomeButton(currentDir) | ||
| } else { | ||
|
|
@@ -1553,6 +1567,9 @@ class FileDisplayActivity : | |
| return | ||
| } | ||
|
|
||
| // EVENT_SINGLE_FOLDER_CONTENTS_SYNCED fires only when the folder's content actually changed, and | ||
| // EVENT_SINGLE_FOLDER_SHARES_SYNCED only when a sharee actually changed - each is an independent, | ||
| // already-precise signal, so both are handled here (RefreshFolderOperation.java). | ||
| var currentFile = file?.remotePath?.let { storageManager.getFileByPath(it) } | ||
| val currentDir = getCurrentDir()?.remotePath?.let { storageManager.getFileByPath(it) } | ||
| val isSyncFolderRemotePathRoot = OCFile.ROOT_PATH == syncFolderRemotePath | ||
|
|
@@ -1914,13 +1931,15 @@ class FileDisplayActivity : | |
| } | ||
| // endregion | ||
|
|
||
| fun browseToRoot() { | ||
| fun browseToRoot(performRefresh: Boolean = true) { | ||
|
alperozturk96 marked this conversation as resolved.
|
||
| listOfFilesFragment?.let { | ||
| val root = storageManager.getFileByPath(OCFile.ROOT_PATH) | ||
| it.resetSearchAttributes() | ||
| file = root | ||
| it.listDirectory(root, MainApp.isOnlyOnDevice()) | ||
| startSyncFolderOperation(root, false) | ||
| if (performRefresh) { | ||
| it.listDirectory(root, MainApp.isOnlyOnDevice()) | ||
| startSyncFolderOperation(root, false) | ||
| } | ||
| } | ||
|
|
||
| binding.fabMain.setImageResource(R.drawable.ic_plus) | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.