Compare commits

...
151 Commits
Author SHA1 Message Date
Alex 165e7fc637 remove unused no-arg constructor and params, along with logic checking params contents
Signed-off-by: Alex <[email protected]>
2025-10-29 20:18:25 -04:00
Alper Öztürk ac7d82a7f0 Merge pull request #15855 from nextcloud/fix/open-file-intent-crash
fix: open file intent crash
2025-10-29 11:16:32 +01:00
alperozturk 27340def2c fix: ui glitch when press back from shortcut
Signed-off-by: alperozturk <[email protected]>
2025-10-29 11:06:00 +01:00
alperozturk e8a8a82671 fix: open file intent crash
Signed-off-by: alperozturk <[email protected]>
2025-10-29 11:06:00 +01:00
Nextcloud bot 416e2b80f8 fix(l10n): Update translations from Transifex
Signed-off-by: Nextcloud bot <[email protected]>
2025-10-29 02:46:33 +00:00
Alper Öztürk 176577aae8 Merge pull request #15860 from nextcloud/revert-input-stream-binder
revert input stream changes
2025-10-28 10:22:20 +01:00
alperozturk 2500a692a7 revert input stream changes
Signed-off-by: alperozturk <[email protected]>
2025-10-28 10:21:05 +01:00
Nextcloud bot 076972789e fix(l10n): Update translations from Transifex
Signed-off-by: Nextcloud bot <[email protected]>
2025-10-28 02:46:17 +00:00
Andy Scherzinger 0c737e04c5 Merge pull request #15842 from nextcloud/renovate/kotlin-monorepo
fix(deps): update kotlin monorepo to v2.2.21
2025-10-27 16:26:37 +01:00
renovate[bot] 46d1253210 chore(deps): update kotlin to v2.2.21
Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-10-27 13:44:40 +01:00
renovate[bot] 2719530f7a chore(deps): update dependency com.google.devtools.ksp to v2.3.0
Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-10-27 13:20:13 +01:00
renovate[bot] 72ff3a5f26 fix(deps): update kotlin monorepo to v2.2.21
Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-10-27 13:18:37 +01:00
Andy Scherzinger 0028b6f0fd Merge pull request #15852 from nextcloud/renovate/composebom
fix(deps): update dependency androidx.compose:compose-bom to v2025.10.01
2025-10-27 13:18:08 +01:00
Andy Scherzinger e77b10ebdc ci(lint): Lower lint sore
Signed-off-by: Andy Scherzinger <[email protected]>
2025-10-27 10:11:12 +01:00
Andy Scherzinger 88fc3f362b ci(chksm): Add meta-data
Signed-off-by: Andy Scherzinger <[email protected]>
2025-10-27 09:31:16 +01:00
Andy Scherzinger 1d19cc6992 ci(lint): Lower score to reflect current state
Signed-off-by: Andy Scherzinger <[email protected]>
2025-10-27 09:31:16 +01:00
renovate[bot] d831a8b96d fix(deps): update dependency androidx.compose:compose-bom to v2025.10.01
Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-10-27 09:31:15 +01:00
Alper Öztürk 3453a7a1f3 Merge pull request #15806 from nextcloud/use-dao-in-upload-list-adapter-for-consistency
use dao in upload list adapter
2025-10-27 08:57:32 +01:00
alperozturk 2f58e63b45 fix: load upload group async load
Signed-off-by: alperozturk <[email protected]>
2025-10-27 08:53:52 +01:00
alperozturk cbe2e9e433 use dao in upload list adapter
Signed-off-by: alperozturk <[email protected]>
2025-10-27 08:53:52 +01:00
Alper Öztürk 17e6e553e5 Merge pull request #15669 from PhilLab/fix_15636_deleting_from_slideshow
Fix deleting from slideshow
2025-10-27 08:33:59 +01:00
Philipp Hasper 4453eaf5d3 fix: deletion from slideshow for cases were user is not present
In that case, deleting the currently viewed file had the following issues:
1. When deleting the first image, the UI just stayed with it.
2. When deleting another image, the UI switched to the previous image,
   instead of the next one, which is inconsistent to the behavior when
   user is available
3. When switching to the next image, the title shown at the top did
   not correctly update

Signed-off-by: Philipp Hasper <[email protected]>
2025-10-27 08:30:21 +01:00
Philipp Hasper 21e0c82e65 fix: deletion from slideshow works again
The patch added in #14782 prevented that the callback
onRemoteOperationFinish() was ever called.

Secondly, the manual update of adapter and pager is only needed if user
is not present. When user is present, the initViewPager() takes care
of everything.

Signed-off-by: Philipp Hasper <[email protected]>
2025-10-27 08:30:21 +01:00
Andy Scherzinger 7a5f707e9a Merge pull request #15843 from nextcloud/renovate/mockkversion
fix(deps): update mockkversion to v1.14.6
2025-10-27 07:12:41 +01:00
Andy Scherzinger cbe4932b85 Merge pull request #15846 from nextcloud/renovate/androidcommonlibraryversion
fix(deps): update dependency com.github.nextcloud.android-common:ui to v0.29.0
2025-10-27 07:12:02 +01:00
renovate[bot] be2b8416da fix(deps): update dependency com.github.nextcloud.android-common:ui to v0.29.0
Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-10-26 22:18:31 +00:00
renovate[bot] 57acd7d046 fix(deps): update mockkversion to v1.14.6
Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-10-26 22:12:18 +00:00
Andy Scherzinger 622e22f801 Merge pull request #15840 from nextcloud/renovate/fbcontribversion
fix(deps): update dependency com.mebigfatguy.fb-contrib:fb-contrib to v7.6.15
2025-10-26 22:39:35 +01:00
Andy Scherzinger 8bc660e9b0 Merge pull request #15845 from nextcloud/renovate/github-codeql-action-4.x
chore(deps): update github/codeql-action action to v4.31.0
2025-10-26 22:38:39 +01:00
renovate[bot] b431522ceb chore(deps): update github/codeql-action action to v4.31.0
Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-10-26 21:38:00 +00:00
renovate[bot] aa5d00dc85 fix(deps): update dependency com.mebigfatguy.fb-contrib:fb-contrib to v7.6.15
Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-10-26 22:35:47 +01:00
Andy Scherzinger 675017c0b7 Merge pull request #15848 from nextcloud/renovate/major-github-artifact-actions
chore(deps): update actions/upload-artifact action to v5
2025-10-26 22:33:06 +01:00
Andy Scherzinger 79f3938a10 Merge pull request #15698 from nextcloud/renovate/daggerversion
fix(deps): update daggerversion to v2.57.2
2025-10-26 22:11:38 +01:00
renovate[bot] 55ee6af50c chore(deps): update actions/upload-artifact action to v5
Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-10-26 19:02:04 +00:00
Andy Scherzinger 02684cb212 ci(test): Sort fav and forlder on top
Signed-off-by: Andy Scherzinger <[email protected]>
2025-10-26 19:15:21 +01:00
Andy Scherzinger 8169857a28 ci(chksm): Update meta data
Signed-off-by: Andy Scherzinger <[email protected]>
2025-10-26 19:15:21 +01:00
Andy Scherzinger 145b79633e ci(test): Fix test
Signed-off-by: Andy Scherzinger <[email protected]>
2025-10-26 19:15:20 +01:00
renovate[bot] eb6282f885 fix(deps): update daggerversion to v2.57.2
Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-10-26 19:15:20 +01:00
Andy Scherzinger a66095eead Merge pull request #15841 from nextcloud/renovate/jacoco_version
fix(deps): update jacoco_version to v0.8.14
2025-10-26 19:14:49 +01:00
Andy Scherzinger 5cc8c43531 Merge pull request #15839 from nextcloud/renovate/spotbugsgradleplugin
fix(deps): update dependency com.github.spotbugs.snom:spotbugs-gradle-plugin to v6.4.4
2025-10-26 19:14:08 +01:00
Andy Scherzinger 1036b44975 Merge pull request #15851 from nextcloud/renovate/gradle-actions-5.x
chore(deps): update gradle/actions action to v5
2025-10-26 19:13:30 +01:00
renovate[bot] 8510970467 fix(deps): update jacoco_version to v0.8.14
Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-10-26 18:09:33 +00:00
renovate[bot] 782adad8a5 fix(deps): update dependency com.github.spotbugs.snom:spotbugs-gradle-plugin to v6.4.4
Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-10-26 18:05:40 +00:00
Andy Scherzinger f3df1dd4f5 Merge pull request #15850 from nextcloud/renovate/fsfe-reuse-action-6.x
chore(deps): update fsfe/reuse-action action to v6
2025-10-26 18:51:14 +01:00
renovate[bot] 94fed2aa62 chore(deps): update gradle/actions action to v5
Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-10-26 16:59:17 +00:00
renovate[bot] bca8dae206 chore(deps): update fsfe/reuse-action action to v6
Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-10-26 16:59:12 +00:00
Andy Scherzinger a7f42e8caa Merge pull request #15686 from nextcloud/renovate/composebom
fix(deps): update dependency androidx.compose:compose-bom to v2025.09.01
2025-10-26 17:17:01 +01:00
Andy Scherzinger 8a315b9f9f ci(chksm): Add metadata
Signed-off-by: Andy Scherzinger <[email protected]>
2025-10-26 15:58:50 +01:00
tobiasKaminsky bcbc089094 new lib material-icons-core needed
Signed-off-by: tobiasKaminsky <[email protected]>
2025-10-26 14:24:05 +01:00
renovate[bot] 2fbf25e765 fix(deps): update dependency androidx.compose:compose-bom to v2025.09.01
Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-10-26 14:24:05 +01:00
Andy Scherzinger 4e0c1083bb Merge pull request #15836 from nextcloud/update-library-2025-10-26
Update library to 2025-10-26
2025-10-26 14:23:37 +01:00
Andy Scherzinger 1ae05df898 ci(chksm): Update meta data
Signed-off-by: Andy Scherzinger <[email protected]>
2025-10-26 13:04:40 +01:00
Tobias Kaminsky 699cbc525b Update library to 2025-10-26
Signed-off-by: Tobias Kaminsky <[email protected]>
2025-10-26 12:49:47 +01:00
Nextcloud bot e1a80b64f4 fix(l10n): Update translations from Transifex
Signed-off-by: Nextcloud bot <[email protected]>
2025-10-26 02:43:02 +00:00
Nextcloud bot 52bb721afc fix(l10n): Update translations from Transifex
Signed-off-by: Nextcloud bot <[email protected]>
2025-10-25 02:42:18 +00:00
Nextcloud bot bb1782e7cc fix(l10n): Update translations from Transifex
Signed-off-by: Nextcloud bot <[email protected]>
2025-10-24 02:42:38 +00:00
Alper Öztürk 004f14ea7f Merge pull request #15407 from nextcloud/sorting
folders/favorites first as option
2025-10-23 16:11:16 +02:00
alperozturk b1d842c6f6 fix: git conflict, kotlin spotless bugs, coda analytics
Signed-off-by: alperozturk <[email protected]>
2025-10-23 16:10:10 +02:00
alperozturk f5acb815b3 fix: git conflict
Signed-off-by: alperozturk <[email protected]>
2025-10-23 16:00:34 +02:00
Alper Öztürk feed19eea4 Merge pull request #14299 from nextcloud/powerWarning
enable power warning for emulators
2025-10-23 15:58:42 +02:00
Alper Öztürk 7dbfa0d551 Merge pull request #14796 from nextcloud/breadcrumb
Fix breadcumb with details view
2025-10-23 15:55:05 +02:00
tobiasKaminsky a222d55b0c Fix breadcumb with details view
Signed-off-by: tobiasKaminsky <[email protected]>
2025-10-23 15:54:53 +02:00
tobiasKaminsky 16996c7601 enable power warning for emulators
Signed-off-by: tobiasKaminsky <[email protected]>
2025-10-22 15:28:56 +02:00
Alper Öztürk 3a3072612d Merge pull request #15595 from nextcloud/printAsyncDirectory
SpotBugs: Fix Method ignores exceptional return value - PrintAsyncTask
2025-10-22 09:13:28 +02:00
Tobias Kaminsky f7dee5449f Merge pull request #15644 from Saeedhany/master
Create Readme-AR.md
2025-10-22 07:58:01 +02:00
Nextcloud bot f1434d833d fix(l10n): Update translations from Transifex
Signed-off-by: Nextcloud bot <[email protected]>
2025-10-22 02:39:21 +00:00
Alex 195c398ca4 updated method
Signed-off-by: Alex <[email protected]>
2025-10-21 12:19:00 -04:00
Alex 5a86c0f00a fix make directories
Signed-off-by: Alex <[email protected]>
2025-10-21 12:19:00 -04:00
Alper Öztürk db0d113b52 Merge pull request #15815 from nextcloud/fix/local-file-list-adapter-scroll-to-top
fix: local file list adapter scroll to top
2025-10-21 10:37:52 +02:00
Nextcloud bot 8fac856d87 fix(l10n): Update translations from Transifex
Signed-off-by: Nextcloud bot <[email protected]>
2025-10-21 02:39:43 +00:00
Andy Scherzinger 083c393c0b Merge pull request #15817 from nextcloud/renovate/ubuntu-noble
chore(deps): update ubuntu:noble docker digest to 66460d5
2025-10-20 18:29:55 +02:00
renovate[bot] 07e81c2c87 chore(deps): update ubuntu:noble docker digest to 66460d5
Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-10-20 10:12:20 +00:00
alperozturk 5b9a7d291b fix: local file list |adapter scroll to top
Signed-off-by: alperozturk <[email protected]>
2025-10-20 10:14:02 +02:00
Alper Öztürk 3bb1c7f4d8 Merge pull request #15513 from nextcloud/createNewBackground
Create new dialog: non white background
2025-10-20 09:45:51 +02:00
Alper Öztürk 7e9c8ccbfc Merge pull request #15591 from nextcloud/renameFileDirectory
SpotBugs: Fix Method ignores exceptional return value - RenameFileOperation
2025-10-20 09:41:38 +02:00
tobiasKaminsky 3686edd55c Create new dialog: non white background
Signed-off-by: tobiasKaminsky <[email protected]>
2025-10-20 09:31:51 +02:00
Alex 62a51e4063 delete if exists
Signed-off-by: Alex <[email protected]>
2025-10-20 09:30:45 +02:00
Alex 5b11ed7b20 fix Exception
Signed-off-by: Alex <[email protected]>
2025-10-20 09:30:45 +02:00
Alex 4e9247a130 Handle exceptions
Signed-off-by: Alex <[email protected]>
2025-10-20 09:30:45 +02:00
Alex 81296dcf8b fix entire function to use newer API
Signed-off-by: Alex <[email protected]>
2025-10-20 09:30:45 +02:00
Alex Knop a704326574 use create file and different delete function
Signed-off-by: Alex Knop <[email protected]>
2025-10-20 09:30:45 +02:00
Alper Öztürk 3cab716a97 Merge pull request #15597 from nextcloud/fileStorageDelete
SpotBugs: Fix Method ignores exceptional return value - FileStorageUtils
2025-10-20 08:57:05 +02:00
Andy Scherzinger 596264d5cd Merge pull request #15807 from nextcloud/fix/npe-left-fragment-adapter
fix: npe left fragment adapter
2025-10-20 08:12:50 +02:00
Andy Scherzinger 50d4b8d187 Merge pull request #15795 from nextcloud/repo-sync/android-config/master
🔄 synced file(s) with nextcloud/android-config
2025-10-20 07:26:01 +02:00
Nextcloud bot cf5cbb1635 fix(l10n): Update translations from Transifex
Signed-off-by: Nextcloud bot <[email protected]>
2025-10-20 02:38:17 +00:00
nextcloud-android-bot a71c7fd1d9 🔄 synced local '.github/workflows/' with remote 'config/workflows/'
Signed-off-by: nextcloud-android-bot <[email protected]>
2025-10-20 02:34:54 +00:00
Nextcloud bot ea3d6407c5 fix(l10n): Update translations from Transifex
Signed-off-by: Nextcloud bot <[email protected]>
2025-10-19 02:38:09 +00:00
Nextcloud bot b4bba97efc fix(l10n): Update translations from Transifex
Signed-off-by: Nextcloud bot <[email protected]>
2025-10-18 02:38:49 +00:00
Alex 84be18b5fb delete if exists
Signed-off-by: Alex <[email protected]>
2025-10-17 13:07:23 -04:00
Alex 2a64e26c10 fix Exception
Signed-off-by: Alex <[email protected]>
2025-10-17 13:07:23 -04:00
Alex 67a638ad4e add exception
Signed-off-by: Alex <[email protected]>
2025-10-17 13:07:23 -04:00
Alex 8f4096e6dc using modern Files delete method
Signed-off-by: Alex <[email protected]>
2025-10-17 13:07:23 -04:00
alperozturk a26beacc40 fix: npe left fragment adapter
Signed-off-by: alperozturk <[email protected]>
2025-10-17 15:53:48 +02:00
Alper Öztürk 1a40920dd7 Merge pull request #15759 from nextcloud/fix/auto-upload-state
fix: auto upload db state
2025-10-17 15:21:49 +02:00
alperozturk 6de9b48fd3 fix: git conflicts
Signed-off-by: alperozturk <[email protected]>
2025-10-17 11:14:41 +02:00
alperozturk 1000c82d5e fix: git conflict
Signed-off-by: alperozturk <[email protected]>
2025-10-17 11:14:41 +02:00
alperozturk f03f517593 revert changes due to split prs
Signed-off-by: alperozturk <[email protected]>
2025-10-17 11:14:41 +02:00
alperozturk 3155c65a74 fix: upload list state
Signed-off-by: alperozturk <[email protected]>
2025-10-17 11:14:41 +02:00
alperozturk 7e1880c3de fix: cant get file from URI
Signed-off-by: alperozturk <[email protected]>
2025-10-17 11:14:41 +02:00
alperozturk 794d48e665 fix: pagination
Signed-off-by: alperozturk <[email protected]>
2025-10-17 11:14:41 +02:00
alperozturk 5d033e7986 fix: pagination
Signed-off-by: alperozturk <[email protected]>
2025-10-17 11:14:41 +02:00
alperozturk 279b5fa209 fix: CursorIndexOutOfBoundsException
Signed-off-by: alperozturk <[email protected]>

# Conflicts:
#	app/src/main/java/com/nextcloud/client/database/dao/SyncedFolderDao.kt
2025-10-17 11:14:41 +02:00
alperozturk d562e5feb3 add: comments
Signed-off-by: alperozturk <[email protected]>
2025-10-17 11:14:41 +02:00
alperozturk 18481f45d7 fix: id incrementation
Signed-off-by: alperozturk <[email protected]>
2025-10-17 11:14:41 +02:00
alperozturk 683ed9b0b8 fix: git conflicts
Signed-off-by: alperozturk <[email protected]>
2025-10-17 11:14:41 +02:00
Alper Öztürk d4e131e81f Merge pull request #15799 from nextcloud/fix/bidi-control-character-incomplete-trailing-escape
fix: incomplete trailing space during decoding filename
2025-10-17 09:10:32 +02:00
Alper Öztürk 484fe04245 Merge pull request #15800 from nextcloud/fix/file-upload-limit-message-visibility
fix: file upload limit message visibility
2025-10-17 09:08:07 +02:00
Nextcloud bot b0f429b477 fix(l10n): Update translations from Transifex
Signed-off-by: Nextcloud bot <[email protected]>
2025-10-17 02:39:10 +00:00
alperozturk 13f40c4026 fix: file upload limit message visibility
Signed-off-by: alperozturk <[email protected]>
2025-10-16 12:06:34 +02:00
alperozturk 2ea35f2f0b fix: incomplete trailing space during decoding filename
Signed-off-by: alperozturk <[email protected]>
2025-10-16 11:24:20 +02:00
Alper Öztürk 9e4197e4b9 Merge pull request #15712 from nextcloud/fix/cancel-upload
fix: upload cancel
2025-10-16 09:29:00 +02:00
Alper Öztürk 7a021f4be9 Merge pull request #15797 from nextcloud/fix/handle-not-modified-and-no-content-response
fix: handle not modified response in input stream binder implementation
2025-10-16 08:58:41 +02:00
Nextcloud bot 03c22ee4a0 fix(l10n): Update translations from Transifex
Signed-off-by: Nextcloud bot <[email protected]>
2025-10-16 02:38:05 +00:00
alperozturk 4fbaaa307d chore: update lib
Signed-off-by: alperozturk <[email protected]>
2025-10-15 17:41:57 +02:00
alperozturk 7275d8b14e fix: handle not modified
Signed-off-by: alperozturk <[email protected]>
2025-10-15 16:52:05 +02:00
alperozturk 199e754e9b fix: handle not modified and no content response
Signed-off-by: alperozturk <[email protected]>
2025-10-15 16:50:46 +02:00
alperozturk db028503d9 fix: git conflict
Signed-off-by: alperozturk <[email protected]>
2025-10-15 14:15:36 +02:00
alperozturk 8a028567d1 fix: upload cancel
Signed-off-by: alperozturk <[email protected]>
2025-10-15 14:10:04 +02:00
alperozturk 7a97e558c3 fix: upload cancel
Signed-off-by: alperozturk <[email protected]>

# Conflicts:
#	build.gradle
2025-10-15 14:10:02 +02:00
alperozturk b83ac7d6a4 fix: upload cancel
Signed-off-by: alperozturk <[email protected]>
2025-10-15 14:10:00 +02:00
alperozturk 6bdbbcb0d7 fix: upload cancel
Signed-off-by: alperozturk <[email protected]>
2025-10-15 14:10:00 +02:00
alperozturk 45a5e6bd26 fix: upload cancel
Signed-off-by: alperozturk <[email protected]>
2025-10-15 14:09:59 +02:00
alperozturk 8d2182a29e fix: upload cancel
Signed-off-by: alperozturk <[email protected]>
2025-10-15 14:09:57 +02:00
alperozturk 5479c135eb fix: upload cancel
Signed-off-by: alperozturk <[email protected]>
2025-10-15 14:09:57 +02:00
alperozturk 3c5aaad6d6 fix: upload cancel
Signed-off-by: alperozturk <[email protected]>
2025-10-15 14:09:57 +02:00
alperozturk eb13420f35 fix: upload cancel
Signed-off-by: alperozturk <[email protected]>
2025-10-15 14:09:55 +02:00
alperozturk 26158aba2c fix: git conflict
Signed-off-by: alperozturk <[email protected]>
2025-10-15 14:09:52 +02:00
Alper Öztürk c89832b1ff Merge pull request #15796 from nextcloud/fix/save-file-download-in-folder-download
fix: saving file for folder download
2025-10-15 14:07:54 +02:00
Alper Öztürk 6e3f63d4d4 Merge pull request #15791 from nextcloud/fix/make-file-upload-worker-long-running-job
fix: make file upload worker long running task
2025-10-15 14:07:23 +02:00
alperozturk eedd3473f5 fix: save file for folder download
Signed-off-by: alperozturk <[email protected]>
2025-10-15 13:53:28 +02:00
alperozturk 5ebb4cfad2 fix: save file for folder download
Signed-off-by: alperozturk <[email protected]>
2025-10-15 13:00:45 +02:00
Alper Öztürk 8baa0a6988 Merge pull request #15743 from nextcloud/build/upgrade-android-sdk-16
upgrade android sdk 36
2025-10-15 10:47:59 +02:00
alperozturk 1f900b7a55 fix: back press of fda
Signed-off-by: alperozturk <[email protected]>
2025-10-15 10:47:47 +02:00
alperozturk c18278b973 fix: back press of fda
Signed-off-by: alperozturk <[email protected]>
2025-10-15 10:14:22 +02:00
alperozturk 7fe00834ed add: Unsupported platform APIs and unable to migrate due to outdated PreferenceActivity for SettingsActivity
Signed-off-by: alperozturk <[email protected]>
2025-10-15 09:05:42 +02:00
alperozturk 83d3cfba1d fix: code analytics
Signed-off-by: alperozturk <[email protected]>
2025-10-15 09:05:42 +02:00
alperozturk 30e67b530f fix: code analytics
Signed-off-by: alperozturk <[email protected]>
2025-10-15 09:05:42 +02:00
alperozturk a4eb0c9275 fix: custom back press navigation
Signed-off-by: alperozturk <[email protected]>
2025-10-15 09:05:42 +02:00
alperozturk 39a7aff33c fix: custom back press navigation
Signed-off-by: alperozturk <[email protected]>
2025-10-15 09:05:42 +02:00
alperozturk 07e7484c5a refactor: update back press gesture
Signed-off-by: alperozturk <[email protected]>
2025-10-15 09:05:42 +02:00
alperozturk a1ce48da06 chore: upgrade android sdk 36
Signed-off-by: alperozturk <[email protected]>
2025-10-15 09:05:42 +02:00
Alper Öztürk 8dd522d600 Merge pull request #14166 from nextcloud/feature/sync-worker
Add Sync Worker
2025-10-15 09:05:07 +02:00
alperozturk b489ddae99 rename to folder download worker
Signed-off-by: alperozturk <[email protected]>
2025-10-15 09:04:35 +02:00
Nextcloud bot 80552ca895 fix(l10n): Update translations from Transifex
Signed-off-by: Nextcloud bot <[email protected]>
2025-10-15 02:38:07 +00:00
alperozturk e6aa4471b8 rename to folder download worker
Signed-off-by: alperozturk <[email protected]>
2025-10-14 17:06:35 +02:00
alperozturk 2a6ba436aa fix: folder download 2025-10-14 16:53:49 +02:00
alperozturk 895fd68e84 fix: make file upload worker long running task
Signed-off-by: alperozturk <[email protected]>
2025-10-14 11:49:14 +02:00
Saeedhany 93d4244859 Merge branch 'master' into master 2025-10-02 15:53:09 +03:00
Saeedhany 726fcbc8e4 Update Readme-AR.md
Signed-off-by: Saeedhany <[email protected]>
2025-10-01 15:15:07 +03:00
Saeedhany aab2051f5f Update Readme-AR.md
Signed-off-by: Saeedhany <[email protected]>
2025-10-01 15:10:29 +03:00
Saeedhany b7b250bb2f Create Readme-AR.md
Signed-off-by: Saeedhany <[email protected]>
2025-09-15 17:29:29 +03:00
156 changed files with 4568 additions and 950 deletions

No files matched your search

+1 -1
View File
@@ -1,4 +1,4 @@
FROM ubuntu:noble@sha256:728785b59223d755e3e5c5af178fab1be7031f3522c5ccd7a0b32b80d8248123
FROM ubuntu:noble@sha256:66460d557b25769b102175144d538d88219c077c678a49af4afca6fbfc1b5252
ARG DEBIAN_FRONTEND=noninteractive
ENV ANDROID_HOME=/usr/lib/android-sdk
+1
View File
@@ -27,6 +27,7 @@ concurrency:
jobs:
analysis:
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- name: Disabled on forks
if: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name != github.repository }}
+1 -1
View File
@@ -28,7 +28,7 @@ jobs:
with:
distribution: "temurin"
java-version: 17
- uses: gradle/actions/wrapper-validation@748248ddd2a24f49513d8f472f81c3a07d4d50e1 # v4.4.4
- uses: gradle/actions/wrapper-validation@4d9f0ba0025fe599b4ebab900eb7f3a1d93ef4c2 # v5.0.0
- name: Build ${{ matrix.flavor }}
run: |
echo "org.gradle.jvmargs=-Xmx6g -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 -XX:+UseParallelGC -XX:MaxMetaspaceSize=1g" >> gradle.properties
+2 -2
View File
@@ -43,7 +43,7 @@ jobs:
with:
swap-size-gb: 10
- name: Initialize CodeQL
uses: github/codeql-action/init@f443b600d91635bebf5b0d9ebc620189c0d6fba5 # v4.30.8
uses: github/codeql-action/init@4e94bd11f71e507f7f87df81788dff88d1dacbfb # v4.31.0
with:
languages: ${{ matrix.language }}
- name: Set up JDK 17
@@ -57,4 +57,4 @@ jobs:
echo "org.gradle.jvmargs=-Xmx4g -XX:MaxMetaspaceSize=512m -XX:+HeapDumpOnOutOfMemoryError" > "$HOME/.gradle/gradle.properties"
./gradlew assembleDebug
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@f443b600d91635bebf5b0d9ebc620189c0d6fba5 # v4.30.8
uses: github/codeql-action/analyze@4e94bd11f71e507f7f87df81788dff88d1dacbfb # v4.31.0
+1 -1
View File
@@ -24,4 +24,4 @@ jobs:
persist-credentials: false
- name: REUSE Compliance Check
uses: fsfe/reuse-action@bb774aa972c2a89ff34781233d275075cbddf542 # v5.0.0
uses: fsfe/reuse-action@676e2d560c9a403aa252096d99fcab3e1132b0f5 # v6.0.0
+1 -1
View File
@@ -42,6 +42,6 @@ jobs:
# Upload the results to GitHub's code scanning dashboard.
- name: "Upload to code-scanning"
uses: github/codeql-action/upload-sarif@f443b600d91635bebf5b0d9ebc620189c0d6fba5 # v4.30.8
uses: github/codeql-action/upload-sarif@4e94bd11f71e507f7f87df81788dff88d1dacbfb # v4.31.0
with:
sarif_file: results.sarif
+1 -1
View File
@@ -102,7 +102,7 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: scripts/uploadReport.sh "${{ secrets.LOG_USERNAME }}" "${{ secrets.LOG_PASSWORD }}" ${{github.event.number}} "${{ matrix.color }}-${{ matrix.scheme }}" "Screenshot" ${{github.event.number}}
- name: Archive Espresso results
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0
if: ${{ always() }}
with:
name: Report-${{ matrix.color }}-${{ matrix.scheme }}
+2 -2
View File
@@ -33,7 +33,7 @@ jobs:
if: ${{ always() }}
run: scripts/deleteOldComments.sh "test" "Unit" ${{github.event.number}}
- name: Setup Gradle
uses: gradle/actions/setup-gradle@748248ddd2a24f49513d8f472f81c3a07d4d50e1 # v4.4.4
uses: gradle/actions/setup-gradle@4d9f0ba0025fe599b4ebab900eb7f3a1d93ef4c2 # v5.0.0
- name: Run unit tests with coverage
run: ./gradlew jacocoTestGplayDebugUnitTest
- name: Upload failing results
@@ -49,7 +49,7 @@ jobs:
fail_ci_if_error: true
- name: Upload jacoco artifacts
if: ${{ failure() }}
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0
with:
name: test-results
path: app/build/reports/tests/testGplayDebugUnitTest/
+120
View File
@@ -0,0 +1,120 @@
<!--
~ SPDX-FileCopyrightText: 2025 Saeed <[email protected]>
~ SPDX-License-Identifier: AGPL-3.0-or-later OR GPL-2.0-only
-->
# تطبيق [Nextcloud](https://nextcloud.com)لأجهزة أندرويد 📱
[![حالة REUSE](https://api.reuse.software/badge/github.com/nextcloud/android)](https://api.reuse.software/info/github.com/nextcloud/android)
[![حالة البناء](https://drone.nextcloud.com/api/badges/nextcloud/android/status.svg)](https://drone.nextcloud.com/nextcloud/android)
[![تقييم Codacy](https://app.codacy.com/project/badge/Grade/fb4cf26336774ee3a5c9adfe829c41aa)](https://app.codacy.com/gh/nextcloud/android/dashboard)
[![الإصدارات](https://img.shields.io/github/release/nextcloud/android.svg)](https://github.com/nextcloud/android/releases/latest)
[<img src="https://play.google.com/intl/en_us/badges/images/generic/en_badge_web_generic.png" alt="تحميل من Google Play" height="80">](https://play.google.com/store/apps/details?id=com.nextcloud.client)
[<img src="https://f-droid.org/badge/get-it-on.png" alt="احصل عليه من F-Droid" height="80">](https://f-droid.org/packages/com.nextcloud.client/)
## التحقق من توقيع التطبيق 🔐
للتأكد من صحة ملف APK:
- ملف APK باسم "gplay" متوفر [هنا](https://github.com/nextcloud/android/releases) أو عبر متجر Google Play
- ملف APK باسم "nextcloud" متوفر [هنا](https://github.com/nextcloud/android/releases)
- غير مناسب لتحميلات F-Droid، لأن F-Droid يقوم بتوقيعه بنفسه
```plaintext
SHA-256: fb009522f65e25802261b67b10a45fd70e610031976f40b28a649e152ded0373
SHA-1: 74aa1702e714941be481e1f7ce4a8f779c19dcea
```
**تطبيق Nextcloud لأندرويد يتيح لك إدارة بياناتك بسهولة على خادم Nextcloud الخاص بك.**
## الحصول على الدعم 🆘
إذا واجهت مشكلة أو لديك سؤال، يمكنك زيارة [منتدى الدعم](https://help.nextcloud.com/c/clients/android).
إذا اكتشفت خطأ أو لديك اقتراح لتحسين التطبيق، يمكنك [فتح قضية جديدة على GitHub](https://github.com/nextcloud/android/issues).
إذا لم تكن متأكدًا ما إذا كانت المشكلة ناتجة عن التطبيق أو الإعدادات أو الخادم، فابدأ بالسؤال في المنتدى، ثم عد إلى GitHub إذا لزم الأمر.
> ملاحظة: هذا المستودع خاص بتطبيق أندرويد فقط. إذا كانت المشكلة في الخادم، يرجى التواصل مع [فريق خادم Nextcloud](https://github.com/nextcloud/server).
## كيف تساهم في المشروع 🚀
هناك العديد من الطرق للمساهمة، سواء كنت مبرمجًا أو لا:
- مساعدة المستخدمين في المنتدى: https://help.nextcloud.com
- ترجمة التطبيق عبر [Transifex](https://app.transifex.com/nextcloud/nextcloud/android/)
- الإبلاغ عن المشاكل أو تقديم اقتراحات عبر [GitHub Issues](https://github.com/nextcloud/android/issues/new/choose)
- تنفيذ إصلاحات أو تحسينات عبر Pull Requests
- مراجعة [طلبات الدمج](https://github.com/nextcloud/android/pulls)
- اختبار النسخ التجريبية أو اليومية أو المرشحة للإصدار
- تحسين [التوثيق](https://github.com/nextcloud/documentation/)
- اختبار الميزات الأساسية في آخر إصدار مستقر
- تعلم كيفية جمع سجلات الأخطاء (logcat) لتقديم تقارير دقيقة
## إرشادات المساهمة والترخيص 📜
- الترخيص: [GPLv2](https://github.com/nextcloud/android/blob/master/LICENSE.txt)
- جميع المساهمات بعد 16 يونيو 2016 تعتبر مرخصة تحت AGPLv3 أو أي إصدار لاحق
- لا حاجة لتوقيع اتفاقية مساهم (CLA)
- يُفضل إضافة السطر التالي في رأس الملف عند إجراء تغييرات كبيرة:
```plaintext
SPDX-FileCopyrightText: <السنة> <اسمك> <بريدك الإلكتروني>
```
يرجى قراءة [مدونة السلوك](https://nextcloud.com/community/code-of-conduct/) لضمان بيئة تعاون إيجابية.
راجع أيضًا [إرشادات المساهمة](https://github.com/nextcloud/android/blob/master/CONTRIBUTING.md).
## ابدأ بالمساهمة 🔧
- اقرأ [SETUP.md](https://github.com/nextcloud/android/blob/master/SETUP.md) و[CONTRIBUTING.md](https://github.com/nextcloud/android/blob/master/CONTRIBUTING.md)
- قم بعمل fork للمستودع وابدأ بإرسال Pull Requests إلى فرع master
- يمكنك البدء بمراجعة [طلبات الدمج](https://github.com/nextcloud/android/pulls) أو العمل على [القضايا المبتدئة](https://github.com/nextcloud/android/issues?q=is%3Aopen+is%3Aissue+label%3A%22good+first+issue%22)
## جمع سجلات الأخطاء (logcat) 🔍
### على لينكس:
- فعّل USB-Debugging على هاتفك
- افتح الطرفية وأدخل:
```bash
adb logcat --pid=$(adb shell pidof -s 'com.nextcloud.client') > logcatOutput.txt
```
> تأكد من تثبيت [adb](https://developer.android.com/studio/releases/platform-tools.html)
### على ويندوز:
- حمّل [Minimal ADB and Fastboot](https://forum.xda-developers.com/t/tool-minimal-adb-and-fastboot-2-9-18.2317790/#post-42407269)
- فعّل USB-Debugging
- افتح البرنامج وأدخل:
```bash
adb shell pidof -s 'com.nextcloud.client'
```
- استخدم الناتج كـ `<processID>` في الأمر التالي:
```bash
adb logcat --pid=<processID> > "%USERPROFILE%\Downloads\logcatOutput.txt"
```
### على الجهاز (مع صلاحيات root):
```bash
su
logcat -d --pid $(pidof -s com.nextcloud.client) -f /sdcard/logcatOutput.txt
```
أو استخدم تطبيقات مثل [CatLog](https://play.google.com/store/apps/details?id=com.nolanlawson.logcat) أو [aLogcat](https://play.google.com/store/apps/details?id=org.jtb.alogcat)
## النسخة التطويرية 🛠️
- [تحميل مباشر للـ APK](https://download.nextcloud.com/android/dev/latest.apk)
- [F-Droid النسخة التجريبية](https://f-droid.org/en/packages/com.nextcloud.android.beta/)
## المشاكل المعروفة والأسئلة الشائعة
### الإشعارات الفورية لا تعمل في نسخ F-Droid
بسبب اعتمادها على خدمات Google Play، لا تعمل الإشعارات الفورية في نسخ F-Droid حاليًا.
+3 -2
View File
@@ -116,8 +116,8 @@ android {
defaultConfig {
applicationId = "com.nextcloud.client"
minSdk = 27
targetSdk = 35
compileSdk = 35
targetSdk = 36
compileSdk = 36
buildConfigField "boolean", "CI", ciBuild.toString()
buildConfigField "boolean", "RUNTIME_PERF_ANALYSIS", perfAnalysis.toString()
@@ -296,6 +296,7 @@ dependencies {
// region Jetpack Compose
implementation(platform(libs.compose.bom))
implementation(libs.material.icons.core)
implementation(libs.compose.ui)
implementation(libs.compose.ui.graphics)
implementation(libs.compose.material3)
@@ -119,7 +119,8 @@ class SyncedFoldersActivityIT : AbstractIT() {
onIdleSync {
EspressoIdlingResource.increment()
val dialog = sut.buildPowerCheckDialog()
dialog.show()
sut.showPowerCheckDialog()
EspressoIdlingResource.decrement()
val screenShotName = createName(testClassName + "_" + "showPowerCheckDialog", "")
@@ -18,6 +18,7 @@ import com.nextcloud.client.account.CurrentAccountProvider;
import com.nextcloud.client.account.User;
import com.nextcloud.client.account.UserAccountManager;
import com.nextcloud.client.account.UserAccountManagerImpl;
import com.nextcloud.client.database.entity.UploadEntityKt;
import com.nextcloud.test.RandomStringGenerator;
import com.owncloud.android.AbstractIT;
import com.owncloud.android.MainApp;
@@ -108,7 +109,7 @@ public class UploadStorageManagerTest extends AbstractIT {
OCUpload upload = createUpload(account);
uploads.add(upload);
uploadsStorageManager.storeUpload(upload);
uploadsStorageManager.uploadDao.insertOrReplace(UploadEntityKt.toUploadEntity(upload));
}
OCUpload[] storedUploads = uploadsStorageManager.getAllStoredUploads();
@@ -151,17 +152,14 @@ public class UploadStorageManagerTest extends AbstractIT {
account.name);
corruptUpload.setLocalPath(null);
uploadsStorageManager.storeUpload(corruptUpload);
uploadsStorageManager.uploadDao.insertOrReplace(UploadEntityKt.toUploadEntity(corruptUpload));
uploadsStorageManager.getAllStoredUploads();
}
@Test
public void getById() {
OCUpload upload = createUpload(account);
long id = uploadsStorageManager.storeUpload(upload);
long id = uploadsStorageManager.uploadDao.insertOrReplace(UploadEntityKt.toUploadEntity(upload));
OCUpload newUpload = uploadsStorageManager.getUploadById(id);
assertNotNull(newUpload);
@@ -178,7 +176,7 @@ public class UploadStorageManagerTest extends AbstractIT {
private void insertUploads(Account account, int rowsToInsert) {
for (int i = 0; i < rowsToInsert; i++) {
uploadsStorageManager.storeUpload(createUpload(account));
uploadsStorageManager.uploadDao.insertOrReplace(UploadEntityKt.toUploadEntity(createUpload(account)));
}
}
@@ -27,8 +27,8 @@ public class FileDisplayActivityTest extends AbstractIT {
InstrumentationRegistry.getInstrumentation().runOnMainSync(() -> {
Activity activity =
ActivityLifecycleMonitorRegistry.getInstance().getActivitiesInStage(RESUMED).iterator().next();
if (activity instanceof WhatsNewActivity) {
activity.onBackPressed();
if (activity instanceof WhatsNewActivity whatsNewActivity) {
whatsNewActivity.getOnBackPressedDispatcher().onBackPressed();
}
});
scenario.recreate();
@@ -822,7 +822,7 @@ class FileDetailSharingFragmentIT : AbstractIT() {
val processFragment =
activity.supportFragmentManager.findFragmentByTag(FileDetailsSharingProcessFragment.TAG) as
FileDetailsSharingProcessFragment
processFragment.onBackPressed()
processFragment.activity?.onBackPressedDispatcher?.onBackPressed()
}
}
}
+4 -1
View File
@@ -121,7 +121,7 @@
android:requestLegacyExternalStorage="true"
android:roundIcon="@mipmap/ic_launcher"
android:supportsRtl="true"
android:enableOnBackInvokedCallback="false"
android:enableOnBackInvokedCallback="true"
android:theme="@style/Theme.ownCloud.Toolbar"
android:usesCleartextTraffic="true"
tools:ignore="UnusedAttribute"
@@ -353,6 +353,7 @@
<activity
android:name=".ui.activity.SettingsActivity"
android:exported="false"
android:enableOnBackInvokedCallback="false"
android:theme="@style/PreferenceTheme" />
<activity
android:name=".ui.preview.PreviewImageActivity"
@@ -584,6 +585,8 @@
</intent-filter>
</receiver>
<receiver android:name="com.nextcloud.client.jobs.folderDownload.FolderDownloadWorkerReceiver" android:exported="false" />
<activity
android:name=".ui.activity.CopyToClipboardActivity"
android:exported="false"
@@ -9,28 +9,12 @@
*/
package com.nextcloud.android.sso;
import org.apache.commons.httpclient.methods.ByteArrayRequestEntity;
import org.apache.commons.httpclient.methods.EntityEnclosingMethod;
import org.apache.commons.httpclient.methods.PostMethod;
import org.apache.commons.httpclient.methods.RequestEntity;
import org.apache.commons.httpclient.util.EncodingUtil;
import java.util.Vector;
public class PatchMethod extends PostMethod {
/**
* The buffered request body consisting of <code>NameValuePair</code>s.
*/
private Vector params = new Vector();
/**
* No-arg constructor.
*/
public PatchMethod() {
super();
}
/**
* Constructor specifying a URI.
*
@@ -58,11 +42,7 @@ public class PatchMethod extends PostMethod {
* @since 2.0beta1
*/
protected boolean hasRequestContent() {
if (!this.params.isEmpty()) {
return true;
} else {
return super.hasRequestContent();
}
return super.hasRequestContent();
}
/**
@@ -71,7 +51,6 @@ public class PatchMethod extends PostMethod {
* @since 2.0beta1
*/
protected void clearRequestBody() {
this.params.clear();
super.clearRequestBody();
}
@@ -82,19 +61,6 @@ public class PatchMethod extends PostMethod {
* @since 3.0
*/
protected RequestEntity generateRequestEntity() {
if (!this.params.isEmpty()) {
// Use a ByteArrayRequestEntity instead of a StringRequestEntity.
// This is to avoid potential encoding issues. Form url encoded strings
// are ASCII by definition but the content type may not be. Treating the content
// as bytes allows us to keep the current charset without worrying about how
// this charset will effect the encoding of the form url encoded string.
String content = EncodingUtil.formUrlEncode(getParameters(), getRequestCharSet());
return new ByteArrayRequestEntity(
EncodingUtil.getAsciiBytes(content),
FORM_URL_ENCODED_CONTENT_TYPE
);
} else {
return super.generateRequestEntity();
}
return super.generateRequestEntity();
}
}
@@ -17,15 +17,6 @@ import com.owncloud.android.utils.MimeType
@Suppress("TooManyFunctions")
@Dao
interface FileDao {
@Query(
"""
SELECT DISTINCT parent
FROM filelist
WHERE path IN (:subfilePaths)
"""
)
fun getParentIdsOfSubfiles(subfilePaths: List<String>): List<Long>
@Update
fun update(entity: FileEntity)
@@ -9,21 +9,24 @@ package com.nextcloud.client.database.dao
import androidx.room.Dao
import androidx.room.Query
import com.nextcloud.client.database.entity.FilesystemEntity
import com.owncloud.android.db.ProviderMeta
@Dao
interface FileSystemDao {
@Query(
"""
SELECT ${ProviderMeta.ProviderTableMeta.FILESYSTEM_FILE_LOCAL_PATH}
SELECT *
FROM ${ProviderMeta.ProviderTableMeta.FILESYSTEM_TABLE_NAME}
WHERE ${ProviderMeta.ProviderTableMeta.FILESYSTEM_SYNCED_FOLDER_ID} = :syncedFolderId
AND ${ProviderMeta.ProviderTableMeta.FILESYSTEM_FILE_SENT_FOR_UPLOAD} = 0
AND ${ProviderMeta.ProviderTableMeta.FILESYSTEM_FILE_IS_FOLDER} = 0
AND ${ProviderMeta.ProviderTableMeta._ID} > :lastId
ORDER BY ${ProviderMeta.ProviderTableMeta._ID}
LIMIT :limit
"""
)
suspend fun getAutoUploadFiles(syncedFolderId: String): List<String>
suspend fun getAutoUploadFilesEntities(syncedFolderId: String, limit: Int, lastId: Int): List<FilesystemEntity>
@Query(
"""
@@ -8,6 +8,8 @@
package com.nextcloud.client.database.dao
import androidx.room.Dao
import androidx.room.Insert
import androidx.room.OnConflictStrategy
import androidx.room.Query
import com.nextcloud.client.database.entity.UploadEntity
import com.owncloud.android.db.ProviderMeta.ProviderTableMeta
@@ -27,4 +29,52 @@ interface UploadDao {
ProviderTableMeta.UPLOADS_ACCOUNT_NAME + " = :accountName"
)
fun getUploadsByIds(ids: LongArray, accountName: String): List<UploadEntity>
@Query(
"SELECT * FROM ${ProviderTableMeta.UPLOADS_TABLE_NAME} " +
"WHERE ${ProviderTableMeta.UPLOADS_REMOTE_PATH} = :remotePath LIMIT 1"
)
fun getByRemotePath(remotePath: String): UploadEntity?
@Query(
"DELETE FROM ${ProviderTableMeta.UPLOADS_TABLE_NAME} " +
"WHERE ${ProviderTableMeta.UPLOADS_ACCOUNT_NAME} = :accountName " +
"AND ${ProviderTableMeta.UPLOADS_REMOTE_PATH} = :remotePath"
)
fun deleteByAccountAndRemotePath(accountName: String, remotePath: String)
@Query(
"SELECT * FROM " + ProviderTableMeta.UPLOADS_TABLE_NAME +
" WHERE " + ProviderTableMeta._ID + " = :id AND " +
ProviderTableMeta.UPLOADS_ACCOUNT_NAME + " = :accountName " +
"LIMIT 1"
)
fun getUploadById(id: Long, accountName: String): UploadEntity?
@Insert(onConflict = OnConflictStrategy.Companion.REPLACE)
fun insertOrReplace(entity: UploadEntity): Long
@Query(
"SELECT * FROM " + ProviderTableMeta.UPLOADS_TABLE_NAME +
" WHERE " + ProviderTableMeta.UPLOADS_ACCOUNT_NAME + " = :accountName AND " +
ProviderTableMeta.UPLOADS_LOCAL_PATH + " = :localPath AND " +
ProviderTableMeta.UPLOADS_REMOTE_PATH + " = :remotePath " +
"LIMIT 1"
)
fun getUploadByAccountAndPaths(accountName: String, localPath: String, remotePath: String): UploadEntity?
@Query(
"UPDATE ${ProviderTableMeta.UPLOADS_TABLE_NAME} " +
"SET ${ProviderTableMeta.UPLOADS_STATUS} = :status " +
"WHERE ${ProviderTableMeta.UPLOADS_REMOTE_PATH} = :remotePath " +
"AND ${ProviderTableMeta.UPLOADS_ACCOUNT_NAME} = :accountName"
)
suspend fun updateStatus(remotePath: String, accountName: String, status: Int): Int
@Query(
"SELECT * FROM ${ProviderTableMeta.UPLOADS_TABLE_NAME} " +
"WHERE ${ProviderTableMeta.UPLOADS_ACCOUNT_NAME} = :accountName " +
"AND ${ProviderTableMeta.UPLOADS_STATUS} = :status"
)
suspend fun getUploadsByStatus(accountName: String, status: Int): List<UploadEntity>
}
@@ -1,6 +1,7 @@
/*
* Nextcloud - Android Client
*
* SPDX-FileCopyrightText: 2025 Alper Ozturk <[email protected]>
* SPDX-FileCopyrightText: 2022 Álvaro Brey <[email protected]>
* SPDX-FileCopyrightText: 2022 Nextcloud GmbH
* SPDX-License-Identifier: AGPL-3.0-or-later OR GPL-2.0-only
@@ -78,3 +79,33 @@ fun UploadEntity.toOCUpload(capability: OCCapability? = null): OCUpload {
return upload
}
fun OCUpload.toUploadEntity(): UploadEntity {
val id = if (uploadId == -1L) {
// needed for the insert new records to the db so that insert DAO function returns new generated id
null
} else {
uploadId
}
return UploadEntity(
id = id?.toInt(),
localPath = localPath,
remotePath = remotePath,
accountName = accountName,
fileSize = fileSize,
status = uploadStatus?.value,
localBehaviour = localAction,
nameCollisionPolicy = nameCollisionPolicy?.serialize(),
isCreateRemoteFolder = if (isCreateRemoteFolder) 1 else 0,
// uploadEndTimestamp may overflow max int capacity since it is conversion from long to int. coerceAtMost needed
uploadEndTimestamp = uploadEndTimestamp.coerceAtMost(Int.MAX_VALUE.toLong()).toInt(),
lastResult = lastResult?.value,
createdBy = createdBy,
isWifiOnly = if (isUseWifiOnly) 1 else 0,
isWhileChargingOnly = if (isWhileChargingOnly) 1 else 0,
folderUnlockToken = folderUnlockToken,
uploadTime = null
)
}
@@ -17,6 +17,7 @@ import com.nextcloud.client.integrations.IntegrationsModule;
import com.nextcloud.client.jobs.JobsModule;
import com.nextcloud.client.jobs.download.FileDownloadHelper;
import com.nextcloud.client.jobs.offlineOperations.receiver.OfflineOperationReceiver;
import com.nextcloud.client.jobs.folderDownload.FolderDownloadWorkerReceiver;
import com.nextcloud.client.jobs.upload.FileUploadBroadcastReceiver;
import com.nextcloud.client.jobs.upload.FileUploadHelper;
import com.nextcloud.client.media.BackgroundPlayerService;
@@ -75,6 +76,8 @@ public interface AppComponent {
void inject(OfflineOperationReceiver offlineOperationReceiver);
void inject(FolderDownloadWorkerReceiver folderDownloadWorkerReceiver);
@Component.Builder
interface Builder {
@BindsInstance
@@ -104,7 +104,7 @@ class DocumentScanActivity :
true
}
android.R.id.home -> {
onBackPressed()
onBackPressedDispatcher.onBackPressed()
true
}
else -> false
@@ -10,6 +10,7 @@ import android.content.Context
import android.content.Intent
import android.os.Bundle
import android.view.MenuItem
import androidx.activity.OnBackPressedCallback
import androidx.lifecycle.Observer
import androidx.lifecycle.ViewModelProvider
import com.nextcloud.client.di.Injectable
@@ -46,6 +47,7 @@ class EtmActivity :
onPageChanged(it)
}
)
handleOnBackPressed()
}
override fun onOptionsItemSelected(item: MenuItem): Boolean = when (item.itemId) {
@@ -58,11 +60,17 @@ class EtmActivity :
else -> super.onOptionsItemSelected(item)
}
@Deprecated("Deprecated in Java")
override fun onBackPressed() {
if (!vm.onBackPressed()) {
super.onBackPressed()
}
private fun handleOnBackPressed() {
onBackPressedDispatcher.addCallback(object : OnBackPressedCallback(true) {
override fun handleOnBackPressed() {
val handledByVm = vm.onBackPressed()
if (!handledByVm) {
isEnabled = false
onBackPressedDispatcher.onBackPressed()
}
}
})
}
private fun onPageChanged(page: EtmMenuEntry?) {
@@ -27,6 +27,7 @@ import com.nextcloud.client.jobs.autoUpload.FileSystemRepository
import com.nextcloud.client.jobs.download.FileDownloadWorker
import com.nextcloud.client.jobs.metadata.MetadataWorker
import com.nextcloud.client.jobs.offlineOperations.OfflineOperationsWorker
import com.nextcloud.client.jobs.folderDownload.FolderDownloadWorker
import com.nextcloud.client.jobs.upload.FileUploadWorker
import com.nextcloud.client.logger.Logger
import com.nextcloud.client.network.ConnectivityService
@@ -102,6 +103,7 @@ class BackgroundJobFactory @Inject constructor(
OfflineOperationsWorker::class -> createOfflineOperationsWorker(context, workerParameters)
InternalTwoWaySyncWork::class -> createInternalTwoWaySyncWork(context, workerParameters)
MetadataWorker::class -> createMetadataWorker(context, workerParameters)
FolderDownloadWorker::class -> createFolderDownloadWorker(context, workerParameters)
else -> null // caller falls back to default factory
}
}
@@ -287,4 +289,12 @@ class BackgroundJobFactory @Inject constructor(
params,
accountManager.user
)
private fun createFolderDownloadWorker(context: Context, params: WorkerParameters): FolderDownloadWorker =
FolderDownloadWorker(
accountManager,
context,
viewThemeUtils.get(),
params
)
}
@@ -140,12 +140,10 @@ interface BackgroundJobManager {
fun startFilesUploadJob(user: User, uploadIds: LongArray, showSameFileAlreadyExistsNotification: Boolean)
fun getFileUploads(user: User): LiveData<List<JobInfo>>
fun cancelFilesUploadJob(user: User)
fun isStartFileUploadJobScheduled(user: User): Boolean
fun isStartFileUploadJobScheduled(accountName: String): Boolean
fun cancelFilesDownloadJob(user: User, fileId: Long)
fun isStartFileDownloadJobScheduled(user: User, fileId: Long): Boolean
@Suppress("LongParameterList")
fun startFileDownloadJob(
user: User,
@@ -173,4 +171,6 @@ interface BackgroundJobManager {
fun scheduleInternal2WaySync(intervalMinutes: Long)
fun cancelAllFilesDownloadJobs()
fun startMetadataSyncJob(currentDirPath: String)
fun downloadFolder(folder: OCFile, accountName: String)
fun cancelFolderDownload()
}
@@ -28,6 +28,7 @@ import com.nextcloud.client.di.Injectable
import com.nextcloud.client.documentscan.GeneratePdfFromImagesWork
import com.nextcloud.client.jobs.autoUpload.AutoUploadWorker
import com.nextcloud.client.jobs.download.FileDownloadWorker
import com.nextcloud.client.jobs.folderDownload.FolderDownloadWorker
import com.nextcloud.client.jobs.metadata.MetadataWorker
import com.nextcloud.client.jobs.offlineOperations.OfflineOperationsWorker
import com.nextcloud.client.jobs.upload.FileUploadHelper
@@ -93,6 +94,7 @@ internal class BackgroundJobManagerImpl(
const val JOB_PERIODIC_OFFLINE_OPERATIONS = "periodic_offline_operations"
const val JOB_PERIODIC_HEALTH_STATUS = "periodic_health_status"
const val JOB_IMMEDIATE_HEALTH_STATUS = "immediate_health_status"
const val JOB_DOWNLOAD_FOLDER = "download_folder"
const val JOB_METADATA_SYNC = "metadata_sync"
const val JOB_INTERNAL_TWO_WAY_SYNC = "internal_two_way_sync"
@@ -635,10 +637,10 @@ internal class BackgroundJobManagerImpl(
workManager.enqueue(request)
}
private fun startFileUploadJobTag(user: User): String = JOB_FILES_UPLOAD + user.accountName
private fun startFileUploadJobTag(accountName: String): String = JOB_FILES_UPLOAD + accountName
override fun isStartFileUploadJobScheduled(user: User): Boolean =
workManager.isWorkScheduled(startFileUploadJobTag(user))
override fun isStartFileUploadJobScheduled(accountName: String): Boolean =
workManager.isWorkScheduled(startFileUploadJobTag(accountName))
/**
* This method supports initiating uploads for various scenarios, including:
@@ -656,7 +658,7 @@ internal class BackgroundJobManagerImpl(
defaultDispatcherScope.launch {
val batchSize = FileUploadHelper.MAX_FILE_COUNT
val batches = uploadIds.toList().chunked(batchSize)
val tag = startFileUploadJobTag(user)
val tag = startFileUploadJobTag(user.accountName)
val constraints = Constraints.Builder()
.setRequiredNetworkType(NetworkType.CONNECTED)
@@ -702,9 +704,6 @@ internal class BackgroundJobManagerImpl(
private fun startFileDownloadJobTag(user: User, fileId: Long): String =
JOB_FOLDER_DOWNLOAD + user.accountName + fileId
override fun isStartFileDownloadJobScheduled(user: User, fileId: Long): Boolean =
workManager.isWorkScheduled(startFileDownloadJobTag(user, fileId))
override fun startFileDownloadJob(
user: User,
file: OCFile,
@@ -824,4 +823,28 @@ internal class BackgroundJobManagerImpl(
workManager.enqueueUniquePeriodicWork(JOB_INTERNAL_TWO_WAY_SYNC, ExistingPeriodicWorkPolicy.UPDATE, request)
}
override fun downloadFolder(folder: OCFile, accountName: String) {
val constraints = Constraints.Builder()
.setRequiredNetworkType(NetworkType.CONNECTED)
.setRequiresStorageNotLow(true)
.build()
val data = Data.Builder()
.putLong(FolderDownloadWorker.FOLDER_ID, folder.fileId)
.putString(FolderDownloadWorker.ACCOUNT_NAME, accountName)
.build()
val request = oneTimeRequestBuilder(FolderDownloadWorker::class, JOB_DOWNLOAD_FOLDER)
.addTag(JOB_DOWNLOAD_FOLDER)
.setInputData(data)
.setConstraints(constraints)
.build()
workManager.enqueueUniqueWork(JOB_DOWNLOAD_FOLDER, ExistingWorkPolicy.APPEND_OR_REPLACE, request)
}
override fun cancelFolderDownload() {
workManager.cancelAllWorkByTag(JOB_DOWNLOAD_FOLDER)
}
}
@@ -30,6 +30,7 @@ import kotlinx.coroutines.withContext
*
* This job must not be started on API < 24.
*/
@Suppress("TooGenericExceptionCaught")
class ContentObserverWork(
private val context: Context,
private val params: WorkerParameters,
@@ -44,7 +45,6 @@ class ContentObserverWork(
private const val NOTIFICATION_ID = 774
}
@Suppress("TooGenericExceptionCaught")
override suspend fun doWork(): Result = withContext(Dispatchers.IO) {
val workerName = BackgroundJobManagerImpl.formatClassTag(this@ContentObserverWork::class)
backgroundJobManager.logStartOfWorker(workerName)
@@ -17,12 +17,16 @@ import androidx.work.CoroutineWorker
import androidx.work.WorkerParameters
import com.nextcloud.client.account.User
import com.nextcloud.client.account.UserAccountManager
import com.nextcloud.client.database.entity.UploadEntity
import com.nextcloud.client.database.entity.toOCUpload
import com.nextcloud.client.database.entity.toUploadEntity
import com.nextcloud.client.device.PowerManagementService
import com.nextcloud.client.jobs.BackgroundJobManager
import com.nextcloud.client.jobs.upload.FileUploadWorker
import com.nextcloud.client.network.ConnectivityService
import com.nextcloud.client.preferences.SubFolderRule
import com.nextcloud.utils.ForegroundServiceHelper
import com.nextcloud.utils.extensions.updateStatus
import com.owncloud.android.R
import com.owncloud.android.datamodel.ArbitraryDataProviderImpl
import com.owncloud.android.datamodel.FileDataStorageManager
@@ -41,7 +45,6 @@ import com.owncloud.android.ui.notifications.NotificationUtils
import com.owncloud.android.utils.FileStorageUtils
import com.owncloud.android.utils.FilesSyncHelper
import com.owncloud.android.utils.MimeType
import com.owncloud.android.utils.MimeTypeUtil
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.withContext
import java.io.File
@@ -235,37 +238,19 @@ class AutoUploadWorker(
private fun getUserOrReturn(syncedFolder: SyncedFolder): User? {
val optionalUser = userAccountManager.getUser(syncedFolder.account)
if (!optionalUser.isPresent) {
Log_OC.w(TAG, "uploadFilesFromFolder skipped user not present")
Log_OC.w(TAG, "user not present")
return null
}
return optionalUser.get()
}
private fun buildPathsAndMimes(
paths: Set<String>,
syncedFolder: SyncedFolder,
dateFormat: SimpleDateFormat
): List<Triple<String, String, String>> {
val lightVersion = context.resources.getBoolean(R.bool.syncedFolder_light)
val currentLocale = context.resources.configuration.locales[0]
return paths.map { path ->
val file = File(path)
val localPath = file.absolutePath
val remotePath =
getRemotePath(file, syncedFolder, dateFormat, lightVersion, context.resources, currentLocale)
val mimeType = MimeTypeUtil.getBestMimeTypeByFilename(localPath)
Triple(localPath, remotePath, mimeType)
}
}
@Suppress("DEPRECATION")
private fun getUploadSettings(syncedFolder: SyncedFolder): Triple<Boolean, Boolean, Int> {
val lightVersion = context.resources.getBoolean(R.bool.syncedFolder_light)
val accountName = syncedFolder.account
return if (lightVersion) {
Log_OC.d(TAG, "uploadFilesFromFolder light version is used")
Log_OC.d(TAG, "light version is used")
val arbitraryDataProvider = ArbitraryDataProviderImpl(context)
val needsCharging = context.resources.getBoolean(R.bool.syncedFolder_light_on_charging)
val needsWifi = arbitraryDataProvider.getBooleanValue(
@@ -277,7 +262,7 @@ class AutoUploadWorker(
Log_OC.d(TAG, "upload action is: $uploadAction")
Triple(needsCharging, needsWifi, uploadAction)
} else {
Log_OC.d(TAG, "getUploadSettings not light version is used")
Log_OC.d(TAG, "not light version is used")
Triple(syncedFolder.isChargingOnly, syncedFolder.isWifiOnly, syncedFolder.uploadAction)
}
}
@@ -286,50 +271,118 @@ class AutoUploadWorker(
private suspend fun uploadFiles(syncedFolder: SyncedFolder) = withContext(Dispatchers.IO) {
val dateFormat = prepareDateFormat()
val user = getUserOrReturn(syncedFolder) ?: return@withContext
val paths = repository.getAutoUploadFiles(syncedFolder)
if (paths.isEmpty()) {
Log_OC.w(TAG, "uploadFiles skipped paths is empty")
return@withContext
}
val pathsAndMimes = buildPathsAndMimes(paths, syncedFolder, dateFormat)
val (needsCharging, needsWifi, uploadAction) = getUploadSettings(syncedFolder)
val ocAccount = OwnCloudAccount(user.toPlatformAccount(), context)
val client = OwnCloudClientManagerFactory.getDefaultSingleton()
.getClientFor(ocAccount, context)
val lightVersion = context.resources.getBoolean(R.bool.syncedFolder_light)
val currentLocale = context.resources.configuration.locales[0]
pathsAndMimes.forEach { (localPath, remotePath, _) ->
try {
Log_OC.d(TAG, "creating oc upload for ${user.accountName}")
val upload = OCUpload(localPath, remotePath, user.accountName).apply {
nameCollisionPolicy = syncedFolder.nameCollisionPolicy
isUseWifiOnly = needsWifi
isWhileChargingOnly = needsCharging
uploadStatus = UploadsStorageManager.UploadStatus.UPLOAD_IN_PROGRESS
createdBy = UploadFileOperation.CREATED_AS_INSTANT_PICTURE
isCreateRemoteFolder = true
localAction = uploadAction
var lastId = 0
while (true) {
val filePathsWithIds = repository.getFilePathsWithIds(syncedFolder, lastId)
if (filePathsWithIds.isEmpty()) {
Log_OC.w(TAG, "no more files to upload at lastId: $lastId")
break
}
Log_OC.d(TAG, "Processing batch: lastId=$lastId, count=${filePathsWithIds.size}")
filePathsWithIds.forEach { (path, id) ->
val file = File(path)
val localPath = file.absolutePath
val remotePath = getRemotePath(
file,
syncedFolder,
dateFormat,
lightVersion,
context.resources,
currentLocale
)
try {
var (uploadEntity, upload) = createEntityAndUpload(user, localPath, remotePath)
try {
// Insert/update to IN_PROGRESS state before starting upload
val generatedId = uploadsStorageManager.uploadDao.insertOrReplace(uploadEntity)
uploadEntity = uploadEntity.copy(id = generatedId.toInt())
upload.uploadId = generatedId
val operation = createUploadFileOperation(upload, user)
Log_OC.d(TAG, "🕒 uploading: $localPath, id: $generatedId")
val result = operation.execute(client)
uploadsStorageManager.updateStatus(uploadEntity, result.isSuccess)
if (result.isSuccess) {
repository.markFileAsUploaded(localPath, syncedFolder)
Log_OC.d(TAG, "✅ upload completed: $localPath")
} else {
Log_OC.e(
TAG,
"❌ upload failed $localPath (${upload.accountName}): ${result.logMessage}"
)
}
} catch (e: Exception) {
uploadsStorageManager.updateStatus(
uploadEntity,
UploadsStorageManager.UploadStatus.UPLOAD_FAILED
)
Log_OC.e(
TAG,
"Exception during upload file, localPath: $localPath, remotePath: $remotePath," +
" exception: $e"
)
}
} catch (e: Exception) {
Log_OC.e(
TAG,
"Exception uploadFiles during creating entity and upload, localPath: $localPath, " +
"remotePath: $remotePath, exception: $e"
)
}
uploadsStorageManager.storeUpload(upload)
val operation = createUploadFileOperation(upload, user)
Log_OC.d(TAG, "🕒 uploading: $localPath")
val result = operation.execute(client)
if (result.isSuccess) {
repository.markFileAsUploaded(localPath, syncedFolder)
Log_OC.d(TAG, "✅ auto upload completed: $localPath")
} else {
Log_OC.e(TAG, "❌ auto upload failed: $localPath")
}
} catch (e: Exception) {
Log_OC.e(TAG, "Exception uploadFiles, localPath: $localPath, remotePath: $remotePath, exception: $e")
// update last id so upload can continue where it left
lastId = id
}
}
}
private fun createEntityAndUpload(user: User, localPath: String, remotePath: String): Pair<UploadEntity, OCUpload> {
val (needsCharging, needsWifi, uploadAction) = getUploadSettings(syncedFolder)
Log_OC.d(TAG, "creating oc upload for ${user.accountName}")
// Get or create upload entity
var uploadEntity = uploadsStorageManager.uploadDao.getUploadByAccountAndPaths(
localPath = localPath,
remotePath = remotePath,
accountName = user.accountName
)
val upload: OCUpload
if (uploadEntity != null) {
// Existing upload - convert and update status
upload = uploadEntity.toOCUpload(null)
upload.uploadStatus = UploadsStorageManager.UploadStatus.UPLOAD_IN_PROGRESS
uploadEntity = upload.toUploadEntity()
} else {
// New upload - create with all settings
upload = OCUpload(localPath, remotePath, user.accountName).apply {
nameCollisionPolicy = syncedFolder.nameCollisionPolicy
isUseWifiOnly = needsWifi
isWhileChargingOnly = needsCharging
uploadStatus = UploadsStorageManager.UploadStatus.UPLOAD_IN_PROGRESS
createdBy = UploadFileOperation.CREATED_AS_INSTANT_PICTURE
isCreateRemoteFolder = true
localAction = uploadAction
}
uploadEntity = upload.toUploadEntity()
}
return uploadEntity to upload
}
private fun createUploadFileOperation(upload: OCUpload, user: User): UploadFileOperation = UploadFileOperation(
uploadsStorageManager,
connectivityService,
@@ -15,28 +15,41 @@ import java.io.File
class FileSystemRepository(private val dao: FileSystemDao) {
suspend fun getAutoUploadFiles(syncedFolder: SyncedFolder): Set<String> {
companion object {
private const val TAG = "FilesystemRepository"
const val BATCH_SIZE = 50
}
@Suppress("NestedBlockDepth")
suspend fun getFilePathsWithIds(syncedFolder: SyncedFolder, lastId: Int): List<Pair<String, Int>> {
val syncedFolderId = syncedFolder.id.toString()
Log_OC.d(TAG, "Fetching candidate files for syncedFolderId = $syncedFolderId")
val candidatePaths = dao.getAutoUploadFiles(syncedFolderId)
val localPathsToUpload = mutableSetOf<String>()
val entities = dao.getAutoUploadFilesEntities(syncedFolderId, BATCH_SIZE, lastId)
val filtered = mutableListOf<Pair<String, Int>>()
candidatePaths.forEach { path ->
val file = File(path)
if (!file.exists()) {
Log_OC.w(TAG, "Ignoring file for upload (doesn't exist): $path")
} else if (!SyncedFolderUtils.isQualifiedFolder(file.parent)) {
Log_OC.w(TAG, "Ignoring file for upload (unqualified folder): $path")
} else if (!SyncedFolderUtils.isFileNameQualifiedForAutoUpload(file.name)) {
Log_OC.w(TAG, "Ignoring file for upload (unqualified file): $path")
} else {
Log_OC.d(TAG, "Adding path to upload: $path")
localPathsToUpload.add(path)
entities.forEach {
it.localPath?.let { path ->
val file = File(path)
if (!file.exists()) {
Log_OC.w(TAG, "Ignoring file for upload (doesn't exist): $path")
} else if (!SyncedFolderUtils.isQualifiedFolder(file.parent)) {
Log_OC.w(TAG, "Ignoring file for upload (unqualified folder): $path")
} else if (!SyncedFolderUtils.isFileNameQualifiedForAutoUpload(file.name)) {
Log_OC.w(TAG, "Ignoring file for upload (unqualified file): $path")
} else {
Log_OC.d(TAG, "Adding path to upload: $path")
if (it.id != null) {
filtered.add(path to it.id)
} else {
Log_OC.w(TAG, "cant adding path to upload, id is null")
}
}
}
}
return localPathsToUpload
return filtered
}
@Suppress("TooGenericExceptionCaught")
@@ -50,8 +63,4 @@ class FileSystemRepository(private val dao: FileSystemDao) {
Log_OC.e(TAG, "Error marking file as uploaded: ${e.message}", e)
}
}
companion object {
private const val TAG = "FilesystemRepository"
}
}
@@ -9,10 +9,12 @@ package com.nextcloud.client.jobs.download
import com.nextcloud.client.account.User
import com.nextcloud.client.jobs.BackgroundJobManager
import com.nextcloud.client.jobs.folderDownload.FolderDownloadWorker
import com.owncloud.android.MainApp
import com.owncloud.android.datamodel.FileDataStorageManager
import com.owncloud.android.datamodel.OCFile
import com.owncloud.android.datamodel.UploadsStorageManager
import com.owncloud.android.lib.common.utils.Log_OC
import com.owncloud.android.operations.DownloadFileOperation
import com.owncloud.android.operations.DownloadType
import com.owncloud.android.utils.MimeTypeUtil
@@ -29,6 +31,7 @@ class FileDownloadHelper {
companion object {
private var instance: FileDownloadHelper? = null
private const val TAG = "FileDownloadHelper"
fun instance(): FileDownloadHelper = instance ?: synchronized(this) {
instance ?: FileDownloadHelper().also { instance = it }
@@ -44,17 +47,11 @@ class FileDownloadHelper {
return false
}
val fileStorageManager = FileDataStorageManager(user, MainApp.getAppContext().contentResolver)
val topParentId = fileStorageManager.getTopParentId(file)
val isJobScheduled = backgroundJobManager.isStartFileDownloadJobScheduled(user, file.fileId)
return isJobScheduled ||
if (file.isFolder) {
FileDownloadWorker.isDownloadingFolder(file.fileId) &&
backgroundJobManager.isStartFileDownloadJobScheduled(user, topParentId)
} else {
FileDownloadWorker.isDownloading(user.accountName, file.fileId)
}
return if (file.isFolder) {
FolderDownloadWorker.isDownloading(file.fileId)
} else {
FileDownloadWorker.isDownloading(user.accountName, file.fileId)
}
}
fun cancelPendingOrCurrentDownloads(user: User?, files: List<OCFile>?) {
@@ -141,4 +138,14 @@ class FileDownloadHelper {
conflictUploadId
)
}
fun downloadFolder(folder: OCFile?, accountName: String) {
if (folder == null) {
Log_OC.e(TAG, "folder cannot be null, cant sync")
return
}
backgroundJobManager.downloadFolder(folder, accountName)
}
fun cancelFolderDownload() = backgroundJobManager.cancelFolderDownload()
}
@@ -24,7 +24,6 @@ import com.nextcloud.client.account.UserAccountManager
import com.nextcloud.model.WorkerState
import com.nextcloud.model.WorkerStateLiveData
import com.nextcloud.utils.ForegroundServiceHelper
import com.nextcloud.utils.extensions.getParentIdsOfSubfiles
import com.nextcloud.utils.extensions.getPercent
import com.owncloud.android.R
import com.owncloud.android.datamodel.FileDataStorageManager
@@ -45,7 +44,6 @@ import com.owncloud.android.utils.theme.ViewThemeUtils
import java.util.AbstractList
import java.util.Optional
import java.util.Vector
import java.util.concurrent.ConcurrentHashMap
import kotlin.random.Random
@Suppress("LongParameterList", "TooManyFunctions")
@@ -63,7 +61,6 @@ class FileDownloadWorker(
private val TAG = FileDownloadWorker::class.java.simpleName
private val pendingDownloads = IndexedForest<DownloadFileOperation>()
private val pendingFolderDownloads: MutableSet<Long> = ConcurrentHashMap.newKeySet<Long>()
fun cancelOperation(accountName: String, fileId: Long) {
pendingDownloads.all.forEach {
@@ -75,8 +72,6 @@ class FileDownloadWorker(
it.value?.payload?.isMatching(accountName, fileId) == true
}
fun isDownloadingFolder(id: Long): Boolean = pendingFolderDownloads.contains(id)
const val FILE_REMOTE_PATH = "FILE_REMOTE_PATH"
const val ACCOUNT_NAME = "ACCOUNT_NAME"
const val BEHAVIOUR = "BEHAVIOUR"
@@ -170,10 +165,6 @@ class FileDownloadWorker(
private fun getRequestDownloads(ocFile: OCFile): AbstractList<String> {
val files = getFiles(ocFile)
val filesPaths = files.map { it.remotePath }
val parentIdsOfSubFiles = fileDataStorageManager?.getParentIdsOfSubfiles(filesPaths) ?: listOf()
pendingFolderDownloads.addAll(parentIdsOfSubFiles)
val downloadType = getDownloadType()
conflictUploadId = inputData.keyValueMap[CONFLICT_UPLOAD_ID] as Long?
@@ -328,7 +319,6 @@ class FileDownloadWorker(
currentDownload?.user?.accountName,
currentDownload?.remotePath
)
pendingFolderDownloads.remove(currentDownload?.file?.parentId)
val downloadResult = result ?: RemoteOperationResult<Any?>(RuntimeException("Error downloading…"))
@@ -0,0 +1,167 @@
/*
* Nextcloud - Android Client
*
* SPDX-FileCopyrightText: 2024 Alper Ozturk <[email protected]>
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
package com.nextcloud.client.jobs.folderDownload
import android.content.Context
import androidx.work.CoroutineWorker
import androidx.work.WorkerParameters
import com.nextcloud.client.account.UserAccountManager
import com.nextcloud.client.jobs.download.FileDownloadHelper
import com.owncloud.android.datamodel.FileDataStorageManager
import com.owncloud.android.datamodel.OCFile
import com.owncloud.android.lib.common.OwnCloudClientManagerFactory
import com.owncloud.android.lib.common.utils.Log_OC
import com.owncloud.android.operations.DownloadFileOperation
import com.owncloud.android.operations.DownloadType
import com.owncloud.android.ui.helpers.FileOperationsHelper
import com.owncloud.android.utils.theme.ViewThemeUtils
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.withContext
import java.util.concurrent.ConcurrentHashMap
@Suppress("LongMethod")
class FolderDownloadWorker(
private val accountManager: UserAccountManager,
private val context: Context,
private val viewThemeUtils: ViewThemeUtils,
params: WorkerParameters
) : CoroutineWorker(context, params) {
companion object {
private const val TAG = "📂" + "FolderDownloadWorker"
const val FOLDER_ID = "FOLDER_ID"
const val ACCOUNT_NAME = "ACCOUNT_NAME"
private val pendingDownloads: MutableSet<Long> = ConcurrentHashMap.newKeySet<Long>()
fun isDownloading(id: Long): Boolean = pendingDownloads.contains(id)
}
private var notificationManager: FolderDownloadWorkerNotificationManager? = null
private lateinit var storageManager: FileDataStorageManager
@Suppress("TooGenericExceptionCaught", "ReturnCount", "DEPRECATION")
override suspend fun doWork(): Result {
val folderID = inputData.getLong(FOLDER_ID, -1)
if (folderID == -1L) {
return Result.failure()
}
val accountName = inputData.getString(ACCOUNT_NAME)
if (accountName == null) {
Log_OC.e(TAG, "failed accountName cannot be null")
return Result.failure()
}
val optionalUser = accountManager.getUser(accountName)
if (optionalUser.isEmpty) {
Log_OC.e(TAG, "failed user is not present")
return Result.failure()
}
val user = optionalUser.get()
storageManager = FileDataStorageManager(user, context.contentResolver)
val folder = storageManager.getFileById(folderID)
if (folder == null) {
Log_OC.e(TAG, "failed folder cannot be nul")
return Result.failure()
}
notificationManager = FolderDownloadWorkerNotificationManager(context, viewThemeUtils)
Log_OC.d(TAG, "🕒 started for ${user.accountName} downloading ${folder.fileName}")
val foregroundInfo = notificationManager?.getForegroundInfo(folder) ?: return Result.failure()
setForeground(foregroundInfo)
pendingDownloads.add(folder.fileId)
val downloadHelper = FileDownloadHelper.instance()
return withContext(Dispatchers.IO) {
try {
val files = getFiles(folder, storageManager)
val account = user.toOwnCloudAccount()
val client = OwnCloudClientManagerFactory.getDefaultSingleton().getClientFor(account, context)
var result = true
files.forEachIndexed { index, file ->
if (!checkDiskSize(file)) {
return@withContext Result.failure()
}
withContext(Dispatchers.Main) {
notificationManager?.showProgressNotification(
folder.fileName,
file.fileName,
index,
files.size
)
}
val operation = DownloadFileOperation(user, file, context)
val operationResult = operation.execute(client)
if (operationResult?.isSuccess == true && operation.downloadType === DownloadType.DOWNLOAD) {
getOCFile(operation)?.let { ocFile ->
downloadHelper.saveFile(ocFile, operation, storageManager)
}
}
if (!operationResult.isSuccess) {
result = false
}
}
withContext(Dispatchers.Main) {
notificationManager?.showCompletionMessage(folder.fileName, result)
}
if (result) {
Log_OC.d(TAG, "✅ completed")
Result.success()
} else {
Log_OC.d(TAG, "❌ failed")
Result.failure()
}
} catch (e: Exception) {
Log_OC.d(TAG, "❌ failed reason: $e")
Result.failure()
} finally {
pendingDownloads.remove(folder.fileId)
notificationManager?.dismiss()
}
}
}
private fun getOCFile(operation: DownloadFileOperation): OCFile? {
val file = operation.file?.fileId?.let { storageManager.getFileById(it) }
?: storageManager.getFileByDecryptedRemotePath(operation.file?.remotePath)
?: run {
Log_OC.e(TAG, "could not save ${operation.file?.remotePath}")
return null
}
return file
}
private fun getFiles(folder: OCFile, storageManager: FileDataStorageManager): List<OCFile> =
storageManager.getFolderContent(folder, false)
.filter { !it.isFolder && !it.isDown }
private suspend fun checkDiskSize(file: OCFile): Boolean {
val fileSizeInByte = file.fileLength
val availableDiskSpace = FileOperationsHelper.getAvailableSpaceOnDevice()
return if (availableDiskSpace < fileSizeInByte) {
notificationManager?.showNotAvailableDiskSpace()
false
} else {
true
}
}
}
@@ -0,0 +1,113 @@
/*
* Nextcloud - Android Client
*
* SPDX-FileCopyrightText: 2024 Alper Ozturk <[email protected]>
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
package com.nextcloud.client.jobs.folderDownload
import android.app.Notification
import android.app.PendingIntent
import android.content.Context
import android.content.Intent
import androidx.work.ForegroundInfo
import com.nextcloud.client.jobs.notification.WorkerNotificationManager
import com.nextcloud.utils.ForegroundServiceHelper
import com.owncloud.android.R
import com.owncloud.android.datamodel.ForegroundServiceType
import com.owncloud.android.datamodel.OCFile
import com.owncloud.android.ui.notifications.NotificationUtils
import com.owncloud.android.utils.theme.ViewThemeUtils
import kotlinx.coroutines.delay
import kotlin.random.Random
class FolderDownloadWorkerNotificationManager(private val context: Context, viewThemeUtils: ViewThemeUtils) :
WorkerNotificationManager(
id = NOTIFICATION_ID,
context,
viewThemeUtils,
tickerId = R.string.folder_download_worker_ticker_id,
channelId = NotificationUtils.NOTIFICATION_CHANNEL_DOWNLOAD
) {
companion object {
private const val NOTIFICATION_ID = 391
private const val MAX_PROGRESS = 100
private const val DELAY = 1000L
}
private fun getNotification(title: String, description: String? = null, progress: Int? = null): Notification =
notificationBuilder.apply {
setSmallIcon(R.drawable.ic_sync)
setContentTitle(title)
clearActions()
description?.let {
setContentText(description)
}
progress?.let {
setProgress(MAX_PROGRESS, progress, false)
addAction(
android.R.drawable.ic_menu_close_clear_cancel,
context.getString(R.string.common_cancel),
getCancelPendingIntent()
)
}
setAutoCancel(true)
}.build()
private fun getCancelPendingIntent(): PendingIntent {
val intent = Intent(context, FolderDownloadWorkerReceiver::class.java)
return PendingIntent.getBroadcast(
context,
Random.nextInt(),
intent,
PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_IMMUTABLE
)
}
fun showProgressNotification(folderName: String, filename: String, currentIndex: Int, totalFileSize: Int) {
val currentFileIndex = (currentIndex + 1)
val description = context.getString(R.string.folder_download_counter, currentFileIndex, totalFileSize, filename)
val progress = (currentFileIndex * MAX_PROGRESS) / totalFileSize
val notification = getNotification(title = folderName, description = description, progress = progress)
notificationManager.notify(NOTIFICATION_ID, notification)
}
suspend fun showCompletionMessage(folderName: String, success: Boolean) {
val title = if (success) {
context.getString(R.string.folder_download_success_notification_title, folderName)
} else {
context.getString(R.string.folder_download_error_notification_title, folderName)
}
val notification = getNotification(title = title)
notificationManager.notify(NOTIFICATION_ID, notification)
delay(DELAY)
dismiss()
}
fun getForegroundInfo(folder: OCFile): ForegroundInfo = ForegroundServiceHelper.createWorkerForegroundInfo(
NOTIFICATION_ID,
getNotification(folder.fileName, progress = 0),
ForegroundServiceType.DataSync
)
suspend fun showNotAvailableDiskSpace() {
val title = context.getString(R.string.folder_download_insufficient_disk_space_notification_title)
val notification = getNotification(title)
notificationManager.notify(NOTIFICATION_ID, notification)
delay(DELAY)
dismiss()
}
fun dismiss() {
notificationManager.cancel(NOTIFICATION_ID)
}
}
@@ -0,0 +1,25 @@
/*
* Nextcloud - Android Client
*
* SPDX-FileCopyrightText: 2024 Alper Ozturk <[email protected]>
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
package com.nextcloud.client.jobs.folderDownload
import android.content.BroadcastReceiver
import android.content.Context
import android.content.Intent
import com.nextcloud.client.jobs.BackgroundJobManager
import com.owncloud.android.MainApp
import javax.inject.Inject
class FolderDownloadWorkerReceiver : BroadcastReceiver() {
@Inject
lateinit var backgroundJobManager: BackgroundJobManager
override fun onReceive(context: Context, intent: Intent) {
MainApp.getAppComponent().inject(this)
backgroundJobManager.cancelFolderDownload()
}
}
@@ -7,11 +7,14 @@
*/
package com.nextcloud.client.jobs.upload
import android.app.Activity
import android.content.BroadcastReceiver
import android.content.Context
import android.content.Intent
import com.nextcloud.client.account.User
import com.nextcloud.client.account.UserAccountManager
import com.nextcloud.client.database.entity.toOCUpload
import com.nextcloud.client.database.entity.toUploadEntity
import com.nextcloud.client.device.BatteryStatus
import com.nextcloud.client.device.PowerManagementService
import com.nextcloud.client.jobs.BackgroundJobManager
@@ -20,6 +23,7 @@ import com.nextcloud.client.network.Connectivity
import com.nextcloud.client.network.ConnectivityService
import com.nextcloud.utils.extensions.getUploadIds
import com.owncloud.android.MainApp
import com.owncloud.android.R
import com.owncloud.android.datamodel.FileDataStorageManager
import com.owncloud.android.datamodel.OCFile
import com.owncloud.android.datamodel.UploadsStorageManager
@@ -35,13 +39,12 @@ import com.owncloud.android.lib.resources.files.ReadFileRemoteOperation
import com.owncloud.android.lib.resources.files.model.RemoteFile
import com.owncloud.android.operations.RemoveFileOperation
import com.owncloud.android.operations.UploadFileOperation
import com.owncloud.android.utils.DisplayUtils
import com.owncloud.android.utils.FileUtil
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
import java.io.File
import java.util.concurrent.CompletableFuture
import java.util.concurrent.ExecutionException
import java.util.concurrent.Semaphore
import javax.inject.Inject
@@ -205,7 +208,7 @@ class FileUploadHelper {
showSameFileAlreadyExistsNotification: Boolean = true
) {
val uploads = localPaths.mapIndexed { index, localPath ->
OCUpload(localPath, remotePaths[index], user.accountName).apply {
val result = OCUpload(localPath, remotePaths[index], user.accountName).apply {
this.nameCollisionPolicy = nameCollisionPolicy
isUseWifiOnly = requiresWifi
isWhileChargingOnly = requiresCharging
@@ -214,47 +217,30 @@ class FileUploadHelper {
isCreateRemoteFolder = createRemoteFolder
localAction = localBehavior
}
val id = uploadsStorageManager.uploadDao.insertOrReplace(result.toUploadEntity())
result.uploadId = id
result
}
uploadsStorageManager.storeUploads(uploads)
backgroundJobManager.startFilesUploadJob(user, uploads.getUploadIds(), showSameFileAlreadyExistsNotification)
}
fun removeFileUpload(remotePath: String, accountName: String) {
try {
val user = accountManager.getUser(accountName).get()
// need to update now table in mUploadsStorageManager,
// since the operation will not get to be run by FileUploader#uploadFile
uploadsStorageManager.removeUpload(accountName, remotePath)
val uploadIds = uploadsStorageManager.getCurrentUploadIds(user.accountName)
cancelAndRestartUploadJob(user, uploadIds)
} catch (e: NoSuchElementException) {
Log_OC.e(TAG, "Error cancelling current upload because user does not exist!: " + e.message)
}
uploadsStorageManager.uploadDao.deleteByAccountAndRemotePath(accountName, remotePath)
}
fun cancelFileUpload(remotePath: String, accountName: String) {
fun updateUploadStatus(remotePath: String, accountName: String, status: UploadStatus) {
ioScope.launch {
val upload = uploadsStorageManager.getUploadByRemotePath(remotePath)
if (upload != null) {
cancelFileUploads(listOf(upload), accountName)
} else {
Log_OC.e(TAG, "Error cancelling current upload because upload does not exist!")
}
uploadsStorageManager.uploadDao.updateStatus(remotePath, accountName, status.value)
}
}
fun cancelFileUploads(uploads: List<OCUpload>, accountName: String) {
for (upload in uploads) {
upload.uploadStatus = UploadStatus.UPLOAD_CANCELLED
uploadsStorageManager.updateUpload(upload)
}
try {
val user = accountManager.getUser(accountName).get()
cancelAndRestartUploadJob(user, uploads.getUploadIds())
} catch (e: NoSuchElementException) {
Log_OC.e(TAG, "Error restarting upload job because user does not exist!: " + e.message)
fun getUploadsByStatus(accountName: String, status: UploadStatus, onCompleted: (Array<OCUpload>) -> Unit) {
ioScope.launch {
val result =
uploadsStorageManager.uploadDao.getUploadsByStatus(accountName, status.value)
.map { it.toOCUpload(null) }.toTypedArray()
onCompleted(result)
}
}
@@ -266,26 +252,16 @@ class FileUploadHelper {
}
@Suppress("ReturnCount")
fun isUploading(user: User?, file: OCFile?): Boolean {
if (user == null || file == null || !backgroundJobManager.isStartFileUploadJobScheduled(user)) {
fun isUploading(remotePath: String?, accountName: String?): Boolean {
accountName ?: return false
if (!backgroundJobManager.isStartFileUploadJobScheduled(accountName)) {
return false
}
val uploadCompletableFuture = CompletableFuture.supplyAsync {
uploadsStorageManager.getUploadByRemotePath(file.remotePath)
}
return try {
val upload = uploadCompletableFuture.get()
if (upload != null) {
upload.uploadStatus == UploadStatus.UPLOAD_IN_PROGRESS
} else {
false
}
} catch (e: ExecutionException) {
false
} catch (e: InterruptedException) {
false
}
remotePath ?: return false
val upload = uploadsStorageManager.uploadDao.getByRemotePath(remotePath)
return upload?.status == UploadStatus.UPLOAD_IN_PROGRESS.value ||
FileUploadWorker.isUploading(remotePath, accountName)
}
private fun checkConnectivity(connectivityService: ConnectivityService): Boolean {
@@ -364,7 +340,7 @@ class FileUploadHelper {
val uploads = existingFiles.map { file ->
file?.let {
OCUpload(file, user).apply {
val result = OCUpload(file, user).apply {
fileSize = file.fileLength
this.nameCollisionPolicy = nameCollisionPolicy
isCreateRemoteFolder = true
@@ -373,9 +349,12 @@ class FileUploadHelper {
isWhileChargingOnly = false
uploadStatus = UploadStatus.UPLOAD_IN_PROGRESS
}
val id = uploadsStorageManager.uploadDao.insertOrReplace(result.toUploadEntity())
result.uploadId = id
result
}
}
uploadsStorageManager.storeUploads(uploads)
val uploadIds: LongArray = uploads.filterNotNull().map { it.uploadId }.toLongArray()
backgroundJobManager.startFilesUploadJob(user, uploadIds, true)
}
@@ -459,6 +438,14 @@ class FileUploadHelper {
return false
}
fun showFileUploadLimitMessage(activity: Activity) {
val message = activity.getString(
R.string.file_upload_limit_message,
MAX_FILE_COUNT
)
DisplayUtils.showSnackMessage(activity, message)
}
class UploadNotificationActionReceiver : BroadcastReceiver() {
override fun onReceive(context: Context, intent: Intent) {
val accountName = intent.getStringExtra(FileUploadWorker.EXTRA_ACCOUNT_NAME)
@@ -474,7 +461,9 @@ class FileUploadHelper {
return
}
instance().cancelFileUpload(remotePath, accountName)
FileUploadWorker.cancelCurrentUpload(remotePath, accountName, onCompleted = {
instance().updateUploadStatus(remotePath, accountName, UploadStatus.UPLOAD_CANCELLED)
})
}
}
}
@@ -7,10 +7,12 @@
*/
package com.nextcloud.client.jobs.upload
import android.app.Notification
import android.app.PendingIntent
import android.content.Context
import androidx.core.app.NotificationCompat
import androidx.localbroadcastmanager.content.LocalBroadcastManager
import androidx.work.Worker
import androidx.work.CoroutineWorker
import androidx.work.WorkerParameters
import com.nextcloud.client.account.User
import com.nextcloud.client.account.UserAccountManager
@@ -21,8 +23,12 @@ import com.nextcloud.client.network.ConnectivityService
import com.nextcloud.client.preferences.AppPreferences
import com.nextcloud.model.WorkerState
import com.nextcloud.model.WorkerStateLiveData
import com.nextcloud.utils.ForegroundServiceHelper
import com.nextcloud.utils.extensions.getPercent
import com.nextcloud.utils.extensions.updateStatus
import com.owncloud.android.R
import com.owncloud.android.datamodel.FileDataStorageManager
import com.owncloud.android.datamodel.ForegroundServiceType
import com.owncloud.android.datamodel.ThumbnailsCacheManager
import com.owncloud.android.datamodel.UploadsStorageManager
import com.owncloud.android.db.OCUpload
@@ -34,8 +40,12 @@ import com.owncloud.android.lib.common.operations.RemoteOperationResult
import com.owncloud.android.lib.common.operations.RemoteOperationResult.ResultCode
import com.owncloud.android.lib.common.utils.Log_OC
import com.owncloud.android.operations.UploadFileOperation
import com.owncloud.android.ui.notifications.NotificationUtils
import com.owncloud.android.utils.ErrorMessageAdapter
import com.owncloud.android.utils.theme.ViewThemeUtils
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.ensureActive
import kotlinx.coroutines.withContext
import java.io.File
import kotlin.random.Random
@@ -51,7 +61,7 @@ class FileUploadWorker(
val preferences: AppPreferences,
val context: Context,
params: WorkerParameters
) : Worker(context, params),
) : CoroutineWorker(context, params),
OnDatatransferProgressListener {
companion object {
@@ -91,19 +101,44 @@ class FileUploadWorker(
fun getUploadStartMessage(): String = FileUploadWorker::class.java.name + UPLOAD_START_MESSAGE
fun getUploadFinishMessage(): String = FileUploadWorker::class.java.name + UPLOAD_FINISH_MESSAGE
fun cancelCurrentUpload(remotePath: String, accountName: String, onCompleted: () -> Unit) {
currentUploadFileOperation?.let {
if (it.remotePath == remotePath && it.user.accountName == accountName) {
it.cancel(ResultCode.USER_CANCELLED)
onCompleted()
}
}
}
fun isUploading(remotePath: String?, accountName: String?): Boolean {
currentUploadFileOperation?.let {
return it.remotePath == remotePath && it.user.accountName == accountName
}
return false
}
}
private var lastPercent = 0
private val notificationManager = UploadNotificationManager(context, viewThemeUtils, Random.nextInt())
private val notificationId = Random.nextInt()
private val notificationManager = UploadNotificationManager(context, viewThemeUtils, notificationId)
private val intents = FileUploaderIntents(context)
private val fileUploaderDelegate = FileUploaderDelegate()
@Suppress("TooGenericExceptionCaught")
override fun doWork(): Result = try {
override suspend fun doWork(): Result = try {
Log_OC.d(TAG, "FileUploadWorker started")
backgroundJobManager.logStartOfWorker(BackgroundJobManagerImpl.formatClassTag(this::class))
val workerName = BackgroundJobManagerImpl.formatClassTag(this::class)
backgroundJobManager.logStartOfWorker(workerName)
val notificationTitle = notificationManager.currentOperationTitle
?: context.getString(R.string.foreground_service_upload)
val notification = createNotification(notificationTitle)
updateForegroundInfo(notification)
val result = uploadFiles()
backgroundJobManager.logEndOfWorker(BackgroundJobManagerImpl.formatClassTag(this::class), result)
backgroundJobManager.logEndOfWorker(workerName, result)
notificationManager.dismissNotification()
if (result == Result.success()) {
setIdleWorkerState()
@@ -111,17 +146,37 @@ class FileUploadWorker(
result
} catch (t: Throwable) {
Log_OC.e(TAG, "Error caught at FileUploadWorker $t")
cleanup()
Result.failure()
}
override fun onStopped() {
private suspend fun updateForegroundInfo(notification: Notification) {
val foregroundInfo = ForegroundServiceHelper.createWorkerForegroundInfo(
notificationId,
notification,
ForegroundServiceType.DataSync
)
setForeground(foregroundInfo)
}
private fun createNotification(title: String): Notification =
NotificationCompat.Builder(context, NotificationUtils.NOTIFICATION_CHANNEL_UPLOAD)
.setContentTitle(title)
.setSmallIcon(R.drawable.uploads)
.setOngoing(true)
.setSound(null)
.setVibrate(null)
.setOnlyAlertOnce(true)
.setPriority(NotificationCompat.PRIORITY_LOW)
.setSilent(true)
.build()
private fun cleanup() {
Log_OC.e(TAG, "FileUploadWorker stopped")
setIdleWorkerState()
currentUploadFileOperation?.cancel(null)
notificationManager.dismissNotification()
super.onStopped()
}
private fun setWorkerState(user: User?) {
@@ -133,36 +188,36 @@ class FileUploadWorker(
}
@Suppress("ReturnCount", "LongMethod")
private fun uploadFiles(): Result {
private suspend fun uploadFiles(): Result = withContext(Dispatchers.IO) {
val accountName = inputData.getString(ACCOUNT)
if (accountName == null) {
Log_OC.e(TAG, "accountName is null")
return Result.failure()
return@withContext Result.failure()
}
val uploadIds = inputData.getLongArray(UPLOAD_IDS)
if (uploadIds == null) {
Log_OC.e(TAG, "uploadIds is null")
return Result.failure()
return@withContext Result.failure()
}
val currentBatchIndex = inputData.getInt(CURRENT_BATCH_INDEX, -1)
if (currentBatchIndex == -1) {
Log_OC.e(TAG, "currentBatchIndex is -1, cancelling")
return Result.failure()
return@withContext Result.failure()
}
val totalUploadSize = inputData.getInt(TOTAL_UPLOAD_SIZE, -1)
if (totalUploadSize == -1) {
Log_OC.e(TAG, "totalUploadSize is -1, cancelling")
return Result.failure()
return@withContext Result.failure()
}
// since worker's policy is append or replace and account name comes from there no need check in the loop
val optionalUser = userAccountManager.getUser(accountName)
if (!optionalUser.isPresent) {
Log_OC.e(TAG, "User not found for account: $accountName")
return Result.failure()
return@withContext Result.failure()
}
val user = optionalUser.get()
@@ -172,21 +227,19 @@ class FileUploadWorker(
val client = OwnCloudClientManagerFactory.getDefaultSingleton().getClientFor(ocAccount, context)
for ((index, upload) in uploads.withIndex()) {
ensureActive()
if (preferences.isGlobalUploadPaused) {
Log_OC.d(TAG, "Upload is paused, skip uploading files!")
notificationManager.notifyPaused(
intents.notificationStartIntent(null)
)
return Result.success()
return@withContext Result.success()
}
if (canExitEarly()) {
notificationManager.showConnectionErrorNotification()
return Result.failure()
}
if (isStopped) {
continue
return@withContext Result.failure()
}
setWorkerState(user)
@@ -203,12 +256,16 @@ class FileUploadWorker(
totalUploadSize = totalUploadSize
)
val result = upload(operation, user, client)
val result = withContext(Dispatchers.IO) {
upload(operation, user, client)
}
val entity = uploadsStorageManager.uploadDao.getUploadById(upload.uploadId, accountName)
uploadsStorageManager.updateStatus(entity, result.isSuccess)
currentUploadFileOperation = null
sendUploadFinishEvent(totalUploadSize, currentUploadIndex, operation, result)
}
return Result.success()
return@withContext Result.success()
}
private fun sendUploadFinishEvent(
@@ -346,6 +403,10 @@ class FileUploadWorker(
return
}
if (uploadResult.code == ResultCode.USER_CANCELLED) {
return
}
notificationManager.run {
val errorMessage = ErrorMessageAdapter.getErrorCauseMessage(
uploadResult,
@@ -132,6 +132,7 @@ class WhatsNewActivity :
object : OnBackPressedCallback(true) {
override fun handleOnBackPressed() {
onFinish()
isEnabled = false
onBackPressedDispatcher.onBackPressed()
}
}
@@ -63,6 +63,12 @@ public interface AppPreferences {
boolean isShowHiddenFilesEnabled();
void setShowHiddenFilesEnabled(boolean enabled);
boolean isSortFoldersBeforeFiles();
void setSortFoldersBeforeFiles(boolean enabled);
boolean isSortFavoritesFirst();
void setSortFavoritesFirst(boolean enabled);
boolean isShowEcosystemApps();
void setShowEcosystemApps(boolean enabled);
@@ -70,6 +70,8 @@ public final class AppPreferencesImpl implements AppPreferences {
private static final String PREF__INSTANT_UPLOADING = "instant_uploading";
private static final String PREF__INSTANT_VIDEO_UPLOADING = "instant_video_uploading";
private static final String PREF__SHOW_HIDDEN_FILES = "show_hidden_files_pref";
private static final String PREF__SORT_FOLDERS_BEFORE_FILES = "sort_folders_before_files";
private static final String PREF__SORT_FAVORITES_FIRST = "sort_favorites_first";
private static final String PREF__SHOW_ECOSYSTEM_APPS = "show_ecosystem_apps";
private static final String PREF__LEGACY_CLEAN = "legacyClean";
private static final String PREF__KEYS_MIGRATION = "keysMigration";
@@ -228,6 +230,26 @@ public final class AppPreferencesImpl implements AppPreferences {
preferences.edit().putBoolean(PREF__SHOW_HIDDEN_FILES, enabled).apply();
}
@Override
public boolean isSortFoldersBeforeFiles() {
return preferences.getBoolean(PREF__SORT_FOLDERS_BEFORE_FILES, true);
}
@Override
public void setSortFoldersBeforeFiles(boolean enabled) {
preferences.edit().putBoolean(PREF__SORT_FOLDERS_BEFORE_FILES, enabled).apply();
}
@Override
public boolean isSortFavoritesFirst() {
return preferences.getBoolean(PREF__SORT_FAVORITES_FIRST, true);
}
@Override
public void setSortFavoritesFirst(boolean enabled) {
preferences.edit().putBoolean(PREF__SORT_FAVORITES_FIRST, enabled).apply();
}
@Override
public boolean isShowEcosystemApps() {
return preferences.getBoolean(PREF__SHOW_ECOSYSTEM_APPS, true);
@@ -84,6 +84,7 @@ class ChooseAccountDialogFragment :
return builder.create()
}
@Suppress("LongMethod")
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
accountManager = (activity as BaseActivity).userAccountManager
@@ -39,8 +39,8 @@ enum class FileAction(
// Uploads and downloads
DOWNLOAD_FILE(R.id.action_download_file, R.string.filedetails_download, R.drawable.ic_cloud_download),
SYNC_FILE(R.id.action_sync_file, R.string.filedetails_sync_file, R.drawable.ic_cloud_sync_on),
CANCEL_SYNC(R.id.action_cancel_sync, R.string.common_cancel_sync, R.drawable.ic_cloud_sync_off),
DOWNLOAD_FOLDER(R.id.action_sync_file, R.string.filedetails_sync_file, R.drawable.ic_sync),
CANCEL_SYNC(R.id.action_cancel_sync, R.string.common_cancel_sync, R.drawable.ic_sync_off),
// File sharing
EXPORT_FILE(R.id.action_export_file, R.string.filedetails_export, R.drawable.ic_export),
@@ -84,7 +84,7 @@ enum class FileAction(
SEND_SHARE_FILE,
SEND_FILE,
OPEN_FILE_WITH,
SYNC_FILE,
DOWNLOAD_FOLDER,
CANCEL_SYNC,
SELECT_ALL,
SELECT_NONE,
@@ -45,52 +45,62 @@ class ShortcutUtil @Inject constructor(private val mContext: Context) {
user: User,
syncedFolderProvider: SyncedFolderProvider
) {
if (ShortcutManagerCompat.isRequestPinShortcutSupported(mContext)) {
val intent = Intent(mContext, FileDisplayActivity::class.java)
intent.action = FileDisplayActivity.OPEN_FILE
intent.putExtra(FileActivity.EXTRA_FILE, file.remotePath)
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)
val shortcutId = "nextcloud_shortcut_" + file.remoteId
val icon: IconCompat
var thumbnail = ThumbnailsCacheManager.getBitmapFromDiskCache(
ThumbnailsCacheManager.PREFIX_THUMBNAIL + file.remoteId
)
if (thumbnail != null) {
thumbnail = bitmapToAdaptiveBitmap(thumbnail)
icon = IconCompat.createWithAdaptiveBitmap(thumbnail)
} else if (file.isFolder) {
if (!ShortcutManagerCompat.isRequestPinShortcutSupported(mContext)) {
return
}
val intent = Intent(mContext, FileDisplayActivity::class.java).apply {
action = FileDisplayActivity.OPEN_FILE
putExtra(FileActivity.EXTRA_FILE_REMOTE_PATH, file.decryptedRemotePath)
addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)
}
val icon = createShortcutIcon(file, viewThemeUtils, user, syncedFolderProvider)
val shortcutInfo = ShortcutInfoCompat.Builder(mContext, "nextcloud_shortcut_${file.remoteId}")
.setShortLabel(file.fileName)
.setLongLabel(mContext.getString(R.string.pin_shortcut_label, file.fileName))
.setIcon(icon)
.setIntent(intent)
.build()
val resultIntent =
ShortcutManagerCompat.createShortcutResultIntent(mContext, shortcutInfo)
val pendingIntent = PendingIntent.getBroadcast(
mContext,
file.hashCode(),
resultIntent,
FLAG_IMMUTABLE
)
ShortcutManagerCompat.requestPinShortcut(mContext, shortcutInfo, pendingIntent.intentSender)
}
private fun createShortcutIcon(
file: OCFile,
viewThemeUtils: ViewThemeUtils,
user: User,
syncedFolderProvider: SyncedFolderProvider
): IconCompat {
val thumbnail = ThumbnailsCacheManager.getBitmapFromDiskCache(
ThumbnailsCacheManager.PREFIX_THUMBNAIL + file.remoteId
)
return when {
thumbnail != null -> IconCompat.createWithAdaptiveBitmap(bitmapToAdaptiveBitmap(thumbnail))
file.isFolder -> {
val isAutoUploadFolder = SyncedFolderProvider.isAutoUploadFolder(syncedFolderProvider, file, user)
val isDarkModeActive = syncedFolderProvider.preferences.isDarkModeEnabled
val overlayIconId = file.getFileOverlayIconId(isAutoUploadFolder)
val drawable = MimeTypeUtil.getFolderIcon(isDarkModeActive, overlayIconId, mContext, viewThemeUtils)
val bitmapIcon = drawable.toBitmap()
icon = IconCompat.createWithBitmap(bitmapIcon)
} else {
icon = IconCompat.createWithResource(
mContext,
MimeTypeUtil.getFileTypeIconId(file.mimeType, file.fileName)
)
IconCompat.createWithBitmap(drawable.toBitmap())
}
val longLabel = mContext.getString(R.string.pin_shortcut_label, file.fileName)
val pinShortcutInfo = ShortcutInfoCompat.Builder(mContext, shortcutId)
.setShortLabel(file.fileName)
.setLongLabel(longLabel)
.setIcon(icon)
.setIntent(intent)
.build()
val pinnedShortcutCallbackIntent =
ShortcutManagerCompat.createShortcutResultIntent(mContext, pinShortcutInfo)
val successCallback = PendingIntent.getBroadcast(
else -> IconCompat.createWithResource(
mContext,
0,
pinnedShortcutCallbackIntent,
FLAG_IMMUTABLE
)
ShortcutManagerCompat.requestPinShortcut(
mContext,
pinShortcutInfo,
successCallback.intentSender
MimeTypeUtil.getFileTypeIconId(file.mimeType, file.fileName)
)
}
}
@@ -1,7 +1,7 @@
/*
* Nextcloud - Android Client
*
* SPDX-FileCopyrightText: 2024 Alper Ozturk <[email protected]>
* SPDX-FileCopyrightText: 2025 Alper Ozturk <[email protected]>
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
@@ -10,22 +10,10 @@ package com.nextcloud.utils.extensions
import android.content.Intent
import com.owncloud.android.MainApp
import com.owncloud.android.R
import com.owncloud.android.datamodel.OCFile
import com.owncloud.android.ui.activity.DrawerActivity
import com.owncloud.android.ui.activity.FileDisplayActivity
@Suppress("ReturnCount")
fun DrawerActivity.handleBackButtonEvent(currentDir: OCFile): Boolean {
if (DrawerActivity.menuItemId == R.id.nav_all_files && currentDir.isRootDirectory) {
moveTaskToBack(true)
return true
}
val isParentDirExists = (storageManager.getFileById(currentDir.parentId) != null)
if (isParentDirExists) {
return false
}
fun DrawerActivity.navigateToAllFiles() {
DrawerActivity.menuItemId = R.id.nav_all_files
setNavigationViewItemChecked()
@@ -38,6 +26,4 @@ fun DrawerActivity.handleBackButtonEvent(currentDir: OCFile): Boolean {
}.run {
startActivity(this)
}
return true
}
@@ -15,9 +15,6 @@ fun FileDataStorageManager.searchFilesByName(file: OCFile, accountName: String,
createFileInstance(it)
}
fun FileDataStorageManager.getParentIdsOfSubfiles(paths: List<String>): List<Long> =
fileDao.getParentIdsOfSubfiles(paths)
fun FileDataStorageManager.getDecryptedPath(file: OCFile): String {
val paths = mutableListOf<String>()
var entity = fileDao.getFileByEncryptedRemotePath(file.remotePath, user.accountName)
@@ -0,0 +1,28 @@
/*
* Nextcloud - Android Client
*
* SPDX-FileCopyrightText: 2025 Alper Ozturk <[email protected]>
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
package com.nextcloud.utils.extensions
import com.nextcloud.client.database.entity.UploadEntity
import com.owncloud.android.datamodel.UploadsStorageManager
fun UploadsStorageManager.updateStatus(entity: UploadEntity?, status: UploadsStorageManager.UploadStatus) {
entity ?: return
uploadDao.insertOrReplace(entity.withStatus(status))
}
fun UploadsStorageManager.updateStatus(entity: UploadEntity?, success: Boolean) {
entity ?: return
val newStatus = if (success) {
UploadsStorageManager.UploadStatus.UPLOAD_SUCCEEDED
} else {
UploadsStorageManager.UploadStatus.UPLOAD_FAILED
}
uploadDao.insertOrReplace(entity.withStatus(newStatus))
}
private fun UploadEntity.withStatus(newStatus: UploadsStorageManager.UploadStatus) = this.copy(status = newStatus.value)
@@ -1,6 +1,7 @@
/*
* Nextcloud - Android Client
*
* SPDX-FileCopyrightText: 2025 Alper Ozturk <[email protected]>
* SPDX-FileCopyrightText: 2024 Jonas Mayer <[email protected]>
* SPDX-FileCopyrightText: 2022 Álvaro Brey <[email protected]>
* SPDX-FileCopyrightText: 2018-2020 Tobias Kaminsky <[email protected]>
@@ -14,14 +15,9 @@
*/
package com.owncloud.android.datamodel;
import android.content.ContentProviderOperation;
import android.content.ContentProviderResult;
import android.content.ContentResolver;
import android.content.ContentValues;
import android.content.OperationApplicationException;
import android.database.Cursor;
import android.net.Uri;
import android.os.RemoteException;
import com.nextcloud.client.account.CurrentAccountProvider;
import com.nextcloud.client.account.User;
@@ -94,97 +90,6 @@ public class UploadsStorageManager extends Observable {
}
}
/**
* Stores an upload object in DB.
*
* @param ocUpload Upload object to store
* @return upload id, -1 if the insert process fails.
*/
public long storeUpload(OCUpload ocUpload) {
OCUpload existingUpload = getPendingCurrentOrFailedUpload(ocUpload);
if (existingUpload != null) {
Log_OC.v(TAG, "Will update upload in db since " + ocUpload.getLocalPath() + " already exists as " +
"pending, current or failed upload");
long existingId = existingUpload.getUploadId();
ocUpload.setUploadId(existingId);
updateUpload(ocUpload);
return existingId;
}
Log_OC.v(TAG, "Inserting " + ocUpload.getLocalPath() + " with status=" + ocUpload.getUploadStatus());
ContentValues cv = getContentValues(ocUpload);
Uri result = getDB().insert(ProviderTableMeta.CONTENT_URI_UPLOADS, cv);
Log_OC.d(TAG, "storeUpload returns with: " + result + " for file: " + ocUpload.getLocalPath());
if (result == null) {
Log_OC.e(TAG, "Failed to insert item " + ocUpload.getLocalPath() + " into upload db.");
return -1;
} else {
long new_id = Long.parseLong(result.getPathSegments().get(1));
ocUpload.setUploadId(new_id);
notifyObserversNow();
return new_id;
}
}
public void storeUploads(final List<OCUpload> ocUploads) {
Log_OC.v(TAG, "Inserting " + ocUploads.size() + " uploads");
ArrayList<ContentProviderOperation> operations = new ArrayList<>(ocUploads.size());
for (OCUpload ocUpload : ocUploads) {
OCUpload existingUpload = getPendingCurrentOrFailedUpload(ocUpload);
if (existingUpload != null) {
Log_OC.v(TAG, "Will update upload in db since " + ocUpload.getLocalPath() + " already exists as" +
" pending, current or failed upload");
ocUpload.setUploadId(existingUpload.getUploadId());
updateUpload(ocUpload);
continue;
}
final ContentProviderOperation operation = ContentProviderOperation
.newInsert(ProviderTableMeta.CONTENT_URI_UPLOADS)
.withValues(getContentValues(ocUpload))
.build();
operations.add(operation);
}
try {
final ContentProviderResult[] contentProviderResults = getDB().applyBatch(MainApp.getAuthority(), operations);
for (int i = 0; i < contentProviderResults.length; i++) {
final ContentProviderResult result = contentProviderResults[i];
final long new_id = Long.parseLong(result.uri.getPathSegments().get(1));
ocUploads.get(i).setUploadId(new_id);
}
notifyObserversNow();
} catch (OperationApplicationException | RemoteException e) {
Log_OC.e(TAG, "Error inserting uploads", e);
}
}
@NonNull
private ContentValues getContentValues(OCUpload ocUpload) {
ContentValues cv = new ContentValues();
cv.put(ProviderTableMeta.UPLOADS_LOCAL_PATH, ocUpload.getLocalPath());
cv.put(ProviderTableMeta.UPLOADS_REMOTE_PATH, ocUpload.getRemotePath());
cv.put(ProviderTableMeta.UPLOADS_ACCOUNT_NAME, ocUpload.getAccountName());
cv.put(ProviderTableMeta.UPLOADS_FILE_SIZE, ocUpload.getFileSize());
cv.put(ProviderTableMeta.UPLOADS_STATUS, ocUpload.getUploadStatus().value);
cv.put(ProviderTableMeta.UPLOADS_LOCAL_BEHAVIOUR, ocUpload.getLocalAction());
cv.put(ProviderTableMeta.UPLOADS_NAME_COLLISION_POLICY, ocUpload.getNameCollisionPolicy().serialize());
cv.put(ProviderTableMeta.UPLOADS_IS_CREATE_REMOTE_FOLDER, ocUpload.isCreateRemoteFolder() ? 1 : 0);
cv.put(ProviderTableMeta.UPLOADS_LAST_RESULT, ocUpload.getLastResult().getValue());
cv.put(ProviderTableMeta.UPLOADS_CREATED_BY, ocUpload.getCreatedBy());
cv.put(ProviderTableMeta.UPLOADS_IS_WHILE_CHARGING_ONLY, ocUpload.isWhileChargingOnly() ? 1 : 0);
cv.put(ProviderTableMeta.UPLOADS_IS_WIFI_ONLY, ocUpload.isUseWifiOnly() ? 1 : 0);
cv.put(ProviderTableMeta.UPLOADS_FOLDER_UNLOCK_TOKEN, ocUpload.getFolderUnlockToken());
return cv;
}
/**
* Update an upload object in DB.
*
@@ -387,52 +292,6 @@ public class UploadsStorageManager extends Observable {
return getUploads(null, (String[]) null);
}
public OCUpload getPendingCurrentOrFailedUpload(OCUpload upload) {
try (Cursor cursor = getDB().query(
ProviderTableMeta.CONTENT_URI_UPLOADS,
null,
ProviderTableMeta.UPLOADS_REMOTE_PATH + "=? and " +
ProviderTableMeta.UPLOADS_LOCAL_PATH + "=? and " +
ProviderTableMeta.UPLOADS_ACCOUNT_NAME + "=? and (" +
ProviderTableMeta.UPLOADS_STATUS + "=? or " +
ProviderTableMeta.UPLOADS_STATUS + "=? )",
new String[]{
upload.getRemotePath(),
upload.getLocalPath(),
upload.getAccountName(),
String.valueOf(UploadStatus.UPLOAD_IN_PROGRESS.value),
String.valueOf(UploadStatus.UPLOAD_FAILED.value)
},
ProviderTableMeta.UPLOADS_REMOTE_PATH + " ASC")) {
if (cursor != null) {
if (cursor.moveToFirst()) {
return createOCUploadFromCursor(cursor);
}
}
}
return null;
}
public OCUpload getUploadByRemotePath(String remotePath) {
OCUpload result = null;
try (Cursor cursor = getDB().query(
ProviderTableMeta.CONTENT_URI_UPLOADS,
null,
ProviderTableMeta.UPLOADS_REMOTE_PATH + "=?",
new String[]{remotePath},
ProviderTableMeta.UPLOADS_REMOTE_PATH + " ASC")) {
if (cursor != null) {
if (cursor.moveToFirst()) {
result = createOCUploadFromCursor(cursor);
}
}
}
Log_OC.d(TAG, "Retrieve job " + result + " for remote path " + remotePath);
return result;
}
public @Nullable
OCUpload getUploadById(long id) {
OCUpload result = null;
@@ -508,19 +367,6 @@ public class UploadsStorageManager extends Observable {
return getUploadPage(QUERY_PAGE_SIZE, afterId, true, selection, selectionArgs);
}
private String getInProgressAndDelayedUploadsSelection() {
return "( " + ProviderTableMeta.UPLOADS_STATUS + EQUAL + UploadStatus.UPLOAD_IN_PROGRESS.value +
OR + ProviderTableMeta.UPLOADS_LAST_RESULT +
EQUAL + UploadResult.DELAYED_FOR_WIFI.getValue() +
OR + ProviderTableMeta.UPLOADS_LAST_RESULT +
EQUAL + UploadResult.LOCK_FAILED.getValue() +
OR + ProviderTableMeta.UPLOADS_LAST_RESULT +
EQUAL + UploadResult.DELAYED_FOR_CHARGING.getValue() +
OR + ProviderTableMeta.UPLOADS_LAST_RESULT +
EQUAL + UploadResult.DELAYED_IN_POWER_SAVE_MODE.getValue() +
" ) AND " + ProviderTableMeta.UPLOADS_ACCOUNT_NAME + IS_EQUAL;
}
@NonNull
private List<OCUpload> getUploadPage(long limit, final long afterId, final boolean descending, @Nullable String selection, @Nullable String... selectionArgs) {
List<OCUpload> uploads = new ArrayList<>();
@@ -630,17 +476,6 @@ public class UploadsStorageManager extends Observable {
return upload;
}
public OCUpload[] getCurrentAndPendingUploadsForCurrentAccount() {
User user = currentAccountProvider.getUser();
return getCurrentAndPendingUploadsForAccount(user.getAccountName());
}
public OCUpload[] getCurrentAndPendingUploadsForAccount(final @NonNull String accountName) {
String inProgressUploadsSelection = getInProgressAndDelayedUploadsSelection();
return getUploads(inProgressUploadsSelection, accountName);
}
public long[] getCurrentUploadIds(final @NonNull String accountName) {
final var result = uploadDao.getAllIds(UploadStatus.UPLOAD_IN_PROGRESS.value, accountName);
return result.stream()
@@ -670,13 +505,6 @@ public class UploadsStorageManager extends Observable {
return getUploads(ProviderTableMeta.UPLOADS_ACCOUNT_NAME + IS_EQUAL, accountName);
}
public OCUpload[] getFinishedUploadsForCurrentAccount() {
User user = currentAccountProvider.getUser();
return getUploads(ProviderTableMeta.UPLOADS_STATUS + EQUAL + UploadStatus.UPLOAD_SUCCEEDED.value + AND +
ProviderTableMeta.UPLOADS_ACCOUNT_NAME + IS_EQUAL, user.getAccountName());
}
public OCUpload[] getCancelledUploadsForCurrentAccount() {
User user = currentAccountProvider.getUser();
@@ -684,22 +512,6 @@ public class UploadsStorageManager extends Observable {
ProviderTableMeta.UPLOADS_ACCOUNT_NAME + IS_EQUAL, user.getAccountName());
}
public OCUpload[] getFailedButNotDelayedUploadsForCurrentAccount() {
User user = currentAccountProvider.getUser();
return getUploads(ProviderTableMeta.UPLOADS_STATUS + EQUAL + UploadStatus.UPLOAD_FAILED.value +
AND + ProviderTableMeta.UPLOADS_LAST_RESULT +
ANGLE_BRACKETS + UploadResult.DELAYED_FOR_WIFI.getValue() +
AND + ProviderTableMeta.UPLOADS_LAST_RESULT +
ANGLE_BRACKETS + UploadResult.LOCK_FAILED.getValue() +
AND + ProviderTableMeta.UPLOADS_LAST_RESULT +
ANGLE_BRACKETS + UploadResult.DELAYED_FOR_CHARGING.getValue() +
AND + ProviderTableMeta.UPLOADS_LAST_RESULT +
ANGLE_BRACKETS + UploadResult.DELAYED_IN_POWER_SAVE_MODE.getValue() +
AND + ProviderTableMeta.UPLOADS_ACCOUNT_NAME + IS_EQUAL,
user.getAccountName());
}
private ContentResolver getDB() {
return contentResolver;
}
@@ -797,7 +609,7 @@ public class UploadsStorageManager extends Observable {
upload.getRemotePath(),
localPath
);
} else {
} else if (uploadResult.getCode() != RemoteOperationResult.ResultCode.USER_CANCELLED){
updateUploadStatus(
upload.getOCUploadId(),
UploadStatus.UPLOAD_FAILED,
@@ -434,7 +434,7 @@ public class FileMenuFilter {
private boolean anyFileUploading() {
for (OCFile file : files) {
if (FileUploadHelper.Companion.instance().isUploading(user, file)) {
if (FileUploadHelper.Companion.instance().isUploading(file.getRemotePath(), user.getAccountName())) {
return true;
}
}
@@ -25,6 +25,9 @@ import com.owncloud.android.utils.MimeTypeUtil;
import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
/**
* Remote operation performing the rename of a remote file (or folder?) in the ownCloud server.
@@ -161,26 +164,32 @@ public class RenameFileOperation extends SyncOperation {
}
// create a test file
String tmpFolderName = FileStorageUtils.getTemporalPath("");
File testFile = new File(tmpFolderName + newName);
File tmpFolder = testFile.getParentFile();
if (!tmpFolder.exists() && !tmpFolder.mkdirs()) {
Log_OC.e(TAG, "Unable to create parent folder " + tmpFolder.getAbsolutePath());
Path testFile = Paths.get(tmpFolderName, newName);
Path tmpFolder = testFile.getParent();
if (tmpFolder != null && !Files.exists(tmpFolder)) {
try {
Files.createDirectories(tmpFolder);
} catch (IOException e) {
Log_OC.e(TAG, "Unable to create parent folder " + tmpFolder.toAbsolutePath());
}
}
if (!tmpFolder.isDirectory()) {
if (tmpFolder != null && !Files.isDirectory(tmpFolder)) {
throw new IOException("Unexpected error: temporal directory could not be created");
}
try {
testFile.createNewFile(); // return value is ignored; it could be 'false' because
// the file already existed, that doesn't invalidate the name
} catch (IOException e) {
Files.createFile(testFile);
} catch (Exception e) {
Log_OC.i(TAG, "Test for validity of name " + newName + " in the file system failed");
return false;
}
boolean result = testFile.exists() && testFile.isFile();
boolean result = Files.exists(testFile) && Files.isRegularFile(testFile);
// cleaning ; result is ignored, since there is not much we could do in case of failure,
// but repeat and repeat...
testFile.delete();
try {
Files.deleteIfExists(testFile);
} catch (Exception e) {
Log_OC.e("Error deleting file: ", e.getMessage());
return true;
}
return result;
}
@@ -28,7 +28,6 @@ import com.owncloud.android.lib.common.utils.Log_OC;
import com.owncloud.android.lib.resources.files.ReadFileRemoteOperation;
import com.owncloud.android.lib.resources.files.ReadFolderRemoteOperation;
import com.owncloud.android.lib.resources.files.model.RemoteFile;
import com.owncloud.android.lib.resources.status.E2EVersion;
import com.owncloud.android.operations.common.SyncOperation;
import com.owncloud.android.services.OperationsService;
import com.owncloud.android.utils.FileStorageUtils;
@@ -485,7 +484,7 @@ public class SynchronizeFolderOperation extends SyncOperation {
Log_OC.d(TAG, "Exception caught at startDirectDownloads" + e);
}
} else {
mFilesForDirectDownload.forEach(file -> fileDownloadHelper.downloadFile(user, file));
fileDownloadHelper.downloadFolder(mLocalFolder, user.getAccountName());
}
}
@@ -79,12 +79,11 @@ import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.RandomAccessFile;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.nio.channels.FileChannel;
import java.nio.channels.FileLock;
import java.nio.channels.OverlappingFileLockException;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.security.InvalidAlgorithmParameterException;
import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException;
@@ -1435,21 +1434,37 @@ public class UploadFileOperation extends SyncOperation {
}
/**
* Allows to cancel the actual upload operation. If actual upload operating is in progress it is cancelled, if
* upload preparation is being performed upload will not take place.
* Cancels the current upload process.
*
* <p>
* Behavior depends on the current state of the upload:
* <ul>
* <li><b>Upload in preparation:</b> Upload will not start and a cancellation flag is set.</li>
* <li><b>Upload in progress:</b> The ongoing upload operation is cancelled via
* {@link UploadFileRemoteOperation#cancel(ResultCode)}.</li>
* <li><b>No upload operation:</b> A cancellation flag is still set, but this situation is unexpected
* and logged as an error.</li>
* </ul>
*
* <p>
* Once cancelled, the database will be updated through
* {@link UploadsStorageManager#updateDatabaseUploadResult(RemoteOperationResult, UploadFileOperation)}.
*
* @param cancellationReason the reason for cancellation
*/
public void cancel(ResultCode cancellationReason) {
if (mUploadOperation == null) {
if (mUploadStarted.get()) {
Log_OC.d(TAG, "Cancelling upload during upload preparations.");
mCancellationRequested.set(true);
} else {
mCancellationRequested.set(true);
Log_OC.e(TAG, "No upload in progress. This should not happen.");
}
} else {
if (mUploadOperation != null) {
// Cancel an active upload
Log_OC.d(TAG, "Cancelling upload during actual upload operation.");
mUploadOperation.cancel(cancellationReason);
} else {
// Cancel while preparing or when no upload exists
mCancellationRequested.set(true);
if (mUploadStarted.get()) {
Log_OC.d(TAG, "Cancelling upload during preparation.");
} else {
Log_OC.e(TAG, "No upload in progress. This should not happen.");
}
}
}
@@ -189,7 +189,7 @@ public class ActivitiesActivity extends DrawerActivity implements ActivityListIn
} else {
showEmptyContent(getString(R.string.server_not_reachable),
getString(R.string.server_not_reachable_content));
binding.emptyList.emptyListIcon.setImageResource(R.drawable.ic_cloud_sync_off);
binding.emptyList.emptyListIcon.setImageResource(R.drawable.ic_sync_off);
}
});
@@ -31,6 +31,7 @@ import android.graphics.drawable.PictureDrawable;
import android.net.Uri;
import android.os.Bundle;
import android.os.Handler;
import android.os.PersistableBundle;
import android.os.SystemClock;
import android.text.TextUtils;
import android.view.Menu;
@@ -115,6 +116,7 @@ import java.util.Optional;
import javax.inject.Inject;
import androidx.activity.OnBackPressedCallback;
import androidx.annotation.IdRes;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
@@ -206,6 +208,12 @@ public abstract class DrawerActivity extends ToolbarActivity
@Inject
ClientFactory clientFactory;
@Override
public void onCreate(@Nullable Bundle savedInstanceState, @Nullable PersistableBundle persistentState) {
super.onCreate(savedInstanceState, persistentState);
addOnBackPressedCallback();
}
/**
* Initializes the drawer and its content. This method needs to be called after the content view has been set.
*/
@@ -1153,19 +1161,24 @@ public abstract class DrawerActivity extends ToolbarActivity
}
}
@Override
public void onBackPressed() {
if (isDrawerOpen()) {
closeDrawer();
return;
}
Fragment fileDetailsSharingProcessFragment =
getSupportFragmentManager().findFragmentByTag(FileDetailsSharingProcessFragment.TAG);
if (fileDetailsSharingProcessFragment != null) {
((FileDetailsSharingProcessFragment) fileDetailsSharingProcessFragment).onBackPressed();
} else {
super.onBackPressed();
}
public void addOnBackPressedCallback() {
getOnBackPressedDispatcher().addCallback(new OnBackPressedCallback(true) {
@Override
public void handleOnBackPressed() {
if (isDrawerOpen()) {
closeDrawer();
return;
}
final var fragment = getSupportFragmentManager().findFragmentByTag(FileDetailsSharingProcessFragment.TAG);
if (fragment instanceof FileDetailsSharingProcessFragment fileDetailsSharingProcessFragment) {
fileDetailsSharingProcessFragment.onBackPressed();
} else {
setEnabled(false);
getOnBackPressedDispatcher().onBackPressed();
}
}
});
}
@Override
@@ -129,6 +129,7 @@ public abstract class FileActivity extends DrawerActivity
LoadingVersionNumberTask.VersionDevInterface, FileDetailSharingFragment.OnEditShareListener, NetworkChangeListener {
public static final String EXTRA_FILE = "com.owncloud.android.ui.activity.FILE";
public static final String EXTRA_FILE_REMOTE_PATH = "com.owncloud.android.ui.activity.FILE_REMOTE_PATH";
public static final String EXTRA_LIVE_PHOTO_FILE = "com.owncloud.android.ui.activity.LIVE.PHOTO.FILE";
public static final String EXTRA_USER = "com.owncloud.android.ui.activity.USER";
public static final String EXTRA_FROM_NOTIFICATION = "com.owncloud.android.ui.activity.FROM_NOTIFICATION";
@@ -40,6 +40,7 @@ import android.view.MenuItem
import android.view.View
import android.view.ViewTreeObserver.OnGlobalLayoutListener
import android.view.WindowManager.BadTokenException
import androidx.activity.OnBackPressedCallback
import androidx.annotation.VisibleForTesting
import androidx.appcompat.widget.SearchView
import androidx.core.view.MenuItemCompat
@@ -82,6 +83,7 @@ import com.nextcloud.utils.extensions.getParcelableArgument
import com.nextcloud.utils.extensions.isActive
import com.nextcloud.utils.extensions.lastFragment
import com.nextcloud.utils.extensions.logFileSize
import com.nextcloud.utils.extensions.navigateToAllFiles
import com.nextcloud.utils.fileNameValidator.FileNameValidator.checkFolderPath
import com.nextcloud.utils.view.FastScrollUtils
import com.owncloud.android.MainApp
@@ -155,7 +157,6 @@ import com.owncloud.android.utils.PermissionUtil.requestNotificationPermission
import com.owncloud.android.utils.PushUtils
import com.owncloud.android.utils.StringUtils
import com.owncloud.android.utils.theme.CapabilityUtils
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
@@ -278,6 +279,7 @@ class FileDisplayActivity :
initSyncBroadcastReceiver()
observeWorkerState()
startMetadataSyncForRoot()
handleBackPress()
}
private fun loadSavedInstanceState(savedInstanceState: Bundle?) {
@@ -549,7 +551,7 @@ class FileDisplayActivity :
when {
ACTION_DETAILS.equals(action, ignoreCase = true) -> {
val file = intent.getParcelableArgument(EXTRA_FILE, OCFile::class.java)
val file = getFileFromIntent(intent)
setFile(file)
showDetails(file)
}
@@ -578,7 +580,6 @@ class FileDisplayActivity :
when (intent.action) {
Intent.ACTION_VIEW -> handleOpenFileViaIntent(intent)
OPEN_FILE -> {
supportFragmentManager.executePendingTransactions()
onOpenFileIntent(intent)
}
}
@@ -645,18 +646,41 @@ class FileDisplayActivity :
// endregion
private fun onOpenFileIntent(intent: Intent) {
val extra = intent.getStringExtra(EXTRA_FILE)
val file = storageManager.getFileByDecryptedRemotePath(extra)
if (file != null) {
val fileFragment: OCFileListFragment?
val leftFragment = this.leftFragment
if (leftFragment is OCFileListFragment) {
fileFragment = leftFragment
} else {
fileFragment = OCFileListFragment()
this.leftFragment = fileFragment
val file = getFileFromIntent(intent)
if (file == null) {
Log_OC.e(TAG, "Can't open file intent, file is null")
return
}
val currentFragment = leftFragment
if (currentFragment == null) {
Log_OC.e(TAG, "Can't open file intent, left fragment is null")
return
}
val fileListFragment: OCFileListFragment = when {
currentFragment is OCFileListFragment && currentFragment !is GalleryFragment -> {
currentFragment
}
fileFragment.onItemClicked(file)
else -> {
Log_OC.w(
TAG,
"Left fragment is not a valid OCFileListFragment " +
"(was ${currentFragment::class.simpleName}). " +
"Replacing with OCFileListFragment."
)
val newFragment = OCFileListFragment()
setLeftFragment(newFragment, false)
setupHomeSearchToolbarWithSortAndListButtons()
newFragment
}
}
// Post to main thread to ensure fragment is fully attached before interacting
Handler(Looper.getMainLooper()).post {
fileListFragment.onItemClicked(file)
}
}
@@ -935,7 +959,7 @@ class FileDisplayActivity :
) {
openDrawer()
} else {
onBackPressed()
onBackPressedDispatcher.onBackPressed()
}
} else if (itemId == R.id.action_select_all) {
val fragment = this.listOfFilesFragment
@@ -1136,40 +1160,59 @@ class FileDisplayActivity :
}
}
private val isRootDirectory: Boolean
get() {
val currentDir = getCurrentDir()
return (currentDir == null || currentDir.parentId == FileDataStorageManager.ROOT_PARENT_ID.toLong())
}
/*
* BackPressed priority/hierarchy:
* 1. close search view if opened
* 2. close drawer if opened
* 3. if it is OCFileListFragment and it's in Root -> (finish Activity) or it's not Root -> (browse up)
* 4. otherwise pop up the fragment and sortGroup view visibility and call super.onBackPressed()
/**
* Sets up a custom back-press handler for this activity.
*
* This callback determines how the back button behaves based on the current UI state:
* - If the search view is open, it closes it.
* - If the navigation drawer is open, it closes it.
* - If the left fragment is an [OCFileListFragment]:
* - If in the root directory, it either navigates to "All Files" or finishes the activity.
* - Otherwise, it navigates one level up.
* - Otherwise, it pops the current fragment from the back stack.
*
* ### About `isEnabled`
* `isEnabled` is a property of [OnBackPressedCallback].
* When `isEnabled = false`, this callback is **temporarily disabled**,
* allowing the system or other callbacks to handle the back press instead.
*/
@SuppressFBWarnings("ITC_INHERITANCE_TYPE_CHECKING") // TODO Apply fail fast principle
override fun onBackPressed() {
if (isSearchOpen()) {
resetSearchAction()
return
}
private fun handleBackPress() {
onBackPressedDispatcher.addCallback(
this,
object : OnBackPressedCallback(true) {
override fun handleOnBackPressed() {
when {
isSearchOpen() -> {
isEnabled = false
resetSearchAction()
}
if (isDrawerOpen) {
super.onBackPressed()
return
}
isDrawerOpen -> {
isEnabled = false
onBackPressedDispatcher.onBackPressed()
}
if (this.leftFragment is OCFileListFragment) {
if (isRoot(getCurrentDir())) {
finish()
} else {
browseUp(leftFragment as OCFileListFragment)
leftFragment is OCFileListFragment -> {
val fragment = leftFragment as OCFileListFragment
if (isRoot(getCurrentDir())) {
if (fragment.shouldNavigateBackToAllFiles()) {
navigateToAllFiles()
} else {
finish()
}
} else {
browseUp(fragment)
}
}
else -> {
isEnabled = false
popBack()
}
}
}
}
} else {
popBack()
}
)
}
private fun browseUp(listOfFiles: OCFileListFragment) {
@@ -1200,9 +1243,10 @@ class FileDisplayActivity :
if (isRoot(getCurrentDir()) && leftFragment is OCFileListFragment) {
// Remove the list to the original state
val listOfHiddenFiles = leftFragment.adapter.listOfHiddenFiles
leftFragment.performSearch("", listOfHiddenFiles, true)
leftFragment.adapter?.let { adapter ->
val listOfHiddenFiles = adapter.listOfHiddenFiles
leftFragment.performSearch("", listOfHiddenFiles, true)
}
hideSearchView(getCurrentDir())
setDrawerIndicatorEnabled(isDrawerIndicatorAvailable)
@@ -1210,20 +1254,20 @@ class FileDisplayActivity :
if (leftFragment is UnifiedSearchFragment) {
showSortListGroup(false)
super.onBackPressed()
onBackPressedDispatcher.onBackPressed()
}
}
/**
* Use this method when want to pop the fragment on back press. It resets Scrolling (See
* [with true][.resetScrolling] and pop the visibility for sortListGroup (See
* [with false][.showSortListGroup]. At last call to super.onBackPressed()
* [with false][.showSortListGroup]. At last call to onBackPressedDispatcher.onBackPressed()
*/
private fun popBack() {
binding.fabMain.setImageResource(R.drawable.ic_plus)
resetScrolling(true)
showSortListGroup(false)
super.onBackPressed()
onBackPressedDispatcher.onBackPressed()
}
override fun onSaveInstanceState(outState: Bundle) {
@@ -1269,11 +1313,8 @@ class FileDisplayActivity :
var startFile: OCFile? = null
if (intent != null) {
val fileArgs = intent.getParcelableArgument(EXTRA_FILE, OCFile::class.java)
if (fileArgs != null) {
startFile = fileArgs
file = startFile
}
startFile = getFileFromIntent(intent)
file = startFile
}
// refresh list of files
@@ -1314,6 +1355,11 @@ class FileDisplayActivity :
}, ON_RESUMED_RESET_DELAY)
}
private fun getFileFromIntent(intent: Intent?): OCFile? =
intent.getParcelableArgument(EXTRA_FILE, OCFile::class.java)
?: intent?.getStringExtra(EXTRA_FILE_REMOTE_PATH)
?.let { fileDataStorageManager.getFileByDecryptedRemotePath(it) }
private fun checkAndSetMenuItemId() {
if (MainApp.isOnlyPersonFiles()) {
menuItemId = R.id.nav_personal_files
@@ -1645,7 +1691,7 @@ class FileDisplayActivity :
if (uploadWasFine || file != null && file.fileExists()) {
fileDetailFragment.updateFileDetails(false, true)
} else {
onBackPressed()
onBackPressedDispatcher.onBackPressed()
}
// Force the preview if the file is an image or text file
@@ -106,7 +106,7 @@ open class FolderPickerActivity :
updateActionBarTitleAndHomeButtonByString(captionText)
setBackgroundText()
handleOnBackPressed()
handleBackPress()
}
override fun onDestroy() {
@@ -151,7 +151,7 @@ open class FolderPickerActivity :
}
}
private fun handleOnBackPressed() {
private fun handleBackPress() {
onBackPressedDispatcher.addCallback(
this,
object : OnBackPressedCallback(true) {
@@ -327,7 +327,7 @@ open class FolderPickerActivity :
} else if (itemId == android.R.id.home) {
val currentDir = currentFolder
if (currentDir != null && currentDir.parentId != 0L) {
onBackPressed()
onBackPressedDispatcher.onBackPressed()
}
} else {
retval = super.onOptionsItemSelected(item)
@@ -201,7 +201,7 @@ class InternalTwoWaySyncActivity :
override fun onOptionsItemSelected(item: MenuItem): Boolean {
when (item.itemId) {
android.R.id.home -> {
onBackPressed()
onBackPressedDispatcher.onBackPressed()
}
R.id.action_dismiss_two_way_sync -> {
disableTwoWaySyncAndWorkers()
@@ -91,7 +91,7 @@ class ManageAccountsActivity :
multipleAccountsSupported = multiAccountSupport(this)
setupUserList()
handleOnBackPressed()
handleBackPress()
}
private fun setupUsers() {
@@ -149,7 +149,7 @@ class ManageAccountsActivity :
performAccountRemoval(user)
}
private fun handleOnBackPressed() {
private fun handleBackPress() {
onBackPressedDispatcher.addCallback(
this,
onBackPressedCallback
@@ -160,13 +160,13 @@ class ManageAccountsActivity :
override fun handleOnBackPressed() {
val resultIntent = Intent()
if (accountManager.allUsers.size > 0) {
if (accountManager.allUsers.isNotEmpty()) {
resultIntent.putExtra(KEY_ACCOUNT_LIST_CHANGED, hasAccountListChanged())
resultIntent.putExtra(KEY_CURRENT_ACCOUNT_CHANGED, hasCurrentAccountChanged())
setResult(RESULT_OK, resultIntent)
} else {
val intent = Intent(this@ManageAccountsActivity, AuthenticatorActivity::class.java)
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)
intent.flags = Intent.FLAG_ACTIVITY_CLEAR_TOP
startActivity(intent)
}
@@ -229,7 +229,7 @@ class ManageAccountsActivity :
var result = true
if (item.itemId == android.R.id.home) {
onBackPressed()
onBackPressedDispatcher.onBackPressed()
} else {
result = super.onOptionsItemSelected(item)
}
@@ -331,7 +331,7 @@ class ManageAccountsActivity :
)
recyclerView?.adapter = userListAdapter
} else {
onBackPressed()
onBackPressedDispatcher.onBackPressed()
}
}
@@ -393,8 +393,7 @@ class ManageAccountsActivity :
resultIntent.putExtra(KEY_ACCOUNT_LIST_CHANGED, true)
resultIntent.putExtra(KEY_CURRENT_ACCOUNT_CHANGED, true)
setResult(RESULT_OK, resultIntent)
super.onBackPressed()
onBackPressedDispatcher.onBackPressed()
}
}
@@ -103,6 +103,7 @@ import java.util.concurrent.Executors;
import javax.inject.Inject;
import androidx.activity.OnBackPressedCallback;
import androidx.annotation.DrawableRes;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
@@ -203,6 +204,8 @@ public class ReceiveExternalFilesActivity extends FileActivity
fm.beginTransaction()
.add(taskRetainerFragment, TaskRetainerFragment.FTAG_TASK_RETAINER_FRAGMENT).commit();
} // else, Fragment already created and retained across configuration change
handleBackPress();
}
@Override
@@ -656,14 +659,19 @@ public class ReceiveExternalFilesActivity extends FileActivity
}
}
@Override
public void onBackPressed() {
if (mParents.size() <= SINGLE_PARENT) {
super.onBackPressed();
} else {
mParents.pop();
browseToFolderIfItExists();
}
private void handleBackPress() {
getOnBackPressedDispatcher().addCallback(this, new OnBackPressedCallback(true) {
@Override
public void handleOnBackPressed() {
if (mParents.size() <= SINGLE_PARENT) {
setEnabled(false);
getOnBackPressedDispatcher().onBackPressed();
} else {
mParents.pop();
browseToFolderIfItExists();
}
}
});
}
@Override
@@ -874,7 +882,9 @@ public class ReceiveExternalFilesActivity extends FileActivity
private List<OCFile> sortFileList(List<OCFile> files) {
FileSortOrder sortOrder = preferences.getSortOrderByFolder(mFile);
return sortOrder.sortCloudFiles(files);
boolean foldersBeforeFiles = preferences.isSortFoldersBeforeFiles();
boolean favoritesFirst = preferences.isSortFavoritesFirst();
return sortOrder.sortCloudFiles(files, foldersBeforeFiles, favoritesFirst);
}
private String generatePath(Stack<String> dirs) {
@@ -944,7 +954,7 @@ public class ReceiveExternalFilesActivity extends FileActivity
}
if (mStreamsToUpload.size() > FileUploadHelper.MAX_FILE_COUNT) {
DisplayUtils.showSnackMessage(this, R.string.max_file_count_warning_message);
FileUploadHelper.Companion.instance().showFileUploadLimitMessage(this);
return;
}
@@ -1097,7 +1107,7 @@ public class ReceiveExternalFilesActivity extends FileActivity
dialog.show(getSupportFragmentManager(), CreateFolderDialogFragment.CREATE_FOLDER_FRAGMENT);
} else if (itemId == android.R.id.home) {
if (mParents.size() > SINGLE_PARENT) {
onBackPressed();
getOnBackPressedDispatcher().onBackPressed();
}
} else if (itemId == R.id.action_switch_account) {
showAccountChooserDialog();
@@ -15,6 +15,7 @@
*/
package com.owncloud.android.ui.activity;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.Intent;
import android.content.SharedPreferences;
@@ -183,6 +184,9 @@ public class SettingsActivity extends PreferenceActivity
// Synced folders
setupAutoUploadCategory(preferenceScreen);
// Files
setupFilesCategory();
// Details
setupDetailsCategory(preferenceScreen);
@@ -354,6 +358,7 @@ public class SettingsActivity extends PreferenceActivity
}
}
@SuppressLint("GestureBackNavigation")
@Override
public void onBackPressed() {
DrawerActivity.menuItemId = R.id.nav_all_files;
@@ -661,25 +666,33 @@ public class SettingsActivity extends PreferenceActivity
boolean fPassCodeEnabled = getResources().getBoolean(R.bool.passcode_enabled);
boolean fDeviceCredentialsEnabled = getResources().getBoolean(R.bool.device_credentials_enabled);
boolean fShowHiddenFilesEnabled = getResources().getBoolean(R.bool.show_hidden_files_enabled);
boolean fShowEcosystemAppsEnabled = !getResources().getBoolean(R.bool.is_branded_client);
boolean fSyncedFolderLightEnabled = getResources().getBoolean(R.bool.syncedFolder_light);
boolean fShowMediaScanNotifications = preferences.isShowMediaScanNotifications();
setupLockPreference(preferenceCategoryDetails, fPassCodeEnabled, fDeviceCredentialsEnabled);
setupHiddenFilesPreference(preferenceCategoryDetails, fShowHiddenFilesEnabled);
setupShowEcosystemAppsPreference(preferenceCategoryDetails, fShowEcosystemAppsEnabled);
setupShowMediaScanNotifications(preferenceCategoryDetails, fShowMediaScanNotifications);
if (!fPassCodeEnabled && !fDeviceCredentialsEnabled && !fShowHiddenFilesEnabled && fSyncedFolderLightEnabled
if (!fPassCodeEnabled && !fDeviceCredentialsEnabled && fSyncedFolderLightEnabled
&& fShowMediaScanNotifications) {
preferenceScreen.removePreference(preferenceCategoryDetails);
}
}
private void setupFilesCategory() {
PreferenceCategory preferenceCategoryDetails = (PreferenceCategory) findPreference("files");
viewThemeUtils.files.themePreferenceCategory(preferenceCategoryDetails);
boolean fShowHiddenFilesEnabled = getResources().getBoolean(R.bool.show_hidden_files_enabled);
setupHiddenFilesPreference(preferenceCategoryDetails, fShowHiddenFilesEnabled);
setupFoldersBeforeFilesPreference();
setupSortFavoritesFirstPreference();
}
private void setupShowMediaScanNotifications(PreferenceCategory preferenceCategoryDetails,
boolean fShowMediaScanNotifications) {
ThemeableSwitchPreference mShowMediaScanNotifications =
@@ -703,6 +716,22 @@ public class SettingsActivity extends PreferenceActivity
}
}
private void setupFoldersBeforeFilesPreference() {
ThemeableSwitchPreference preference = (ThemeableSwitchPreference) findPreference("sort_folders_before_files");
preference.setOnPreferenceClickListener(p -> {
preferences.setSortFoldersBeforeFiles(preference.isChecked());
return true;
});
}
private void setupSortFavoritesFirstPreference() {
ThemeableSwitchPreference preference = (ThemeableSwitchPreference) findPreference("sort_favorites_first");
preference.setOnPreferenceClickListener(p -> {
preferences.setSortFavoritesFirst(preference.isChecked());
return true;
});
}
private void setupShowEcosystemAppsPreference(PreferenceCategory preferenceCategoryDetails, boolean fShowEcosystemAppsEnabled) {
showEcosystemApps = (ThemeableSwitchPreference) findPreference("show_ecosystem_apps");
if (fShowEcosystemAppsEnabled) {
@@ -28,6 +28,7 @@ import androidx.lifecycle.Lifecycle
import androidx.lifecycle.lifecycleScope
import androidx.recyclerview.widget.GridLayoutManager
import com.google.android.material.dialog.MaterialAlertDialogBuilder
import com.nextcloud.client.appinfo.AppInfo
import com.nextcloud.client.core.Clock
import com.nextcloud.client.device.PowerManagementService
import com.nextcloud.client.di.Injectable
@@ -146,6 +147,9 @@ class SyncedFoldersActivity :
@Inject
lateinit var syncedFolderProvider: SyncedFolderProvider
@Inject
lateinit var appInfo: AppInfo
lateinit var binding: SyncedFoldersLayoutBinding
lateinit var adapter: SyncedFolderAdapter
@@ -858,7 +862,7 @@ class SyncedFoldersActivity :
val powerManager = getSystemService(POWER_SERVICE) as PowerManager?
return when {
powerManager != null -> !powerManager.isIgnoringBatteryOptimizations(BuildConfig.APPLICATION_ID)
else -> true
else -> !appInfo.isDebugBuild
}
}
}
@@ -157,17 +157,32 @@ public abstract class ToolbarActivity extends BaseActivity implements Injectable
* Updates title bar and home buttons (state and icon).
*/
protected void updateActionBarTitleAndHomeButton(OCFile chosenFile) {
String title;
boolean isRoot = isRoot(chosenFile);
title = isRoot ? themeUtils.getDefaultDisplayNameForRootFolder(this) : fileDataStorageManager.getFilenameConsideringOfflineOperation(chosenFile);
String title = getActionBarTitle(chosenFile, isRoot);
updateActionBarTitleAndHomeButtonByString(title);
if (mAppBar != null) {
showHomeSearchToolbar(title, isRoot);
}
}
private String getActionBarTitle(OCFile chosenFile, boolean isRoot) {
if (isRoot) {
return themeUtils.getDefaultDisplayNameForRootFolder(this);
}
if (chosenFile.isFolder()) {
return fileDataStorageManager.getFilenameConsideringOfflineOperation(chosenFile);
}
long parentId = chosenFile.getParentId();
OCFile parentFile = fileDataStorageManager.getFileById(parentId);
if (parentFile == null) {
return "";
}
return fileDataStorageManager.getFilenameConsideringOfflineOperation(parentFile);
}
public void showSearchView() {
if (isHomeSearchToolbarShow) {
showHomeSearchToolbar(false);
@@ -272,11 +287,21 @@ public abstract class ToolbarActivity extends BaseActivity implements Injectable
}
public void showSortListGroup(boolean show) {
findViewById(R.id.sort_list_button_group).setVisibility(show ? View.VISIBLE : View.GONE);
final var view = findViewById(R.id.sort_list_button_group);
if (view == null) {
return;
}
view.setVisibility(show ? View.VISIBLE : View.GONE);
}
public boolean sortListGroupVisibility(){
return findViewById(R.id.sort_list_button_group).getVisibility() == View.VISIBLE;
final var view = findViewById(R.id.sort_list_button_group);
if (view == null) {
return false;
}
return view.getVisibility() == View.VISIBLE;
}
/**
* Change the bitmap for the toolbar's preview image.
@@ -238,7 +238,7 @@ public class UploadFilesActivity extends DrawerActivity implements LocalFileList
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
int i = position;
while (i-- != 0) {
onBackPressed();
getOnBackPressedDispatcher().onBackPressed();
}
// the next operation triggers a new call to this method, but it's necessary to
// ensure that the name exposed in the action bar is the current directory when the
@@ -311,7 +311,7 @@ public class UploadFilesActivity extends DrawerActivity implements LocalFileList
if (itemId == android.R.id.home) {
if (mCurrentDir != null && mCurrentDir.getParentFile() != null) {
onBackPressed();
getOnBackPressedDispatcher().onBackPressed();
}
} else if (itemId == R.id.action_select_all) {
mSelectAll = !item.isChecked();
@@ -503,7 +503,7 @@ public class UploadFilesActivity extends DrawerActivity implements LocalFileList
} else {
final var chosenFiles = mFileListFragment.getCheckedFilePaths();
if (chosenFiles.length > FileUploadHelper.MAX_FILE_COUNT) {
DisplayUtils.showSnackMessage(this, R.string.max_file_count_warning_message);
FileUploadHelper.Companion.instance().showFileUploadLimitMessage(this);
return;
}
@@ -670,7 +670,7 @@ public class UploadFilesActivity extends DrawerActivity implements LocalFileList
} else {
final var chosenFiles = mFileListFragment.getCheckedFilePaths();
if (chosenFiles.length > FileUploadHelper.MAX_FILE_COUNT) {
DisplayUtils.showSnackMessage(this, R.string.max_file_count_warning_message);
FileUploadHelper.Companion.instance().showFileUploadLimitMessage(this);
return;
}
boolean isPositionZero = (binding.uploadFilesSpinnerBehaviour.getSelectedItemPosition() == 0);
@@ -720,7 +720,7 @@ public class UploadFilesActivity extends DrawerActivity implements LocalFileList
Log_OC.d(TAG, "Positive button in dialog was clicked; dialog tag is " + callerTag);
final var chosenFiles = mFileListFragment.getCheckedFilePaths();
if (chosenFiles.length > FileUploadHelper.MAX_FILE_COUNT) {
DisplayUtils.showSnackMessage(this, R.string.max_file_count_warning_message);
FileUploadHelper.Companion.instance().showFileUploadLimitMessage(this);
return;
}
@@ -158,7 +158,7 @@ public class UserInfoActivity extends DrawerActivity implements Injectable {
int itemId = item.getItemId();
if (itemId == android.R.id.home) {
onBackPressed();
getOnBackPressedDispatcher().onBackPressed();
} else if (itemId == R.id.action_open_account) {
accountClicked(user.hashCode());
} else if (itemId == R.id.action_delete_account) {
@@ -266,7 +266,9 @@ public class OCFileListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHol
if (searchType == SearchType.SHARED_FILTER) {
mFiles.sort((o1, o2) -> Long.compare(o2.getFirstShareTimestamp(), o1.getFirstShareTimestamp()));
} else {
mFiles = sortOrder.sortCloudFiles(mFiles);
boolean foldersBeforeFiles = preferences.isSortFoldersBeforeFiles();
boolean favoritesFirst = preferences.isSortFavoritesFirst();
mFiles = sortOrder.sortCloudFiles(mFiles, foldersBeforeFiles, favoritesFirst);
}
new Handler(Looper.getMainLooper()).post(() -> {
@@ -907,7 +909,9 @@ public class OCFileListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHol
mFiles = OCFileExtensionsKt.filterFilenames(mFiles);
sortOrder = preferences.getSortOrderByFolder(directory);
mFiles = sortOrder.sortCloudFiles(mFiles);
boolean foldersBeforeFiles = preferences.isSortFoldersBeforeFiles();
boolean favoritesFirst = preferences.isSortFavoritesFirst();
mFiles = sortOrder.sortCloudFiles(mFiles, foldersBeforeFiles, favoritesFirst);
prepareListOfHiddenFiles();
mergeOCFilesForLivePhoto();
mFilesAll.clear();
@@ -999,15 +1003,18 @@ public class OCFileListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHol
searchType == SearchType.RECENTLY_MODIFIED_SEARCH) {
mFiles = FileStorageUtils.sortOcFolderDescDateModifiedWithoutFavoritesFirst(mFiles);
} else if (searchType != SearchType.SHARED_FILTER) {
boolean foldersBeforeFiles = preferences.isSortFoldersBeforeFiles();
boolean favoritesFirst = preferences.isSortFavoritesFirst();
if (searchType == SearchType.FAVORITE_SEARCH) {
sortOrder = preferences.getSortOrderByType(FileSortOrder.Type.favoritesListView);
} else {
sortOrder = preferences.getSortOrderByFolder(folder);
}
mFiles = sortOrder.sortCloudFiles(mFiles);
mFiles = sortOrder.sortCloudFiles(mFiles, foldersBeforeFiles, favoritesFirst);
}
this.searchType = searchType;
mFilesAll.clear();
mFilesAll.addAll(mFiles);
@@ -1134,14 +1141,17 @@ public class OCFileListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHol
mStorageManager.saveVirtuals(contentValues);
}
public void setSortOrder(@Nullable OCFile folder, FileSortOrder sortOrder) {
@SuppressLint("NotifyDataSetChanged")
public void setSortOrder(@Nullable OCFile folder, @NonNull FileSortOrder sortOrder) {
if (searchType == SearchType.FAVORITE_SEARCH) {
preferences.setSortOrder(FileSortOrder.Type.favoritesListView, sortOrder);
} else {
preferences.setSortOrder(folder, sortOrder);
}
mFiles = sortOrder.sortCloudFiles(mFiles);
boolean foldersBeforeFiles = preferences.isSortFoldersBeforeFiles();
boolean favoritesFirst = preferences.isSortFavoritesFirst();
mFiles = sortOrder.sortCloudFiles(mFiles, foldersBeforeFiles, favoritesFirst);
notifyDataSetChanged();
this.sortOrder = sortOrder;
@@ -380,7 +380,7 @@ class OCFileListDelegate(
return operationsServiceBinder?.isSynchronizing(user, file) == true ||
fileDownloadHelper.isDownloading(user, file) ||
fileUploadHelper.isUploading(user, file)
fileUploadHelper.isUploading(file.remotePath, user.accountName)
}
private fun showLocalFileIndicator(file: OCFile, holder: ListViewHolder) {
@@ -8,6 +8,7 @@
*/
package com.owncloud.android.ui.adapter;
import android.annotation.SuppressLint;
import android.app.NotificationManager;
import android.content.ActivityNotFoundException;
import android.content.Context;
@@ -59,6 +60,7 @@ import com.owncloud.android.utils.theme.ViewThemeUtils;
import java.io.File;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Optional;
import java.util.Set;
import java.util.concurrent.LinkedBlockingQueue;
@@ -67,6 +69,7 @@ import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
import androidx.annotation.NonNull;
import kotlin.Unit;
/**
* This Adapter populates a ListView with following types of uploads: pending, active, completed. Filtering possible.
@@ -74,6 +77,18 @@ import androidx.annotation.NonNull;
public class UploadListAdapter extends SectionedRecyclerViewAdapter<SectionedViewHolder> {
private static final String TAG = UploadListAdapter.class.getSimpleName();
private static class GroupConfig {
final Type type;
final int titleRes;
final UploadStatus status;
GroupConfig(Type type, int titleRes, UploadStatus status) {
this.type = type;
this.titleRes = titleRes;
this.status = status;
}
}
private UploadProgressListener uploadProgressListener;
private final FileActivity parentActivity;
private final UploadsStorageManager uploadsStorageManager;
@@ -93,6 +108,66 @@ public class UploadListAdapter extends SectionedRecyclerViewAdapter<SectionedVie
private final FileUploadHelper uploadHelper = FileUploadHelper.Companion.instance();
public UploadListAdapter(final FileActivity fileActivity,
final UploadsStorageManager uploadsStorageManager,
final FileDataStorageManager storageManager,
final UserAccountManager accountManager,
final ConnectivityService connectivityService,
final PowerManagementService powerManagementService,
final Clock clock,
final ViewThemeUtils viewThemeUtils) {
Log_OC.d(TAG, "UploadListAdapter");
this.parentActivity = fileActivity;
this.uploadsStorageManager = uploadsStorageManager;
this.storageManager = storageManager;
this.accountManager = accountManager;
this.connectivityService = connectivityService;
this.powerManagementService = powerManagementService;
this.clock = clock;
this.viewThemeUtils = viewThemeUtils;
uploadGroups = new UploadGroup[4];
shouldShowHeadersForEmptySections(false);
initUploadGroups();
showUser = accountManager.getAccounts().length > 1;
}
private void initUploadGroups() {
final var optionalUser = parentActivity.getUser();
if (optionalUser.isEmpty()) {
return;
}
final var accountName = optionalUser.get().getAccountName();
var groups = List.of(
new GroupConfig(Type.CURRENT, R.string.uploads_view_group_current_uploads, UploadStatus.UPLOAD_IN_PROGRESS),
new GroupConfig(Type.FAILED, R.string.uploads_view_group_failed_uploads, UploadStatus.UPLOAD_FAILED),
new GroupConfig(Type.CANCELLED, R.string.uploads_view_group_manually_cancelled_uploads, UploadStatus.UPLOAD_CANCELLED),
new GroupConfig(Type.FINISHED, R.string.uploads_view_group_finished_uploads, UploadStatus.UPLOAD_SUCCEEDED)
);
for (int i = 0; i < groups.size(); i++) {
var config = groups.get(i);
uploadGroups[i] = createUploadGroup(config, accountName);
}
}
private UploadGroup createUploadGroup(GroupConfig config, String accountName) {
return new UploadGroup(config.type, parentActivity.getString(config.titleRes)) {
@Override
public void refresh(LoadCompleteListener listener) {
uploadHelper.getUploadsByStatus(accountName, config.status, ocUploads -> {
fixAndSortItems(ocUploads);
listener.onComplete();
return Unit.INSTANCE;
});
}
};
}
@Override
public int getSectionCount() {
return uploadGroups.length;
@@ -144,7 +219,10 @@ public class UploadListAdapter extends SectionedRecyclerViewAdapter<SectionedVie
return;
}
uploadHelper.cancelFileUploads(Arrays.asList(group.items), accountName);
for (OCUpload upload: group.items) {
uploadHelper.updateUploadStatus(upload.getRemotePath(), accountName, UploadStatus.UPLOAD_CANCELLED);
FileUploadWorker.Companion.cancelCurrentUpload(upload.getRemotePath(), accountName, () -> Unit.INSTANCE);
}
loadUploadItemsFromDb();
}).start();
case FINISHED -> {
@@ -242,66 +320,6 @@ public class UploadListAdapter extends SectionedRecyclerViewAdapter<SectionedVie
// not needed
}
public UploadListAdapter(final FileActivity fileActivity,
final UploadsStorageManager uploadsStorageManager,
final FileDataStorageManager storageManager,
final UserAccountManager accountManager,
final ConnectivityService connectivityService,
final PowerManagementService powerManagementService,
final Clock clock,
final ViewThemeUtils viewThemeUtils) {
Log_OC.d(TAG, "UploadListAdapter");
this.parentActivity = fileActivity;
this.uploadsStorageManager = uploadsStorageManager;
this.storageManager = storageManager;
this.accountManager = accountManager;
this.connectivityService = connectivityService;
this.powerManagementService = powerManagementService;
this.clock = clock;
this.viewThemeUtils = viewThemeUtils;
uploadGroups = new UploadGroup[4];
shouldShowHeadersForEmptySections(false);
uploadGroups[0] = new UploadGroup(Type.CURRENT,
parentActivity.getString(R.string.uploads_view_group_current_uploads)) {
@Override
public void refresh() {
fixAndSortItems(uploadsStorageManager.getCurrentAndPendingUploadsForCurrentAccount());
}
};
uploadGroups[1] = new UploadGroup(Type.FAILED,
parentActivity.getString(R.string.uploads_view_group_failed_uploads)) {
@Override
public void refresh() {
fixAndSortItems(uploadsStorageManager.getFailedButNotDelayedUploadsForCurrentAccount());
}
};
uploadGroups[2] = new UploadGroup(Type.CANCELLED,
parentActivity.getString(
R.string.uploads_view_group_manually_cancelled_uploads)) {
@Override
public void refresh() {
fixAndSortItems(uploadsStorageManager.getCancelledUploadsForCurrentAccount());
}
};
uploadGroups[3] = new UploadGroup(Type.FINISHED,
parentActivity.getString(R.string.uploads_view_group_finished_uploads)) {
@Override
public void refresh() {
fixAndSortItems(uploadsStorageManager.getFinishedUploadsForCurrentAccount());
}
};
showUser = accountManager.getAccounts().length > 1;
}
@Override
public void onBindViewHolder(SectionedViewHolder holder, int section, int relativePosition, int absolutePosition) {
if (uploadGroups.length == 0 || section < 0 || section >= uploadGroups.length) {
@@ -427,7 +445,8 @@ public class UploadListAdapter extends SectionedRecyclerViewAdapter<SectionedVie
itemViewHolder.binding.uploadRightButton.setImageResource(R.drawable.ic_action_cancel_grey);
itemViewHolder.binding.uploadRightButton.setVisibility(View.VISIBLE);
itemViewHolder.binding.uploadRightButton.setOnClickListener(v -> {
uploadHelper.cancelFileUpload(item.getRemotePath(), item.getAccountName());
uploadHelper.updateUploadStatus(item.getRemotePath(), item.getAccountName(), UploadStatus.UPLOAD_CANCELLED);
FileUploadWorker.Companion.cancelCurrentUpload(item.getRemotePath(), item.getAccountName(), () -> Unit.INSTANCE);
loadUploadItemsFromDb();
});
@@ -914,7 +933,7 @@ public class UploadListAdapter extends SectionedRecyclerViewAdapter<SectionedVie
}
interface Refresh {
void refresh();
void refresh(LoadCompleteListener listener);
}
interface Apply {
@@ -993,20 +1012,30 @@ public class UploadListAdapter extends SectionedRecyclerViewAdapter<SectionedVie
}
}
@SuppressLint("NotifyDataSetChanged")
@Override
public void run() {
final int groupCount = uploadGroups.length;
final int[] completedCount = {0};
for (UploadGroup group : uploadGroups) {
group.refresh();
group.refresh(() -> {
synchronized (completedCount) {
group.apply();
completedCount[0]++;
if (completedCount[0] == groupCount) {
// All groups finished, update UI once
parentActivity.runOnUiThread(() -> {
notifyDataSetChanged();
for (LoadCompleteListener loadCompleteListener : loadCompleteListenerSet) {
loadCompleteListener.onComplete();
}
});
}
}
});
}
parentActivity.runOnUiThread(() -> {
for (UploadGroup uploadGroup : uploadGroups) {
uploadGroup.apply();
}
notifyDataSetChanged();
for (LoadCompleteListener loadCompleteListener : loadCompleteListenerSet) {
loadCompleteListener.onComplete();
}
});
}
}
@@ -28,6 +28,8 @@ import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.lang.ref.WeakReference;
import java.nio.file.Files;
import java.util.Objects;
import static android.content.Context.PRINT_SERVICE;
@@ -56,69 +58,67 @@ public class PrintAsyncTask extends AsyncTask<Void, Void, Boolean> {
@Override
protected Boolean doInBackground(Void... voids) {
if (file == null) return Boolean.FALSE;
HttpClient client = new HttpClient();
GetMethod getMethod = null;
FileOutputStream fos = null;
try {
getMethod = new GetMethod(url);
int status = client.executeMethod(getMethod);
if (status == HttpStatus.SC_OK) {
if (file.exists() && !file.delete()) {
return Boolean.FALSE;
}
if (status != HttpStatus.SC_OK) return Boolean.FALSE;
file.getParentFile().mkdirs();
if (file.exists() && !file.delete()) return Boolean.FALSE;
if (!file.getParentFile().exists()) {
Log_OC.d(TAG, file.getParentFile().getAbsolutePath() + " does not exist");
return Boolean.FALSE;
}
File parentFile = file.getParentFile();
if (parentFile == null) return Boolean.FALSE;
if (!file.createNewFile()) {
Log_OC.d(TAG, file.getAbsolutePath() + " could not be created");
return Boolean.FALSE;
}
Files.createDirectories(parentFile.toPath());
if (!parentFile.exists()) {
Log_OC.d(TAG, parentFile.getAbsolutePath() + " does not exist");
return Boolean.FALSE;
}
if (!file.createNewFile()) {
Log_OC.d(TAG, file.getAbsolutePath() + " could not be created");
return Boolean.FALSE;
}
Header contentLengthHeader = getMethod.getResponseHeader("Content-Length");
long totalToTransfer = 0;
if (contentLengthHeader != null && !contentLengthHeader.getValue().isEmpty()) {
totalToTransfer = Long.parseLong(contentLengthHeader.getValue());
}
try (
BufferedInputStream bis = new BufferedInputStream(getMethod.getResponseBodyAsStream());
fos = new FileOutputStream(file);
FileOutputStream fos = new FileOutputStream(file)
) {
byte[] buffer = new byte[4096];
long transferred = 0;
int read;
Header contentLength = getMethod.getResponseHeader("Content-Length");
long totalToTransfer = contentLength != null && contentLength.getValue().length() > 0 ?
Long.parseLong(contentLength.getValue()) : 0;
byte[] bytes = new byte[4096];
int readResult;
while ((readResult = bis.read(bytes)) != -1) {
fos.write(bytes, 0, readResult);
transferred += readResult;
while ((read = bis.read(buffer)) != -1) {
fos.write(buffer, 0, read);
transferred += read;
}
// Check if the file is completed
if (transferred != totalToTransfer) {
if (totalToTransfer > 0 && transferred != totalToTransfer) {
Log_OC.d(TAG, "Transferred bytes (" + transferred +
") != expected (" + totalToTransfer + ")");
return Boolean.FALSE;
}
if (getMethod.getResponseBodyAsStream() != null) {
getMethod.getResponseBodyAsStream().close();
}
}
} catch (IOException e) {
Log_OC.e(TAG, "Error reading file", e);
return Boolean.TRUE;
} catch (Exception e) {
Log_OC.e(TAG, "Error downloading file", e);
return Boolean.FALSE;
} finally {
if (getMethod != null) {
getMethod.releaseConnection();
}
if (fos != null) {
try {
fos.close();
} catch (IOException e) {
Log_OC.e(TAG, "Error closing file output stream", e);
}
}
}
return Boolean.TRUE;
}
@Override
@@ -24,7 +24,6 @@ import com.owncloud.android.datamodel.OCFile
import com.owncloud.android.ui.activity.FileActivity
import com.owncloud.android.ui.activity.FileDisplayActivity
import com.owncloud.android.ui.dialog.ConfirmationDialogFragment.ConfirmationDialogFragmentListener
import com.owncloud.android.ui.preview.PreviewImageActivity
import javax.inject.Inject
/**
@@ -125,14 +124,11 @@ class RemoveFilesDialogFragment :
}
finishActionMode()
finishPreviewImageActivity()
}
}
override fun onNeutral(callerTag: String?) = Unit
private fun finishPreviewImageActivity() = getTypedActivity(PreviewImageActivity::class.java)?.finish()
private fun setActionMode(actionMode: ActionMode?) {
this.actionMode = actionMode
}
@@ -25,7 +25,6 @@ import android.os.Handler
import android.os.Looper
import android.os.Parcelable
import android.util.DisplayMetrics
import android.view.KeyEvent
import android.view.LayoutInflater
import android.view.Menu
import android.view.MenuInflater
@@ -57,7 +56,6 @@ import com.nextcloud.client.di.Injectable
import com.nextcloud.client.preferences.AppPreferences
import com.nextcloud.client.preferences.AppPreferencesImpl
import com.nextcloud.utils.extensions.getTypedActivity
import com.nextcloud.utils.extensions.handleBackButtonEvent
import com.owncloud.android.MainApp
import com.owncloud.android.R
import com.owncloud.android.databinding.ListFragmentBinding
@@ -65,7 +63,6 @@ import com.owncloud.android.lib.common.utils.Log_OC
import com.owncloud.android.lib.resources.files.SearchRemoteOperation
import com.owncloud.android.lib.resources.status.OwnCloudVersion
import com.owncloud.android.ui.EmptyRecyclerView
import com.owncloud.android.ui.activity.FileActivity
import com.owncloud.android.ui.activity.FileDisplayActivity
import com.owncloud.android.ui.activity.FolderPickerActivity
import com.owncloud.android.ui.activity.OnEnforceableRefreshListener
@@ -767,18 +764,7 @@ open class ExtendedListFragment :
}
}
protected fun setupBackButtonRedirectToAllFiles() {
view?.isFocusableInTouchMode = true
view?.requestFocus()
view?.setOnKeyListener { _: View, keyCode: Int, event: KeyEvent ->
if (event.action == KeyEvent.ACTION_UP && keyCode == KeyEvent.KEYCODE_BACK) {
val fda = getTypedActivity(FileActivity::class.java)
val currentDir = fda?.currentDir ?: return@setOnKeyListener false
return@setOnKeyListener fda.handleBackButtonEvent(currentDir)
}
false
}
}
protected fun isAccountManagerInitialized(): Boolean = ::accountManager.isInitialized
private data class EmptyListData(val headline: Int, val message: Int, val icon: Int?, val tintIcon: Boolean)
@@ -197,7 +197,7 @@ public class FileDetailFragment extends FileFragment implements OnClickListener,
}
public void goBackToOCFileListFragment() {
requireActivity().onBackPressed();
requireActivity().getOnBackPressedDispatcher().onBackPressed();
}
@Override
@@ -574,7 +574,7 @@ public class FileDetailFragment extends FileFragment implements OnClickListener,
// configure UI for depending upon local state of the file
if (transferring
|| (FileDownloadHelper.Companion.instance().isDownloading(user, file))
|| (FileUploadHelper.Companion.instance().isUploading(user, file))) {
|| (FileUploadHelper.Companion.instance().isUploading(file.getRemotePath(), user.getAccountName()))) {
setButtonsForTransferring();
} else if (file.isDown()) {
@@ -736,7 +736,7 @@ public class FileDetailFragment extends FileFragment implements OnClickListener,
if (FileDownloadHelper.Companion.instance().isDownloading(user, getFile())) {
binding.progressText.setText(R.string.downloader_download_in_progress_ticker);
} else {
if (FileUploadHelper.Companion.instance().isUploading(user, getFile())) {
if (FileUploadHelper.Companion.instance().isUploading(getFile().getRemotePath(), user.getAccountName())) {
binding.progressText.setText(R.string.uploader_upload_in_progress_ticker);
}
}
@@ -234,12 +234,6 @@ public class GalleryFragment extends OCFileListFragment implements GalleryFragme
}
}
@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
setupBackButtonRedirectToAllFiles();
}
@Override
public void onMessageEvent(ChangeMenuEvent changeMenuEvent) {
super.onMessageEvent(changeMenuEvent);
@@ -274,6 +274,11 @@ public class LocalFileListFragment extends ExtendedListFragment implements
mAdapter.swapDirectory(directory);
mDirectory = directory;
final var recyclerView = getRecyclerView();
if (recyclerView != null) {
recyclerView.scrollToPosition(0);
}
}
@@ -77,6 +77,8 @@ class OCFileListBottomSheetDialog(
colorImageView(menuIconScanDocUpload, ColorRole.PRIMARY)
colorImageView(menuIconMkdir, ColorRole.PRIMARY)
colorImageView(menuIconAddFolderInfo, ColorRole.PRIMARY)
colorViewBackground(binding.bottomSheet, ColorRole.SURFACE)
}
}
}
@@ -277,12 +277,6 @@ public class OCFileListFragment extends ExtendedListFragment implements
super.onResume();
}
@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
setupBackButtonRedirectToAllFiles();
}
@Override
public void onDestroyView() {
super.onDestroyView();
@@ -1247,6 +1241,11 @@ public class OCFileListFragment extends ExtendedListFragment implements
}
private void handlePendingDownloadFile(OCFile file) {
if (!isAccountManagerInitialized()) {
Log_OC.e(TAG, "AccountManager not yet initialized");
return;
}
User account = accountManager.getUser();
OCCapability capability = mContainerActivity.getStorageManager().getCapability(account.getAccountName());
@@ -2325,4 +2324,15 @@ public class OCFileListFragment extends ExtendedListFragment implements
public SearchEvent getSearchEvent() {
return searchEvent;
}
public boolean isSearchEventFavorite() {
if (searchEvent == null) {
return false;
}
return searchEvent.getSearchType() == SearchRemoteOperation.SearchType.FAVORITE_SEARCH;
}
public boolean shouldNavigateBackToAllFiles() {
return ((this instanceof GalleryFragment) || isSearchEventFavorite() || DrawerActivity.menuItemId == R.id.nav_favorites);
}
}
@@ -404,7 +404,7 @@ public class BackupListFragment extends FileFragment implements Injectable {
private void closeFragment() {
ContactsPreferenceActivity contactsPreferenceActivity = (ContactsPreferenceActivity) getActivity();
if (contactsPreferenceActivity != null) {
contactsPreferenceActivity.onBackPressed();
contactsPreferenceActivity.getOnBackPressedDispatcher().onBackPressed();
}
}
@@ -34,6 +34,7 @@ import com.nextcloud.client.account.User;
import com.nextcloud.client.jobs.BackgroundJobManager;
import com.nextcloud.client.jobs.download.FileDownloadHelper;
import com.nextcloud.client.jobs.upload.FileUploadHelper;
import com.nextcloud.client.jobs.upload.FileUploadWorker;
import com.nextcloud.client.network.ConnectivityService;
import com.nextcloud.utils.EditorUtils;
import com.owncloud.android.MainApp;
@@ -42,6 +43,7 @@ import com.owncloud.android.datamodel.ArbitraryDataProvider;
import com.owncloud.android.datamodel.ArbitraryDataProviderImpl;
import com.owncloud.android.datamodel.FileDataStorageManager;
import com.owncloud.android.datamodel.OCFile;
import com.owncloud.android.datamodel.UploadsStorageManager;
import com.owncloud.android.files.StreamMediaFileOperation;
import com.owncloud.android.lib.common.operations.RemoteOperationResult;
import com.owncloud.android.lib.common.utils.Log_OC;
@@ -86,7 +88,6 @@ import java.util.Collection;
import java.util.Date;
import java.util.List;
import java.util.Locale;
import java.util.NoSuchElementException;
import java.util.Optional;
import java.util.Set;
import java.util.regex.Matcher;
@@ -97,6 +98,7 @@ import androidx.annotation.Nullable;
import androidx.core.content.FileProvider;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentTransaction;
import kotlin.Unit;
/**
* Helper implementation for file operations locally and remote.
@@ -1006,17 +1008,22 @@ public class FileOperationsHelper {
}
}
if (FileDownloadHelper.Companion.instance().isDownloading(currentUser, file)) {
final var fileDownloadHelper = FileDownloadHelper.Companion.instance();
if (fileDownloadHelper.isDownloading(currentUser, file)) {
List<OCFile> files = fileActivity.getStorageManager().getAllFilesRecursivelyInsideFolder(file);
FileDownloadHelper.Companion.instance().cancelPendingOrCurrentDownloads(currentUser, files);
fileDownloadHelper.cancelPendingOrCurrentDownloads(currentUser, files);
}
if (FileUploadHelper.Companion.instance().isUploading(currentUser, file)) {
try {
FileUploadHelper.Companion.instance().cancelFileUpload(file.getRemotePath(), currentUser.getAccountName());
} catch (NoSuchElementException e) {
Log_OC.e(TAG, "Error cancelling current upload because user does not exist!");
}
if (file.isFolder()) {
fileDownloadHelper.cancelFolderDownload();
}
final var fileUploadHelper = FileUploadHelper.Companion.instance();
if (fileUploadHelper.isUploading(file.getRemotePath(), currentUser.getAccountName())) {
FileUploadWorker.Companion.cancelCurrentUpload(file.getRemotePath(), currentUser.getAccountName(), () -> {
fileUploadHelper.updateUploadStatus(file.getRemotePath(), currentUser.getAccountName(), UploadsStorageManager.UploadStatus.UPLOAD_CANCELLED);
return Unit.INSTANCE;
});
}
}
@@ -54,7 +54,7 @@ class PreviewBitmapActivity :
}
override fun onSupportNavigateUp(): Boolean {
onBackPressed()
onBackPressedDispatcher.onBackPressed()
return true
}
}
@@ -14,6 +14,7 @@ import android.os.Build
import android.os.Bundle
import android.view.MenuItem
import android.view.View
import androidx.activity.OnBackPressedCallback
import androidx.appcompat.app.ActionBar
import androidx.core.content.ContextCompat
import androidx.drawerlayout.widget.DrawerLayout
@@ -55,6 +56,7 @@ import edu.umd.cs.findbugs.annotations.SuppressFBWarnings
import java.io.Serializable
import javax.inject.Inject
import kotlin.math.max
import kotlin.math.min
/**
* Holds a swiping gallery where image files contained in an Nextcloud directory are shown.
@@ -123,6 +125,7 @@ class PreviewImageActivity :
observeWorkerState()
applyDisplayCutOutTopPadding()
handleBackPress()
}
private fun applyDisplayCutOutTopPadding() {
@@ -214,9 +217,25 @@ class PreviewImageActivity :
}
}
override fun onBackPressed() {
sendRefreshSearchEventBroadcast()
super.onBackPressed()
private fun updateViewPagerAfterDeletionAndAdvanceForward() {
val deletePosition = viewPager?.currentItem ?: return
previewImagePagerAdapter?.let { adapter ->
val nextPosition = min(deletePosition, adapter.itemCount - 1)
viewPager?.setCurrentItem(nextPosition, true)
adapter.delete(deletePosition)
// Page needs to be reselected after the adapter has been updated. Otherwise, wrong title is shown
selectPage(nextPosition)
}
}
private fun handleBackPress() {
onBackPressedDispatcher.addCallback(object : OnBackPressedCallback(true) {
override fun handleOnBackPressed() {
sendRefreshSearchEventBroadcast()
isEnabled = false
onBackPressedDispatcher.onBackPressed()
}
})
}
override fun onOptionsItemSelected(item: MenuItem): Boolean {
@@ -278,9 +297,6 @@ class PreviewImageActivity :
super.onRemoteOperationFinish(operation, result)
if (operation is RemoveFileOperation) {
val deletePosition = viewPager?.currentItem ?: return
val nextPosition = if (deletePosition > 0) deletePosition - 1 else 0
previewImagePagerAdapter?.let {
if (it.itemCount <= 1) {
backToDisplayActivity()
@@ -288,12 +304,9 @@ class PreviewImageActivity :
}
}
if (user.isPresent) {
initViewPager(user.get())
if (result.isSuccess) {
updateViewPagerAfterDeletionAndAdvanceForward()
}
viewPager?.setCurrentItem(nextPosition, true)
previewImagePagerAdapter?.delete(deletePosition)
} else if (operation is SynchronizeFileOperation) {
onSynchronizeFileOperationFinish(result)
}
@@ -63,7 +63,9 @@ class PreviewImagePagerAdapter : FragmentStateAdapter {
imageFiles = mStorageManager.getFolderImages(parentFolder, onlyOnDevice)
val sortOrder = preferences.getSortOrderByFolder(parentFolder)
imageFiles = sortOrder.sortCloudFiles(imageFiles.toMutableList()).toMutableList()
val foldersBeforeFiles = preferences.isSortFoldersBeforeFiles()
val favoritesFirst = preferences.isSortFavoritesFirst()
imageFiles = sortOrder.sortCloudFiles(imageFiles.toMutableList(), foldersBeforeFiles, favoritesFirst)
mObsoleteFragments = HashSet()
mObsoletePositions = HashSet()
@@ -101,7 +103,9 @@ class PreviewImagePagerAdapter : FragmentStateAdapter {
if (type == VirtualFolderType.FAVORITE) {
val sortOrder = preferences.getSortOrderByType(FileSortOrder.Type.favoritesListView)
imageFiles = sortOrder.sortCloudFiles(imageFiles.toMutableList()).toMutableList()
val foldersBeforeFiles = preferences.isSortFoldersBeforeFiles()
val favoritesFirst = preferences.isSortFavoritesFirst()
imageFiles = sortOrder.sortCloudFiles(imageFiles.toMutableList(), foldersBeforeFiles, favoritesFirst)
}
mObsoleteFragments = HashSet()
@@ -201,4 +205,11 @@ class PreviewImagePagerAdapter : FragmentStateAdapter {
override fun createFragment(position: Int): Fragment = getItem(position)
override fun getItemCount(): Int = imageFiles.size
override fun getItemId(position: Int): Long {
// The item ID function is needed to detect whether the deletion of the current item needs a UI update
return imageFiles.getOrNull(position)?.fileId ?: position.toLong()
}
override fun containsItem(itemId: Long): Boolean = imageFiles.any { it.fileId == itemId }
}
@@ -165,7 +165,7 @@ abstract class PreviewTextFragment :
* Finishes the preview
*/
protected fun finish() {
requireActivity().runOnUiThread { requireActivity().onBackPressed() }
requireActivity().runOnUiThread { requireActivity().onBackPressedDispatcher.onBackPressed() }
}
companion object {
@@ -7,15 +7,16 @@
*/
package com.owncloud.android.ui.preview
import android.app.Activity
import android.app.Dialog
import android.os.Build
import android.view.ViewGroup
import android.view.Window
import androidx.activity.addCallback
import androidx.annotation.OptIn
import androidx.core.view.WindowCompat
import androidx.core.view.WindowInsetsCompat
import androidx.core.view.WindowInsetsControllerCompat
import androidx.fragment.app.FragmentActivity
import androidx.media3.common.util.UnstableApi
import androidx.media3.exoplayer.ExoPlayer
import androidx.media3.ui.PlayerView
@@ -35,7 +36,7 @@ import com.owncloud.android.lib.common.utils.Log_OC
*/
@OptIn(UnstableApi::class)
class PreviewVideoFullscreenDialog(
private val activity: Activity,
private val activity: FragmentActivity,
nextcloudClient: NextcloudClient,
private val sourceExoPlayer: ExoPlayer,
private val sourceView: PlayerView
@@ -69,6 +70,7 @@ class PreviewVideoFullscreenDialog(
binding.videoPlayer.player = mExoPlayer
mExoPlayer.prepare()
}
handleOnBackPressed()
}
private fun isRotatedVideo(): Boolean {
@@ -95,7 +97,7 @@ class PreviewVideoFullscreenDialog(
setOnShowListener {
enableImmersiveMode()
switchTargetViewFromSource()
binding.videoPlayer.setFullscreenButtonClickListener { onBackPressed() }
binding.videoPlayer.setFullscreenButtonClickListener { activity.onBackPressedDispatcher.onBackPressed() }
if (isPlaying) {
mExoPlayer.play()
}
@@ -111,23 +113,25 @@ class PreviewVideoFullscreenDialog(
}
}
override fun onBackPressed() {
val isPlaying = mExoPlayer.isPlaying
if (isPlaying) {
mExoPlayer.pause()
}
setOnDismissListener {
disableImmersiveMode()
playingStateListener?.let {
mExoPlayer.removeListener(it)
}
switchTargetViewToSource()
private fun handleOnBackPressed() {
activity.onBackPressedDispatcher.addCallback(activity) {
val isPlaying = mExoPlayer.isPlaying
if (isPlaying) {
sourceExoPlayer.play()
mExoPlayer.pause()
}
sourceView.showController()
setOnDismissListener {
disableImmersiveMode()
playingStateListener?.let {
mExoPlayer.removeListener(it)
}
switchTargetViewToSource()
if (isPlaying) {
sourceExoPlayer.play()
}
sourceView.showController()
}
dismiss()
}
dismiss()
}
private fun switchTargetViewToSource() {
@@ -128,6 +128,7 @@ class TrashbinActivity :
updateActionBarTitleAndHomeButtonByString(getString(R.string.trashbin_activity_title))
setupDrawer()
handleBackPress()
}
override fun onStart() {
@@ -179,8 +180,6 @@ class TrashbinActivity :
loadFolder()
handleOnBackPressed()
mMultiChoiceModeListener = MultiChoiceModeListener(
this,
trashbinListAdapter,
@@ -189,7 +188,7 @@ class TrashbinActivity :
addDrawerListener(mMultiChoiceModeListener)
}
private fun handleOnBackPressed() {
private fun handleBackPress() {
onBackPressedDispatcher.addCallback(
this,
onBackPressedCallback
@@ -390,7 +389,7 @@ class TrashbinActivity :
binding.emptyList.emptyListViewHeadline.visibility = View.VISIBLE
binding.emptyList.emptyListViewText.visibility = View.VISIBLE
binding.emptyList.emptyListView.visibility = View.VISIBLE
binding.emptyList.emptyListIcon.setImageResource(R.drawable.ic_cloud_sync_off)
binding.emptyList.emptyListIcon.setImageResource(R.drawable.ic_sync_off)
}
private fun openActionsMenu(filesCount: Int, checkedFiles: Set<TrashbinFile>) {
@@ -80,7 +80,7 @@ open class FileSortOrder(@JvmField var name: String, var isAscending: Boolean) {
* @param files files to sort
*/
@JvmStatic
fun sortCloudFilesByFavourite(files: MutableList<OCFile>): List<OCFile> {
fun sortCloudFilesByFavourite(files: MutableList<OCFile>): MutableList<OCFile> {
files.sortWith { o1: OCFile, o2: OCFile ->
when {
o1.isFavorite && o2.isFavorite -> 0
@@ -91,9 +91,46 @@ open class FileSortOrder(@JvmField var name: String, var isAscending: Boolean) {
}
return files
}
/**
* Sorts list by Folders.
*
* @param files files to sort
*/
@JvmStatic
fun sortCloudFilesByFolderFirst(files: MutableList<OCFile>): MutableList<OCFile> {
files.sortWith { o1: OCFile, o2: OCFile ->
when {
o1.isFolder && o2.isFolder -> 0
o1.isFolder -> -1
o2.isFolder -> 1
else -> 0
}
}
return files
}
}
open fun sortCloudFiles(files: MutableList<OCFile>): List<OCFile> = sortCloudFilesByFavourite(files)
@Suppress("ReturnCount")
open fun sortCloudFiles(
files: MutableList<OCFile>,
foldersBeforeFiles: Boolean,
favoritesFirst: Boolean
): MutableList<OCFile> {
if (foldersBeforeFiles && favoritesFirst) {
return sortCloudFilesByFavourite(sortCloudFilesByFolderFirst(files))
}
if (foldersBeforeFiles) {
return sortCloudFilesByFolderFirst(files)
}
if (favoritesFirst) {
return sortCloudFilesByFavourite(files)
}
return files
}
open fun sortLocalFiles(files: MutableList<File>): List<File> = files
@@ -20,12 +20,16 @@ class FileSortOrderByDate(name: String, ascending: Boolean) : FileSortOrder(name
*
* @param files list of files to sort
*/
override fun sortCloudFiles(files: MutableList<OCFile>): List<OCFile> {
override fun sortCloudFiles(
files: MutableList<OCFile>,
foldersBeforeFiles: Boolean,
favoritesFirst: Boolean
): MutableList<OCFile> {
val multiplier = if (isAscending) 1 else -1
files.sortWith { o1: OCFile, o2: OCFile ->
multiplier * o1.modificationTimestamp.compareTo(o2.modificationTimestamp)
}
return super.sortCloudFiles(files)
return super.sortCloudFiles(files, foldersBeforeFiles, favoritesFirst)
}
/**
@@ -24,9 +24,13 @@ class FileSortOrderByName internal constructor(name: String?, ascending: Boolean
* @param files files to sort
*/
@SuppressFBWarnings("Bx")
override fun sortCloudFiles(files: MutableList<OCFile>): List<OCFile> {
val sortedByName = sortServerFiles(files)
return super.sortCloudFiles(sortedByName)
override fun sortCloudFiles(
files: MutableList<OCFile>,
foldersBeforeFiles: Boolean,
favoritesFirst: Boolean
): MutableList<OCFile> {
val sortedByName = sortOnlyByName(files)
return super.sortCloudFiles(sortedByName, foldersBeforeFiles, favoritesFirst)
}
/**
@@ -51,6 +55,11 @@ class FileSortOrderByName internal constructor(name: String?, ascending: Boolean
return files
}
private fun sortOnlyByName(files: MutableList<OCFile>): MutableList<OCFile> {
files.sortWith { o1: OCFile, o2: OCFile -> sortMultiplier * AlphanumComparator.compare(o1, o2) }
return files
}
/**
* Sorts list by Name.
*
@@ -17,9 +17,13 @@ import java.io.File
*/
class FileSortOrderBySize internal constructor(name: String?, ascending: Boolean) : FileSortOrder(name!!, ascending) {
override fun sortCloudFiles(files: MutableList<OCFile>): List<OCFile> {
override fun sortCloudFiles(
files: MutableList<OCFile>,
foldersBeforeFiles: Boolean,
favoritesFirst: Boolean
): MutableList<OCFile> {
val sortedBySize = sortServerFiles(files)
return super.sortCloudFiles(sortedBySize)
return super.sortCloudFiles(sortedBySize, foldersBeforeFiles, favoritesFirst)
}
override fun sortTrashbinFiles(files: MutableList<TrashbinFile>): List<TrashbinFile> {
@@ -40,6 +40,7 @@ import java.io.OutputStream;
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
@@ -80,8 +81,8 @@ public final class FileStorageUtils {
String decoded;
try {
decoded = URLDecoder.decode(filename, StandardCharsets.UTF_8.toString());
} catch (UnsupportedEncodingException e) {
return false;
} catch (Exception e) {
decoded = filename;
}
int[] bidiControlCharacters = {
@@ -535,7 +536,11 @@ public final class FileStorageUtils {
}
storageManager.deleteFileInMediaScan(file.getAbsolutePath());
file.delete();
try {
Files.deleteIfExists(file.toPath());
} catch (Exception e) {
Log_OC.e("Error deleting file: ", e.getMessage());
}
}
public static boolean deleteRecursive(File file) {
+16
View File
@@ -0,0 +1,16 @@
<!--
~ Nextcloud - Android Client
~
~ SPDX-FileCopyrightText: 2018-2024 Google LLC
~ SPDX-License-Identifier: Apache-2.0
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="960"
android:viewportHeight="960">
<path
android:pathData="M792,904 L643,755q-19,11 -39.5,20T560,790v-84q6,-2 12,-4.5t12,-5.5L264,376q-11,25 -17.5,51.5T240,482q0,45 17,87.5t53,78.5l10,10v-98h80v240L160,800v-80h110l-16,-14q-49,-49 -71.5,-106.5T160,482q0,-45 11.5,-86.5T205,317L56,168l57,-57 736,736 -57,57ZM757,641 L697,581q11,-24 17,-50t6,-53q0,-45 -17,-87.5T650,312l-10,-10v98h-80v-240h240v80L690,240l16,14q49,49 71.5,106.5T800,478q0,45 -11.5,85.5T757,641ZM379,263l-60,-60q19,-11 39,-19t42,-14v84q-5,2 -10.5,4t-10.5,5Z"
android:fillColor="#757575"/>
</vector>
@@ -8,10 +8,12 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
style="@style/Widget.Material3.BottomSheet"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:paddingBottom="@dimen/standard_half_padding"
android:id="@+id/bottom_sheet"
app:layout_behavior="com.google.android.material.bottomsheet.BottomSheetBehavior">
<com.google.android.material.bottomsheet.BottomSheetDragHandleView
+3 -1
View File
@@ -544,7 +544,6 @@
قد تستغرق هذه العملية بعض الوقت.</string>
<string name="manage_space_title">إدارة المساحة</string>
<string name="max_file_count_warning_message">تجاوزت الحد الأقصى المسموح به لزمن رفع الملفات. رجاءً، لا تقم برفع عدد يزيد عن 500 ملف في كل مرة.</string>
<string name="media_err_invalid_progressive_playback">ملف الوسائط لا يمكن بثه</string>
<string name="media_err_io">تعذرت قراءة ملف الوسائط</string>
<string name="media_err_malformed">يحتوي ملف الوسائط على ترميز غير صحيح</string>
@@ -662,6 +661,7 @@
<string name="prefs_category_about">حول</string>
<string name="prefs_category_details">تفاصيل</string>
<string name="prefs_category_dev">التطوير</string>
<string name="prefs_category_files">الملفّات</string>
<string name="prefs_category_general">عام</string>
<string name="prefs_category_more">المزيد</string>
<string name="prefs_category_sync">زامن</string>
@@ -846,6 +846,8 @@
<string name="signup_with_provider">التسجيل عبر مزوّد خدمة</string>
<string name="single_sign_on_request_token" formatted="true">هل تسمح لـ%1$s بالوصول إلى حسابك %2$s في Nextcloud؟</string>
<string name="sort_by">ترتيب</string>
<string name="sort_favorites_first">فرز المفضلة أولا</string>
<string name="sort_folders_before_files">فرز المجلدات قبل الملفات</string>
<string name="ssl_validator_btn_details_hide">إخفاء</string>
<string name="ssl_validator_btn_details_see">تفاصيل</string>
<string name="ssl_validator_header">لا يمكن التحقق من هوية الخادم</string>
+3
View File
@@ -393,6 +393,7 @@
<string name="prefs_add_account">Amestar cuenta</string>
<string name="prefs_category_about">Tocante a</string>
<string name="prefs_category_details">Detalles</string>
<string name="prefs_category_files">Ficheros</string>
<string name="prefs_category_general">Xeneral</string>
<string name="prefs_category_more">Más</string>
<string name="prefs_category_sync">Sincronizar</string>
@@ -486,6 +487,8 @@
<string name="signup_with_provider">Rexistrase con un fornidor</string>
<string name="single_sign_on_request_token" formatted="true">¿Quies permitr que %1$s acceda a la cuenta de Nextcloud %2$s?</string>
<string name="sort_by">Ordenar per</string>
<string name="sort_favorites_first">Ordenar los favoritos primero</string>
<string name="sort_folders_before_files">Ordenar les carpetes enantes que los ficheros</string>
<string name="ssl_validator_btn_details_hide">Esconder</string>
<string name="ssl_validator_btn_details_see">Detalles</string>
<string name="ssl_validator_header">Nun se pudo verificar la identidá del sirvidor</string>
+20 -1
View File
@@ -93,12 +93,19 @@
<string name="auth_unsupported_multiaccount">%1$s does not support multiple accounts</string>
<string name="auth_wrong_connection_title">Could not establish connection</string>
<string name="authenticator_activity_cancel_login">Cancel Login</string>
<string name="authenticator_activity_empty_base_url">Please enter a valid server address.</string>
<string name="authenticator_activity_empty_response_message">Unable to fetch login details. Please try again.</string>
<string name="authenticator_activity_login_error">There was an issue processing your login request. Please try again later.</string>
<string name="authenticator_activity_no_web_browser_found">No browser is available to open this link.</string>
<string name="authenticator_activity_please_complete_login_process">Please complete login process in your browser</string>
<string name="auto_upload_battery_saver_mode_warning">Auto-upload is paused because Battery Saver is on.</string>
<string name="auto_upload_file_behaviour_kept_in_folder">kept in original folder, as it is readonly</string>
<string name="auto_upload_low_battery_warning_info">Low battery, upload might take longer</string>
<string name="auto_upload_on_wifi">Only upload on unmetered Wi-Fi</string>
<string name="auto_upload_path">/AutoUpload</string>
<string name="auto_upload_sub_folder_warning">This folder is already included in the parent folder’s sync, which may cause duplicate uploads</string>
<string name="auto_upload_wifi_only_warning_info">Waiting for Wi-Fi to start uploading</string>
<string name="auto_upload_worker_start_text">Uploading files from %s to %s</string>
<string name="autoupload_configure">Configure</string>
<string name="autoupload_create_new_custom_folder">Create new custom folder setup</string>
<string name="autoupload_custom_folder">Set up a custom folder</string>
@@ -202,6 +209,7 @@
<string name="contacts_preferences_import_scheduled_fail">Import failed to start. Please try again</string>
<string name="contacts_preferences_no_file_found">No file found</string>
<string name="contacts_preferences_something_strange_happened">Could not find your last backup!</string>
<string name="content_observer_work_notification_title">Detecting content changes</string>
<string name="copied_to_clipboard">Copied to clipboard</string>
<string name="copy_file_error">An error occurred while trying to copy this file or folder</string>
<string name="copy_file_invalid_into_descendent">It is not possible to copy a folder into one of its own underlying folders</string>
@@ -450,6 +458,7 @@
<string name="file_not_found_cannot_share">File not found. Unable to create a share.</string>
<string name="file_not_synced">File could not be synced. Showing latest available version.</string>
<string name="file_rename">Rename</string>
<string name="file_upload_limit_message">You can upload up to %d files at once."</string>
<string name="file_upload_worker_error_notification_title">Upload failed. No internet connection</string>
<string name="file_upload_worker_same_file_already_exists">%s already exists, no conflict detected</string>
<string name="file_version_restored_error">Error restoring file version!</string>
@@ -471,6 +480,11 @@
<string name="folder_already_exists">Folder already exists</string>
<string name="folder_best_viewed_in">This folder is best viewed in %1$s.</string>
<string name="folder_confirm_create">Create</string>
<string name="folder_download_counter">%1$d of %2$d &#183; %3$s</string>
<string name="folder_download_error_notification_title">An error occurred during synchronisation of the %s folder</string>
<string name="folder_download_insufficient_disk_space_notification_title">Insufficient disk space, synchronisation cancelled</string>
<string name="folder_download_success_notification_title">%s folder successfully synchronised</string>
<string name="folder_download_worker_ticker_id">Syncing…</string>
<string name="folder_list_empty_headline">No folders here</string>
<string name="folder_name_empty">Folder name cannot be empty</string>
<string name="folder_picker_choose_button_text">Choose</string>
@@ -558,7 +572,6 @@
<string name="manage_space_clear_data">Clear data</string>
<string name="manage_space_description">Settings, database and server certificates from %1$s\'s data will be deleted permanently. \n\nDownloaded files will be kept untouched.\n\nThis process can take a while.</string>
<string name="manage_space_title">Manage space</string>
<string name="max_file_count_warning_message">You have reached the maximum file upload limit. Please upload fewer than 500 files at a time.</string>
<string name="media_err_invalid_progressive_playback">The media file cannot be streamed</string>
<string name="media_err_io">Could not read the media file</string>
<string name="media_err_malformed">The media file has incorrect encoding</string>
@@ -607,6 +620,8 @@
<string name="notification_action_failed">Failed to execute action.</string>
<string name="notification_channel_background_operations_description">Show notifications to interact result of background operations</string>
<string name="notification_channel_background_operations_name">Background operations</string>
<string name="notification_channel_content_observer_description">Detects local file changes</string>
<string name="notification_channel_content_observer_name_short">Content observer</string>
<string name="notification_channel_download_description">Shows download progress</string>
<string name="notification_channel_download_name_short">Downloads</string>
<string name="notification_channel_file_sync_description">Shows file sync progress and results</string>
@@ -683,6 +698,7 @@
<string name="prefs_category_about">About</string>
<string name="prefs_category_details">Details</string>
<string name="prefs_category_dev">Dev</string>
<string name="prefs_category_files">Files</string>
<string name="prefs_category_general">General</string>
<string name="prefs_category_more">More</string>
<string name="prefs_category_sync">Sync</string>
@@ -874,6 +890,8 @@
<string name="signup_with_provider">Sign up with provider</string>
<string name="single_sign_on_request_token" formatted="true">Allow %1$s to access your Nextcloud account %2$s?</string>
<string name="sort_by">Sort by</string>
<string name="sort_favorites_first">Sort favourites first</string>
<string name="sort_folders_before_files">Sort folders before files</string>
<string name="ssl_validator_btn_details_hide">Hide</string>
<string name="ssl_validator_btn_details_see">Details</string>
<string name="ssl_validator_header">The identity of the server could not be verified</string>
@@ -984,6 +1002,7 @@
<string name="unified_search_fragment_calendar_event_not_found">Event not found, you can always sync to update. Redirecting to web…</string>
<string name="unified_search_fragment_contact_not_found">Contact not found, you can always sync to update. Redirecting to web…</string>
<string name="unified_search_fragment_permission_needed">Permissions are required to open search result otherwise it will redirected to web…</string>
<string name="unified_search_fragment_search_in_this_folder">In this folder</string>
<string name="unknown">Unknown</string>
<string name="unlock_file">Unlock file</string>
<string name="unread_comments">Unread comments exist</string>
@@ -541,6 +541,7 @@
<string name="prefs_category_about">Относно</string>
<string name="prefs_category_details">Подробности</string>
<string name="prefs_category_dev">Разработка</string>
<string name="prefs_category_files">Файлове</string>
<string name="prefs_category_general">Общи</string>
<string name="prefs_category_more">Още</string>
<string name="prefs_category_sync">Синхронизиране</string>
+11 -9
View File
@@ -141,7 +141,7 @@
<string name="common_error">Error</string>
<string name="common_error_out_memory">Memòria insuficient</string>
<string name="common_error_unknown">Error desconegut</string>
<string name="common_leave_this_share">Abandona aquest element compartit</string>
<string name="common_leave_this_share">Abandona aquest compartició</string>
<string name="common_loading">S\'està carregant…</string>
<string name="common_next">Següent</string>
<string name="common_no">No</string>
@@ -215,7 +215,7 @@
<string name="create_new_folder">Carpeta nova</string>
<string name="create_new_presentation">Nova presentació</string>
<string name="create_new_spreadsheet">Nou full de càlcul</string>
<string name="create_rich_workspace">Afegiu una descripció per a la carpeta</string>
<string name="create_rich_workspace">Afegeix una descripció per a la carpeta</string>
<string name="creates_rich_workspace">Afegeix la descripció de la carpeta</string>
<string name="credentials_disabled">Credencials inhabilitades</string>
<string name="daily_backup">Còpia de seguretat diària</string>
@@ -233,7 +233,7 @@
<string name="did_not_check_for_dupes">No s\'han verificat els duplicats.</string>
<string name="digest_algorithm_not_available">Aquest algorisme de resum no és disponible al vostre telèfon.</string>
<string name="direct_login_failed">l\'Inici de sessió via enllaç directe ha fallat!</string>
<string name="direct_login_text">Inicia la sessió amb %1$s a %2$s</string>
<string name="direct_login_text">Inici de sessió amb %1$s a %2$s</string>
<string name="disable_new_media_folder_detection_notifications">Inhabilita</string>
<string name="dismiss">Descarta</string>
<string name="dismiss_notification_description">Descarta la notificació</string>
@@ -443,7 +443,7 @@
<string name="folder_already_exists">La carpeta ja existeix</string>
<string name="folder_confirm_create">Crea</string>
<string name="folder_list_empty_headline">No hi ha carpetes</string>
<string name="folder_name_empty">El nom del fitxer no pot estar buit</string>
<string name="folder_name_empty">El nom de la carpeta no pot estar buit</string>
<string name="folder_picker_choose_button_text">Tria</string>
<string name="folder_picker_choose_caption_text">Trieu la carpeta de destinació</string>
<string name="folder_picker_copy_button_text">Còpia</string>
@@ -463,7 +463,7 @@
<string name="forward">Endavant</string>
<string name="fourHours">4 hores</string>
<string name="gplay_restriction">Google ha restringit la baixada de fitxers APK/AAB!</string>
<string name="grid_file_features_live_photo_content_description">Aquesta icona indica la disponibilitat de la foto en directe</string>
<string name="grid_file_features_live_photo_content_description">Aquesta icona indica la disponibilitat de la foto en viu</string>
<string name="hidden_file_name_warning">El nom donarà com a resultat un fitxer ocult</string>
<string name="hint_name">Nom</string>
<string name="hint_note">Nota</string>
@@ -528,7 +528,6 @@
<string name="manage_space_clear_data">Neteja dades</string>
<string name="manage_space_description">Els paràmetres, la base de dades i els certificats del servidor %1$s se suprimiran de forma permanent. \n\nEls fitxers descarregats romandran intactes.\n\n Aquest procés pot trigar una estona.</string>
<string name="manage_space_title">Gestió d\'espai</string>
<string name="max_file_count_warning_message">Has assolit el límit màxim de pujada de fitxers. Puja menys de 500 fitxers alhora.</string>
<string name="media_err_invalid_progressive_playback">No es pot reproduir el fitxer multimèdia</string>
<string name="media_err_io">No s\'ha pogut llegir el fitxer multimèdia</string>
<string name="media_err_malformed">El fitxer multimèdia té una codificació incorrecta</string>
@@ -641,13 +640,14 @@
<string name="prefs_category_about">Quant a</string>
<string name="prefs_category_details">Detalls</string>
<string name="prefs_category_dev">Dev</string>
<string name="prefs_category_files">Fitxers</string>
<string name="prefs_category_general">General</string>
<string name="prefs_category_more">Més</string>
<string name="prefs_category_sync">Sincronitza</string>
<string name="prefs_daily_backup_summary">Còpia de seguretat diària del calendari i els contactes</string>
<string name="prefs_daily_contact_backup_summary">Còpia de seguretat diària dels vostres contactes</string>
<string name="prefs_data_storage_location">Ubicació de l\'emmagatzematge de dades</string>
<string name="prefs_data_storage_location_summary">Gestioneu la ubicació de l\'emmagatzematge de dades</string>
<string name="prefs_data_storage_location_summary">Administrar la ubicació de l\'emmagatzematge de dades</string>
<string name="prefs_e2e_active">S\'ha configurat el xifratge d\'extrem a extrem</string>
<string name="prefs_e2e_mnemonic">E2E mnemònic</string>
<string name="prefs_e2e_no_device_credentials">Per mostrar els mnemònics, si us plau habiliteu les credencials del dispositiu.</string>
@@ -803,6 +803,8 @@
<string name="signup_with_provider">Registreu-vos amb el proveïdor</string>
<string name="single_sign_on_request_token" formatted="true">Voleu permetre que %1$s accedeixi al vostre compte de Nextcloud %2$s?</string>
<string name="sort_by">Ordena per</string>
<string name="sort_favorites_first">Ordena primer els preferits</string>
<string name="sort_folders_before_files">Ordena les carpetes abans dels fitxers</string>
<string name="ssl_validator_btn_details_hide">Amaga</string>
<string name="ssl_validator_btn_details_see">Detalls</string>
<string name="ssl_validator_header">No s\'ha pogut verificar la identitat del servidor</string>
@@ -852,7 +854,7 @@
<string name="subject_shared_with_you">\"%1$s\" us ha estat compartit</string>
<string name="subject_user_shared_with_you">%1$s us ha compartit %2$s</string>
<string name="subtitle_photos_only">Només fotografies</string>
<string name="subtitle_photos_videos">Fotos i vídeos</string>
<string name="subtitle_photos_videos">Fotografies i vídeos</string>
<string name="subtitle_videos_only">Només vídeos</string>
<string name="suggest">Suggereix</string>
<string name="sync">Sincronitza</string>
@@ -993,7 +995,7 @@
<string name="uploads_view_upload_status_succeeded">Completat</string>
<string name="uploads_view_upload_status_unknown_fail">Error desconegut</string>
<string name="uploads_view_upload_status_virus_detected">S\'ha detectat un virus. No es pot completar la pujada!</string>
<string name="uploads_view_upload_status_waiting_exit_power_save_mode">S\'està esperant al mode d\'apagada segur</string>
<string name="uploads_view_upload_status_waiting_exit_power_save_mode">S\'està esperant a sortir del mode d\'estalvi d\'energia</string>
<string name="uploads_view_upload_status_waiting_for_charging">S\'està esperant càrrega de bateria</string>
<string name="uploads_view_upload_status_waiting_for_wifi">S\'està esperant una wifi sense mètrica de consum de dades</string>
<string name="user_icon">Usuari</string>
+15 -1
View File
@@ -98,11 +98,13 @@
<string name="authenticator_activity_login_error">Došlo k problému při zpracovávání vašeho požadavku na přihlášení se. Zkuste to prosím později.</string>
<string name="authenticator_activity_no_web_browser_found">Není k dispozici žádný webový prohlížeč pro otevření tohoto odkazu.</string>
<string name="authenticator_activity_please_complete_login_process">Dokončete proces přihlášení prostřednictvím webového prohlížeče</string>
<string name="auto_upload_battery_saver_mode_warning">Automatické nahrávání je pozastaveno, protože je zapnuté šetření energií z akumulátoru.</string>
<string name="auto_upload_file_behaviour_kept_in_folder">ponechán v původní složce, protože je pouze pro čtení</string>
<string name="auto_upload_low_battery_warning_info">Téměř vybitý akumulátor – nahrávání může trvat déle</string>
<string name="auto_upload_on_wifi">Nahrávat pouze přes neúčtované Wi-Fi připojení</string>
<string name="auto_upload_path">/AutoUpload</string>
<string name="auto_upload_sub_folder_warning">Tato složka už je obsažena v synchronizaci nadřazené složky, což může způsobovat duplicitní nahrávání</string>
<string name="auto_upload_wifi_only_warning_info">Čeká se na Wi-Fi, aby bylo možné spustit nahrávání</string>
<string name="auto_upload_worker_start_text">Jsou nahrávány soubory z %s do %s</string>
<string name="autoupload_configure">Nastavit</string>
<string name="autoupload_create_new_custom_folder">Vytvořit nové uživatelsky určené nastavení složky</string>
@@ -207,6 +209,7 @@
<string name="contacts_preferences_import_scheduled_fail">Import se nepodařilo spustit. Zkuste to znovu</string>
<string name="contacts_preferences_no_file_found">Nenalezen žádný soubor</string>
<string name="contacts_preferences_something_strange_happened">Nepodařilo se najít vaši nejaktuálnější zálohu!</string>
<string name="content_observer_work_notification_title">Zjišťování změn obsahu</string>
<string name="copied_to_clipboard">Zkopírováno do schránky</string>
<string name="copy_file_error">Při pokusu o zkopírování tohoto souboru či složky došlo k chybě</string>
<string name="copy_file_invalid_into_descendent">Není možné zkopírovat složku do některé z jejích vlastních podsložek</string>
@@ -455,6 +458,7 @@
<string name="file_not_found_cannot_share">Soubor nenalezen. Sdílení proto není možné vytvořit.</string>
<string name="file_not_synced">Soubor se nepodařilo synchronizovat. Zobrazuje se poslední dostupná verze.</string>
<string name="file_rename">Přejmenovat</string>
<string name="file_upload_limit_message">Je možné nahrávat až %d souborů naráz.“</string>
<string name="file_upload_worker_error_notification_title">Nahrávání se nezdařilo. Není k dispozici připojení k Internetu</string>
<string name="file_upload_worker_same_file_already_exists">%s už existuje – nezjištěny žádné konflikty</string>
<string name="file_version_restored_error">Chyba při obnovování verze souboru!</string>
@@ -476,6 +480,11 @@
<string name="folder_already_exists">Složka už existuje</string>
<string name="folder_best_viewed_in">Tuto složku je nejlépe prohlížet si v %1$s.</string>
<string name="folder_confirm_create">Vytvořit</string>
<string name="folder_download_counter">%1$d z %2$d &#183; %3$s</string>
<string name="folder_download_error_notification_title">Při synchronizování složky %s došlo k chybě</string>
<string name="folder_download_insufficient_disk_space_notification_title">Nedostatek prostoru na disku – synchronizace zrušena</string>
<string name="folder_download_success_notification_title">složka %s úspěšně synchronizována</string>
<string name="folder_download_worker_ticker_id">Synchronizování…</string>
<string name="folder_list_empty_headline">Nejsou zde žádné složky</string>
<string name="folder_name_empty">Název složky je třeba vyplnit</string>
<string name="folder_picker_choose_button_text">Vybrat</string>
@@ -563,7 +572,6 @@
<string name="manage_space_clear_data">Vyčistit data</string>
<string name="manage_space_description">Nastavení, databáze a certifikáty serverů z dat %1$s budou natrvalo smazány. \n\nStažené soubory zůstanou beze změny.\n\nTento proces může chvíli trvat.</string>
<string name="manage_space_title">Spravovat úložný prostor</string>
<string name="max_file_count_warning_message">Dosáhli jste maximálního limitu počtu nahrávaných souborů. Nahrávejte méně než 500 souborů naráz.</string>
<string name="media_err_invalid_progressive_playback">Soubor s médii se nedaří proudově vysílat (stream)</string>
<string name="media_err_io">Nepodařilo se číst soubor média</string>
<string name="media_err_malformed">Soubor médií nemá platné kódování</string>
@@ -612,6 +620,8 @@
<string name="notification_action_failed">Akci se nepodařilo provést.</string>
<string name="notification_channel_background_operations_description">Zobrazovat upozornění pro interakci s výsledkem operací na pozadí</string>
<string name="notification_channel_background_operations_name">Operace na pozadí</string>
<string name="notification_channel_content_observer_description">Zjišťovat změny v lokálních souborech</string>
<string name="notification_channel_content_observer_name_short">Pozorovatel obsahu</string>
<string name="notification_channel_download_description">Zobrazuje ukazatel postupu stahování</string>
<string name="notification_channel_download_name_short">Stažené</string>
<string name="notification_channel_file_sync_description">Zobrazuje průběh a výsledek synchronizace souborů</string>
@@ -688,6 +698,7 @@
<string name="prefs_category_about">O aplikaci</string>
<string name="prefs_category_details">Podrobnosti</string>
<string name="prefs_category_dev">Vývojové</string>
<string name="prefs_category_files">Soubory</string>
<string name="prefs_category_general">Obecné</string>
<string name="prefs_category_more">Více</string>
<string name="prefs_category_sync">Synchronizovat</string>
@@ -879,6 +890,8 @@
<string name="signup_with_provider">Zaregistrovat se u poskytovatele</string>
<string name="single_sign_on_request_token" formatted="true">Povolit %1$s přístup k vašemu Nextcloud účtu %2$s?</string>
<string name="sort_by">Řadit podle</string>
<string name="sort_favorites_first">Seřadit od oblíbených</string>
<string name="sort_folders_before_files">Při řazení zobrazovat složky a pak až soubory</string>
<string name="ssl_validator_btn_details_hide">Skrýt</string>
<string name="ssl_validator_btn_details_see">Podrobnosti</string>
<string name="ssl_validator_header">Totožnost serveru se nepodařilo ověřit</string>
@@ -988,6 +1001,7 @@
<string name="unified_search_fragment_calendar_event_not_found">Událost nenalezena, ale ještě pořád je možné aktualizovat synchronizací. Přesměrovává se na web…</string>
<string name="unified_search_fragment_contact_not_found">Kontakt nenalezen, ale ještě pořád je možné aktualizovat synchronizací. Přesměrovává se na web…</string>
<string name="unified_search_fragment_permission_needed">Pro otevření výsledků vyhledávání je zapotřebí oprávnění – pokud chybí, přesměruje na web…</string>
<string name="unified_search_fragment_search_in_this_folder">V této složce</string>
<string name="unknown">Neznámé</string>
<string name="unlock_file">Odemknout soubor</string>
<string name="unread_comments">Existuje nepřečtený komentář</string>
+9 -7
View File
@@ -15,7 +15,7 @@
<string name="action_switch_list_view">List visning</string>
<string name="actionbar_calendar_contacts_restore">Gendan kontakter og kalender</string>
<string name="actionbar_mkdir">Ny mappe</string>
<string name="actionbar_move_or_copy">Flyt eller kopier</string>
<string name="actionbar_move_or_copy">Flyt eller kopiér</string>
<string name="actionbar_open_with">Åbn med</string>
<string name="actionbar_search">Søg</string>
<string name="actionbar_see_details">Detaljer</string>
@@ -211,7 +211,7 @@
<string name="copy_file_invalid_into_descendent">Det er ikke muligt at kopiere en mappe til en af dens egne undermapper</string>
<string name="copy_file_invalid_overwrite">Filen findes allerede i destinationsmappen</string>
<string name="copy_file_not_found">Ikke muligt at kopiere. Undersøg venligst om filen eksisterer.</string>
<string name="copy_link">Kopier link</string>
<string name="copy_link">Kopiér link</string>
<string name="copy_move_to_encrypted_folder_not_supported">Kopier/flyt til krypteret mappe endnu ikke understøttet.</string>
<string name="could_not_download_image">Kunne ikke hente hele billedet</string>
<string name="could_not_retrieve_shares">Kunne ikke hente delte drev</string>
@@ -460,9 +460,9 @@
<string name="file_version_restored_successfully">Succes ved genskabning af fil version!</string>
<string name="filedetails_details">Detaljer</string>
<string name="filedetails_download">Download</string>
<string name="filedetails_export">Eksporter</string>
<string name="filedetails_export">Eksportér</string>
<string name="filedetails_renamed_in_upload_msg">File omdøbt %1$sunder overførelse</string>
<string name="filedetails_sync_file">Synkroniser</string>
<string name="filedetails_sync_file">Synkronisér</string>
<string name="filedisplay_no_file_selected">Ingen fil valgt</string>
<string name="filename_empty">Filnavnet kan ikke stå tomt.</string>
<string name="filename_forbidden_characters">Ugyldige tegn: / \\ &lt; &gt; : \" | ? *</string>
@@ -479,7 +479,7 @@
<string name="folder_name_empty">Mappenavnet må ikke være tomt</string>
<string name="folder_picker_choose_button_text">Vælg</string>
<string name="folder_picker_choose_caption_text">Vælg destinationsmappe</string>
<string name="folder_picker_copy_button_text">Kopier</string>
<string name="folder_picker_copy_button_text">Kopiér</string>
<string name="folder_picker_move_button_text">Flyt</string>
<string name="forbidden_permissions">Du har ikke tilladelse %s</string>
<string name="forbidden_permissions_copy">til at kopiere denne fil</string>
@@ -562,7 +562,6 @@
<string name="manage_space_clear_data">Fjern data</string>
<string name="manage_space_description">Indstillinger, database og server certifikater fra %1$s\'s data vil blive permanent slettede.\n\nHentede filer vil forblive uberørte.\n\n Denne proces kan tage lidt tid.</string>
<string name="manage_space_title">Håndter plads</string>
<string name="max_file_count_warning_message">Du har nået din maksimale uploadgrænse. Upload venligst mindre end 500 filer på samme tid.</string>
<string name="media_err_invalid_progressive_playback">Medie filen kan ikke streames.</string>
<string name="media_err_io">Kunne ikke læse mediefil</string>
<string name="media_err_malformed">Mediefilen har en ugyldig indkodning.</string>
@@ -687,6 +686,7 @@
<string name="prefs_category_about">Om</string>
<string name="prefs_category_details">Detaljer</string>
<string name="prefs_category_dev">Udvikling</string>
<string name="prefs_category_files">Filer</string>
<string name="prefs_category_general">Generel</string>
<string name="prefs_category_more">Mere</string>
<string name="prefs_category_sync">Synkronisér</string>
@@ -819,7 +819,7 @@
<string name="share">Del</string>
<string name="share_allow_download_and_sync_permission">Tillad download og synkronisering</string>
<string name="share_cannot_update_empty_note">Vi kunne ikke opdatere delingen. Tilføj en note og prøv igen.</string>
<string name="share_copy_link">Del og kopier link</string>
<string name="share_copy_link">Del og kopiér link</string>
<string name="share_create_permission">Opret</string>
<string name="share_custom_permission">Brugerdefinerede rettigheder</string>
<string name="share_delete_permission">Slet</string>
@@ -879,6 +879,8 @@
<string name="signup_with_provider">Indskrivning hos udbyder</string>
<string name="single_sign_on_request_token" formatted="true">Tillad %1$s adgang til din Nextcloud konto %2$s?</string>
<string name="sort_by">Sorter efter</string>
<string name="sort_favorites_first">Vis favoritter først</string>
<string name="sort_folders_before_files">Sorter mapper før filer</string>
<string name="ssl_validator_btn_details_hide">Gem</string>
<string name="ssl_validator_btn_details_see">Detaljer</string>
<string name="ssl_validator_header">Serverens identitet kunne ikke verificeres</string>
+13 -2
View File
@@ -209,6 +209,7 @@
<string name="contacts_preferences_import_scheduled_fail">Der Import konnte nicht gestartet werden. Bitte erneut versuchen</string>
<string name="contacts_preferences_no_file_found">Keine Datei gefunden</string>
<string name="contacts_preferences_something_strange_happened">Wir können Ihr letztes Backup nicht finden!</string>
<string name="content_observer_work_notification_title">Erkennen von Inhaltsänderungen</string>
<string name="copied_to_clipboard">In die Zwischenablage kopiert</string>
<string name="copy_file_error">Es ist ein Fehler beim Kopieren der Datei oder des Ordners aufgetreten.</string>
<string name="copy_file_invalid_into_descendent">Es ist nicht möglich, einen Ordner in einen seiner Unterordner zu kopieren</string>
@@ -457,6 +458,7 @@
<string name="file_not_found_cannot_share">Datei nicht gefunden. Freigabe kann nicht erstellt werden.</string>
<string name="file_not_synced">Datei konnte nicht synchronisiert werden. Zeige letzte verfügbare Version. </string>
<string name="file_rename">Umbenennen</string>
<string name="file_upload_limit_message">Es können bis zu %d Dateien gleichzeitig hochgeladen werden.</string>
<string name="file_upload_worker_error_notification_title">Upload fehlgeschlagen. Keine Internetverbindung</string>
<string name="file_upload_worker_same_file_already_exists">%s existiert bereits, kein Konflikt erkannt</string>
<string name="file_version_restored_error">Fehler beim Wiederherstellen der Dateiversion!</string>
@@ -478,6 +480,11 @@
<string name="folder_already_exists">Ordner existiert bereits</string>
<string name="folder_best_viewed_in">Dieser Ordner lässt sich am besten in %1$s anzeigen.</string>
<string name="folder_confirm_create">Erstellen</string>
<string name="folder_download_counter">%1$d von %2$d &#183; %3$s</string>
<string name="folder_download_error_notification_title">Es ist ein Fehler beim Synchronisieren des Ordners %s aufgetreten.</string>
<string name="folder_download_insufficient_disk_space_notification_title">Unzureichender Speicherplatz, Synchronisierung abgebrochen</string>
<string name="folder_download_success_notification_title">%s Ordner erfolgreich synchronisiert</string>
<string name="folder_download_worker_ticker_id">Synchronisiere…</string>
<string name="folder_list_empty_headline">Keine Ordner vorhanden</string>
<string name="folder_name_empty">Der Ordnername darf nicht leer sein</string>
<string name="folder_picker_choose_button_text">Auswählen</string>
@@ -565,7 +572,6 @@
<string name="manage_space_clear_data">Daten löschen</string>
<string name="manage_space_description">Einstellungen, Datenbank und Serverzertifikate von %1$s\'s Daten werden dauerhaft gelöscht.\n\nHerunter geladene Dateien bleiben unangetastet.\n\nDieser Vorgang kann eine Zeit dauern.</string>
<string name="manage_space_title">Verwalte Speicherplatz</string>
<string name="max_file_count_warning_message">Sie haben die maximale Anzahl an Datei-Uploads erreicht. Bitte laden Sie weniger als 500 Dateien gleichzeitig hoch.</string>
<string name="media_err_invalid_progressive_playback">Die Mediendatei kann nicht gestreamt werden</string>
<string name="media_err_io">Die Mediendatei konnte nicht gelesen werden</string>
<string name="media_err_malformed">Mediendatei ist nicht korrekt encodiert</string>
@@ -614,6 +620,8 @@
<string name="notification_action_failed">Aktion konnte nicht ausgeführt werden</string>
<string name="notification_channel_background_operations_description">Benachrichtigungen anzeigen, um auf die Ergebnisse von Hintergrundoperationen zu reagieren</string>
<string name="notification_channel_background_operations_name">Hintergrundvorgänge</string>
<string name="notification_channel_content_observer_description">Erkennt lokale Dateiänderungen</string>
<string name="notification_channel_content_observer_name_short">Inhaltsmonitor</string>
<string name="notification_channel_download_description">Zeigt den Herunterlade-Fortschritt an</string>
<string name="notification_channel_download_name_short">Downloads</string>
<string name="notification_channel_file_sync_description">Zeigt den Fortschritt der Dateisynchronisierung und die Ergebnisse an</string>
@@ -690,6 +698,7 @@
<string name="prefs_category_about">Über</string>
<string name="prefs_category_details">Details</string>
<string name="prefs_category_dev">Dev</string>
<string name="prefs_category_files">Dateien</string>
<string name="prefs_category_general">Allgemein</string>
<string name="prefs_category_more">Mehr</string>
<string name="prefs_category_sync">Synchronisieren</string>
@@ -881,6 +890,8 @@
<string name="signup_with_provider">Mit Provider anmelden</string>
<string name="single_sign_on_request_token" formatted="true">Zulassen, dass %1$s auf Ihr Nextcloud Konto %2$s zugreifen darf?</string>
<string name="sort_by">Sortieren nach</string>
<string name="sort_favorites_first">Favoriten zuerst sortieren</string>
<string name="sort_folders_before_files">Ordner vor Dateien sortieren</string>
<string name="ssl_validator_btn_details_hide">Ausblenden</string>
<string name="ssl_validator_btn_details_see">Details</string>
<string name="ssl_validator_header">Die Identität des Servers konnte nicht verifiziert werden</string>
@@ -956,7 +967,7 @@
<string name="sync_not_enough_space_dialog_title">Nicht genügend Speicherplatz</string>
<string name="sync_status_button">Status-synchronisieren-Button</string>
<string name="sync_string_files">Dateien</string>
<string name="sync_warning_button">Schaltfläche „Synchronisationswarnung“</string>
<string name="sync_warning_button">Schaltfläche \"Synchronisationswarnung\"</string>
<string name="synced_folder_settings_button">Einstellungs-Button</string>
<string name="synced_folders_configure_folders">Ordner konfigurieren</string>
<string name="synced_folders_new_info">Die Sofort-Uploads wurden vollständig überarbeitet. Konfiguriere Sie Ihren automatischen Uploader im Hauptmenü.\n\nGenießen Sie den verbesserten Auto-Upload.</string>
+2
View File
@@ -696,6 +696,8 @@
<string name="signup_with_provider">Σύνδεση με πάροχο</string>
<string name="single_sign_on_request_token" formatted="true">Να επιτραπεί%1$sη πρόσβαση στον λογαριασμό σας Nextcloud %2$s ?</string>
<string name="sort_by">Ταξινόμηση κατά</string>
<string name="sort_favorites_first">Ταξινόμηση των αγαπημένων πρώτα</string>
<string name="sort_folders_before_files">Ταξινόμηση φακέλων πριν από τα αρχεία</string>
<string name="ssl_validator_btn_details_hide">Απόκρυψη</string>
<string name="ssl_validator_btn_details_see">Λεπτομέρειες</string>
<string name="ssl_validator_header">Δεν ήταν δυνατή η επαλήθευση της ταυτότητας του διακομιστή</string>
+1 -1
View File
@@ -484,7 +484,6 @@
<string name="manage_space_clear_data">Borrar datos</string>
<string name="manage_space_description">Las configuraciones , base de datos y certificados del servidor de los datos de %1$s serán borrados permanentemente.\n\nLos archivos descargados se mantendrán sin cambios.\n\nEste proceso puede tomar algo de tiempo. </string>
<string name="manage_space_title">Administrar espacio</string>
<string name="max_file_count_warning_message">Ha alcanzado el límite de carga máxima de archivos. Por favor, cargue menos de 500 archivos a la vez.</string>
<string name="media_err_invalid_progressive_playback">No se puede transmitir el archivo multimedia</string>
<string name="media_err_io">No fue posible leer el archivo de medios</string>
<string name="media_err_malformed">El archivo de medios tiene una codificacion incorrecta</string>
@@ -585,6 +584,7 @@
<string name="prefs_category_about">Acerca de</string>
<string name="prefs_category_details">Detalles</string>
<string name="prefs_category_dev">Dev</string>
<string name="prefs_category_files">Archivo</string>
<string name="prefs_category_general">General</string>
<string name="prefs_category_more">Más</string>
<string name="prefs_category_sync">Sincronizar</string>
@@ -377,6 +377,7 @@
<string name="prefs_category_about">Acerca de</string>
<string name="prefs_category_details">Detalles</string>
<string name="prefs_category_dev">Desarrollo</string>
<string name="prefs_category_files">Archivo</string>
<string name="prefs_category_general">General</string>
<string name="prefs_category_more">Más</string>
<string name="prefs_category_sync">Sincronizar</string>
Loaded 100 of 156 files, more files were not shown because too many files have changed in this diff. Show more