Compare commits

...
Author SHA1 Message Date
Tobias Kaminsky 7c2fc79824 daily dev 20190105 2019-01-05 00:33:13 +01:00
Tobias Kaminsky 4fac5b07a0 Merge pull request #3420 from nextcloud/newServer
New server image, uses php 7.2
2019-01-04 12:54:32 +01:00
tobiasKaminsky eeddeefc5f reformat
Signed-off-by: tobiasKaminsky <[email protected]>
2019-01-04 12:45:20 +01:00
tobiasKaminsky 142990052e new server image, uses php 7.2
Signed-off-by: tobiasKaminsky <[email protected]>
2019-01-04 12:24:20 +01:00
Nextcloud bot bf8a54d0e2 [tx-robot] updated from transifex 2019-01-03 01:48:35 +00:00
Nextcloud bot d7a4f270dc [tx-robot] updated from transifex 2019-01-02 01:48:35 +00:00
Nextcloud bot f1978da46f [tx-robot] updated from transifex 2019-01-01 01:48:28 +00:00
Nextcloud bot 1f5025a6e6 [tx-robot] updated from transifex 2018-12-31 01:50:34 +00:00
Nextcloud bot be80e38e2f [tx-robot] updated from transifex 2018-12-30 01:52:17 +00:00
Nextcloud bot 9a6bee5407 [tx-robot] updated from transifex 2018-12-28 15:55:04 +00:00
Nextcloud bot fb047939ef [tx-robot] updated from transifex 2018-12-27 01:51:07 +00:00
Nextcloud bot 1b359d3998 [tx-robot] updated from transifex 2018-12-26 01:52:47 +00:00
Nextcloud bot 4306850628 [tx-robot] updated from transifex 2018-12-25 01:48:29 +00:00
Nextcloud bot 5759e9b3ba [tx-robot] updated from transifex 2018-12-24 01:57:16 +00:00
Nextcloud bot ce86481516 [tx-robot] updated from transifex 2018-12-23 01:52:53 +00:00
Nextcloud bot acf2a1edfa [tx-robot] updated from transifex 2018-12-22 01:48:38 +00:00
Tobias Kaminsky 7e585c273c daily dev 20181222 2018-12-22 00:33:12 +01:00
Tobias Kaminsky c1a75ffc1d Merge pull request #3391 from nextcloud/checkForTemplates
Add check for template support
2018-12-21 14:15:06 +01:00
tobiasKaminsky d93d5ef151 revert library branch
Signed-off-by: tobiasKaminsky <[email protected]>
2018-12-21 13:12:44 +01:00
Nextcloud bot f50453bb27 [tx-robot] updated from transifex 2018-12-21 01:49:16 +00:00
Nextcloud bot 37b8ae825c [tx-robot] updated from transifex 2018-12-20 01:50:24 +00:00
Nextcloud bot a89dcd94d8 [tx-robot] updated from transifex 2018-12-19 01:52:08 +00:00
tobiasKaminsky 4490a02efa add check for template support
Signed-off-by: tobiasKaminsky <[email protected]>
2018-12-18 16:24:57 +01:00
Andy Scherzinger 315769979b Merge pull request #3386 from nextcloud/dependabot/gradle/androidx.multidex-multidex-2.0.1
Bump multidex from 2.0.0 to 2.0.1
2018-12-18 07:18:09 +01:00
dependabot[bot] ce0d4ba3db Bump multidex from 2.0.0 to 2.0.1
Bumps multidex from 2.0.0 to 2.0.1.

Signed-off-by: dependabot[bot] <[email protected]>
2018-12-18 02:16:42 +00:00
Nextcloud bot abb58599f7 [tx-robot] updated from transifex 2018-12-18 01:50:06 +00:00
Tobias Kaminsky c5378a7d8d daily dev 20181218 2018-12-18 00:33:14 +01:00
Andy Scherzinger 3634c432df Merge pull request #3312 from nextcloud/changelog340
Changelog for 3.4.0
2018-12-17 17:21:18 +01:00
Andy Scherzinger 64afaf2820 3.4.0 final 2018-12-17 15:32:26 +01:00
Nextcloud bot 4176ac2917 [tx-robot] updated from transifex 2018-12-17 01:50:18 +00:00
Nextcloud bot 557f8b53e9 [tx-robot] updated from transifex 2018-12-16 01:50:42 +00:00
Tobias Kaminsky 677133ad4f daily dev 20181216 2018-12-16 00:33:09 +01:00
Andy Scherzinger 7eba750e4a Merge pull request #2886 from nextcloud/syncDownloaded
Sync downloaded
2018-12-15 12:20:00 +01:00
Nextcloud bot 3e3a32e588 [tx-robot] updated from transifex 2018-12-15 01:48:13 +00:00
Tobias Kaminsky c0515a02f6 daily dev 20181215 2018-12-15 00:33:08 +01:00
Andy Scherzinger 59c6169ccc Merge pull request #3372 from nextcloud/350alpha
Bump to next major: 3.5.0
2018-12-14 10:31:25 +01:00
tobiasKaminsky bf134ceece bump to next major
Signed-off-by: tobiasKaminsky <[email protected]>
2018-12-14 10:21:04 +01:00
tobiasKaminsky 6cf499828c Sync all downloaded files in background
Signed-off-by: tobiasKaminsky <[email protected]>
2018-12-14 09:54:30 +01:00
Tobias Kaminsky 824a91ad5d Merge pull request #3130 from nextcloud/activityPreview
Activity: use image url instead of generating previews by oneself
2018-12-14 09:01:23 +01:00
tobiasKaminsky 52f77239f7 use image url instead of generating previews by oneself
Signed-off-by: tobiasKaminsky <[email protected]>
2018-12-14 08:01:19 +01:00
Tobias Kaminsky 803cfadb1f Merge pull request #3368 from nextcloud/fixStreaming
Fix streaming
2018-12-14 07:47:25 +01:00
Tobias Kaminsky 23b91eb2e8 Merge pull request #3365 from nextcloud/trashbinCheckIfActive
Trashbin: do UI changes of async only if activity is still up and running
2018-12-14 07:46:53 +01:00
Nextcloud bot 2ab33bd1f4 [tx-robot] updated from transifex 2018-12-14 01:50:38 +00:00
Tobias Kaminsky 83c5306c9b daily dev 20181214 2018-12-14 00:33:21 +01:00
Andy Scherzinger 6daf772501 Merge pull request #3120 from nextcloud/showComments
Show unread comments count
2018-12-13 23:34:16 +01:00
tobiasKaminsky d45f047a38 fix streaming
Signed-off-by: tobiasKaminsky <[email protected]>
2018-12-13 15:53:35 +01:00
tobiasKaminsky 2e9428ad69 do UI changes of async only if activity is still up and running
Signed-off-by: tobiasKaminsky <[email protected]>
2018-12-13 13:44:11 +01:00
Andy Scherzinger 3079073da6 Merge pull request #3359 from nextcloud/androidJobBackport
Use own fork with backported android 9 fix
2018-12-13 12:41:17 +01:00
Andy Scherzinger 4894157942 Merge pull request #3357 from nextcloud/fixNPEonResume
FileDetailSharingFragment: fix npe on resume
2018-12-13 12:40:50 +01:00
Andy Scherzinger 4d192025aa Merge pull request #3360 from nextcloud/fixNPEonCapability
Capability was read too early
2018-12-13 12:40:13 +01:00
tobiasKaminsky 5838918a0a Capability was read too early
Signed-off-by: tobiasKaminsky <[email protected]>
2018-12-13 11:01:27 +01:00
tobiasKaminsky 075bb74736 use own fork with backported android 9 fix
Signed-off-by: tobiasKaminsky <[email protected]>
2018-12-13 10:22:23 +01:00
tobiasKaminsky a37b34fc78 fix npe on resume
Signed-off-by: tobiasKaminsky <[email protected]>
2018-12-13 09:21:32 +01:00
Andy Scherzinger 2d028495c7 Merge pull request #3350 from nextcloud/batteryOptimizationWarning
Add battery optimization warning
2018-12-13 08:51:26 +01:00
tobiasKaminsky 8c679c20b7 remove unneeded parenthesis
Signed-off-by: tobiasKaminsky <[email protected]>
2018-12-13 08:27:17 +01:00
Tobias Kaminsky 034058ff1e Merge pull request #3356 from nextcloud/lintIgnoreDepUpdates
ignore lint warning for gradle deps as we have dependabot
2018-12-13 08:20:11 +01:00
nextcloud-android-bot 7d02c0b045 Drone: update Lint results to reflect reduced error/warning count [skip ci] 2018-12-13 07:05:41 +00:00
Tobias Kaminsky 88ce0bd256 Merge c09fd78e90 into 41fbb08395 2018-12-13 07:02:03 +00:00
tobiasKaminsky c09fd78e90 ignore lint warning for gradle deps as we have dependabot
Signed-off-by: tobiasKaminsky <[email protected]>
2018-12-13 08:01:02 +01:00
Andy Scherzinger 41fbb08395 Merge pull request #3352 from nextcloud/dependabot/gradle/androidx.test-runner-1.1.1
Bump runner from 1.1.0 to 1.1.1
2018-12-13 07:46:12 +01:00
dependabot[bot] 398503a4b3 Bump runner from 1.1.0 to 1.1.1
Bumps runner from 1.1.0 to 1.1.1.

Signed-off-by: dependabot[bot] <[email protected]>
2018-12-13 06:42:23 +00:00
Tobias Kaminsky ad60cc2415 Merge pull request #3353 from nextcloud/dependabot/gradle/androidx.test.espresso-espresso-core-3.1.1
Bump espresso-core from 3.1.0 to 3.1.1
2018-12-13 07:41:22 +01:00
dependabot[bot] 0a2ed61fa9 Bump espresso-core from 3.1.0 to 3.1.1
Bumps espresso-core from 3.1.0 to 3.1.1.

Signed-off-by: dependabot[bot] <[email protected]>
2018-12-13 07:32:52 +01:00
Tobias Kaminsky 4b7175a89c Merge pull request #3355 from nextcloud/dependabot/gradle/androidx.test.espresso-espresso-contrib-3.1.1
Bump espresso-contrib from 3.1.0 to 3.1.1
2018-12-13 07:31:33 +01:00
Tobias Kaminsky efadfa6759 Merge pull request #3354 from nextcloud/dependabot/gradle/androidx.test-rules-1.1.1
Bump rules from 1.1.0 to 1.1.1
2018-12-13 07:31:11 +01:00
dependabot[bot] 045e3feb81 Bump espresso-contrib from 3.1.0 to 3.1.1
Bumps espresso-contrib from 3.1.0 to 3.1.1.

Signed-off-by: dependabot[bot] <[email protected]>
2018-12-13 02:18:23 +00:00
dependabot[bot] 4e9f48341f Bump rules from 1.1.0 to 1.1.1
Bumps rules from 1.1.0 to 1.1.1.

Signed-off-by: dependabot[bot] <[email protected]>
2018-12-13 02:18:20 +00:00
Nextcloud bot f6b7f5ae80 [tx-robot] updated from transifex 2018-12-13 01:50:25 +00:00
tobiasKaminsky d60465d3b0 remove alpha in list
Signed-off-by: tobiasKaminsky <[email protected]>
2018-12-12 16:32:45 +01:00
tobiasKaminsky 63211df14a use two xml for comments, one for list, one for grid
Signed-off-by: tobiasKaminsky <[email protected]>
2018-12-12 16:25:27 +01:00
Andy Scherzinger 0eed3b00a9 add stroke 2018-12-12 14:56:57 +01:00
tobiasKaminsky 8f63377171 add svg
use 757575

Signed-off-by: tobiasKaminsky <[email protected]>
2018-12-12 14:30:59 +01:00
tobiasKaminsky 7aa8496c68 fix lint
Signed-off-by: tobiasKaminsky <[email protected]>
2018-12-12 13:07:02 +01:00
tobiasKaminsky cb1bff1ce0 add battery optimization warning
Signed-off-by: tobiasKaminsky <[email protected]>
2018-12-12 11:50:53 +01:00
Nextcloud bot 396c8c4906 [tx-robot] updated from transifex 2018-12-12 01:56:43 +00:00
Tobias Kaminsky e8264e0231 daily dev 20181212 2018-12-12 00:33:18 +01:00
Andy Scherzinger 5901f97c0d Merge pull request #3346 from nextcloud/matchCompleteBranchName
Match complete branch name
2018-12-11 17:03:46 +01:00
tobiasKaminsky 4d24261e84 match complete branch name
Signed-off-by: tobiasKaminsky <[email protected]>
2018-12-11 13:28:07 +01:00
Tobias Kaminsky b6efa6c8b6 Merge pull request #3344 from nextcloud/addLabelsToTemplate
Add labels to template
2018-12-11 11:11:36 +01:00
tobiasKaminsky d0ed64f977 add labels to template
Signed-off-by: tobiasKaminsky <[email protected]>
2018-12-11 11:10:36 +01:00
Andy Scherzinger e77216cfbe Merge pull request #3339 from nextcloud/findbugsExlude
ignore warning about reading file
2018-12-11 10:12:08 +01:00
Tobias Kaminsky 653c82351c Merge pull request #3330 from nextcloud/sso-fix-request-header
add request headers if present
2018-12-11 09:51:12 +01:00
Tobias Kaminsky a353e3ca6a Merge pull request #3297 from nextcloud/dependabot/gradle/com.github.chrisbanes-PhotoView-2.3.0
Bump PhotoView from 2.1.4 to 2.3.0
2018-12-11 09:43:58 +01:00
tobiasKaminsky 19e9692541 ignore warning about reading file
Signed-off-by: tobiasKaminsky <[email protected]>
2018-12-11 09:38:06 +01:00
tobiasKaminsky 3e0c4e70c5 show comments in grid view, but then no share icon
Signed-off-by: tobiasKaminsky <[email protected]>
2018-12-11 09:37:18 +01:00
tobiasKaminsky 9e115d91d0 show comments in grid view, but then no share icon
Signed-off-by: tobiasKaminsky <[email protected]>
2018-12-11 09:07:51 +01:00
dependabot[bot] 77da74be3a Bump PhotoView from 2.1.4 to 2.3.0
Bumps [PhotoView](https://github.com/chrisbanes/PhotoView) from 2.1.4 to 2.3.0.
- [Release notes](https://github.com/chrisbanes/PhotoView/releases)
- [Commits](https://github.com/chrisbanes/PhotoView/compare/2.1.4...2.3.0)

Signed-off-by: dependabot[bot] <[email protected]>
2018-12-11 07:43:05 +00:00
tobiasKaminsky cad6cd6a19 show unread comments
Signed-off-by: tobiasKaminsky <[email protected]>
2018-12-11 08:09:07 +01:00
Tobias Kaminsky 3c8475c8b0 daily dev 20181211 2018-12-11 00:35:07 +01:00
Andy Scherzinger 594eba571f Merge pull request #3336 from nextcloud/useRestoreFileVersionRemoteOperation
Use RestoreFileVersionRemoteOperation
2018-12-11 00:24:58 +01:00
Andy Scherzinger bf51735633 Merge pull request #3089 from nextcloud/androidX
Switch to AndroidX
2018-12-11 00:19:17 +01:00
tobiasKaminsky 478fccf6a1 disable uiAutomator (for now)
Signed-off-by: tobiasKaminsky <[email protected]>
2018-12-10 17:26:53 +01:00
tobiasKaminsky bbd1f96f76 use RestoreFileVersionRemoteOperation
Signed-off-by: tobiasKaminsky <[email protected]>
2018-12-10 16:49:45 +01:00
tobiasKaminsky 59cf6b9ba4 switch to AndroidX
Signed-off-by: tobiasKaminsky <[email protected]>
2018-12-10 13:11:03 +01:00
Tobias Kaminsky 3e7efd86ff Merge pull request #3324 from nextcloud/moveOperationsToLibrary
Move operations to library
2018-12-10 13:05:06 +01:00
tobiasKaminsky e5597e14c9 import location change in test
Signed-off-by: tobiasKaminsky <[email protected]>
2018-12-10 10:22:55 +01:00
Andy Scherzinger e197b31c15 revert lib back to master 2018-12-10 09:48:45 +01:00
Nextcloud bot 9c9079df54 [tx-robot] updated from transifex 2018-12-10 05:22:23 +00:00
Nextcloud bot f605fd597c [tx-robot] updated from transifex 2018-12-09 01:50:57 +00:00
Nextcloud bot bf034d2383 [tx-robot] updated from transifex 2018-12-08 01:48:24 +00:00
Tobias Kaminsky 34c016ff27 daily dev 20181208 2018-12-08 00:34:41 +01:00
Andy Scherzinger f3844cfb73 Merge pull request #3328 from nextcloud/analyticsZero
Analytics: show 0 instead of ""
2018-12-07 14:50:01 +01:00
David Luhmer 135a36a10a add request headers if present 2018-12-07 14:17:36 +01:00
tobiasKaminsky 0f34902fb4 show 0 instead of ""
Signed-off-by: tobiasKaminsky <[email protected]>
2018-12-07 14:12:40 +01:00
tobiasKaminsky 43ce903559 move all operation to library
rename library operation to RemoteOperation
some cleanups

Signed-off-by: tobiasKaminsky <[email protected]>
2018-12-07 07:43:12 +01:00
Nextcloud bot 9f9adfe9af [tx-robot] updated from transifex 2018-12-07 01:49:48 +00:00
Tobias Kaminsky 41321b77c5 daily dev 20181207 2018-12-07 00:34:18 +01:00
Andy Scherzinger 62afaefff6 Merge pull request #3322 from nextcloud/unusedRessources
remove unused resources / add to lint ignore
2018-12-06 17:26:36 +01:00
nextcloud-android-bot 0aceb0d001 Drone: update Lint results to reflect reduced error/warning count [skip ci] 2018-12-06 14:05:47 +00:00
Tobias Kaminsky 30b5f87c1d Merge 84303837a6 into 70c364ebe8 2018-12-06 13:38:19 +00:00
tobiasKaminsky 84303837a6 remove unused resources / add to lint ignore
Signed-off-by: tobiasKaminsky <[email protected]>
2018-12-06 14:37:35 +01:00
Andy Scherzinger 70c364ebe8 Merge pull request #3323 from nextcloud/showOldLint
Show old lint warning from stable branch
2018-12-06 14:31:28 +01:00
tobiasKaminsky 9264eb8ecc show old lint warning from stable branch
Signed-off-by: tobiasKaminsky <[email protected]>
2018-12-06 11:24:16 +01:00
Andy Scherzinger 0c07ef376b Merge pull request #3321 from nextcloud/strugee-patch-1
Fix typo
2018-12-06 10:32:40 +01:00
AJ Jordan 2285b4208e Fix typo 2018-12-06 02:43:29 -05:00
Nextcloud bot 7be83616a1 [tx-robot] updated from transifex 2018-12-06 01:56:13 +00:00
Tobias Kaminsky 51db0a6f57 daily dev 20181206 2018-12-06 00:33:06 +01:00
Andy Scherzinger 8264ed040d Merge pull request #3319 from nextcloud/lombokForHasPreview
use lombok for has preview
2018-12-05 09:52:12 +01:00
tobiasKaminsky f020e02dfb use lombok for has preview
rename
cleanup
fix warnings

Signed-off-by: tobiasKaminsky <[email protected]>
2018-12-05 09:06:11 +01:00
Tobias Kaminsky b997966e90 Merge pull request #3226 from nextcloud/NPEonTrashbin
UI can already be non-existent
2018-12-05 08:11:56 +01:00
Nextcloud bot c1e014373f [tx-robot] updated from transifex 2018-12-05 01:50:55 +00:00
tobiasKaminsky 8cebbf8146 also check for other UI elements
Signed-off-by: tobiasKaminsky <[email protected]>
2018-12-04 11:24:27 +01:00
Nextcloud bot d3d78ab744 [tx-robot] updated from transifex 2018-12-04 01:59:47 +00:00
Tobias Kaminsky 96af008653 daily dev 20181204 2018-12-04 00:33:12 +01:00
Andy Scherzinger 1910e4cfa6 Merge pull request #3313 from nextcloud/firstRun_buttonsBold
First run: make buttons bold
2018-12-03 14:53:08 +01:00
Tobias Kaminsky 3fc27cc927 Merge pull request #3303 from dan0xii/curco
Sets the cursor colour on the passcode screen to grey.
2018-12-03 14:49:47 +01:00
Andy Scherzinger 3fdc757ac1 Merge pull request #3316 from nextcloud/directEditingOnDBupgradeMaster
Add db upgrade step: add direct_editing
2018-12-03 14:05:54 +01:00
tobiasKaminsky b972c46686 add db upgrade step: add direct_editing
Signed-off-by: tobiasKaminsky <[email protected]>
2018-12-03 13:45:50 +01:00
tobiasKaminsky 09d1fe7654 make buttons bold
Signed-off-by: tobiasKaminsky <[email protected]>
2018-12-03 13:16:43 +01:00
Tobias Kaminsky e1514db205 daily dev 20181203 2018-12-03 13:13:44 +01:00
Tobias Kaminsky 3a2f68523d Merge pull request #3311 from nextcloud/directEditingCollabora
Add direct editing capability
2018-12-03 12:07:29 +01:00
Andy Scherzinger 53cc99b032 changelog for 3.4.0 2018-12-03 11:30:55 +01:00
tobiasKaminsky 6b038492b1 add direct editing capability
Signed-off-by: tobiasKaminsky <[email protected]>
2018-12-03 10:35:38 +01:00
Andy Scherzinger f4f9af41dc Merge pull request #3307 from nextcloud/dependabot/gradle/org.parceler-parceler-api-1.1.12
Bump parceler-api from 1.1.11 to 1.1.12
2018-12-03 06:37:47 +01:00
Andy Scherzinger a7c95b46c5 Merge pull request #3306 from nextcloud/dependabot/gradle/org.parceler-parceler-1.1.12
Bump parceler from 1.1.11 to 1.1.12
2018-12-03 06:37:27 +01:00
dependabot[bot] 2eb476639a Bump parceler-api from 1.1.11 to 1.1.12
Bumps [parceler-api](https://github.com/johncarl81/parceler) from 1.1.11 to 1.1.12.
- [Release notes](https://github.com/johncarl81/parceler/releases)
- [Changelog](https://github.com/johncarl81/parceler/blob/master/CHANGELOG.adoc)
- [Commits](https://github.com/johncarl81/parceler/compare/parceler-project-1.1.11...parceler-project-1.1.12)

Signed-off-by: dependabot[bot] <[email protected]>
2018-12-03 02:14:22 +00:00
dependabot[bot] cc5b9a10eb Bump parceler from 1.1.11 to 1.1.12
Bumps [parceler](https://github.com/johncarl81/parceler) from 1.1.11 to 1.1.12.
- [Release notes](https://github.com/johncarl81/parceler/releases)
- [Changelog](https://github.com/johncarl81/parceler/blob/master/CHANGELOG.adoc)
- [Commits](https://github.com/johncarl81/parceler/compare/parceler-project-1.1.11...parceler-project-1.1.12)

Signed-off-by: dependabot[bot] <[email protected]>
2018-12-03 02:14:22 +00:00
Nextcloud bot 36df660d29 [tx-robot] updated from transifex 2018-12-03 01:47:34 +00:00
Nextcloud bot 3bbc5adecd [tx-robot] updated from transifex 2018-12-02 01:50:01 +00:00
Daniel Bailey 9bc802dddf Sets the cursor colour on the passcode screen to grey.
Before this change, if the user has a custom colour set on their
nextcloud server, the cursor would be blue regardless of the custom
theme colour.
2018-12-01 12:31:07 +00:00
Nextcloud bot 6e6bbb7d8b [tx-robot] updated from transifex 2018-12-01 01:47:35 +00:00
Nextcloud bot 8650de4d45 [tx-robot] updated from transifex 2018-11-30 01:48:29 +00:00
Andy Scherzinger 49bbf945fe Merge pull request #3299 from nextcloud/stableFrom90
use 90 as first stable
2018-11-29 12:53:05 +01:00
tobiasKaminsky b4fc0388c0 use 90 as first stable
Signed-off-by: tobiasKaminsky <[email protected]>
2018-11-29 11:13:04 +01:00
Tobias Kaminsky bd253f1584 Merge pull request #3286 from nextcloud/hideDownloadsAlsoOnFolders
Hide download also on folders
2018-11-29 10:47:24 +01:00
Nextcloud bot 1762ecbd26 [tx-robot] updated from transifex 2018-11-29 01:50:25 +00:00
Andy Scherzinger 6011fc42c5 Merge pull request #3126 from nextcloud/richDocumentsInWebView
Add support for richdocuments
2018-11-28 14:52:31 +01:00
nextcloud-android-bot 76b8681061 Drone: update Lint results to reflect reduced error/warning count [skip ci] 2018-11-28 14:37:29 +01:00
tobiasKaminsky 4d485d00e7 use lombok
Signed-off-by: tobiasKaminsky <[email protected]>
2018-11-28 14:37:29 +01:00
tobiasKaminsky 3a7ef82632 Add support for richdocuments
Signed-off-by: tobiasKaminsky <[email protected]>
2018-11-28 14:37:25 +01:00
Andy Scherzinger 0807696761 Merge pull request #3281 from nextcloud/dotFileSortingTest
Test case for sorting hidden files/folders
2018-11-28 14:20:57 +01:00
Andy Scherzinger be320936d9 Test case for sorting hidden files/folders - see #3280 2018-11-28 09:04:49 +01:00
Nextcloud bot ce5acb05ab [tx-robot] updated from transifex 2018-11-28 01:50:16 +00:00
Nextcloud bot 3c87e5a14f [tx-robot] updated from transifex 2018-11-27 04:12:35 +00:00
Nextcloud bot d5da8965d3 [tx-robot] updated from transifex 2018-11-24 01:45:59 +00:00
tobiasKaminsky b785b0b18d hide download also on folders
Signed-off-by: tobiasKaminsky <[email protected]>
2018-11-23 14:49:58 +01:00
Andy Scherzinger 7a0af443b2 Merge pull request #3276 from hlovdal/readme-update
Simplify grep + awk command to just awk in readme file
2018-11-23 13:57:40 +01:00
Andy Scherzinger 90e74a6722 Merge pull request #3279 from nextcloud/dependabot/gradle/org.mockito-mockito-core-2.23.4
Bump mockito-core from 2.23.0 to 2.23.4
2018-11-21 08:36:03 +01:00
Nextcloud bot d177ed6755 [tx-robot] updated from transifex 2018-11-21 01:49:18 +00:00
dependabot[bot] ed103ad530 Bump mockito-core from 2.23.0 to 2.23.4
Bumps [mockito-core](https://github.com/mockito/mockito) from 2.23.0 to 2.23.4.
- [Release notes](https://github.com/mockito/mockito/releases)
- [Commits](https://github.com/mockito/mockito/compare/v2.23.0...v2.23.4)

Signed-off-by: dependabot[bot] <[email protected]>
2018-11-21 01:12:25 +00:00
Nextcloud bot fb06caff1c [tx-robot] updated from transifex 2018-11-20 01:50:08 +00:00
Håkon Løvdal e7a5cfd45a readme: simplify grep + awk -> awk 2018-11-20 00:50:48 +01:00
Nextcloud bot b34001d866 [tx-robot] updated from transifex 2018-11-17 02:04:55 +00:00
Nextcloud bot b5827c7ec1 [tx-robot] updated from transifex 2018-11-16 01:49:37 +00:00
Nextcloud bot f4d25af034 [tx-robot] updated from transifex 2018-11-15 01:52:19 +00:00
Nextcloud bot d6fcc4869f [tx-robot] updated from transifex 2018-11-13 01:50:57 +00:00
Andy Scherzinger df5eddcd85 Merge pull request #3260 from nextcloud/moveMinVersion
move MINIMUM_SUPPORTED_SERVER_VERSION to MainApp
2018-11-12 09:57:14 +01:00
Andy Scherzinger 9d0457f16e Merge pull request #3259 from nextcloud/hideDownloadOnlyForNC15
Hide download is only working for >=NC15
2018-11-12 09:54:39 +01:00
tobiasKaminsky 5d40c37121 move MINIMUM_SUPPORTED_SERVER_VERSION to MainApp
Signed-off-by: tobiasKaminsky <[email protected]>
2018-11-12 09:41:20 +01:00
tobiasKaminsky c72076ae21 Hide download is only working for >=NC15
Signed-off-by: tobiasKaminsky <[email protected]>
2018-11-12 09:24:54 +01:00
Andy Scherzinger 828b0a7d75 Merge pull request #3245 from nextcloud/enhanceFileDetailSharingFragment
FileDetailSharingFragment: extract common used objects as fields
2018-11-12 09:03:44 +01:00
Andy Scherzinger b31d650b28 Merge pull request #3133 from nextcloud/sso-fix-exception
fix exception handling
2018-11-12 08:37:46 +01:00
Nextcloud bot 4ed02c40b7 [tx-robot] updated from transifex 2018-11-12 01:48:27 +00:00
Nextcloud bot 64bfb52541 [tx-robot] updated from transifex 2018-11-11 01:49:36 +00:00
nextcloud-android-bot dbf8f9e68a Drone: update Lint results to reflect reduced error/warning count [skip ci] 2018-11-10 09:42:20 +00:00
Andy Scherzinger 8069f04766 Merge pull request #3252 from nextcloud/removeActionEditText
remove class ActionEditText
2018-11-10 10:36:33 +01:00
Nextcloud bot 23a1f2530e [tx-robot] updated from transifex 2018-11-10 01:47:55 +00:00
Andy Scherzinger 60d13157d5 Merge pull request #3250 from nextcloud/i18n
SyncedFolderAdapter: add locale for number
2018-11-09 20:13:41 +01:00
nextcloud-android-bot 8a19ee7d84 Drone: update Lint results to reflect reduced error/warning count [skip ci] 2018-11-09 13:03:26 +00:00
Tobias Kaminsky 730f10e9d7 Merge 9a24eb221d into bc2f52840b 2018-11-09 13:00:57 +00:00
tobiasKaminsky 9a24eb221d split up viewHolder
Signed-off-by: tobiasKaminsky <[email protected]>
2018-11-09 13:59:50 +01:00
tobiasKaminsky 3705e5a209 add locale
Signed-off-by: tobiasKaminsky <[email protected]>
2018-11-09 13:36:38 +01:00
tobiasKaminsky 40268978e7 code formatting
Signed-off-by: tobiasKaminsky <[email protected]>
2018-11-09 13:18:10 +01:00
tobiasKaminsky 959cce44fb code formatting
Signed-off-by: tobiasKaminsky <[email protected]>
2018-11-09 13:17:12 +01:00
nextcloud-android-bot 404bbe3f13 Drone: update Lint results to reflect reduced error/warning count [skip ci] 2018-11-09 10:33:45 +00:00
Tobias Kaminsky 70978089b6 Merge b35ddef4fb into bc2f52840b 2018-11-09 10:29:11 +00:00
tobiasKaminsky b35ddef4fb remove class
Signed-off-by: tobiasKaminsky <[email protected]>
2018-11-09 11:28:34 +01:00
tobiasKaminsky 28112b6444 extract common used objects as fields
Signed-off-by: tobiasKaminsky <[email protected]>
2018-11-09 11:20:03 +01:00
Nextcloud bot bc2f52840b [tx-robot] updated from transifex 2018-11-09 01:46:47 +00:00
Nextcloud bot 2e6fb57cef [tx-robot] updated from transifex 2018-11-08 01:46:49 +00:00
Andy Scherzinger c29fddfc7e Merge pull request #3249 from nextcloud/wakelockTimeout
use suggested timeout of 10min
2018-11-07 23:44:34 +01:00
nextcloud-android-bot 9780b3ef08 Drone: update Lint results to reflect reduced error/warning count [skip ci] 2018-11-07 22:31:46 +00:00
Tobias Kaminsky b2301cb040 Merge 85170d2389 into 93bc0b4050 2018-11-07 22:29:26 +00:00
tobiasKaminsky 85170d2389 use suggested timeout of 10min
Signed-off-by: tobiasKaminsky <[email protected]>
2018-11-07 23:28:06 +01:00
Andy Scherzinger 93bc0b4050 Merge pull request #3243 from nextcloud/hideDownload
Add hide download option to share via link
2018-11-07 22:14:29 +01:00
nextcloud-android-bot 77211f2cf0 Drone: update Lint results to reflect reduced error/warning count [skip ci] 2018-11-07 21:01:24 +00:00
Tobias Kaminsky 37d34de34f Merge 350f9e9ef4 into bef25b7bc0 2018-11-07 20:58:14 +00:00
Andy Scherzinger 350f9e9ef4 Revert lib back to master 2018-11-07 21:57:45 +01:00
tobiasKaminsky 8d676ea556 Add hide download option to share via link
Signed-off-by: tobiasKaminsky <[email protected]>
2018-11-07 21:57:34 +01:00
Andy Scherzinger bef25b7bc0 Merge pull request #3248 from nextcloud/disableRNGwarning
disable lint warning on not secure RNG on < 4.3
2018-11-07 21:44:13 +01:00
tobiasKaminsky a1167ea3d7 disable lint warning on not secure RNG on < 4.3
Signed-off-by: tobiasKaminsky <[email protected]>
2018-11-07 21:33:29 +01:00
Andy Scherzinger 71784259f9 Merge pull request #3247 from nextcloud/removeClass
Remove not needed class
2018-11-07 21:16:02 +01:00
nextcloud-android-bot f6709fcf6d Drone: update Lint results to reflect reduced error/warning count [skip ci] 2018-11-07 14:16:17 +00:00
Tobias Kaminsky 0d3211e974 Merge d2e867d61b into 13b76b3fb9 2018-11-07 14:11:31 +00:00
tobiasKaminsky d2e867d61b remove not needed class
Signed-off-by: tobiasKaminsky <[email protected]>
2018-11-07 15:09:16 +01:00
Nextcloud bot 13b76b3fb9 [tx-robot] updated from transifex 2018-11-07 01:46:44 +00:00
Tobias Kaminsky 1742509309 daily dev 20181107 2018-11-07 00:33:35 +01:00
David Luhmer 6850d73c40 fix codacy issue 2018-11-06 21:40:53 +01:00
Andy Scherzinger 0b1e102715 Merge pull request #3236 from nextcloud/lombok
Use lombok to generate POJO boilerplate code
2018-11-06 13:06:08 +01:00
Andy Scherzinger e46818f3fa rename boolean variable for nicer getter/setter names 2018-11-06 12:52:46 +01:00
Andy Scherzinger 9c5a390257 Merge pull request #3241 from nextcloud/lombok-2
Further lombok usage
2018-11-06 12:43:17 +01:00
Andy Scherzinger 1f5bae0dbb Resolve #3148 adding lombok to more data classes 2018-11-06 09:25:37 +01:00
Andy Scherzinger 8091470ae3 codacy: remove useless parentheses 2018-11-06 08:35:07 +01:00
Andy Scherzinger 162ccfc15c Resolve #3148 adding lombok to some larger data classes 2018-11-06 08:22:24 +01:00
Andy Scherzinger 0aae8653d8 Resolve #3148 adding lombok support for the app 2018-11-06 08:21:56 +01:00
Nextcloud bot 3dab2b0a4c [tx-robot] updated from transifex 2018-11-06 01:48:28 +00:00
Tobias Kaminsky 52c000a50f daily dev 20181106 2018-11-06 00:32:15 +01:00
Andy Scherzinger 4f1d4f4250 Merge pull request #3216 from nextcloud/hasPreviewProperty
Add has-preview property
2018-11-05 21:53:38 +01:00
Andy Scherzinger 69b86b5e6c fixes after and revert back to master lib 2018-11-05 21:47:42 +01:00
tobiasKaminsky c381bc9da8 add has-preview property
Signed-off-by: tobiasKaminsky <[email protected]>
2018-11-05 21:32:49 +01:00
Andy Scherzinger 8ba7257628 Merge pull request #3225 from nextcloud/notificationOutOfBounds
As async, it can happen that list already changed
2018-11-05 21:20:11 +01:00
Andy Scherzinger 560ae2c311 Merge pull request #3227 from nextcloud/preventNPEonAccount
SyncedFolderActivity: prevent account NPE
2018-11-05 21:16:36 +01:00
Andy Scherzinger c0c1e0085b Merge pull request #3228 from nextcloud/npeOnRetrievingMnemonic
NPE on some devices when showing Mnemonic
2018-11-05 21:15:04 +01:00
Andy Scherzinger c8a87a2e06 Merge pull request #3233 from nextcloud/uploadIT
Upload IT: add non-zero uploads
2018-11-05 20:08:20 +01:00
tobiasKaminsky 49d516969d upload IT: add non-zero uploads
Signed-off-by: tobiasKaminsky <[email protected]>
2018-11-05 16:22:35 +01:00
Andy Scherzinger b32e1705d9 Merge pull request #3230 from nextcloud/addAllLanguageToLint
test add languages to lint
2018-11-05 15:46:50 +01:00
tobiasKaminsky bd58321cfa Replace specific languages with placeholder
Signed-off-by: tobiasKaminsky <[email protected]>
2018-11-05 15:08:18 +01:00
Tobias Kaminsky 7ea630a88e Merge pull request #3231 from nextcloud/anaylsisVariableFx
Analysis: variable was not replaced
2018-11-05 15:05:46 +01:00
tobiasKaminsky e37e11cc3e variable was not replaced
Signed-off-by: tobiasKaminsky <[email protected]>
2018-11-05 12:55:43 +01:00
tobiasKaminsky facf8a2aae correct lower bound
Signed-off-by: tobiasKaminsky <[email protected]>
2018-11-05 12:32:20 +01:00
Andy Scherzinger c5ff313d27 Merge pull request #3229 from nextcloud/changelog332
Changelog for 3.3.2
2018-11-05 12:24:48 +01:00
tobiasKaminsky c9d77884c5 changelog for 3.3.2
Signed-off-by: tobiasKaminsky <[email protected]>
2018-11-05 12:22:02 +01:00
tobiasKaminsky f20f74fec9 NPE on some devices when showing Mnemonic
Signed-off-by: tobiasKaminsky <[email protected]>
2018-11-05 10:24:22 +01:00
tobiasKaminsky e250b61e01 prevent account NPE
Signed-off-by: tobiasKaminsky <[email protected]>
2018-11-05 09:31:26 +01:00
tobiasKaminsky 6210a69297 UI can already be non-existent
Signed-off-by: tobiasKaminsky <[email protected]>
2018-11-05 08:56:42 +01:00
tobiasKaminsky f91a9725d7 As async, it can happen that list already changed
Signed-off-by: tobiasKaminsky <[email protected]>
2018-11-05 08:48:51 +01:00
Nextcloud bot 0d5b557bf2 [tx-robot] updated from transifex 2018-11-05 01:48:07 +00:00
Nextcloud bot bcbbdfb9df [tx-robot] updated from transifex 2018-11-04 01:52:58 +00:00
Nextcloud bot dd95a6af0f [tx-robot] updated from transifex 2018-11-03 01:48:03 +00:00
Tobias Kaminsky d74c5da260 daily dev 20181103 2018-11-03 00:33:07 +01:00
Nextcloud bot c4cfd0de25 [tx-robot] updated from transifex 2018-11-02 01:49:56 +00:00
Tobias Kaminsky 0e23d84b72 daily dev 20181102 2018-11-02 00:32:10 +01:00
Andy Scherzinger 7944422a2f Merge pull request #3214 from nextcloud/adjustLint
Lint changes
2018-11-01 23:07:10 +01:00
tobiasKaminsky 8ac77c731e lint changes
Signed-off-by: tobiasKaminsky <[email protected]>
2018-11-01 10:59:08 +01:00
Andy Scherzinger c15bc58a39 Merge pull request #3205 from nextcloud/sortTrash
Add specific sort order for upload/local/trashbin
2018-11-01 09:02:57 +01:00
tobiasKaminsky ab8bcbddc2 add specific sort order for upload/local/trashbin
trashbin: new->old by default

Signed-off-by: tobiasKaminsky <[email protected]>
2018-11-01 08:35:41 +01:00
Tobias Kaminsky df5aa98cd0 daily dev 20181101 2018-11-01 00:32:22 +01:00
Andy Scherzinger 90302c0de0 Merge pull request #3207 from nextcloud/fingerprintBug
Fix fingerprint bug
2018-10-31 20:37:18 +01:00
tobiasKaminsky ad7771d8e4 Fix fingerprint bug: on certain devices no fingerprint, but only pin worked
Signed-off-by: tobiasKaminsky <[email protected]>
2018-10-31 15:21:23 +01:00
Andy Scherzinger ce72bef98c Merge pull request #3203 from nextcloud/nunito
Switch font from openSans to Nunito
2018-10-31 14:22:07 +01:00
Andy Scherzinger 59a4e24ade bump lint warnings due to font use 2018-10-31 13:49:07 +01:00
Nextcloud bot 630585b2e4 [tx-robot] updated from transifex 2018-10-31 01:48:12 +00:00
Tobias Kaminsky d375140e4a daily dev 20181031 2018-10-31 00:33:04 +01:00
Andy Scherzinger 91590b2408 Merge pull request #3201 from nextcloud/changelog331new
enhanced changelog for 3.3.1
2018-10-30 16:51:45 +01:00
tobiasKaminsky aa96a1ded7 switch to Nunito
Signed-off-by: tobiasKaminsky <[email protected]>
2018-10-30 10:58:50 +01:00
tobiasKaminsky ebce82e1e8 enhanced changelog for 3.3.1
Signed-off-by: tobiasKaminsky <[email protected]>
2018-10-30 10:28:52 +01:00
Nextcloud bot 27ea5731bb [tx-robot] updated from transifex 2018-10-30 01:51:00 +00:00
Tobias Kaminsky 5771aa3631 daily dev 20181030 2018-10-30 00:32:20 +01:00
Andy Scherzinger fbb350a64b Merge pull request #3189 from nextcloud/fixTalkIcon
Fix talk icon on first run
2018-10-29 22:42:51 +01:00
tobiasKaminsky 7ad8a1a863 use another svg as source for talk icon. previous got corrupted on 6.0
Signed-off-by: tobiasKaminsky <[email protected]>
2018-10-29 22:28:00 +01:00
Andy Scherzinger 831f083153 Merge pull request #3187 from nextcloud/handleNoApps
Wrapper to start urls/intents if no app is available
2018-10-29 22:24:59 +01:00
tobiasKaminsky 4736124a9e wrapper to start urls/intents if no app is available
Signed-off-by: tobiasKaminsky <[email protected]>
2018-10-29 22:09:08 +01:00
Andy Scherzinger 3b9e6fa210 Merge pull request #3067 from nextcloud/fixDoubleSorting
LocalFileListAdapter: fix double sorting
2018-10-29 17:55:43 +01:00
tobiasKaminsky 59745fb8ca fix #2714
remove double sorting
remove unneeded ListAdapter

Signed-off-by: tobiasKaminsky <[email protected]>
2018-10-29 14:40:39 +01:00
Andy Scherzinger 52b61670a4 Merge pull request #3199 from nextcloud/changelog331
Changelog for 3.3.1
2018-10-29 12:49:28 +01:00
tobiasKaminsky 01eaebbe98 Changelog for 3.3.1
Signed-off-by: tobiasKaminsky <[email protected]>
2018-10-29 12:01:01 +01:00
Nextcloud bot 6d567fb68c [tx-robot] updated from transifex 2018-10-29 01:50:08 +00:00
Nextcloud bot 27855ddb84 [tx-robot] updated from transifex 2018-10-28 00:48:25 +00:00
Tobias Kaminsky a90766c5b9 daily dev 20181028 2018-10-28 00:33:17 +02:00
Nextcloud bot 77a46d0e29 [tx-robot] updated from transifex 2018-10-27 00:49:37 +00:00
Tobias Kaminsky fac6bf5461 daily dev 20181027 2018-10-27 00:32:56 +02:00
Andy Scherzinger 8dff447f68 Merge pull request #3194 from nextcloud/adjustFeatureTemplate
Make headlines a bit bigger
2018-10-26 09:14:04 +02:00
Tobias Kaminsky 8324d47d43 Merge pull request #3082 from nextcloud/sendNote
Allow to set/edit note on shares
2018-10-26 08:42:57 +02:00
tobiasKaminsky fce151948f make headlines a bit bigger
Signed-off-by: tobiasKaminsky <[email protected]>
2018-10-26 08:01:28 +02:00
Tobias Kaminsky a22a80374e Merge pull request #3144 from nextcloud/dependabot/gradle/org.codehaus.groovy-groovy-all-2.5.3
Bump groovy-all from 2.4.12 to 2.5.3
2018-10-26 07:38:02 +02:00
Nextcloud bot e705342dc3 [tx-robot] updated from transifex 2018-10-26 00:48:50 +00:00
Tobias Kaminsky a81792e788 daily dev 20181026 2018-10-26 00:33:22 +02:00
tobiasKaminsky e1c27f65b5 use IllegalArgumentException instead of NPE
Signed-off-by: tobiasKaminsky <[email protected]>
2018-10-25 10:48:54 +02:00
tobiasKaminsky b963818a98 test to remove groovy-all
Signed-off-by: tobiasKaminsky <[email protected]>
2018-10-25 10:19:44 +02:00
Tobias Kaminsky b48fbb2e06 Merge pull request #1708 from apicellaj/action_bar
Prevent action bar title from being overwritten
2018-10-25 10:02:38 +02:00
Nextcloud bot 334ec4824c [tx-robot] updated from transifex 2018-10-25 00:48:16 +00:00
Tobias Kaminsky 401f99762c daily dev 20181025 2018-10-25 00:32:29 +02:00
tobiasKaminsky 44896ba832 minor code enhancements
Signed-off-by: tobiasKaminsky <[email protected]>
2018-10-24 18:53:41 +02:00
tobiasKaminsky cf983d621f suppress lint as it is ok for dialogs to pass null as parent
Signed-off-by: tobiasKaminsky <[email protected]>
2018-10-24 18:53:41 +02:00
tobiasKaminsky e7ae1a5364 prevent autofill
Signed-off-by: tobiasKaminsky <[email protected]>
2018-10-24 18:53:40 +02:00
tobiasKaminsky d0a3302212 allow to set/edit note on shares
Signed-off-by: tobiasKaminsky <[email protected]>
2018-10-24 18:53:37 +02:00
Andy Scherzinger 7e2230970b Merge pull request #3171 from nextcloud/downgradeJUniveralLib
Downgrade juniversalchardet
2018-10-24 15:24:11 +02:00
Andy Scherzinger dac6bac8df bump lint score due to lib downgrade 2018-10-24 15:00:03 +02:00
Tobias Kaminsky 7fc2d9f902 Merge pull request #565 from nextcloud/bugfix-454
Search inside of text files
2018-10-24 14:44:20 +02:00
tobiasKaminsky 5c0e4be5c9 downgrade juniversalchardet
Signed-off-by: tobiasKaminsky <[email protected]>
2018-10-24 14:35:54 +02:00
Andy Scherzinger 87cda5a97f Merge pull request #3182 from nextcloud/searchEventExplicit
Use explicit SearchEvent everywhere
2018-10-24 14:04:45 +02:00
Andy Scherzinger dab0ea373c Merge pull request #3173 from nextcloud/autoUploadNotifcation
Fix AutoUpload notification
2018-10-24 13:23:44 +02:00
Andy Scherzinger 078d19382c Merge pull request #3183 from nextcloud/removeDuplicatedIfBranch
In both if branches was the same
2018-10-24 12:37:28 +02:00
Andy Scherzinger f74570f348 Merge pull request #3097 from nextcloud/fixDavdroidURL
Fix davdroid url: base url was retrieved too early
2018-10-24 11:41:30 +02:00
nextcloud-android-bot ea58ad6340 Drone: update Lint results to reflect reduced error/warning count [skip ci] 2018-10-24 08:35:18 +00:00
tobiasKaminsky 5e135e6ced in both if branches was the same
Signed-off-by: tobiasKaminsky <[email protected]>
2018-10-24 10:24:49 +02:00
tobiasKaminsky 82e713c167 use explicit SearchEvent everywhere
Signed-off-by: tobiasKaminsky <[email protected]>
2018-10-24 10:21:42 +02:00
Andy Scherzinger c01061b9df Merge pull request #3153 from nextcloud/fixNotificationCrash
Notification: move client creation to thread
2018-10-24 10:12:59 +02:00
Andy Scherzinger 148f9b119b Merge pull request #3176 from nextcloud/fixFavoriteRefreshingBug
Fix refreshing bug on favorite
2018-10-24 10:00:09 +02:00
tobiasKaminsky 46f916b1a2 satisfy codacy
Signed-off-by: tobiasKaminsky <[email protected]>
2018-10-24 09:42:24 +02:00
Mario Danic b6c528763c Search inside text files
Signed-off-by: tobiasKaminsky <[email protected]>
2018-10-24 09:42:24 +02:00
tobiasKaminsky bc2179965f - fix not working detection of already defined synced folders
- delete not used (and wrong) function

Signed-off-by: tobiasKaminsky <[email protected]>
2018-10-24 09:40:55 +02:00
Tobias Kaminsky 2e2e509835 Merge 30fc18d772 into e39c1658f1 2018-10-24 07:35:22 +00:00
tobiasKaminsky 30fc18d772 satisfy codacy
Signed-off-by: tobiasKaminsky <[email protected]>
2018-10-24 09:35:16 +02:00
tobiasKaminsky 7876f44e5b base uri was retrieved too early
-code cleanup

Signed-off-by: tobiasKaminsky <[email protected]>
2018-10-24 09:35:16 +02:00
tobiasKaminsky 31ea2e7be4 base uri was retrieved too early
Signed-off-by: tobiasKaminsky <[email protected]>
2018-10-24 09:35:16 +02:00
tobiasKaminsky 08d36d68e3 fix refreshing bug on favorite
Signed-off-by: tobiasKaminsky <[email protected]>
2018-10-24 09:05:00 +02:00
Tobias Kaminsky e39c1658f1 Merge pull request #3180 from nextcloud/changeRepoOrder
Change repositories order
2018-10-24 09:02:38 +02:00
tobiasKaminsky 5d1e3a2213 change repositories order
Signed-off-by: tobiasKaminsky <[email protected]>
2018-10-24 08:44:44 +02:00
Nextcloud bot 952fe722f6 [tx-robot] updated from transifex 2018-10-24 00:49:19 +00:00
Tobias Kaminsky c0fa9b9bf6 daily dev 20181024 2018-10-24 00:32:15 +02:00
Tobias Kaminsky 1d1e4f974b Merge pull request #3170 from nextcloud/fixAutoUploadPreferenceHeadlines
max-2-line headlines for auto upload config items
2018-10-23 07:37:51 +02:00
Nextcloud bot 8e835271d5 [tx-robot] updated from transifex 2018-10-23 00:41:26 +00:00
Tobias Kaminsky 6f8e5b53b3 daily dev 20181023 2018-10-23 00:32:12 +02:00
AndyScherzinger a5d6731611 Resolves #3165 - allowing 2-line headlines for auto upload config item's headlines 2018-10-22 19:09:29 +02:00
Andy Scherzinger 0c525db644 Merge pull request #3114 from nextcloud/notificationButtonHandling
Notification button handling
2018-10-22 17:26:32 +02:00
Andy Scherzinger 9bbf69a621 Merge pull request #3162 from nextcloud/handleReshare
Obey "can reshare" property
2018-10-22 13:51:53 +02:00
Andy Scherzinger 33af9119ce Merge pull request #3058 from nextcloud/asyncWithWeakReference
fix "static context is leaked"
2018-10-22 13:49:06 +02:00
nextcloud-android-bot 4eb62c7655 Drone: update Lint results to reflect reduced error/warning count [skip ci] 2018-10-22 07:18:47 +00:00
Tobias Kaminsky e9758fda6c Merge 7a17e13d55 into febc475634 2018-10-22 07:13:51 +00:00
tobiasKaminsky 7a17e13d55 fix "static context is leaked"
Signed-off-by: tobiasKaminsky <[email protected]>
2018-10-22 08:48:58 +02:00
David Luhmer f9bc65b6e1 add exception handling if nextcloud-files app is reinstalled and third party app tries to access using an old token 2018-10-21 12:42:09 +02:00
Nextcloud bot febc475634 [tx-robot] updated from transifex 2018-10-21 00:42:37 +00:00
Nextcloud bot b9b6d9da78 [tx-robot] updated from transifex 2018-10-20 00:41:37 +00:00
Tobias Kaminsky 3f4502e861 daily dev 20181020 2018-10-20 00:33:08 +02:00
Andy Scherzinger 6d8c7af90c Merge pull request #3152 from nextcloud/codacy
Fixing further codacy issues
2018-10-19 07:49:43 +02:00
tobiasKaminsky a4e3347abf obey "can reshare" property
Signed-off-by: tobiasKaminsky <[email protected]>
2018-10-18 10:02:50 +02:00
Nextcloud bot a71f449adc [tx-robot] updated from transifex 2018-10-18 00:44:09 +00:00
Tobias Kaminsky 96fe9e094c daily dev 20181018 2018-10-18 00:32:13 +02:00
Andy Scherzinger b105abc56f Merge pull request #3157 from nextcloud/fixPom
Pom: increase httpclient version
2018-10-18 00:00:38 +02:00
Andy Scherzinger bb5790cd1a Merge pull request #3143 from slohse/sorting-general-contract-violation-files-with-dots
Fix IllegalArgumentException on files with dots in name, add test case
2018-10-17 23:58:48 +02:00
tobiasKaminsky 506dee2337 sort & compare for two tests
Signed-off-by: tobiasKaminsky <[email protected]>
2018-10-17 15:52:38 +02:00
tobiasKaminsky 1cf1b0f1da increase httpclient version
Signed-off-by: tobiasKaminsky <[email protected]>
2018-10-17 14:50:46 +02:00
tobiasKaminsky 15bc754ea7 move client to thread
Signed-off-by: tobiasKaminsky <[email protected]>
2018-10-17 10:20:42 +02:00
Nextcloud bot 01641a05f4 [tx-robot] updated from transifex 2018-10-17 00:40:59 +00:00
AndyScherzinger 84a1cc37a5 codacy: Avoid using redundant field initializer for 'onlyOnDevice' 2018-10-16 08:37:42 +02:00
AndyScherzinger a4088eb173 codacy: This for loop can be replaced by a foreach loop 2018-10-16 08:35:17 +02:00
AndyScherzinger 70f0d9c61b extract size to variable 2018-10-16 08:34:54 +02:00
AndyScherzinger 0c6b7fc4a1 codacy: Avoid unused private fields such as 'account'. 2018-10-16 08:29:23 +02:00
Nextcloud bot bf9df6e0b2 [tx-robot] updated from transifex 2018-10-16 00:41:24 +00:00
Tobias Kaminsky f3fff52304 daily dev 20181016 2018-10-16 00:32:56 +02:00
Andy Scherzinger 3cde7fc4ee Merge pull request #3129 from nextcloud/autofill
Add autofill hints
2018-10-15 15:30:15 +02:00
Stephan Lohse 9b19f3940b Fix IllegalArgumentException on files with dots in name, add test case 2018-10-14 22:54:21 +02:00
Nextcloud bot e5e776c288 [tx-robot] updated from transifex 2018-10-14 00:41:35 +00:00
Nextcloud bot f648fdc31c [tx-robot] updated from transifex 2018-10-13 00:40:59 +00:00
Tobias Kaminsky 5ea50b1030 daily dev 20181013 2018-10-13 00:33:58 +02:00
Andy Scherzinger c3269e6639 Merge pull request #3132 from Blackhat96/master
App crashes when uploading files to Nextcloud
2018-10-12 22:43:03 +02:00
tobiasKaminsky bba96eef89 line wrap
Signed-off-by: tobiasKaminsky <[email protected]>
2018-10-12 14:03:41 +02:00
David Luhmer d9080650ac add response-body (if available) to exception if request failed (ref https://github.com/nextcloud/Android-SingleSignOn/issues/35) 2018-10-12 10:36:38 +02:00
David Luhmer 704a41b281 improve error handling as suggested by @AndyScherzinger 2018-10-12 10:35:25 +02:00
Andy Scherzinger 585f734e32 Merge pull request #3135 from nextcloud/update-issue-templates
Update issue templates: choose between bug and feature request
2018-10-12 09:12:06 +02:00
tobiasKaminsky 412d32e58d delete template on old position
Signed-off-by: tobiasKaminsky <[email protected]>
2018-10-12 09:03:14 +02:00
Tobias Kaminsky 73ecd3505e Update issue templates: choose between bug and feature request 2018-10-12 09:01:33 +02:00
Andy Scherzinger f2759fc5dd Merge pull request #3134 from nextcloud/dependabot/gradle/com.android.tools.build-gradle-3.2.1
Bump gradle from 3.2.0 to 3.2.1
2018-10-12 08:26:59 +02:00
dependabot[bot] 5b07b66492 Bump gradle from 3.2.0 to 3.2.1
Bumps gradle from 3.2.0 to 3.2.1.

Signed-off-by: dependabot[bot] <[email protected]>
2018-10-12 01:13:01 +00:00
Nextcloud bot 2b91e651d4 [tx-robot] updated from transifex 2018-10-12 00:40:54 +00:00
David Luhmer 80582657f0 fix exception handling (networkonmainthread failed before) 2018-10-11 21:24:21 +02:00
Abhishek U Bhat 82de7f631a Rquesting FOREGROUND_SERVICE permission for Android 9(API level 28) or
higher
2018-10-11 22:59:59 +05:30
Joe Apicella 333b544001 modify default display name for root folder 2018-10-11 14:27:18 +02:00
Joe Apicella 6e98e25184 set action bar title to show "On device" 2018-10-11 14:27:18 +02:00
Joe Apicella 36bed52eae prevent action bar title from being overwritten 2018-10-11 14:27:08 +02:00
nextcloud-android-bot 976abb854b Drone: update Lint results to reflect reduced error/warning count [skip ci] 2018-10-10 13:32:34 +00:00
Tobias Kaminsky d667354e09 Merge 6b468d5751 into 86e564bb91 2018-10-10 13:30:44 +00:00
tobiasKaminsky 6b468d5751 hide unusedAttribute lint warning on autofill
Signed-off-by: tobiasKaminsky <[email protected]>
2018-10-10 15:30:30 +02:00
tobiasKaminsky a61f6e8f93 add autofill hints
Signed-off-by: tobiasKaminsky <[email protected]>
2018-10-10 15:18:12 +02:00
Nextcloud bot 86e564bb91 [tx-robot] updated from transifex 2018-10-10 00:49:23 +00:00
Tobias Kaminsky f5b9f28cc0 daily dev 20181009 2018-10-09 00:33:14 +02:00
Andy Scherzinger 7dad67ad35 Merge pull request #3117 from nextcloud/dependabot/gradle/org.mockito-mockito-core-2.23.0
Bump mockito-core from 2.22.0 to 2.23.0
2018-10-08 09:16:51 +02:00
dependabot[bot] 0eb93b4e8b Bump mockito-core from 2.22.0 to 2.23.0
Bumps [mockito-core](https://github.com/mockito/mockito) from 2.22.0 to 2.23.0.
- [Release notes](https://github.com/mockito/mockito/releases)
- [Commits](https://github.com/mockito/mockito/compare/v2.22.0...v2.23.0)

Signed-off-by: dependabot[bot] <[email protected]>
2018-10-08 01:12:28 +00:00
Nextcloud bot f5ad4c9117 [tx-robot] updated from transifex 2018-10-07 00:48:53 +00:00
Nextcloud bot 14e7cfcbef [tx-robot] updated from transifex 2018-10-06 00:47:08 +00:00
Tobias Kaminsky 89e4cc7be0 daily dev 20181006 2018-10-06 00:32:12 +02:00
Tobias Kaminsky 00b2cfb785 Merge pull request #3113 from Tijs-B/master
Changed "Copied to clipboard" text to "Link copied"
2018-10-05 09:36:24 +02:00
tobiasKaminsky 8b8820ef91 create a task for each button
disable buttons until request is complete: error -> re-enable / success: delete notification
success check: added 202 (accepted)

Signed-off-by: tobiasKaminsky <[email protected]>
2018-10-05 09:06:13 +02:00
Nextcloud bot d3ffbb6bd0 [tx-robot] updated from transifex 2018-10-05 00:49:57 +00:00
Tijs-B 725ecb192c Changed "Copied to clipboard" text to "Link copied 2018-10-04 14:16:24 +02:00
Tijs-B 15fa3804af Changed "Copied to clipboard" text to "Link copied" 2018-10-04 14:14:42 +02:00
Nextcloud bot 5d359ba7a0 [tx-robot] updated from transifex 2018-10-04 00:52:19 +00:00
Nextcloud bot df779d9f2a [tx-robot] updated from transifex 2018-10-03 00:40:26 +00:00
Nextcloud bot b9633f1c22 [tx-robot] updated from transifex 2018-10-02 00:47:56 +00:00
Nextcloud bot a6ec9e3049 [tx-robot] updated from transifex 2018-10-01 00:47:34 +00:00
Nextcloud bot bec84e799e [tx-robot] updated from transifex 2018-09-30 00:48:31 +00:00
Nextcloud bot 4eb45af6d0 [tx-robot] updated from transifex 2018-09-29 00:45:52 +00:00
Nextcloud bot 61579b1166 [tx-robot] updated from transifex 2018-09-28 00:41:57 +00:00
Nextcloud bot 41aae0b753 [tx-robot] updated from transifex 2018-09-27 00:50:31 +00:00
Tobias Kaminsky 23ff844e70 daily dev 20180927 2018-09-27 00:32:10 +02:00
Andy Scherzinger a3730c7c82 Merge pull request #3094 from nextcloud/editorconfig
Add editor config to configure Android Studio
2018-09-26 13:22:34 +02:00
AndyScherzinger a587defb76 add editor config to configure Android Studio according to the project guidelines automatically 2018-09-26 11:31:06 +02:00
Andy Scherzinger 38407d55a9 Merge pull request #3065 from nextcloud/fixNavigation
Fix broken navigation
2018-09-26 08:29:25 +02:00
tobiasKaminsky 63435257f0 fix #2857
Signed-off-by: tobiasKaminsky <[email protected]>
2018-09-26 08:05:05 +02:00
Tobias Kaminsky 17065f9193 Merge pull request #3090 from nextcloud/fixOutOfBoundsOnCharAt
charAt is throwing out of bounds, if empty string
2018-09-26 07:56:26 +02:00
Nextcloud bot 6caecfce72 [tx-robot] updated from transifex 2018-09-26 00:50:34 +00:00
Tobias Kaminsky 1dabdb5315 daily dev 20180926 2018-09-26 00:33:06 +02:00
AndyScherzinger 131a8fafcd charAt is throwing out of bounds, if empty string 2018-09-25 18:50:39 +02:00
tobiasKaminsky b5f742f3ba charAt is throwing out of bounds, if empty string
Signed-off-by: tobiasKaminsky <[email protected]>
2018-09-25 18:50:36 +02:00
Andy Scherzinger 726cb1a3eb Merge pull request #3086 from nextcloud/rememberLocalUploadPath
Remember last path which was used on local file selection
2018-09-25 18:49:46 +02:00
tobiasKaminsky 59d0b99121 remember last path which was used on local file selection
Signed-off-by: tobiasKaminsky <[email protected]>
2018-09-25 18:17:13 +02:00
Andy Scherzinger b061b1a557 Merge pull request #3085 from nextcloud/wakeLockTag
Wakelock tag pattern follows PowerManager doc
2018-09-25 15:52:24 +02:00
nextcloud-android-bot 3b1c6ae68f Drone: update Lint results to reflect reduced error/warning count [skip ci] 2018-09-25 14:12:29 +02:00
tobiasKaminsky d5ed79ab66 tag pattern follows PowerManager doc
Signed-off-by: tobiasKaminsky <[email protected]>
2018-09-25 14:12:29 +02:00
Andy Scherzinger df3bb79365 Merge pull request #3070 from nextcloud/codacy
Codacy fixes
2018-09-25 13:51:35 +02:00
AndyScherzinger 7308f3464b codacy: This for loop can be replaced by a foreach loop 2018-09-25 13:26:17 +02:00
AndyScherzinger 8a53f5ff56 codacy: Avoid using redundant field initializer 2018-09-25 13:26:16 +02:00
AndyScherzinger 3e5de81414 codacy: No need to call String.valueOf to append to a string. 2018-09-25 13:26:16 +02:00
AndyScherzinger 6b59ade7bd codacy: A getX() method which returns a boolean should be named isX() 2018-09-25 13:26:15 +02:00
AndyScherzinger ebed24ab5d codacy: String.startsWith can be rewritten using String.charAt(0) 2018-09-25 13:26:15 +02:00
AndyScherzinger 64c227afc9 codacy: No need to check for null before an instanceof 2018-09-25 13:26:14 +02:00
AndyScherzinger bb6947d9d9 codacy: Avoid unnecessary constructors - the compiler will generate these for you 2018-09-25 13:26:14 +02:00
AndyScherzinger f35db9a594 codacy: Avoid the use of value in annotations when its the only element 2018-09-25 13:26:13 +02:00
AndyScherzinger fb446d433a codacy: Do not add empty strings 2018-09-25 13:26:13 +02:00
AndyScherzinger 1e443545c9 codacy: String.indexOf(char) is faster than String.indexOf(String). 2018-09-25 13:26:12 +02:00
Andy Scherzinger 0ee0c655cf Merge pull request #3087 from nextcloud/useAssembleOnFindbugs
Fix findbugs
2018-09-25 13:25:33 +02:00
Andy Scherzinger 183f8f5398 Merge pull request #3088 from nextcloud/android-42
use android-42 docker-ci
2018-09-25 13:20:35 +02:00
Andy Scherzinger 91e300cb68 use android-42 2018-09-25 13:12:00 +02:00
Andy Scherzinger 641895c0d5 Merge pull request #3051 from nextcloud/addRoomShareType
Add room share type
2018-09-25 12:48:11 +02:00
tobiasKaminsky e84522c2fa Use new findbug location
error out if findbugs / lint report is missing

Signed-off-by: tobiasKaminsky <[email protected]>
2018-09-25 12:31:09 +02:00
tobiasKaminsky dc4077325b use list instead of checking each individually
Signed-off-by: tobiasKaminsky <[email protected]>
2018-09-25 10:52:39 +02:00
Nextcloud bot 44c42e1c01 [tx-robot] updated from transifex 2018-09-25 00:50:23 +00:00
Tobias Kaminsky f2f86932f4 daily dev 20180925 2018-09-25 00:36:02 +02:00
Andy Scherzinger 943d197253 Merge pull request #3084 from nextcloud/dependabot/gradle/com.android.tools.build-gradle-3.2.0
Bump gradle from 3.1.4 to 3.2.0
2018-09-24 20:36:13 +02:00
Andy Scherzinger 3a015657cb bump lint result due to new version 2018-09-24 19:38:02 +02:00
Andy Scherzinger 974520a733 update to gradle-4.6-all 2018-09-24 19:26:13 +02:00
dependabot[bot] b1dedf3435 Bump gradle from 3.1.4 to 3.2.0
Bumps gradle from 3.1.4 to 3.2.0.

Signed-off-by: dependabot[bot] <[email protected]>
2018-09-24 17:20:58 +00:00
Andy Scherzinger 29347af729 Merge pull request #3081 from nextcloud/test28
Bump supportLibraryVersion from 27.1.1 to 28.0.0
2018-09-24 18:33:18 +02:00
AndyScherzinger 9efd3ec7ad use InstrumentationRegistry.getTargetContext() for tests 2018-09-24 09:21:04 +02:00
AndyScherzinger 169b0e560b lint: remove deprecated/removed ApplicationTestCase reference 2018-09-24 09:19:31 +02:00
AndyScherzinger 9c560eae63 lint: use new v28 app-compat API 2018-09-24 09:18:56 +02:00
Andy Scherzinger 3e2c4b1db0 bump target to v28 2018-09-24 08:42:19 +02:00
dependabot[bot] cb47072fa7 Bump supportLibraryVersion from 27.1.1 to 28.0.0
Bumps `supportLibraryVersion` from 27.1.1 to 28.0.0.

Updates `support-v4` from 27.1.1 to 28.0.0

Updates `design` from 27.1.1 to 28.0.0
- [Release notes](https://github.com/material-components/material-components-android/releases)
- [Commits](https://github.com/material-components/material-components-android/commits)

Updates `appcompat-v7` from 27.1.1 to 28.0.0

Updates `cardview-v7` from 27.1.1 to 28.0.0

Updates `exifinterface` from 27.1.1 to 28.0.0

Updates `support-annotations` from 27.1.1 to 28.0.0

Signed-off-by: dependabot[bot] <[email protected]>
2018-09-24 06:32:34 +00:00
Tobias Kaminsky 59d4e7688f daily dev 20180924 2018-09-24 00:32:58 +02:00
Andy Scherzinger 8291a19487 revert back to master lib 2018-09-23 12:32:09 +02:00
Nextcloud bot 1bb7d764ca [tx-robot] updated from transifex 2018-09-23 01:17:49 +00:00
Nextcloud bot 251cecb1a7 [tx-robot] updated from transifex 2018-09-22 00:50:13 +00:00
Nextcloud bot d67b6ab6e6 [tx-robot] updated from transifex 2018-09-21 00:57:26 +00:00
Tobias Kaminsky ddcca92012 daily dev 20180921 2018-09-21 00:32:50 +02:00
Andy Scherzinger 739c1d9257 Merge pull request #3069 from nextcloud/localSiz
Show local size when switching to "on device" view
2018-09-20 15:59:15 +02:00
tobiasKaminsky 6978587ae1 show local size when switching to "on device" view
Signed-off-by: tobiasKaminsky <[email protected]>
2018-09-20 15:07:02 +02:00
Nextcloud bot da1064fc37 [tx-robot] updated from transifex 2018-09-20 00:49:09 +00:00
Tobias Kaminsky a41be3d3cb daily dev 20180920 2018-09-20 00:32:48 +02:00
Andy Scherzinger 798093ae19 Merge pull request #3059 from nextcloud/removeDuplicatedMimetype
Remove duplicated mimetype
2018-09-19 16:22:08 +02:00
tobiasKaminsky 929cb20149 fix #2684
remove duplicated mimetype

Signed-off-by: tobiasKaminsky <[email protected]>
2018-09-19 15:41:48 +02:00
Andy Scherzinger 2676cd88e5 Merge pull request #3052 from nextcloud/codacy
Codacy fixes
2018-09-19 15:11:19 +02:00
tobiasKaminsky c40a912815 use chat bubble as fallback
Signed-off-by: tobiasKaminsky <[email protected]>
2018-09-19 14:18:37 +02:00
AndyScherzinger 6a177d3dee remove unused return value from method signature 2018-09-19 14:12:40 +02:00
AndyScherzinger 79677f5281 codacy: useless parentheses 2018-09-19 14:12:39 +02:00
AndyScherzinger 7e17aca4ff codacy: avoid instantiating new objects inside loops 2018-09-19 14:12:39 +02:00
AndyScherzinger c78e05e873 codacy: avoid using redundant field initializer 2018-09-19 14:12:38 +02:00
AndyScherzinger 2e9d7ce028 codacy: useless qualified this usage in the same class. 2018-09-19 14:12:38 +02:00
AndyScherzinger a4eafbf757 codacy: String.indexOf(char) is faster than String.indexOf(String). 2018-09-19 14:12:37 +02:00
AndyScherzinger 799c3a3163 codacy: all methods are static. Consider using a utility class instead. 2018-09-19 14:12:37 +02:00
AndyScherzinger 22e7f71e22 codacy: avoid unused imports 2018-09-19 14:12:36 +02:00
AndyScherzinger 0ae679f3b5 codacy: consider simply returning the value vs storing it in local variable 2018-09-19 14:12:36 +02:00
AndyScherzinger 13d602422e codacy: avoid the use of value in annotations when its the only element 2018-09-19 14:12:36 +02:00
AndyScherzinger ed95f486fc codacy: avoid using Literals in Conditional Statements 2018-09-19 14:12:35 +02:00
AndyScherzinger 93ef48add6 codacy: field has the same name as a method 2018-09-19 14:12:31 +02:00
Andy Scherzinger 2c6bfc4c9e Merge pull request #3057 from nextcloud/changelog330
Changelog 3.3.0
2018-09-19 11:15:03 +02:00
Andy Scherzinger fd23d58cb9 release 3.3.0 2018-09-19 10:05:16 +02:00
Andy Scherzinger d40a4a1731 Merge pull request #3055 from nextcloud/changeRCversion
change RC starting with 51
2018-09-19 09:16:02 +02:00
tobiasKaminsky 01edfe6491 change RC starting with 51
Signed-off-by: tobiasKaminsky <[email protected]>
2018-09-19 07:46:50 +02:00
Andy Scherzinger ae94e219ba Merge pull request #3054 from nextcloud/dependabot/gradle/org.jetbrains-annotations-16.0.3
Bump annotations from 16.0.2 to 16.0.3
2018-09-19 07:13:17 +02:00
dependabot[bot] 1958c06b87 Bump annotations from 16.0.2 to 16.0.3
Bumps [annotations](https://github.com/JetBrains/java-annotations) from 16.0.2 to 16.0.3.
- [Release notes](https://github.com/JetBrains/java-annotations/releases)
- [Commits](https://github.com/JetBrains/java-annotations/commits/16.0.3)

Signed-off-by: dependabot[bot] <[email protected]>
2018-09-19 01:12:56 +00:00
tobiasKaminsky 0efdf2bbac Add room share type
Signed-off-by: tobiasKaminsky <[email protected]>
2018-09-18 14:48:29 +02:00
409 changed files with 13753 additions and 7885 deletions

No files matched your search

+55 -55
View File
@@ -1,67 +1,67 @@
pipeline:
compile:
image: nextcloudci/android:android-40
commands:
# build app and assemble APK
- sh -c "if [ '${FLAVOR}' != 'Analysis' ]; then ./gradlew assemble${FLAVOR}; fi"
when:
matrix:
FLAVOR: [Generic, Gplay]
compile:
image: nextcloudci/android:android-42
commands:
# build app and assemble APK
- sh -c "if [ '${FLAVOR}' != 'Analysis' ]; then ./gradlew assemble${FLAVOR}; fi"
when:
matrix:
FLAVOR: [Generic, Gplay]
test:
image: nextcloudci/android:android-40
privileged: true
commands:
- emulator -avd android-27 -no-window -no-audio &
- ./wait_for_emulator.sh
- ./gradlew assembleGplayDebug
- ./gradlew jacocoTestGplayDebugUnitTestReport || scripts/uploadReport.sh $LOG_USERNAME $LOG_PASSWORD $DRONE_BUILD_NUMBER "Unit"
- ./gradlew installGplayDebugAndroidTest
- ./gradlew createGplayDebugCoverageReport || scripts/uploadReport.sh $LOG_USERNAME $LOG_PASSWORD $DRONE_BUILD_NUMBER "IT"
- ./gradlew combinedTestReport
- curl -o codecov.sh https://codecov.io/bash
- bash ./codecov.sh -t fc506ba4-33c3-43e4-a760-aada38c24fd5
secrets: [ LOG_USERNAME, LOG_PASSWORD ]
when:
matrix:
FLAVOR: Gplay
test:
image: nextcloudci/android:android-42
privileged: true
commands:
- emulator -avd android-27 -no-window -no-audio &
- ./wait_for_emulator.sh
- ./gradlew assembleGplayDebug
- ./gradlew jacocoTestGplayDebugUnitTestReport || scripts/uploadReport.sh $LOG_USERNAME $LOG_PASSWORD $DRONE_BUILD_NUMBER "Unit"
- ./gradlew installGplayDebugAndroidTest
- ./gradlew createGplayDebugCoverageReport || scripts/uploadReport.sh $LOG_USERNAME $LOG_PASSWORD $DRONE_BUILD_NUMBER "IT"
- ./gradlew combinedTestReport
- curl -o codecov.sh https://codecov.io/bash
- bash ./codecov.sh -t fc506ba4-33c3-43e4-a760-aada38c24fd5
secrets: [ LOG_USERNAME, LOG_PASSWORD ]
when:
matrix:
FLAVOR: Gplay
analysis:
image: nextcloudci/android:android-40
commands:
- export BRANCH=$(scripts/analysis/getBranchName.sh $GIT_USERNAME $GIT_TOKEN $DRONE_PULL_REQUEST)
- scripts/analysis/analysis-wrapper.sh $GIT_USERNAME $GIT_TOKEN $BRANCH $LOG_USERNAME $LOG_PASSWORD $DRONE_BUILD_NUMBER $DRONE_PULL_REQUEST
secrets: [ GIT_USERNAME, GIT_TOKEN, LOG_USERNAME, LOG_PASSWORD ]
when:
matrix:
FLAVOR: Analysis
notify:
image: drillster/drone-email
host: $EMAIL_HOST
port: 587
username: $EMAIL_USERNAME
password: $EMAIL_PASSWORD
from: [email protected]
recipients_only: true
recipients: [ $EMAIL_RECIPIENTS ]
secrets: [ EMAIL_USERNAME, EMAIL_PASSWORD, EMAIL_RECIPIENTS, EMAIL_HOST ]
when:
event: push
status: failure
branch: master
analysis:
image: nextcloudci/android:android-42
commands:
- export BRANCH=$(scripts/analysis/getBranchName.sh $GIT_USERNAME $GIT_TOKEN $DRONE_PULL_REQUEST)
- scripts/analysis/analysis-wrapper.sh $GIT_USERNAME $GIT_TOKEN $BRANCH $LOG_USERNAME $LOG_PASSWORD $DRONE_BUILD_NUMBER $DRONE_PULL_REQUEST
secrets: [ GIT_USERNAME, GIT_TOKEN, LOG_USERNAME, LOG_PASSWORD ]
when:
matrix:
FLAVOR: Analysis
notify:
image: drillster/drone-email
host: $EMAIL_HOST
port: 587
username: $EMAIL_USERNAME
password: $EMAIL_PASSWORD
from: [email protected]
recipients_only: true
recipients: [ $EMAIL_RECIPIENTS ]
secrets: [ EMAIL_USERNAME, EMAIL_PASSWORD, EMAIL_RECIPIENTS, EMAIL_HOST ]
when:
event: push
status: failure
branch: master
matrix:
FLAVOR:
FLAVOR:
- Generic
- Gplay
- Analysis
services:
server:
image: nextcloudci/server:server-1
when:
matrix:
FLAVOR: Gplay
server:
image: nextcloudci/server:server-3
when:
matrix:
FLAVOR: Gplay
branches: master
+33
View File
@@ -0,0 +1,33 @@
# .editorconfig
# see http://EditorConfig.org
# This is the file in the root of the project.
# For sub folders you can have other files that override only some settings.
# For these, this settings should be false.
root=true
[*]
max_line_length=120
# use spaces, not tabs.
indent_style=space
indent_size=4
charset=utf-8
# Trimming is good for consistency
trim_trailing_whitespace=true
# I've seen cases where a missing new_line was ignored on *nix systems.
# Never again with this setting!
insert_final_newline=true
[*.properties]
# Exception for Java properties files should be encoded latin1 (aka iso8859-1)
charset=latin1
[*.{cmd,bat}]
# batch files on Windows should stay with CRLF
end_of_line=crlf
[*.md]
trim_trailing_whitespace=false
@@ -1,3 +1,10 @@
---
name: Bug report
about: Create a report to help us improve
labels: bug
---
### Actual behaviour
- Tell us what happens
+20
View File
@@ -0,0 +1,20 @@
---
name: Feature request
about: Suggest an idea for this project
labels: enhancement
---
### Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
### Describe the solution you'd like
A clear and concise description of what you want to happen.
### Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.
### Additional context
Add any other context or screenshots about the feature request here.
**NOTE:** Be super sure to remove sensitive data like passwords, note that everybody can look here! You can use the Issue Template application to prefill some of the required information: https://apps.nextcloud.com/apps/issuetemplate
+54 -11
View File
@@ -1,10 +1,53 @@
## 3.2.4 (Sept, 04, 2018)
fix push notification on gplay release
## 3.4.0 (December, 17, 2018)
- hide download when creating share links
- direct editing files with Collabora (Collabora Server >=4.0)
- sort deleted files by deletion date by default
- set/edit notes on shares
- search inside of text files
- actions on notifications
- remember last path on upload
- share file to Talk room
- show local size in "on device" view
- SSO: add request header for deck app
- bug fixes
For a detailed list, please visit: https://github.com/nextcloud/android/milestone/25
## 3.2.3 (Aug, 21, 2018)
- Fix crash on Android Android 4.x
## 3.3.2 (November, 02, 2018)
- fix fingerprint not working on certain devices
## 3.2.2 (Aug, 20, 2018)
For full list please see https://github.com/nextcloud/android/milestone/27
## 3.3.1 (October, 29, 2018)
Bugfix release
- fix crash on shared folder/file via Talk
- fix crash on Notification activity
- fixed setup DAVdroid via settings
- hide edit option on shares, if not allowed
For full list please see https://github.com/nextcloud/android/milestone/26
## 3.3.0 (September, 19, 2018)
- Support for Trashbin (Nc14+)
- Media streaming (Nc14+)
- New media detection for AutoUpload
- Improved TalkBack screenreader support
- Show outdated server warning for server <NC12
- Add support for device credentials
- Show offline / maintenance info
- Improved activities
- Improved file detail / sharing with comments
- Improved Share link creation via bottom sheet
- Improved Notification, supporting actions
- Minor UI/UX improvements
- Many bug fixes
## 3.2.4 (September, 04, 2018)
- Fix push notification on gplay release
## 3.2.3 (August, 21, 2018)
- Fix crash on Android 4.x
## 3.2.2 (August, 20, 2018)
- New simple signup screen
## 3.2.1 (June, 11, 2018)
@@ -22,27 +65,27 @@ fix push notification on gplay release
- minor UI/UX improvements
- many bug fixes
## 3.1.0 (Apr, 22, 2018)
## 3.1.0 (April, 22, 2018)
- enhance support for 8.x
- speed improvements
- minor UI/UX improvements
- many bug fixes
## 3.0.3 (Mar, 05, 2018)
## 3.0.3 (March, 05, 2018)
- Fix creating folders in auto upload
## 3.0.2 (Feb, 27, 2018)
## 3.0.2 (February, 27, 2018)
- Fix crash on old android versions
- Fix E2E
- Fix crash on old server
## 3.0.1 (Feb, 14, 2018)
## 3.0.1 (February, 14, 2018)
- Bugfix E2E
- Fix SSL via PlayStore updater
- Fix push notification
- New android lib, fixing wrong user agent
## 3.0.0 (Feb, 08, 2018)
## 3.0.0 (February, 08, 2018)
- End to end encryption
- Screen adapted images instead of downloading
- direct access to operations for single files
@@ -58,7 +101,7 @@ fix push notification on gplay release
- UI enhancements
- bug fixes
## 2.0.0 (Oct, 17, 2017)
## 2.0.0 (October, 17, 2017)
- Account-wide search (Nc 12+)
- Auto upload available on Android 4+
- Separation between Image & Video for Auto upload
+1 -1
View File
@@ -45,7 +45,7 @@ Easy starting points are also reviewing [pull requests](https://github.com/nextc
#### With a computer:
- connect the device via USB
- open command prompt/terminal
- enter `adb logcat | grep "$(adb shell ps | grep com.nextcloud.client | awk '{print $2}')" > logcatOutput.txt` to save the output to this file
- enter `adb logcat | grep "$(adb shell ps | awk '/com.nextcloud.client/{print $2}')" > logcatOutput.txt` to save the output to this file
**Note:** You must have [adb](https://developer.android.com/studio/releases/platform-tools.html) installed first!
+1
View File
@@ -52,6 +52,7 @@ To set up the project in Android Studio follow the next steps:
* Make sure you have called ```git submodule update``` whenever you switched branches
* Open Android Studio and select 'Import Project (Eclipse ADT, Gradle, etc)'. Browse through your file system to the folder 'android' where the project is located. Android Studio will then create the '.iml' files it needs. If you ever close the project but the files are still there, you just select 'Open Project…'. The file chooser will show an Android face as the folder icon, which you can select to reopen the project.
* Android Studio will try to build the project directly after importing it. To build it manually, follow the menu path 'Build'/'Make Project', or just click the 'Play' button in the toolbar to build and run it in a mobile device or an emulator. The resulting APK file will be saved in the 'build/outputs/apk/' subdirectory in the project folder.
* Setup Android Studio editor configurtation for the project: ```Settings``` → ```Editor``` → ```Code Style``` → ```Scheme: Project``` and ```Enable EditorConfig support```
### 3. Working in a terminal with Gradle:
+2 -2
View File
@@ -66,7 +66,7 @@
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.3.1</version>
<version>4.3.6</version>
</dependency>
<dependency>
<groupId>com.google.android</groupId>
@@ -75,4 +75,4 @@
<scope>provided</scope>
</dependency>
</dependencies>
</project>
</project>
+48 -49
View File
@@ -7,19 +7,16 @@
buildscript {
repositories {
google()
jcenter()
maven {
url 'https://oss.sonatype.org/content/repositories/snapshots/'
}
google()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.4'
classpath 'org.codehaus.groovy:groovy-all:2.4.12'
classpath('com.dicedmelon.gradle:jacoco-android:0.1.3') {
exclude group: 'org.codehaus.groovy', module: 'groovy-all'
}
classpath 'com.android.tools.build:gradle:3.2.1'
classpath('com.dicedmelon.gradle:jacoco-android:0.1.3')
}
}
@@ -36,7 +33,6 @@ configurations.all {
}
ext {
supportLibraryVersion = '27.1.1'
jacocoVersion = "0.8.2"
travisBuild = System.getenv("TRAVIS") == "true"
@@ -46,10 +42,10 @@ ext {
}
repositories {
google()
jcenter()
maven { url "https://jitpack.io" }
maven { url 'https://oss.sonatype.org/content/repositories/snapshots/' }
google()
flatDir {
dirs 'libs'
@@ -58,9 +54,9 @@ repositories {
// semantic versioning for version code
def versionMajor = 3
def versionMinor = 4
def versionMinor = 5
def versionPatch = 0
def versionBuild = 0 // 0-49=Alpha / 50-98=RC / 99=stable
def versionBuild = 0 // 0-50=Alpha / 51-98=RC / 90-99=stable
def taskRequest = getGradle().getStartParameter().getTaskRequests().toString()
if (taskRequest.contains("Gplay") || taskRequest.contains("findbugs") || taskRequest.contains("lint")) {
@@ -72,20 +68,20 @@ android {
abortOnError false
htmlReport true
htmlOutput file("$project.buildDir/reports/lint/lint.html")
disable 'MissingTranslation'
disable 'MissingTranslation', 'GradleDependency'
}
dexOptions {
javaMaxHeapSize "4g"
}
compileSdkVersion 27
compileSdkVersion 28
defaultConfig {
minSdkVersion 14
targetSdkVersion 27
targetSdkVersion 28
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
// arguments to be passed to functional tests
testInstrumentationRunnerArgument "TEST_USER", "\"$System.env.OCTEST_APP_USERNAME\""
@@ -96,12 +92,12 @@ android {
versionCode versionMajor * 10000000 + versionMinor * 10000 + versionPatch * 100 + versionBuild
if (versionBuild > 98) {
if (versionBuild > 89) {
versionName "${versionMajor}.${versionMinor}.${versionPatch}"
} else if (versionBuild > 49) {
versionName "${versionMajor}.${versionMinor}.${versionPatch} RC"+(versionBuild-49)
} else if (versionBuild > 50) {
versionName "${versionMajor}.${versionMinor}.${versionPatch} RC" + (versionBuild - 50)
} else {
versionName "${versionMajor}.${versionMinor}.${versionPatch} Alpha"+(versionBuild+1)
versionName "${versionMajor}.${versionMinor}.${versionPatch} Alpha" + (versionBuild + 1)
}
// adapt structure from Eclipse to Gradle/Android Studio expectations;
@@ -130,8 +126,8 @@ android {
versionDev {
applicationId "com.nextcloud.android.beta"
dimension "default"
versionCode 20180919
versionName "20180919"
versionCode 20190105
versionName "20190105"
}
}
}
@@ -183,7 +179,7 @@ android {
ignoreFailures = false
effort = "max"
reportLevel = "medium"
classes = fileTree("$project.buildDir/intermediates/classes/gplay/debug/com/owncloud")
classes = fileTree("$project.buildDir/intermediates/javac/gplayDebug/compileGplayDebugJavaWithJavac/classes/")
excludeFilter = file("${project.rootDir}/findbugs-filter.xml")
source = fileTree('src/main/java')
pluginClasspath = project.configurations.findbugsPlugins
@@ -210,65 +206,68 @@ android {
dependencies {
// dependencies for app building
implementation 'com.android.support:multidex:1.0.3'
implementation 'androidx.multidex:multidex:2.0.1'
// implementation project('nextcloud-android-library')
genericImplementation "com.github.nextcloud:android-library:master-SNAPSHOT"
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
gplayImplementation "com.github.nextcloud:android-library:master-SNAPSHOT"
versionDevImplementation 'com.github.nextcloud:android-library:master-SNAPSHOT' // use always latest master
implementation "com.android.support:support-v4:${supportLibraryVersion}"
implementation "com.android.support:design:${supportLibraryVersion}"
genericImplementation 'com.github.nextcloud:android-library:master-SNAPSHOT'
gplayImplementation 'com.github.nextcloud:android-library:master-SNAPSHOT'
versionDevImplementation 'com.github.nextcloud:android-library:master-SNAPSHOT'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'com.google.android.material:material:1.0.0'
implementation 'com.jakewharton:disklrucache:2.0.2'
implementation "com.android.support:appcompat-v7:${supportLibraryVersion}"
implementation "com.android.support:cardview-v7:${supportLibraryVersion}"
implementation "com.android.support:exifinterface:${supportLibraryVersion}"
implementation 'com.github.albfernandez:juniversalchardet:2.2.0'
implementation 'androidx.appcompat:appcompat:1.0.2'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'androidx.exifinterface:exifinterface:1.0.0'
implementation 'com.github.albfernandez:juniversalchardet:2.0.0' // need this version for Android <7
implementation 'com.google.code.findbugs:annotations:2.0.1'
implementation 'commons-io:commons-io:2.6'
implementation 'com.github.evernote:android-job:v1.2.5'
implementation 'com.jakewharton:butterknife:8.8.1'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'
implementation 'com.github.tobiaskaminsky:android-job:v1.2.6.1' // 'com.github.evernote:android-job:v1.2.5'
implementation 'com.jakewharton:butterknife:9.0.0-rc2'
annotationProcessor 'com.jakewharton:butterknife-compiler:9.0.0-rc2'
implementation 'org.greenrobot:eventbus:3.1.1'
implementation 'com.googlecode.ez-vcard:ez-vcard:0.10.4'
implementation 'org.lukhnos:nnio:0.2'
implementation 'com.madgag.spongycastle:pkix:1.54.0.0'
implementation 'com.google.code.gson:gson:2.8.5'
implementation 'com.afollestad:sectioned-recyclerview:0.5.0'
implementation 'com.github.chrisbanes:PhotoView:2.1.4'
implementation 'com.github.chrisbanes:PhotoView:2.3.0'
implementation 'pl.droidsonroids.gif:android-gif-drawable:1.2.15'
implementation 'org.parceler:parceler-api:1.1.11'
annotationProcessor 'org.parceler:parceler:1.1.11'
implementation ('com.github.bumptech.glide:glide:3.7.0') {
implementation 'org.parceler:parceler-api:1.1.12'
annotationProcessor 'org.parceler:parceler:1.1.12'
implementation('com.github.bumptech.glide:glide:3.7.0') {
exclude group: "com.android.support"
}
implementation 'com.caverock:androidsvg:1.3'
implementation "com.android.support:support-annotations:${supportLibraryVersion}"
implementation 'androidx.annotation:annotation:1.0.1'
implementation 'com.google.code.gson:gson:2.8.5'
// dependencies for local unit tests
testImplementation 'junit:junit:4.12'
testImplementation 'org.mockito:mockito-core:2.22.0'
testImplementation 'org.mockito:mockito-core:2.23.4'
// dependencies for instrumented tests
// JUnit4 Rules
androidTestImplementation 'com.android.support.test:rules:1.0.2'
androidTestImplementation 'androidx.test:rules:1.1.1'
// Android JUnit Runner
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'androidx.test:runner:1.1.1'
// Espresso core
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-contrib:3.0.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-contrib:3.1.1'
// UIAutomator - for cross-app UI tests, and to grant screen is turned on in Espresso tests
androidTestImplementation 'com.android.support.test.uiautomator:uiautomator-v18:2.1.3'
// androidTestImplementation 'androidx.test.uiautomator:uiautomator:2.2.0'
// fix conflict in dependencies; see http://g.co/androidstudio/app-test-app-conflict for details
//androidTestImplementation "com.android.support:support-annotations:${supportLibraryVersion}"
implementation 'org.jetbrains:annotations:16.0.2'
implementation 'org.jetbrains:annotations:16.0.3'
compileOnly "org.projectlombok:lombok:1.18.4"
annotationProcessor "org.projectlombok:lombok:1.18.4"
androidTestImplementation 'tools.fastlane:screengrab:1.2.0'
findbugsPlugins 'com.h3xstream.findsecbugs:findsecbugs-plugin:1.8.0'
findbugsPlugins 'com.mebigfatguy.fb-contrib:fb-contrib:7.4.3'
// jacocoAnt "org.jacoco:org.jacoco.ant:${jacocoVersion}"
// jacocoAgent "org.jacoco:org.jacoco.agent:${jacocoVersion}"
// androidJacocoAgent "org.jacoco:org.jacoco.agent:${jacocoVersion}"
@@ -309,6 +308,6 @@ task combinedTestReport(type: JacocoReport) {
sourceDirectories = files([mainSrc])
classDirectories = files([debugTree])
executionData = fileTree(dir: project.buildDir, includes: [
'jacoco/testGplayDebugUnitTest.exec', 'outputs/code-coverage/connected/flavors/GPLAY/*coverage.ec'
'jacoco/testGplayDebugUnitTest.exec', 'outputs/code-coverage/connected/flavors/GPLAY/*coverage.ec'
])
}
+5
View File
@@ -0,0 +1,5 @@
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">
<path d="M0 0h24v24H0z" fill="none" />
<path
d="M15.67 4H14V2h-4v2H8.33C7.6 4 7 4.6 7 5.33v15.33C7 21.4 7.6 22 8.33 22h7.33c.74 0 1.34-.6 1.34-1.33V5.33C17 4.6 16.4 4 15.67 4zM13 18h-2v-2h2v2zm0-4h-2V9h2v5z" />
</svg>

After

Width:  |  Height:  |  Size: 318 B

+4
View File
@@ -0,0 +1,4 @@
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">
<path d="M20 2H4c-1.1 0-2 .9-2 2v18l4-4h14c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2z"/>
<path d="M0 0h24v24H0z" fill="none"/>
</svg>

After

Width:  |  Height:  |  Size: 216 B

+4
View File
@@ -0,0 +1,4 @@
<svg xmlns="http://www.w3.org/2000/svg" height="16" width="16" version="1.1" viewbox="0 0 16 16">
<path
d="M8 1.5C3.582 1.5 0 3.962 0 7s3.582 5.5 8 5.5c.25 0 .49-.016.734-.03L13 16v-4.703c1.83-1.008 3-2.56 3-4.297 0-3.038-3.582-5.5-8-5.5z" />
</svg>

After

Width:  |  Height:  |  Size: 262 B

+11 -9
View File
@@ -13,7 +13,7 @@
viewBox="0 0 128 128"
version="1.1"
id="svg829"
inkscape:version="0.92.2 2405546, 2018-03-11"
inkscape:version="0.92.3 (2405546, 2018-03-11)"
sodipodi:docname="first_run_talk.svg">
<defs
id="defs823"/>
@@ -25,8 +25,8 @@
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="0.98994949"
inkscape:cx="297.07973"
inkscape:cy="366.5173"
inkscape:cx="197.26742"
inkscape:cy="78.319822"
inkscape:document-units="mm"
inkscape:current-layer="layer1"
showgrid="false"
@@ -35,10 +35,10 @@
fit-margin-left="2"
fit-margin-right="2"
fit-margin-bottom="2"
inkscape:window-width="1600"
inkscape:window-height="835"
inkscape:window-width="1920"
inkscape:window-height="1046"
inkscape:window-x="0"
inkscape:window-y="0"
inkscape:window-y="34"
inkscape:window-maximized="1"/>
<metadata
id="metadata826">
@@ -58,9 +58,11 @@
id="layer1"
transform="translate(-15.580506,-52.12649)">
<path
style="fill:#ffffff;stroke-width:4.78543139"
d="M 241.85938,2.6035156 C 109.72511,2.6053865 2.6113188,109.72517 2.6152344,241.86133 c 8.69e-5,132.13334 107.1127156,239.24815 239.2441456,239.25 26.38805,-0.0535 52.46249,-4.4707 77.19954,-12.96295 16.31567,-5.60118 32.04955,-12.97512 46.90788,-22.039 12.78608,5.081 32.46588,14.50729 51.91537,22.30803 25.27886,10.13878 50.16864,17.53156 59.02799,9.06892 8.75623,-8.36216 2.65569,-33.29226 -6.22433,-58.86696 -7.73207,-22.26856 -17.57143,-45.02584 -21.54521,-57.75999 9.61628,-16.68601 17.14139,-34.39874 22.46771,-52.73831 6.22776,-21.44334 9.44951,-43.74365 9.49323,-66.26169 C 481.09967,109.72865 373.99016,2.6150774 241.86133,2.6113281 Z m 0.0273,90.9609374 h 0.002 c 81.9303,3.48e-4 148.34762,66.419397 148.34766,148.351567 -0.004,81.92844 -66.42304,148.34179 -148.34961,148.34179 -81.92656,0 -148.342022,-66.41335 -148.347658,-148.34179 2.7e-5,-81.93241 66.417128,-148.351563 148.347658,-148.351567 z"
transform="matrix(0.26458333,0,0,0.26458333,15.580506,52.12649)"
id="path4753"
inkscape:connector-curvature="0"
style="fill:#ffffff;stroke-width:1.26614535"
d="m 79.572589,52.815123 a 63.300934,63.301842 0 0 0 -63.300038,63.303717 63.300934,63.301842 0 0 0 63.300038,63.3018 63.300934,63.301842 0 0 0 32.836581,-9.26097 c 7.77991,3.09162 25.20623,12.26357 29.35376,8.30176 4.33401,-4.13896 -5.08818,-23.61904 -7.34707,-30.85775 A 63.300934,63.301842 0 0 0 142.8719,116.11826 63.300934,63.301842 0 0 0 79.572762,52.817324 Z m 0.0074,24.06677 A 39.250508,39.251409 0 0 1 118.83033,116.13329 39.250508,39.251409 0 0 1 79.579825,155.382 39.250508,39.251409 0 0 1 40.329319,116.13329 39.250508,39.251409 0 0 1 79.579825,76.881893 Z"
id="path2"/>
sodipodi:nodetypes="cccscscscscccsccscs"/>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 2.6 KiB

After

Width:  |  Height:  |  Size: 3.0 KiB

+1
View File
@@ -8,4 +8,5 @@
<Match>
<Class name="~.*\.R\$.*"/>
</Match>
<Bug pattern="PATH_TRAVERSAL_IN" />
</FindBugsFilter>
+5
View File
@@ -0,0 +1,5 @@
# workaround since lombok and desugering have an issue
# to be fixed with gradle Android plugin 3.3.0
android.enableD8.desugaring=false
android.enableJetifier=true
android.useAndroidX=true
+2 -2
View File
@@ -3,5 +3,5 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip
distributionSha256Sum=7a2c66d1a78f811d5f37d14630ad21cec5e77a2a4dc61e787e2257a6341016ce
distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip
distributionSha256Sum=9af7345c199f1731c187c96d3fe3d31f5405192a42046bafa71d846c3d9adacb
+13 -171
View File
@@ -1,17 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<lint>
<issue id="UnusedAttribute">
<ignore regexp="importantForAutofill"/>
<ignore regexp="autofillHints"/>
</issue>
<issue id="InvalidPackage">
<ignore path="**/freemarker-2.3.23.jar"/>
<ignore path="**/nnio-0.2.jar"/>
<ignore path="**/pkix-1.54.0.0.jar"/>
</issue>
<issue id="UnusedResources">
<ignore regexp="store_short_desc|store_full_desc|store_short_dev_desc|store_full_dev_desc" />
<ignore
regexp="screenshot_01_gridView|screenshot_02_listView|screenshot_03_drawer|screenshot_04_accounts|screenshot_05_autoUpload|screenshot_06_davdroid"/>
<ignore path="**/raw/encryption_key_words.txt" />
</issue>
<issue id="MissingQuantity">
<ignore path="**/values-ka-rGE/strings.xml"/>
</issue>
@@ -28,178 +33,15 @@
</issue>
<issue id="UnusedResources">
<ignore path="**/values-b+en+001/strings.xml"/>
<ignore path="**/values-b+es+419/strings.xml" />
<ignore path="**/values-pt-rPT/strings.xml"/>
<ignore path="**/values-ro/strings.xml"/>
<ignore path="**/values-zh-rCN/strings.xml"/>
<ignore path="**/values-bg-rBG/strings.xml"/>
<ignore path="**/values-nb-rNO/strings.xml"/>
<ignore path="**/values-es/strings.xml"/>
<ignore path="**/values-fa/strings.xml"/>
<ignore path="**/values-ko/strings.xml"/>
<ignore path="**/values-ru/strings.xml"/>
<ignore path="**/values-ast/strings.xml"/>
<ignore path="**/values-es-rCO/strings.xml"/>
<ignore path="**/values-es-rCL/strings.xml"/>
<ignore path="**/values-es-rSV/strings.xml"/>
<ignore path="**/values-sv/strings.xml"/>
<ignore path="**/values-tr/strings.xml"/>
<ignore path="**/values-es-rUY/strings.xml"/>
<ignore path="**/values-es-rGT/strings.xml"/>
<ignore path="**/values-fr/strings.xml"/>
<ignore path="**/values-es-rMX/strings.xml"/>
<ignore path="**/values-fi-rFI/strings.xml"/>
<ignore path="**/values-ar/strings.xml"/>
<ignore path="**/values-es-rAR/strings.xml"/>
<ignore path="**/values-de-rDE/strings.xml"/>
<ignore path="**/values-ca/strings.xml"/>
<ignore path="**/values-is/strings.xml"/>
<ignore path="**/values-es-rNI/strings.xml"/>
<ignore path="**/values-es-rPR/strings.xml"/>
<ignore path="**/values-es-rDO/strings.xml"/>
<ignore path="**/values-sq/strings.xml"/>
<ignore path="**/values-pt-rBR/strings.xml"/>
<ignore path="**/values-ja-rJP/strings.xml"/>
<ignore path="**/values-sr/strings.xml"/>
<ignore path="**/values-it/strings.xml"/>
<ignore path="**/values-hu-rHU/strings.xml"/>
<ignore path="**/values-pl/strings.xml"/>
<ignore path="**/values-es-rHN/strings.xml"/>
<ignore path="**/values-lt-rLT/strings.xml"/>
<ignore path="**/values-es-rPA/strings.xml"/>
<ignore path="**/values-nl/strings.xml"/>
<ignore path="**/values-sk-rSK/strings.xml"/>
<ignore path="**/values-ka-rGE/strings.xml"/>
<ignore path="**/values-eu/strings.xml"/>
<ignore path="**/values-es-rCR/strings.xml"/>
<ignore path="**/values-da/strings.xml"/>
<ignore path="**/values-es-rEC/strings.xml"/>
<ignore path="**/values-de/strings.xml"/>
<ignore path="**/values-sl/strings.xml"/>
<ignore path="**/values-es-rPY/strings.xml"/>
<ignore path="**/values-es-rPE/strings.xml"/>
<ignore path="**/values-zh-rTW/strings.xml"/>
<ignore path="**/values-el/strings.xml"/>
<ignore path="**/values-id/strings.xml"/>
<ignore path="**/values-cs-rCZ/strings.xml"/>
<ignore path="**/values-en-rGB/strings.xml"/>
<ignore path="**/values-**/strings.xml" />
</issue>
<issue id="TypographyEllipsis">
<ignore path="**/values-b+en+001/strings.xml"/>
<ignore path="**/values-pt-rPT/strings.xml"/>
<ignore path="**/values-ro/strings.xml"/>
<ignore path="**/values-zh-rCN/strings.xml"/>
<ignore path="**/values-bg-rBG/strings.xml"/>
<ignore path="**/values-nb-rNO/strings.xml"/>
<ignore path="**/values-es/strings.xml"/>
<ignore path="**/values-fa/strings.xml"/>
<ignore path="**/values-ko/strings.xml"/>
<ignore path="**/values-ru/strings.xml"/>
<ignore path="**/values-ast/strings.xml"/>
<ignore path="**/values-es-rCO/strings.xml"/>
<ignore path="**/values-es-rCL/strings.xml"/>
<ignore path="**/values-es-rSV/strings.xml"/>
<ignore path="**/values-sv/strings.xml"/>
<ignore path="**/values-tr/strings.xml"/>
<ignore path="**/values-es-rUY/strings.xml"/>
<ignore path="**/values-es-rGT/strings.xml"/>
<ignore path="**/values-fr/strings.xml"/>
<ignore path="**/values-es-rMX/strings.xml"/>
<ignore path="**/values-fi-rFI/strings.xml"/>
<ignore path="**/values-ar/strings.xml"/>
<ignore path="**/values-es-rAR/strings.xml"/>
<ignore path="**/values-de-rDE/strings.xml"/>
<ignore path="**/values-ca/strings.xml"/>
<ignore path="**/values-is/strings.xml"/>
<ignore path="**/values-es-rNI/strings.xml"/>
<ignore path="**/values-es-rPR/strings.xml"/>
<ignore path="**/values-es-rDO/strings.xml"/>
<ignore path="**/values-sq/strings.xml"/>
<ignore path="**/values-pt-rBR/strings.xml"/>
<ignore path="**/values-ja-rJP/strings.xml"/>
<ignore path="**/values-sr/strings.xml"/>
<ignore path="**/values-it/strings.xml"/>
<ignore path="**/values-hu-rHU/strings.xml"/>
<ignore path="**/values-pl/strings.xml"/>
<ignore path="**/values-es-rHN/strings.xml"/>
<ignore path="**/values-lt-rLT/strings.xml"/>
<ignore path="**/values-es-rPA/strings.xml"/>
<ignore path="**/values-nl/strings.xml"/>
<ignore path="**/values-sk-rSK/strings.xml"/>
<ignore path="**/values-ka-rGE/strings.xml"/>
<ignore path="**/values-eu/strings.xml"/>
<ignore path="**/values-es-rCR/strings.xml"/>
<ignore path="**/values-da/strings.xml"/>
<ignore path="**/values-es-rEC/strings.xml"/>
<ignore path="**/values-de/strings.xml"/>
<ignore path="**/values-sl/strings.xml"/>
<ignore path="**/values-es-rPY/strings.xml"/>
<ignore path="**/values-es-rPE/strings.xml"/>
<ignore path="**/values-zh-rTW/strings.xml"/>
<ignore path="**/values-el/strings.xml"/>
<ignore path="**/values-id/strings.xml"/>
<ignore path="**/values-cs-rCZ/strings.xml"/>
<ignore path="**/values-en-rGB/strings.xml"/>
<ignore path="**/values-**/strings.xml" />
</issue>
<issue id="Typos">
<ignore path="**/values-b+en+001/strings.xml"/>
<ignore path="**/values-pt-rPT/strings.xml"/>
<ignore path="**/values-ro/strings.xml"/>
<ignore path="**/values-zh-rCN/strings.xml"/>
<ignore path="**/values-bg-rBG/strings.xml"/>
<ignore path="**/values-nb-rNO/strings.xml"/>
<ignore path="**/values-es/strings.xml"/>
<ignore path="**/values-fa/strings.xml"/>
<ignore path="**/values-ko/strings.xml"/>
<ignore path="**/values-ru/strings.xml"/>
<ignore path="**/values-ast/strings.xml"/>
<ignore path="**/values-es-rCO/strings.xml"/>
<ignore path="**/values-es-rCL/strings.xml"/>
<ignore path="**/values-es-rSV/strings.xml"/>
<ignore path="**/values-sv/strings.xml"/>
<ignore path="**/values-tr/strings.xml"/>
<ignore path="**/values-es-rUY/strings.xml"/>
<ignore path="**/values-es-rGT/strings.xml"/>
<ignore path="**/values-fr/strings.xml"/>
<ignore path="**/values-es-rMX/strings.xml"/>
<ignore path="**/values-fi-rFI/strings.xml"/>
<ignore path="**/values-ar/strings.xml"/>
<ignore path="**/values-es-rAR/strings.xml"/>
<ignore path="**/values-de-rDE/strings.xml"/>
<ignore path="**/values-ca/strings.xml"/>
<ignore path="**/values-is/strings.xml"/>
<ignore path="**/values-es-rNI/strings.xml"/>
<ignore path="**/values-es-rPR/strings.xml"/>
<ignore path="**/values-es-rDO/strings.xml"/>
<ignore path="**/values-sq/strings.xml"/>
<ignore path="**/values-pt-rBR/strings.xml"/>
<ignore path="**/values-ja-rJP/strings.xml"/>
<ignore path="**/values-sr/strings.xml"/>
<ignore path="**/values-it/strings.xml"/>
<ignore path="**/values-hu-rHU/strings.xml"/>
<ignore path="**/values-pl/strings.xml"/>
<ignore path="**/values-es-rHN/strings.xml"/>
<ignore path="**/values-lt-rLT/strings.xml"/>
<ignore path="**/values-es-rPA/strings.xml"/>
<ignore path="**/values-nl/strings.xml"/>
<ignore path="**/values-sk-rSK/strings.xml"/>
<ignore path="**/values-ka-rGE/strings.xml"/>
<ignore path="**/values-eu/strings.xml"/>
<ignore path="**/values-es-rCR/strings.xml"/>
<ignore path="**/values-da/strings.xml"/>
<ignore path="**/values-es-rEC/strings.xml"/>
<ignore path="**/values-de/strings.xml"/>
<ignore path="**/values-sl/strings.xml"/>
<ignore path="**/values-es-rPY/strings.xml"/>
<ignore path="**/values-es-rPE/strings.xml"/>
<ignore path="**/values-zh-rTW/strings.xml"/>
<ignore path="**/values-el/strings.xml"/>
<ignore path="**/values-id/strings.xml"/>
<ignore path="**/values-cs-rCZ/strings.xml"/>
<ignore path="**/values-en-rGB/strings.xml"/>
<issue id="Typos">
<ignore path="**/values-**/strings.xml" />
</issue>
</lint>
+67 -34
View File
@@ -8,74 +8,107 @@
#6: DRONE_BUILD_NUMBER
#7: PULL_REQUEST_NUMBER
stableBranch="master"
repository="android"
ruby scripts/analysis/lint-up.rb $1 $2 $3
lintValue=$?
./gradlew findbugs
# exit codes:
# 0: count was reduced
# 1: count was increased
# 2: count stayed the same
./gradlew findbugs
echo "Branch: $3"
if [ $3 = "master" ]; then
echo "New findbugs result for master at: https://www.kaminsky.me/nc-dev/client-findbugs/master.html"
curl -u $4:$5 -X PUT https://nextcloud.kaminsky.me/remote.php/webdav/findbugs/master.html --upload-file build/reports/findbugs/findbugs.html
summary=$(sed -n "/<h1>Summary<\/h1>/,/<h1>Warnings<\/h1>/p" build/reports/findbugs/findbugs.html | head -n-1 | sed s'/<\/a>//'g | sed s'/<a.*>//'g | sed s'/Summary/FindBugs (master)/' | tr "\"" "\'" | tr -d "\r\n")
curl -u $4:$5 -X PUT -d "$summary" https://nextcloud.kaminsky.me/remote.php/webdav/findbugs/findbugs.html
if [ $3 = $stableBranch ]; then
echo "New findbugs result for $stableBranch at: https://www.kaminsky.me/nc-dev/$repository-findbugs/$stableBranch.html"
curl -u $4:$5 -X PUT https://nextcloud.kaminsky.me/remote.php/webdav/$repository-findbugs/$stableBranch.html --upload-file build/reports/findbugs/findbugs.html
summary=$(sed -n "/<h1>Summary<\/h1>/,/<h1>Warnings<\/h1>/p" build/reports/findbugs/findbugs.html | head -n-1 | sed s'/<\/a>//'g | sed s'/<a.*>//'g | sed s"/Summary/FindBugs ($stableBranch)/" | tr "\"" "\'" | tr -d "\r\n")
curl -u $4:$5 -X PUT -d "$summary" https://nextcloud.kaminsky.me/remote.php/webdav/$repository-findbugs/findbugs-summary-$stableBranch.html
if [ $lintValue -ne 1 ]; then
echo "New lint result for master at: https://www.kaminsky.me/nc-dev/client-lint/master.html"
curl -u $4:$5 -X PUT https://nextcloud.kaminsky.me/remote.php/webdav/droneLogs/master.html --upload-file build/reports/lint/lint.html
echo "New lint result for $stableBranch at: https://www.kaminsky.me/nc-dev/$repository-lint/$stableBranch.html"
curl -u $4:$5 -X PUT https://nextcloud.kaminsky.me/remote.php/webdav/$repository-lint/$stableBranch.html --upload-file build/reports/lint/lint.html
exit 0
fi
else
if [ -e $6 ]; then
6="master-"$(date +%F)
6=$stableBranch"-"$(date +%F)
fi
echo "New lint results at https://www.kaminsky.me/nc-dev/client-lint/$6.html"
curl 2>/dev/null -u $4:$5 -X PUT https://nextcloud.kaminsky.me/remote.php/webdav/droneLogs/$6.html --upload-file build/reports/lint/lint.html
echo "New findbugs results at https://www.kaminsky.me/nc-dev/client-findbugs/$6.html"
curl 2>/dev/null -u $4:$5 -X PUT https://nextcloud.kaminsky.me/remote.php/webdav/findbugs/$6.html --upload-file build/reports/findbugs/findbugs.html
echo "New lint results at https://www.kaminsky.me/nc-dev/$repository-lint/$6.html"
curl 2>/dev/null -u $4:$5 -X PUT https://nextcloud.kaminsky.me/remote.php/webdav/$repository-lint/$6.html --upload-file build/reports/lint/lint.html
echo "New findbugs results at https://www.kaminsky.me/nc-dev/$repository-findbugs/$6.html"
curl 2>/dev/null -u $4:$5 -X PUT https://nextcloud.kaminsky.me/remote.php/webdav/$repository-findbugs/$6.html --upload-file build/reports/findbugs/findbugs.html
# delete all old comments
oldComments=$(curl 2>/dev/null -u $1:$2 -X GET https://api.github.com/repos/nextcloud/android/issues/$7/comments | jq '.[] | (.id |tostring) + "|" + (.user.login | test("nextcloud-android-bot") | tostring) ' | grep true | tr -d "\"" | cut -f1 -d"|")
echo $oldComments | while read comment ; do
oldComments=$(curl 2>/dev/null -u $1:$2 -X GET https://api.github.com/repos/nextcloud/android/issues/$7/comments | jq '.[] | (.id |tostring) + "|" + (.user.login | test("nextcloud-android-bot") | tostring) ' | grep true | tr -d "\"" | cut -f1 -d"|")
echo $oldComments | while read comment ; do
curl 2>/dev/null -u $1:$2 -X DELETE https://api.github.com/repos/nextcloud/android/issues/comments/$comment
done
# check library, only if base branch is master
baseBranch=$(scripts/analysis/getBranchBase.sh $1 $2 $7 | tr -d "\"")
if [ $baseBranch = "master" -a $(grep "android-library:master" build.gradle -c) -ne 3 ]; then
checkLibraryMessage="<h1>Android-library is not set to master branch in build.gradle</h1>"
checkLibrary=1
else
else
checkLibrary=0
fi
# lint and findbugs file must exist
if [ ! -s build/reports/lint/lint.html ] ; then
echo "lint.html file is missing!"
exit 1
fi
if [ ! -s build/reports/findbugs/findbugs.html ] ; then
echo "findbugs.html file is missing!"
exit 1
fi
# add comment with results
lintResultNew=$(grep "Lint Report.* [0-9]* warnings" build/reports/lint/lint.html | cut -f2 -d':' |cut -f1 -d'<')
lintErrorNew=$(echo $lintResultNew | grep "[0-9]* error" -o | cut -f1 -d" ")
lintWarningNew=$(echo $lintResultNew | grep "[0-9]* warning" -o | cut -f1 -d" ")
lintErrorOld=$(grep "[0-9]* error" scripts/analysis/lint-results.txt -o | cut -f1 -d" ")
lintWarningOld=$(grep "[0-9]* warning" scripts/analysis/lint-results.txt -o | cut -f1 -d" ")
lintResult="<h1>Lint</h1><table width='500' cellpadding='5' cellspacing='2'><tr class='tablerow0'><td>Type</td><td><a href='https://www.kaminsky.me/nc-dev/client-lint/master.html'>Master</a></td><td><a href='https://www.kaminsky.me/nc-dev/client-lint/"$6".html'>PR</a></td></tr><tr class='tablerow1'><td>Warnings</td><td>"$lintWarningOld"</td><td>"$lintWarningNew"</td></tr><tr class='tablerow0'><td>Errors</td><td>"$lintErrorOld"</td><td>"$lintErrorNew"</td></tr></table>"
findbugsResultNew=$(sed -n "/<h1>Summary<\/h1>/,/<h1>Warnings<\/h1>/p" build/reports/findbugs/findbugs.html |head -n-1 | sed s'/<\/a>//'g | sed s'/<a.*>//'g | sed s"#Summary#<a href=\"https://www.kaminsky.me/nc-dev/client-findbugs/$6.html\">FindBugs</a> (new)#" | tr "\"" "\'" | tr -d "\n")
findbugsResultOld=$(curl 2>/dev/null https://nextcloud.kaminsky.me/index.php/s/YaHngKMM6ERmBeg/download | tr "\"" "\'" | tr -d "\r\n" | sed s'#FindBugs#<a href=\"https://www.kaminsky.me/nc-dev/client-findbugs/master.html">FindBugs</a>#'| tr "\"" "\'" | tr -d "\n")
lintErrorNew=$(echo $lintResultNew | grep "[0-9]* error" -o | cut -f1 -d" ")
if ( [ -z $lintErrorNew ] ); then
lintErrorNew=0
fi
lintWarningNew=$(echo $lintResultNew | grep "[0-9]* warning" -o | cut -f1 -d" ")
if ( [ -z $lintWarningNew ] ); then
lintWarningNew=0
fi
lintResultOld=$(curl 2>/dev/null https://raw.githubusercontent.com/nextcloud/android/$stableBranch/scripts/analysis/lint-results.txt)
lintErrorOld=$(echo $lintResultOld | grep "[0-9]* error" -o | cut -f1 -d" ")
if ( [ -z $lintErrorOld ] ); then
lintErrorOld=0
fi
lintWarningOld=$(echo $lintResultOld | grep "[0-9]* warning" -o | cut -f1 -d" ")
if ( [ -z $lintWarningOld ] ); then
lintWarningOld=0
fi
lintResult="<h1>Lint</h1><table width='500' cellpadding='5' cellspacing='2'><tr class='tablerow0'><td>Type</td><td><a href='https://www.kaminsky.me/nc-dev/"$repository"-lint/"$stableBranch".html'>$stableBranch</a></td><td><a href='https://www.kaminsky.me/nc-dev/"$repository"-lint/"$6".html'>PR</a></td></tr><tr class='tablerow1'><td>Warnings</td><td>"$lintWarningOld"</td><td>"$lintWarningNew"</td></tr><tr class='tablerow0'><td>Errors</td><td>"$lintErrorOld"</td><td>"$lintErrorNew"</td></tr></table>"
findbugsResultNew=$(sed -n "/<h1>Summary<\/h1>/,/<h1>Warnings<\/h1>/p" build/reports/findbugs/findbugs.html |head -n-1 | sed s'/<\/a>//'g | sed s'/<a.*>//'g | sed s"#Summary#<a href=\"https://www.kaminsky.me/nc-dev/$repository-findbugs/$6.html\">FindBugs</a> (new)#" | tr "\"" "\'" | tr -d "\n")
findbugsResultOld=$(curl 2>/dev/null https://www.kaminsky.me/nc-dev/$repository-findbugs/findbugs-summary-$stableBranch.html | tr "\"" "\'" | tr -d "\r\n" | sed s"#FindBugs#<a href=\"https://www.kaminsky.me/nc-dev/$repository-findbugs/$stableBranch.html\">FindBugs</a>#" | tr "\"" "\'" | tr -d "\n")
curl -u $1:$2 -X POST https://api.github.com/repos/nextcloud/android/issues/$7/comments -d "{ \"body\" : \"$lintResult $findbugsResultNew $findbugsResultOld $checkLibraryMessage \" }"
if [ $checkLibrary -eq 1 ]; then
exit 1
fi
if [ $lintValue -eq 2 ]; then
exit 0
else
exit $lintValue
fi
fi
fi
+1 -1
View File
@@ -5,5 +5,5 @@
if [ -z $3 ] ; then
echo "master";
else
curl 2>/dev/null -u $1:$2 https://api.github.com/repos/nextcloud/android/pulls/$3 | grep \"ref\": | grep -v master | cut -d"\"" -f4
curl 2>/dev/null -u $1:$2 https://api.github.com/repos/nextcloud/android/pulls/$3 | grep \"ref\": | grep -v '"master"' | cut -d"\"" -f4
fi
+1 -1
View File
@@ -1,2 +1,2 @@
DO NOT TOUCH; GENERATED BY DRONE
<span class="mdl-layout-title">Lint Report: 94 warnings</span>
<span class="mdl-layout-title">Lint Report: 83 warnings</span>
+3 -3
View File
@@ -1,6 +1,6 @@
#!/usr/bin/env bash
URL=https://nextcloud.kaminsky.me/remote.php/webdav/integrationTests
URL=https://nextcloud.kaminsky.me/remote.php/webdav/android-integrationTests
ID=$3
USER=$1
PASS=$2
@@ -8,12 +8,12 @@ TYPE=$4
if [ $TYPE = "IT" ]; then
cd build/reports/androidTests/connected/flavors/GPLAY
else
else
cd build/reports/tests/testGplayDebugUnitTest
fi
find . -type d -exec curl -u $USER:$PASS -X MKCOL $URL/$ID/$(echo {} | sed s#\./##) \;
find . -type f -exec curl -u $USER:$PASS -X PUT $URL/$ID/$(echo {} | sed s#\./##) --upload-file {} \;
echo "Uploaded failing tests to https://nextcloud.kaminsky.me/index.php/s/XqY52jBr9ZYfDiz -> $ID"
echo "Uploaded failing tests to https://www.kaminsky.me/nc-dev/android-integrationTests/$ID"
exit 1
+5 -5
View File
@@ -25,8 +25,8 @@
the normal release/debug builds.
-->
<manifest
package="${applicationId}.test"
xmlns:tools="http://schemas.android.com/tools">
<uses-sdk tools:overrideLibrary="android.support.test.uiautomator.v18"/>
</manifest>
<manifest xmlns:tools="http://schemas.android.com/tools"
package="${applicationId}.test">
<uses-sdk tools:overrideLibrary="android_libs.ub_uiautomator" />
</manifest>
@@ -1,11 +1,6 @@
package com.owncloud.android.screenshots;
import android.content.Intent;
import android.support.test.espresso.Espresso;
import android.support.test.espresso.action.ViewActions;
import android.support.test.espresso.contrib.DrawerActions;
import android.support.test.espresso.matcher.PreferenceMatchers;
import android.support.test.rule.ActivityTestRule;
import com.owncloud.android.R;
import com.owncloud.android.ui.activity.FileDisplayActivity;
@@ -20,15 +15,20 @@ import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
import androidx.test.espresso.Espresso;
import androidx.test.espresso.action.ViewActions;
import androidx.test.espresso.contrib.DrawerActions;
import androidx.test.espresso.matcher.PreferenceMatchers;
import androidx.test.rule.ActivityTestRule;
import tools.fastlane.screengrab.Screengrab;
import tools.fastlane.screengrab.UiAutomatorScreenshotStrategy;
import tools.fastlane.screengrab.locale.LocaleTestRule;
import static android.support.test.espresso.Espresso.onData;
import static android.support.test.espresso.Espresso.onView;
import static android.support.test.espresso.action.ViewActions.click;
import static android.support.test.espresso.matcher.ViewMatchers.withId;
import static android.support.test.espresso.matcher.ViewMatchers.withText;
import static androidx.test.espresso.Espresso.onData;
import static androidx.test.espresso.Espresso.onView;
import static androidx.test.espresso.action.ViewActions.click;
import static androidx.test.espresso.matcher.ViewMatchers.withId;
import static androidx.test.espresso.matcher.ViewMatchers.withText;
import static org.hamcrest.Matchers.anything;
import static org.hamcrest.core.AnyOf.anyOf;
@@ -21,18 +21,19 @@ package com.owncloud.android.uiautomator;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.support.test.InstrumentationRegistry;
import android.support.test.filters.SdkSuppress;
import android.support.test.runner.AndroidJUnit4;
import android.support.test.uiautomator.UiDevice;
import android.support.test.uiautomator.UiObject;
import android.support.test.uiautomator.UiObjectNotFoundException;
import android.support.test.uiautomator.UiSelector;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import androidx.test.InstrumentationRegistry;
import androidx.test.filters.SdkSuppress;
import androidx.test.runner.AndroidJUnit4;
import androidx.test.uiautomator.UiDevice;
import androidx.test.uiautomator.UiObject;
import androidx.test.uiautomator.UiObjectNotFoundException;
import androidx.test.uiautomator.UiSelector;
import static org.hamcrest.CoreMatchers.notNullValue;
import static org.junit.Assert.assertThat;
@@ -6,8 +6,6 @@ import android.accounts.AuthenticatorException;
import android.accounts.OperationCanceledException;
import android.content.ActivityNotFoundException;
import android.content.Context;
import android.support.test.runner.AndroidJUnit4;
import android.test.ApplicationTestCase;
import com.owncloud.android.datamodel.FileDataStorageManager;
import com.owncloud.android.lib.common.OwnCloudClient;
@@ -19,31 +17,31 @@ import org.junit.BeforeClass;
import org.junit.runner.RunWith;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import androidx.test.InstrumentationRegistry;
import androidx.test.runner.AndroidJUnit4;
/**
* Common base for all integration tests
*/
@RunWith(AndroidJUnit4.class)
public abstract class AbstractIT extends ApplicationTestCase<MainApp> {
public abstract class AbstractIT {
protected static OwnCloudClient client;
protected static Account account;
static Account account;
protected static Context context;
private static final String username = "test";
private static final String password = "test";
private static final String baseUrl = "server";
public AbstractIT() {
super(MainApp.class);
}
@BeforeClass
public static void beforeAll() {
try {
context = MainApp.getAppContext();
context = InstrumentationRegistry.getTargetContext();
Account temp = new Account(username + "@" + baseUrl, MainApp.getAccountType(context));
@@ -62,7 +60,7 @@ public abstract class AbstractIT extends ApplicationTestCase<MainApp> {
if (account == null) {
throw new ActivityNotFoundException();
}
client = OwnCloudClientFactory.createOwnCloudClient(account, context);
createDummyFiles();
@@ -77,14 +75,28 @@ public abstract class AbstractIT extends ApplicationTestCase<MainApp> {
}
}
protected FileDataStorageManager getStorageManager() {
FileDataStorageManager getStorageManager() {
return new FileDataStorageManager(account, context.getContentResolver());
}
private static void createDummyFiles() throws IOException {
new File(FileStorageUtils.getSavePath(account.name)).mkdirs();
File file = new File(FileStorageUtils.getSavePath(account.name) + "/123.txt");
createFile("empty.txt", 0);
createFile("nonEmpty.txt", 100);
createFile("chunkedFile.txt", 500000);
}
private static void createFile(String name, int iteration) throws IOException {
File file = new File(FileStorageUtils.getSavePath(account.name) + File.separator + name);
file.createNewFile();
FileWriter writer = new FileWriter(file);
for (int i = 0; i < iteration; i++) {
writer.write("123123123123123123123123123\n");
}
writer.flush();
writer.close();
}
}
@@ -1,7 +1,5 @@
package com.owncloud.android;
import android.support.test.runner.AndroidJUnit4;
import com.owncloud.android.lib.common.operations.RemoteOperationResult;
import com.owncloud.android.operations.CreateFolderOperation;
import com.owncloud.android.operations.common.SyncOperation;
@@ -9,17 +7,21 @@ import com.owncloud.android.operations.common.SyncOperation;
import org.junit.Test;
import org.junit.runner.RunWith;
import androidx.test.runner.AndroidJUnit4;
import static junit.framework.TestCase.assertTrue;
import static org.junit.Assert.assertNull;
/**
* Tests related to file operations
*/
@RunWith(AndroidJUnit4.class)
public class FileIT extends AbstractIT {
@Test
public void testCreateFolder() {
String path = "/testFolder/";
// folder does not exist yet
assertNull(getStorageManager().getFileByPath(path));
@@ -1,7 +1,5 @@
package com.owncloud.android;
import android.support.test.runner.AndroidJUnit4;
import com.owncloud.android.db.OCUpload;
import com.owncloud.android.files.services.FileUploader;
import com.owncloud.android.lib.common.operations.RemoteOperationResult;
@@ -11,6 +9,10 @@ import com.owncloud.android.utils.FileStorageUtils;
import org.junit.Test;
import org.junit.runner.RunWith;
import androidx.test.runner.AndroidJUnit4;
import static junit.framework.TestCase.assertTrue;
/**
* Tests related to file uploads
*/
@@ -19,18 +21,45 @@ import org.junit.runner.RunWith;
public class UploadIT extends AbstractIT {
@Test
public void testSimpleUpload() {
OCUpload ocUpload = new OCUpload(FileStorageUtils.getSavePath(account.name) + "/123.txt",
"/testUpload/1.txt", account.name);
public void testEmptyUpload() {
OCUpload ocUpload = new OCUpload(FileStorageUtils.getSavePath(account.name) + "/empty.txt",
"/testUpload/empty.txt", account.name);
RemoteOperationResult result = testUpload(ocUpload);
assertTrue(result.isSuccess());
}
@Test
public void testNonEmptyUpload() {
OCUpload ocUpload = new OCUpload(FileStorageUtils.getSavePath(account.name) + "/nonEmpty.txt",
"/testUpload/nonEmpty.txt", account.name);
RemoteOperationResult result = testUpload(ocUpload);
assertTrue(result.isSuccess());
}
@Test
public void testChunkedUpload() {
OCUpload ocUpload = new OCUpload(FileStorageUtils.getSavePath(account.name) + "/chunkedFile.txt",
"/testUpload/chunkedFile.txt", account.name);
RemoteOperationResult result = testUpload(ocUpload);
assertTrue(result.isSuccess());
}
public RemoteOperationResult testUpload(OCUpload ocUpload) {
UploadFileOperation newUpload = new UploadFileOperation(
account,
null,
ocUpload,
false,
FileUploader.LOCAL_BEHAVIOUR_COPY,
context,
false,
false
account,
null,
ocUpload,
false,
FileUploader.LOCAL_BEHAVIOUR_COPY,
context,
false,
false
);
newUpload.addRenameUploadListener(() -> {
// dummy
@@ -38,13 +67,12 @@ public class UploadIT extends AbstractIT {
newUpload.setRemoteFolderToBeCreated();
RemoteOperationResult result = newUpload.execute(client, getStorageManager());
assertTrue(result.isSuccess());
return newUpload.execute(client, getStorageManager());
}
@Test
public void testUploadInNonExistingFolder() {
OCUpload ocUpload = new OCUpload(FileStorageUtils.getSavePath(account.name) + "/123.txt",
OCUpload ocUpload = new OCUpload(FileStorageUtils.getSavePath(account.name) + "/empty.txt",
"/testUpload/2/3/4/1.txt", account.name);
UploadFileOperation newUpload = new UploadFileOperation(
account,
@@ -1,4 +1,4 @@
/**
/*
* ownCloud Android client application
*
* @author David A. Velasco
@@ -21,13 +21,14 @@
package com.owncloud.android.datamodel;
import android.os.Parcel;
import android.support.test.filters.SmallTest;
import android.support.test.runner.AndroidJUnit4;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import androidx.test.filters.SmallTest;
import androidx.test.runner.AndroidJUnit4;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
@@ -77,21 +78,20 @@ public class OCFileUnitTest {
mFile.setFileId(ID);
mFile.setParentId(PARENT_ID);
mFile.setStoragePath(STORAGE_PATH);
mFile.setMimetype(MIME_TYPE);
mFile.setMimeType(MIME_TYPE);
mFile.setFileLength(FILE_LENGTH);
mFile.setCreationTimestamp(CREATION_TIMESTAMP);
mFile.setModificationTimestamp(MODIFICATION_TIMESTAMP);
mFile.setModificationTimestampAtLastSyncForData(MODIFICATION_TIMESTAMP_AT_LAST_SYNC_FOR_DATA);
mFile.setLastSyncDateForProperties(LAST_SYNC_DATE_FOR_PROPERTIES);
mFile.setLastSyncDateForData(LAST_SYNC_DATE_FOR_DATA);
mFile.setAvailableOffline(true);
mFile.setEtag(ETAG);
mFile.setShareViaLink(true);
mFile.setShareWithSharee(true);
mFile.setSharedViaLink(true);
mFile.setSharedWithSharee(true);
mFile.setPublicLink(PUBLIC_LINK);
mFile.setPermissions(PERMISSIONS);
mFile.setRemoteId(REMOTE_ID);
mFile.setNeedsUpdateThumbnail(true);
mFile.setUpdateThumbnailNeeded(true);
mFile.setDownloading(true);
mFile.setEtagInConflict(ETAG_IN_CONFLICT);
@@ -119,16 +119,14 @@ public class OCFileUnitTest {
);
assertThat(fileReadFromParcel.getLastSyncDateForProperties(), is(LAST_SYNC_DATE_FOR_PROPERTIES));
assertThat(fileReadFromParcel.getLastSyncDateForData(), is(LAST_SYNC_DATE_FOR_DATA));
assertThat(fileReadFromParcel.isAvailableOffline(), is(true));
assertThat(fileReadFromParcel.getEtag(), is(ETAG));
assertThat(fileReadFromParcel.isSharedViaLink(), is(true));
assertThat(fileReadFromParcel.isSharedWithSharee(), is(true));
assertThat(fileReadFromParcel.getPublicLink(), is(PUBLIC_LINK));
assertThat(fileReadFromParcel.getPermissions(), is(PERMISSIONS));
assertThat(fileReadFromParcel.getRemoteId(), is(REMOTE_ID));
assertThat(fileReadFromParcel.needsUpdateThumbnail(), is(true));
assertThat(fileReadFromParcel.isUpdateThumbnailNeeded(), is(true));
assertThat(fileReadFromParcel.isDownloading(), is(true));
assertThat(fileReadFromParcel.getEtagInConflict(), is(ETAG_IN_CONFLICT));
}
}
@@ -3,9 +3,6 @@ package com.owncloud.android.datamodel;
import android.accounts.Account;
import android.content.ContentResolver;
import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.filters.SmallTest;
import android.support.test.runner.AndroidJUnit4;
import com.owncloud.android.db.OCUpload;
@@ -17,6 +14,10 @@ import org.junit.runner.RunWith;
import java.io.File;
import androidx.test.InstrumentationRegistry;
import androidx.test.filters.SmallTest;
import androidx.test.runner.AndroidJUnit4;
/**
* Created by JARP on 6/7/17.
*/
@@ -22,8 +22,6 @@
package com.owncloud.android.util;
import android.os.Build;
import android.support.annotation.RequiresApi;
import android.support.test.runner.AndroidJUnit4;
import com.google.gson.JsonElement;
import com.google.gson.JsonParser;
@@ -50,7 +48,10 @@ import java.util.HashMap;
import java.util.HashSet;
import java.util.Set;
import static android.support.test.InstrumentationRegistry.getInstrumentation;
import androidx.annotation.RequiresApi;
import androidx.test.runner.AndroidJUnit4;
import static androidx.test.InstrumentationRegistry.getInstrumentation;
import static junit.framework.Assert.assertFalse;
import static junit.framework.Assert.assertTrue;
import static org.junit.Assert.assertEquals;
@@ -0,0 +1,19 @@
Svobodná (copyleft) aplikace Nextcloud pro Android, poskytující mobilní svobodu.
Funkce:
* Snadno použitelné moderní rozhraní, hodící se k vzhledu vašeho serveru
* Nahrávání souborů na Nextcloud server
* Jejich sdílení s ostatními
* Synchronizace vašich oblíbených souborů a složek
* Hledání napříč všemi složkami na serveru
* Automatické nahrávání fotek a videí pořízených vaším zařízením
* Doručování oznámení
* Podpora vícero účtů
* Zabezpečený přístup k vašim datům pomocí otisku prstu nebo PIN kódu
* Začlenění DAVdroid pro snadný přístup ke kalendáři & synchronizaci kontaktů
Jakékoli problémy prosím hlaste na https://github.com/nextcloud/android/issues a o aplikaci diskutujte na https://help.nextcloud.com/c/clients/android
Ještě Nextcloud neznáte? Nextcloud je server pro soukromou synchronizaci souborů &, sdílení a komunikaci. Je to svobodný software a můžete ho buď provozovat sami nebo si pronajímat od nějaké společnosti. Tím vy vládnete svým fotkám, údajům v kalendáři a kontaktech, dokumentům a všemu ostatnímu.
Podívejte se na Nextcloud na https://nextcloud.com
@@ -1 +1 @@
Aplikace Nextcloud pro Android ti nabízí přístup ke všem souborům ve tvém Nextcl
Aplikace Nextcloud pro Android poskytuje přístup ke všem souborům na vašem Nextc
@@ -0,0 +1 @@
Nextcloud Android programėlė suteikia jums mobiliąją prieigą prie jūsų visų Next
@@ -0,0 +1 @@
Nextcloud
@@ -9,6 +9,6 @@ Funkcje:
Zgłaszaj błędy na https://github.com/nextcloud/android/issues i dyskutuj na temat tej aplikacji na https://help.nextcloud.com/c/clients/android
Nie znasz jeszcze Nextcloud? Nextcloud jest prywatnym serwerem synchronizacji & współdzielenia plików oraz komunikacji. Jego źródła są całkowicie otwarte, więc możesz korzystać z niego na własnym serwerze albo możesz zapłacić za to firmie trzeciej. W ten sposób kontrolujesz swoje zdjęcia, kalendarz, dane kontaktowe, twoje dokumenty i inne dane.
Nie znasz jeszcze Nextcloud? Nextcloud jest prywatnym serwerem synchronizacji współdzielenia plików oraz komunikacji. Jego źródła są całkowicie otwarte, więc możesz korzystać z niego na własnym serwerze albo możesz zapłacić za to firmie trzeciej. W ten sposób kontrolujesz swoje zdjęcia, kalendarz, dane kontaktowe, twoje dokumenty i inne dane.
Zobacz Nextcloud na https://nextcloud.com
@@ -0,0 +1 @@
Nextcloud Android-appen ger mobilåtkomst till alla filer på ditt Nextcloud.
@@ -0,0 +1 @@
Nextcloud
@@ -26,10 +26,13 @@ import android.util.Log;
import com.google.android.gms.common.ConnectionResult;
import com.google.android.gms.common.GoogleApiAvailability;
public class GooglePlayUtils {
public final class GooglePlayUtils {
private static final int PLAY_SERVICES_RESOLUTION_REQUEST = 9000;
private static final String TAG = "GooglePlayUtils";
private GooglePlayUtils() {
}
public static boolean checkPlayServices(Activity activity) {
GoogleApiAvailability apiAvailability = GoogleApiAvailability.getInstance();
int resultCode = apiAvailability.isGooglePlayServicesAvailable(activity);
@@ -395,19 +395,11 @@ public final class PushUtils {
PreferenceManager.setKeysMigration(context, true);
} else {
if (oldPrivateKeyFile.exists()) {
try {
FileStorageUtils.moveFile(oldPrivateKeyFile, privateKeyFile);
} catch (IOException e) {
Log.e(TAG, "Failed to move old private key to new location");
}
FileStorageUtils.moveFile(oldPrivateKeyFile, privateKeyFile);
}
if (oldPublicKeyFile.exists()) {
try {
FileStorageUtils.moveFile(oldPublicKeyFile, publicKeyFile);
} catch (IOException e) {
Log.e(TAG, "Failed to move old public key to new location");
}
FileStorageUtils.moveFile(oldPublicKeyFile, publicKeyFile);
}
if (privateKeyFile.exists() && publicKeyFile.exists()) {
-1
View File
@@ -10,7 +10,6 @@
<string name="google_app_id" translatable="false">1:829118773643:android:512449826e931d0e</string>
<string name="google_crash_reporting_api_key" translatable="false">AIzaSyAWIyOcLafaFp8PFL61h64cy1NNZW2cU_s</string>
<string name="google_storage_bucket" translatable="false">nextcloud-a7dea.appspot.com</string>
<string name="project_id" translatable="false">nextcloud-a7dea</string>
</resources>
+19 -4
View File
@@ -64,7 +64,11 @@
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.USE_FINGERPRINT" />
<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" />
<uses-permission android:name="android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS" />
<!-- Apps that target Android 9 (API level 28) or higher and use foreground services
must request the FOREGROUND_SERVICE permission -->
<uses-permission android:name="android.permission.FOREGROUND_SERVICE"/>
<application
@@ -106,10 +110,13 @@
<activity android:name=".ui.activity.UploadFilesActivity" />
<activity android:name=".ui.activity.ExternalSiteWebView"
android:configChanges="orientation|screenSize|keyboardHidden" />
<activity
android:name=".ui.activity.RichDocumentsWebView"
android:configChanges="orientation|screenSize|keyboardHidden"/>
<activity android:name=".ui.activity.ContactsPreferenceActivity"
android:launchMode="singleInstance"/>
<activity android:name=".ui.activity.ReceiveExternalFilesActivity"
android:taskAffinity=""
android:excludeFromRecents="true"
android:theme="@style/Theme.ownCloud.NoActionBar">
@@ -194,7 +201,7 @@
<!-- new provider used to generate URIs without file:// scheme (forbidden from Android 7) -->
<provider
android:name="android.support.v4.content.FileProvider"
android:name="androidx.core.content.FileProvider"
android:authorities="@string/file_provider_authority"
android:grantUriPermissions="true"
android:exported="false">
@@ -242,10 +249,12 @@
<service android:name=".media.MediaService" />
<activity android:name=".ui.activity.PassCodeActivity" />
<activity android:name=".ui.activity.RequestCredentialsActivity" />
<activity
android:name=".ui.activity.RequestCredentialsActivity"
android:launchMode="singleTask" />
<activity android:name=".ui.activity.ConflictsResolveActivity"/>
<activity android:name=".ui.activity.ErrorsWhileCopyingHandlerActivity"/>
<activity android:name=".ui.activity.LogHistoryActivity"/>
<activity android:name=".ui.errorhandling.ErrorShowActivity" />
@@ -277,6 +286,12 @@
<activity
android:name=".ui.activity.FolderPickerActivity"
android:label="@string/app_name" />
<activity
android:name=".ui.activity.FilePickerActivity"
android:label="@string/app_name"
android:theme="@style/Theme.ownCloud.Dialog.NoTitle"
android:launchMode="singleTop"
android:windowSoftInputMode="adjustResize"/>
<activity
android:name=".ui.activity.UploadPathActivity"
android:label="@string/app_name" />
@@ -28,6 +28,7 @@ import android.content.Context;
import android.content.SharedPreferences;
import android.os.Binder;
import android.os.ParcelFileDescriptor;
import android.text.TextUtils;
import android.util.Log;
import com.nextcloud.android.sso.aidl.IInputStreamService;
@@ -49,13 +50,16 @@ import org.apache.commons.httpclient.methods.PostMethod;
import org.apache.commons.httpclient.methods.PutMethod;
import org.apache.commons.httpclient.methods.StringRequestEntity;
import java.io.BufferedReader;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.Serializable;
import java.util.List;
import java.util.Map;
import static com.nextcloud.android.sso.Constants.EXCEPTION_ACCOUNT_NOT_FOUND;
@@ -111,7 +115,7 @@ public class InputStreamBinder extends IInputStreamService.Stub {
NextcloudRequest request = deserializeObjectAndCloseStream(is);
httpStream = processRequest(request);
} catch (Exception e) {
Log_OC.e(TAG, e.getMessage());
Log_OC.e(TAG, "Error during Nextcloud request", e);
exception = e;
}
@@ -121,7 +125,7 @@ public class InputStreamBinder extends IInputStreamService.Stub {
InputStream resultStream = new java.io.SequenceInputStream(exceptionStream, httpStream);
return ParcelFileDescriptorUtil.pipeFrom(resultStream, thread -> Log.d(TAG, "Done sending result"));
} catch (IOException e) {
Log_OC.e(TAG, e.getMessage());
Log_OC.e(TAG, "Error while sending response back to client app", e);
}
return null;
}
@@ -206,6 +210,11 @@ public class InputStreamBinder extends IInputStreamService.Stub {
method.setQueryString(convertMapToNVP(request.getParameter()));
method.addRequestHeader("OCS-APIREQUEST", "true");
for(Map.Entry<String, List<String>> header : request.getHeader().entrySet()) {
// https://stackoverflow.com/a/3097052
method.addRequestHeader(header.getKey(), TextUtils.join(",", header.getValue()));
}
client.setFollowRedirects(request.isFollowRedirects());
int status = client.executeMethod(method);
@@ -213,7 +222,20 @@ public class InputStreamBinder extends IInputStreamService.Stub {
if (status >= HTTP_STATUS_CODE_OK && status < HTTP_STATUS_CODE_MULTIPLE_CHOICES) {
return method.getResponseBodyAsStream();
} else {
throw new IllegalStateException(EXCEPTION_HTTP_REQUEST_FAILED, new IllegalStateException(String.valueOf(status)));
StringBuilder total = new StringBuilder();
InputStream inputStream = method.getResponseBodyAsStream();
// If response body is available
if (inputStream != null) {
BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream));
String line = reader.readLine();
while (line != null) {
total.append(line).append('\n');
line = reader.readLine();
}
Log_OC.e(TAG, total.toString());
}
throw new IllegalStateException(EXCEPTION_HTTP_REQUEST_FAILED,
new IllegalStateException(String.valueOf(status), new Throwable(total.toString())));
}
}
@@ -227,6 +249,10 @@ public class InputStreamBinder extends IInputStreamService.Stub {
}
private boolean validateToken(String hash, String token) {
if (hash.isEmpty() || !hash.contains("$")) {
throw new IllegalStateException(EXCEPTION_INVALID_TOKEN);
}
String salt = hash.split("\\$")[1]; // TODO extract "$"
String newHash = EncryptionUtils.generateSHA512(token, salt);
+14 -14
View File
@@ -4,16 +4,16 @@
* @author masensio
* @author David A. Velasco
* Copyright (C) 2015 ownCloud Inc.
*
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2,
* as published by the Free Software Foundation.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
@@ -35,11 +35,6 @@ import android.os.Build;
import android.os.Bundle;
import android.os.Environment;
import android.os.StrictMode;
import android.support.annotation.RequiresApi;
import android.support.annotation.StringRes;
import android.support.multidex.MultiDexApplication;
import android.support.v4.util.Pair;
import android.support.v7.app.AlertDialog;
import android.text.TextUtils;
import android.view.WindowManager;
@@ -81,6 +76,11 @@ import java.util.List;
import java.util.Map;
import java.util.concurrent.TimeUnit;
import androidx.annotation.RequiresApi;
import androidx.annotation.StringRes;
import androidx.appcompat.app.AlertDialog;
import androidx.core.util.Pair;
import androidx.multidex.MultiDexApplication;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import static com.owncloud.android.ui.activity.ContactsPreferenceActivity.PREFERENCE_CONTACTS_AUTOMATIC_BACKUP;
@@ -95,6 +95,7 @@ import static com.owncloud.android.ui.activity.ContactsPreferenceActivity.PREFER
public class MainApp extends MultiDexApplication {
public static final OwnCloudVersion OUTDATED_SERVER_VERSION = OwnCloudVersion.nextcloud_12;
public static final OwnCloudVersion MINIMUM_SUPPORTED_SERVER_VERSION = OwnCloudVersion.nextcloud_10;
private static final String TAG = MainApp.class.getSimpleName();
@@ -180,7 +181,6 @@ public class MainApp extends MultiDexApplication {
.build()
.schedule();
// register global protection with pass code
registerActivityLifecycleCallbacks(new ActivityLifecycleCallbacks() {
@@ -387,7 +387,7 @@ public class MainApp extends MultiDexApplication {
notificationManager.createNotificationChannel(channel);
}
}
public static Context getAppContext() {
return MainApp.mContext;
@@ -405,9 +405,9 @@ public class MainApp extends MultiDexApplication {
MainApp.storagePath = path;
}
// Methods to obtain Strings referring app_name
// From AccountAuthenticator
// public static final String ACCOUNT_TYPE = "owncloud";
// Methods to obtain Strings referring app_name
// From AccountAuthenticator
// public static final String ACCOUNT_TYPE = "owncloud";
public static String getAccountType(Context context) {
return context.getResources().getString(R.string.account_type);
}
@@ -446,7 +446,7 @@ public class MainApp extends MultiDexApplication {
return getAppContext().getResources().getString(R.string.authority);
}
// From ProviderMeta
// From ProviderMeta
// public static final String DB_FILE = "owncloud.db";
public static String getDBFile() {
return getAppContext().getResources().getString(R.string.db_file);
@@ -19,16 +19,17 @@ package com.owncloud.android.authentication;
import android.accounts.AccountAuthenticatorResponse;
import android.accounts.AccountManager;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import androidx.appcompat.app.AppCompatActivity;
/*
* Base class for implementing an Activity that is used to help implement an AbstractAccountAuthenticator.
* If the AbstractAccountAuthenticator needs to use an activity to handle the request then it can have the activity extend
* Base class for implementing an Activity that is used to help implement an AbstractAccountAuthenticator.
* If the AbstractAccountAuthenticator needs to use an activity to handle the request then it can have the activity extend
* AccountAuthenticatorActivity. The AbstractAccountAuthenticator passes in the response to the intent using the following:
* intent.putExtra(AccountManager.KEY_ACCOUNT_AUTHENTICATOR_RESPONSE, response);
*
* The activity then sets the result that is to be handed to the response via setAccountAuthenticatorResult(android.os.Bundle).
* This result will be sent as the result of the request when the activity finishes. If this is never set or if it is set to null
*
* The activity then sets the result that is to be handed to the response via setAccountAuthenticatorResult(android.os.Bundle).
* This result will be sent as the result of the request when the activity finishes. If this is never set or if it is set to null
* then error AccountManager.ERROR_CODE_CANCELED will be called on the response.
*/
@@ -41,7 +42,7 @@ public class AccountAuthenticatorActivity extends AppCompatActivity {
/**
* Set the result that is to be sent as the result of the request that caused this Activity to be launched.
* If result is null or this method is never called then the request will be canceled.
*
*
* @param result this is returned as the result of the AbstractAccountAuthenticator request
*/
public final void setAccountAuthenticatorResult(Bundle result) {
@@ -64,7 +65,7 @@ public class AccountAuthenticatorActivity extends AppCompatActivity {
mAccountAuthenticatorResponse.onRequestContinued();
}
}
/**
* Sends the result or a Constants.ERROR_CODE_CANCELED error if a result isn't present.
*/
@@ -24,8 +24,6 @@ import android.accounts.AccountManager;
import android.content.Context;
import android.content.SharedPreferences;
import android.preference.PreferenceManager;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import com.owncloud.android.MainApp;
import com.owncloud.android.datamodel.ArbitraryDataProvider;
@@ -33,6 +31,9 @@ import com.owncloud.android.lib.common.accounts.AccountUtils.Constants;
import com.owncloud.android.lib.resources.status.OwnCloudVersion;
import com.owncloud.android.ui.activity.ManageAccountsActivity;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
/**
* Helper class for dealing with accounts.
*/
@@ -50,10 +51,10 @@ public final class AccountUtils {
/**
* Can be used to get the currently selected ownCloud {@link Account} in the
* application preferences.
*
*
* @param context The current application {@link Context}
* @return The ownCloud {@link Account} currently saved in preferences, or the first
* {@link Account} available, if valid (still registered in the system as ownCloud
* @return The ownCloud {@link Account} currently saved in preferences, or the first
* {@link Account} available, if valid (still registered in the system as ownCloud
* account). If none is available and valid, returns null.
*/
public static @Nullable Account getCurrentOwnCloudAccount(Context context) {
@@ -96,7 +97,7 @@ public final class AccountUtils {
return accountManager.getAccountsByType(MainApp.getAccountType(context));
}
public static boolean exists(Account account, Context context) {
Account[] ocAccounts = getAccounts(context);
@@ -132,7 +133,7 @@ public final class AccountUtils {
return null;
}
}
/**
* Returns owncloud account identified by accountName or null if it does not exist.
* @param context the context
@@ -176,20 +177,23 @@ public final class AccountUtils {
/**
* Access the version of the OC server corresponding to an account SAVED IN THE ACCOUNTMANAGER
*
* @param account ownCloud account
* @return Version of the OC server corresponding to account, according to the data saved
* in the system AccountManager
* @param account ownCloud account
* @return Version of the OC server corresponding to account, according to the data saved
* in the system AccountManager
*/
public static @NonNull
OwnCloudVersion getServerVersion(Account account) {
OwnCloudVersion serverVersion = OwnCloudVersion.nextcloud_10;
OwnCloudVersion serverVersion = MainApp.MINIMUM_SUPPORTED_SERVER_VERSION;
if (account != null) {
AccountManager accountMgr = AccountManager.get(MainApp.getAppContext());
String serverVersionStr = accountMgr.getUserData(account, Constants.KEY_OC_VERSION);
if (serverVersionStr != null) {
serverVersion = new OwnCloudVersion(serverVersionStr);
}
}
return serverVersion;
}
@@ -59,13 +59,6 @@ import android.os.Bundle;
import android.os.Handler;
import android.os.IBinder;
import android.preference.PreferenceManager;
import android.support.annotation.Nullable;
import android.support.design.widget.Snackbar;
import android.support.design.widget.TextInputLayout;
import android.support.v4.app.DialogFragment;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentTransaction;
import android.text.Editable;
import android.text.InputType;
import android.text.TextUtils;
@@ -90,6 +83,8 @@ import android.widget.ProgressBar;
import android.widget.TextView;
import android.widget.TextView.OnEditorActionListener;
import com.google.android.material.snackbar.Snackbar;
import com.google.android.material.textfield.TextInputLayout;
import com.owncloud.android.MainApp;
import com.owncloud.android.R;
import com.owncloud.android.authentication.SsoWebViewClient.SsoWebViewClientListener;
@@ -132,6 +127,11 @@ import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
import androidx.annotation.Nullable;
import androidx.fragment.app.DialogFragment;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentTransaction;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
/**
@@ -203,7 +203,7 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
private AccountManager mAccountMgr;
private Uri mNewCapturedUriFromOAuth2Redirection;
/// Server PRE-Fragment elements
/// Server PRE-Fragment elements
private CustomEditText mHostUrlInput;
private View mRefreshButton;
private TextView mServerStatusView;
@@ -217,7 +217,7 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
private GetServerInfoOperation.ServerInfo mServerInfo = new GetServerInfoOperation.ServerInfo();
/// Authentication PRE-Fragment elements
/// Authentication PRE-Fragment elements
private CheckBox mOAuth2Check;
private TextView mOAuthAuthEndpointText;
private TextView mOAuthTokenEndpointText;
@@ -237,7 +237,7 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
private boolean mIsFirstAuthAttempt;
/// Identifier of operation in progress which result shouldn't be lost
/// Identifier of operation in progress which result shouldn't be lost
private long mWaitingForOpId = Long.MAX_VALUE;
private String basicTokenType;
@@ -264,7 +264,7 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
if (savedInstanceState == null) {
FirstRunActivity.runIfNeeded(this);
}
basicTokenType = AccountTypeUtils.getAuthTokenTypePass(MainApp.getAccountType(this));
oauthTokenType = AccountTypeUtils.getAuthTokenTypeAccessToken(MainApp.getAccountType(this));
samlTokenType = AccountTypeUtils.getAuthTokenTypeSamlSessionCookie(MainApp.getAccountType(this));
@@ -379,7 +379,7 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
mLoginWebView.getSettings().setAllowFileAccess(false);
mLoginWebView.getSettings().setJavaScriptEnabled(true);
mLoginWebView.getSettings().setDomStorageEnabled(true);
if (useGenericUserAgent) {
mLoginWebView.getSettings().setUserAgentString(MainApp.getNextcloudUserAgent());
} else {
@@ -587,10 +587,8 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
if (mAuthTokenType == null) {
if (mAccount != null) {
boolean oAuthRequired = mAccountMgr.getUserData(mAccount, Constants.KEY_SUPPORTS_OAUTH2) != null;
boolean samlWebSsoRequired = (
mAccountMgr.getUserData
(mAccount, Constants.KEY_SUPPORTS_SAML_WEB_SSO) != null
);
boolean samlWebSsoRequired = mAccountMgr.getUserData
(mAccount, Constants.KEY_SUPPORTS_SAML_WEB_SSO) != null;
mAuthTokenType = chooseAuthTokenType(oAuthRequired, samlWebSsoRequired);
} else {
@@ -1341,7 +1339,8 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
uri = uriBuilder.build();
Log_OC.d(TAG, "Starting browser to view " + uri.toString());
Intent i = new Intent(Intent.ACTION_VIEW, uri);
startActivity(i);
DisplayUtils.startIntentIfAppAvailable(i, this, R.string.no_browser_available);
}
@@ -1373,7 +1372,7 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
if (operation instanceof GetServerInfoOperation) {
if (operation.hashCode() == mWaitingForOpId) {
onGetServerInfoFinish(result);
} // else nothing ; only the last check operation is considered;
} // else nothing ; only the last check operation is considered;
// multiple can be started if the user amends a URL quickly
} else if (operation instanceof OAuth2GetAccessToken) {
@@ -1458,7 +1457,7 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
// 1. connection succeeded, and we know if it's SSL or not
// 2. server is installed
// 3. we got the server version
// 4. we got the authentication method required by the server
// 4. we got the authentication method required by the server
mServerInfo = (GetServerInfoOperation.ServerInfo) (result.getData().get(0));
// show outdated warning
@@ -1525,13 +1524,9 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
}
private boolean authSupported(AuthenticationMethod authMethod) {
return ((basicTokenType.equals(mAuthTokenType) &&
AuthenticationMethod.BASIC_HTTP_AUTH.equals(authMethod)) ||
(oauthTokenType.equals(mAuthTokenType) &&
AuthenticationMethod.BEARER_TOKEN.equals(authMethod)) ||
(samlTokenType.equals(mAuthTokenType) &&
AuthenticationMethod.SAML_WEB_SSO.equals(authMethod))
);
return (basicTokenType.equals(mAuthTokenType) && AuthenticationMethod.BASIC_HTTP_AUTH.equals(authMethod)) ||
(oauthTokenType.equals(mAuthTokenType) && AuthenticationMethod.BEARER_TOKEN.equals(authMethod)) ||
(samlTokenType.equals(mAuthTokenType) && AuthenticationMethod.SAML_WEB_SSO.equals(authMethod));
}
/**
@@ -1782,7 +1777,7 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
}
} else if (result.isServerFail() || result.isException()) {
/// server errors or exceptions in authorization take to requiring a new check of
/// server errors or exceptions in authorization take to requiring a new check of
/// the server
mServerIsChecked = true;
mServerIsValid = false;
@@ -1843,13 +1838,13 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
if (AccountTypeUtils.getAuthTokenTypeAccessToken(accountType).equals(mAuthTokenType)) {
response.putString(AccountManager.KEY_AUTHTOKEN, mAuthToken);
// the next line is necessary, notifications are calling directly to the
// the next line is necessary, notifications are calling directly to the
// AuthenticatorActivity to update, without AccountManager intervention
mAccountMgr.setAuthToken(mAccount, mAuthTokenType, mAuthToken);
} else if (AccountTypeUtils.getAuthTokenTypeSamlSessionCookie(accountType).equals(mAuthTokenType)) {
response.putString(AccountManager.KEY_AUTHTOKEN, mAuthToken);
// the next line is necessary; by now, notifications are calling directly to the
// the next line is necessary; by now, notifications are calling directly to the
// AuthenticatorActivity to update, without AccountManager intervention
mAccountMgr.setAuthToken(mAccount, mAuthTokenType, mAuthToken);
@@ -1944,7 +1939,7 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
}
/// prepare result to return to the Authenticator
// TODO check again what the Authenticator makes with it; probably has the same
// TODO check again what the Authenticator makes with it; probably has the same
// effect as addAccountExplicitly, but it's not well done
final Intent intent = new Intent();
intent.putExtra(AccountManager.KEY_ACCOUNT_TYPE, accountType);
@@ -1953,7 +1948,7 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
if (isOAuth || isSaml) {
mAccountMgr.setAuthToken(mAccount, mAuthTokenType, mAuthToken);
}
/// add user data to the new account; TODO probably can be done in the last parameter
/// add user data to the new account; TODO probably can be done in the last parameter
// addAccountExplicitly, or in KEY_USERDATA
mAccountMgr.setUserData(mAccount, Constants.KEY_OC_VERSION, mServerInfo.mVersion.getVersion());
mAccountMgr.setUserData(mAccount, Constants.KEY_OC_BASE_URL, mServerInfo.mBaseUrl);
@@ -2059,7 +2054,7 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
/**
* Called when the 'action' button in an IME is pressed ('enter' in software keyboard).
*
*
* Used to trigger the authentication check when the user presses 'enter' after writing the
* password, or to throw the server test when the only field on screen is the URL input field.
*/
@@ -2198,7 +2193,7 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
public void onSavedCertificate() {
Fragment fd = getSupportFragmentManager().findFragmentByTag(SAML_DIALOG_TAG);
if (fd == null) {
// if SAML dialog is not shown,
// if SAML dialog is not shown,
// the SslDialog was shown due to an SSL error in the server check
checkOcServer();
}
@@ -2222,7 +2217,7 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
private void doOnResumeAndBound() {
//Log_OC.e(TAG, "registering to listen for operation callbacks" );
mOperationsServiceBinder.addOperationListener(AuthenticatorActivity.this, mHandler);
mOperationsServiceBinder.addOperationListener(this, mHandler);
if (mWaitingForOpId <= Integer.MAX_VALUE) {
mOperationsServiceBinder.dispatchResultIfFinished((int) mWaitingForOpId, this);
}
@@ -1,4 +1,4 @@
/**
/*
* ownCloud Android client application
*
* @author masensio on 09/02/2015.
@@ -43,11 +43,11 @@ public class AuthenticatorAsyncTask extends AsyncTask<Object, Void, RemoteOpera
private static final String REMOTE_PATH = "/";
private static final boolean SUCCESS_IF_ABSENT = false;
private Context mContext;
private WeakReference<Context> mWeakContext;
private final WeakReference<OnAuthenticatorTaskListener> mListener;
public AuthenticatorAsyncTask(Activity activity) {
mContext = activity.getApplicationContext();
mWeakContext = new WeakReference<>(activity.getApplicationContext());
mListener = new WeakReference<>((OnAuthenticatorTaskListener)activity);
}
@@ -55,21 +55,18 @@ public class AuthenticatorAsyncTask extends AsyncTask<Object, Void, RemoteOpera
protected RemoteOperationResult doInBackground(Object... params) {
RemoteOperationResult result;
if (params!= null && params.length==2) {
if (params != null && params.length == 2 && mWeakContext.get() != null) {
String url = (String)params[0];
Context context = mWeakContext.get();
OwnCloudCredentials credentials = (OwnCloudCredentials)params[1];
// Client
Uri uri = Uri.parse(url);
OwnCloudClient client = OwnCloudClientFactory.createOwnCloudClient(uri, mContext, true);
OwnCloudClient client = OwnCloudClientFactory.createOwnCloudClient(uri, context, true);
client.setCredentials(credentials);
// Operation - try credentials
ExistenceCheckRemoteOperation operation = new ExistenceCheckRemoteOperation(
REMOTE_PATH,
mContext,
SUCCESS_IF_ABSENT
);
ExistenceCheckRemoteOperation operation = new ExistenceCheckRemoteOperation(REMOTE_PATH, SUCCESS_IF_ABSENT);
result = operation.execute(client);
if (operation.wasRedirected()) {
@@ -50,12 +50,11 @@ public final class PassCodeManager {
// other activities may be exempted, if needed
}
private static final int PASS_CODE_TIMEOUT = 1000;
private static final int PASS_CODE_TIMEOUT = 5000;
// keeping a "low" positive value is the easiest way to prevent the pass code is requested on rotations
private static PassCodeManager passCodeManagerInstance;
private Long timestamp = 0L;
private int visibleActivitiesCounter;
public static PassCodeManager getPassCodeManager() {
@@ -79,7 +78,8 @@ public final class PassCodeManager {
}
public void onActivityStarted(Activity activity) {
if (!exemptOfPasscodeActivities.contains(activity.getClass()) && passCodeShouldBeRequested()) {
Long timestamp = PreferenceManager.getLockTimestamp(activity);
if (!exemptOfPasscodeActivities.contains(activity.getClass()) && passCodeShouldBeRequested(timestamp)) {
Intent i = new Intent(MainApp.getAppContext(), PassCodeActivity.class);
i.setAction(PassCodeActivity.ACTION_CHECK);
@@ -88,8 +88,7 @@ public final class PassCodeManager {
}
if (!exemptOfPasscodeActivities.contains(activity.getClass()) &&
Build.VERSION.SDK_INT >= Build.VERSION_CODES.M && deviceCredentialsShouldBeRequested(activity) &&
!DeviceCredentialUtils.tryEncrypt(activity)) {
Build.VERSION.SDK_INT >= Build.VERSION_CODES.M && deviceCredentialsShouldBeRequested(timestamp, activity)) {
Intent i = new Intent(MainApp.getAppContext(), RequestCredentialsActivity.class);
i.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
activity.startActivityForResult(i, PASSCODE_ACTIVITY);
@@ -102,7 +101,7 @@ public final class PassCodeManager {
if (visibleActivitiesCounter > 0) {
visibleActivitiesCounter--;
}
setUnlockTimestamp();
setUnlockTimestamp(activity);
PowerManager powerMgr = (PowerManager) activity.getSystemService(Context.POWER_SERVICE);
if ((passCodeIsEnabled() || deviceCredentialsAreEnabled(activity)) && powerMgr != null
&& !powerMgr.isScreenOn()) {
@@ -110,22 +109,23 @@ public final class PassCodeManager {
}
}
private void setUnlockTimestamp() {
timestamp = System.currentTimeMillis();
private void setUnlockTimestamp(Activity activity) {
Long timestamp = System.currentTimeMillis();
PreferenceManager.setLockTimestamp(activity, timestamp);
}
private boolean passCodeShouldBeRequested() {
private boolean passCodeShouldBeRequested(Long timestamp) {
return (System.currentTimeMillis() - timestamp) > PASS_CODE_TIMEOUT &&
visibleActivitiesCounter <= 0 && passCodeIsEnabled();
visibleActivitiesCounter <= 0 && passCodeIsEnabled();
}
private boolean passCodeIsEnabled() {
return PreferenceManager.getLockPreference(MainApp.getAppContext()).equals(Preferences.LOCK_PASSCODE);
}
private boolean deviceCredentialsShouldBeRequested(Activity activity) {
private boolean deviceCredentialsShouldBeRequested(Long timestamp, Activity activity) {
return (System.currentTimeMillis() - timestamp) > PASS_CODE_TIMEOUT && visibleActivitiesCounter <= 0 &&
deviceCredentialsAreEnabled(activity);
deviceCredentialsAreEnabled(activity);
}
private boolean deviceCredentialsAreEnabled(Activity activity) {
@@ -24,9 +24,16 @@ package com.owncloud.android.datamodel;
import java.util.HashMap;
import java.util.Map;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.Setter;
/**
* Decrypted class representation of metadata json of folder metadata.
*/
@Getter
@Setter
@AllArgsConstructor
public class DecryptedFolderMetadata {
private Metadata metadata;
private Map<String, DecryptedFile> files;
@@ -36,170 +43,47 @@ public class DecryptedFolderMetadata {
this.files = new HashMap<>();
}
public DecryptedFolderMetadata(Metadata metadata, Map<String, DecryptedFile> files) {
this.metadata = metadata;
this.files = files;
}
public Metadata getMetadata() {
return metadata;
}
public void setMetadata(Metadata metadata) {
this.metadata = metadata;
}
public Map<String, DecryptedFile> getFiles() {
return files;
}
public void setFiles(Map<String, DecryptedFile> files) {
this.files = files;
}
@Getter
@Setter
public static class Metadata {
private Map<Integer, String> metadataKeys; // each keys is encrypted on its own, decrypt on use
private Sharing sharing;
private int version;
public Map<Integer, String> getMetadataKeys() {
return metadataKeys;
}
public void setMetadataKeys(Map<Integer, String> metadataKeys) {
this.metadataKeys = metadataKeys;
}
public Sharing getSharing() {
return sharing;
}
public void setSharing(Sharing sharing) {
this.sharing = sharing;
}
public int getVersion() {
return version;
}
public void setVersion(int version) {
this.version = version;
}
@Override
public String toString() {
return String.valueOf(version);
}
}
@Getter
@Setter
public static class Encrypted {
private Map<Integer, String> metadataKeys;
public Map<Integer, String> getMetadataKeys() {
return metadataKeys;
}
public void setMetadataKeys(Map<Integer, String> metadataKeys) {
this.metadataKeys = metadataKeys;
}
}
@Getter
@Setter
public static class Sharing {
private Map<String, String> recipient;
private String signature;
public Map<String, String> getRecipient() {
return recipient;
}
public void setRecipient(Map<String, String> recipient) {
this.recipient = recipient;
}
public String getSignature() {
return signature;
}
public void setSignature(String signature) {
this.signature = signature;
}
}
@Getter
@Setter
public static class DecryptedFile {
private Data encrypted;
private String initializationVector;
private String authenticationTag;
private int metadataKey;
public Data getEncrypted() {
return encrypted;
}
public void setEncrypted(Data encrypted) {
this.encrypted = encrypted;
}
public String getInitializationVector() {
return initializationVector;
}
public void setInitializationVector(String initializationVector) {
this.initializationVector = initializationVector;
}
public String getAuthenticationTag() {
return authenticationTag;
}
public void setAuthenticationTag(String authenticationTag) {
this.authenticationTag = authenticationTag;
}
public int getMetadataKey() {
return metadataKey;
}
public void setMetadataKey(int metadataKey) {
this.metadataKey = metadataKey;
}
}
@Getter
@Setter
public static class Data {
private String key;
private String filename;
private String mimetype;
private int version;
public String getKey() {
return key;
}
public void setKey(String key) {
this.key = key;
}
public String getFilename() {
return filename;
}
public void setFilename(String filename) {
this.filename = filename;
}
public String getMimetype() {
return mimetype;
}
public void setMimetype(String mimetype) {
this.mimetype = mimetype;
}
public int getVersion() {
return version;
}
public void setVersion(int version) {
this.version = version;
}
}
}
@@ -22,54 +22,19 @@ package com.owncloud.android.datamodel;
import org.parceler.Parcel;
@Parcel public class DecryptedPushMessage {
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
@Parcel
@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
public class DecryptedPushMessage {
public String app;
public String type;
public String subject;
public String id;
public DecryptedPushMessage(String app, String type, String subject, String id) {
this.app = app;
this.type = type;
this.subject = subject;
this.id = id;
}
public DecryptedPushMessage() {
}
public String getApp() {
return app;
}
public void setApp(String app) {
this.app = app;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public String getSubject() {
return subject;
}
public void setSubject(String subject) {
this.subject = subject;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
}
@@ -23,71 +23,26 @@ package com.owncloud.android.datamodel;
import java.util.Map;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.Setter;
/**
* Encrypted class representation of metadata json of folder metadata
*/
@Getter
@Setter
@AllArgsConstructor
public class EncryptedFolderMetadata {
private DecryptedFolderMetadata.Metadata metadata;
private Map<String, EncryptedFile> files;
public EncryptedFolderMetadata(DecryptedFolderMetadata.Metadata metadata, Map<String, EncryptedFile> files) {
this.metadata = metadata;
this.files = files;
}
public DecryptedFolderMetadata.Metadata getMetadata() {
return metadata;
}
public void setMetadata(DecryptedFolderMetadata.Metadata metadata) {
this.metadata = metadata;
}
public Map<String, EncryptedFile> getFiles() {
return files;
}
public void setFiles(Map<String, EncryptedFile> files) {
this.files = files;
}
@Getter
@Setter
public static class EncryptedFile {
private String encrypted;
private String initializationVector;
private String authenticationTag;
private int metadataKey;
public String getEncrypted() {
return encrypted;
}
public void setEncrypted(String encrypted) {
this.encrypted = encrypted;
}
public String getInitializationVector() {
return initializationVector;
}
public void setInitializationVector(String initializationVector) {
this.initializationVector = initializationVector;
}
public String getAuthenticationTag() {
return authenticationTag;
}
public void setAuthenticationTag(String authenticationTag) {
this.authenticationTag = authenticationTag;
}
public int getMetadataKey() {
return metadataKey;
}
public void setMetadataKey(int metadataKey) {
this.metadataKey = metadataKey;
}
}
}
@@ -1,19 +1,19 @@
/*
* Nextcloud Android client application
*
*
* Copyright (C) 2017 Tobias Kaminsky
* Copyright (C) 2017 Nextcloud.
*
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
* License as published by the Free Software Foundation; either
* version 3 of the License, or any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
*
*
* You should have received a copy of the GNU Affero General Public
* License along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
@@ -23,7 +23,6 @@ import android.content.ContentResolver;
import android.content.ContentValues;
import android.database.Cursor;
import android.net.Uri;
import android.support.annotation.NonNull;
import com.owncloud.android.db.ProviderMeta;
import com.owncloud.android.lib.common.ExternalLink;
@@ -33,6 +32,8 @@ import com.owncloud.android.lib.common.utils.Log_OC;
import java.util.ArrayList;
import java.util.List;
import androidx.annotation.NonNull;
/**
* Database provider for handling the persistence aspects of {@link com.owncloud.android.lib.common.ExternalLink}s.
*/
@@ -1,18 +1,18 @@
/*
* ownCloud Android client application
*
*
* Copyright (C) 2012 Bartek Przybylski
* Copyright (C) 2015 ownCloud Inc.
*
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2,
* as published by the Free Software Foundation.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
@@ -33,15 +33,15 @@ import android.database.Cursor;
import android.net.Uri;
import android.os.RemoteException;
import android.provider.MediaStore;
import android.support.annotation.Nullable;
import android.text.TextUtils;
import com.owncloud.android.MainApp;
import com.owncloud.android.db.ProviderMeta.ProviderTableMeta;
import com.owncloud.android.lib.common.network.WebdavEntry;
import com.owncloud.android.lib.common.operations.RemoteOperationResult;
import com.owncloud.android.lib.common.utils.Log_OC;
import com.owncloud.android.lib.resources.files.ReadRemoteFileOperation;
import com.owncloud.android.lib.resources.files.RemoteFile;
import com.owncloud.android.lib.resources.files.ReadFileRemoteOperation;
import com.owncloud.android.lib.resources.files.model.RemoteFile;
import com.owncloud.android.lib.resources.shares.OCShare;
import com.owncloud.android.lib.resources.shares.ShareType;
import com.owncloud.android.lib.resources.status.CapabilityBooleanType;
@@ -53,6 +53,7 @@ import com.owncloud.android.utils.MimeTypeUtil;
import java.io.File;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
@@ -61,51 +62,37 @@ import java.util.List;
import java.util.Locale;
import java.util.Set;
import androidx.annotation.Nullable;
import lombok.Getter;
import lombok.Setter;
@Getter
public class FileDataStorageManager {
private static final String TAG = FileDataStorageManager.class.getSimpleName();
public static final int ROOT_PARENT_ID = 0;
private ContentResolver mContentResolver;
private ContentProviderClient mContentProviderClient;
private Account mAccount;
private static final String AND = "=? AND ";
private static final String FAILED_TO_INSERT_MSG = "Fail to insert insert file to database ";
private static final String SENDING_TO_FILECONTENTPROVIDER_MSG = "Sending %d operations to FileContentProvider";
private static final String EXCEPTION_MSG = "Exception in batch of operations ";
private static final String TAG = FileDataStorageManager.class.getSimpleName();
public static final int ROOT_PARENT_ID = 0;
private ContentResolver contentResolver;
private ContentProviderClient contentProviderClient;
@Setter private Account account;
public FileDataStorageManager(Account account, ContentResolver cr) {
mContentProviderClient = null;
mContentResolver = cr;
mAccount = account;
contentProviderClient = null;
contentResolver = cr;
this.account = account;
}
public FileDataStorageManager(Account account, ContentProviderClient cp) {
mContentProviderClient = cp;
mContentResolver = null;
mAccount = account;
contentProviderClient = cp;
contentResolver = null;
this.account = account;
}
public void setAccount(Account account) {
mAccount = account;
}
public Account getAccount() {
return mAccount;
}
public ContentResolver getContentResolver() {
return mContentResolver;
}
public ContentProviderClient getContentProviderClient() {
return mContentProviderClient;
}
public OCFile getFileByPath(String path) {
Cursor c = getFileCursorForValue(ProviderTableMeta.FILE_PATH, path);
OCFile file = null;
@@ -119,7 +106,6 @@ public class FileDataStorageManager {
return file;
}
public @Nullable
OCFile getFileById(long id) {
Cursor c = getFileCursorForValue(ProviderTableMeta._ID, String.valueOf(id));
@@ -130,7 +116,7 @@ public class FileDataStorageManager {
c.close();
return file;
}
public OCFile getFileByLocalPath(String path) {
Cursor c = getFileCursorForValue(ProviderTableMeta.FILE_STORAGE_PATH, path);
OCFile file = null;
@@ -172,7 +158,7 @@ public class FileDataStorageManager {
public List<OCFile> getFolderImages(OCFile folder, boolean onlyOnDevice) {
List<OCFile> ret = new ArrayList<>();
if (folder != null) {
// TODO better implementation, filtering in the access to database instead of here
List<OCFile> tmp = getFolderContent(folder, onlyOnDevice);
@@ -205,30 +191,29 @@ public class FileDataStorageManager {
cv.put(ProviderTableMeta.FILE_IS_ENCRYPTED, file.isEncrypted());
cv.put(ProviderTableMeta.FILE_STORAGE_PATH, file.getStoragePath());
}
cv.put(ProviderTableMeta.FILE_ACCOUNT_OWNER, mAccount.name);
cv.put(ProviderTableMeta.FILE_ACCOUNT_OWNER, account.name);
cv.put(ProviderTableMeta.FILE_LAST_SYNC_DATE, file.getLastSyncDateForProperties());
cv.put(ProviderTableMeta.FILE_LAST_SYNC_DATE_FOR_DATA, file.getLastSyncDateForData());
cv.put(ProviderTableMeta.FILE_KEEP_IN_SYNC, file.isAvailableOffline() ? 1 : 0);
cv.put(ProviderTableMeta.FILE_ETAG, file.getEtag());
cv.put(ProviderTableMeta.FILE_ETAG_ON_SERVER, file.getEtagOnServer());
cv.put(ProviderTableMeta.FILE_SHARED_VIA_LINK, file.isSharedViaLink() ? 1 : 0);
cv.put(ProviderTableMeta.FILE_SHARED_WITH_SHAREE, file.isSharedWithSharee() ? 1 : 0);
cv.put(ProviderTableMeta.FILE_PUBLIC_LINK, file.getPublicLink());
cv.put(ProviderTableMeta.FILE_PERMISSIONS, file.getPermissions());
cv.put(ProviderTableMeta.FILE_REMOTE_ID, file.getRemoteId());
cv.put(ProviderTableMeta.FILE_UPDATE_THUMBNAIL, file.needsUpdateThumbnail());
cv.put(ProviderTableMeta.FILE_UPDATE_THUMBNAIL, file.isUpdateThumbnailNeeded());
cv.put(ProviderTableMeta.FILE_IS_DOWNLOADING, file.isDownloading());
cv.put(ProviderTableMeta.FILE_ETAG_IN_CONFLICT, file.getEtagInConflict());
cv.put(ProviderTableMeta.FILE_UNREAD_COMMENTS_COUNT, file.getUnreadCommentsCount());
boolean sameRemotePath = fileExists(file.getRemotePath());
if (sameRemotePath ||
fileExists(file.getFileId())) { // for renamed files; no more delete and create
OCFile oldFile;
if (sameRemotePath) {
oldFile = getFileByPath(file.getRemotePath());
OCFile oldFile = getFileByPath(file.getRemotePath());
file.setFileId(oldFile.getFileId());
} else {
oldFile = getFileById(file.getFileId());
}
overridden = true;
@@ -283,7 +268,7 @@ public class FileDataStorageManager {
OCFile returnFile;
if (parentFile == null) {
// remote request
ReadRemoteFileOperation operation = new ReadRemoteFileOperation(parentPath);
ReadFileRemoteOperation operation = new ReadFileRemoteOperation(parentPath);
RemoteOperationResult result = operation.execute(getAccount(), context);
if (result.isSuccess()) {
OCFile remoteFolder = FileStorageUtils.fillOCFile((RemoteFile) result.getData().get(0));
@@ -362,13 +347,13 @@ public class FileDataStorageManager {
String[] whereArgs;
for (OCFile file : filesToRemove) {
if (file.getParentId() == folder.getFileId()) {
whereArgs = new String[]{mAccount.name, file.getRemotePath()};
whereArgs = new String[]{account.name, file.getRemotePath()};
if (file.isFolder()) {
operations.add(ContentProviderOperation.newDelete(
ContentUris.withAppendedId(ProviderTableMeta.CONTENT_URI_DIR, file.getFileId()))
.withSelection(where, whereArgs).build());
File localFolder = new File(FileStorageUtils.getDefaultSavePathFor(mAccount.name, file));
File localFolder = new File(FileStorageUtils.getDefaultSavePathFor(account.name, file));
if (localFolder.exists()) {
removeLocalFolder(localFolder);
}
@@ -414,7 +399,7 @@ public class FileDataStorageManager {
if (results != null) {
long newId;
Iterator<OCFile> filesIt = updatedFiles.iterator();
OCFile file = null;
OCFile file;
for (ContentProviderResult result : results) {
if (filesIt.hasNext()) {
file = filesIt.next();
@@ -445,18 +430,20 @@ public class FileDataStorageManager {
cv.put(ProviderTableMeta.FILE_NAME, folder.getFileName());
cv.put(ProviderTableMeta.FILE_PARENT, folder.getParentId());
cv.put(ProviderTableMeta.FILE_PATH, folder.getRemotePath());
cv.put(ProviderTableMeta.FILE_ACCOUNT_OWNER, mAccount.name);
cv.put(ProviderTableMeta.FILE_ACCOUNT_OWNER, account.name);
cv.put(ProviderTableMeta.FILE_LAST_SYNC_DATE, folder.getLastSyncDateForProperties());
cv.put(ProviderTableMeta.FILE_LAST_SYNC_DATE_FOR_DATA, folder.getLastSyncDateForData());
cv.put(ProviderTableMeta.FILE_KEEP_IN_SYNC, folder.isAvailableOffline() ? 1 : 0);
cv.put(ProviderTableMeta.FILE_ETAG, folder.getEtag());
cv.put(ProviderTableMeta.FILE_ETAG_ON_SERVER, folder.getEtagOnServer());
cv.put(ProviderTableMeta.FILE_SHARED_VIA_LINK, folder.isSharedViaLink() ? 1 : 0);
cv.put(ProviderTableMeta.FILE_SHARED_WITH_SHAREE, folder.isSharedWithSharee() ? 1 : 0);
cv.put(ProviderTableMeta.FILE_PUBLIC_LINK, folder.getPublicLink());
cv.put(ProviderTableMeta.FILE_PERMISSIONS, folder.getPermissions());
cv.put(ProviderTableMeta.FILE_REMOTE_ID, folder.getRemoteId());
cv.put(ProviderTableMeta.FILE_FAVORITE, folder.getIsFavorite());
cv.put(ProviderTableMeta.FILE_FAVORITE, folder.isFavorite());
cv.put(ProviderTableMeta.FILE_IS_ENCRYPTED, folder.isEncrypted());
cv.put(ProviderTableMeta.FILE_UNREAD_COMMENTS_COUNT, folder.getUnreadCommentsCount());
return cv;
}
@@ -474,22 +461,25 @@ public class FileDataStorageManager {
if (!file.isFolder()) {
cv.put(ProviderTableMeta.FILE_STORAGE_PATH, file.getStoragePath());
}
cv.put(ProviderTableMeta.FILE_ACCOUNT_OWNER, mAccount.name);
cv.put(ProviderTableMeta.FILE_ACCOUNT_OWNER, account.name);
cv.put(ProviderTableMeta.FILE_LAST_SYNC_DATE, file.getLastSyncDateForProperties());
cv.put(ProviderTableMeta.FILE_LAST_SYNC_DATE_FOR_DATA, file.getLastSyncDateForData());
cv.put(ProviderTableMeta.FILE_KEEP_IN_SYNC, file.isAvailableOffline() ? 1 : 0);
cv.put(ProviderTableMeta.FILE_ETAG, file.getEtag());
cv.put(ProviderTableMeta.FILE_ETAG_ON_SERVER, file.getEtagOnServer());
cv.put(ProviderTableMeta.FILE_SHARED_VIA_LINK, file.isSharedViaLink() ? 1 : 0);
cv.put(ProviderTableMeta.FILE_SHARED_WITH_SHAREE, file.isSharedWithSharee() ? 1 : 0);
cv.put(ProviderTableMeta.FILE_PUBLIC_LINK, file.getPublicLink());
cv.put(ProviderTableMeta.FILE_PERMISSIONS, file.getPermissions());
cv.put(ProviderTableMeta.FILE_REMOTE_ID, file.getRemoteId());
cv.put(ProviderTableMeta.FILE_UPDATE_THUMBNAIL, file.needsUpdateThumbnail());
cv.put(ProviderTableMeta.FILE_UPDATE_THUMBNAIL, file.isUpdateThumbnailNeeded());
cv.put(ProviderTableMeta.FILE_IS_DOWNLOADING, file.isDownloading());
cv.put(ProviderTableMeta.FILE_ETAG_IN_CONFLICT, file.getEtagInConflict());
cv.put(ProviderTableMeta.FILE_FAVORITE, file.getIsFavorite());
cv.put(ProviderTableMeta.FILE_FAVORITE, file.isFavorite());
cv.put(ProviderTableMeta.FILE_IS_ENCRYPTED, file.isEncrypted());
cv.put(ProviderTableMeta.FILE_MOUNT_TYPE, file.getMountType().ordinal());
cv.put(ProviderTableMeta.FILE_HAS_PREVIEW, file.isPreviewAvailable() ? 1 : 0);
cv.put(ProviderTableMeta.FILE_UNREAD_COMMENTS_COUNT, file.getUnreadCommentsCount());
return cv;
}
@@ -505,7 +495,7 @@ public class FileDataStorageManager {
// ""+file.getFileId());
Uri file_uri = ContentUris.withAppendedId(ProviderTableMeta.CONTENT_URI_FILE, file.getFileId());
String where = ProviderTableMeta.FILE_ACCOUNT_OWNER + AND + ProviderTableMeta.FILE_PATH + "=?";
String[] whereArgs = new String[]{mAccount.name, file.getRemotePath()};
String[] whereArgs = new String[]{account.name, file.getRemotePath()};
int deleted = 0;
if (getContentProviderClient() != null) {
try {
@@ -557,10 +547,10 @@ public class FileDataStorageManager {
}
private boolean removeFolderInDb(OCFile folder) {
Uri folder_uri = Uri.withAppendedPath(ProviderTableMeta.CONTENT_URI_DIR, "" + folder.getFileId()); // URI
Uri folder_uri = Uri.withAppendedPath(ProviderTableMeta.CONTENT_URI_DIR, String.valueOf(folder.getFileId())); // URI
// for recursive deletion
String where = ProviderTableMeta.FILE_ACCOUNT_OWNER + AND + ProviderTableMeta.FILE_PATH + "=?";
String[] whereArgs = new String[]{mAccount.name, folder.getRemotePath()};
String[] whereArgs = new String[]{account.name, folder.getRemotePath()};
int deleted = 0;
if (getContentProviderClient() != null) {
try {
@@ -576,7 +566,7 @@ public class FileDataStorageManager {
private boolean removeLocalFolder(OCFile folder) {
boolean success = true;
String localFolderPath = FileStorageUtils.getDefaultSavePathFor(mAccount.name, folder);
String localFolderPath = FileStorageUtils.getDefaultSavePathFor(account.name, folder);
File localFolder = new File(localFolderPath);
if (localFolder.exists()) {
// stage 1: remove the local files already registered in the files database
@@ -600,7 +590,7 @@ public class FileDataStorageManager {
}
}
// stage 2: remove the folder itself and any local file inside out of sync;
// stage 2: remove the folder itself and any local file inside out of sync;
// for instance, after clearing the app cache or reinstalling
success &= removeLocalFolder(localFolder);
}
@@ -646,7 +636,7 @@ public class FileDataStorageManager {
ProviderTableMeta.CONTENT_URI,
null,
ProviderTableMeta.FILE_ACCOUNT_OWNER + AND + ProviderTableMeta.FILE_PATH + " LIKE ? ",
new String[]{mAccount.name, file.getRemotePath() + "%"},
new String[]{account.name, file.getRemotePath() + "%"},
ProviderTableMeta.FILE_PATH + " ASC "
);
} catch (RemoteException e) {
@@ -658,16 +648,16 @@ public class FileDataStorageManager {
ProviderTableMeta.CONTENT_URI,
null,
ProviderTableMeta.FILE_ACCOUNT_OWNER + AND + ProviderTableMeta.FILE_PATH + " LIKE ? ",
new String[]{mAccount.name, file.getRemotePath() + "%"},
new String[]{account.name, file.getRemotePath() + "%"},
ProviderTableMeta.FILE_PATH + " ASC "
);
}
/// 2. prepare a batch of update operations to change all the descendants
ArrayList<ContentProviderOperation> operations = new ArrayList<>(c.getCount());
String defaultSavePath = FileStorageUtils.getSavePath(mAccount.name);
List<String> originalPathsToTriggerMediaScan = new ArrayList<String>();
List<String> newPathsToTriggerMediaScan = new ArrayList<String>();
String defaultSavePath = FileStorageUtils.getSavePath(account.name);
List<String> originalPathsToTriggerMediaScan = new ArrayList<>();
List<String> newPathsToTriggerMediaScan = new ArrayList<>();
if (c.moveToFirst()) {
int lengthOfOldPath = file.getRemotePath().length();
int lengthOfOldStoragePath = defaultSavePath.length() + lengthOfOldPath;
@@ -717,8 +707,8 @@ public class FileDataStorageManager {
Log_OC.e(TAG, "Fail to update " + file.getFileId() + " and descendants in database", e);
}
/// 4. move in local file system
String originalLocalPath = FileStorageUtils.getDefaultSavePathFor(mAccount.name, file);
/// 4. move in local file system
String originalLocalPath = FileStorageUtils.getDefaultSavePathFor(account.name, file);
String targetLocalPath = defaultSavePath + targetPath;
File localFile = new File(originalLocalPath);
boolean renamed = false;
@@ -750,10 +740,10 @@ public class FileDataStorageManager {
public void copyLocalFile(OCFile file, String targetPath) {
if (file != null && file.fileExists() && !OCFile.ROOT_PATH.equals(file.getFileName())) {
String localPath = FileStorageUtils.getDefaultSavePathFor(mAccount.name, file);
String localPath = FileStorageUtils.getDefaultSavePathFor(account.name, file);
File localFile = new File(localPath);
boolean copied = false;
String defaultSavePath = FileStorageUtils.getSavePath(mAccount.name);
String defaultSavePath = FileStorageUtils.getSavePath(account.name);
if (localFile.exists()) {
File targetFile = new File(defaultSavePath + targetPath);
File targetFolder = targetFile.getParentFile();
@@ -859,7 +849,7 @@ public class FileDataStorageManager {
}
} while (c.moveToNext());
}
c.close();
}
@@ -869,7 +859,7 @@ public class FileDataStorageManager {
private OCFile createRootDir() {
OCFile file = new OCFile(OCFile.ROOT_PATH);
file.setMimetype(MimeType.DIRECTORY);
file.setMimeType(MimeType.DIRECTORY);
file.setParentId(FileDataStorageManager.ROOT_PARENT_ID);
saveFile(file);
return file;
@@ -884,7 +874,7 @@ public class FileDataStorageManager {
cmp_key + AND
+ ProviderTableMeta.FILE_ACCOUNT_OWNER
+ "=?",
new String[]{value, mAccount.name}, null);
new String[]{value, account.name}, null);
} else {
try {
c = getContentProviderClient().query(
@@ -892,7 +882,7 @@ public class FileDataStorageManager {
null,
cmp_key + AND
+ ProviderTableMeta.FILE_ACCOUNT_OWNER + "=?",
new String[]{value, mAccount.name}, null);
new String[]{value, account.name}, null);
} catch (RemoteException e) {
Log_OC.e(TAG, "Couldn't determine file existance, assuming non existance: " + e.getMessage(), e);
return false;
@@ -904,7 +894,7 @@ public class FileDataStorageManager {
}
private Cursor getFileCursorForValue(String key, String value) {
Cursor c = null;
Cursor c;
if (getContentResolver() != null) {
c = getContentResolver()
.query(ProviderTableMeta.CONTENT_URI,
@@ -912,14 +902,14 @@ public class FileDataStorageManager {
key + AND
+ ProviderTableMeta.FILE_ACCOUNT_OWNER
+ "=?",
new String[]{value, mAccount.name}, null);
new String[]{value, account.name}, null);
} else {
try {
c = getContentProviderClient().query(
ProviderTableMeta.CONTENT_URI,
null,
key + AND + ProviderTableMeta.FILE_ACCOUNT_OWNER
+ "=?", new String[]{value, mAccount.name},
+ "=?", new String[]{value, account.name},
null);
} catch (RemoteException e) {
Log_OC.e(TAG, "Could not get file details: " + e.getMessage(), e);
@@ -947,13 +937,13 @@ public class FileDataStorageManager {
file.setFileId(c.getLong(c.getColumnIndex(ProviderTableMeta._ID)));
file.setParentId(c.getLong(c.getColumnIndex(ProviderTableMeta.FILE_PARENT)));
file.setEncryptedFileName(c.getString(c.getColumnIndex(ProviderTableMeta.FILE_ENCRYPTED_NAME)));
file.setMimetype(c.getString(c.getColumnIndex(ProviderTableMeta.FILE_CONTENT_TYPE)));
file.setMimeType(c.getString(c.getColumnIndex(ProviderTableMeta.FILE_CONTENT_TYPE)));
file.setStoragePath(c.getString(c.getColumnIndex(ProviderTableMeta.FILE_STORAGE_PATH)));
if (file.getStoragePath() == null) {
// try to find existing file and bind it with current account;
// with the current update of SynchronizeFolderOperation, this won't be
// necessary anymore after a full synchronization of the account
File f = new File(FileStorageUtils.getDefaultSavePathFor(mAccount.name, file));
File f = new File(FileStorageUtils.getDefaultSavePathFor(account.name, file));
if (f.exists()) {
file.setStoragePath(f.getAbsolutePath());
file.setLastSyncDateForData(f.lastModified());
@@ -966,14 +956,14 @@ public class FileDataStorageManager {
c.getColumnIndex(ProviderTableMeta.FILE_MODIFIED_AT_LAST_SYNC_FOR_DATA)));
file.setLastSyncDateForProperties(c.getLong(c.getColumnIndex(ProviderTableMeta.FILE_LAST_SYNC_DATE)));
file.setLastSyncDateForData(c.getLong(c.getColumnIndex(ProviderTableMeta.FILE_LAST_SYNC_DATE_FOR_DATA)));
file.setAvailableOffline(c.getInt(c.getColumnIndex(ProviderTableMeta.FILE_KEEP_IN_SYNC)) == 1);
file.setEtag(c.getString(c.getColumnIndex(ProviderTableMeta.FILE_ETAG)));
file.setShareViaLink(c.getInt(c.getColumnIndex(ProviderTableMeta.FILE_SHARED_VIA_LINK)) == 1);
file.setShareWithSharee(c.getInt(c.getColumnIndex(ProviderTableMeta.FILE_SHARED_WITH_SHAREE)) == 1);
file.setEtagOnServer(c.getString(c.getColumnIndex(ProviderTableMeta.FILE_ETAG_ON_SERVER)));
file.setSharedViaLink(c.getInt(c.getColumnIndex(ProviderTableMeta.FILE_SHARED_VIA_LINK)) == 1);
file.setSharedWithSharee(c.getInt(c.getColumnIndex(ProviderTableMeta.FILE_SHARED_WITH_SHAREE)) == 1);
file.setPublicLink(c.getString(c.getColumnIndex(ProviderTableMeta.FILE_PUBLIC_LINK)));
file.setPermissions(c.getString(c.getColumnIndex(ProviderTableMeta.FILE_PERMISSIONS)));
file.setRemoteId(c.getString(c.getColumnIndex(ProviderTableMeta.FILE_REMOTE_ID)));
file.setNeedsUpdateThumbnail(c.getInt(c.getColumnIndex(ProviderTableMeta.FILE_UPDATE_THUMBNAIL)) == 1);
file.setUpdateThumbnailNeeded(c.getInt(c.getColumnIndex(ProviderTableMeta.FILE_UPDATE_THUMBNAIL)) == 1);
file.setDownloading(c.getInt(c.getColumnIndex(ProviderTableMeta.FILE_IS_DOWNLOADING)) == 1);
file.setEtagInConflict(c.getString(c.getColumnIndex(ProviderTableMeta.FILE_ETAG_IN_CONFLICT)));
file.setFavorite(c.getInt(c.getColumnIndex(ProviderTableMeta.FILE_FAVORITE)) == 1);
@@ -983,7 +973,10 @@ public class FileDataStorageManager {
}
file.setMountType(WebdavEntry.MountType.values()[c.getInt(
c.getColumnIndex(ProviderTableMeta.FILE_MOUNT_TYPE))]);
file.setPreviewAvailable(c.getInt(c.getColumnIndex(ProviderTableMeta.FILE_HAS_PREVIEW)) == 1);
file.setUnreadCommentsCount(c.getInt(c.getColumnIndex(ProviderTableMeta.FILE_UNREAD_COMMENTS_COUNT)));
}
return file;
}
@@ -1000,16 +993,14 @@ public class FileDataStorageManager {
cv.put(ProviderTableMeta.OCSHARES_SHARED_DATE, share.getSharedDate());
cv.put(ProviderTableMeta.OCSHARES_EXPIRATION_DATE, share.getExpirationDate());
cv.put(ProviderTableMeta.OCSHARES_TOKEN, share.getToken());
cv.put(
ProviderTableMeta.OCSHARES_SHARE_WITH_DISPLAY_NAME,
share.getSharedWithDisplayName()
);
cv.put(ProviderTableMeta.OCSHARES_SHARE_WITH_DISPLAY_NAME, share.getSharedWithDisplayName());
cv.put(ProviderTableMeta.OCSHARES_IS_DIRECTORY, share.isFolder() ? 1 : 0);
cv.put(ProviderTableMeta.OCSHARES_USER_ID, share.getUserId());
cv.put(ProviderTableMeta.OCSHARES_ID_REMOTE_SHARED, share.getRemoteId());
cv.put(ProviderTableMeta.OCSHARES_ACCOUNT_OWNER, mAccount.name);
cv.put(ProviderTableMeta.OCSHARES_ACCOUNT_OWNER, account.name);
cv.put(ProviderTableMeta.OCSHARES_IS_PASSWORD_PROTECTED, share.isPasswordProtected() ? 1 : 0);
cv.put(ProviderTableMeta.OCSHARES_NOTE, share.getNote());
cv.put(ProviderTableMeta.OCSHARES_HIDE_DOWNLOAD, share.isHideFileDownload());
if (shareExistsForRemoteId(share.getRemoteId())) {// for renamed files; no more delete and create
overriden = true;
@@ -1109,7 +1100,7 @@ public class FileDataStorageManager {
null,
key + AND
+ ProviderTableMeta.OCSHARES_ACCOUNT_OWNER + "=?",
new String[]{value, mAccount.name},
new String[]{value, account.name},
null
);
} else {
@@ -1118,7 +1109,7 @@ public class FileDataStorageManager {
ProviderTableMeta.CONTENT_URI_SHARE,
null,
key + AND + ProviderTableMeta.OCSHARES_ACCOUNT_OWNER + "=?",
new String[]{value, mAccount.name},
new String[]{value, account.name},
null
);
} catch (RemoteException e) {
@@ -1139,7 +1130,7 @@ public class FileDataStorageManager {
* @return First {@link OCShare} instance found in DB bound to the file in 'path'
*/
public OCShare getFirstShareByPathAndType(String path, ShareType type, String shareWith) {
Cursor cursor = null;
Cursor cursor;
if (shareWith == null) {
shareWith = "";
}
@@ -1156,13 +1147,13 @@ public class FileDataStorageManager {
selectionArgs = new String[]{
path,
Integer.toString(type.getValue()),
mAccount.name
account.name
};
} else {
selectionArgs = new String[]{
path,
Integer.toString(type.getValue()),
mAccount.name,
account.name,
shareWith
};
}
@@ -1215,6 +1206,8 @@ public class FileDataStorageManager {
share.setUserId(c.getLong(c.getColumnIndex(ProviderTableMeta.OCSHARES_USER_ID)));
share.setIdRemoteShared(c.getLong(c.getColumnIndex(ProviderTableMeta.OCSHARES_ID_REMOTE_SHARED)));
share.setIsPasswordProtected(c.getInt(c.getColumnIndex(ProviderTableMeta.OCSHARES_IS_PASSWORD_PROTECTED)) == 1);
share.setNote(c.getString(c.getColumnIndex(ProviderTableMeta.OCSHARES_NOTE)));
share.setHideFileDownload(c.getInt(c.getColumnIndex(ProviderTableMeta.OCSHARES_HIDE_DOWNLOAD)) == 1);
}
return share;
}
@@ -1225,7 +1218,7 @@ public class FileDataStorageManager {
cv.put(ProviderTableMeta.FILE_SHARED_WITH_SHAREE, false);
cv.put(ProviderTableMeta.FILE_PUBLIC_LINK, "");
String where = ProviderTableMeta.FILE_ACCOUNT_OWNER + "=?";
String[] whereArgs = new String[]{mAccount.name};
String[] whereArgs = new String[]{account.name};
if (getContentResolver() != null) {
getContentResolver().update(ProviderTableMeta.CONTENT_URI, cv, where, whereArgs);
@@ -1245,7 +1238,7 @@ public class FileDataStorageManager {
cv.put(ProviderTableMeta.FILE_SHARED_WITH_SHAREE, false);
cv.put(ProviderTableMeta.FILE_PUBLIC_LINK, "");
String where = ProviderTableMeta.FILE_ACCOUNT_OWNER + AND + ProviderTableMeta.FILE_PARENT + "=?";
String[] whereArgs = new String[]{mAccount.name, String.valueOf(folder.getFileId())};
String[] whereArgs = new String[]{account.name, String.valueOf(folder.getFileId())};
if (getContentResolver() != null) {
getContentResolver().update(ProviderTableMeta.CONTENT_URI, cv, where, whereArgs);
@@ -1265,7 +1258,7 @@ public class FileDataStorageManager {
cv.put(ProviderTableMeta.FILE_SHARED_WITH_SHAREE, false);
cv.put(ProviderTableMeta.FILE_PUBLIC_LINK, "");
String where = ProviderTableMeta.FILE_ACCOUNT_OWNER + AND + ProviderTableMeta.FILE_PATH + "=?";
String[] whereArgs = new String[]{mAccount.name, filePath};
String[] whereArgs = new String[]{account.name, filePath};
if (getContentResolver() != null) {
getContentResolver().update(ProviderTableMeta.CONTENT_URI, cv, where, whereArgs);
@@ -1281,7 +1274,7 @@ public class FileDataStorageManager {
private void cleanShares() {
String where = ProviderTableMeta.OCSHARES_ACCOUNT_OWNER + "=?";
String[] whereArgs = new String[]{mAccount.name};
String[] whereArgs = new String[]{account.name};
if (getContentResolver() != null) {
getContentResolver().delete(ProviderTableMeta.CONTENT_URI_SHARE, where, whereArgs);
@@ -1313,16 +1306,14 @@ public class FileDataStorageManager {
cv.put(ProviderTableMeta.OCSHARES_SHARED_DATE, share.getSharedDate());
cv.put(ProviderTableMeta.OCSHARES_EXPIRATION_DATE, share.getExpirationDate());
cv.put(ProviderTableMeta.OCSHARES_TOKEN, share.getToken());
cv.put(
ProviderTableMeta.OCSHARES_SHARE_WITH_DISPLAY_NAME,
share.getSharedWithDisplayName()
);
cv.put(ProviderTableMeta.OCSHARES_SHARE_WITH_DISPLAY_NAME, share.getSharedWithDisplayName());
cv.put(ProviderTableMeta.OCSHARES_IS_DIRECTORY, share.isFolder() ? 1 : 0);
cv.put(ProviderTableMeta.OCSHARES_USER_ID, share.getUserId());
cv.put(ProviderTableMeta.OCSHARES_ID_REMOTE_SHARED, share.getRemoteId());
cv.put(ProviderTableMeta.OCSHARES_ACCOUNT_OWNER, mAccount.name);
cv.put(ProviderTableMeta.OCSHARES_ACCOUNT_OWNER, account.name);
cv.put(ProviderTableMeta.OCSHARES_IS_PASSWORD_PROTECTED, share.isPasswordProtected() ? 1 : 0);
cv.put(ProviderTableMeta.OCSHARES_NOTE, share.getNote());
cv.put(ProviderTableMeta.OCSHARES_HIDE_DOWNLOAD, share.isHideFileDownload());
if (shareExistsForRemoteId(share.getRemoteId())) {
// updating an existing file
@@ -1386,28 +1377,22 @@ public class FileDataStorageManager {
if (!file.isFolder()) {
cv.put(ProviderTableMeta.FILE_STORAGE_PATH, file.getStoragePath());
}
cv.put(ProviderTableMeta.FILE_ACCOUNT_OWNER, mAccount.name);
cv.put(ProviderTableMeta.FILE_ACCOUNT_OWNER, account.name);
cv.put(ProviderTableMeta.FILE_LAST_SYNC_DATE, file.getLastSyncDateForProperties());
cv.put(
ProviderTableMeta.FILE_LAST_SYNC_DATE_FOR_DATA,
file.getLastSyncDateForData()
);
cv.put(ProviderTableMeta.FILE_KEEP_IN_SYNC, file.isAvailableOffline() ? 1 : 0);
cv.put(ProviderTableMeta.FILE_ETAG, file.getEtag());
cv.put(ProviderTableMeta.FILE_ETAG_ON_SERVER, file.getEtagOnServer());
cv.put(ProviderTableMeta.FILE_SHARED_VIA_LINK, file.isSharedViaLink() ? 1 : 0);
cv.put(ProviderTableMeta.FILE_SHARED_WITH_SHAREE, file.isSharedWithSharee() ? 1 : 0);
cv.put(ProviderTableMeta.FILE_PUBLIC_LINK, file.getPublicLink());
cv.put(ProviderTableMeta.FILE_PERMISSIONS, file.getPermissions());
cv.put(ProviderTableMeta.FILE_REMOTE_ID, file.getRemoteId());
cv.put(ProviderTableMeta.FILE_FAVORITE, file.getIsFavorite());
cv.put(
ProviderTableMeta.FILE_UPDATE_THUMBNAIL,
file.needsUpdateThumbnail() ? 1 : 0
);
cv.put(
ProviderTableMeta.FILE_IS_DOWNLOADING,
file.isDownloading() ? 1 : 0
);
cv.put(ProviderTableMeta.FILE_FAVORITE, file.isFavorite());
cv.put(ProviderTableMeta.FILE_UPDATE_THUMBNAIL, file.isUpdateThumbnailNeeded() ? 1 : 0);
cv.put(ProviderTableMeta.FILE_IS_DOWNLOADING, file.isDownloading() ? 1 : 0);
cv.put(ProviderTableMeta.FILE_ETAG_IN_CONFLICT, file.getEtagInConflict());
boolean existsByPath = fileExists(file.getRemotePath());
@@ -1454,7 +1439,7 @@ public class FileDataStorageManager {
Uri share_uri = ProviderTableMeta.CONTENT_URI_SHARE;
String where = ProviderTableMeta.OCSHARES_ACCOUNT_OWNER + AND +
ProviderTableMeta._ID + "=?";
String[] whereArgs = new String[]{mAccount.name, Long.toString(share.getId())};
String[] whereArgs = new String[]{account.name, Long.toString(share.getId())};
if (getContentProviderClient() != null) {
try {
getContentProviderClient().delete(share_uri, where, whereArgs);
@@ -1525,7 +1510,7 @@ public class FileDataStorageManager {
public void removeSharesForFile(String remotePath) {
resetShareFlagInAFile(remotePath);
ArrayList<ContentProviderOperation> operations = new ArrayList<ContentProviderOperation>();
ArrayList<ContentProviderOperation> operations = new ArrayList<>();
operations = prepareRemoveSharesInFile(remotePath, operations);
// apply operations in batch
if (operations.size() > 0) {
@@ -1547,7 +1532,7 @@ public class FileDataStorageManager {
public void saveSharesInFolder(ArrayList<OCShare> shares, OCFile folder) {
resetShareFlagsInFolder(folder);
ArrayList<ContentProviderOperation> operations = new ArrayList<ContentProviderOperation>();
ArrayList<ContentProviderOperation> operations = new ArrayList<>();
operations = prepareRemoveSharesInFolder(folder, operations);
if (shares != null) {
@@ -1596,23 +1581,18 @@ public class FileDataStorageManager {
cv.put(ProviderTableMeta.OCSHARES_SHARED_DATE, share.getSharedDate());
cv.put(ProviderTableMeta.OCSHARES_EXPIRATION_DATE, share.getExpirationDate());
cv.put(ProviderTableMeta.OCSHARES_TOKEN, share.getToken());
cv.put(
ProviderTableMeta.OCSHARES_SHARE_WITH_DISPLAY_NAME,
share.getSharedWithDisplayName()
);
cv.put(ProviderTableMeta.OCSHARES_SHARE_WITH_DISPLAY_NAME, share.getSharedWithDisplayName());
cv.put(ProviderTableMeta.OCSHARES_IS_DIRECTORY, share.isFolder() ? 1 : 0);
cv.put(ProviderTableMeta.OCSHARES_USER_ID, share.getUserId());
cv.put(ProviderTableMeta.OCSHARES_ID_REMOTE_SHARED, share.getRemoteId());
cv.put(ProviderTableMeta.OCSHARES_ACCOUNT_OWNER, mAccount.name);
cv.put(ProviderTableMeta.OCSHARES_ACCOUNT_OWNER, account.name);
cv.put(ProviderTableMeta.OCSHARES_IS_PASSWORD_PROTECTED, share.isPasswordProtected() ? 1 : 0);
cv.put(ProviderTableMeta.OCSHARES_NOTE, share.getNote());
cv.put(ProviderTableMeta.OCSHARES_HIDE_DOWNLOAD, share.isHideFileDownload());
// adding a new share resource
operations.add(
ContentProviderOperation.newInsert(ProviderTableMeta.CONTENT_URI_SHARE).
withValues(cv).
build()
);
operations.add(ContentProviderOperation.newInsert(
ProviderTableMeta.CONTENT_URI_SHARE).withValues(cv).build());
}
}
return operations;
@@ -1623,7 +1603,7 @@ public class FileDataStorageManager {
if (folder != null) {
String where = ProviderTableMeta.OCSHARES_PATH + AND
+ ProviderTableMeta.OCSHARES_ACCOUNT_OWNER + "=?";
String[] whereArgs = new String[]{"", mAccount.name};
String[] whereArgs = new String[]{"", account.name};
List<OCFile> files = getFolderContent(folder, false);
@@ -1645,7 +1625,7 @@ public class FileDataStorageManager {
String where = ProviderTableMeta.OCSHARES_PATH + AND
+ ProviderTableMeta.OCSHARES_ACCOUNT_OWNER + "=?";
String[] whereArgs = new String[]{filePath, mAccount.name};
String[] whereArgs = new String[]{filePath, account.name};
preparedOperations.add(
ContentProviderOperation.newDelete(ProviderTableMeta.CONTENT_URI_SHARE).
@@ -1664,31 +1644,30 @@ public class FileDataStorageManager {
+ " (" + ProviderTableMeta.OCSHARES_SHARE_TYPE + "=? OR "
+ ProviderTableMeta.OCSHARES_SHARE_TYPE + "=? OR "
+ ProviderTableMeta.OCSHARES_SHARE_TYPE + "=? OR "
+ ProviderTableMeta.OCSHARES_SHARE_TYPE + "=? OR "
+ ProviderTableMeta.OCSHARES_SHARE_TYPE + "=? ) ";
String[] whereArgs = new String[]{filePath, accountName,
Integer.toString(ShareType.USER.getValue()),
Integer.toString(ShareType.GROUP.getValue()),
Integer.toString(ShareType.EMAIL.getValue()),
Integer.toString(ShareType.FEDERATED.getValue())};
Integer.toString(ShareType.FEDERATED.getValue()),
Integer.toString(ShareType.ROOM.getValue())};
Cursor cursor = null;
if (getContentResolver() != null) {
cursor = getContentResolver().query(
ProviderTableMeta.CONTENT_URI_SHARE,
null, where, whereArgs, null);
cursor = getContentResolver().query(ProviderTableMeta.CONTENT_URI_SHARE, null, where, whereArgs, null);
} else {
try {
cursor = getContentProviderClient().query(
ProviderTableMeta.CONTENT_URI_SHARE,
null, where, whereArgs, null);
cursor = getContentProviderClient().query(ProviderTableMeta.CONTENT_URI_SHARE, null, where,
whereArgs, null);
} catch (RemoteException e) {
Log_OC.e(TAG, "Could not get list of shares with: " + e.getMessage(), e);
cursor = null;
}
}
ArrayList<OCShare> shares = new ArrayList<OCShare>();
OCShare share = null;
ArrayList<OCShare> shares = new ArrayList<>();
OCShare share;
if (cursor != null) {
if (cursor.moveToFirst()) {
do {
@@ -1844,7 +1823,7 @@ public class FileDataStorageManager {
ProviderTableMeta.CONTENT_URI_FILE,
new String[]{ProviderTableMeta._ID},
whereForDescencentsInConflict,
new String[]{mAccount.name, parentPath + "%"},
new String[]{account.name, parentPath + "%"},
null
);
} else {
@@ -1853,7 +1832,7 @@ public class FileDataStorageManager {
ProviderTableMeta.CONTENT_URI_FILE,
new String[]{ProviderTableMeta._ID},
whereForDescencentsInConflict,
new String[]{mAccount.name, parentPath + "%"},
new String[]{account.name, parentPath + "%"},
null
);
} catch (RemoteException e) {
@@ -1868,7 +1847,7 @@ public class FileDataStorageManager {
cv,
ProviderTableMeta.FILE_ACCOUNT_OWNER + AND +
ProviderTableMeta.FILE_PATH + "=?",
new String[]{mAccount.name, parentPath}
new String[]{account.name, parentPath}
);
} else {
try {
@@ -1877,7 +1856,7 @@ public class FileDataStorageManager {
cv,
ProviderTableMeta.FILE_ACCOUNT_OWNER + AND +
ProviderTableMeta.FILE_PATH + "=?"
, new String[]{mAccount.name, parentPath}
, new String[]{account.name, parentPath}
);
} catch (RemoteException e) {
Log_OC.e(TAG, "Failed saving conflict in database " + e.getMessage(), e);
@@ -1905,13 +1884,13 @@ public class FileDataStorageManager {
// Prepare capabilities data
ContentValues cv = new ContentValues();
cv.put(ProviderTableMeta.CAPABILITIES_ACCOUNT_NAME, mAccount.name);
cv.put(ProviderTableMeta.CAPABILITIES_ACCOUNT_NAME, account.name);
cv.put(ProviderTableMeta.CAPABILITIES_VERSION_MAYOR, capability.getVersionMayor());
cv.put(ProviderTableMeta.CAPABILITIES_VERSION_MINOR, capability.getVersionMinor());
cv.put(ProviderTableMeta.CAPABILITIES_VERSION_MICRO, capability.getVersionMicro());
cv.put(ProviderTableMeta.CAPABILITIES_VERSION_STRING, capability.getVersionString());
cv.put(ProviderTableMeta.CAPABILITIES_VERSION_EDITION, capability.getVersionEdition());
cv.put(ProviderTableMeta.CAPABILITIES_CORE_POLLINTERVAL, capability.getCorePollinterval());
cv.put(ProviderTableMeta.CAPABILITIES_CORE_POLLINTERVAL, capability.getCorePollInterval());
cv.put(ProviderTableMeta.CAPABILITIES_SHARING_API_ENABLED, capability.getFilesSharingApiEnabled().getValue());
cv.put(ProviderTableMeta.CAPABILITIES_SHARING_PUBLIC_ENABLED,
capability.getFilesSharingPublicEnabled().getValue());
@@ -1951,17 +1930,24 @@ public class FileDataStorageManager {
cv.put(ProviderTableMeta.CAPABILITIES_SERVER_BACKGROUND_PLAIN, capability.getServerBackgroundPlain()
.getValue());
cv.put(ProviderTableMeta.CAPABILITIES_ACTIVITY, capability.isActivityEnabled().getValue());
cv.put(ProviderTableMeta.CAPABILITIES_RICHDOCUMENT, capability.getRichDocuments().getValue());
cv.put(ProviderTableMeta.CAPABILITIES_RICHDOCUMENT_MIMETYPE_LIST,
TextUtils.join(",", capability.getRichDocumentsMimeTypeList()));
cv.put(ProviderTableMeta.CAPABILITIES_RICHDOCUMENT_DIRECT_EDITING, capability.getRichDocumentsDirectEditing()
.getValue());
cv.put(ProviderTableMeta.CAPABILITIES_RICHDOCUMENT_TEMPLATES, capability.getRichdocumentsTemplatesAvailable()
.getValue());
if (capabilityExists(mAccount.name)) {
if (capabilityExists(account.name)) {
if (getContentResolver() != null) {
getContentResolver().update(ProviderTableMeta.CONTENT_URI_CAPABILITIES, cv,
ProviderTableMeta.CAPABILITIES_ACCOUNT_NAME + "=?",
new String[]{mAccount.name});
new String[]{account.name});
} else {
try {
getContentProviderClient().update(ProviderTableMeta.CONTENT_URI_CAPABILITIES,
cv, ProviderTableMeta.CAPABILITIES_ACCOUNT_NAME + "=?",
new String[]{mAccount.name});
new String[]{account.name});
} catch (RemoteException e) {
Log_OC.e(TAG, FAILED_TO_INSERT_MSG + e.getMessage(), e);
}
@@ -1983,7 +1969,7 @@ public class FileDataStorageManager {
long new_id = Long.parseLong(result_uri.getPathSegments()
.get(1));
capability.setId(new_id);
capability.setAccountName(mAccount.name);
capability.setAccountName(account.name);
}
}
@@ -2024,7 +2010,7 @@ public class FileDataStorageManager {
}
public OCCapability getCapability(String accountName) {
OCCapability capability = null;
OCCapability capability;
Cursor c = getCapabilityCursorForAccount(accountName);
if (c.moveToFirst()) {
@@ -2053,7 +2039,7 @@ public class FileDataStorageManager {
.getColumnIndex(ProviderTableMeta.CAPABILITIES_VERSION_STRING)));
capability.setVersionEdition(c.getString(c
.getColumnIndex(ProviderTableMeta.CAPABILITIES_VERSION_EDITION)));
capability.setCorePollinterval(c.getInt(c
capability.setCorePollInterval(c.getInt(c
.getColumnIndex(ProviderTableMeta.CAPABILITIES_CORE_POLLINTERVAL)));
capability.setFilesSharingApiEnabled(CapabilityBooleanType.fromValue(c.getInt(c
.getColumnIndex(ProviderTableMeta.CAPABILITIES_SHARING_API_ENABLED))));
@@ -2106,6 +2092,17 @@ public class FileDataStorageManager {
c.getInt(c.getColumnIndex(ProviderTableMeta.CAPABILITIES_SERVER_BACKGROUND_PLAIN))));
capability.setActivity(CapabilityBooleanType.fromValue(
c.getInt(c.getColumnIndex(ProviderTableMeta.CAPABILITIES_ACTIVITY))));
capability.setRichDocuments(CapabilityBooleanType.fromValue(c.getInt(
c.getColumnIndex(ProviderTableMeta.CAPABILITIES_RICHDOCUMENT))));
capability.setRichDocumentsDirectEditing(CapabilityBooleanType.fromValue(c.getInt(
c.getColumnIndex(ProviderTableMeta.CAPABILITIES_RICHDOCUMENT_DIRECT_EDITING))));
capability.setRichdocumentsTemplatesAvailable(CapabilityBooleanType.fromValue(c.getInt(
c.getColumnIndex(ProviderTableMeta.CAPABILITIES_RICHDOCUMENT_TEMPLATES))));
String mimetypes = c.getString(c.getColumnIndex(ProviderTableMeta.CAPABILITIES_RICHDOCUMENT_MIMETYPE_LIST));
if (mimetypes == null) {
mimetypes = "";
}
capability.setRichDocumentsMimeTypeList(Arrays.asList(mimetypes.split(",")));
}
return capability;
}
@@ -2214,7 +2211,7 @@ public class FileDataStorageManager {
public void deleteAllFiles() {
String where = ProviderTableMeta.FILE_ACCOUNT_OWNER + "=?";
String[] whereArgs = new String[]{mAccount.name};
String[] whereArgs = new String[]{account.name};
if (getContentResolver() != null) {
getContentResolver().delete(ProviderTableMeta.CONTENT_URI_FILE, where, whereArgs);
@@ -2223,7 +2220,7 @@ public class FileDataStorageManager {
try {
getContentProviderClient().delete(ProviderTableMeta.CONTENT_URI_FILE, where, whereArgs);
} catch (RemoteException e) {
Log_OC.e(TAG, "Exception in deleteAllFiles for account " + mAccount.name + ": " + e.getMessage(), e);
Log_OC.e(TAG, "Exception in deleteAllFiles for account " + account.name + ": " + e.getMessage(), e);
}
}
}
@@ -1,9 +1,11 @@
/**
/*
* Nextcloud Android client application
*
* @author Mario Danic
* @author Andy Scherzinger
* Copyright (C) 2017 Mario Danic
* Copyright (C) 2017 Nextcloud
* Copyright (C) 2018 Andy Scherzinger
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
@@ -20,98 +22,26 @@
*/
package com.owncloud.android.datamodel;
import android.support.annotation.Nullable;
import androidx.annotation.Nullable;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
/*
Model for filesystem data from the database
/**
* Model for filesystem data from the database.
*/
@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
public class FileSystemDataSet {
private int id;
private String localPath;
private long modifiedAt;
private boolean isFolder;
private boolean isSentForUpload;
private boolean folder;
private boolean sentForUpload;
private long foundAt;
private long syncedFolderId;
@Nullable private String crc32;
public FileSystemDataSet() {
}
public FileSystemDataSet(int id, String localPath, long modifiedAt, boolean isFolder,
boolean isSentForUpload, long foundAt, long syncedFolderId, @Nullable String crc32) {
this.id = id;
this.localPath = localPath;
this.modifiedAt = modifiedAt;
this.isFolder = isFolder;
this.isSentForUpload = isSentForUpload;
this.foundAt = foundAt;
this.syncedFolderId = syncedFolderId;
this.crc32 = crc32;
}
public String getCrc32() {
return crc32;
}
public void setCrc32(String crc32) {
this.crc32 = crc32;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getLocalPath() {
return localPath;
}
public void setLocalPath(String localPath) {
this.localPath = localPath;
}
public long getModifiedAt() {
return modifiedAt;
}
public void setModifiedAt(long modifiedAt) {
this.modifiedAt = modifiedAt;
}
public boolean isFolder() {
return isFolder;
}
public void setFolder(boolean folder) {
isFolder = folder;
}
public long getFoundAt() {
return foundAt;
}
public void setFoundAt(long foundAt) {
this.foundAt = foundAt;
}
public boolean isSentForUpload() {
return isSentForUpload;
}
public void setSentForUpload(boolean sentForUpload) {
isSentForUpload = sentForUpload;
}
public long getSyncedFolderId() {
return syncedFolderId;
}
public void setSyncedFolderId(long syncedFolderId) {
this.syncedFolderId = syncedFolderId;
}
}
@@ -21,6 +21,8 @@ package com.owncloud.android.datamodel;
import android.util.SparseArray;
import lombok.Getter;
/**
* Types of media folder.
*/
@@ -29,7 +31,7 @@ public enum MediaFolderType {
IMAGE(1),
VIDEO(2);
private Integer id;
@Getter private Integer id;
private static SparseArray<MediaFolderType> reverseMap = new SparseArray<>(3);
@@ -46,8 +48,4 @@ public enum MediaFolderType {
public static MediaFolderType getById(Integer id) {
return reverseMap.get(id);
}
public Integer getId() {
return id;
}
}
@@ -2,7 +2,9 @@
* Nextcloud Android client application
*
* @author Mario Danic
* @author Andy Scherzinger
* Copyright (C) 2018 Mario Danic
* Copyright (C) 2018 Andy Scherzinger
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
@@ -22,35 +24,15 @@ package com.owncloud.android.datamodel;
import java.util.List;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
@Getter @Setter
@NoArgsConstructor
@AllArgsConstructor
public class MediaFoldersModel {
private List<String> imageMediaFolders;
private List<String> videoMediaFolders;
/**
* default constructor.
*/
public MediaFoldersModel() {
// keep default constructor for GSON
}
public MediaFoldersModel(List<String> imageMediaFolders, List<String> videoMediaFolders) {
this.imageMediaFolders = imageMediaFolders;
this.videoMediaFolders = videoMediaFolders;
}
public List<String> getImageMediaFolders() {
return imageMediaFolders;
}
public void setImageMediaFolders(List<String> imageMediaFolders) {
this.imageMediaFolders = imageMediaFolders;
}
public List<String> getVideoMediaFolders() {
return videoMediaFolders;
}
public void setVideoMediaFolders(List<String> videoMediaFolders) {
this.videoMediaFolders = videoMediaFolders;
}
}
@@ -27,9 +27,9 @@ import android.content.ContentResolver;
import android.database.Cursor;
import android.net.Uri;
import android.provider.MediaStore;
import android.support.design.widget.Snackbar;
import android.util.Log;
import com.google.android.material.snackbar.Snackbar;
import com.owncloud.android.MainApp;
import com.owncloud.android.R;
import com.owncloud.android.utils.PermissionUtil;
@@ -119,9 +119,9 @@ public final class MediaProvider {
MediaStore.MediaColumns.DATA));
// check if valid path
if (filePath != null && filePath.lastIndexOf("/") > 0) {
if (filePath != null && filePath.lastIndexOf('/') > 0) {
mediaFolder.filePaths.add(filePath);
mediaFolder.absolutePath = filePath.substring(0, filePath.lastIndexOf("/"));
mediaFolder.absolutePath = filePath.substring(0, filePath.lastIndexOf('/'));
}
}
cursorImages.close();
@@ -185,8 +185,8 @@ public final class MediaProvider {
Manifest.permission.WRITE_EXTERNAL_STORAGE)) || getWithoutActivity) {
cursorFolders = contentResolver.query(MediaStore.Video.Media.EXTERNAL_CONTENT_URI, VIDEOS_FOLDER_PROJECTION,
null, null, null);
}
}
List<MediaFolder> mediaFolders = new ArrayList<>();
String dataPath = MainApp.getStoragePath() + File.separator + MainApp.getDataFolder();
@@ -223,7 +223,7 @@ public final class MediaProvider {
if (filePath != null) {
mediaFolder.filePaths.add(filePath);
mediaFolder.absolutePath = filePath.substring(0, filePath.lastIndexOf("/"));
mediaFolder.absolutePath = filePath.substring(0, filePath.lastIndexOf('/'));
}
}
cursorVideos.close();
@@ -28,85 +28,71 @@ import android.content.Context;
import android.net.Uri;
import android.os.Parcel;
import android.os.Parcelable;
import android.support.annotation.NonNull;
import android.support.v4.content.FileProvider;
import com.owncloud.android.R;
import com.owncloud.android.lib.common.network.WebdavEntry;
import com.owncloud.android.lib.common.network.WebdavUtils;
import com.owncloud.android.lib.common.utils.Log_OC;
import com.owncloud.android.lib.resources.files.ServerFileInterface;
import com.owncloud.android.lib.resources.files.model.ServerFileInterface;
import com.owncloud.android.utils.MimeType;
import java.io.File;
import androidx.annotation.NonNull;
import androidx.core.content.FileProvider;
import lombok.Getter;
import lombok.Setter;
import third_parties.daveKoeller.AlphanumComparator;
public class OCFile implements Parcelable, Comparable<OCFile>, ServerFileInterface {
public static final Parcelable.Creator<OCFile> CREATOR = new Parcelable.Creator<OCFile>() {
@Override
public OCFile createFromParcel(Parcel source) {
return new OCFile(source);
}
@Override
public OCFile[] newArray(int size) {
return new OCFile[size];
}
};
private final static String PERMISSION_SHARED_WITH_ME = "S"; // TODO move to better location
private final static String PERMISSION_SHARED_WITH_ME = "S";
private final static String PERMISSION_CAN_RESHARE = "R";
private final static String PERMISSION_CAN_WRITE = "CK";
private final static String PERMISSION_CAN_WRITE = "CK";
public static final String PATH_SEPARATOR = "/";
public static final String ROOT_PATH = PATH_SEPARATOR;
private static final String TAG = OCFile.class.getSimpleName();
private long mId;
private long mParentId;
private long mLength;
private long mCreationTimestamp;
private long mModifiedTimestamp;
private long mModifiedTimestampAtLastSyncForData;
private String mRemotePath;
private String mLocalPath;
private String mMimeType;
private boolean mNeedsUpdating;
private long mLastSyncDateForProperties;
private long mLastSyncDateForData;
private boolean mAvailableOffline;
private String mEtag;
private boolean mShareByLink;
private String mPublicLink;
private String mPermissions;
private String mRemoteId;
private boolean mNeedsUpdateThumbnail;
private boolean mIsDownloading;
private String mEtagInConflict; // Save file etag in the server, when there is a conflict. No conflict = null
private boolean mShareWithSharee;
private boolean mIsFavorite;
private boolean mIsEncrypted;
private WebdavEntry.MountType mMountType;
@Getter @Setter private long fileId; // android internal ID of the file
@Getter @Setter private long parentId;
@Getter @Setter private long fileLength;
@Getter @Setter private long creationTimestamp; // UNIX timestamp of the time the file was created
@Getter @Setter private long modificationTimestamp; // UNIX timestamp of the file modification time
/** UNIX timestamp of the modification time, corresponding to the value returned by the server
* in the last synchronization of THE CONTENTS of this file.
*/
@Getter @Setter private long modificationTimestampAtLastSyncForData;
@Setter private String remotePath;
private String localPath;
@Getter @Setter private String mimeType;
@Getter private boolean needsUpdatingWhileSaving;
@Getter @Setter private long lastSyncDateForProperties;
@Getter @Setter private long lastSyncDateForData;
@Getter @Setter private boolean availableOffline;
@Getter @Setter private boolean previewAvailable;
@Getter private String etag;
@Getter private String etagOnServer;
@Getter @Setter private boolean sharedViaLink;
@Getter @Setter private String publicLink;
@Getter @Setter private String permissions;
@Getter @Setter private String remoteId; // The fileid namespaced by the instance fileId, globally unique
@Getter @Setter private boolean updateThumbnailNeeded;
@Getter @Setter private boolean downloading;
@Getter @Setter private String etagInConflict; // Only saves file etag in the server, when there is a conflict
@Getter @Setter private boolean sharedWithSharee;
@Getter @Setter private boolean favorite;
@Getter @Setter private boolean encrypted;
@Getter @Setter private WebdavEntry.MountType mountType;
@Getter
@Setter
private int unreadCommentsCount;
/**
* URI to the local path of the file contents, if stored in the device; cached after first call
* to {@link #getStorageUri()}
*/
private Uri mLocalUri;
private Uri localUri;
/**
@@ -114,8 +100,8 @@ public class OCFile implements Parcelable, Comparable<OCFile>, ServerFileInterfa
* <p>
* Cached after first call, until changed.
*/
private Uri mExposedFileUri;
private String mEncryptedFileName;
private Uri exposedFileUri;
@Getter @Setter private String encryptedFileName;
/**
@@ -127,11 +113,11 @@ public class OCFile implements Parcelable, Comparable<OCFile>, ServerFileInterfa
*/
public OCFile(String path) {
resetData();
mNeedsUpdating = false;
needsUpdatingWhileSaving = false;
if (path == null || path.length() <= 0 || !path.startsWith(PATH_SEPARATOR)) {
throw new IllegalArgumentException("Trying to create a OCFile with a non valid remote path: " + path);
}
mRemotePath = path;
remotePath = path;
}
/**
@@ -140,90 +126,66 @@ public class OCFile implements Parcelable, Comparable<OCFile>, ServerFileInterfa
* @param source The source parcel
*/
private OCFile(Parcel source) {
mId = source.readLong();
mParentId = source.readLong();
mLength = source.readLong();
mCreationTimestamp = source.readLong();
mModifiedTimestamp = source.readLong();
mModifiedTimestampAtLastSyncForData = source.readLong();
mRemotePath = source.readString();
mLocalPath = source.readString();
mMimeType = source.readString();
mNeedsUpdating = source.readInt() == 0;
mAvailableOffline = source.readInt() == 1;
mLastSyncDateForProperties = source.readLong();
mLastSyncDateForData = source.readLong();
mEtag = source.readString();
mShareByLink = source.readInt() == 1;
mPublicLink = source.readString();
mPermissions = source.readString();
mRemoteId = source.readString();
mNeedsUpdateThumbnail = source.readInt() == 1;
mIsDownloading = source.readInt() == 1;
mEtagInConflict = source.readString();
mShareWithSharee = source.readInt() == 1;
mIsFavorite = source.readInt() == 1;
mIsEncrypted = source.readInt() == 1;
mEncryptedFileName = source.readString();
mMountType = (WebdavEntry.MountType) source.readSerializable();
fileId = source.readLong();
parentId = source.readLong();
fileLength = source.readLong();
creationTimestamp = source.readLong();
modificationTimestamp = source.readLong();
modificationTimestampAtLastSyncForData = source.readLong();
remotePath = source.readString();
localPath = source.readString();
mimeType = source.readString();
needsUpdatingWhileSaving = source.readInt() == 0;
lastSyncDateForProperties = source.readLong();
lastSyncDateForData = source.readLong();
etag = source.readString();
etagOnServer = source.readString();
sharedViaLink = source.readInt() == 1;
publicLink = source.readString();
permissions = source.readString();
remoteId = source.readString();
updateThumbnailNeeded = source.readInt() == 1;
downloading = source.readInt() == 1;
etagInConflict = source.readString();
sharedWithSharee = source.readInt() == 1;
favorite = source.readInt() == 1;
encrypted = source.readInt() == 1;
encryptedFileName = source.readString();
mountType = (WebdavEntry.MountType) source.readSerializable();
}
@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeLong(mId);
dest.writeLong(mParentId);
dest.writeLong(mLength);
dest.writeLong(mCreationTimestamp);
dest.writeLong(mModifiedTimestamp);
dest.writeLong(mModifiedTimestampAtLastSyncForData);
dest.writeString(mRemotePath);
dest.writeString(mLocalPath);
dest.writeString(mMimeType);
dest.writeInt(mNeedsUpdating ? 1 : 0);
dest.writeInt(mAvailableOffline ? 1 : 0);
dest.writeLong(mLastSyncDateForProperties);
dest.writeLong(mLastSyncDateForData);
dest.writeString(mEtag);
dest.writeInt(mShareByLink ? 1 : 0);
dest.writeString(mPublicLink);
dest.writeString(mPermissions);
dest.writeString(mRemoteId);
dest.writeInt(mNeedsUpdateThumbnail ? 1 : 0);
dest.writeInt(mIsDownloading ? 1 : 0);
dest.writeString(mEtagInConflict);
dest.writeInt(mShareWithSharee ? 1 : 0);
dest.writeInt(mIsFavorite ? 1 : 0);
dest.writeInt(mIsEncrypted ? 1 : 0);
dest.writeString(mEncryptedFileName);
dest.writeSerializable(mMountType);
}
public boolean getIsFavorite() {
return mIsFavorite;
}
public void setFavorite(boolean mIsFavorite) {
this.mIsFavorite = mIsFavorite;
}
public boolean isEncrypted() {
return mIsEncrypted;
}
public void setEncrypted(boolean mIsEncrypted) {
this.mIsEncrypted = mIsEncrypted;
}
/**
* Gets the android internal ID of the file
*
* @return the android internal file ID
*/
public long getFileId() {
return mId;
dest.writeLong(fileId);
dest.writeLong(parentId);
dest.writeLong(fileLength);
dest.writeLong(creationTimestamp);
dest.writeLong(modificationTimestamp);
dest.writeLong(modificationTimestampAtLastSyncForData);
dest.writeString(remotePath);
dest.writeString(localPath);
dest.writeString(mimeType);
dest.writeInt(needsUpdatingWhileSaving ? 1 : 0);
dest.writeLong(lastSyncDateForProperties);
dest.writeLong(lastSyncDateForData);
dest.writeString(etag);
dest.writeString(etagOnServer);
dest.writeInt(sharedViaLink ? 1 : 0);
dest.writeString(publicLink);
dest.writeString(permissions);
dest.writeString(remoteId);
dest.writeInt(updateThumbnailNeeded ? 1 : 0);
dest.writeInt(downloading ? 1 : 0);
dest.writeString(etagInConflict);
dest.writeInt(sharedWithSharee ? 1 : 0);
dest.writeInt(favorite ? 1 : 0);
dest.writeInt(encrypted ? 1 : 0);
dest.writeString(encryptedFileName);
dest.writeSerializable(mountType);
}
public String getDecryptedRemotePath() {
return mRemotePath;
return remotePath;
}
/**
@@ -233,7 +195,7 @@ public class OCFile implements Parcelable, Comparable<OCFile>, ServerFileInterfa
*/
public String getRemotePath() {
if (isEncrypted() && !isFolder()) {
String parentPath = new File(mRemotePath).getParent();
String parentPath = new File(remotePath).getParent();
if (parentPath.endsWith("/")) {
return parentPath + getEncryptedFileName();
@@ -242,21 +204,17 @@ public class OCFile implements Parcelable, Comparable<OCFile>, ServerFileInterfa
}
} else {
if (isFolder()) {
if (mRemotePath.endsWith("/")) {
return mRemotePath;
if (remotePath.endsWith("/")) {
return remotePath;
} else {
return mRemotePath + "/";
return remotePath + "/";
}
} else {
return mRemotePath;
return remotePath;
}
}
}
public void setRemotePath(String path) {
mRemotePath = path;
}
/**
* Can be used to check, whether or not this file exists in the database
* already
@@ -264,7 +222,7 @@ public class OCFile implements Parcelable, Comparable<OCFile>, ServerFileInterfa
* @return true, if the file exists in the database
*/
public boolean fileExists() {
return mId != -1;
return fileId != -1;
}
/**
@@ -273,7 +231,7 @@ public class OCFile implements Parcelable, Comparable<OCFile>, ServerFileInterfa
* @return true if it is a folder
*/
public boolean isFolder() {
return mMimeType != null && mMimeType.equals(MimeType.DIRECTORY);
return MimeType.DIRECTORY.equals(mimeType);
}
@@ -284,7 +242,7 @@ public class OCFile implements Parcelable, Comparable<OCFile>, ServerFileInterfa
* @return OCFile this file
*/
public OCFile setFolder() {
setMimetype(MimeType.DIRECTORY);
setMimeType(MimeType.DIRECTORY);
return this;
}
@@ -303,8 +261,8 @@ public class OCFile implements Parcelable, Comparable<OCFile>, ServerFileInterfa
* @return true if it is
*/
public boolean existsOnDevice() {
if (mLocalPath != null && mLocalPath.length() > 0) {
return new File(mLocalPath).exists();
if (localPath != null && localPath.length() > 0) {
return new File(localPath).exists();
}
return false;
}
@@ -315,7 +273,7 @@ public class OCFile implements Parcelable, Comparable<OCFile>, ServerFileInterfa
* @return The local path to the file
*/
public String getStoragePath() {
return mLocalPath;
return localPath;
}
/**
@@ -324,52 +282,52 @@ public class OCFile implements Parcelable, Comparable<OCFile>, ServerFileInterfa
* @return A URI to the local copy of the file, or NULL if not stored in the device
*/
public Uri getStorageUri() {
if (mLocalPath == null || mLocalPath.length() == 0) {
if (localPath == null || localPath.length() == 0) {
return null;
}
if (mLocalUri == null) {
if (localUri == null) {
Uri.Builder builder = new Uri.Builder();
builder.scheme(ContentResolver.SCHEME_FILE);
builder.path(mLocalPath);
mLocalUri = builder.build();
builder.path(localPath);
localUri = builder.build();
}
return mLocalUri;
return localUri;
}
public Uri getLegacyExposedFileUri(Context context) {
if (mLocalPath == null || mLocalPath.length() == 0) {
public Uri getLegacyExposedFileUri() {
if (localPath == null || localPath.length() == 0) {
return null;
}
if (mExposedFileUri == null) {
return Uri.parse(ContentResolver.SCHEME_FILE + "://" + WebdavUtils.encodePath(mLocalPath));
if (exposedFileUri == null) {
return Uri.parse(ContentResolver.SCHEME_FILE + "://" + WebdavUtils.encodePath(localPath));
}
return mExposedFileUri;
return exposedFileUri;
}
/*
Partly disabled because not all apps understand paths that we get via this method for now
*/
public Uri getExposedFileUri(Context context) {
if (mLocalPath == null || mLocalPath.length() == 0) {
if (localPath == null || localPath.length() == 0) {
return null;
}
if (mExposedFileUri == null) {
if (exposedFileUri == null) {
try {
mExposedFileUri = FileProvider.getUriForFile(
exposedFileUri = FileProvider.getUriForFile(
context,
context.getString(R.string.file_provider_authority),
new File(mLocalPath));
new File(localPath));
} catch (IllegalArgumentException ex) {
// Could not share file using FileProvider URI scheme.
// Fall back to legacy URI parsing.
getLegacyExposedFileUri(context);
getLegacyExposedFileUri();
}
}
return mExposedFileUri;
return exposedFileUri;
}
/**
@@ -378,82 +336,18 @@ public class OCFile implements Parcelable, Comparable<OCFile>, ServerFileInterfa
* @param storage_path to set
*/
public void setStoragePath(String storage_path) {
mLocalPath = storage_path;
mLocalUri = null;
mExposedFileUri = null;
localPath = storage_path;
localUri = null;
exposedFileUri = null;
}
/**
* Get a UNIX timestamp of the file creation time
*
* @return A UNIX timestamp of the time that file was created
*/
public long getCreationTimestamp() {
return mCreationTimestamp;
}
/**
* Set a UNIX timestamp of the time the file was created
*
* @param creation_timestamp to set
*/
public void setCreationTimestamp(long creation_timestamp) {
mCreationTimestamp = creation_timestamp;
}
/**
* Get a UNIX timestamp of the file modification time.
*
* @return A UNIX timestamp of the modification time, corresponding to the value returned by the server
* in the last synchronization of the properties of this file.
*/
public long getModificationTimestamp() {
return mModifiedTimestamp;
}
/**
* Set a UNIX timestamp of the time the time the file was modified.
* <p/>
* To update with the value returned by the server in every synchronization of the properties
* of this file.
*
* @param modification_timestamp to set
*/
public void setModificationTimestamp(long modification_timestamp) {
mModifiedTimestamp = modification_timestamp;
}
/**
* Get a UNIX timestamp of the file modification time.
*
* @return A UNIX timestamp of the modification time, corresponding to the value returned by the server
* in the last synchronization of THE CONTENTS of this file.
*/
public long getModificationTimestampAtLastSyncForData() {
return mModifiedTimestampAtLastSyncForData;
}
/**
* Set a UNIX timestamp of the time the time the file was modified.
* <p/>
* To update with the value returned by the server in every synchronization of THE CONTENTS
* of this file.
*
* @param modificationTimestamp to set
*/
public void setModificationTimestampAtLastSyncForData(long modificationTimestamp) {
mModifiedTimestampAtLastSyncForData = modificationTimestamp;
}
/**
* Returns the filename and "/" for the root directory
*
* @return The name of the file
*/
public String getFileName() {
File f = new File(mRemotePath);
File f = new File(remotePath);
return f.getName().length() == 0 ? ROOT_PATH : f.getName();
}
@@ -464,121 +358,49 @@ public class OCFile implements Parcelable, Comparable<OCFile>, ServerFileInterfa
* directory
*/
public void setFileName(String name) {
Log_OC.d(TAG, "OCFile name changing from " + mRemotePath);
Log_OC.d(TAG, "OCFile name changing from " + remotePath);
if (name != null && name.length() > 0 && !name.contains(PATH_SEPARATOR) &&
!mRemotePath.equals(ROOT_PATH)) {
!ROOT_PATH.equals(remotePath)) {
String parent = new File(this.getRemotePath()).getParent();
parent = parent.endsWith(PATH_SEPARATOR) ? parent : parent + PATH_SEPARATOR;
mRemotePath = parent + name;
remotePath = parent + name;
if (isFolder()) {
mRemotePath += PATH_SEPARATOR;
remotePath += PATH_SEPARATOR;
}
Log_OC.d(TAG, "OCFile name changed to " + mRemotePath);
Log_OC.d(TAG, "OCFile name changed to " + remotePath);
}
}
public void setEncryptedFileName(String name) {
mEncryptedFileName = name;
}
public String getEncryptedFileName() {
return mEncryptedFileName;
}
/**
* Can be used to get the MimeType
*
* @return the MimeType as a String
*/
@Override
public String getMimeType() {
return mMimeType;
}
/**
* Used internally. Reset all file properties
*/
private void resetData() {
mId = -1;
mRemotePath = null;
mParentId = 0;
mLocalPath = null;
mMimeType = null;
mLength = 0;
mCreationTimestamp = 0;
mModifiedTimestamp = 0;
mModifiedTimestampAtLastSyncForData = 0;
mLastSyncDateForProperties = 0;
mLastSyncDateForData = 0;
mAvailableOffline = false;
mNeedsUpdating = false;
mEtag = null;
mShareByLink = false;
mPublicLink = null;
mPermissions = null;
mRemoteId = null;
mNeedsUpdateThumbnail = false;
mIsDownloading = false;
mEtagInConflict = null;
mShareWithSharee = false;
mIsFavorite = false;
mIsEncrypted = false;
mEncryptedFileName = null;
mMountType = WebdavEntry.MountType.INTERNAL;
}
/**
* Sets the ID of the file
*
* @param file_id to set
*/
public void setFileId(long file_id) {
mId = file_id;
}
/**
* Sets the Mime-Type of the
*
* @param mimetype to set
*/
public void setMimetype(String mimetype) {
mMimeType = mimetype;
}
/**
* Sets the ID of the parent folder
*
* @param parent_id to set
*/
public void setParentId(long parent_id) {
mParentId = parent_id;
}
/**
* Sets the file size in bytes
*
* @param file_len to set
*/
public void setFileLength(long file_len) {
mLength = file_len;
}
/**
* Returns the size of the file in bytes
*
* @return The filesize in bytes
*/
public long getFileLength() {
return mLength;
}
/**
* Returns the ID of the parent Folder
*
* @return The ID
*/
public long getParentId() {
return mParentId;
fileId = -1;
remotePath = null;
parentId = 0;
localPath = null;
mimeType = null;
fileLength = 0;
creationTimestamp = 0;
modificationTimestamp = 0;
modificationTimestampAtLastSyncForData = 0;
lastSyncDateForProperties = 0;
lastSyncDateForData = 0;
needsUpdatingWhileSaving = false;
etag = null;
etagOnServer = null;
sharedViaLink = false;
publicLink = null;
permissions = null;
remoteId = null;
updateThumbnailNeeded = false;
downloading = false;
etagInConflict = null;
sharedWithSharee = false;
favorite = false;
encrypted = false;
encryptedFileName = null;
mountType = WebdavEntry.MountType.INTERNAL;
}
/**
@@ -591,47 +413,6 @@ public class OCFile implements Parcelable, Comparable<OCFile>, ServerFileInterfa
return parentPath.endsWith("/") ? parentPath : parentPath + "/";
}
/**
* Check, if this file needs updating
*
* @return
*/
public boolean needsUpdatingWhileSaving() {
return mNeedsUpdating;
}
public boolean needsUpdateThumbnail() {
return mNeedsUpdateThumbnail;
}
public void setNeedsUpdateThumbnail(boolean needsUpdateThumbnail) {
this.mNeedsUpdateThumbnail = needsUpdateThumbnail;
}
public long getLastSyncDateForProperties() {
return mLastSyncDateForProperties;
}
public void setLastSyncDateForProperties(long lastSyncDate) {
mLastSyncDateForProperties = lastSyncDate;
}
public long getLastSyncDateForData() {
return mLastSyncDateForData;
}
public void setLastSyncDateForData(long lastSyncDate) {
mLastSyncDateForData = lastSyncDate;
}
public void setAvailableOffline(boolean availableOffline) {
mAvailableOffline = availableOffline;
}
public boolean isAvailableOffline() {
return mAvailableOffline;
}
@Override
public int describeContents() {
return super.hashCode();
@@ -660,51 +441,34 @@ public class OCFile implements Parcelable, Comparable<OCFile>, ServerFileInterfa
OCFile ocFile = (OCFile) o;
return mId == ocFile.mId && mParentId == ocFile.mParentId;
return fileId == ocFile.fileId && parentId == ocFile.parentId;
}
@Override
public int hashCode() {
return 31 * (int) (mId ^ (mId >>> 32)) + (int) (mParentId ^ (mParentId >>> 32));
return 31 * (int) (fileId ^ (fileId >>> 32)) + (int) (parentId ^ (parentId >>> 32));
}
@NonNull
@Override
public String toString() {
String asString = "[id=%s, name=%s, mime=%s, downloaded=%s, local=%s, remote=%s, " +
"parentId=%s, availableOffline=%s etag=%s favourite=%s]";
return String.format(asString, mId, getFileName(), mMimeType, isDown(),
mLocalPath, mRemotePath, mParentId, mAvailableOffline,
mEtag, mIsFavorite);
}
public String getEtag() {
return mEtag;
"parentId=%s, etag=%s, favourite=%s]";
return String.format(asString, fileId, getFileName(), mimeType, isDown(), localPath, remotePath, parentId,
etag, favorite);
}
public void setEtag(String etag) {
this.mEtag = (etag != null ? etag : "");
this.etag = etag != null ? etag : "";
}
public boolean isSharedViaLink() {
return mShareByLink;
}
public void setShareViaLink(boolean shareByLink) {
this.mShareByLink = shareByLink;
}
public String getPublicLink() {
return mPublicLink;
}
public void setPublicLink(String publicLink) {
this.mPublicLink = publicLink;
public void setEtagOnServer(String etag) {
this.etagOnServer = etag != null ? etag : "";
}
public long getLocalModificationTimestamp() {
if (mLocalPath != null && mLocalPath.length() > 0) {
File f = new File(mLocalPath);
if (localPath != null && localPath.length() > 0) {
File f = new File(localPath);
return f.lastModified();
}
return 0;
@@ -714,65 +478,20 @@ public class OCFile implements Parcelable, Comparable<OCFile>, ServerFileInterfa
* @return 'True' if the file is hidden
*/
public boolean isHidden() {
return getFileName().startsWith(".");
}
public String getPermissions() {
return mPermissions;
}
public void setPermissions(String permissions) {
this.mPermissions = permissions;
return getFileName().length() > 0 && getFileName().charAt(0) == '.';
}
/**
* The fileid namespaced by the instance id, globally unique
* The unique fileId for the file within the instance
*
* @return globally unique file id: file id + instance id
*/
public String getRemoteId() {
return mRemoteId;
}
/**
* The unique id for the file within the instance
*
* @return file id, unique within the instance
* @return file fileId, unique within the instance
*/
public String getLocalId() {
return getRemoteId().substring(0, 8).replaceAll("^0*", "");
}
public void setRemoteId(String remoteId) {
this.mRemoteId = remoteId;
}
public boolean isDownloading() {
return mIsDownloading;
}
public void setDownloading(boolean isDownloading) {
this.mIsDownloading = isDownloading;
}
public String getEtagInConflict() {
return mEtagInConflict;
}
public boolean isInConflict() {
return mEtagInConflict != null && !mEtagInConflict.equals("");
}
public void setEtagInConflict(String etagInConflict) {
mEtagInConflict = etagInConflict;
}
public boolean isSharedWithSharee() {
return mShareWithSharee;
}
public void setShareWithSharee(boolean shareWithSharee) {
this.mShareWithSharee = shareWithSharee;
return etagInConflict != null && !"".equals(etagInConflict);
}
public boolean isSharedWithMe() {
@@ -790,11 +509,16 @@ public class OCFile implements Parcelable, Comparable<OCFile>, ServerFileInterfa
return permissions != null && permissions.contains(PERMISSION_CAN_WRITE);
}
public WebdavEntry.MountType getMountType() {
return mMountType;
}
public static final Parcelable.Creator<OCFile> CREATOR = new Parcelable.Creator<OCFile>() {
public void setMountType(WebdavEntry.MountType mountType) {
mMountType = mountType;
}
@Override
public OCFile createFromParcel(Parcel source) {
return new OCFile(source);
}
@Override
public OCFile[] newArray(int size) {
return new OCFile[size];
}
};
}
@@ -1,8 +1,10 @@
/**
/*
* Nextcloud Android client application
*
* @author Mario Danic
* @author Andy Scherzinger
* Copyright (C) 2017 Mario Danic
* Copyright (C) 2018 Andy Scherzinger
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
@@ -20,62 +22,19 @@
package com.owncloud.android.datamodel;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
public class PushConfigurationState {
public String pushToken;
public String deviceIdentifier;
public String deviceIdentifierSignature;
public String userPublicKey;
public boolean shouldBeDeleted;
public PushConfigurationState() {
}
public PushConfigurationState(String pushToken, String deviceIdentifier, String deviceIdentifierSignature,
String userPublicKey, boolean shouldBeDeleted) {
this.pushToken = pushToken;
this.deviceIdentifier = deviceIdentifier;
this.deviceIdentifierSignature = deviceIdentifierSignature;
this.userPublicKey = userPublicKey;
this.shouldBeDeleted = shouldBeDeleted;
}
public String getPushToken() {
return pushToken;
}
public void setPushToken(String pushToken) {
this.pushToken = pushToken;
}
public String getDeviceIdentifier() {
return deviceIdentifier;
}
public void setDeviceIdentifier(String deviceIdentifier) {
this.deviceIdentifier = deviceIdentifier;
}
public String getDeviceIdentifierSignature() {
return deviceIdentifierSignature;
}
public void setDeviceIdentifierSignature(String deviceIdentifierSignature) {
this.deviceIdentifierSignature = deviceIdentifierSignature;
}
public String getUserPublicKey() {
return userPublicKey;
}
public void setUserPublicKey(String userPublicKey) {
this.userPublicKey = userPublicKey;
}
public boolean isShouldBeDeleted() {
return shouldBeDeleted;
}
public void setShouldBeDeleted(boolean shouldBeDeleted) {
this.shouldBeDeleted = shouldBeDeleted;
}
}
@@ -23,32 +23,17 @@ import android.accounts.Account;
import org.parceler.Parcel;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
@Parcel
@Getter
@Setter
@AllArgsConstructor
@NoArgsConstructor
public class SignatureVerification {
public boolean signatureValid;
public Account account;
public SignatureVerification() {
}
public SignatureVerification(boolean signatureValid, Account account) {
this.signatureValid = signatureValid;
this.account = account;
}
public boolean isSignatureValid() {
return signatureValid;
}
public void setSignatureValid(boolean signatureValid) {
this.signatureValid = signatureValid;
}
public Account getAccount() {
return account;
}
public void setAccount(Account account) {
this.account = account;
}
}
@@ -1,4 +1,4 @@
/**
/*
* Nextcloud Android client application
*
* @author Tobias Kaminsky
@@ -23,12 +23,20 @@ package com.owncloud.android.datamodel;
import java.io.Serializable;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.Setter;
/**
* Synced folder entity containing all information per synced folder.
*/
@Getter
@Setter
@AllArgsConstructor
public class SyncedFolder implements Serializable, Cloneable {
public static final long UNPERSISTED_ID = Long.MIN_VALUE;
private static final long serialVersionUID = -793476118299906429L;
private long id = UNPERSISTED_ID;
private String localPath;
private String remotePath;
@@ -40,35 +48,6 @@ public class SyncedFolder implements Serializable, Cloneable {
private boolean enabled;
private MediaFolderType type;
/**
* constructor for already persisted entity.
*
* @param id the primary key
* @param localPath local path
* @param remotePath remote path
* @param wifiOnly upload on wifi only flag
* @param chargingOnly upload on charging only
* @param subfolderByDate create sub-folders by date (month)
* @param account the account owning the synced folder
* @param uploadAction the action to be done after the upload
* @param enabled flag if synced folder config is active
* @param type the type of the folder
*/
public SyncedFolder(long id, String localPath, String remotePath, Boolean wifiOnly, Boolean chargingOnly,
Boolean subfolderByDate, String account, Integer uploadAction, Boolean enabled,
MediaFolderType type) {
this.id = id;
this.localPath = localPath;
this.remotePath = remotePath;
this.wifiOnly = wifiOnly;
this.chargingOnly = chargingOnly;
this.subfolderByDate = subfolderByDate;
this.account = account;
this.uploadAction = uploadAction;
this.enabled = enabled;
this.type = type;
}
/**
* constructor for new, to be persisted entity.
*
@@ -103,84 +82,4 @@ public class SyncedFolder implements Serializable, Cloneable {
return null;
}
}
public long getId() {
return id;
}
public void setId(long id) {
this.id = id;
}
public String getLocalPath() {
return localPath;
}
public void setLocalPath(String localPath) {
this.localPath = localPath;
}
public String getRemotePath() {
return remotePath;
}
public void setRemotePath(String remotePath) {
this.remotePath = remotePath;
}
public Boolean getWifiOnly() {
return wifiOnly;
}
public void setWifiOnly(Boolean wifiOnly) {
this.wifiOnly = wifiOnly;
}
public Boolean getChargingOnly() {
return chargingOnly;
}
public void setChargingOnly(Boolean chargingOnly) {
this.chargingOnly = chargingOnly;
}
public Boolean getSubfolderByDate() {
return subfolderByDate;
}
public void setSubfolderByDate(Boolean subfolderByDate) {
this.subfolderByDate = subfolderByDate;
}
public String getAccount() {
return account;
}
public void setAccount(String account) {
this.account = account;
}
public Integer getUploadAction() {
return uploadAction;
}
public void setUploadAction(Integer uploadAction) {
this.uploadAction = uploadAction;
}
public boolean isEnabled() {
return enabled;
}
public void setEnabled(boolean enabled) {
this.enabled = enabled;
}
public MediaFolderType getType() {
return type;
}
public void setType(MediaFolderType type) {
this.type = type;
}
}
}
@@ -1,4 +1,4 @@
/**
/*
* Nextcloud Android client application
*
* @author Andy Scherzinger
@@ -23,10 +23,15 @@ package com.owncloud.android.datamodel;
import java.util.List;
import lombok.Getter;
import lombok.Setter;
/**
* Display item specialization for synced folder objects to be displayed in a list/grid view adding further
* information to be displayed in the UI but not part of the persisted underlying {@link SyncedFolder} object.
*/
@Getter
@Setter
public class SyncedFolderDisplayItem extends SyncedFolder {
private List<String> filePaths;
private String folderName;
@@ -65,28 +70,4 @@ public class SyncedFolderDisplayItem extends SyncedFolder {
super(id, localPath, remotePath, wifiOnly, chargingOnly, subfolderByDate, account, uploadAction, enabled, type);
this.folderName = folderName;
}
public List<String> getFilePaths() {
return filePaths;
}
public void setFilePaths(List<String> filePaths) {
this.filePaths = filePaths;
}
public String getFolderName() {
return folderName;
}
public void setFolderName(String folderName) {
this.folderName = folderName;
}
public long getNumberOfFiles() {
return numberOfFiles;
}
public void setNumberOfFiles(long numberOfFiles) {
this.numberOfFiles = numberOfFiles;
}
}
@@ -26,7 +26,6 @@ import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.net.Uri;
import android.support.annotation.NonNull;
import com.owncloud.android.db.PreferenceManager;
import com.owncloud.android.db.ProviderMeta;
@@ -37,6 +36,8 @@ import java.util.ArrayList;
import java.util.List;
import java.util.Observable;
import androidx.annotation.NonNull;
/**
* Database provider for handling the persistence aspects of {@link SyncedFolder}s.
*/
@@ -182,12 +183,12 @@ public class SyncedFolderProvider extends Observable {
SyncedFolder result = null;
Cursor cursor = mContentResolver.query(
ProviderMeta.ProviderTableMeta.CONTENT_URI_SYNCED_FOLDERS,
null,
ProviderMeta.ProviderTableMeta.SYNCED_FOLDER_LOCAL_PATH + " == \"" + localPath + "\"" + " AND " +
ProviderMeta.ProviderTableMeta.SYNCED_FOLDER_ACCOUNT + " == " + account.name,
null,
null
ProviderMeta.ProviderTableMeta.CONTENT_URI_SYNCED_FOLDERS,
null,
ProviderMeta.ProviderTableMeta.SYNCED_FOLDER_LOCAL_PATH + "=? AND " +
ProviderMeta.ProviderTableMeta.SYNCED_FOLDER_ACCOUNT + " =? ",
new String[]{localPath, account.name},
null
);
if (cursor != null && cursor.getCount() == 1) {
@@ -209,54 +210,17 @@ public class SyncedFolderProvider extends Observable {
}
/**
* find a synced folder by local path.
*
* @param localPath the local path of the local folder
* @return the synced folder if found, else null
*/
public SyncedFolder findByLocalPath(String localPath) {
SyncedFolder result = null;
Cursor cursor = mContentResolver.query(
ProviderMeta.ProviderTableMeta.CONTENT_URI_SYNCED_FOLDERS,
null,
ProviderMeta.ProviderTableMeta.SYNCED_FOLDER_LOCAL_PATH + " == \"" + localPath + "\"",
null,
null
);
if (cursor != null && cursor.getCount() == 1) {
result = createSyncedFolderFromCursor(cursor);
} else {
if (cursor == null) {
Log_OC.e(TAG, "Sync folder db cursor for local path=" + localPath + " in NULL.");
} else {
Log_OC.e(TAG, cursor.getCount() + " items for local path=" + localPath
+ " available in sync folder db. Expected 1. Failed to update sync folder db.");
}
}
if (cursor != null) {
cursor.close();
}
return result;
}
/**
* Delete all synced folders for an account
*
* @param account whose synced folders should be deleted
*/
public int deleteSyncFoldersForAccount(Account account) {
int result = mContentResolver.delete(
return mContentResolver.delete(
ProviderMeta.ProviderTableMeta.CONTENT_URI_SYNCED_FOLDERS,
ProviderMeta.ProviderTableMeta.SYNCED_FOLDER_ACCOUNT + " = ?",
new String[]{String.valueOf(account.name)}
);
return result;
}
/**
@@ -345,14 +309,12 @@ public class SyncedFolderProvider extends Observable {
ContentValues cv = createContentValuesFromSyncedFolder(syncedFolder);
int result = mContentResolver.update(
return mContentResolver.update(
ProviderMeta.ProviderTableMeta.CONTENT_URI_SYNCED_FOLDERS,
cv,
ProviderMeta.ProviderTableMeta._ID + "=?",
new String[]{String.valueOf(syncedFolder.getId())}
);
return result;
}
/**
@@ -0,0 +1,46 @@
/*
* Nextcloud Android client application
*
* @author Tobias Kaminsky
* Copyright (C) 2018 Tobias Kaminsky
* Copyright (C) 2018 Nextcloud GmbH.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.owncloud.android.datamodel;
import org.parceler.Parcel;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
/**
* Template for creating a file from it via RichDocuments app
*/
@Parcel
@Getter
@Setter
@AllArgsConstructor
@NoArgsConstructor
public class Template {
private int id;
private String name;
private String thumbnailLink;
private String type;
private String extension;
}
@@ -37,7 +37,6 @@ import android.media.ThumbnailUtils;
import android.net.Uri;
import android.os.AsyncTask;
import android.provider.MediaStore;
import android.support.annotation.Nullable;
import android.text.TextUtils;
import android.view.Display;
import android.view.MenuItem;
@@ -51,8 +50,8 @@ import com.owncloud.android.lib.common.OwnCloudClient;
import com.owncloud.android.lib.common.OwnCloudClientManagerFactory;
import com.owncloud.android.lib.common.operations.RemoteOperation;
import com.owncloud.android.lib.common.utils.Log_OC;
import com.owncloud.android.lib.resources.files.ServerFileInterface;
import com.owncloud.android.lib.resources.files.TrashbinFile;
import com.owncloud.android.lib.resources.files.model.ServerFileInterface;
import com.owncloud.android.lib.resources.trashbin.model.TrashbinFile;
import com.owncloud.android.ui.TextDrawable;
import com.owncloud.android.ui.adapter.DiskLruImageCache;
import com.owncloud.android.ui.fragment.FileFragment;
@@ -73,6 +72,7 @@ import java.lang.ref.WeakReference;
import java.net.URLEncoder;
import java.util.List;
import androidx.annotation.Nullable;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
/**
@@ -90,13 +90,13 @@ public final class ThumbnailsCacheManager {
private static final String ETAG = "ETag";
private static final Object mThumbnailsDiskCacheLock = new Object();
private static DiskLruImageCache mThumbnailCache = null;
private static DiskLruImageCache mThumbnailCache;
private static boolean mThumbnailCacheStarting = true;
private static final int DISK_CACHE_SIZE = 1024 * 1024 * 200; // 200MB
private static final CompressFormat mCompressFormat = CompressFormat.JPEG;
private static final int mCompressQuality = 70;
private static OwnCloudClient mClient = null;
private static OwnCloudClient mClient;
public static final Bitmap mDefaultImg = BitmapFactory.decodeResource(MainApp.getAppContext().getResources(),
R.drawable.file_image);
@@ -106,7 +106,7 @@ public final class ThumbnailsCacheManager {
private ThumbnailsCacheManager() {
}
public static class InitDiskCacheTask extends AsyncTask<File, Void, Void> {
@Override
protected Void doInBackground(File... params) {
@@ -115,7 +115,7 @@ public final class ThumbnailsCacheManager {
if (mThumbnailCache == null) {
try {
// Check if media is mounted or storage is built-in, if so,
// Check if media is mounted or storage is built-in, if so,
// try and use external cache dir; otherwise use internal cache dir
File cacheDir = MainApp.getAppContext().getExternalCacheDir();
@@ -184,7 +184,7 @@ public final class ThumbnailsCacheManager {
return thumbnail;
}
public static void addBitmapToCache(String key, Bitmap bitmap) {
synchronized (mThumbnailsDiskCacheLock) {
if (mThumbnailCache != null) {
@@ -265,7 +265,7 @@ public final class ThumbnailsCacheManager {
thumbnail = getBitmapFromDiskCache(imageKey);
// Not found in disk cache
if (thumbnail == null || file.needsUpdateThumbnail()) {
if (thumbnail == null || file.isUpdateThumbnailNeeded()) {
Point p = getScreenDimension();
int pxW = p.x;
int pxH = p.y;
@@ -281,7 +281,7 @@ public final class ThumbnailsCacheManager {
thumbnail = addThumbnailToCache(imageKey, bitmap, file.getStoragePath(), pxW, pxH);
file.setNeedsUpdateThumbnail(false);
file.setUpdateThumbnailNeeded(false);
storageManager.saveFile(file);
}
@@ -355,7 +355,7 @@ public final class ThumbnailsCacheManager {
}
}
}).start();
}
}
}
@@ -384,7 +384,7 @@ public final class ThumbnailsCacheManager {
private static Account mAccount;
private List<ThumbnailGenerationTask> mAsyncTasks;
private Object mFile;
private String mImageKey = null;
private String mImageKey;
private FileDataStorageManager mStorageManager;
private GetMethod getMethod;
@@ -397,7 +397,7 @@ public final class ThumbnailsCacheManager {
Account account, List<ThumbnailGenerationTask> asyncTasks)
throws IllegalArgumentException {
// Use a WeakReference to ensure the ImageView can be garbage collected
mImageViewReference = new WeakReference<ImageView>(imageView);
mImageViewReference = new WeakReference<>(imageView);
if (storageManager == null) {
throw new IllegalArgumentException("storageManager must not be NULL");
}
@@ -421,7 +421,7 @@ public final class ThumbnailsCacheManager {
public ThumbnailGenerationTask(ImageView imageView) {
// Use a WeakReference to ensure the ImageView can be garbage collected
mImageViewReference = new WeakReference<ImageView>(imageView);
mImageViewReference = new WeakReference<>(imageView);
}
@SuppressFBWarnings("Dm")
@@ -504,7 +504,7 @@ public final class ThumbnailsCacheManager {
thumbnail = getBitmapFromDiskCache(imageKey);
// Not found in disk cache
if (thumbnail == null || (file instanceof OCFile && ((OCFile) file).needsUpdateThumbnail())) {
if (thumbnail == null || (file instanceof OCFile && ((OCFile) file).isUpdateThumbnailNeeded())) {
int pxW;
int pxH;
pxW = pxH = getThumbnailDimension();
@@ -528,7 +528,7 @@ public final class ThumbnailsCacheManager {
thumbnail = addThumbnailToCache(imageKey, bitmap, ocFile.getStoragePath(), pxW, pxH);
ocFile.setNeedsUpdateThumbnail(false);
ocFile.setUpdateThumbnailNeeded(false);
mStorageManager.saveFile(ocFile);
}
}
@@ -555,7 +555,7 @@ public final class ThumbnailsCacheManager {
uri = mClient.getBaseUri() + "/index.php/apps/files_trashbin/preview?fileId=" +
file.getLocalId() + "&x=" + pxW + "&y=" + pxH;
}
Log_OC.d(TAG, "generate thumbnail: " + file.getFileName() + " URI: " + uri);
getMethod = new GetMethod(uri);
getMethod.setRequestHeader("Cookie",
@@ -865,7 +865,7 @@ public final class ThumbnailsCacheManager {
Log_OC.d("Avatar", "URI: " + uri);
get = new GetMethod(uri);
// only use eTag if available and corresponding avatar is still there
// only use eTag if available and corresponding avatar is still there
// (might be deleted from cache)
if (!eTag.isEmpty() && getBitmapFromDiskCache(avatarKey) != null) {
get.setRequestHeader("If-None-Match", eTag);
@@ -1166,4 +1166,4 @@ public final class ThumbnailsCacheManager {
addThumbnailToCache(imageKey, bitmap, file.getStoragePath(), pxW, pxH);
}
}
}
}
@@ -26,7 +26,6 @@ import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.net.Uri;
import android.support.annotation.Nullable;
import com.owncloud.android.authentication.AccountUtils;
import com.owncloud.android.db.OCUpload;
@@ -40,6 +39,8 @@ import com.owncloud.android.operations.UploadFileOperation;
import java.util.Calendar;
import java.util.Observable;
import androidx.annotation.Nullable;
/**
* Database helper for storing list of files to be uploaded, including status
* information for each file.
@@ -343,7 +344,7 @@ public class UploadsStorageManager extends Observable {
if (account != null) {
return getUploads(
ProviderTableMeta.UPLOADS_STATUS + "==" + UploadStatus.UPLOAD_IN_PROGRESS.value +
ProviderTableMeta.UPLOADS_STATUS + "==" + UploadStatus.UPLOAD_IN_PROGRESS.value +
" OR " + ProviderTableMeta.UPLOADS_LAST_RESULT +
"==" + UploadResult.DELAYED_FOR_WIFI.getValue() +
" OR " + ProviderTableMeta.UPLOADS_LAST_RESULT +
@@ -353,8 +354,7 @@ public class UploadsStorageManager extends Observable {
" OR " + ProviderTableMeta.UPLOADS_LAST_RESULT +
"==" + UploadResult.DELAYED_IN_POWER_SAVE_MODE.getValue() +
" AND " + ProviderTableMeta.UPLOADS_ACCOUNT_NAME + "== ?",
new String[]{account.name}
);
account.name);
} else {
return new OCUpload[0];
}
@@ -375,7 +375,7 @@ public class UploadsStorageManager extends Observable {
"==" + UploadResult.DELAYED_IN_POWER_SAVE_MODE.getValue() +
" ) AND " + ProviderTableMeta.UPLOADS_LAST_RESULT +
"!= " + UploadResult.VIRUS_DETECTED.getValue()
, new String[]{String.valueOf(UploadStatus.UPLOAD_FAILED.value)});
, String.valueOf(UploadStatus.UPLOAD_FAILED.value));
}
public OCUpload[] getFinishedUploadsForCurrentAccount() {
@@ -383,7 +383,7 @@ public class UploadsStorageManager extends Observable {
if (account != null) {
return getUploads(ProviderTableMeta.UPLOADS_STATUS + "==" + UploadStatus.UPLOAD_SUCCEEDED.value + AND +
ProviderTableMeta.UPLOADS_ACCOUNT_NAME + "== ?", new String[]{account.name});
ProviderTableMeta.UPLOADS_ACCOUNT_NAME + "== ?", account.name);
} else {
return new OCUpload[0];
}
@@ -411,8 +411,7 @@ public class UploadsStorageManager extends Observable {
AND + ProviderTableMeta.UPLOADS_LAST_RESULT +
"<>" + UploadResult.DELAYED_IN_POWER_SAVE_MODE.getValue() +
AND + ProviderTableMeta.UPLOADS_ACCOUNT_NAME + "== ?",
new String[]{account.name}
);
account.name);
} else {
return new OCUpload[0];
}
@@ -1,20 +1,20 @@
/**
/*
* Nextcloud Android client application
*
* @author Tobias Kaminsky
* Copyright (C) 2017 Tobias Kaminsky
* Copyright (C) 2017 Nextcloud GmbH.
* <p>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* at your option) any later version.
* <p>
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
* <p>
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
@@ -24,7 +24,6 @@ package com.owncloud.android.datamodel;
/**
* Type for virtual folders
*/
public enum VirtualFolderType {
FAVORITE, PHOTOS, NONE
}
@@ -1,4 +1,4 @@
/**
/*
* Nextcloud Android client application
*
* @author Bartosz Przybylski
@@ -21,9 +21,17 @@
package com.owncloud.android.datastorage;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
/**
* @author Bartosz Przybylski
*/
@Getter @Setter
@NoArgsConstructor
@AllArgsConstructor
public class StoragePoint implements Comparable<StoragePoint> {
public enum StorageType {
INTERNAL, EXTERNAL
@@ -33,51 +41,13 @@ public class StoragePoint implements Comparable<StoragePoint> {
PRIVATE, PUBLIC
}
private String mDescription;
private String mPath;
private StorageType mStorageType;
private PrivacyType mPrivacyType;
public StoragePoint() {
}
public StoragePoint(String mDescription, String mPath, StorageType mStorageType, PrivacyType privacyType) {
this.mDescription = mDescription;
this.mPath = mPath;
this.mStorageType = mStorageType;
this.mPrivacyType = privacyType;
}
public StorageType getStorageType() {
return mStorageType;
}
public PrivacyType getPrivacyType() {
return mPrivacyType;
}
public String getPath() { return mPath; }
public String getDescription() { return mDescription; }
public void setDescription(String description) {
this.mDescription = description;
}
public void setPath(String path) {
this.mPath = path;
}
public void setStorageType(StorageType storageType) {
this.mStorageType = storageType;
}
public void setPrivacyType(PrivacyType privacyType) {
this.mPrivacyType = privacyType;
}
private String description;
private String path;
private StorageType storageType;
private PrivacyType privacyType;
@Override
public int compareTo(StoragePoint another) {
return mPath.compareTo(another.getPath());
return path.compareTo(another.getPath());
}
}
@@ -62,7 +62,7 @@ public class MountCommandStoragePointProvider extends AbstractCommandLineStorage
if (!line.toLowerCase(Locale.US).contains("asec") && sPattern.matcher(line).matches()) {
String parts[] = line.split(" ");
for (String path : parts) {
if (path.startsWith("/") && !path.toLowerCase(Locale.US).contains("vold")) {
if (path.length() > 0 && path.charAt(0) == '/' && !path.toLowerCase(Locale.US).contains("vold")) {
result.add(path);
}
}
@@ -39,6 +39,9 @@ import com.owncloud.android.utils.MimeTypeUtil;
import java.io.File;
import lombok.Getter;
import lombok.Setter;
/**
* Stores all information in order to start upload operations. PersistentUploadObject can
* be stored persistently by {@link UploadsStorageManager}.
@@ -47,85 +50,85 @@ public class OCUpload implements Parcelable {
private static final String TAG = OCUpload.class.getSimpleName();
private long id;
@Getter @Setter private long uploadId;
/**
* Absolute path in the local file system to the file to be uploaded.
*/
private String localPath;
@Getter @Setter private String localPath;
/**
* Absolute path in the remote account to set to the uploaded file (not for its parent folder!)
*/
private String remotePath;
@Getter @Setter private String remotePath;
/**
* Name of Owncloud account to upload file to.
*/
private String accountName;
@Getter private String accountName;
/**
* File size.
*/
private long fileSize;
@Getter @Setter private long fileSize;
/**
* Local action for upload. (0 - COPY, 1 - MOVE, 2 - FORGET)
*/
private int localAction;
@Getter @Setter private int localAction;
/**
* Overwrite destination file?
*/
private boolean forceOverwrite;
@Getter @Setter private boolean forceOverwrite;
/**
* Create destination folder?
*/
private boolean createRemoteFolder;
@Getter @Setter private boolean createRemoteFolder;
/**
* Status of upload (later, in_progress, ...).
*/
private UploadStatus uploadStatus;
@Getter private UploadStatus uploadStatus;
/**
* Result from last upload operation. Can be null.
*/
private UploadResult lastResult;
@Getter private UploadResult lastResult;
/**
* Defines the origin of the upload; see constants CREATED_ in {@link UploadFileOperation}
*/
private int createdBy;
@Getter @Setter private int createdBy;
/**
* When the upload ended
*/
private long uploadEndTimeStamp;
@Getter @Setter private long uploadEndTimestamp;
/**
* Upload only via wifi?
*/
private boolean useWifiOnly;
@Getter @Setter private boolean useWifiOnly;
/**
* Upload only if phone being charged?
*/
private boolean whileChargingOnly;
@Getter @Setter private boolean whileChargingOnly;
/**
* Token to unlock E2E folder
*/
private String folderUnlockToken;
@Getter @Setter private String folderUnlockToken;
/**
* temporary values, used for sorting
*/
private UploadStatus fixedUploadStatus;
private boolean fixedUploadingNow;
private long fixedUploadEndTimeStamp;
private long fixedId;
@Getter private UploadStatus fixedUploadStatus;
@Getter private boolean fixedUploadingNow;
@Getter private long fixedUploadEndTimeStamp;
@Getter private long fixedUploadId;
/**
* Main constructor.
@@ -168,7 +171,7 @@ public class OCUpload implements Parcelable {
localPath = "";
accountName = "";
fileSize = -1;
id = -1;
uploadId = -1;
localAction = FileUploader.LOCAL_BEHAVIOUR_COPY;
forceOverwrite = false;
createRemoteFolder = false;
@@ -183,26 +186,11 @@ public class OCUpload implements Parcelable {
public void setDataFixed(FileUploader.FileUploaderBinder binder) {
fixedUploadStatus = uploadStatus;
fixedUploadingNow = binder != null && binder.isUploadingNow(this);
fixedUploadEndTimeStamp = uploadEndTimeStamp;
fixedId = id;
}
// Getters & Setters
public void setUploadId(long id) {
this.id = id;
}
public long getUploadId() {
return id;
}
/**
* @return the uploadStatus
*/
public UploadStatus getUploadStatus() {
return uploadStatus;
fixedUploadEndTimeStamp = uploadEndTimestamp;
fixedUploadId = uploadId;
}
// custom Getters & Setters
/**
* Sets uploadStatus AND SETS lastResult = null;
* @param uploadStatus the uploadStatus to set
@@ -212,13 +200,6 @@ public class OCUpload implements Parcelable {
setLastResult(UploadResult.UNKNOWN);
}
/**
* @return the lastResult
*/
public UploadResult getLastResult() {
return lastResult;
}
/**
* @param lastResult the lastResult to set
*/
@@ -226,44 +207,6 @@ public class OCUpload implements Parcelable {
this.lastResult = lastResult != null ? lastResult : UploadResult.UNKNOWN;
}
/**
* @return the localPath
*/
public String getLocalPath() {
return localPath;
}
public void setLocalPath(String localPath) {
this.localPath = localPath;
}
/**
* @return the remotePath
*/
public String getRemotePath() {
return remotePath;
}
/**
* @param remotePath the remotePath
*/
public void setRemotePath(String remotePath) {
this.remotePath = remotePath;
}
/**
* @return File size
*/
public long getFileSize() {
return fileSize;
}
public void setFileSize(long fileSize) {
this.fileSize = fileSize;
}
/**
* @return the mimeType
*/
@@ -272,77 +215,12 @@ public class OCUpload implements Parcelable {
}
/**
* @return the localAction
*/
public int getLocalAction() {
return localAction;
}
/**
* @param localAction the localAction to set
*/
public void setLocalAction(int localAction) {
this.localAction = localAction;
}
/**
* @return the forceOverwrite
*/
public boolean isForceOverwrite() {
return forceOverwrite;
}
/**
* @param forceOverwrite the forceOverwrite to set
*/
public void setForceOverwrite(boolean forceOverwrite) {
this.forceOverwrite = forceOverwrite;
}
/**
* @return the isCreateRemoteFolder
*/
public boolean isCreateRemoteFolder() {
return createRemoteFolder;
}
/**
* @param createRemoteFolder the createRemoteFolder to set
*/
public void setCreateRemoteFolder(boolean createRemoteFolder) {
this.createRemoteFolder = createRemoteFolder;
}
/**
* @return the accountName
*/
public String getAccountName() {
return accountName;
}
/**
* Returns owncloud account as {@link Account} object.
* Returns owncloud account as {@link Account} object.
*/
public Account getAccount(Context context) {
return AccountUtils.getOwnCloudAccountByName(context, getAccountName());
}
public void setCreatedBy(int createdBy) {
this.createdBy = createdBy;
}
public int getCreatedBy() {
return createdBy;
}
public void setUploadEndTimestamp(long uploadEndTimestamp) {
uploadEndTimeStamp = uploadEndTimestamp;
}
public long getUploadEndTimestamp() {
return uploadEndTimeStamp;
}
/**
* For debugging purposes only.
*/
@@ -373,36 +251,6 @@ public class OCUpload implements Parcelable {
}
};
/**
* @return the isUseWifiOnly
*/
public boolean isUseWifiOnly() {
return useWifiOnly;
}
/**
* @param useWifiOnly the useWifiOnly to set
*/
public void setUseWifiOnly(boolean useWifiOnly) {
this.useWifiOnly = useWifiOnly;
}
public void setWhileChargingOnly(boolean whileChargingOnly) {
this.whileChargingOnly = whileChargingOnly;
}
public boolean isWhileChargingOnly() {
return whileChargingOnly;
}
public void setFolderUnlockToken(String token) {
folderUnlockToken = token;
}
public String getFolderUnlockToken() {
return folderUnlockToken;
}
/**
* Reconstruct from parcel
*
@@ -413,7 +261,7 @@ public class OCUpload implements Parcelable {
}
private void readFromParcel(Parcel source) {
id = source.readLong();
uploadId = source.readLong();
localPath = source.readString();
remotePath = source.readString();
accountName = source.readString();
@@ -425,7 +273,7 @@ public class OCUpload implements Parcelable {
} catch (IllegalArgumentException x) {
uploadStatus = UploadStatus.UPLOAD_IN_PROGRESS;
}
uploadEndTimeStamp = source.readLong();
uploadEndTimestamp = source.readLong();
try {
lastResult = UploadResult.valueOf(source.readString());
} catch (IllegalArgumentException x) {
@@ -444,7 +292,7 @@ public class OCUpload implements Parcelable {
@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeLong(id);
dest.writeLong(uploadId);
dest.writeString(localPath);
dest.writeString(remotePath);
dest.writeString(accountName);
@@ -452,7 +300,7 @@ public class OCUpload implements Parcelable {
dest.writeInt(forceOverwrite ? 1 : 0);
dest.writeInt(createRemoteFolder ? 1 : 0);
dest.writeString(uploadStatus.name());
dest.writeLong(uploadEndTimeStamp);
dest.writeLong(uploadEndTimestamp);
dest.writeString(lastResult == null ? "" : lastResult.name());
dest.writeInt(createdBy);
dest.writeInt(useWifiOnly ? 1 : 0);
@@ -460,21 +308,5 @@ public class OCUpload implements Parcelable {
dest.writeString(folderUnlockToken);
}
public UploadStatus getFixedUploadStatus() {
return fixedUploadStatus;
}
public boolean isFixedUploadingNow() {
return fixedUploadingNow;
}
public long getFixedUploadEndTimestamp() {
return fixedUploadEndTimeStamp;
}
public Long getFixedUploadId() {
return fixedId;
}
enum CanUploadFileNowStatus {NOW, LATER, FILE_GONE, ERROR}
}
@@ -3,16 +3,16 @@
*
* @author David A. Velasco
* Copyright (C) 2016 ownCloud Inc.
*
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2,
* as published by the Free Software Foundation.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
@@ -42,6 +42,7 @@ public final class PreferenceManager {
* Value handled by the app without direct access in the UI.
*/
private static final String AUTO_PREF__LAST_UPLOAD_PATH = "last_upload_path";
private static final String AUTO_PREF__UPLOAD_FROM_LOCAL_LAST_PATH = "upload_from_local_last_path";
private static final String AUTO_PREF__UPLOAD_FILE_EXTENSION_MAP_URL = "prefs_upload_file_extension_map_url";
private static final String AUTO_PREF__UPLOAD_FILE_EXTENSION_URL = "prefs_upload_file_extension_url";
private static final String AUTO_PREF__UPLOADER_BEHAVIOR = "prefs_uploader_behaviour";
@@ -64,6 +65,7 @@ public final class PreferenceManager {
private static final String PREF__AUTO_UPLOAD_INIT = "autoUploadInit";
private static final String PREF__FOLDER_SORT_ORDER = "folder_sort_order";
private static final String PREF__FOLDER_LAYOUT = "folder_layout";
public static final String PREF__LOCK_TIMESTAMP = "lock_timestamp";
private PreferenceManager() {
}
@@ -186,6 +188,27 @@ public final class PreferenceManager {
saveStringPreference(context, AUTO_PREF__LAST_UPLOAD_PATH, path);
}
/**
* Gets the last local path where the user selected to do an upload from.
*
* @param context Caller {@link Context}, used to access to shared preferences manager.
* @return path Absolute path to a folder, as previously stored by
* {@link #setUploadFromLocalLastPath(Context, String)}, or empty String if never saved before.
*/
public static String getUploadFromLocalLastPath(Context context) {
return getDefaultSharedPreferences(context).getString(AUTO_PREF__UPLOAD_FROM_LOCAL_LAST_PATH, "");
}
/**
* Saves the path where the user selected to do the last local upload of a file from.
*
* @param context Caller {@link Context}, used to access to shared preferences manager.
* @param path Absolute path to a folder.
*/
public static void setUploadFromLocalLastPath(Context context, String path) {
saveStringPreference(context, AUTO_PREF__UPLOAD_FROM_LOCAL_LAST_PATH, path);
}
/**
* Gets the lock preference configured by the user.
*
@@ -211,7 +234,7 @@ public final class PreferenceManager {
*
* @param context Caller {@link Context}, used to access to preferences manager.
* @param folder Folder
* @return preference value, default is
* @return preference value, default is
* {@link com.owncloud.android.ui.fragment.OCFileListFragment#FOLDER_LAYOUT_LIST}
*/
public static String getFolderLayout(Context context, OCFile folder) {
@@ -235,19 +258,57 @@ public final class PreferenceManager {
* @param context Caller {@link Context}, used to access to shared preferences manager.
* @return sort order the sort order, default is {@link FileSortOrder#sort_a_to_z} (sort by name)
*/
public static FileSortOrder getSortOrder(Context context, OCFile folder) {
public static FileSortOrder getSortOrderByFolder(Context context, OCFile folder) {
return FileSortOrder.sortOrders.get(getFolderPreference(context, PREF__FOLDER_SORT_ORDER, folder,
FileSortOrder.sort_a_to_z.mName));
FileSortOrder.sort_a_to_z.name));
}
/**
* Set preferred folder sort order.
*
* @param context Caller {@link Context}, used to access to shared preferences manager.
* @param sortOrder the sort order
* @param context Caller {@link Context}, used to access to shared preferences manager.
* @param sortOrder the sort order
*/
public static void setSortOrder(Context context, OCFile folder, FileSortOrder sortOrder) {
setFolderPreference(context, PREF__FOLDER_SORT_ORDER, folder, sortOrder.mName);
setFolderPreference(context, PREF__FOLDER_SORT_ORDER, folder, sortOrder.name);
}
public static FileSortOrder getSortOrderByType(Context context, FileSortOrder.Type type) {
return getSortOrderByType(context, type, FileSortOrder.sort_a_to_z);
}
/**
* Get preferred folder sort order.
*
* @param context Caller {@link Context}, used to access to shared preferences manager.
* @return sort order the sort order, default is {@link FileSortOrder#sort_a_to_z} (sort by name)
*/
public static FileSortOrder getSortOrderByType(Context context, FileSortOrder.Type type,
FileSortOrder defaultOrder) {
Account account = AccountUtils.getCurrentOwnCloudAccount(context);
if (account == null) {
return defaultOrder;
}
ArbitraryDataProvider dataProvider = new ArbitraryDataProvider(context.getContentResolver());
String value = dataProvider.getValue(account.name, PREF__FOLDER_SORT_ORDER + "_" + type);
return value.isEmpty() ? defaultOrder : FileSortOrder.sortOrders.get(value);
}
/**
* Set preferred folder sort order.
*
* @param context Caller {@link Context}, used to access to shared preferences manager.
* @param sortOrder the sort order
*/
public static void setSortOrder(Context context, FileSortOrder.Type type, FileSortOrder sortOrder) {
Account account = AccountUtils.getCurrentOwnCloudAccount(context);
ArbitraryDataProvider dataProvider = new ArbitraryDataProvider(context.getContentResolver());
dataProvider.storeOrUpdateKeyValue(account.name, PREF__FOLDER_SORT_ORDER + "_" + type, sortOrder.name);
}
/**
@@ -267,14 +328,14 @@ public final class PreferenceManager {
if (account == null) {
return defaultValue;
}
ArbitraryDataProvider dataProvider = new ArbitraryDataProvider(context.getContentResolver());
FileDataStorageManager storageManager = ((ComponentsGetter)context).getStorageManager();
if (storageManager == null) {
storageManager = new FileDataStorageManager(account, context.getContentResolver());
}
String value = dataProvider.getValue(account.name, getKeyFromFolder(preferenceName, folder));
while (folder != null && value.isEmpty()) {
folder = storageManager.getFileById(folder.getParentId());
@@ -283,6 +344,29 @@ public final class PreferenceManager {
return value.isEmpty() ? defaultValue : value;
}
/**
* Get preference value for a view.
*
* @param context Context object.
* @param preferenceName Name of the preference to lookup.
* @param type view which view
* @param defaultValue Fallback value in case nothing is set.
* @return Preference value
*/
public static String getTypePreference(Context context, String preferenceName, String type, String defaultValue) {
Account account = AccountUtils.getCurrentOwnCloudAccount(context);
if (account == null) {
return defaultValue;
}
ArbitraryDataProvider dataProvider = new ArbitraryDataProvider(context.getContentResolver());
String value = dataProvider.getValue(account.name, preferenceName + "_" + type);
return value.isEmpty() ? defaultValue : value;
}
/**
* Set preference value for a folder.
*
@@ -300,7 +384,7 @@ public final class PreferenceManager {
private static String getKeyFromFolder(String preferenceName, OCFile folder) {
final String folderIdString = String.valueOf(folder != null ? folder.getFileId() :
FileDataStorageManager.ROOT_PARENT_ID);
return preferenceName + "_" + folderIdString;
}
@@ -449,6 +533,14 @@ public final class PreferenceManager {
saveIntPreference(context, AUTO_PREF__LAST_SEEN_VERSION_CODE, versionCode);
}
public static long getLockTimestamp(Context context) {
return getDefaultSharedPreferences(context).getLong(PREF__LOCK_TIMESTAMP, 0);
}
public static void setLockTimestamp(Context context, long timestamp) {
saveLongPreference(context, PREF__LOCK_TIMESTAMP, timestamp);
}
private static void saveBooleanPreference(Context context, String key, boolean value) {
SharedPreferences.Editor appPreferences = getDefaultSharedPreferences(context.getApplicationContext()).edit();
appPreferences.putBoolean(key, value).apply();
@@ -475,6 +567,11 @@ public final class PreferenceManager {
appPreferences.putFloat(key, value).apply();
}
private static void saveLongPreference(Context context, String key, long value) {
SharedPreferences.Editor appPreferences = getDefaultSharedPreferences(context.getApplicationContext()).edit();
appPreferences.putLong(key, value).apply();
}
public static SharedPreferences getDefaultSharedPreferences(Context context) {
return android.preference.PreferenceManager.getDefaultSharedPreferences(context.getApplicationContext());
}
@@ -32,7 +32,7 @@ import com.owncloud.android.MainApp;
public class ProviderMeta {
public static final String DB_NAME = "filelist";
public static final int DB_VERSION = 34;
public static final int DB_VERSION = 42;
private ProviderMeta() {
}
@@ -92,6 +92,7 @@ public class ProviderMeta {
public static final String FILE_LAST_SYNC_DATE_FOR_DATA = "last_sync_date_for_data";
public static final String FILE_KEEP_IN_SYNC = "keep_in_sync";
public static final String FILE_ETAG = "etag";
public static final String FILE_ETAG_ON_SERVER = "etag_on_server";
public static final String FILE_SHARED_VIA_LINK = "share_by_link";
public static final String FILE_SHARED_WITH_SHAREE = "shared_via_users";
public static final String FILE_PUBLIC_LINK = "public_link";
@@ -103,13 +104,17 @@ public class ProviderMeta {
public static final String FILE_FAVORITE = "favorite";
public static final String FILE_IS_ENCRYPTED = "is_encrypted";
public static final String FILE_MOUNT_TYPE = "mount_type";
public static final String FILE_HAS_PREVIEW = "has_preview";
public static final String FILE_UNREAD_COMMENTS_COUNT = "unread_comments_count";
public static final String [] FILE_ALL_COLUMNS = {_ID, FILE_PARENT, FILE_NAME
, FILE_CREATION, FILE_MODIFIED,
FILE_MODIFIED_AT_LAST_SYNC_FOR_DATA, FILE_CONTENT_LENGTH, FILE_CONTENT_TYPE, FILE_STORAGE_PATH,
FILE_PATH, FILE_ACCOUNT_OWNER, FILE_LAST_SYNC_DATE, FILE_LAST_SYNC_DATE_FOR_DATA, FILE_KEEP_IN_SYNC,
FILE_ETAG, FILE_SHARED_VIA_LINK, FILE_SHARED_WITH_SHAREE, FILE_PUBLIC_LINK, FILE_PERMISSIONS,
FILE_REMOTE_ID, FILE_UPDATE_THUMBNAIL, FILE_IS_DOWNLOADING, FILE_ETAG_IN_CONFLICT, FILE_FAVORITE};
public static final String[] FILE_ALL_COLUMNS = {
_ID, FILE_PARENT, FILE_NAME, FILE_CREATION, FILE_MODIFIED,
FILE_MODIFIED_AT_LAST_SYNC_FOR_DATA, FILE_CONTENT_LENGTH, FILE_CONTENT_TYPE, FILE_STORAGE_PATH,
FILE_PATH, FILE_ACCOUNT_OWNER, FILE_LAST_SYNC_DATE, FILE_LAST_SYNC_DATE_FOR_DATA, FILE_ETAG,
FILE_ETAG_ON_SERVER, FILE_SHARED_VIA_LINK, FILE_SHARED_WITH_SHAREE, FILE_PUBLIC_LINK, FILE_PERMISSIONS,
FILE_REMOTE_ID, FILE_UPDATE_THUMBNAIL, FILE_IS_DOWNLOADING, FILE_ETAG_IN_CONFLICT, FILE_FAVORITE,
FILE_IS_ENCRYPTED, FILE_MOUNT_TYPE, FILE_HAS_PREVIEW, FILE_UNREAD_COMMENTS_COUNT
};
public static final String FILE_DEFAULT_SORT_ORDER = FILE_NAME + " collate nocase asc";
@@ -129,6 +134,8 @@ public class ProviderMeta {
public static final String OCSHARES_ID_REMOTE_SHARED = "id_remote_shared";
public static final String OCSHARES_ACCOUNT_OWNER = "owner_share";
public static final String OCSHARES_IS_PASSWORD_PROTECTED = "is_password_protected";
public static final String OCSHARES_NOTE = "note";
public static final String OCSHARES_HIDE_DOWNLOAD = "hide_download";
public static final String OCSHARES_DEFAULT_SORT_ORDER = OCSHARES_FILE_SOURCE
+ " collate nocase asc";
@@ -169,9 +176,12 @@ public class ProviderMeta {
public static final String CAPABILITIES_SERVER_SLOGAN = "server_slogan";
public static final String CAPABILITIES_SERVER_BACKGROUND_DEFAULT = "background_default";
public static final String CAPABILITIES_SERVER_BACKGROUND_PLAIN = "background_plain";
public static final String CAPABILITIES_END_TO_END_ENCRYPTION = "end_to_end_encryption";
public static final String CAPABILITIES_ACTIVITY = "activity";
public static final String CAPABILITIES_RICHDOCUMENT = "richdocument";
public static final String CAPABILITIES_RICHDOCUMENT_MIMETYPE_LIST = "richdocument_mimetype_list";
public static final String CAPABILITIES_RICHDOCUMENT_DIRECT_EDITING = "richdocument_direct_editing";
public static final String CAPABILITIES_RICHDOCUMENT_TEMPLATES = "richdocument_direct_templates";
public static final String CAPABILITIES_DEFAULT_SORT_ORDER = CAPABILITIES_ACCOUNT_NAME
+ " collate nocase asc";
@@ -27,15 +27,17 @@ import android.os.Parcelable;
import com.owncloud.android.R;
import lombok.Getter;
/**
* @author Bartosz Przybylski
* @author Tobias Kaminsky
*/
public class FeatureItem implements Parcelable {
private static final int DO_NOT_SHOW = -1;
private int image;
private int titleText;
private int contentText;
@Getter private int image;
@Getter private int titleText;
@Getter private int contentText;
private boolean contentCentered;
private boolean bulletList;
@@ -51,26 +53,14 @@ public class FeatureItem implements Parcelable {
return image != DO_NOT_SHOW;
}
public int getImage() {
return image;
}
public boolean shouldShowTitleText() {
return titleText != DO_NOT_SHOW && titleText != R.string.empty;
}
public int getTitleText() {
return titleText;
}
public boolean shouldShowContentText() {
return contentText != DO_NOT_SHOW && contentText != R.string.empty;
}
public int getContentText() {
return contentText;
}
public boolean shouldContentCentered() {
return contentCentered;
}
@@ -0,0 +1,95 @@
/*
* Nextcloud Android client application
*
* @author Tobias Kaminsky
* Copyright (C) 2018 Tobias Kaminsky
* Copyright (C) 2018 Nextcloud GmbH.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.owncloud.android.files;
import com.owncloud.android.lib.common.OwnCloudClient;
import com.owncloud.android.lib.common.operations.RemoteOperation;
import com.owncloud.android.lib.common.operations.RemoteOperationResult;
import com.owncloud.android.lib.common.utils.Log_OC;
import org.apache.commons.httpclient.HttpStatus;
import org.apache.commons.httpclient.methods.PostMethod;
import org.json.JSONObject;
import java.util.ArrayList;
public class CreateFileFromTemplateOperation extends RemoteOperation {
private static final String TAG = CreateFileFromTemplateOperation.class.getSimpleName();
private static final int SYNC_READ_TIMEOUT = 40000;
private static final int SYNC_CONNECTION_TIMEOUT = 5000;
private static final String NEW_FROM_TEMPLATE_URL = "/ocs/v2.php/apps/richdocuments/api/v1/templates/new";
private String path;
private int templateId;
// JSON node names
private static final String NODE_OCS = "ocs";
private static final String NODE_DATA = "data";
private static final String JSON_FORMAT = "?format=json";
public CreateFileFromTemplateOperation(String path, int templateId) {
this.path = path;
this.templateId = templateId;
}
protected RemoteOperationResult run(OwnCloudClient client) {
RemoteOperationResult result;
PostMethod postMethod = null;
try {
postMethod = new PostMethod(client.getBaseUri() + NEW_FROM_TEMPLATE_URL + JSON_FORMAT);
postMethod.setParameter("path", path);
postMethod.setParameter("template", String.valueOf(templateId));
// remote request
postMethod.addRequestHeader(OCS_API_HEADER, OCS_API_HEADER_VALUE);
int status = client.executeMethod(postMethod, SYNC_READ_TIMEOUT, SYNC_CONNECTION_TIMEOUT);
if (status == HttpStatus.SC_OK) {
String response = postMethod.getResponseBodyAsString();
// Parse the response
JSONObject respJSON = new JSONObject(response);
String url = respJSON.getJSONObject(NODE_OCS).getJSONObject(NODE_DATA).getString("url");
ArrayList<Object> templateArray = new ArrayList<>();
templateArray.add(url);
result = new RemoteOperationResult(true, postMethod);
result.setData(templateArray);
} else {
result = new RemoteOperationResult(false, postMethod);
client.exhaustResponse(postMethod.getResponseBodyAsStream());
}
} catch (Exception e) {
result = new RemoteOperationResult(e);
Log_OC.e(TAG, "Create file from template " + templateId + " failed: " + result.getLogMessage(),
result.getException());
} finally {
if (postMethod != null) {
postMethod.releaseConnection();
}
}
return result;
}
}
@@ -0,0 +1,105 @@
/*
* Nextcloud Android client application
*
* @author Tobias Kaminsky
* Copyright (C) 2018 Tobias Kaminsky
* Copyright (C) 2018 Nextcloud GmbH.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.owncloud.android.files;
import com.owncloud.android.datamodel.Template;
import com.owncloud.android.lib.common.OwnCloudClient;
import com.owncloud.android.lib.common.operations.RemoteOperation;
import com.owncloud.android.lib.common.operations.RemoteOperationResult;
import com.owncloud.android.lib.common.utils.Log_OC;
import com.owncloud.android.ui.dialog.ChooseTemplateDialogFragment;
import org.apache.commons.httpclient.HttpStatus;
import org.apache.commons.httpclient.methods.GetMethod;
import org.json.JSONArray;
import org.json.JSONObject;
import java.util.ArrayList;
import java.util.Locale;
public class FetchTemplateOperation extends RemoteOperation {
private static final String TAG = FetchTemplateOperation.class.getSimpleName();
private static final int SYNC_READ_TIMEOUT = 40000;
private static final int SYNC_CONNECTION_TIMEOUT = 5000;
private static final String TEMPLATE_URL = "/ocs/v2.php/apps/richdocuments/api/v1/templates/";
private ChooseTemplateDialogFragment.Type type;
// JSON node names
private static final String NODE_OCS = "ocs";
private static final String NODE_DATA = "data";
private static final String JSON_FORMAT = "?format=json";
public FetchTemplateOperation(ChooseTemplateDialogFragment.Type type) {
this.type = type;
}
protected RemoteOperationResult run(OwnCloudClient client) {
RemoteOperationResult result;
GetMethod getMethod = null;
try {
getMethod = new GetMethod(client.getBaseUri() + TEMPLATE_URL + type.toString().toLowerCase(Locale.ENGLISH) +
JSON_FORMAT);
// remote request
getMethod.addRequestHeader(OCS_API_HEADER, OCS_API_HEADER_VALUE);
int status = client.executeMethod(getMethod, SYNC_READ_TIMEOUT, SYNC_CONNECTION_TIMEOUT);
if (status == HttpStatus.SC_OK) {
String response = getMethod.getResponseBodyAsString();
// Parse the response
JSONObject respJSON = new JSONObject(response);
JSONArray templates = respJSON.getJSONObject(NODE_OCS).getJSONArray(NODE_DATA);
ArrayList<Object> templateArray = new ArrayList<>();
for (int i = 0; i < templates.length(); i++) {
JSONObject templateObject = templates.getJSONObject(i);
templateArray.add(new Template(templateObject.getInt("id"),
templateObject.getString("name"),
templateObject.optString("preview"),
templateObject.getString("type"),
templateObject.getString("extension")));
}
result = new RemoteOperationResult(true, getMethod);
result.setData(templateArray);
} else {
result = new RemoteOperationResult(false, getMethod);
client.exhaustResponse(getMethod.getResponseBodyAsStream());
}
} catch (Exception e) {
result = new RemoteOperationResult(e);
Log_OC.e(TAG, "Get templates for typ " + type + " failed: " + result.getLogMessage(),
result.getException());
} finally {
if (getMethod != null) {
getMethod.releaseConnection();
}
}
return result;
}
}
@@ -34,6 +34,7 @@ import com.owncloud.android.files.services.FileUploader.FileUploaderBinder;
import com.owncloud.android.lib.resources.status.OCCapability;
import com.owncloud.android.services.OperationsService.OperationsServiceBinder;
import com.owncloud.android.ui.activity.ComponentsGetter;
import com.owncloud.android.ui.activity.RichDocumentsWebView;
import com.owncloud.android.utils.MimeTypeUtil;
import java.util.ArrayList;
@@ -44,7 +45,7 @@ import java.util.List;
/**
* Filters out the file actions available in a given {@link Menu} for a given {@link OCFile}
* according to the current state of the latest.
* according to the current state of the latest.
*/
public class FileMenuFilter {
@@ -177,19 +178,19 @@ public class FileMenuFilter {
filterSync(toShow, toHide, synchronizing);
filterShareFile(toShow, toHide, capability);
filterDetails(toShow, toHide);
filterKeepAvailableOffline(toShow, toHide, synchronizing);
filterDontKeepAvailableOffline(toShow, toHide, synchronizing);
filterFavorite(toShow, toHide, synchronizing);
filterUnfavorite(toShow, toHide, synchronizing);
filterEncrypt(toShow, toHide, endToEndEncryptionEnabled);
filterUnsetEncrypted(toShow, toHide, endToEndEncryptionEnabled);
filterSetPictureAs(toShow, toHide);
filterStream(toShow, toHide);
filterOpenAsRichDocument(toShow, toHide, capability);
}
private void filterShareFile(List<Integer> toShow, List<Integer> toHide, OCCapability capability) {
if (containsEncryptedFile() || (!isShareViaLinkAllowed() && !isShareWithUsersAllowed()) ||
!isSingleSelection() || !isShareApiEnabled(capability) || mOverflowMenu) {
!isSingleSelection() || !isShareApiEnabled(capability) || !mFiles.iterator().next().canReshare()
|| mOverflowMenu) {
toHide.add(R.id.action_send_share_file);
} else {
toShow.add(R.id.action_send_share_file);
@@ -204,22 +205,6 @@ public class FileMenuFilter {
}
}
private void filterKeepAvailableOffline(List<Integer> toShow, List<Integer> toHide, boolean synchronizing) {
if (!allFiles() || synchronizing || allKeptAvailableOffline()) {
toHide.add(R.id.action_keep_files_offline);
} else {
toShow.add(R.id.action_keep_files_offline);
}
}
private void filterDontKeepAvailableOffline(List<Integer> toShow, List<Integer> toHide, boolean synchronizing) {
if (!allFiles() || synchronizing || allNotKeptAvailableOffline()) {
toHide.add(R.id.action_unset_keep_files_offline);
} else {
toShow.add(R.id.action_unset_keep_files_offline);
}
}
private void filterFavorite(List<Integer> toShow, List<Integer> toHide, boolean synchronizing) {
if (mFiles.isEmpty() || synchronizing || allFavorites()) {
toHide.add(R.id.action_favorite);
@@ -262,6 +247,16 @@ public class FileMenuFilter {
}
}
private void filterOpenAsRichDocument(List<Integer> toShow, List<Integer> toHide, OCCapability capability) {
if (isSingleFile() && android.os.Build.VERSION.SDK_INT >= RichDocumentsWebView.MINIMUM_API &&
capability.getRichDocumentsMimeTypeList().contains(mFiles.iterator().next().getMimeType()) &&
capability.getRichDocumentsDirectEditing().isTrue()) {
toShow.add(R.id.action_open_file_as_richdocument);
} else {
toHide.add(R.id.action_open_file_as_richdocument);
}
}
private void filterSync(List<Integer> toShow, List<Integer> toHide, boolean synchronizing) {
if (mFiles.isEmpty() || (!anyFileDown() && !containsFolder()) || synchronizing) {
toHide.add(R.id.action_sync_file);
@@ -484,18 +479,9 @@ public class FileMenuFilter {
return false;
}
private boolean allKeptAvailableOffline() {
for (OCFile file : mFiles) {
if (!file.isAvailableOffline()) {
return false;
}
}
return true;
}
private boolean allFavorites() {
for (OCFile file : mFiles) {
if (!file.getIsFavorite()) {
if (!file.isFavorite()) {
return false;
}
}
@@ -504,16 +490,7 @@ public class FileMenuFilter {
private boolean allNotFavorites() {
for (OCFile file : mFiles) {
if (file.getIsFavorite()) {
return false;
}
}
return true;
}
private boolean allNotKeptAvailableOffline() {
for (OCFile file : mFiles) {
if (file.isAvailableOffline()) {
if (file.isFavorite()) {
return false;
}
}
@@ -36,7 +36,6 @@ import android.os.IBinder;
import android.os.Looper;
import android.os.Message;
import android.os.Process;
import android.support.v4.app.NotificationCompat;
import android.util.Pair;
import com.owncloud.android.R;
@@ -70,6 +69,8 @@ import java.util.Iterator;
import java.util.Map;
import java.util.Vector;
import androidx.core.app.NotificationCompat;
public class FileDownloader extends Service
implements OnDatatransferProgressListener, OnAccountsUpdateListener {
@@ -321,10 +322,7 @@ public class FileDownloader extends Service
* @param file A file that could be in the queue of downloads.
*/
public boolean isDownloading(Account account, OCFile file) {
if (account == null || file == null) {
return false;
}
return (mPendingDownloads.contains(account.name, file.getRemotePath()));
return account != null && file != null && mPendingDownloads.contains(account.name, file.getRemotePath());
}
@@ -495,11 +493,11 @@ public class FileDownloader extends Service
long syncDate = System.currentTimeMillis();
file.setLastSyncDateForProperties(syncDate);
file.setLastSyncDateForData(syncDate);
file.setNeedsUpdateThumbnail(true);
file.setUpdateThumbnailNeeded(true);
file.setModificationTimestamp(mCurrentDownload.getModificationTimestamp());
file.setModificationTimestampAtLastSyncForData(mCurrentDownload.getModificationTimestamp());
file.setEtag(mCurrentDownload.getEtag());
file.setMimetype(mCurrentDownload.getMimeType());
file.setMimeType(mCurrentDownload.getMimeType());
file.setStoragePath(mCurrentDownload.getSavePath());
file.setFileLength(new File(mCurrentDownload.getSavePath()).length());
file.setRemoteId(mCurrentDownload.getFile().getRemoteId());
@@ -531,7 +529,7 @@ public class FileDownloader extends Service
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.O) {
mNotificationBuilder.setChannelId(NotificationUtils.NOTIFICATION_CHANNEL_DOWNLOAD);
}
/// includes a pending intent in the notification showing the details view of the file
Intent showDetailsIntent = null;
if (PreviewImageFragment.canBePreviewed(download.getFile())) {
@@ -572,7 +570,7 @@ public class FileDownloader extends Service
if (mNotificationManager == null) {
mNotificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
}
if (mNotificationManager != null) {
mNotificationManager.notify(R.string.downloader_download_in_progress_ticker,
mNotificationBuilder.build());
@@ -599,8 +597,8 @@ public class FileDownloader extends Service
}
if (!downloadResult.isCancelled()) {
int tickerId = (downloadResult.isSuccess()) ? R.string.downloader_download_succeeded_ticker :
R.string.downloader_download_failed_ticker;
int tickerId = downloadResult.isSuccess() ?
R.string.downloader_download_succeeded_ticker : R.string.downloader_download_failed_ticker;
boolean needsToUpdateCredentials = ResultCode.UNAUTHORIZED.equals(downloadResult.getCode());
tickerId = needsToUpdateCredentials ?
@@ -42,7 +42,6 @@ import android.os.Looper;
import android.os.Message;
import android.os.Parcelable;
import android.os.Process;
import android.support.v4.app.NotificationCompat;
import android.util.Pair;
import com.evernote.android.job.JobRequest;
@@ -84,6 +83,8 @@ import java.util.Vector;
import javax.annotation.Nullable;
import androidx.core.app.NotificationCompat;
/**
* Service for uploading files. Invoke using context.startService(...).
*
@@ -525,7 +526,7 @@ public class FileUploader extends Service
Log_OC.d(TAG, "Starting command with id " + startId);
startForeground(FOREGROUND_SERVICE_ID, mNotification);
if (intent == null) {
Log_OC.e(TAG, "Intent is null");
return Service.START_NOT_STICKY;
@@ -961,15 +962,15 @@ public class FileUploader extends Service
totalToTransfer, fileName);
if (MainApp.getAppContext() != null) {
if (mCurrentUpload.getIsWifiRequired() && !Device.getNetworkType(MainApp.getAppContext()).
if (mCurrentUpload.isWifiRequired() && !Device.getNetworkType(MainApp.getAppContext()).
equals(JobRequest.NetworkType.UNMETERED)) {
cancel(mCurrentUpload.getAccount().name, mCurrentUpload.getFile().getRemotePath()
, ResultCode.DELAYED_FOR_WIFI);
} else if (mCurrentUpload.getIsChargingRequired() &&
} else if (mCurrentUpload.isChargingRequired() &&
!Device.getBatteryStatus(MainApp.getAppContext()).isCharging()) {
cancel(mCurrentUpload.getAccount().name, mCurrentUpload.getFile().getRemotePath()
, ResultCode.DELAYED_FOR_CHARGING);
} else if (!mCurrentUpload.getIsIgnoringPowerSaveMode() &&
} else if (!mCurrentUpload.isIgnoringPowerSaveMode() &&
PowerUtils.isPowerSaveMode(MainApp.getAppContext())) {
cancel(mCurrentUpload.getAccount().name, mCurrentUpload.getFile().getRemotePath()
, ResultCode.DELAYED_IN_POWER_SAVE_MODE);
@@ -1166,7 +1167,7 @@ public class FileUploader extends Service
if (mNotificationManager == null) {
mNotificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
}
mNotificationManager.notify(R.string.uploader_upload_in_progress_ticker, mNotificationBuilder.build());
} // else wait until the upload really start (onTransferProgress is called), so that if it's discarded
// due to lack of Wifi, no notification is shown
@@ -26,7 +26,6 @@ import android.accounts.AccountManager;
import android.accounts.AccountManagerCallback;
import android.accounts.AccountManagerFuture;
import android.content.Context;
import android.support.annotation.NonNull;
import com.evernote.android.job.Job;
import com.evernote.android.job.util.support.PersistableBundleCompat;
@@ -50,6 +49,8 @@ import java.io.File;
import java.util.ArrayList;
import java.util.List;
import androidx.annotation.NonNull;
import static android.content.Context.ACCOUNT_SERVICE;
import static com.owncloud.android.ui.activity.ManageAccountsActivity.PENDING_FOR_REMOVAL;
@@ -119,7 +120,7 @@ public class AccountRemovalJob extends Job implements AccountManagerCallback<Boo
filesystemDataProvider.deleteAllEntriesForSyncedFolder(Long.toString(syncedFolderId));
}
// delete stored E2E keys
// delete stored E2E keys
arbitraryDataProvider.deleteKeyForAccount(account.name, EncryptionUtils.PRIVATE_KEY);
arbitraryDataProvider.deleteKeyForAccount(account.name, EncryptionUtils.PUBLIC_KEY);
@@ -30,7 +30,6 @@ import android.database.Cursor;
import android.net.Uri;
import android.os.IBinder;
import android.provider.ContactsContract;
import android.support.annotation.NonNull;
import android.text.format.DateFormat;
import com.evernote.android.job.Job;
@@ -56,6 +55,8 @@ import java.util.ArrayList;
import java.util.Calendar;
import java.util.List;
import androidx.annotation.NonNull;
/**
* Job that backup contacts to /Contacts-Backup and deletes files older than x days
*/
@@ -4,17 +4,17 @@
* @author Tobias Kaminsky
* Copyright (C) 2017 Tobias Kaminsky
* Copyright (C) 2017 Nextcloud GmbH.
*
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
@@ -24,7 +24,6 @@ package com.owncloud.android.jobs;
import android.database.Cursor;
import android.net.Uri;
import android.provider.ContactsContract;
import android.support.annotation.NonNull;
import com.evernote.android.job.Job;
import com.evernote.android.job.util.support.PersistableBundleCompat;
@@ -38,6 +37,7 @@ import java.util.ArrayList;
import java.util.Collections;
import java.util.TreeMap;
import androidx.annotation.NonNull;
import ezvcard.Ezvcard;
import ezvcard.VCard;
import third_parties.ezvcard_android.ContactOperations;
@@ -88,8 +88,8 @@ public class ContactsImportJob extends Job {
}
for (int i = 0; i < intArray.length; i++) {
VCard vCard = vCards.get(intArray[i]);
for (int checkedItem : intArray) {
VCard vCard = vCards.get(checkedItem);
if (ContactListFragment.getDisplayName(vCard).length() != 0) {
if (!ownContactList.containsKey(vCard)) {
operations.insertContact(vCard);
@@ -27,8 +27,6 @@ import android.content.Context;
import android.content.res.Resources;
import android.os.Build;
import android.os.PowerManager;
import android.support.annotation.NonNull;
import android.support.media.ExifInterface;
import android.text.TextUtils;
import com.evernote.android.job.Job;
@@ -58,6 +56,9 @@ import java.util.Date;
import java.util.Locale;
import java.util.TimeZone;
import androidx.annotation.NonNull;
import androidx.exifinterface.media.ExifInterface;
/*
Job that:
- restarts existing jobs if required
@@ -68,6 +69,7 @@ public class FilesSyncJob extends Job {
public static final String TAG = "FilesSyncJob";
public static final String SKIP_CUSTOM = "skipCustom";
public static final String OVERRIDE_POWER_SAVING = "overridePowerSaving";
private static final String WAKELOCK_TAG_SEPARATION = ":";
@NonNull
@Override
@@ -77,8 +79,9 @@ public class FilesSyncJob extends Job {
if (android.os.Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
PowerManager powerManager = (PowerManager) context.getSystemService(Context.POWER_SERVICE);
wakeLock = powerManager.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, TAG);
wakeLock.acquire();
wakeLock = powerManager.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, MainApp.getAuthority() +
WAKELOCK_TAG_SEPARATION + TAG);
wakeLock.acquire(10 * 60 * 1000);
}
PersistableBundleCompat bundle = params.getExtras();
@@ -130,18 +133,23 @@ public class FilesSyncJob extends Job {
Integer uploadAction;
boolean needsCharging;
boolean needsWifi;
File file;
ArbitraryDataProvider arbitraryDataProvider;
Account account = AccountUtils.getOwnCloudAccountByName(context, syncedFolder.getAccount());
if (lightVersion) {
arbitraryDataProvider = new ArbitraryDataProvider(context.getContentResolver());
} else {
arbitraryDataProvider = null;
}
for (String path : filesystemDataProvider.getFilesForUpload(syncedFolder.getLocalPath(),
Long.toString(syncedFolder.getId()))) {
File file = new File(path);
file = new File(path);
Long lastModificationTime = calculateLastModificationTime(file, syncedFolder, sFormatter);
String mimeType = MimeTypeUtil.getBestMimeTypeByFilename(file.getAbsolutePath());
if (lightVersion) {
ArbitraryDataProvider arbitraryDataProvider = new ArbitraryDataProvider(
context.getContentResolver());
needsCharging = resources.getBoolean(R.bool.syncedFolder_light_on_charging);
needsWifi = account == null || arbitraryDataProvider.getBooleanValue(account.name,
Preferences.SYNCED_FOLDER_LIGHT_UPLOAD_ON_WIFI);
@@ -30,8 +30,6 @@ import android.content.Context;
import android.content.Intent;
import android.graphics.BitmapFactory;
import android.media.RingtoneManager;
import android.support.annotation.NonNull;
import android.support.v4.app.NotificationCompat;
import android.text.TextUtils;
import com.evernote.android.job.Job;
@@ -51,6 +49,9 @@ import com.owncloud.android.utils.ThemeUtils;
import java.util.ArrayList;
import java.util.List;
import androidx.annotation.NonNull;
import androidx.core.app.NotificationCompat;
public class MediaFoldersDetectionJob extends Job {
public static final String TAG = "MediaFoldersDetectionJob";
@@ -71,10 +72,8 @@ public class MediaFoldersDetectionJob extends Job {
String arbitraryDataString;
MediaFoldersModel mediaFoldersModel;
List<MediaFolder> imageMediaFolders = MediaProvider.getImageFolders(contentResolver, 1,
null, true);
List<MediaFolder> videoMediaFolders = MediaProvider.getVideoFolders(contentResolver, 1, null,
true);
List<MediaFolder> imageMediaFolders = MediaProvider.getImageFolders(contentResolver, 1, null, true);
List<MediaFolder> videoMediaFolders = MediaProvider.getVideoFolders(contentResolver, 1, null, true);
List<String> imageMediaFolderPaths = new ArrayList<>();
List<String> videoMediaFolderPaths = new ArrayList<>();
@@ -109,24 +108,22 @@ public class MediaFoldersDetectionJob extends Job {
for (Account account : accountList) {
for (String imageMediaFolder : imageMediaFolderPaths) {
if (syncedFolderProvider.findByLocalPathAndAccount(imageMediaFolder,
account) == null) {
if (syncedFolderProvider.findByLocalPathAndAccount(imageMediaFolder, account) == null) {
sendNotification(String.format(context.getString(R.string.new_media_folder_detected),
context.getString(R.string.new_media_folder_photos)),
imageMediaFolder.substring(imageMediaFolder.lastIndexOf('/') + 1,
imageMediaFolder.length()),
account, imageMediaFolder, 1);
imageMediaFolder.substring(imageMediaFolder.lastIndexOf('/') + 1
),
account, imageMediaFolder, 1);
}
}
for (String videoMediaFolder : videoMediaFolderPaths) {
if (syncedFolderProvider.findByLocalPathAndAccount(videoMediaFolder,
account) == null) {
if (syncedFolderProvider.findByLocalPathAndAccount(videoMediaFolder, account) == null) {
sendNotification(String.format(context.getString(R.string.new_media_folder_detected),
context.getString(R.string.new_media_folder_videos)),
videoMediaFolder.substring(videoMediaFolder.lastIndexOf('/') + 1,
videoMediaFolder.length()),
account, videoMediaFolder, 2);
videoMediaFolder.substring(videoMediaFolder.lastIndexOf('/') + 1
),
account, videoMediaFolder, 2);
}
}
}
@@ -134,14 +131,14 @@ public class MediaFoldersDetectionJob extends Job {
} else {
mediaFoldersModel = new MediaFoldersModel(imageMediaFolderPaths, videoMediaFolderPaths);
arbitraryDataProvider.storeOrUpdateKeyValue(ACCOUNT_NAME_GLOBAL, KEY_MEDIA_FOLDERS, gson.toJson(mediaFoldersModel));
arbitraryDataProvider.storeOrUpdateKeyValue(ACCOUNT_NAME_GLOBAL, KEY_MEDIA_FOLDERS,
gson.toJson(mediaFoldersModel));
}
return Result.SUCCESS;
}
private void sendNotification(String contentTitle, String subtitle, Account account,
String path, int type) {
private void sendNotification(String contentTitle, String subtitle, Account account, String path, int type) {
Context context = getContext();
Intent intent = new Intent(getContext(), SyncedFoldersActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
@@ -24,7 +24,6 @@ package com.owncloud.android.jobs;
import android.app.job.JobParameters;
import android.app.job.JobService;
import android.os.Build;
import android.support.annotation.RequiresApi;
import com.evernote.android.job.JobRequest;
import com.evernote.android.job.util.support.PersistableBundleCompat;
@@ -32,6 +31,8 @@ import com.owncloud.android.datamodel.SyncedFolderProvider;
import com.owncloud.android.utils.FilesSyncHelper;
import com.owncloud.android.utils.PowerUtils;
import androidx.annotation.RequiresApi;
/*
Job that triggers new FilesSyncJob in case new photo or video were detected
and starts a job to find new media folders
@@ -27,8 +27,6 @@ import android.content.Context;
import android.content.Intent;
import android.graphics.BitmapFactory;
import android.media.RingtoneManager;
import android.support.annotation.NonNull;
import android.support.v4.app.NotificationCompat;
import android.text.TextUtils;
import android.util.Base64;
import android.util.Log;
@@ -51,6 +49,9 @@ import java.security.PrivateKey;
import javax.crypto.Cipher;
import javax.crypto.NoSuchPaddingException;
import androidx.annotation.NonNull;
import androidx.core.app.NotificationCompat;
public class NotificationJob extends Job {
public static final String TAG = "NotificationJob";
@@ -21,11 +21,8 @@ package com.owncloud.android.jobs;
import android.accounts.Account;
import android.content.Context;
import android.content.Intent;
import android.database.Cursor;
import android.os.Build;
import android.os.PowerManager;
import android.support.annotation.NonNull;
import com.evernote.android.job.Job;
import com.evernote.android.job.JobManager;
@@ -35,26 +32,28 @@ import com.owncloud.android.MainApp;
import com.owncloud.android.authentication.AccountUtils;
import com.owncloud.android.datamodel.FileDataStorageManager;
import com.owncloud.android.datamodel.OCFile;
import com.owncloud.android.db.ProviderMeta;
import com.owncloud.android.lib.common.operations.RemoteOperationResult;
import com.owncloud.android.lib.common.utils.Log_OC;
import com.owncloud.android.lib.resources.files.CheckEtagRemoteOperation;
import com.owncloud.android.operations.SynchronizeFileOperation;
import com.owncloud.android.ui.activity.ConflictsResolveActivity;
import com.owncloud.android.utils.ConnectivityUtils;
import com.owncloud.android.utils.FileStorageUtils;
import com.owncloud.android.utils.PowerUtils;
import java.util.ArrayList;
import java.util.List;
import java.io.File;
import java.util.Set;
import androidx.annotation.NonNull;
public class OfflineSyncJob extends Job {
public static final String TAG = "OfflineSyncJob";
private List<OfflineFile> offlineFileList = new ArrayList<>();
private static final String WAKELOCK_TAG_SEPARATION = ":";
@NonNull
@Override
protected Result onRunJob(@NonNull Params params) {
final Context context = MainApp.getAppContext();
final Context context = getContext();
PowerManager.WakeLock wakeLock = null;
if (!PowerUtils.isPowerSaveMode(context) &&
@@ -69,57 +68,27 @@ public class OfflineSyncJob extends Job {
if (android.os.Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
PowerManager powerManager = (PowerManager) context.getSystemService(Context.POWER_SERVICE);
wakeLock = powerManager.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, TAG);
wakeLock.acquire();
if (powerManager != null) {
wakeLock = powerManager.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, MainApp.getAuthority() +
WAKELOCK_TAG_SEPARATION + TAG);
wakeLock.acquire(10 * 60 * 1000);
}
}
Cursor cursorOnKeptInSync = context.getContentResolver().query(
ProviderMeta.ProviderTableMeta.CONTENT_URI,
null,
ProviderMeta.ProviderTableMeta.FILE_KEEP_IN_SYNC + " = ?",
new String[]{String.valueOf(1)},
null
);
Account[] accounts = AccountUtils.getAccounts(context);
if (cursorOnKeptInSync != null) {
if (cursorOnKeptInSync.moveToFirst()) {
for (Account account : accounts) {
FileDataStorageManager storageManager = new FileDataStorageManager(account,
getContext().getContentResolver());
String localPath = "";
String accountName = "";
Account account = null;
do {
localPath = cursorOnKeptInSync.getString(cursorOnKeptInSync
.getColumnIndex(ProviderMeta.ProviderTableMeta.FILE_STORAGE_PATH));
accountName = cursorOnKeptInSync.getString(cursorOnKeptInSync
.getColumnIndex(ProviderMeta.ProviderTableMeta.FILE_ACCOUNT_OWNER));
account = new Account(accountName, MainApp.getAccountType(getContext()));
if (!AccountUtils.exists(account, context) || localPath == null || localPath.length() <= 0) {
continue;
}
offlineFileList.add(new OfflineFile(localPath, account));
} while (cursorOnKeptInSync.moveToNext());
OCFile ocRoot = storageManager.getFileByPath("/");
if (ocRoot.getStoragePath() == null) {
break;
}
cursorOnKeptInSync.close();
}
FileDataStorageManager storageManager;
for (OfflineFile offlineFile : offlineFileList) {
storageManager = new FileDataStorageManager(offlineFile.getAccount(), context.getContentResolver());
OCFile file = storageManager.getFileByLocalPath(offlineFile.getLocalPath());
SynchronizeFileOperation sfo =
new SynchronizeFileOperation(file, null, offlineFile.getAccount(), true, context);
RemoteOperationResult result = sfo.execute(storageManager, context);
if (result.getCode() == RemoteOperationResult.ResultCode.SYNC_CONFLICT) {
Intent i = new Intent(context, ConflictsResolveActivity.class);
i.setFlags(i.getFlags() | Intent.FLAG_ACTIVITY_NEW_TASK);
i.putExtra(ConflictsResolveActivity.EXTRA_FILE, file);
i.putExtra(ConflictsResolveActivity.EXTRA_ACCOUNT, offlineFile.getAccount());
context.startActivity(i);
}
recursive(new File(ocRoot.getStoragePath()), storageManager, account);
}
if (wakeLock != null) {
@@ -130,30 +99,72 @@ public class OfflineSyncJob extends Job {
return Result.SUCCESS;
}
private void recursive(File folder, FileDataStorageManager storageManager, Account account) {
String downloadFolder = FileStorageUtils.getSavePath(account.name);
String folderName = folder.getAbsolutePath().replaceFirst(downloadFolder, "") + "/";
Log_OC.d(TAG, folderName + ": enter");
private class OfflineFile {
private String localPath;
private Account account;
private OfflineFile(String localPath, Account account) {
this.localPath = localPath;
this.account = account;
// exit
if (folder.listFiles() == null) {
return;
}
public String getLocalPath() {
return localPath;
OCFile ocFolder = storageManager.getFileByPath(folderName);
Log_OC.d(TAG, folderName + ": currentEtag: " + ocFolder.getEtag());
// check for etag change, if false, skip
CheckEtagRemoteOperation checkEtagOperation = new CheckEtagRemoteOperation(ocFolder.getRemotePath(),
ocFolder.getEtagOnServer());
RemoteOperationResult result = checkEtagOperation.execute(account, getContext());
// eTag changed, sync file
switch (result.getCode()) {
case ETAG_UNCHANGED:
Log_OC.d(TAG, folderName + ": eTag unchanged");
return;
case FILE_NOT_FOUND:
boolean removalResult = storageManager.removeFolder(ocFolder, true, true);
if (!removalResult) {
Log_OC.e(TAG, "removal of " + ocFolder.getStoragePath() + " failed: file not found");
}
return;
default:
case ETAG_CHANGED:
Log_OC.d(TAG, folderName + ": eTag changed");
break;
}
public void setLocalPath(String localPath) {
this.localPath = localPath;
// iterate over downloaded files
File[] files = folder.listFiles(File::isFile);
if (files != null) {
for (File file : files) {
OCFile ocFile = storageManager.getFileByLocalPath(file.getPath());
SynchronizeFileOperation synchronizeFileOperation = new SynchronizeFileOperation(ocFile.getRemotePath(),
account, true, getContext());
synchronizeFileOperation.execute(storageManager, getContext());
}
}
public Account getAccount() {
return account;
// recursive into folder
File[] subfolders = folder.listFiles(File::isDirectory);
if (subfolders != null) {
for (File subfolder : subfolders) {
recursive(subfolder, storageManager, account);
}
}
public void setAccount(Account account) {
this.account = account;
// update eTag
try {
String updatedEtag = (String) result.getData().get(0);
ocFolder.setEtagOnServer(updatedEtag);
storageManager.saveFile(ocFolder);
} catch (Exception e) {
Log_OC.e(TAG, "Failed to update etag on " + folder.getAbsolutePath(), e);
}
}
}
@@ -41,7 +41,6 @@ import android.net.wifi.WifiManager.WifiLock;
import android.os.AsyncTask;
import android.os.IBinder;
import android.os.PowerManager;
import android.support.v4.app.NotificationCompat;
import android.widget.Toast;
import com.owncloud.android.R;
@@ -61,9 +60,11 @@ import com.owncloud.android.utils.ThemeUtils;
import java.io.IOException;
import java.lang.ref.WeakReference;
import androidx.core.app.NotificationCompat;
/**
* Service that handles media playback, both audio and video.
* Service that handles media playback, both audio and video.
*
* Waits for Intents which signal the service to perform specific operations: Play, Pause,
* Rewind, etc.
@@ -181,14 +182,14 @@ public class MediaService extends Service implements OnCompletionListener, OnPre
} else if (extra == MediaPlayer.MEDIA_ERROR_IO) {
/* Added in API level 17
File or network related operation errors.
Constant Value: -1004 (0xfffffc14)
Constant Value: -1004 (0xfffffc14)
*/
messageId = R.string.media_err_io;
} else if (extra == MediaPlayer.MEDIA_ERROR_MALFORMED) {
/* Added in API level 17
Bitstream is not conforming to the related coding standard or file spec.
Constant Value: -1007 (0xfffffc11)
Constant Value: -1007 (0xfffffc11)
*/
messageId = R.string.media_err_malformed;
@@ -217,7 +218,7 @@ public class MediaService extends Service implements OnCompletionListener, OnPre
Added in API level 1
Media server died. In this case, the application must release the MediaPlayer
object and instantiate a new one.
Constant Value: 100 (0x00000064)
Constant Value: 100 (0x00000064)
*/
messageId = R.string.media_err_unknown;
}
@@ -268,9 +269,9 @@ public class MediaService extends Service implements OnCompletionListener, OnPre
/**
* Processes a request to play a media file received as a parameter
*
* TODO If a new request is received when a file is being prepared, it is ignored. Is this what we want?
* TODO If a new request is received when a file is being prepared, it is ignored. Is this what we want?
*
* @param intent Intent received in the request with the data to identify the file to play.
* @param intent Intent received in the request with the data to identify the file to play.
*/
private void processPlayFileRequest(Intent intent) {
if (mState != State.PREPARING) {
@@ -327,7 +328,7 @@ public class MediaService extends Service implements OnCompletionListener, OnPre
}
/**
* Processes a request to pause the current playback
* Processes a request to pause the current playback
*/
protected void processPauseRequest() {
if (mState == State.PLAYING) {
@@ -393,7 +394,7 @@ public class MediaService extends Service implements OnCompletionListener, OnPre
/**
* Reconfigures MediaPlayer according to audio focus settings and starts/restarts it.
* Reconfigures MediaPlayer according to audio focus settings and starts/restarts it.
*/
protected void configAndStartMediaPlayer() {
if (mPlayer == null) {
@@ -421,7 +422,7 @@ public class MediaService extends Service implements OnCompletionListener, OnPre
/**
* Requests the audio focus to the Audio Manager
* Requests the audio focus to the Audio Manager
*/
private void tryToGetAudioFocus() {
if (mAudioFocus != AudioFocus.FOCUS
@@ -436,7 +437,7 @@ public class MediaService extends Service implements OnCompletionListener, OnPre
/**
* Starts playing the current media file.
* Starts playing the current media file.
*/
protected void playMedia() {
mState = State.STOPPED;
@@ -501,7 +502,7 @@ public class MediaService extends Service implements OnCompletionListener, OnPre
/**
* Called when media player is done preparing.
* Called when media player is done preparing.
*
* Time to start.
*/
@@ -589,7 +590,7 @@ public class MediaService extends Service implements OnCompletionListener, OnPre
}
/**
* Called when there's an error playing media.
* Called when there's an error playing media.
*
* Warns the user about the error and resets the media player.
*/
@@ -646,7 +647,7 @@ public class MediaService extends Service implements OnCompletionListener, OnPre
/**
* Provides a binder object that clients can use to perform operations on the MediaPlayer managed by the MediaService.
* Provides a binder object that clients can use to perform operations on the MediaPlayer managed by the MediaService.
*/
@Override
public IBinder onBind(Intent arg) {
@@ -671,7 +672,7 @@ public class MediaService extends Service implements OnCompletionListener, OnPre
/**
* Accesses the current MediaPlayer instance in the service.
*
* To be handled carefully. Visibility is protected to be accessed only
* To be handled carefully. Visibility is protected to be accessed only
*
* @return Current MediaPlayer instance handled by MediaService.
*/
@@ -21,38 +21,18 @@
package com.owncloud.android.operations;
import android.util.Log;
import com.google.gson.GsonBuilder;
import com.owncloud.android.lib.common.OwnCloudClient;
import com.owncloud.android.lib.common.operations.RemoteOperationResult;
import com.owncloud.android.lib.common.utils.Log_OC;
import com.owncloud.android.lib.resources.comments.CommentFileRemoteOperation;
import com.owncloud.android.operations.common.SyncOperation;
import org.apache.commons.httpclient.HttpStatus;
import org.apache.commons.httpclient.methods.PostMethod;
import org.apache.commons.httpclient.methods.StringRequestEntity;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
/**
* Restore a {@link com.owncloud.android.lib.resources.files.FileVersion}.
* Comment file
*/
public class CommentFileOperation extends SyncOperation {
private static final String TAG = CommentFileOperation.class.getSimpleName();
private static final int POST_READ_TIMEOUT = 30000;
private static final int POST_CONNECTION_TIMEOUT = 5000;
private static final String ACTOR_ID = "actorId";
private static final String ACTOR_TYPE = "actorType";
private static final String ACTOR_TYPE_VALUE = "users";
private static final String VERB = "verb";
private static final String VERB_VALUE = "comment";
private static final String MESSAGE = "message";
private String message;
private String fileId;
private String userId;
@@ -76,37 +56,12 @@ public class CommentFileOperation extends SyncOperation {
*/
@Override
protected RemoteOperationResult run(OwnCloudClient client) {
RemoteOperationResult result = new CommentFileRemoteOperation(message, fileId, userId).execute(client, true);
RemoteOperationResult result;
try {
String url = client.getNewWebdavUri() + "/comments/files/" + fileId;
PostMethod postMethod = new PostMethod(url);
postMethod.addRequestHeader("Content-type", "application/json");
Map<String, String> values = new HashMap<>();
values.put(ACTOR_ID, userId);
values.put(ACTOR_TYPE, ACTOR_TYPE_VALUE);
values.put(VERB, VERB_VALUE);
values.put(MESSAGE, message);
String json = new GsonBuilder().create().toJson(values, Map.class);
postMethod.setRequestEntity(new StringRequestEntity(json));
int status = client.executeMethod(postMethod, POST_READ_TIMEOUT, POST_CONNECTION_TIMEOUT);
result = new RemoteOperationResult(isSuccess(status), postMethod);
client.exhaustResponse(postMethod.getResponseBodyAsStream());
} catch (IOException e) {
result = new RemoteOperationResult(e);
Log.e(TAG, "Post comment to file with id " + fileId + " failed: " + result.getLogMessage(), e);
if (!result.isSuccess()) {
Log_OC.e(this, "File with Id " + fileId + " could not be commented");
}
return result;
}
private boolean isSuccess(int status) {
return status == HttpStatus.SC_CREATED;
}
}
@@ -20,7 +20,7 @@ import com.owncloud.android.datamodel.OCFile;
import com.owncloud.android.lib.common.OwnCloudClient;
import com.owncloud.android.lib.common.operations.RemoteOperationResult;
import com.owncloud.android.lib.common.operations.RemoteOperationResult.ResultCode;
import com.owncloud.android.lib.resources.files.CopyRemoteFileOperation;
import com.owncloud.android.lib.resources.files.CopyFileRemoteOperation;
import com.owncloud.android.operations.common.SyncOperation;
@@ -74,13 +74,7 @@ public class CopyFileOperation extends SyncOperation {
if (mFile.isFolder()) {
targetPath += OCFile.PATH_SEPARATOR;
}
CopyRemoteFileOperation operation = new CopyRemoteFileOperation(
mSrcPath,
targetPath,
false
);
RemoteOperationResult result = operation.execute(client);
RemoteOperationResult result = new CopyFileRemoteOperation(mSrcPath, targetPath, false).execute(client);
/// 3. local copy
if (result.isSuccess()) {
@@ -27,9 +27,9 @@ import com.owncloud.android.lib.common.operations.OnRemoteOperationListener;
import com.owncloud.android.lib.common.operations.RemoteOperation;
import com.owncloud.android.lib.common.operations.RemoteOperationResult;
import com.owncloud.android.lib.common.utils.Log_OC;
import com.owncloud.android.lib.resources.files.CreateRemoteFolderOperation;
import com.owncloud.android.lib.resources.files.ReadRemoteFolderOperation;
import com.owncloud.android.lib.resources.files.RemoteFile;
import com.owncloud.android.lib.resources.files.CreateFolderRemoteOperation;
import com.owncloud.android.lib.resources.files.ReadFolderRemoteOperation;
import com.owncloud.android.lib.resources.files.model.RemoteFile;
import com.owncloud.android.operations.common.SyncOperation;
import com.owncloud.android.utils.FileStorageUtils;
import com.owncloud.android.utils.MimeType;
@@ -40,16 +40,16 @@ import com.owncloud.android.utils.MimeType;
* Save the new folder in Database
*/
public class CreateFolderOperation extends SyncOperation implements OnRemoteOperationListener{
private static final String TAG = CreateFolderOperation.class.getSimpleName();
protected String mRemotePath;
private boolean mCreateFullPath;
private RemoteFile createdRemoteFolder;
/**
* Constructor
*
*
* @param createFullPath 'True' means that all the ancestor folders should be created
* if don't exist yet.
*/
@@ -61,29 +61,28 @@ public class CreateFolderOperation extends SyncOperation implements OnRemoteOper
@Override
protected RemoteOperationResult run(OwnCloudClient client) {
CreateRemoteFolderOperation operation = new CreateRemoteFolderOperation(mRemotePath, mCreateFullPath);
RemoteOperationResult result = operation.execute(client, true);
RemoteOperationResult result = new CreateFolderRemoteOperation(mRemotePath, mCreateFullPath).execute(client);
if (result.isSuccess()) {
ReadRemoteFolderOperation remoteFolderOperation = new ReadRemoteFolderOperation(mRemotePath);
RemoteOperationResult remoteFolderOperationResult = remoteFolderOperation.execute(client, true);
RemoteOperationResult remoteFolderOperationResult = new ReadFolderRemoteOperation(mRemotePath)
.execute(client, true);
createdRemoteFolder = (RemoteFile) remoteFolderOperationResult.getData().get(0);
saveFolderInDB();
} else {
Log_OC.e(TAG, mRemotePath + " hasn't been created");
}
return result;
}
@Override
public void onRemoteOperationFinish(RemoteOperation operation, RemoteOperationResult result) {
if (operation instanceof CreateRemoteFolderOperation) {
if (operation instanceof CreateFolderRemoteOperation) {
onCreateRemoteFolderOperationFinish(result);
}
}
private void onCreateRemoteFolderOperationFinish(RemoteOperationResult result) {
if (result.isSuccess()) {
saveFolderInDB();
@@ -99,7 +98,7 @@ public class CreateFolderOperation extends SyncOperation implements OnRemoteOper
if (mCreateFullPath && getStorageManager().
getFileByPath(FileStorageUtils.getParentPath(mRemotePath)) == null){// When parent
// of remote path
// is not created
// is not created
String[] subFolders = mRemotePath.split("/");
String composedRemotePath = "/";
@@ -113,7 +112,7 @@ public class CreateFolderOperation extends SyncOperation implements OnRemoteOper
}
} else { // Create directory on DB
OCFile newDir = new OCFile(mRemotePath);
newDir.setMimetype(MimeType.DIRECTORY);
newDir.setMimeType(MimeType.DIRECTORY);
long parentId = getStorageManager().getFileByPath(FileStorageUtils.getParentPath(mRemotePath)).getFileId();
newDir.setParentId(parentId);
newDir.setRemoteId(createdRemoteFolder.getRemoteId());
@@ -89,7 +89,7 @@ public class CreateShareViaLinkOperation extends SyncOperation {
createOp.setGetShareDetails(true);
result = createOp.execute(client);
}
if (result.isSuccess()) {
if (result.getData().size() > 0) {
Object item = result.getData().get(0);
@@ -106,10 +106,10 @@ public class CreateShareViaLinkOperation extends SyncOperation {
result = new RemoteOperationResult(RemoteOperationResult.ResultCode.SHARE_NOT_FOUND);
}
}
return result;
}
public String getPath() {
return mPath;
}
@@ -128,12 +128,12 @@ public class CreateShareViaLinkOperation extends SyncOperation {
}
getStorageManager().saveShare(share);
// Update OCFile with data from share: ShareByLink and publicLink
OCFile file = getStorageManager().getFileByPath(mPath);
if (file!=null) {
file.setPublicLink(share.getShareLink());
file.setShareViaLink(true);
file.setSharedViaLink(true);
getStorageManager().saveFile(file);
}
}
@@ -1,4 +1,4 @@
/**
/*
* ownCloud Android client application
*
* @author masensio
@@ -31,6 +31,10 @@ import com.owncloud.android.lib.resources.shares.OCShare;
import com.owncloud.android.lib.resources.shares.ShareType;
import com.owncloud.android.operations.common.SyncOperation;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
/**
* Creates a new private share for a given file.
*/
@@ -43,6 +47,9 @@ public class CreateShareWithShareeOperation extends SyncOperation {
private ShareType mShareType;
private int mPermissions;
private static final List<ShareType> supportedShareTypes = new ArrayList<>(Arrays.asList(ShareType.USER,
ShareType.GROUP, ShareType.FEDERATED, ShareType.EMAIL, ShareType.ROOM));
/**
* Constructor.
*
@@ -54,8 +61,7 @@ public class CreateShareWithShareeOperation extends SyncOperation {
* https://doc.owncloud.org/server/8.2/developer_manual/core/ocs-share-api.html .
*/
public CreateShareWithShareeOperation(String path, String shareeName, ShareType shareType, int permissions) {
if (!ShareType.USER.equals(shareType) && !ShareType.GROUP.equals(shareType)
&& !ShareType.FEDERATED.equals(shareType) && !ShareType.EMAIL.equals(shareType)) {
if (!supportedShareTypes.contains(shareType)) {
throw new IllegalArgumentException("Illegal share type " + shareType);
}
mPath = path;
@@ -78,15 +84,15 @@ public class CreateShareWithShareeOperation extends SyncOperation {
operation.setGetShareDetails(true);
RemoteOperationResult result = operation.execute(client);
if (result.isSuccess() && result.getData().size() > 0) {
OCShare share = (OCShare) result.getData().get(0);
updateData(share);
}
return result;
}
public String getPath() {
return mPath;
}
@@ -97,13 +103,12 @@ public class CreateShareWithShareeOperation extends SyncOperation {
share.setIsFolder(mPath.endsWith(FileUtils.PATH_SEPARATOR));
getStorageManager().saveShare(share);
// Update OCFile with data from share: ShareByLink and publicLink
OCFile file = getStorageManager().getFileByPath(mPath);
if (file!=null) {
file.setShareWithSharee(true); // TODO - this should be done by the FileContentProvider, as part of getStorageManager().saveShare(share)
file.setSharedWithSharee(true); // TODO - this should be done by the FileContentProvider, as part of getStorageManager().saveShare(share)
getStorageManager().saveFile(file);
}
}
}
@@ -1,4 +1,4 @@
/**
/*
* ownCloud Android client application
*
* @author David A. Velasco
@@ -34,7 +34,7 @@ import com.owncloud.android.lib.common.operations.OperationCancelledException;
import com.owncloud.android.lib.common.operations.RemoteOperation;
import com.owncloud.android.lib.common.operations.RemoteOperationResult;
import com.owncloud.android.lib.common.utils.Log_OC;
import com.owncloud.android.lib.resources.files.DownloadRemoteFileOperation;
import com.owncloud.android.lib.resources.files.DownloadFileRemoteOperation;
import com.owncloud.android.utils.EncryptionUtils;
import com.owncloud.android.utils.FileStorageUtils;
@@ -49,7 +49,7 @@ import java.util.concurrent.atomic.AtomicBoolean;
* Remote mDownloadOperation performing the download of a file to an ownCloud server
*/
public class DownloadFileOperation extends RemoteOperation {
private static final String TAG = DownloadFileOperation.class.getSimpleName();
private Account mAccount;
@@ -60,13 +60,13 @@ public class DownloadFileOperation extends RemoteOperation {
private long mModificationTimestamp;
private String mEtag = "";
private final AtomicBoolean mCancellationRequested = new AtomicBoolean(false);
private DownloadRemoteFileOperation mDownloadOperation;
private DownloadFileRemoteOperation mDownloadOperation;
private String mActivityName;
private String mPackageName;
public DownloadFileOperation(Account account, OCFile file, String behaviour, String activityName,
public DownloadFileOperation(Account account, OCFile file, String behaviour, String activityName,
String packageName, Context context) {
if (account == null) {
throw new IllegalArgumentException("Illegal null account in DownloadFileOperation " +
@@ -76,7 +76,7 @@ public class DownloadFileOperation extends RemoteOperation {
throw new IllegalArgumentException("Illegal null file in DownloadFileOperation " +
"creation");
}
mAccount = account;
mFile = file;
mBehaviour = behaviour;
@@ -89,7 +89,7 @@ public class DownloadFileOperation extends RemoteOperation {
public Account getAccount() {
return mAccount;
}
public OCFile getFile() {
return mFile;
}
@@ -107,15 +107,15 @@ public class DownloadFileOperation extends RemoteOperation {
}
return FileStorageUtils.getDefaultSavePathFor(mAccount.name, mFile);
}
public String getTmpPath() {
return FileStorageUtils.getTemporalPath(mAccount.name) + mFile.getRemotePath();
}
public String getTmpFolder() {
return FileStorageUtils.getTemporalPath(mAccount.name);
}
public String getRemotePath() {
return mFile.getRemotePath();
}
@@ -138,14 +138,13 @@ public class DownloadFileOperation extends RemoteOperation {
}
return mimeType;
}
public long getSize() {
return mFile.getFileLength();
}
public long getModificationTimestamp() {
return (mModificationTimestamp > 0) ? mModificationTimestamp :
mFile.getModificationTimestamp();
return mModificationTimestamp > 0 ? mModificationTimestamp : mFile.getModificationTimestamp();
}
public String getEtag() {
@@ -169,14 +168,14 @@ public class DownloadFileOperation extends RemoteOperation {
File tmpFile = new File(getTmpPath());
String tmpFolder = getTmpFolder();
mDownloadOperation = new DownloadRemoteFileOperation(mFile.getRemotePath(), tmpFolder);
mDownloadOperation = new DownloadFileRemoteOperation(mFile.getRemotePath(), tmpFolder);
Iterator<OnDatatransferProgressListener> listener = mDataTransferListeners.iterator();
while (listener.hasNext()) {
mDownloadOperation.addDatatransferProgressListener(listener.next());
}
result = mDownloadOperation.execute(client, client.useNextcloudUserAgent());
if (result.isSuccess()) {
mModificationTimestamp = mDownloadOperation.getModificationTimestamp();
mEtag = mDownloadOperation.getEtag();
@@ -218,7 +217,7 @@ public class DownloadFileOperation extends RemoteOperation {
}
Log_OC.i(TAG, "Download of " + mFile.getRemotePath() + " to " + getSavePath() + ": " +
result.getLogMessage());
return result;
}
@@ -235,7 +234,7 @@ public class DownloadFileOperation extends RemoteOperation {
mDataTransferListeners.add(listener);
}
}
public void removeDatatransferProgressListener(OnDatatransferProgressListener listener) {
synchronized (mDataTransferListeners) {
mDataTransferListeners.remove(listener);
@@ -1,83 +0,0 @@
/*
* Nextcloud Android client application
*
* @author Tobias Kaminsky
* Copyright (C) 2018 Tobias Kaminsky
* Copyright (C) 2018 Nextcloud GmbH.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.owncloud.android.operations;
import android.util.Log;
import com.owncloud.android.lib.common.OwnCloudClient;
import com.owncloud.android.lib.common.operations.RemoteOperationResult;
import com.owncloud.android.operations.common.SyncOperation;
import org.apache.commons.httpclient.HttpStatus;
import org.apache.jackrabbit.webdav.client.methods.DeleteMethod;
import java.io.IOException;
/**
* Empty trashbin.
*/
public class EmptyTrashbinFileOperation extends SyncOperation {
private static final String TAG = EmptyTrashbinFileOperation.class.getSimpleName();
private static final int RESTORE_READ_TIMEOUT = 30000;
private static final int RESTORE_CONNECTION_TIMEOUT = 5000;
private String userId;
/**
* Constructor
*
* @param userId to access correct trashbin
*/
public EmptyTrashbinFileOperation(String userId) {
this.userId = userId;
}
/**
* Performs the operation.
*
* @param client Client object to communicate with the remote Nextcloud server.
*/
@Override
protected RemoteOperationResult run(OwnCloudClient client) {
RemoteOperationResult result;
try {
DeleteMethod delete = new DeleteMethod(client.getNewWebdavUri() + "/trashbin/" + userId + "/trash");
int status = client.executeMethod(delete, RESTORE_READ_TIMEOUT, RESTORE_CONNECTION_TIMEOUT);
result = new RemoteOperationResult(isSuccess(status), delete);
client.exhaustResponse(delete.getResponseBodyAsStream());
} catch (IOException e) {
result = new RemoteOperationResult(e);
Log.e(TAG, "Empty trashbin failed: " + result.getLogMessage(), e);
}
return result;
}
private boolean isSuccess(int status) {
return status == HttpStatus.SC_NO_CONTENT;
}
}
@@ -82,7 +82,7 @@ public class GetServerInfoOperation extends RemoteOperation {
if (result.isSuccess()) {
// second: get authentication method required by the server
mResultData.mVersion = (OwnCloudVersion)(result.getData().get(0));
mResultData.mIsSslConn = (result.getCode() == ResultCode.OK_SSL);
mResultData.mIsSslConn = result.getCode() == ResultCode.OK_SSL;
mResultData.mBaseUrl = normalizeProtocolPrefix(mUrl, mResultData.mIsSslConn);
RemoteOperationResult detectAuthResult = detectAuthorizationMethod(client);
@@ -23,7 +23,7 @@ import com.owncloud.android.datamodel.OCFile;
import com.owncloud.android.lib.common.OwnCloudClient;
import com.owncloud.android.lib.common.operations.RemoteOperationResult;
import com.owncloud.android.lib.common.operations.RemoteOperationResult.ResultCode;
import com.owncloud.android.lib.resources.files.MoveRemoteFileOperation;
import com.owncloud.android.lib.resources.files.MoveFileRemoteOperation;
import com.owncloud.android.operations.common.SyncOperation;
@@ -31,16 +31,16 @@ import com.owncloud.android.operations.common.SyncOperation;
* Operation mmoving an {@link OCFile} to a different folder.
*/
public class MoveFileOperation extends SyncOperation {
//private static final String TAG = MoveFileOperation.class.getSimpleName();
private String mSrcPath;
private String mTargetParentPath;
private OCFile mFile;
/**
* Constructor
*
*
* @param srcPath Remote path of the {@link OCFile} to move.
* @param targetParentPath Path to the folder where the file will be moved into.
*/
@@ -50,13 +50,13 @@ public class MoveFileOperation extends SyncOperation {
if (!mTargetParentPath.endsWith(OCFile.PATH_SEPARATOR)) {
mTargetParentPath += OCFile.PATH_SEPARATOR;
}
mFile = null;
}
/**
* Performs the operation.
*
*
* @param client Client object to communicate with the remote ownCloud server.
*/
@Override
@@ -69,27 +69,22 @@ public class MoveFileOperation extends SyncOperation {
if (mFile == null) {
return new RemoteOperationResult(ResultCode.FILE_NOT_FOUND);
}
/// 2. remote move
String targetPath = mTargetParentPath + mFile.getFileName();
if (mFile.isFolder()) {
targetPath += OCFile.PATH_SEPARATOR;
}
MoveRemoteFileOperation operation = new MoveRemoteFileOperation(
mSrcPath,
targetPath,
false
);
RemoteOperationResult result = operation.execute(client);
RemoteOperationResult result = new MoveFileRemoteOperation(mSrcPath, targetPath, false).execute(client);
/// 3. local move
if (result.isSuccess()) {
getStorageManager().moveLocalFile(mFile, targetPath, mTargetParentPath);
}
}
// TODO handle ResultCode.PARTIAL_MOVE_DONE in client Activity, for the moment
return result;
}
}
@@ -22,8 +22,6 @@ package com.owncloud.android.operations;
import android.accounts.Account;
import android.content.Context;
import android.content.Intent;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.util.Log;
import com.owncloud.android.datamodel.DecryptedFolderMetadata;
@@ -34,9 +32,9 @@ import com.owncloud.android.lib.common.operations.RemoteOperation;
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.lib.resources.files.ReadRemoteFileOperation;
import com.owncloud.android.lib.resources.files.ReadRemoteFolderOperation;
import com.owncloud.android.lib.resources.files.RemoteFile;
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.shares.GetRemoteSharesForFileOperation;
import com.owncloud.android.lib.resources.shares.OCShare;
import com.owncloud.android.lib.resources.shares.ShareType;
@@ -52,12 +50,15 @@ import java.util.List;
import java.util.Map;
import java.util.Vector;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
/**
* Remote operation performing the synchronization of the list of files contained
* Remote operation performing the synchronization of the list of files contained
* in a folder identified with its remote path.
*
* Fetches the list and properties of the files contained in the given folder, including their
* Fetches the list and properties of the files contained in the given folder, including their
* properties, and updates the local database with them.
*
* Does NOT enter in the child folders to synchronize their contents also.
@@ -97,8 +98,8 @@ public class RefreshFolderOperation extends RemoteOperation {
private int mFailsInKeptInSyncFound;
/**
* Map of remote and local paths to files that where locally stored in a location
* out of the ownCloud folder and couldn't be copied automatically into it
* Map of remote and local paths to files that where locally stored in a location
* out of the ownCloud folder and couldn't be copied automatically into it
**/
private Map<String, String> mForgottenLocalFiles;
@@ -122,13 +123,13 @@ public class RefreshFolderOperation extends RemoteOperation {
*
* @param folder Folder to synchronize.
* @param currentSyncTime Time stamp for the synchronization process in progress.
* @param syncFullAccount 'True' means that this operation is part of a full account
* @param syncFullAccount 'True' means that this operation is part of a full account
* synchronization.
* @param ignoreETag 'True' means that the content of the remote folder should
* be fetched and updated even though the 'eTag' did not
* change.
* be fetched and updated even though the 'eTag' did not
* change.
* @param dataStorageManager Interface with the local database.
* @param account ownCloud account where the folder is located.
* @param account ownCloud account where the folder is located.
* @param context Application context.
*/
public RefreshFolderOperation(OCFile folder,
@@ -163,7 +164,7 @@ public class RefreshFolderOperation extends RemoteOperation {
}
/**
* Returns the list of files and folders contained in the synchronized folder,
* Returns the list of files and folders contained in the synchronized folder,
* if called after synchronization is complete.
*
* @return List of files and folders contained in the synchronized folder.
@@ -195,7 +196,6 @@ public class RefreshFolderOperation extends RemoteOperation {
if (mRemoteFolderChanged) {
result = fetchAndSyncRemoteFolder(client);
} else {
fetchKeptInSyncFilesToSyncFromLocalData();
mChildren = mStorageManager.getFolderContent(mLocalFolder, false);
}
@@ -215,7 +215,7 @@ public class RefreshFolderOperation extends RemoteOperation {
}
if (result.isSuccess() && !mSyncFullAccount) {
refreshSharesForFolder(client); // share result is ignored
refreshSharesForFolder(client); // share result is ignored
}
if (!mSyncFullAccount) {
@@ -262,9 +262,9 @@ public class RefreshFolderOperation extends RemoteOperation {
Log_OC.d(TAG, "Checking changes in " + mAccount.name + remotePath);
// remote request
ReadRemoteFileOperation operation = new ReadRemoteFileOperation(remotePath);
result = operation.execute(client, true);
// remote request
result = new ReadFileRemoteOperation(remotePath).execute(client, true);
if (result.isSuccess()) {
OCFile remoteFolder = FileStorageUtils.fillOCFile((RemoteFile) result.getData().get(0));
@@ -305,8 +305,7 @@ public class RefreshFolderOperation extends RemoteOperation {
private RemoteOperationResult fetchAndSyncRemoteFolder(OwnCloudClient client) {
String remotePath = mLocalFolder.getRemotePath();
ReadRemoteFolderOperation operation = new ReadRemoteFolderOperation(remotePath);
RemoteOperationResult result = operation.execute(client, true);
RemoteOperationResult result = new ReadFolderRemoteOperation(remotePath).execute(client, true);
Log_OC.d(TAG, "Synchronizing " + mAccount.name + remotePath);
if (result.isSuccess()) {
@@ -349,7 +348,7 @@ public class RefreshFolderOperation extends RemoteOperation {
// get 'fresh data' from the database
mLocalFolder = mStorageManager.getFileByPath(mLocalFolder.getRemotePath());
// parse data from remote folder
// parse data from remote folder
OCFile remoteFolder = FileStorageUtils.fillOCFile((RemoteFile) folderAndFiles.get(0));
remoteFolder.setParentId(mLocalFolder.getParentId());
remoteFolder.setFileId(mLocalFolder.getFileId());
@@ -387,7 +386,7 @@ public class RefreshFolderOperation extends RemoteOperation {
updatedFile = FileStorageUtils.fillOCFile(r);
updatedFile.setParentId(mLocalFolder.getFileId());
// retrieve local data for the read file
// retrieve local data for the read file
localFile = localFilesMap.remove(remoteFile.getRemotePath());
// add to updatedFile data about LOCAL STATE (not existing in server)
@@ -399,13 +398,6 @@ public class RefreshFolderOperation extends RemoteOperation {
// check and fix, if needed, local storage path
FileStorageUtils.searchForLocalFileInDefaultPath(updatedFile, mAccount);
// prepare content synchronization for kept-in-sync files
if (updatedFile.isAvailableOffline()) {
mFilesToSyncContents.add(
new SynchronizeFileOperation(localFile, remoteFile, mAccount, true, mContext)
);
}
// update file name for encrypted files
if (metadata != null) {
updateFileNameForEncryptedFile(metadata, updatedFile);
@@ -414,7 +406,7 @@ public class RefreshFolderOperation extends RemoteOperation {
// we parse content, so either the folder itself or its direct parent (which we check) must be encrypted
boolean encrypted = updatedFile.isEncrypted() || mLocalFolder.isEncrypted();
updatedFile.setEncrypted(encrypted);
updatedFiles.add(updatedFile);
}
@@ -444,9 +436,9 @@ public class RefreshFolderOperation extends RemoteOperation {
updatedFile.setFileName(decryptedFileName);
if (mimetype == null || mimetype.isEmpty()) {
updatedFile.setMimetype("application/octet-stream");
updatedFile.setMimeType("application/octet-stream");
} else {
updatedFile.setMimetype(mimetype);
updatedFile.setMimeType(mimetype);
}
} catch (NullPointerException e) {
Log_OC.e(TAG, "Metadata for file " + updatedFile.getFileId() + " not found!");
@@ -456,7 +448,6 @@ public class RefreshFolderOperation extends RemoteOperation {
private void setLocalFileDataOnUpdatedFile(OCFile remoteFile, OCFile localFile, OCFile updatedFile, boolean remoteFolderChanged) {
if (localFile != null) {
updatedFile.setFileId(localFile.getFileId());
updatedFile.setAvailableOffline(localFile.isAvailableOffline());
updatedFile.setLastSyncDateForData(localFile.getLastSyncDateForData());
updatedFile.setModificationTimestampAtLastSyncForData(
localFile.getModificationTimestampAtLastSyncForData()
@@ -477,17 +468,20 @@ public class RefreshFolderOperation extends RemoteOperation {
} else if (remoteFolderChanged && MimeTypeUtil.isImage(remoteFile) &&
remoteFile.getModificationTimestamp() !=
localFile.getModificationTimestamp()) {
updatedFile.setNeedsUpdateThumbnail(true);
updatedFile.setUpdateThumbnailNeeded(true);
Log.d(TAG, "Image " + remoteFile.getFileName() + " updated on the server");
}
updatedFile.setPublicLink(localFile.getPublicLink());
updatedFile.setShareViaLink(localFile.isSharedViaLink());
updatedFile.setShareWithSharee(localFile.isSharedWithSharee());
updatedFile.setSharedViaLink(localFile.isSharedViaLink());
updatedFile.setSharedWithSharee(localFile.isSharedWithSharee());
} else {
// remote eTag will not be updated unless file CONTENTS are synchronized
updatedFile.setEtag("");
}
// eTag on Server is used for thumbnail validation
updatedFile.setEtagOnServer(remoteFile.getEtag());
}
@NonNull
@@ -509,7 +503,7 @@ public class RefreshFolderOperation extends RemoteOperation {
* Performs a list of synchronization operations, determining if a download or upload is needed
* or if exists conflict due to changes both in local and remote contents of the each file.
*
* If download or upload is needed, request the operation to the corresponding service and goes
* If download or upload is needed, request the operation to the corresponding service and goes
* on.
*
* @param filesToSyncContents Synchronization operations to execute.
@@ -545,7 +539,7 @@ public class RefreshFolderOperation extends RemoteOperation {
private RemoteOperationResult refreshSharesForFolder(OwnCloudClient client) {
RemoteOperationResult result;
// remote request
// remote request
GetRemoteSharesForFileOperation operation =
new GetRemoteSharesForFileOperation(mLocalFolder.getRemotePath(), true, true);
result = operation.execute(client);
@@ -592,24 +586,5 @@ public class RefreshFolderOperation extends RemoteOperation {
intent.setPackage(mContext.getPackageName());
mContext.sendStickyBroadcast(intent);
//LocalBroadcastManager.getInstance(mContext).sendBroadcast(intent);
}
private void fetchKeptInSyncFilesToSyncFromLocalData() {
List<OCFile> children = mStorageManager.getFolderContent(mLocalFolder, false);
for (OCFile child : children) {
if (!child.isFolder() && child.isAvailableOffline() && !child.isInConflict()) {
SynchronizeFileOperation operation = new SynchronizeFileOperation(
child,
child, // cheating with the remote file to get an update to server; to refactor
mAccount,
true,
mContext
);
mFilesToSyncContents.add(operation);
}
}
}
}
@@ -31,7 +31,7 @@ import com.owncloud.android.lib.common.OwnCloudClient;
import com.owncloud.android.lib.common.operations.RemoteOperation;
import com.owncloud.android.lib.common.operations.RemoteOperationResult;
import com.owncloud.android.lib.common.operations.RemoteOperationResult.ResultCode;
import com.owncloud.android.lib.resources.files.RemoveRemoteFileOperation;
import com.owncloud.android.lib.resources.files.RemoveFileRemoteOperation;
import com.owncloud.android.operations.common.SyncOperation;
@@ -46,14 +46,14 @@ public class RemoveFileOperation extends SyncOperation {
private Account account;
private boolean inBackground;
private Context context;
/**
* Constructor
*
* @param remotePath RemotePath of the OCFile instance describing the remote file or
*
* @param remotePath RemotePath of the OCFile instance describing the remote file or
* folder to remove from the server
* @param onlyLocalCopy When 'true', and a local copy of the file exists, only this is
* @param onlyLocalCopy When 'true', and a local copy of the file exists, only this is
* removed.
*/
public RemoveFileOperation(String remotePath, boolean onlyLocalCopy, Account account, boolean inBackground,
@@ -64,11 +64,11 @@ public class RemoveFileOperation extends SyncOperation {
this.inBackground = inBackground;
this.context = context;
}
/**
* Getter for the file to remove (or removed, if the operation was successfully performed).
*
*
* @return File to remove or already removed.
*/
public OCFile getFile() {
@@ -78,10 +78,10 @@ public class RemoveFileOperation extends SyncOperation {
public boolean isInBackground() {
return inBackground;
}
/**
* Performs the remove operation
*
*
* @param client Client object to communicate with the remote ownCloud server.
*/
@Override
@@ -103,25 +103,25 @@ public class RemoveFileOperation extends SyncOperation {
operation = new RemoveRemoteEncryptedFileOperation(remotePath, parent.getLocalId(), account, context,
fileToRemove.getEncryptedFileName());
} else {
operation = new RemoveRemoteFileOperation(remotePath);
operation = new RemoveFileRemoteOperation(remotePath);
}
result = operation.execute(client);
if (result.isSuccess() || result.getCode() == ResultCode.FILE_NOT_FOUND) {
localRemovalFailed = !(getStorageManager().removeFile(fileToRemove, true, true));
}
} else {
localRemovalFailed = !(getStorageManager().removeFile(fileToRemove, false, true));
if (!localRemovalFailed) {
result = new RemoteOperationResult(ResultCode.OK);
}
}
if (localRemovalFailed) {
result = new RemoteOperationResult(ResultCode.LOCAL_STORAGE_NOT_REMOVED);
}
return result;
}
}
@@ -24,7 +24,6 @@ package com.owncloud.android.operations;
import android.accounts.Account;
import android.content.Context;
import android.os.Build;
import android.support.annotation.RequiresApi;
import com.google.gson.reflect.TypeToken;
import com.owncloud.android.datamodel.ArbitraryDataProvider;
@@ -35,15 +34,17 @@ import com.owncloud.android.lib.common.network.WebdavUtils;
import com.owncloud.android.lib.common.operations.RemoteOperation;
import com.owncloud.android.lib.common.operations.RemoteOperationResult;
import com.owncloud.android.lib.common.utils.Log_OC;
import com.owncloud.android.lib.resources.files.GetMetadataOperation;
import com.owncloud.android.lib.resources.files.LockFileOperation;
import com.owncloud.android.lib.resources.files.UnlockFileOperation;
import com.owncloud.android.lib.resources.files.UpdateMetadataOperation;
import com.owncloud.android.lib.resources.e2ee.GetMetadataRemoteOperation;
import com.owncloud.android.lib.resources.e2ee.LockFileRemoteOperation;
import com.owncloud.android.lib.resources.e2ee.UnlockFileRemoteOperation;
import com.owncloud.android.lib.resources.e2ee.UpdateMetadataRemoteOperation;
import com.owncloud.android.utils.EncryptionUtils;
import org.apache.commons.httpclient.HttpStatus;
import org.apache.jackrabbit.webdav.client.methods.DeleteMethod;
import androidx.annotation.RequiresApi;
/**
* Remote operation performing the removal of a remote encrypted file or folder
*/
@@ -67,8 +68,8 @@ public class RemoveRemoteEncryptedFileOperation extends RemoteOperation {
* @param remotePath RemotePath of the remote file or folder to remove from the server
* @param parentId local id of parent folder
*/
public RemoveRemoteEncryptedFileOperation(String remotePath, String parentId, Account account, Context context,
String fileName) {
RemoveRemoteEncryptedFileOperation(String remotePath, String parentId, Account account, Context context,
String fileName) {
this.remotePath = remotePath;
this.parentId = parentId;
this.account = account;
@@ -93,8 +94,7 @@ public class RemoveRemoteEncryptedFileOperation extends RemoteOperation {
try {
// Lock folder
LockFileOperation lockFileOperation = new LockFileOperation(parentId);
RemoteOperationResult lockFileOperationResult = lockFileOperation.execute(client, true);
RemoteOperationResult lockFileOperationResult = new LockFileRemoteOperation(parentId).execute(client, true);
if (lockFileOperationResult.isSuccess()) {
token = (String) lockFileOperationResult.getData().get(0);
@@ -105,8 +105,8 @@ public class RemoveRemoteEncryptedFileOperation extends RemoteOperation {
}
// refresh metadata
GetMetadataOperation getMetadataOperation = new GetMetadataOperation(parentId);
RemoteOperationResult getMetadataOperationResult = getMetadataOperation.execute(client, true);
RemoteOperationResult getMetadataOperationResult = new GetMetadataRemoteOperation(parentId)
.execute(client, true);
if (getMetadataOperationResult.isSuccess()) {
// decrypt metadata
@@ -137,9 +137,8 @@ public class RemoveRemoteEncryptedFileOperation extends RemoteOperation {
String serializedFolderMetadata = EncryptionUtils.serializeJSON(encryptedFolderMetadata);
// upload metadata
UpdateMetadataOperation storeMetadataOperation = new UpdateMetadataOperation(parentId,
serializedFolderMetadata, token);
RemoteOperationResult uploadMetadataOperationResult = storeMetadataOperation.execute(client, true);
RemoteOperationResult uploadMetadataOperationResult = new UpdateMetadataRemoteOperation(parentId,
serializedFolderMetadata, token).execute(client, true);
if (!uploadMetadataOperationResult.isSuccess()) {
throw new RemoteOperationFailedException("Metadata not uploaded!");
@@ -158,8 +157,8 @@ public class RemoveRemoteEncryptedFileOperation extends RemoteOperation {
// unlock file
if (token != null) {
UnlockFileOperation unlockFileOperation = new UnlockFileOperation(parentId, token);
RemoteOperationResult unlockFileOperationResult = unlockFileOperation.execute(client, true);
RemoteOperationResult unlockFileOperationResult = new UnlockFileRemoteOperation(parentId, token)
.execute(client, true);
if (!unlockFileOperationResult.isSuccess()) {
Log_OC.e(TAG, "Failed to unlock " + parentId);
@@ -1,4 +1,4 @@
/**
/*
* ownCloud Android client application
*
* @author David A. Velasco
@@ -27,7 +27,7 @@ import com.owncloud.android.lib.common.OwnCloudClient;
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.lib.resources.files.RenameRemoteFileOperation;
import com.owncloud.android.lib.resources.files.RenameFileRemoteOperation;
import com.owncloud.android.operations.common.SyncOperation;
import com.owncloud.android.utils.FileStorageUtils;
@@ -39,17 +39,17 @@ import java.io.IOException;
* Remote operation performing the rename of a remote file (or folder?) in the ownCloud server.
*/
public class RenameFileOperation extends SyncOperation {
private static final String TAG = RenameFileOperation.class.getSimpleName();
private OCFile mFile;
private String mRemotePath;
private String mNewName;
private String mNewRemotePath;
/**
* Constructor
*
*
* @param remotePath RemotePath of the OCFile instance describing the remote file or
* folder to rename
* @param newName New name to set as the name of file.
@@ -59,29 +59,29 @@ public class RenameFileOperation extends SyncOperation {
mNewName = newName;
mNewRemotePath = null;
}
public OCFile getFile() {
return mFile;
}
/**
* Performs the rename operation.
*
*
* @param client Client object to communicate with the remote ownCloud server.
*/
@Override
protected RemoteOperationResult run(OwnCloudClient client) {
RemoteOperationResult result = null;
mFile = getStorageManager().getFileByPath(mRemotePath);
// check if the new name is valid in the local file system
try {
if (!isValidNewName()) {
return new RemoteOperationResult(ResultCode.INVALID_LOCAL_FILE_NAME);
}
String parent = (new File(mFile.getRemotePath())).getParent();
String parent = new File(mFile.getRemotePath()).getParent();
parent = parent.endsWith(OCFile.PATH_SEPARATOR) ? parent : parent + OCFile.PATH_SEPARATOR;
mNewRemotePath = parent + mNewName;
if (mFile.isFolder()) {
@@ -92,11 +92,9 @@ public class RenameFileOperation extends SyncOperation {
if (getStorageManager().getFileByPath(mNewRemotePath) != null) {
return new RemoteOperationResult(ResultCode.INVALID_OVERWRITE);
}
RenameRemoteFileOperation operation = new RenameRemoteFileOperation(mFile.getFileName(),
mFile.getRemotePath(),
mNewName, mFile.isFolder());
result = operation.execute(client);
result = new RenameFileRemoteOperation(mFile.getFileName(), mFile.getRemotePath(), mNewName,
mFile.isFolder()).execute(client);
if (result.isSuccess()) {
if (mFile.isFolder()) {
@@ -107,7 +105,7 @@ public class RenameFileOperation extends SyncOperation {
saveLocalFile();
}
}
} catch (IOException e) {
Log_OC.e(TAG, "Rename " + mFile.getRemotePath() + " to " + ((mNewRemotePath==null) ?
mNewName : mNewRemotePath) + ": " +
@@ -141,22 +139,22 @@ public class RenameFileOperation extends SyncOperation {
// can't be updated
// TODO - study conditions when this could be a problem
}
getStorageManager().saveFile(mFile);
}
/**
* Checks if the new name to set is valid in the file system
*
* Checks if the new name to set is valid in the file system
*
* The only way to be sure is trying to create a file with that name. It's made in the
* temporal directory for downloads, out of any account, and then removed.
*
*
* IMPORTANT: The test must be made in the same file system where files are download.
* The internal storage could be formatted with a different file system.
*
*
* TODO move this method, and maybe FileDownload.get***Path(), to a class with utilities
* specific for the interactions with the file system
*
*
* @return 'True' if a temporal file named with the name to set could be
* created in the file system where local files are stored.
* @throws IOException When the temporal folder can not be created.
@@ -182,11 +180,11 @@ public class RenameFileOperation extends SyncOperation {
return false;
}
boolean result = testFile.exists() && testFile.isFile();
// cleaning ; result is ignored, since there is not much we could do in case of failure,
// but repeat and repeat...
testFile.delete();
return result;
}
}
Loaded 100 of 409 files, more files were not shown because too many files have changed in this diff. Show more