Compare commits

..
Author SHA1 Message Date
tobiasKaminsky ef92ca7db8 wip
Signed-off-by: tobiasKaminsky <[email protected]>
2020-02-19 15:24:40 +01:00
tobiasKaminsky 640e70e6f3 TestWorkshop
Signed-off-by: tobiasKaminsky <[email protected]>
2020-02-19 15:22:39 +01:00
Nextcloud bot 0f1da5238b [tx-robot] updated from transifex 2020-02-19 03:29:10 +00:00
Tobias Kaminsky 5d428fe9a2 Merge pull request #4788 from nextcloud/instantupload_all
Setting to also upload existing files
2020-02-18 08:45:03 +01:00
Alice Gaudon 49f3a67251 ConflictsResolveActivity: code style and readability improvements
Signed-off-by: Alice Gaudon <[email protected]>
Signed-off-by: tobiasKaminsky <[email protected]>
2020-02-18 07:39:13 +01:00
Alice Gaudon 6540e3ef71 Upload list conflicts: replace trash icon with menu and add resolve action
Signed-off-by: Alice Gaudon <[email protected]>
2020-02-18 07:38:35 +01:00
Alice Gaudon a4ff1f11d7 Customize upload sync conflict notification strings
Signed-off-by: Alice Gaudon <[email protected]>
2020-02-18 07:38:35 +01:00
Alice Gaudon e77ffa00a8 Fix synced folder layout form control widgets alignment
Signed-off-by: Alice Gaudon <[email protected]>
2020-02-18 07:38:35 +01:00
Alice Gaudon 91ef307e7a Fix database migration of field forceOverwrite to NameCollisionPolicy
Signed-off-by: Alice Gaudon <[email protected]>
2020-02-18 07:38:35 +01:00
Alice Gaudon 52d089b18a FileUploader: fix codacy issues and SpotBugs
Signed-off-by: Alice Gaudon <[email protected]>
2020-02-18 07:38:35 +01:00
Alice Gaudon ec27f840a6 FileUploader: code cleanup
Signed-off-by: Alice Gaudon <[email protected]>
2020-02-18 07:38:35 +01:00
Alice Gaudon 7713a28a4f FileUploader: require explicit NameCollisionPolicy and change default used value
- Changes NameConflictPolicy for manual uploads from default RENAME to ASK_USER
- Removal of helper class FileUploader.UploadRequester (methods become static and go to FileUploader)

Signed-off-by: Alice Gaudon <[email protected]>
2020-02-18 07:38:35 +01:00
Alice Gaudon 6783e8ab4c Make file uploads ask the user what to do when the file already exists on remote
Signed-off-by: Alice Gaudon <[email protected]>
2020-02-18 07:38:16 +01:00
Alice Gaudon 213002f44e Make newly created synced folders auto upload existing files by default
Signed-off-by: Alice Gaudon <[email protected]>
2020-02-18 07:37:54 +01:00
Chris Koying Browet 1b7bd72c49 ADD: [instantupload] setting to also upload existing files
Signed-off-by: Chris Koying Browet <[email protected]>
2020-02-18 07:37:54 +01:00
Tobias Kaminsky c243453168 Merge pull request #5465 from nextcloud/fix/create-folder-crash-autosync
Fixed crash during folder creation (autosync)
2020-02-18 07:28:12 +01:00
tobiasKaminsky a93313ca19 added tests
Signed-off-by: tobiasKaminsky <[email protected]>
2020-02-17 15:05:14 +01:00
Kilian Périsset 467104c455 Replaced OCFile by File in getFolder() method 2020-02-17 14:45:14 +01:00
Kilian Périsset c59f9c0b91 Formated the code + added header 2020-02-17 14:45:07 +01:00
Kilian Périsset c821f192d6 Formated the code (removed useless spaces) 2020-02-17 14:45:07 +01:00
Kilian Périsset 389090d3e8 Implemented tests for FolderPickerActivity 2020-02-17 14:45:07 +01:00
Kilian Périsset 511a16612d Fixed bug relative to null folder in FolderPicker 2020-02-17 14:45:07 +01:00
Tobias Kaminsky 4616b0d40b Merge pull request #5447 from nextcloud/ezaquarii/migrate-jobs-to-new-user-model
Migrate jobs to new user model
2020-02-17 10:40:04 +01:00
Tobias Kaminsky 20b910a646 Merge pull request #5442 from nextcloud/ezaquarii/fix-crash-on-text-file-creation
Fix crash during text file creation
2020-02-17 10:34:26 +01:00
Chris Narkiewicz 0977c37916 Fix crash during text file creation
Fixes #5330

Signed-off-by: Chris Narkiewicz <[email protected]>
Signed-off-by: tobiasKaminsky <[email protected]>
2020-02-17 09:30:37 +01:00
Nextcloud bot 5c74f2b1be [tx-robot] updated from transifex 2020-02-16 03:28:46 +00:00
Nextcloud bot 27fabe745b [tx-robot] updated from transifex 2020-02-15 03:29:51 +00:00
Andy Scherzinger 490b292ad9 Merge pull request #5300 from nextcloud/sharedSearchAgain
Re-enable shared search and add ui test for list shares
2020-02-14 13:52:18 +01:00
tobiasKaminsky 61027524f7 test
Signed-off-by: tobiasKaminsky <[email protected]>
2020-02-14 13:01:21 +01:00
tobiasKaminsky 7b4e1b82e3 change cancelContactBackupJobForAccount to user new User class
Signed-off-by: tobiasKaminsky <[email protected]>
2020-02-14 11:08:38 +01:00
tobiasKaminsky af93382c66 test
Signed-off-by: tobiasKaminsky <[email protected]>
2020-02-14 08:46:08 +01:00
Chris Narkiewicz 0afc2645c4 Migrated jobs to new user model
Signed-off-by: Chris Narkiewicz <[email protected]>
2020-02-14 06:22:20 +00:00
Nextcloud bot 68f06ea158 [tx-robot] updated from transifex 2020-02-14 03:28:53 +00:00
Andy Scherzinger 045a7aa9e7 Merge pull request #5466 from nextcloud/squareIcon
Add square google icon
2020-02-13 16:34:18 +01:00
tobiasKaminsky 5cc0360855 upload preliminary step
Signed-off-by: tobiasKaminsky <[email protected]>
2020-02-13 15:34:53 +01:00
tobiasKaminsky eefeda930c Add square google icon
Signed-off-by: tobiasKaminsky <[email protected]>
2020-02-13 15:32:24 +01:00
Nextcloud bot 7156aaff2a [tx-robot] updated from transifex 2020-02-13 03:33:37 +00:00
Andy Scherzinger 67880e2758 Merge pull request #5450 from nextcloud/etmScreenshots
Screenshot tests for ETM
2020-02-12 21:35:07 +01:00
Tobias Kaminsky a063f32d25 Merge pull request #5434 from nextcloud/ezaquarii/migrate-account-list-to-new-user-model
Migrate account list to new user model
2020-02-12 12:18:00 +01:00
tobiasKaminsky d841f64254 Screenshot tests for ETM
Signed-off-by: tobiasKaminsky <[email protected]>
2020-02-12 11:47:55 +01:00
tobiasKaminsky 0569b0de65 Screenshot tests ManageAccountsActivity
Signed-off-by: tobiasKaminsky <[email protected]>
2020-02-12 09:34:59 +01:00
Chris Narkiewicz 53024d1cd1 Migrate account list to new user model
Signed-off-by: Chris Narkiewicz <[email protected]>
2020-02-12 07:31:38 +00:00
Nextcloud bot e716c99a9b [tx-robot] updated from transifex 2020-02-12 03:28:27 +00:00
Tobias Kaminsky f520f2f9a2 Merge pull request #5436 from nextcloud/ezaquarii/make-user-model-parcelable
Make user model parcelable
2020-02-11 09:26:26 +01:00
Tobias Kaminsky 25cbeb4bd8 Merge pull request #5422 from nextcloud/gplayScreenshots
switch to gplay connected tests, to not run both generic and gplay on drone
2020-02-11 09:01:04 +01:00
tobiasKaminsky 26d7b9c692 Fix after rebase
Signed-off-by: tobiasKaminsky <[email protected]>
2020-02-11 08:58:31 +01:00
tobiasKaminsky c2750aabda Add ui test for list shares
add test user to drone
switch back to master
use "waitForIdleSync" instead of sleep

Signed-off-by: tobiasKaminsky <[email protected]>
2020-02-11 08:57:09 +01:00
Nextcloud bot 87eb8e0d16 [tx-robot] updated from transifex 2020-02-11 03:31:50 +00:00
Chris Narkiewicz 4ce54bc21e Make user model parcelable
Signed-off-by: Chris Narkiewicz <[email protected]>
2020-02-10 15:49:12 +00:00
Tobias Kaminsky 5905b1c5a5 Merge pull request #5432 from nextcloud/ezaquarii/migrate-drawer-menu-utils-to-new-user-model
Migrate drawer menu utilities to new user model
2020-02-10 12:41:25 +01:00
Tobias Kaminsky 4be18adc2d Merge pull request #5064 from nextcloud/ezaquarii/extract-account-logic-from-base-activity-into-mixin
Extract account logic from BaseActivity into a mixin
2020-02-10 12:33:04 +01:00
tobiasKaminsky 2b3e69e80a switch to gplay connected tests, to not run both generic and gplay on drone
Signed-off-by: tobiasKaminsky <[email protected]>
2020-02-10 12:00:35 +01:00
Tobias Kaminsky 619b5d05d2 Merge pull request #5419 from nextcloud/dependabot/gradle/org.projectlombok-lombok-1.18.12
Bump lombok from 1.18.10 to 1.18.12
2020-02-10 09:48:21 +01:00
Tobias Kaminsky 2d6e73dd31 Merge pull request #5414 from nextcloud/fixContactCrash
Fix crash: Caused by: java.lang.ClassCastException: java.lang.Object[…
2020-02-10 09:17:56 +01:00
tobiasKaminsky 1bb04aa29e also increase annotationProcessor
Signed-off-by: tobiasKaminsky <[email protected]>
2020-02-10 08:48:52 +01:00
tobiasKaminsky 6048243f41 Fix crash: Caused by: java.lang.ClassCastException: java.lang.Object[] cannot be cast to java.lang.Void[]
Signed-off-by: tobiasKaminsky <[email protected]>
2020-02-10 08:41:51 +01:00
Nextcloud bot 0027df9d0c [tx-robot] updated from transifex 2020-02-10 07:30:30 +00:00
Tobias Kaminsky 6dd5d925ab Merge pull request #5443 from nextcloud/fixTransifex
do not break line on transifex
2020-02-10 08:26:51 +01:00
tobiasKaminsky b4db9d07af do not break line on transifex
Signed-off-by: tobiasKaminsky <[email protected]>
2020-02-10 08:23:41 +01:00
Chris Narkiewicz b5fb9c1374 Migrate drawer menu utilities to new user model
Signed-off-by: Chris Narkiewicz <[email protected]>
2020-02-09 10:11:08 +00:00
dependabot-preview[bot] f415cd966f Merge pull request #5420 from nextcloud/dependabot/gradle/org.parceler-parceler-1.1.13 2020-02-07 10:48:00 +00:00
dependabot-preview[bot] a114080348 Bump lombok from 1.18.10 to 1.18.12
Bumps [lombok](https://github.com/rzwitserloot/lombok) from 1.18.10 to 1.18.12.
- [Release notes](https://github.com/rzwitserloot/lombok/releases)
- [Changelog](https://github.com/rzwitserloot/lombok/blob/master/doc/changelog.markdown)
- [Commits](https://github.com/rzwitserloot/lombok/compare/v1.18.10...v1.18.12)

Signed-off-by: dependabot-preview[bot] <[email protected]>
2020-02-07 08:58:29 +00:00
dependabot-preview[bot] 2b2800bc74 Bump parceler from 1.1.12 to 1.1.13
Bumps [parceler](https://github.com/johncarl81/parceler) from 1.1.12 to 1.1.13.
- [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.12...parceler-project-1.1.13)

Signed-off-by: dependabot-preview[bot] <[email protected]>
2020-02-07 08:58:21 +00:00
Tobias Kaminsky 98d7518808 Merge pull request #5418 from nextcloud/dependabot/gradle/org.parceler-parceler-api-1.1.13
Bump parceler-api from 1.1.12 to 1.1.13
2020-02-07 09:57:05 +01:00
tobiasKaminsky 8ce35e3f59 manually bump lint
Signed-off-by: tobiasKaminsky <[email protected]>
2020-02-07 08:44:18 +01:00
dependabot-preview[bot] c4a0a09c74 Bump parceler-api from 1.1.12 to 1.1.13
Bumps [parceler-api](https://github.com/johncarl81/parceler) from 1.1.12 to 1.1.13.
- [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.12...parceler-project-1.1.13)

Signed-off-by: dependabot-preview[bot] <[email protected]>
2020-02-07 02:15:34 +00:00
dependabot-preview[bot] b13cba02c2 Merge pull request #5412 from nextcloud/dependabot/gradle/androidx.work-work-runtime-ktx-2.3.1 2020-02-06 07:35:05 +00:00
nextcloud-android-bot dc1a3f1f06 Drone: update Lint results to reflect reduced error/warning count [skip ci]
Signed-off-by: nextcloud-android-bot <[email protected]>
2020-02-06 07:28:36 +00:00
dependabot-preview[bot] aa3727e031 Bump work-runtime-ktx from 2.3.0 to 2.3.1
Bumps work-runtime-ktx from 2.3.0 to 2.3.1.

Signed-off-by: dependabot-preview[bot] <[email protected]>
2020-02-06 07:16:09 +00:00
Tobias Kaminsky 7dbf43b2fb Merge pull request #5413 from nextcloud/lint
Bump to "Obsolete custom lint check"
2020-02-06 08:14:41 +01:00
tobiasKaminsky 4a1e1b1ca8 Bump to "Obsolete custom lint check"
Signed-off-by: tobiasKaminsky <[email protected]>
2020-02-06 08:14:07 +01:00
Chris Narkiewicz 26f2d52a5a Extract account logic from BaseActivity into a mixin
Signed-off-by: Chris Narkiewicz <[email protected]>
2020-02-05 22:08:58 +00:00
Andy Scherzinger 94abac7f79 Merge pull request #5403 from nextcloud/dependabot/gradle/io.gitlab.arturbosch.detekt-detekt-gradle-plugin-1.5.1
Bump detekt-gradle-plugin from 1.5.0 to 1.5.1
2020-02-05 16:12:51 +01:00
dependabot-preview[bot] 8890770fb2 Bump detekt-gradle-plugin from 1.5.0 to 1.5.1
Bumps detekt-gradle-plugin from 1.5.0 to 1.5.1.

Signed-off-by: dependabot-preview[bot] <[email protected]>
2020-02-05 14:28:05 +00:00
Andy Scherzinger 823808e37a Merge pull request #5407 from nextcloud/changelog-master-stable-3.10.1
Add changelog for 3.10.1
2020-02-05 15:20:48 +01:00
Andy Scherzinger c7669fe9db Merge pull request #5393 from nextcloud/removeUnsetType
Remove UnsetType as we do not have bottom bar anymore…
2020-02-05 15:17:44 +01:00
Andy Scherzinger e8d00fd81c proper headline formatting
Signed-off-by: Andy Scherzinger <[email protected]>
2020-02-05 15:17:19 +01:00
Tobias Kaminsky c5be0ad7e4 Merge pull request #5399 from nextcloud/extractArbitraryDataSet
extract ArbitraryDataSet class
2020-02-05 12:30:37 +01:00
tobiasKaminsky a0de3e5ad1 Add changelog for 3.10.1
Signed-off-by: tobiasKaminsky <[email protected]>
2020-02-05 12:19:20 +01:00
Tobias Kaminsky 0936945b3c Merge pull request #5328 from nextcloud/fix/not-enough-space-dialog
Added "not enough space dialog"
2020-02-05 12:14:40 +01:00
Tobias Kaminsky c7d2b0e808 Merge pull request #5404 from nextcloud/uploadReportVerbose
github comment if preliminary step failed
2020-02-05 11:36:09 +01:00
tobiasKaminsky 7e4711a23c github comment if preliminary step failed
Signed-off-by: tobiasKaminsky <[email protected]>
2020-02-05 11:35:02 +01:00
tobiasKaminsky 778fec9e21 extract openDrawer test into AbstractIT
rebased

Signed-off-by: tobiasKaminsky <[email protected]>
2020-02-05 11:12:48 +01:00
tobiasKaminsky 3a78c1b9db add more UI tests
Signed-off-by: tobiasKaminsky <[email protected]>
2020-02-05 11:09:14 +01:00
tobiasKaminsky e118f9a516 Remove UnsetType as we do not have bottom bar anymore…
Signed-off-by: tobiasKaminsky <[email protected]>
2020-02-05 11:09:14 +01:00
tobiasKaminsky c7ea6458bf extract ArbitraryDataSet class
cleanup

Signed-off-by: tobiasKaminsky <[email protected]>
2020-02-05 10:58:05 +01:00
Tobias Kaminsky 7c84a9f929 Merge pull request #5296 from nextcloud/fix/defective-search
Fixed defective search
2020-02-05 10:56:19 +01:00
Kilian Périsset f9a47e6b3b Formated the code 2020-02-05 10:50:44 +01:00
Andy Scherzinger c64e90e8cc Merge pull request #5401 from nextcloud/needlesslyBoxing
NAB_NEEDLESS_BOOLEAN_CONSTANT_CONVERSION
2020-02-05 10:50:26 +01:00
Andy Scherzinger 84adb9eaa0 Merge pull request #5400 from nextcloud/rakekniven-patch-1
l10n: Grammar: url -> URL
2020-02-05 10:48:00 +01:00
nextcloud-android-bot 0d0a4a3198 Drone: update FindBugs results to reflect reduced error/warning count [skip ci]
Signed-off-by: nextcloud-android-bot <[email protected]>
2020-02-05 09:34:45 +00:00
drone d7918c59c6 Merge commit '1bf079d2cd85fe4770716bbf02790651290d66c1' 2020-02-05 09:23:30 +00:00
tobiasKaminsky 1bf079d2cd NAB_NEEDLESS_BOOLEAN_CONSTANT_CONVERSION: Method needlessly boxes a boolean constant
This method assigns a Boxed boolean constant to a primitive boolean variable, or assigns a primitive boolean constant to a Boxed boolean variable. Use the correct constant for the variable desired.

Signed-off-by: tobiasKaminsky <[email protected]>
2020-02-05 10:21:56 +01:00
rakekniven e19b58178b l10n: Grammar: url -> URL
Signed-off-by: rakekniven <[email protected]>
2020-02-05 10:05:33 +01:00
dependabot-preview[bot] 75c0871e65 Merge pull request #5395 from nextcloud/dependabot/gradle/org.greenrobot-eventbus-3.2.0 2020-02-05 08:48:48 +00:00
dependabot-preview[bot] ebba5ea4eb Merge pull request #5396 from nextcloud/dependabot/gradle/io.gitlab.arturbosch.detekt-detekt-gradle-plugin-1.5.0 2020-02-05 08:43:47 +00:00
Nextcloud bot a2e327bdcd [tx-robot] updated from transifex 2020-02-05 03:30:41 +00:00
dependabot-preview[bot] d1b54e1ab7 Bump detekt-gradle-plugin from 1.4.0 to 1.5.0
Bumps detekt-gradle-plugin from 1.4.0 to 1.5.0.

Signed-off-by: dependabot-preview[bot] <[email protected]>
2020-02-05 02:12:49 +00:00
dependabot-preview[bot] 829c705e90 Bump eventbus from 3.1.1 to 3.2.0
Bumps [eventbus](https://github.com/greenrobot/EventBus) from 3.1.1 to 3.2.0.
- [Release notes](https://github.com/greenrobot/EventBus/releases)
- [Commits](https://github.com/greenrobot/EventBus/commits)

Signed-off-by: dependabot-preview[bot] <[email protected]>
2020-02-05 02:11:55 +00:00
Kilian Périsset 4e16e0431a Merge branch 'fix/defective-search' of github.com:nextcloud/android into fix/defective-search 2020-02-04 18:23:49 +01:00
Kilian Périsset 8184dbf1ff Change variables accessibility 2020-02-04 18:20:31 +01:00
Andy Scherzinger f9af611a27 Merge pull request #4878 from nextcloud/ezaquarii/contributions-engineering-practices-section
Added TOC links and Engineering section to CONTRIBUTING.md
2020-02-04 12:14:39 +01:00
tobiasKaminsky 88c4d6d2ab Merge remote-tracking branch 'origin/fix/not-enough-space-dialog' into fix/not-enough-space-dialog 2020-02-04 11:24:19 +01:00
tobiasKaminsky b74c9f2517 use correct storage location
Signed-off-by: tobiasKaminsky <[email protected]>
2020-02-04 11:24:10 +01:00
tobiasKaminsky fab19e8f78 minor enhancements
Signed-off-by: tobiasKaminsky <[email protected]>
2020-02-04 11:03:22 +01:00
Chris Narkiewicz 460389579b Added TOC links and Engineering section to CONTRIBUTING.md
Signed-off-by: Chris Narkiewicz <[email protected]>
2020-02-04 10:42:12 +01:00
dependabot-preview[bot] f7d7a0c7a2 Merge pull request #5378 from nextcloud/dependabot/gradle/markwonVersion-4.2.1 2020-02-04 09:27:04 +00:00
Tobias Kaminsky f7220f4618 Merge pull request #5246 from siebica/master
Fix #2753 "Unresponsive App" error popup when syncing
2020-02-04 10:01:17 +01:00
dependabot-preview[bot] 3d5a40fa0b Merge pull request #5169 from nextcloud/dependabot/gradle/io.gitlab.arturbosch.detekt-detekt-gradle-plugin-1.4.0 2020-02-04 08:42:16 +00:00
tobiasKaminsky eb903ab486 add UI test for Markdown
Signed-off-by: tobiasKaminsky <[email protected]>
2020-02-04 09:40:06 +01:00
tobiasKaminsky f794f230b5 formatting
Signed-off-by: tobiasKaminsky <[email protected]>
2020-02-04 09:36:40 +01:00
Tobias Kaminsky 64c253be66 Merge pull request #5089 from cheecodes/master
Add check to make sure cursor is initialized
2020-02-04 09:12:33 +01:00
Nextcloud bot ff400e16bf [tx-robot] updated from transifex 2020-02-04 03:28:06 +00:00
Tobias Kaminsky 5d868e47fc Merge pull request #5363 from nextcloud/fix/lolipop-webview-crash
Changed appcompat 1.1.0 to 1.2.0-alpha02
2020-02-03 14:31:49 +01:00
Tobias Kaminsky 0c272ad1d7 Merge pull request #5231 from nextcloud/roundedCorners
images: slightly rounded corners
2020-02-03 13:47:15 +01:00
tobiasKaminsky b787284ab6 bump spotbugs
Signed-off-by: tobiasKaminsky <[email protected]>
2020-02-03 11:53:37 +01:00
Tobias Kaminsky 6e202dd942 Merge pull request #5383 from nextcloud/whitePrimaryColor
Auth activity with primary white color
2020-02-03 08:02:34 +01:00
tobiasKaminsky 66b78e0eb7 changed to 8dp
Signed-off-by: tobiasKaminsky <[email protected]>
2020-02-03 06:58:39 +01:00
tobiasKaminsky 5ac25d545d remove unneeded resource
Signed-off-by: tobiasKaminsky <[email protected]>
2020-02-03 06:47:40 +01:00
Tobias Kaminsky 176c7f8938 Merge pull request #5382 from nextcloud/prLineWrapping
PR template: line wrapping
2020-02-03 06:17:43 +01:00
tobiasKaminsky 120a6ca871 PR template: line wrapping
Signed-off-by: tobiasKaminsky <[email protected]>
2020-02-03 06:16:50 +01:00
Tobias Kaminsky 81c3bcef34 Merge pull request #5381 from nextcloud/movePRtemplate
move pr template
2020-02-03 06:12:54 +01:00
tobiasKaminsky 622f1f9f6c move pr template
Signed-off-by: tobiasKaminsky <[email protected]>
2020-02-03 06:12:16 +01:00
tobiasKaminsky f8ff0e106a Auth activity with primary white color
Signed-off-by: tobiasKaminsky <[email protected]>
2020-02-03 06:08:05 +01:00
Nextcloud bot aeee4beba7 [tx-robot] updated from transifex 2020-02-03 03:25:02 +00:00
dependabot-preview[bot] 987b728464 Bump markwonVersion from 4.2.0 to 4.2.1
Bumps `markwonVersion` from 4.2.0 to 4.2.1.

Updates `core` from 4.2.0 to 4.2.1
- [Release notes](https://github.com/noties/Markwon/releases)
- [Changelog](https://github.com/noties/Markwon/blob/master/CHANGELOG.md)
- [Commits](https://github.com/noties/Markwon/compare/v4.2.0...v4.2.1)

Updates `ext-strikethrough` from 4.2.0 to 4.2.1
- [Release notes](https://github.com/noties/Markwon/releases)
- [Changelog](https://github.com/noties/Markwon/blob/master/CHANGELOG.md)
- [Commits](https://github.com/noties/Markwon/compare/v4.2.0...v4.2.1)

Updates `ext-tables` from 4.2.0 to 4.2.1
- [Release notes](https://github.com/noties/Markwon/releases)
- [Changelog](https://github.com/noties/Markwon/blob/master/CHANGELOG.md)
- [Commits](https://github.com/noties/Markwon/compare/v4.2.0...v4.2.1)

Updates `ext-tasklist` from 4.2.0 to 4.2.1
- [Release notes](https://github.com/noties/Markwon/releases)
- [Changelog](https://github.com/noties/Markwon/blob/master/CHANGELOG.md)
- [Commits](https://github.com/noties/Markwon/compare/v4.2.0...v4.2.1)

Updates `html` from 4.2.0 to 4.2.1
- [Release notes](https://github.com/noties/Markwon/releases)
- [Changelog](https://github.com/noties/Markwon/blob/master/CHANGELOG.md)
- [Commits](https://github.com/noties/Markwon/compare/v4.2.0...v4.2.1)

Updates `syntax-highlight` from 4.2.0 to 4.2.1
- [Release notes](https://github.com/noties/Markwon/releases)
- [Changelog](https://github.com/noties/Markwon/blob/master/CHANGELOG.md)
- [Commits](https://github.com/noties/Markwon/compare/v4.2.0...v4.2.1)

Signed-off-by: dependabot-preview[bot] <[email protected]>
2020-02-03 02:13:17 +00:00
Nextcloud bot d60133bb86 [tx-robot] updated from transifex 2020-02-02 03:26:10 +00:00
Nextcloud bot c3be968843 [tx-robot] updated from transifex 2020-02-01 03:26:45 +00:00
Kilian Périsset d512b80331 Changed appcompat 1.2.0 to 1.2.0-alpha02
signed-off by Kilian Périsset <[email protected]>
2020-01-31 16:07:39 +01:00
Kilian Périsset badc7c92da Formated the code of ExtendedListFragment.java
(In order to avoid issues)
2020-01-31 14:59:54 +01:00
Kilian Périsset 4ec55ea677 Removed gradle heap-size property (fail) 2020-01-31 14:55:06 +01:00
Kilian Périsset 00e3ce6217 Removed translations (unneeded for this fix branch)
This reverts commit 938e4a6f44.

Signed-off-by: Kilian Périsset <[email protected]>
2020-01-31 14:54:11 +01:00
Tobias Kaminsky 9c12102d28 Merge pull request #5360 from nextcloud/testDocumentation
Test documentation
2020-01-31 12:53:42 +01:00
tobiasKaminsky b8d042e171 Basic documentation of how to test
add checklist as PR template

Signed-off-by: tobiasKaminsky <[email protected]>
2020-01-31 09:50:00 +01:00
Andy Scherzinger e617e57083 Merge pull request #5358 from nextcloud/transifexFix
No need of CDATA
2020-01-31 08:23:46 +01:00
Nextcloud bot 73697963c3 [tx-robot] updated from transifex 2020-01-31 07:01:08 +00:00
tobiasKaminsky bd99ee9959 No need of CDATA
Signed-off-by: tobiasKaminsky <[email protected]>
2020-01-31 07:57:15 +01:00
tobiasKaminsky d6275c4833 use 10dp
Signed-off-by: tobiasKaminsky <[email protected]>
2020-01-31 07:20:14 +01:00
tobiasKaminsky 763ee606d1 use radius, and do not only test for it
Signed-off-by: tobiasKaminsky <[email protected]>
2020-01-30 21:39:54 +01:00
tobiasKaminsky 82dd14f6bc extract doubled code
Signed-off-by: tobiasKaminsky <[email protected]>
2020-01-30 20:31:45 +01:00
Kilian Périsset 82baea3062 Normalized the code 2020-01-30 16:55:37 +01:00
Tobias Kaminsky 8dc162960b Merge pull request #5209 from nextcloud/ooDownloadFile
OnlyOffice: make download possible
2020-01-30 15:30:04 +01:00
dependabot-preview[bot] 7f558a14a2 Merge pull request #5352 from nextcloud/dependabot/gradle/daggerVersion-2.26 2020-01-30 14:25:59 +00:00
tobiasKaminsky 1ac4e1394b update screenshot test cases
Signed-off-by: tobiasKaminsky <[email protected]>
2020-01-30 14:56:50 +01:00
tobiasKaminsky 6dbce81c1d update screenshot
Signed-off-by: tobiasKaminsky <[email protected]>
2020-01-30 14:55:18 +01:00
dependabot-preview[bot] 1db777d41d Bump daggerVersion from 2.25.4 to 2.26
Bumps `daggerVersion` from 2.25.4 to 2.26.

Updates `dagger` from 2.25.4 to 2.26
- [Release notes](https://github.com/google/dagger/releases)
- [Changelog](https://github.com/google/dagger/blob/master/CHANGELOG.md)
- [Commits](https://github.com/google/dagger/compare/dagger-2.25.4...dagger-2.26)

Updates `dagger-android` from 2.25.4 to 2.26
- [Release notes](https://github.com/google/dagger/releases)
- [Changelog](https://github.com/google/dagger/blob/master/CHANGELOG.md)
- [Commits](https://github.com/google/dagger/compare/dagger-2.25.4...dagger-2.26)

Updates `dagger-android-support` from 2.25.4 to 2.26
- [Release notes](https://github.com/google/dagger/releases)
- [Changelog](https://github.com/google/dagger/blob/master/CHANGELOG.md)
- [Commits](https://github.com/google/dagger/compare/dagger-2.25.4...dagger-2.26)

Updates `dagger-compiler` from 2.25.4 to 2.26
- [Release notes](https://github.com/google/dagger/releases)
- [Changelog](https://github.com/google/dagger/blob/master/CHANGELOG.md)
- [Commits](https://github.com/google/dagger/compare/dagger-2.25.4...dagger-2.26)

Updates `dagger-android-processor` from 2.25.4 to 2.26
- [Release notes](https://github.com/google/dagger/releases)
- [Changelog](https://github.com/google/dagger/blob/master/CHANGELOG.md)
- [Commits](https://github.com/google/dagger/compare/dagger-2.25.4...dagger-2.26)

Signed-off-by: dependabot-preview[bot] <[email protected]>
2020-01-30 02:14:00 +00:00
Kilian Périsset 4bed2adc2f Merge branch 'fix/not-enough-space-dialog' of github.com:nextcloud/android into fix/not-enough-space-dialog 2020-01-29 10:39:52 +01:00
Kilian Périsset 52edda73f6 Formated the code and removed Pair 2020-01-29 10:39:45 +01:00
Tobias Kaminsky 4a9fc087a6 Merge pull request #5349 from nextcloud/devBranchMigration
dev: do not modify master, but push everything to dev branch
2020-01-29 08:39:20 +01:00
tobiasKaminsky cfb8306681 dev: do not modify master, but push everything to dev branch
Signed-off-by: tobiasKaminsky <[email protected]>
2020-01-29 08:38:03 +01:00
tobiasKaminsky 9d5e3da126 Merge remote-tracking branch 'origin/fix/not-enough-space-dialog' into fix/not-enough-space-dialog
# Conflicts:
#	src/main/java/com/owncloud/android/ui/dialog/SyncFileNotEnoughSpaceDialogFragment.java
2020-01-29 08:35:20 +01:00
Tobias Kaminsky e03b819ef3 daily dev 20200129
9fa16494b Merge pull request #5294 from nextcloud/reliableDev
2040a3507 daily dev 20200128
2020-01-29 03:38:37 +01:00
tobiasKaminsky 8737d9b835 add ui test
- some small code changes
- removed unneeded code

Signed-off-by: tobiasKaminsky <[email protected]>
2020-01-28 16:02:19 +01:00
Kilian Périsset e3c19410c8 Removed redundant code for Codacy grade 2020-01-28 14:05:50 +01:00
Kilian Périsset 1c44f2003d Removed codacy issues 2020-01-28 13:59:24 +01:00
Kilian Périsset 54f30670dd Removed translatable attribute from strings
Signed-off-by: Kilian Périsset <[email protected]>
2020-01-28 13:28:54 +01:00
tobiasKaminsky 56076dfd96 small typo enhancements
Signed-off-by: tobiasKaminsky <[email protected]>
2020-01-28 11:26:41 +01:00
Tobias Kaminsky 9fa16494b4 Merge pull request #5294 from nextcloud/reliableDev
reproducable dev version: use commit instead of master snapshot for dev version
2020-01-28 07:45:17 +01:00
Tobias Kaminsky 2040a35071 daily dev 20200128
55c1a8919 Merge pull request #5321 from nextcloud/dependabot/gradle/org.powermock-powermock-core-2.0.5
6fbf451f2 Merge pull request #5320 from nextcloud/dependabot/gradle/org.powermock-powermock-api-mockito2-2.0.5
c0991da09 Bump powermock-core from 2.0.4 to 2.0.5
a1f489af0 Bump powermock-api-mockito2 from 2.0.4 to 2.0.5
dd5c6043c Merge pull request #5322 from nextcloud/dependabot/gradle/org.powermock-powermock-module-junit4-2.0.5
b53c96cba Merge pull request #5218 from nextcloud/fix_multitask
fc6889291 [tx-robot] updated from transifex
b0003f04b Bump powermock-module-junit4 from 2.0.4 to 2.0.5
a5acbbfe0 [tx-robot] updated from transifex
01ba3bef9 daily dev 20200125
2020-01-28 03:38:25 +01:00
Andy Scherzinger 55c1a89196 Merge pull request #5321 from nextcloud/dependabot/gradle/org.powermock-powermock-core-2.0.5
Bump powermock-core from 2.0.4 to 2.0.5
2020-01-27 16:41:53 +01:00
Andy Scherzinger 6fbf451f28 Merge pull request #5320 from nextcloud/dependabot/gradle/org.powermock-powermock-api-mockito2-2.0.5
Bump powermock-api-mockito2 from 2.0.4 to 2.0.5
2020-01-27 16:41:28 +01:00
Kilian Périsset 03a307825d Finished "Not Enough Space" dialog + Optimized UX 2020-01-27 15:29:46 +01:00
dependabot-preview[bot] c0991da098 Bump powermock-core from 2.0.4 to 2.0.5
Bumps [powermock-core](https://github.com/powermock/powermock) from 2.0.4 to 2.0.5.
- [Release notes](https://github.com/powermock/powermock/releases)
- [Changelog](https://github.com/powermock/powermock/blob/release/2.x/docs/changelog.txt)
- [Commits](https://github.com/powermock/powermock/compare/powermock-2.0.4...powermock-2.0.5)

Signed-off-by: dependabot-preview[bot] <[email protected]>
2020-01-27 13:48:08 +00:00
dependabot-preview[bot] a1f489af08 Bump powermock-api-mockito2 from 2.0.4 to 2.0.5
Bumps [powermock-api-mockito2](https://github.com/powermock/powermock) from 2.0.4 to 2.0.5.
- [Release notes](https://github.com/powermock/powermock/releases)
- [Changelog](https://github.com/powermock/powermock/blob/release/2.x/docs/changelog.txt)
- [Commits](https://github.com/powermock/powermock/compare/powermock-2.0.4...powermock-2.0.5)

Signed-off-by: dependabot-preview[bot] <[email protected]>
2020-01-27 13:48:08 +00:00
dependabot-preview[bot] dd5c6043cd Merge pull request #5322 from nextcloud/dependabot/gradle/org.powermock-powermock-module-junit4-2.0.5 2020-01-27 13:46:57 +00:00
Tobias Kaminsky b53c96cba0 Merge pull request #5218 from nextcloud/fix_multitask
Fix #5213 app is excluded from recent/current apps
2020-01-27 08:39:05 +01:00
Nextcloud bot fc68892919 [tx-robot] updated from transifex 2020-01-27 03:29:16 +00:00
dependabot-preview[bot] b0003f04be Bump powermock-module-junit4 from 2.0.4 to 2.0.5
Bumps [powermock-module-junit4](https://github.com/powermock/powermock) from 2.0.4 to 2.0.5.
- [Release notes](https://github.com/powermock/powermock/releases)
- [Changelog](https://github.com/powermock/powermock/blob/release/2.x/docs/changelog.txt)
- [Commits](https://github.com/powermock/powermock/compare/powermock-2.0.4...powermock-2.0.5)

Signed-off-by: dependabot-preview[bot] <[email protected]>
2020-01-27 02:14:10 +00:00
Nextcloud bot a5acbbfe06 [tx-robot] updated from transifex 2020-01-25 03:27:00 +00:00
Tobias Kaminsky 01ba3bef96 daily dev 20200125
3b49f56d1 [tx-robot] updated from transifex
2020-01-25 03:38:26 +01:00
Kilian Périsset 9fac55da6b Added args for SyncFileNotEnoughSpaceFragment (unfinished)
Caption support is missing
2020-01-24 15:08:03 +01:00
Kilian Périsset 5c146d4f08 Added translations for dialog 2020-01-24 14:37:15 +01:00
Kilian Périsset 8e09c99f1f Added dialog when sync is too heavy for device (unfinished) 2020-01-24 14:19:40 +01:00
Nextcloud bot 3b49f56d15 [tx-robot] updated from transifex 2020-01-24 03:26:39 +00:00
Andy Scherzinger e4f099237c Merge pull request #5203 from nextcloud/directEditingPre5
prevent direct editing on < Lollipop
2020-01-23 18:54:06 +01:00
Kilian Périsset 579140b7c4 Cleaned a bit the code + Fixed cross display bug 2020-01-23 15:54:09 +01:00
tobiasKaminsky c14725fdbc reproducable dev version: use commit instead of master snapshot for dev version
Signed-off-by: tobiasKaminsky <[email protected]>
2020-01-23 13:43:50 +01:00
dependabot-preview[bot] 04b5b6ae39 Merge pull request #5288 from nextcloud/dependabot/gradle/androidx.work-work-runtime-2.3.0 2020-01-23 11:41:03 +00:00
dependabot-preview[bot] fc8c9b7bba Bump work-runtime from 2.2.0 to 2.3.0
Bumps work-runtime from 2.2.0 to 2.3.0.

Signed-off-by: dependabot-preview[bot] <[email protected]>
2020-01-23 11:34:55 +01:00
tobiasKaminsky b280387188 migrate to 1.4
Signed-off-by: tobiasKaminsky <[email protected]>
2020-01-23 11:32:43 +01:00
Tobias Kaminsky 63b5276c84 Merge pull request #5289 from nextcloud/dependabot/gradle/androidx.lifecycle-lifecycle-viewmodel-ktx-2.2.0
Bump lifecycle-viewmodel-ktx from 2.1.0 to 2.2.0
2020-01-23 11:02:40 +01:00
dependabot-preview[bot] ed2e90bf30 Merge pull request #5286 from nextcloud/dependabot/gradle/androidx.work-work-runtime-ktx-2.3.0 2020-01-23 10:01:56 +00:00
Nextcloud bot ce6ce06636 [tx-robot] updated from transifex 2020-01-23 03:31:17 +00:00
dependabot-preview[bot] b62d291940 Bump lifecycle-viewmodel-ktx from 2.1.0 to 2.2.0
Bumps lifecycle-viewmodel-ktx from 2.1.0 to 2.2.0.

Signed-off-by: dependabot-preview[bot] <[email protected]>
2020-01-23 02:14:45 +00:00
dependabot-preview[bot] d42566be72 Bump work-runtime-ktx from 2.2.0 to 2.3.0
Bumps work-runtime-ktx from 2.2.0 to 2.3.0.

Signed-off-by: dependabot-preview[bot] <[email protected]>
2020-01-23 02:12:59 +00:00
Kilian Périsset 938e4a6f44 Added translations to prepare pre-search + Fixed fab bug 2020-01-22 18:58:43 +01:00
tobiasKaminsky 4fb140d275 round corners only in list view
Signed-off-by: tobiasKaminsky <[email protected]>
2020-01-22 13:45:31 +01:00
Nextcloud bot f783eed9b5 [tx-robot] updated from transifex 2020-01-22 03:30:22 +00:00
Tobias Kaminsky 642682b21f daily dev 20200122
775753930 Merge pull request #5248 from nextcloud/material110RC2
c684ec692 Merge pull request #5249 from nextcloud/changelog
ce2971386 Merge pull request #5270 from nextcloud/addSeparator
cd6acdd05 Merge pull request #5269 from nextcloud/gradleBump
fc8a5dd43 Merge pull request #5267 from nextcloud/devDBupdate
289a83635 OC bottom list improvement - same padding - add "create new" for creators
4532c5b1c Merge pull request #5268 from nextcloud/runCoverageOnlyOnCI
368bd325a use newest gradle
94f17a779 re-enable: coverage only on CI
491de101a Fix duplicated rich_workspace in dev version
066a1a342 [tx-robot] updated from transifex
e9d1c51d7 daily dev 20200121
2020-01-22 03:40:10 +01:00
Andy Scherzinger 7757539309 Merge pull request #5248 from nextcloud/material110RC2
bump material to 1.1.0RC2
2020-01-21 22:55:20 +01:00
Andy Scherzinger c684ec6922 Merge pull request #5249 from nextcloud/changelog
fix formatting of changelog
2020-01-21 22:46:48 +01:00
Andy Scherzinger ce2971386d Merge pull request #5270 from nextcloud/addSeparator
OC bottom list improvement
2020-01-21 22:46:26 +01:00
Kilian Périsset 10b661744a Fixed onBackPressed bug (inactive button) + Refactored and optimized the code 2020-01-21 18:09:50 +01:00
Andy Scherzinger cd6acdd05e Merge pull request #5269 from nextcloud/gradleBump
use newest gradle
2020-01-21 16:50:43 +01:00
Andy Scherzinger fc8a5dd43e Merge pull request #5267 from nextcloud/devDBupdate
Fix duplicated rich_workspace in dev version
2020-01-21 16:01:07 +01:00
tobiasKaminsky 289a83635d OC bottom list improvement
- same padding
- add "create new" for creators

Signed-off-by: tobiasKaminsky <[email protected]>
2020-01-21 13:01:28 +01:00
Tobias Kaminsky 4532c5b1c0 Merge pull request #5268 from nextcloud/runCoverageOnlyOnCI
re-enable: coverage only on CI
2020-01-21 11:56:27 +01:00
tobiasKaminsky 368bd325a8 use newest gradle
Signed-off-by: tobiasKaminsky <[email protected]>
2020-01-21 11:00:02 +01:00
tobiasKaminsky 94f17a7797 re-enable: coverage only on CI
Signed-off-by: tobiasKaminsky <[email protected]>
2020-01-21 09:44:42 +01:00
tobiasKaminsky 491de101ac Fix duplicated rich_workspace in dev version
Signed-off-by: tobiasKaminsky <[email protected]>
2020-01-21 09:17:34 +01:00
Nextcloud bot 066a1a3424 [tx-robot] updated from transifex 2020-01-21 03:29:14 +00:00
Tobias Kaminsky e9d1c51d70 daily dev 20200121
a07a165fb Merge pull request #5252 from nextcloud/fix/lock-drawer-video-preview
2f02f6bdf Added locking and unlocking of Drawer in Videos Activities/Fragments
465b209ec Merge pull request #5216 from nextcloud/fix/lock-drawer-in-medias-activities
b2fb207a1 Merge pull request #5234 from nextcloud/moveAddFolderInfo
521c89d83 Merge pull request #5229 from nextcloud/colorLauncher
d31223b59 fix gradle warning
4ac216dd3 Merge pull request #5247 from nextcloud/dependabot/gradle/com.google.android-flexbox-2.0.1
d0413af7b [tx-robot] updated from transifex
f3ccaa4d1 Bump flexbox from 2.0.0 to 2.0.1
48a9d752b [tx-robot] updated from transifex
1c483e140 move create rich workspace into bottom sheet
8d9148f5f Launcher: color statusbar / navigation bar in primary color
9e8f0fda7 [tx-robot] updated from transifex
8b1fd4f51 daily dev 20200118
2020-01-21 03:37:19 +01:00
Andy Scherzinger a07a165fb8 Merge pull request #5252 from nextcloud/fix/lock-drawer-video-preview
Added locking and unlocking of Drawer in Videos Activities/Fragments
2020-01-20 13:02:03 +01:00
Sebastian-Ion TINCU 531c0187a8 Fix #2753 "Unresponsive App" error popup when syncing
Always start SyncFolderOperations as background services to prevent
ANRs when they take a little more time to complete.

Signed-off-by: Sebastian-Ion TINCU <[email protected]>
2020-01-20 12:56:06 +01:00
Kilian Périsset 2f02f6bdf4 Added locking and unlocking of Drawer in Videos Activities/Fragments 2020-01-20 12:30:02 +01:00
Andy Scherzinger f52840bcd6 fix formatting
Signed-off-by: Andy Scherzinger <[email protected]>
2020-01-20 11:10:31 +01:00
Andy Scherzinger 465b209ec9 Merge pull request #5216 from nextcloud/fix/lock-drawer-in-medias-activities
Locked and hid the drawer in Pictures Preview
2020-01-20 11:02:28 +01:00
Andy Scherzinger 254b2a9347 bump material zu 1.1.0RC2
Signed-off-by: Andy Scherzinger <[email protected]>
2020-01-20 10:42:19 +01:00
Andy Scherzinger b2fb207a1a Merge pull request #5234 from nextcloud/moveAddFolderInfo
move create rich workspace into bottom sheet
2020-01-20 10:09:16 +01:00
Andy Scherzinger 521c89d830 Merge pull request #5229 from nextcloud/colorLauncher
Launcher: color statusbar / navigation bar in primary color
2020-01-20 09:56:46 +01:00
Andy Scherzinger d31223b59c fix gradle warning
Signed-off-by: Andy Scherzinger <[email protected]>
2020-01-20 08:34:51 +01:00
dependabot-preview[bot] 4ac216dd30 Merge pull request #5247 from nextcloud/dependabot/gradle/com.google.android-flexbox-2.0.1 2020-01-20 07:11:52 +00:00
Nextcloud bot d0413af7bd [tx-robot] updated from transifex 2020-01-20 03:27:12 +00:00
dependabot-preview[bot] f3ccaa4d17 Bump flexbox from 2.0.0 to 2.0.1
Bumps [flexbox](https://github.com/google/flexbox-layout) from 2.0.0 to 2.0.1.
- [Release notes](https://github.com/google/flexbox-layout/releases)
- [Commits](https://github.com/google/flexbox-layout/compare/2.0.0...2.0.1)

Signed-off-by: dependabot-preview[bot] <[email protected]>
2020-01-20 02:14:07 +00:00
Nextcloud bot 48a9d752b3 [tx-robot] updated from transifex 2020-01-19 03:28:29 +00:00
tobiasKaminsky 1c483e140d move create rich workspace into bottom sheet
Signed-off-by: tobiasKaminsky <[email protected]>
2020-01-18 18:08:54 +01:00
tobiasKaminsky ef0b0fe9ee images: slightly rounded corners
Signed-off-by: tobiasKaminsky <[email protected]>
2020-01-18 16:22:54 +01:00
tobiasKaminsky 8d9148f5fa Launcher: color statusbar / navigation bar in primary color
Signed-off-by: tobiasKaminsky <[email protected]>
2020-01-18 14:29:36 +01:00
Nextcloud bot 9e8f0fda7a [tx-robot] updated from transifex 2020-01-18 03:31:28 +00:00
Tobias Kaminsky 8b1fd4f515 daily dev 20200118
82de38179 Merge pull request #5220 from nextcloud/changelog-master-stable-3.10.0
8f929ab33 Add changelog for 3.10.0
ae6251bf6 daily dev 20200117
2020-01-18 03:37:20 +01:00
Andy Scherzinger 82de38179f Merge pull request #5220 from nextcloud/changelog-master-stable-3.10.0
Add changelog for 3.10.0
2020-01-17 09:58:04 +01:00
tobiasKaminsky 8f929ab332 Add changelog for 3.10.0
Signed-off-by: tobiasKaminsky <[email protected]>
2020-01-17 09:36:42 +01:00
Tobias Kaminsky ae6251bf6f daily dev 20200117
9bf2cbd26 Merge pull request #5214 from nextcloud/fix/search-in-video-preview
dc3c030e9 Removed search icon in toolbar during media/video preview
5d15aa4ad [tx-robot] updated from transifex
3753a184b [tx-robot] updated from transifex
5849ba257 daily dev 20200115
2020-01-17 03:37:07 +01:00
Andy Scherzinger 9bf2cbd26f Merge pull request #5214 from nextcloud/fix/search-in-video-preview
Removed search icon in toolbar during media/video preview
2020-01-16 22:04:23 +01:00
Joris Bodin 97eda02db6 Fix #5213 2020-01-16 18:18:42 +01:00
Kilian Périsset 113575b7bf Locked and hid the drawer in Pictures Preview 2020-01-16 15:27:09 +01:00
Kilian Périsset dc3c030e94 Removed search icon in toolbar during media/video preview 2020-01-16 11:25:14 +01:00
Nextcloud bot 5d15aa4add [tx-robot] updated from transifex 2020-01-16 03:31:11 +00:00
tobiasKaminsky af24dafd7b OnlyOffice: make download possible
Signed-off-by: tobiasKaminsky <[email protected]>
2020-01-15 16:25:23 +01:00
tobiasKaminsky 4eec8905ae prevent direct editing on < NOUGAT
Signed-off-by: tobiasKaminsky <[email protected]>
2020-01-15 10:05:17 +01:00
Nextcloud bot 3753a184b6 [tx-robot] updated from transifex 2020-01-15 03:27:33 +00:00
Tobias Kaminsky 5849ba2576 daily dev 20200115
6f86e497f Merge pull request #5193 from nextcloud/uploadInReadonlyFolder
5ddc5a890 Merge pull request #5189 from nextcloud/removeLines
2011f5211 Merge pull request #5157 from nextcloud/ezaquarii/fix-npe-in-get-user-in-user-account-manager
4cb800ea1 Merge pull request #5187 from nextcloud/fab
447cac9af Upload button: disable/grey when folder is read-only
8b7d39c28 dark background to #151515 minor design changes for dark theme
7ba3bf0cf FAB: show disabled correctly again
f68e9e06d Merge pull request #5181 from nextcloud/vCard30
a8f41615d Merge pull request #5172 from nextcloud/preventNPE
b2a1245c6 Merge pull request #5175 from nextcloud/rwEnhancements
e2c361375 [tx-robot] updated from transifex
09183fec1 export vCard to 3.0 version
f8c9af44a simplify if statement
33b086195 prevent NPE
f01cdd65a UI enhancements to rich workspaces
b1f198ff6 [tx-robot] updated from transifex
a4287380a [tx-robot] updated from transifex
09d98e16c daily dev 20200112
2020-01-15 03:38:37 +01:00
Tobias Kaminsky 6f86e497fc Merge pull request #5193 from nextcloud/uploadInReadonlyFolder
Upload button: disable/grey when folder is read-only
2020-01-14 20:01:54 +01:00
Tobias Kaminsky 5ddc5a890f Merge pull request #5189 from nextcloud/removeLines
Dark theme enhancements
2020-01-14 20:01:38 +01:00
Tobias Kaminsky 2011f5211b Merge pull request #5157 from nextcloud/ezaquarii/fix-npe-in-get-user-in-user-account-manager
Fix NPE in UserAccountManagerImpl.getUser(CharSequence)
2020-01-14 17:21:12 +01:00
Tobias Kaminsky 4cb800ea13 Merge pull request #5187 from nextcloud/fab
FAB: show disabled correctly again
2020-01-14 17:14:53 +01:00
tobiasKaminsky 447cac9af9 Upload button: disable/grey when folder is read-only
Signed-off-by: tobiasKaminsky <[email protected]>
2020-01-14 16:29:09 +01:00
tobiasKaminsky 8b7d39c289 dark background to #151515
minor design changes for dark theme

Signed-off-by: tobiasKaminsky <[email protected]>
2020-01-14 14:20:31 +01:00
tobiasKaminsky 7ba3bf0cf9 FAB: show disabled correctly again
Signed-off-by: tobiasKaminsky <[email protected]>
2020-01-14 11:44:29 +01:00
Tobias Kaminsky f68e9e06d7 Merge pull request #5181 from nextcloud/vCard30
Export vCard to version 3.0
2020-01-14 10:47:10 +01:00
Tobias Kaminsky a8f41615d6 Merge pull request #5172 from nextcloud/preventNPE
prevent NPE
2020-01-14 10:00:51 +01:00
Tobias Kaminsky b2a1245c6d Merge pull request #5175 from nextcloud/rwEnhancements
UI enhancements to rich workspaces
2020-01-14 09:59:38 +01:00
Nextcloud bot e2c3613756 [tx-robot] updated from transifex 2020-01-14 03:28:22 +00:00
Andy Scherzinger 09183fec15 export vCard to 3.0 version
Resolves #4727

Signed-off-by: Andy Scherzinger <[email protected]>
2020-01-13 22:13:30 +01:00
Andy Scherzinger f8c9af44a0 simplify if statement
Signed-off-by: Andy Scherzinger <[email protected]>
2020-01-13 20:34:53 +01:00
tobiasKaminsky 33b0861955 prevent NPE
Signed-off-by: tobiasKaminsky <[email protected]>
2020-01-13 20:34:52 +01:00
tobiasKaminsky f01cdd65ae UI enhancements to rich workspaces
Signed-off-by: tobiasKaminsky <[email protected]>
2020-01-13 19:06:49 +01:00
Nextcloud bot b1f198ff65 [tx-robot] updated from transifex 2020-01-13 03:27:25 +00:00
dependabot-preview[bot] 3007477d90 Bump detekt-gradle-plugin from 1.3.0 to 1.4.0
Bumps detekt-gradle-plugin from 1.3.0 to 1.4.0.

Signed-off-by: dependabot-preview[bot] <[email protected]>
2020-01-13 02:13:46 +00:00
Nextcloud bot a4287380ac [tx-robot] updated from transifex 2020-01-12 03:28:46 +00:00
Tobias Kaminsky 09d98e16c5 daily dev 20200112
ec515d0aa [tx-robot] updated from transifex
422a61d8d Merge pull request #5136 from nextcloud/systemDefault
6e96e99de Merge pull request #5130 from nextcloud/createRichWorkspace
b7a7772cf Merge pull request #5122 from nextcloud/firstRun
603825e36 update screenshot
c4d5e41a4 Merge pull request #5143 from nextcloud/background
c6d89edf8 only allow rich workspace creation on >= Lollipop
87dae2ef0 show first run again
91252852c manually increasing lint due to "autoMirrored" warning
4c10cf5d7 launcher: correct folder position according to AS
51fdf9461 [tx-robot] updated from transifex
e0b77f910 daily dev 20200110
2020-01-12 03:37:14 +01:00
nextcloud-android-bot 19f2a5024d Drone: update FindBugs results to reflect reduced error/warning count [skip ci]
Signed-off-by: nextcloud-android-bot <[email protected]>
2020-01-11 21:40:56 +00:00
Chris Narkiewicz fe404f0e25 Fix NPE in UserAccountManagerImpl.getUser(CharSequence)
Optional.of() called on nullable value causes NPE.
We should use Optional.ofNullable() instead, as the
argument can be null by design.

Fixes #5155

Signed-off-by: Chris Narkiewicz <[email protected]>
2020-01-11 21:31:04 +00:00
Nextcloud bot ec515d0aad [tx-robot] updated from transifex 2020-01-11 03:28:17 +00:00
Tobias Kaminsky 422a61d8de Merge pull request #5136 from nextcloud/systemDefault
make "follow system" default for dark theme
2020-01-10 20:16:11 +01:00
Tobias Kaminsky 6e96e99dea Merge pull request #5130 from nextcloud/createRichWorkspace
rich workspaces
2020-01-10 19:45:02 +01:00
tobiasKaminsky 603825e36f update screenshot
Signed-off-by: tobiasKaminsky <[email protected]>
2020-01-10 12:09:57 +01:00
tobiasKaminsky c6d89edf85 only allow rich workspace creation on >= Lollipop
Signed-off-by: tobiasKaminsky <[email protected]>
2020-01-10 09:59:15 +01:00
tobiasKaminsky 91252852c7 manually increasing lint due to "autoMirrored" warning
Signed-off-by: tobiasKaminsky <[email protected]>
2020-01-10 09:32:43 +01:00
tobiasKaminsky 4b2002a9a3 better error description
Signed-off-by: tobiasKaminsky <[email protected]>
2020-01-09 16:10:58 +01:00
tobiasKaminsky 1977267826 fix FAB position
Signed-off-by: tobiasKaminsky <[email protected]>
2020-01-09 16:09:46 +01:00
tobiasKaminsky 15ac231818 make "follow system" default for dark theme
Signed-off-by: tobiasKaminsky <[email protected]>
2020-01-09 15:53:03 +01:00
tobiasKaminsky 0e5a772e63 rich workspaces
- show button to create folder info
- bug fixes

Signed-off-by: tobiasKaminsky <[email protected]>
2020-01-09 15:17:19 +01:00
Fabian Bettag 4e91c23bb5 Add check to make sure cursor is initialized
Fixes #4702
Fixes #4919

Signed-off-by: Fabian <[email protected]>
2020-01-02 17:51:14 +01:00
296 changed files with 10158 additions and 6522 deletions

No files matched your search

+16 -1
View File
@@ -67,6 +67,7 @@ steps:
commands:
- scripts/checkIfRunDrone.sh $GIT_USERNAME $GIT_TOKEN $DRONE_PULL_REQUEST || exit 0
- emulator-headless -avd android-27 -no-snapshot -gpu swiftshader_indirect -no-window -no-audio -skin 500x833 &
- sed -i s'#<bool name="is_beta">false</bool>#<bool name="is_beta">true</bool>#'g src/main/res/values/setup.xml
- ./gradlew assembleGplay
- ./gradlew assembleGplayDebug
- scripts/wait_for_emulator.sh
@@ -101,7 +102,21 @@ steps:
services:
- name: server
image: nextcloudci/server:server-3
image: nextcloudci/server:server-17 # also change in updateScreenshots.sh
commands:
- /usr/local/bin/initnc.sh
- su www-data -c "OC_PASS=user1 php /var/www/html/occ user:add --password-from-env --display-name='User One' user1"
- su www-data -c "OC_PASS=user2 php /var/www/html/occ user:add --password-from-env --display-name='User Two' user2"
- su www-data -c "OC_PASS=user3 php /var/www/html/occ user:add --password-from-env --display-name='User Three' user3"
- su www-data -c "php /var/www/html/occ user:setting user2 files quota 1G"
- su www-data -c "php /var/www/html/occ group:add users"
- su www-data -c "php /var/www/html/occ group:adduser users user1"
- su www-data -c "php /var/www/html/occ group:adduser users user2"
- su www-data -c "git clone -b master https://github.com/nextcloud/activity.git /var/www/html/apps/activity/"
- su www-data -c "php /var/www/html/occ app:enable activity"
- su www-data -c "git clone -b master https://github.com/nextcloud/text.git /var/www/html/apps/text/"
- su www-data -c "php /var/www/html/occ app:enable text"
- /usr/local/bin/run.sh
trigger:
branch:
+8
View File
@@ -0,0 +1,8 @@
### Testing
Writing tests is very important. Please try to write some tests for your PR.
If you need help, please do not hesitate to ask in this PR for help.
- [ ] [unit tests](https://github.com/nextcloud/android/blob/master/CONTRIBUTING.md#unit-tests)
- [ ] [instrumented tests](https://github.com/nextcloud/android/blob/master/CONTRIBUTING.md#instrumented-tests)
- [ ] [UI tests](https://github.com/nextcloud/android/blob/master/CONTRIBUTING.md#ui-tests)
+1 -1
View File
@@ -193,4 +193,4 @@
</arrangement>
</codeStyleSettings>
</code_scheme>
</component>
</component>
+25 -3
View File
@@ -1,17 +1,39 @@
3.9.2 (December, 05, 2019)
## 3.10.1 (February, 05, 2020)
- fix crash on self-signed certificates
- fix openOffice open files with special chars
For a full list, please see https://github.com/nextcloud/android/milestone/45
## 3.10.0 (January, 17, 2020)
- Dark theme (@dan0xii, @AndyScherzinger)
- Rich workspace (NC18+)
- collaborative text editor (NC18+)
- links in Markdown previews clickable (@AndyScherzinger)
- Show/Hide auto upload list items (@AndyScherzinger)
- drop 4.0.x support
- outdated server warning set to NC15
- latest supported version NC13
For a full list, please see https://github.com/nextcloud/android/milestone/40
## 3.9.2 (December, 05, 2019)
- HOTFIX: fix login loop
- Fix crash on opening png images
- Translation updates
3.9.1 (December, 04, 2019)
For a full list, please see https://github.com/nextcloud/android/milestone/44
## 3.9.1 (December, 04, 2019)
- Fix crash on opening png images
- Translation updates
For a full list, please see https://github.com/nextcloud/android/milestone/43
3.9.0 (November, 12, 2019)
## 3.9.0 (November, 12, 2019)
- preview Markdown with syntax highlighting @AndyScherzinger
- improved DavX5 integration @bitfireAT
+175 -40
View File
@@ -5,40 +5,46 @@
# Index
1. Guidelines
1. Issue reporting
1. Labels
1. Pull request (PR)
1. Issue
1. Bug workflow
1. Contributing to Source Code
1. Developing process
1. Branching model
1. Android Studio formatter setup
1. Build variants
1. Contribution process
1. Fork and download android/master repository
1. Create pull request
1. Create another pull request
1. Backport pull request
1. Pull requests that also need changes on library
1. Adding new files
1. File naming
1. Menu files
1. Translations
1. Releases
1. Types
1. Stable
1. Release Candidate
1. Dev
1. Version Name and number
1. Stable / Release candidate
1. Dev
1. Release cycle
1. Release Process
1. Stable Release
1. Release Candidate Release
1. Development Dev
1. [Guidelines](#guidelines)
1. [Issue reporting](#issue-reporting)
1. [Labels](#labels)
1. [Pull request](#pull-request)
1. [Issue](#issue)
1. [Bug workflow](#bug-workflow)
1. [Contributing to Source Code](#contributing-to-source-code)
1. [Developing process](#developing-process)
1. [Branching model](#branching-model)
1. [Android Studio formatter setup](#android-studio-formatter-setup)
1. [Build variants](#build-variants)
1. [Contribution process](#contribution-process)
1. [Fork and download android repository](#fork-and-download-android-repository)
1. [Create pull request](#create-pull-request)
1. [Create another pull request](#create-another-pull-request)
1. [Backport pull request](#backport-pull-request)
1. [Pull requests that also need changes on library](#pull-requests-that-also-need-changes-on-library)
1. [Adding new files](#adding-new-files)
1. [Testing](#testing)
1. [File naming](#file-naming)
1. [Menu files](#menu-files)
1. [Translations](#translations)
1. [Engineering practices](#engineering-practices)
1. [Approach to technical debt](#approach-to-technical-debt)
1. [Dependency injection](#dependency-injection)
1. [Custom platform APIs](#custom-platform-apis)
1. [Testing](#testing)
1. [Releases](#releases)
1. [Types](#types)
1. [Stable](#stable)
1. [Release Candidate](#release-candidate)
1. [Dev](#dev)
1. [Version Name and number](#version-name-and-number)
1. [Stable / Release candidate](#stable-release-candidate)
1. [Dev](#dev)
1. [Release cycle](#release-cycle)
1. [Release Process](#release-process)
1. [Stable Release](#stable-release)
1. [Release Candidate Release](#release-candidate-release)
1. [Development Dev](#development-dev)
# Guidelines
@@ -117,18 +123,18 @@ There are three build variants
* For your first contribution start a pull request on master.
### 1. Fork and download android/master repository:
### Fork and download android repository:
* Please follow [SETUP.md](https://github.com/nextcloud/android/blob/master/SETUP.md) to setup Nextcloud Android app work environment.
### 2. Create pull request:
### Create pull request:
* Commit your changes locally: ```git commit -a```
* Push your changes to your GitHub repo: ```git push```
* Browse to <https://github.com/YOURGITHUBNAME/android/pulls> and issue pull request
* Enter description and send pull request.
### 3. Create another pull request:
### Create another pull request:
To make sure your new pull request does not contain commits which are already contained in previous PRs, create a new branch which is a clone of upstream/master.
* ```git fetch upstream```
@@ -137,12 +143,12 @@ To make sure your new pull request does not contain commits which are already co
* Push branch to server: ```git push -u origin name_of_local_master_branch```
* Use GitHub to issue PR
### 4. Backport pull request:
### Backport pull request:
Use backport-bot via "/backport to stable-version", e.g. "/backport to stable-3.7".
This will automatically add "backport-request" label to PR and bot will create a new PR to targeted branch once the base PR is merged.
If automatic backport fails, it will create a comment.
### 5. Pull requests that also need changes on library
### Pull requests that also need changes on library
For speeding up developing, we do use a master snapshot of nextcloud-library, provided by jitpack.io.
This means that if a breaking change is merged on library, master branch of the app will fail.
To limit this risk please follow this approach:
@@ -156,7 +162,7 @@ Once both PRs are reviewed and ready to merge:
With this approach the "downtime" of not building master is limited to the timestamp between merge lib PR and merging app PR, which is only limited by CI.
### 6. Adding new files
### Adding new files
If you create a new file it needs to contain a license header. We encourage you to use the same license (AGPL3+) as we do.
Copyright of Nextcloud GmbH is optional.
@@ -238,6 +244,52 @@ Source code of app:
-->
```
### Testing
- testing is very important, but is lacking a lot on this project. Starting with 2020 we aim to write tests for every
new pull request.
- Code coverage can be found [here](https://codecov.io/gh/nextcloud/android).
#### Unit tests
- small, isolated tests, with no need of Android SDK
- code coverage can be directly shown via right click on test and select "Run Test with Coverage"
#### Instrumented tests
- tests to see larger code working in correct way
- tests that require parts of Android SDK
- best to avoid server communication, see https://github.com/nextcloud/android/pull/3624
- run all tests ```./gradlew createGplayDebugCoverageReport -Pcoverage=true```
- run selective test class: ```./gradlew createGplayDebugCoverageReport -Pcoverage=true
-Pandroid.testInstrumentationRunnerArguments.class=com.owncloud.android.datamodel.FileDataStorageManagerTest```
- run multiple test classes:
- separate by ","
- ```./gradlew createGplayDebugCoverageReport -Pcoverage=true -Pandroid.testInstrumentationRunnerArguments.class=com.owncloud.android.datamodel.FileDataStorageManagerTest,com.nextcloud.client.FileDisplayActivityIT```
- run one test in class: ```./gradlew createGplayDebugCoverageReport -Pcoverage=true
-Pandroid.testInstrumentationRunnerArguments.class=com.owncloud.android.datamodel.FileDataStorageManagerTest#saveNewFile```
- JaCoCo results are shown as html: firefox ./build/reports/coverage/gplay/debug/index.html
#### UI tests
We use [shot](https://github.com/Karumi/Shot) for taking screenshots and compare them
- check screenshots: ```./gradlew executeScreenshotTests ```
- update/generate new screenshots: ```scripts/updateScreenshots.sh ```
- in this script are samples how to only execute a given class/test
- this will fire up docker & emulator to ensure that screenshots look the same
- creating own UI comparision tests:
- add IntentsTestRule for launching activity directly:
```java
@Rule public IntentsTestRule<SettingsActivity> activityRule = new IntentsTestRule<>(SettingsActivity.class,
true,
false);
```
- in test method:
```java
Activity activity = activityRule.launchActivity(null);
…do something, e.g. navigate, create folder, etc. …
Screenshot.snapActivity(activity).record();
```
- best practise is to first create test with emulator too see behaviour and then create screenshots
## File naming
The file naming patterns are inspired and based on [Ribot's Android Project And Code Guidelines](https://github.com/ribot/android-guidelines/blob/c1d8c9c904eb31bf01fe24aadb963b74281fe79a/project_and_code_guidelines.md).
@@ -257,12 +309,95 @@ Similar to layout files, menu files should match the name of the component. For
A good practice is to not include the word `menu` as part of the name because these files are already located in the `menu` directory. In case a component uses several menus in different places (via popup menus) then the resource name would be extended. For example, if the user profile activity has two popup menus for configuring the users settings and one for the handling group assignments then the file names for the menus would be: `activity_user_profile_user_settings.xml` and `activity_user_profile_group_assignments.xml`.
## Translations
We manage translations via [Transifex](https://www.transifex.com/nextcloud/nextcloud/android/). So just request joining the translation team for Android on the site and start translating. All translations will then be automatically pushed to this repository, there is no need for any pull request for translations.
If you need to change a translation, do not change it, but give it new key. This way the translation stays backward compatible as we automatically backport translated strings to last versions.
When submitting PRs with changed translations, please only submit changes to values/strings.xml and not changes to translated files. These will be overwritten by next merge of transifex-but and increase PR review.
## Engineering practices
This section contains some general guideliens for new contributors, based on common issues flagged during code review.
### Approach to technical debt
TL;DR Non-Stop Litter Picking Party!
We recognize the importance of technical debt that can slow down development, make bufixing difficult and
discourage future contributors.
We are mindful of the [Broken Windows Theory](https://en.wikipedia.org/wiki/Broken_windows_theory) and we'd like
actively promote and encourage contributors to apply The Scout's Rule: *"Always leave the campground cleaner than
you found it"*. Simple, little improvements will sum up and will be very appreciated by Nextcloud team.
We also promise to actively support and mentor contributors that help us to improve code quality, as we understand
that this process is challenging and requires deep understanding of the application codebase.
### Dependency injection
TL;DR Avoid calling constructors inside constructors.
In effort to modernize the codebase we are applying [Dependency Injection](https://en.wikipedia.org/wiki/Dependency_injection)
whenever possible. We use 2 approaches: automatic and manual.
We are using [Dagger 2](https://dagger.dev/) to inject dependencies into major Android components only:
* `Activity`
* `Fragment`
* `Service`
* `BroadcastReceiver`
* `ContentProvider`
This process is fairly automatic, with `@Inject` annotation being sufficient to supply properly initialized
objects. Android lifecycle callbacks allow us to do most of the work without effort.
For other application sub-components we prefer to use constructor injection and manually provide required dependencies.
This combination allows us to benefit from automation when it provides most value, does not tie rest of the code
to any specific framework and stimulates continuous code modernization through iterative refactoring of all minor
elements.
### Custom platform APIs
TL;DR Avoid Android platform APIs.
Nextcloud Android application provides some replacements for native Android APIs to facilitate testing
and expose higher-level, business-specific APIs.
Generally, whenever you need:
* account management
* application preferences
* background task scheduling
* device hardware information
* media playback
* networking
* logging
we have something more suitable.
Our transition to new APIs is a continuous process. Contributors might be asked by code reviewers to
refrain from using specific Android APIs considered problematic and to use Nextcloud APIs instead.
In extreme cases we might decide to put specific features on hold until we provide platform API
replacement.
If in doubt, ask Nextcloud developers. App undergoes a process of intense refactoring and situation
changes frequently.
### Testing
TL;DR If we can't write a test for it, it's not good.
Test automation is challenging in mobile applications in general. We try to improve in this area
and thereof we'd ask contributors to be mindful of their code testability:
1. new code submitted to Nextcloud project should be provided with automatic tests
2. contributions to existing code that is currently not covered by automatic tests
should at least not make future efforts more challenging
3. whenever possible, testability should be improved even if the code is not covered by tests
# Releases
At the moment we are releasing the app in two app stores:
+28 -23
View File
@@ -26,7 +26,7 @@ buildscript {
}
classpath 'gradle.plugin.com.github.spotbugs:spotbugs-gradle-plugin:1.6.6'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "io.gitlab.arturbosch.detekt:detekt-gradle-plugin:1.3.0"
classpath "io.gitlab.arturbosch.detekt:detekt-gradle-plugin:1.5.1"
classpath "commons-httpclient:commons-httpclient:3.1@jar" // remove after entire switch to lib v2
classpath 'com.karumi:shot:3.1.0'
}
@@ -60,8 +60,8 @@ configurations {
ext {
jacocoVersion = "0.8.2"
daggerVersion = "2.25.4"
markwonVersion = "4.2.0"
daggerVersion = "2.26"
markwonVersion = "4.2.1"
prismVersion = "2.0.0"
androidLibraryVersion = "master-SNAPSHOT"
@@ -91,7 +91,7 @@ def versionBuild = 0 // 0-50=Alpha / 51-98=RC / 90-99=stable
for (TaskExecutionRequest tr : getGradle().getStartParameter().getTaskRequests()) {
for (String arg : tr.args) {
// any gplay, but only exact "build", as e.g. buildGeneric shall not apply gplay.grade
if (arg.contains("Gplay") || arg.contains("lint") || arg == "build") {
if (arg.contains("Gplay") || arg.contains("lint") || arg.contains("executeScreenshot") || arg == "build") {
apply from: 'gplay.gradle'
System.console().println("Applying gplay.gradle")
break
@@ -105,10 +105,14 @@ spotbugs {
shot {
appId = 'com.nextcloud.client'
instrumentationTestTask = 'connectedGenericDebugAndroidTest'
instrumentationTestTask = 'connectedGplayDebugAndroidTest'
}
android {
testOptions {
unitTests.returnDefaultValues = true
}
lintOptions {
abortOnError false
htmlReport true
@@ -158,7 +162,7 @@ android {
buildTypes {
debug {
testCoverageEnabled true
testCoverageEnabled (project.hasProperty('coverage'))
}
}
@@ -177,8 +181,8 @@ android {
versionDev {
applicationId "com.nextcloud.android.beta"
dimension "default"
versionCode 20200110
versionName "20200110"
versionCode 20200129
versionName "20200129"
}
qa {
@@ -192,6 +196,7 @@ android {
testOptions {
unitTests.returnDefaultValues = true
execution 'ANDROIDX_TEST_ORCHESTRATOR'
animationsDisabled true
}
}
@@ -288,21 +293,21 @@ dependencies {
implementation 'org.apache.jackrabbit:jackrabbit-webdav:2.13.1' // remove after entire switch to lib v2
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'com.google.android.material:material:1.1.0-beta02'
implementation 'com.google.android.material:material:1.1.0-rc02'
implementation 'com.jakewharton:disklrucache:2.0.2'
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.appcompat:appcompat:1.2.0-alpha02'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'androidx.exifinterface:exifinterface:1.1.0'
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:2.1.0"
implementation "androidx.work:work-runtime:2.2.0"
implementation "androidx.work:work-runtime-ktx:2.2.0"
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:2.2.0"
implementation "androidx.work:work-runtime:2.3.0"
implementation "androidx.work:work-runtime-ktx:2.3.1"
implementation 'com.github.albfernandez:juniversalchardet:2.0.3' // need this version for Android <7
compileOnly 'com.google.code.findbugs:annotations:2.0.1'
implementation 'commons-io:commons-io:2.6'
implementation 'com.github.tobiaskaminsky:android-job:v1.2.6.1' // 'com.github.evernote:android-job:v1.2.5'
implementation 'com.jakewharton:butterknife:10.2.1'
kapt 'com.jakewharton:butterknife-compiler:10.2.1'
implementation 'org.greenrobot:eventbus:3.1.1'
implementation 'org.greenrobot:eventbus:3.2.0'
implementation 'com.googlecode.ez-vcard:ez-vcard:0.10.5'
implementation 'org.lukhnos:nnio:0.2'
implementation 'com.madgag.spongycastle:pkix:1.54.0.0'
@@ -311,9 +316,9 @@ dependencies {
implementation 'com.github.chrisbanes:PhotoView:2.3.0'
implementation 'pl.droidsonroids.gif:android-gif-drawable:1.2.15'
implementation 'com.github.tobiaskaminsky:qrcodescanner:0.1.2.2' // 'com.github.blikoon:QRCodeScanner:0.1.2'
implementation 'com.google.android:flexbox:2.0.0'
implementation 'org.parceler:parceler-api:1.1.12'
kapt 'org.parceler:parceler:1.1.12'
implementation 'com.google.android:flexbox:2.0.1'
implementation 'org.parceler:parceler-api:1.1.13'
kapt 'org.parceler:parceler:1.1.13'
implementation('com.github.bumptech.glide:glide:3.8.0') {
exclude group: "com.android.support"
}
@@ -332,8 +337,8 @@ dependencies {
kapt "com.google.dagger:dagger-compiler:$daggerVersion"
kapt "com.google.dagger:dagger-android-processor:$daggerVersion"
compileOnly "org.projectlombok:lombok:1.18.10"
annotationProcessor "org.projectlombok:lombok:1.18.10"
compileOnly "org.projectlombok:lombok:1.18.12"
annotationProcessor "org.projectlombok:lombok:1.18.12"
ktlint "com.pinterest:ktlint:0.36.0"
implementation 'org.conscrypt:conscrypt-android:2.2.1'
@@ -353,9 +358,9 @@ dependencies {
testImplementation 'junit:junit:4.13'
testImplementation 'org.mockito:mockito-core:3.2.4'
testImplementation 'androidx.test:core:1.2.0'
testImplementation 'org.powermock:powermock-core:2.0.4'
testImplementation 'org.powermock:powermock-module-junit4:2.0.4'
testImplementation 'org.powermock:powermock-api-mockito2:2.0.4'
testImplementation 'org.powermock:powermock-core:2.0.5'
testImplementation 'org.powermock:powermock-module-junit4:2.0.5'
testImplementation 'org.powermock:powermock-api-mockito2:2.0.5'
testImplementation 'org.json:json:20190722'
testImplementation "com.nhaarman.mockitokotlin2:mockito-kotlin:2.2.0"
testImplementation "androidx.arch.core:core-testing:2.1.0"
@@ -378,7 +383,7 @@ dependencies {
//androidTestImplementation "com.android.support:support-annotations:${supportLibraryVersion}"
androidTestImplementation 'tools.fastlane:screengrab:2.0.0'
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
androidTestCompile('com.android.support.test.espresso:espresso-intents:3.0.2')
androidTestImplementation('com.android.support.test.espresso:espresso-intents:3.0.2')
// jacocoAnt "org.jacoco:org.jacoco.ant:${jacocoVersion}"
// jacocoAgent "org.jacoco:org.jacoco.agent:${jacocoVersion}"
+4 -59
View File
@@ -1,30 +1,3 @@
autoCorrect: true
test-pattern: # Configure exclusions for test sources
active: true
patterns: # Test file regexes
- '.*/test/.*'
- '.*/androidTest/.*'
- '.*Test.kt'
- '.*Spec.kt'
- '.*Spek.kt'
exclude-rule-sets:
- 'comments'
exclude-rules:
- 'NamingRules'
- 'WildcardImport'
- 'MagicNumber'
- 'MaxLineLength'
- 'LateinitUsage'
- 'StringLiteralDuplication'
- 'SpreadOperator'
- 'TooManyFunctions'
- 'ForEachOnRange'
- 'FunctionMaxLength'
- 'TooGenericExceptionCaught'
- 'TooGenericExceptionThrown'
- 'InstanceOfCheckForException'
build:
maxIssues: 10
weights:
@@ -138,7 +111,7 @@ empty-blocks:
active: true
EmptyFunctionBlock:
active: true
ignoreOverriddenFunctions: false
ignoreOverridden: false
EmptyIfBlock:
active: true
EmptyInitBlock:
@@ -202,23 +175,18 @@ exceptions:
formatting:
active: true
android: false
autoCorrect: true
ChainWrapping:
active: true
autoCorrect: true
CommentSpacing:
active: true
autoCorrect: true
Filename:
active: true
FinalNewline:
active: true
autoCorrect: true
ImportOrdering:
active: false
Indentation:
active: true
autoCorrect: true
indentSize: 4
continuationIndentSize: 4
MaximumLineLength:
@@ -226,73 +194,49 @@ formatting:
maxLineLength: 120
ModifierOrdering:
active: true
autoCorrect: true
NoBlankLineBeforeRbrace:
active: true
autoCorrect: true
NoConsecutiveBlankLines:
active: true
autoCorrect: true
NoEmptyClassBody:
active: true
autoCorrect: true
NoItParamInMultilineLambda:
active: false
NoLineBreakAfterElse:
active: true
autoCorrect: true
NoLineBreakBeforeAssignment:
active: true
autoCorrect: true
NoMultipleSpaces:
active: true
autoCorrect: true
NoSemicolons:
active: true
autoCorrect: true
NoTrailingSpaces:
active: true
autoCorrect: true
NoUnitReturn:
active: true
autoCorrect: true
NoUnusedImports:
active: true
autoCorrect: true
NoWildcardImports:
active: true
autoCorrect: true
PackageName:
active: true
autoCorrect: true
ParameterListWrapping:
active: true
autoCorrect: true
indentSize: 4
SpacingAroundColon:
active: true
autoCorrect: true
SpacingAroundComma:
active: true
autoCorrect: true
SpacingAroundCurly:
active: true
autoCorrect: true
SpacingAroundKeyword:
active: true
autoCorrect: true
SpacingAroundOperators:
active: true
autoCorrect: true
SpacingAroundParens:
active: true
autoCorrect: true
SpacingAroundRangeOperator:
active: true
autoCorrect: true
StringTemplate:
active: true
autoCorrect: true
naming:
active: true
@@ -325,12 +269,12 @@ naming:
active: true
parameterPattern: '[a-z][A-Za-z0-9]*'
excludeClassPattern: '$^'
ignoreOverriddenFunctions: true
ignoreOverridden: true
MatchingDeclarationName:
active: true
MemberNameEqualsClassName:
active: false
ignoreOverriddenFunction: true
ignoreOverridden: true
ObjectPropertyNaming:
active: true
constantPattern: '[A-Za-z][_A-Za-z0-9]*'
@@ -442,6 +386,7 @@ style:
ignoreAnnotation: false
ignoreNamedArgument: true
ignoreEnums: false
excludes: "**/*Test.kt"
MandatoryBracesIfStatements:
active: false
MaxLineLength:
+18
View File
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?><!-- Generator: Adobe Illustrator 23.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" x="0px" y="0px" width="24px" height="24px" viewBox="0 0 24 24"
enable-background="new 0 0 24 24" xml:space="preserve">
<g id="Bounding_Box">
<rect fill="none" width="24" height="24" />
</g>
<g id="Flat">
<g id="ui_x5F_spec_x5F_header_copy_2">
</g>
<g>
<path d="M17,19.22H5V7h7V5H5C3.9,5,3,5.9,3,7v12c0,1.1,0.9,2,2,2h12c1.1,0,2-0.9,2-2v-7h-2V19.22z" />
<path d="M19,2h-2v3h-3c0.01,0.01,0,2,0,2h3v2.99c0.01,0.01,2,0,2,0V7h3V5h-3V2z" />
<rect x="7" y="9" width="8" height="2" />
<polygon points="7,12 7,14 15,14 15,12 12,12 " />
<rect x="7" y="15" width="8" height="2" />
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 845 B

-1
View File
@@ -5,4 +5,3 @@ NC_TEST_SERVER_PASSWORD=test
android.enableJetifier=true
android.useAndroidX=true
android.debug.obsoleteApi=true
+1 -1
View File
@@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-all.zip
Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 38 KiB

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 25 KiB

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 40 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 33 KiB

After

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 37 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 41 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

+1 -1
View File
@@ -1 +1 @@
414
383
+1 -1
View File
@@ -1,2 +1,2 @@
DO NOT TOUCH; GENERATED BY DRONE
<span class="mdl-layout-title">Lint Report: 74 warnings</span>
<span class="mdl-layout-title">Lint Report: 77 warnings</span>
+9 -8
View File
@@ -35,17 +35,18 @@ mv latest.apk ~/apks/
lastBuildTime=$(date --date="$(git log -1 --format=%ai $(git tag | grep dev | tail -n1))" +%s)
changelog=$(git log --after=$lastBuildTime --pretty=oneline --abbrev-commit)
echo "$changelog" > src/versionDev/fastlane/metadata/android/en-US/changelogs/$date.txt
echo "library commit: $(curl https://api.github.com/repos/nextcloud/android-library/commits/master | jq .sha | sed s'/\"//g')" >> src/versionDev/fastlane/metadata/android/en-US/changelogs/$date.txt
libraryCommit=$(curl https://api.github.com/repos/nextcloud/android-library/commits/master | jq .sha | sed s'/\"//g')
git add build.gradle
git add src/versionDev/fastlane/metadata/android/en-US/changelogs/$date.txt
# changelog
echo "$changelog" > src/versionDev/fastlane/metadata/android/en-US/changelogs/$date.txt
echo "library commit: $libraryCommit" >> src/versionDev/fastlane/metadata/android/en-US/changelogs/$date.txt
# build
sed -i s"# androidLibraryVersion.*#androidLibraryVersion =\"$libraryCommit\"#" build.gradle
git add .
git commit -m "daily dev $date" -m "$changelog"
git push
git tag dev-$date
git push origin dev-$date
# remove all but the latest 5 tags
git tag|grep dev | sort -r | awk 'NR>5' | xargs -n 1 git push --delete origin
git tag|grep dev | sort -r | awk 'NR>5' | xargs -n 1 git tag -d
+33 -2
View File
@@ -1,7 +1,13 @@
#!/usr/bin/env bash
if ( [[ $(grep NC_TEST_SERVER_BASEURL ~/.gradle/gradle.properties | grep -v "#" -c) -gt 0 ]] ); then
echo "This will not use server in docker. Please comment in .gradle/gradle.properties. Aborting!"
exit 1
fi
## emulator
if ( [[ $(emulator -list-avds | grep uiComparison -c) -eq 0 ]] ); then
avdmanager delete avd -n uiComparison
(sleep 5; echo "no") | avdmanager create avd -n uiComparison -c 100M -k "system-images;android-27;google_apis;x86" --abi "google_apis/x86"
fi
@@ -9,7 +15,7 @@ emulator -avd uiComparison -no-snapshot -gpu swiftshader_indirect -no-window -no
PID=$(echo $!)
## server
docker run --name=uiComparison nextcloudci/server:server-3 1>/dev/null &
docker run --name=uiComparison nextcloudci/server:server-17 1>/dev/null &
sleep 5
IP=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' uiComparison)
@@ -22,8 +28,33 @@ fi
cp gradle.properties gradle.properties_
sed -i s"/server/$IP/" gradle.properties
scripts/wait_for_emulator.sh
scripts/wait_for_server.sh ${IP}
# setup test server
docker exec uiComparison /bin/sh -c "/usr/local/bin/initnc.sh"
docker exec uiComparison /bin/sh -c "su www-data -c \"OC_PASS=user1 php /var/www/html/occ user:add --password-from-env --display-name='User One' user1\""
docker exec uiComparison /bin/sh -c "su www-data -c \"OC_PASS=user2 php /var/www/html/occ user:add --password-from-env --display-name='User Two' user2\""
docker exec uiComparison /bin/sh -c "su www-data -c \"OC_PASS=user3 php /var/www/html/occ user:add --password-from-env --display-name='User Three' user3\""
docker exec uiComparison /bin/sh -c "su www-data -c \"php /var/www/html/occ user:setting user2 files quota 1G\""
docker exec uiComparison /bin/sh -c "su www-data -c \"php /var/www/html/occ group:add users\""
docker exec uiComparison /bin/sh -c "su www-data -c \"php /var/www/html/occ group:adduser users user1\""
docker exec uiComparison /bin/sh -c "su www-data -c \"php /var/www/html/occ group:adduser users user2\""
docker exec uiComparison /bin/sh -c "/usr/local/bin/run.sh"
## update/create all screenshots
./gradlew executeScreenshotTests -Precord
## update screenshots in a class
#./gradlew executeScreenshotTests \
#-Precord \
#-Pandroid.testInstrumentationRunnerArguments.class=\
#com.owncloud.android.ui.dialog.SyncFileNotEnoughSpaceDialogFragmentTest
## update single screenshot within a class
#./gradlew executeScreenshotTests \
#-Precord \
#-Pandroid.testInstrumentationRunnerArguments.class=\
#com.owncloud.android.ui.dialog.SyncFileNotEnoughSpaceDialogFragmentTest#showNotEnoughSpaceDialogForFile
mv gradle.properties_ gradle.properties
# tidy up
+42 -9
View File
@@ -1,5 +1,19 @@
#!/usr/bin/env bash
upload() {
cd $1
find . -type d -exec curl -u $USER:$PASS -X MKCOL $URL/$REMOTE_FOLDER/$(echo {} | sed s#\./##) \;
find . -type f -exec curl -u $USER:$PASS -X PUT $URL/$REMOTE_FOLDER/$(echo {} | sed s#\./##) --upload-file {} \;
echo "Uploaded failing tests to https://www.kaminsky.me/nc-dev/android-integrationTests/$REMOTE_FOLDER"
curl -u $GITHUB_USER:$GITHUB_PASSWORD -X POST https://api.github.com/repos/nextcloud/android/issues/$PR/comments \
-d "{ \"body\" : \"$TYPE test failed: https://www.kaminsky.me/nc-dev/android-integrationTests/$REMOTE_FOLDER \" }"
exit 1
}
#1: LOG_USERNAME
#2: LOG_PASSWORD
#3: DRONE_BUILD_NUMBER
@@ -13,23 +27,42 @@ ID=$3
USER=$1
PASS=$2
TYPE=$4
FOLDER=$ID-$TYPE
PR=$5
GITHUB_USER=$6
GITHUB_PASSWORD=$7
REMOTE_FOLDER=$ID-$TYPE
set -e
if [ $TYPE = "IT" ]; then
cd build/reports/androidTests/connected/flavors/GPLAY
FOLDER=build/reports/androidTests/connected/flavors/GPLAY
elif [ $TYPE = "Unit" ]; then
cd build/reports/tests/testGplayDebugUnitTest
FOLDER=build/reports/tests/testGplayDebugUnitTest
else
cd build/reports/shot/verification/
FOLDER=build/reports/shot/verification
fi
find . -type d -exec curl -u $USER:$PASS -X MKCOL $URL/$FOLDER/$(echo {} | sed s#\./##) \;
find . -type f -exec curl -u $USER:$PASS -X PUT $URL/$FOLDER/$(echo {} | sed s#\./##) --upload-file {} \;
if [ -e $FOLDER ]; then
upload $FOLDER
else
echo "$TYPE test failed, but no output was generated. Maybe a preliminary stage failed."
echo "Uploaded failing tests to https://www.kaminsky.me/nc-dev/android-integrationTests/$FOLDER"
curl -u $GITHUB_USER:$GITHUB_PASSWORD \
-X POST https://api.github.com/repos/nextcloud/android/issues/$PR/comments \
-d "{ \"body\" : \"$TYPE test failed, but no output was generated. Maybe a preliminary stage failed. \" }"
curl -u $6:$7 -X POST https://api.github.com/repos/nextcloud/android/issues/$5/comments -d "{ \"body\" : \"$TYPE test failed: https://www.kaminsky.me/nc-dev/android-integrationTests/$FOLDER \" }"
if [ -e build/reports/androidTests/connected/flavors/GPLAY ] ; then
TYPE="IT"
upload "build/reports/androidTests/connected/flavors/GPLAY"
fi
exit 1
if [ -e build/reports/tests/testGplayDebugUnitTest ] ; then
TYPE="Unit"
upload "build/reports/tests/testGplayDebugUnitTest"
fi
if [ -e build/reports/shot/verification ] ; then
TYPE="Screenshot"
upload "build/reports/shot/verification"
fi
fi
+1 -1
View File
@@ -8,7 +8,7 @@ until [[ $status = "false" ]]; do
if [[ "$status" =~ "false" || "$status" = "" ]]; then
let "counter += 1"
if [[ $counter -gt 2 ]]; then
if [[ $counter -gt 10 ]]; then
echo "Failed to wait for server"
exit 1
fi
+23
View File
@@ -0,0 +1,23 @@
Java:
```java
private String getAppProcessName() {
String processName = "";
if(Build.VERSION.SDK_INT < Build.VERSION_CODES.P) {
ActivityManager manager = (ActivityManager) this.getSystemService(Context.ACTIVITY_SERVICE);
final int ownPid = android.os.Process.myPid();
final List<ActivityManager.RunningAppProcessInfo> processes = manager.getRunningAppProcesses();
if (processes != null) {
for (ActivityManager.RunningAppProcessInfo info : processes) {
if (info.pid == ownPid) {
processName = info.processName;
break;
}
}
}
} else {
processName = Application.getProcessName();
}
return processName;
}
```
@@ -0,0 +1,50 @@
/*
*
* Nextcloud Android client application
*
* @author Tobias Kaminsky
* Copyright (C) 2020 Tobias Kaminsky
* Copyright (C) 2020 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 <https://www.gnu.org/licenses/>.
*/
package com.nextcloud.client;
import android.Manifest;
import com.owncloud.android.AbstractIT;
import com.owncloud.android.ui.activities.ActivitiesActivity;
import org.junit.Rule;
import org.junit.Test;
import androidx.test.espresso.intent.rule.IntentsTestRule;
import androidx.test.rule.GrantPermissionRule;
public class ActivitiesActivityIT extends AbstractIT {
@Rule public IntentsTestRule<ActivitiesActivity> activityRule = new IntentsTestRule<>(ActivitiesActivity.class,
true,
false);
@Rule
public final GrantPermissionRule permissionRule = GrantPermissionRule.grant(
Manifest.permission.WRITE_EXTERNAL_STORAGE);
@Test
public void openDrawer() throws InterruptedException {
super.openDrawer(activityRule);
}
}
@@ -28,8 +28,17 @@ import android.app.Activity;
import com.facebook.testing.screenshot.Screenshot;
import com.owncloud.android.AbstractIT;
import com.owncloud.android.R;
import com.owncloud.android.lib.resources.files.CreateFolderRemoteOperation;
import com.owncloud.android.lib.resources.files.ExistenceCheckRemoteOperation;
import com.owncloud.android.lib.resources.files.SearchRemoteOperation;
import com.owncloud.android.lib.resources.shares.CreateShareRemoteOperation;
import com.owncloud.android.lib.resources.shares.OCShare;
import com.owncloud.android.lib.resources.shares.ShareType;
import com.owncloud.android.ui.activity.FileDisplayActivity;
import com.owncloud.android.ui.events.SearchEvent;
import org.greenrobot.eventbus.EventBus;
import org.junit.Assert;
import org.junit.Rule;
import org.junit.Test;
@@ -40,6 +49,8 @@ import androidx.test.rule.GrantPermissionRule;
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.platform.app.InstrumentationRegistry.getInstrumentation;
import static junit.framework.TestCase.assertTrue;
public class FileDisplayActivityIT extends AbstractIT {
@@ -69,6 +80,53 @@ public class FileDisplayActivityIT extends AbstractIT {
Screenshot.snapActivity(sut).record();
}
@Test
public void showShares() {
assertTrue(new ExistenceCheckRemoteOperation("/shareToAdmin/", true).execute(client).isSuccess());
assertTrue(new CreateFolderRemoteOperation("/shareToAdmin/", true).execute(client).isSuccess());
assertTrue(new CreateFolderRemoteOperation("/shareToGroup/", true).execute(client).isSuccess());
assertTrue(new CreateFolderRemoteOperation("/shareViaLink/", true).execute(client).isSuccess());
assertTrue(new CreateFolderRemoteOperation("/noShare/", true).execute(client).isSuccess());
// share folder to user "admin"
assertTrue(new CreateShareRemoteOperation("/shareToAdmin/",
ShareType.USER,
"admin",
false,
"",
OCShare.MAXIMUM_PERMISSIONS_FOR_FOLDER)
.execute(client).isSuccess());
// share folder via public link
assertTrue(new CreateShareRemoteOperation("/shareViaLink/",
ShareType.PUBLIC_LINK,
"",
true,
"",
OCShare.READ_PERMISSION_FLAG)
.execute(client).isSuccess());
// share folder to group
Assert.assertTrue(new CreateShareRemoteOperation("/shareToGroup/",
ShareType.GROUP,
"users",
false,
"",
OCShare.DEFAULT_PERMISSION)
.execute(client).isSuccess());
Activity sut = activityRule.launchActivity(null);
getInstrumentation().waitForIdleSync();
EventBus.getDefault().post(new SearchEvent("",
SearchRemoteOperation.SearchType.SHARED_FILTER));
getInstrumentation().waitForIdleSync();
Screenshot.snapActivity(sut).record();
}
@Test
public void showAccounts() {
Activity sut = activityRule.launchActivity(null);
@@ -0,0 +1,50 @@
/*
*
* Nextcloud Android client application
*
* @author Tobias Kaminsky
* Copyright (C) 2020 Tobias Kaminsky
* Copyright (C) 2020 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 <https://www.gnu.org/licenses/>.
*/
package com.nextcloud.client;
import android.Manifest;
import com.owncloud.android.AbstractIT;
import com.owncloud.android.ui.activity.NotificationsActivity;
import org.junit.Rule;
import org.junit.Test;
import androidx.test.espresso.intent.rule.IntentsTestRule;
import androidx.test.rule.GrantPermissionRule;
public class NotificationsActivityIT extends AbstractIT {
@Rule public IntentsTestRule<NotificationsActivity> activityRule = new IntentsTestRule<>(NotificationsActivity.class,
true,
false);
@Rule
public final GrantPermissionRule permissionRule = GrantPermissionRule.grant(
Manifest.permission.WRITE_EXTERNAL_STORAGE);
@Test
public void openDrawer() throws InterruptedException {
super.openDrawer(activityRule);
}
}
@@ -0,0 +1,50 @@
/*
*
* Nextcloud Android client application
*
* @author Tobias Kaminsky
* Copyright (C) 2020 Tobias Kaminsky
* Copyright (C) 2020 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 <https://www.gnu.org/licenses/>.
*/
package com.nextcloud.client;
import android.Manifest;
import com.owncloud.android.AbstractIT;
import com.owncloud.android.ui.activity.SyncedFoldersActivity;
import org.junit.Rule;
import org.junit.Test;
import androidx.test.espresso.intent.rule.IntentsTestRule;
import androidx.test.rule.GrantPermissionRule;
public class SyncedFoldersActivityIT extends AbstractIT {
@Rule public IntentsTestRule<SyncedFoldersActivity> activityRule = new IntentsTestRule<>(SyncedFoldersActivity.class,
true,
false);
@Rule
public final GrantPermissionRule permissionRule = GrantPermissionRule.grant(
Manifest.permission.WRITE_EXTERNAL_STORAGE);
@Test
public void openDrawer() throws InterruptedException {
super.openDrawer(activityRule);
}
}
@@ -0,0 +1,50 @@
/*
*
* Nextcloud Android client application
*
* @author Tobias Kaminsky
* Copyright (C) 2020 Tobias Kaminsky
* Copyright (C) 2020 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 <https://www.gnu.org/licenses/>.
*/
package com.nextcloud.client;
import android.Manifest;
import com.owncloud.android.AbstractIT;
import com.owncloud.android.ui.activity.UploadListActivity;
import org.junit.Rule;
import org.junit.Test;
import androidx.test.espresso.intent.rule.IntentsTestRule;
import androidx.test.rule.GrantPermissionRule;
public class UploadListActivityActivityIT extends AbstractIT {
@Rule public IntentsTestRule<UploadListActivity> activityRule = new IntentsTestRule<>(UploadListActivity.class,
true,
false);
@Rule
public final GrantPermissionRule permissionRule = GrantPermissionRule.grant(
Manifest.permission.WRITE_EXTERNAL_STORAGE);
@Test
public void openDrawer() throws InterruptedException {
super.openDrawer(activityRule);
}
}
@@ -0,0 +1,53 @@
/*
* Nextcloud Android client application
*
* @author Chris Narkiewicz <[email protected]>
* Copyright (C) 2020 Chris Narkiewicz
* Copyright (C) 2020 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 <https://www.gnu.org/licenses/>.
*/
package com.nextcloud.client.account
import android.os.Parcel
import androidx.test.ext.junit.runners.AndroidJUnit4
import org.junit.Assert
import org.junit.Test
import org.junit.runner.RunWith
@RunWith(AndroidJUnit4::class)
class AnonymousUserTest {
@Test
fun anonymousUserImplementsParcelable() {
// GIVEN
// anonymous user instance
val original = AnonymousUser("test_account")
// WHEN
// instance is serialized into Parcel
// instance is retrieved from Parcel
val parcel = Parcel.obtain()
parcel.setDataPosition(0)
parcel.writeParcelable(original, 0)
parcel.setDataPosition(0)
val retrieved = parcel.readParcelable<User>(User::class.java.classLoader)
// THEN
// retrieved instance in distinct
// instances are equal
Assert.assertNotSame(original, retrieved)
Assert.assertTrue(retrieved is AnonymousUser)
Assert.assertEquals(original, retrieved)
}
}
@@ -0,0 +1,119 @@
/*
* Nextcloud Android client application
*
* @author Chris Narkiewicz <[email protected]>
* Copyright (C) 2020 Chris Narkiewicz
* Copyright (C) 2020 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 <https://www.gnu.org/licenses/>.
*/
package com.nextcloud.client.account
import android.accounts.Account
import android.net.Uri
import android.os.Parcel
import com.owncloud.android.lib.common.OwnCloudAccount
import com.owncloud.android.lib.common.OwnCloudBasicCredentials
import com.owncloud.android.lib.resources.status.OwnCloudVersion
import org.junit.Assert.assertEquals
import org.junit.Assert.assertFalse
import org.junit.Assert.assertNotSame
import org.junit.Assert.assertTrue
import org.junit.Before
import org.junit.Test
import java.net.URI
class RegisteredUserTest {
private companion object {
fun buildTestUser(accountName: String): RegisteredUser {
val uri = Uri.parse("https://nextcloud.localhost.localdomain")
val credentials = OwnCloudBasicCredentials("user", "pass")
val account = Account(accountName, "test-type")
val ownCloudAccount = OwnCloudAccount(uri, credentials)
val server = Server(
uri = URI(uri.toString()),
version = OwnCloudVersion.nextcloud_17
)
return RegisteredUser(
account = account,
ownCloudAccount = ownCloudAccount,
server = server
)
}
}
private lateinit var user: RegisteredUser
@Before
fun setUp() {
user = buildTestUser("[email protected]")
}
@Test
fun registeredUserImplementsParcelable() {
// GIVEN
// registered user instance
// WHEN
// instance is serialized into Parcel
// instance is retrieved from Parcel
val parcel = Parcel.obtain()
parcel.setDataPosition(0)
parcel.writeParcelable(user, 0)
parcel.setDataPosition(0)
val deserialized = parcel.readParcelable<User>(User::class.java.classLoader)
// THEN
// retrieved instance in distinct
// instances are equal
assertNotSame(user, deserialized)
assertTrue(deserialized is RegisteredUser)
assertEquals(user, deserialized)
}
@Test
fun accountNamesEquality() {
// GIVEN
// registered user instance with lower-case account name
// registered user instance with mixed-case account name
val user1 = buildTestUser("account_name")
val user2 = buildTestUser("Account_Name")
// WHEN
// account names are checked for equality
val equal = user1.nameEquals(user2)
// THEN
// account names are equal
assertTrue(equal)
}
@Test
fun accountNamesEqualityCheckIsNullSafe() {
// GIVEN
// registered user instance with lower-case account name
// null account
val user1 = buildTestUser("account_name")
val user2: User? = null
// WHEN
// account names are checked for equality against null
val equal = user1.nameEquals(user2)
// THEN
// account names are not equal
assertFalse(equal)
}
}
@@ -0,0 +1,63 @@
/*
*
* Nextcloud Android client application
*
* @author Tobias Kaminsky
* Copyright (C) 2020 Tobias Kaminsky
* Copyright (C) 2020 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 <https://www.gnu.org/licenses/>.
*/
package com.nextcloud.client.etm
import android.app.Activity
import androidx.test.espresso.intent.rule.IntentsTestRule
import androidx.test.internal.runner.junit4.statement.UiThreadStatement
import com.facebook.testing.screenshot.Screenshot
import com.owncloud.android.AbstractIT
import org.junit.Rule
import org.junit.Test
class EtmActivityTest : AbstractIT() {
@get:Rule
var activityRule = IntentsTestRule(EtmActivity::class.java, true, false)
@Test
fun overview() {
val sut: Activity = activityRule.launchActivity(null)
waitForIdleSync()
Screenshot.snapActivity(sut).record()
}
@Test
fun preferences() {
val sut: EtmActivity = activityRule.launchActivity(null)
UiThreadStatement.runOnUiThread { sut.vm.onPageSelected(0) }
Screenshot.snapActivity(sut).record()
}
@Test
fun accounts() {
val sut: EtmActivity = activityRule.launchActivity(null)
UiThreadStatement.runOnUiThread { sut.vm.onPageSelected(1) }
Screenshot.snapActivity(sut).record()
}
}
@@ -4,22 +4,29 @@ import android.accounts.Account;
import android.accounts.AccountManager;
import android.accounts.AuthenticatorException;
import android.accounts.OperationCanceledException;
import android.app.Activity;
import android.content.ActivityNotFoundException;
import android.content.Context;
import android.net.Uri;
import android.os.Bundle;
import com.facebook.testing.screenshot.Screenshot;
import com.nextcloud.client.account.UserAccountManager;
import com.nextcloud.client.account.UserAccountManagerImpl;
import com.owncloud.android.datamodel.FileDataStorageManager;
import com.owncloud.android.datamodel.FileDataStorageManagerImpl;
import com.owncloud.android.lib.common.OwnCloudClient;
import com.owncloud.android.lib.common.OwnCloudClientFactory;
import com.owncloud.android.lib.common.accounts.AccountUtils;
import com.owncloud.android.lib.common.operations.RemoteOperationResult;
import com.owncloud.android.lib.resources.files.ReadFolderRemoteOperation;
import com.owncloud.android.lib.resources.files.RemoveFileRemoteOperation;
import com.owncloud.android.lib.resources.files.model.RemoteFile;
import com.owncloud.android.utils.FileStorageUtils;
import org.apache.commons.httpclient.HttpStatus;
import org.apache.commons.httpclient.methods.GetMethod;
import org.apache.commons.io.FileUtils;
import org.junit.After;
import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.runner.RunWith;
@@ -27,9 +34,20 @@ import org.junit.runner.RunWith;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStream;
import java.util.Collection;
import androidx.test.espresso.contrib.DrawerActions;
import androidx.test.espresso.intent.rule.IntentsTestRule;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import androidx.test.platform.app.InstrumentationRegistry;
import androidx.test.runner.lifecycle.ActivityLifecycleMonitorRegistry;
import androidx.test.runner.lifecycle.Stage;
import static androidx.test.InstrumentationRegistry.getInstrumentation;
import static androidx.test.espresso.Espresso.onView;
import static androidx.test.espresso.matcher.ViewMatchers.withId;
import static org.junit.Assert.assertTrue;
/**
@@ -40,9 +58,11 @@ import androidx.test.platform.app.InstrumentationRegistry;
public abstract class AbstractIT {
protected static OwnCloudClient client;
static Account account;
protected static Account account;
protected static Context targetContext;
private Activity currentActivity;
@BeforeClass
public static void beforeAll() {
try {
@@ -88,8 +108,24 @@ public abstract class AbstractIT {
}
}
@After
public void after() {
RemoteOperationResult result = new ReadFolderRemoteOperation("/").execute(client);
assertTrue(result.getLogMessage(), result.isSuccess());
for (Object object : result.getData()) {
RemoteFile remoteFile = (RemoteFile) object;
if (!remoteFile.getRemotePath().equals("/")) {
assertTrue(new RemoveFileRemoteOperation(remoteFile.getRemotePath())
.execute(client).isSuccess());
}
}
}
FileDataStorageManager getStorageManager() {
return new FileDataStorageManagerImpl(account, targetContext.getContentResolver());
return new FileDataStorageManager(account, targetContext.getContentResolver());
}
private static void createDummyFiles() throws IOException {
@@ -134,4 +170,42 @@ public abstract class AbstractIT {
e.printStackTrace();
}
}
protected File getFile(String filename) throws IOException {
InputStream inputStream = getInstrumentation().getContext().getAssets().open(filename);
File temp = File.createTempFile("file", "file");
FileUtils.copyInputStreamToFile(inputStream, temp);
return temp;
}
protected void waitForIdleSync() {
InstrumentationRegistry.getInstrumentation().waitForIdleSync();
}
protected void openDrawer(IntentsTestRule activityRule) throws InterruptedException {
Activity sut = activityRule.launchActivity(null);
Thread.sleep(3000);
onView(withId(R.id.drawer_layout)).perform(DrawerActions.open());
waitForIdleSync();
Screenshot.snapActivity(sut).record();
}
protected Activity getCurrentActivity() {
InstrumentationRegistry.getInstrumentation().runOnMainSync(() -> {
Collection<Activity> resumedActivities = ActivityLifecycleMonitorRegistry
.getInstance()
.getActivitiesInStage(Stage.RESUMED);
if (resumedActivities.iterator().hasNext()) {
currentActivity = resumedActivities.iterator().next();
}
});
return currentActivity;
}
}
@@ -120,7 +120,7 @@ public class UploadIT extends AbstractIT {
account,
null,
ocUpload,
false,
FileUploader.NameCollisionPolicy.DEFAULT,
FileUploader.LOCAL_BEHAVIOUR_COPY,
targetContext,
false,
@@ -140,17 +140,17 @@ public class UploadIT extends AbstractIT {
OCUpload ocUpload = new OCUpload(FileStorageUtils.getSavePath(account.name) + "/empty.txt",
"/testUpload/2/3/4/1.txt", account.name);
UploadFileOperation newUpload = new UploadFileOperation(
storageManager,
connectivityServiceMock,
powerManagementServiceMock,
account,
null,
ocUpload,
false,
FileUploader.LOCAL_BEHAVIOUR_COPY,
targetContext,
false,
false
storageManager,
connectivityServiceMock,
powerManagementServiceMock,
account,
null,
ocUpload,
FileUploader.NameCollisionPolicy.DEFAULT,
FileUploader.LOCAL_BEHAVIOUR_COPY,
targetContext,
false,
false
);
newUpload.addRenameUploadListener(() -> {
// dummy
@@ -0,0 +1,122 @@
package com.owncloud.android.ui.activity;
/*
* Nextcloud Android client application
*
* @author Kilian Périsset
* Copyright (C) 2019 Kilian Périsset (Infomaniak Network SA)
* Copyright (C) 2019 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 <https://www.gnu.org/licenses/>.
*/
import com.owncloud.android.datamodel.OCFile;
import org.junit.Assert;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import androidx.test.filters.LargeTest;
import androidx.test.rule.ActivityTestRule;
@RunWith(AndroidJUnit4.class)
@LargeTest
public class FolderPickerActivityIT {
@Rule
public ActivityTestRule<FolderPickerActivity> activityRule =
new ActivityTestRule<>(FolderPickerActivity.class);
@Test
public void getActivityFile() {
// Arrange
FolderPickerActivity targetActivity = activityRule.getActivity();
OCFile origin = new OCFile("/test/file.test");
origin.setRemotePath("/remotePath/test");
// Act
targetActivity.setFile(origin);
OCFile target = targetActivity.getFile();
// Assert
Assert.assertEquals(origin, target);
}
@Test
public void getParentFolder_isNotRootFolder() {
// Arrange
FolderPickerActivity targetActivity = activityRule.getActivity();
OCFile origin = new OCFile("/test/");
origin.setFileId(1);
origin.setRemotePath("/test/");
origin.setStoragePath("/test/");
origin.setFolder();
// Act
targetActivity.setFile(origin);
OCFile target = targetActivity.getCurrentFolder();
// Assert
Assert.assertEquals(origin, target);
}
@Test
public void getParentFolder_isRootFolder() {
// Arrange
FolderPickerActivity targetActivity = activityRule.getActivity();
OCFile origin = new OCFile("/");
origin.setFileId(1);
origin.setRemotePath("/");
origin.setStoragePath("/");
origin.setFolder();
// Act
targetActivity.setFile(origin);
OCFile target = targetActivity.getCurrentFolder();
// Assert
Assert.assertEquals(origin, target);
}
@Test
public void nullFile() {
// Arrange
FolderPickerActivity targetActivity = activityRule.getActivity();
OCFile rootFolder = targetActivity.getStorageManager().getFileByPath(OCFile.ROOT_PATH);
// Act
targetActivity.setFile(null);
OCFile target = targetActivity.getCurrentFolder();
// Assert
Assert.assertEquals(rootFolder, target);
}
@Test
public void getParentFolder() {
// Arrange
FolderPickerActivity targetActivity = activityRule.getActivity();
OCFile origin = new OCFile("/test/file.test");
origin.setRemotePath("/test/file.test");
OCFile target = new OCFile("/test/");
// Act
targetActivity.setFile(origin);
// Assert
Assert.assertEquals(origin, target);
}
}
@@ -0,0 +1,62 @@
/*
*
* Nextcloud Android client application
*
* @author Tobias Kaminsky
* Copyright (C) 2020 Tobias Kaminsky
* Copyright (C) 2020 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 <https://www.gnu.org/licenses/>.
*/
package com.owncloud.android.ui.activity;
import android.app.Activity;
import com.facebook.testing.screenshot.Screenshot;
import com.nextcloud.client.account.User;
import com.owncloud.android.AbstractIT;
import org.junit.Rule;
import org.junit.Test;
import androidx.test.espresso.intent.rule.IntentsTestRule;
public class ManageAccountsActivityIT extends AbstractIT {
@Rule
public IntentsTestRule<ManageAccountsActivity> activityRule = new IntentsTestRule<>(ManageAccountsActivity.class,
true,
false);
@Test
public void open() throws InterruptedException {
Activity sut = activityRule.launchActivity(null);
Thread.sleep(2000);
Screenshot.snapActivity(sut).record();
}
@Test
public void userInfoDetail() throws InterruptedException {
ManageAccountsActivity sut = activityRule.launchActivity(null);
User user = sut.accountManager.getUser();
sut.onClick(user);
Thread.sleep(2000);
Screenshot.snapActivity(getCurrentActivity()).record();
}
}
@@ -0,0 +1,77 @@
/*
*
* Nextcloud Android client application
*
* @author Tobias Kaminsky
* Copyright (C) 2020 Tobias Kaminsky
* Copyright (C) 2020 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 <https://www.gnu.org/licenses/>.
*/
package com.owncloud.android.ui.dialog;
import android.Manifest;
import com.facebook.testing.screenshot.Screenshot;
import com.owncloud.android.AbstractIT;
import com.owncloud.android.datamodel.OCFile;
import com.owncloud.android.ui.activity.FileDisplayActivity;
import org.junit.Rule;
import org.junit.Test;
import androidx.test.espresso.intent.rule.IntentsTestRule;
import androidx.test.rule.GrantPermissionRule;
import static androidx.test.platform.app.InstrumentationRegistry.getInstrumentation;
public class SyncFileNotEnoughSpaceDialogFragmentTest extends AbstractIT {
@Rule public IntentsTestRule<FileDisplayActivity> activityRule = new IntentsTestRule<>(FileDisplayActivity.class,
true,
false);
@Rule
public final GrantPermissionRule permissionRule = GrantPermissionRule.grant(
Manifest.permission.WRITE_EXTERNAL_STORAGE);
@Test
public void showNotEnoughSpaceDialogForFolder() {
FileDisplayActivity test = activityRule.launchActivity(null);
OCFile ocFile = new OCFile("/Document/");
ocFile.setFileLength(5000000);
SyncFileNotEnoughSpaceDialogFragment dialog = SyncFileNotEnoughSpaceDialogFragment.newInstance(ocFile, 1000);
dialog.show(test.getListOfFilesFragment().getFragmentManager(), "1");
getInstrumentation().waitForIdleSync();
Screenshot.snap(dialog.getDialog().getWindow().getDecorView()).record();
}
@Test
public void showNotEnoughSpaceDialogForFile() {
FileDisplayActivity test = activityRule.launchActivity(null);
OCFile ocFile = new OCFile("/Video.mp4");
ocFile.setFileLength(1000000);
SyncFileNotEnoughSpaceDialogFragment dialog = SyncFileNotEnoughSpaceDialogFragment.newInstance(ocFile, 2000);
dialog.show(test.getListOfFilesFragment().getFragmentManager(), "2");
getInstrumentation().waitForIdleSync();
Screenshot.snap(dialog.getDialog().getWindow().getDecorView()).record();
}
}
@@ -0,0 +1,85 @@
/*
*
* Nextcloud Android client application
*
* @author Tobias Kaminsky
* Copyright (C) 2020 Tobias Kaminsky
* Copyright (C) 2020 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 <https://www.gnu.org/licenses/>.
*/
package com.owncloud.android.ui.preview;
import android.Manifest;
import com.facebook.testing.screenshot.Screenshot;
import com.owncloud.android.AbstractIT;
import com.owncloud.android.datamodel.OCFile;
import com.owncloud.android.ui.activity.FileDisplayActivity;
import com.owncloud.android.utils.FileStorageUtils;
import com.owncloud.android.utils.MimeTypeUtil;
import org.junit.Rule;
import org.junit.Test;
import java.io.File;
import java.io.IOException;
import androidx.test.espresso.intent.rule.IntentsTestRule;
import androidx.test.rule.GrantPermissionRule;
public class PreviewTextFileFragmentTest extends AbstractIT {
@Rule public IntentsTestRule<FileDisplayActivity> activityRule = new IntentsTestRule<>(FileDisplayActivity.class,
true,
false);
@Rule
public final GrantPermissionRule permissionRule = GrantPermissionRule.grant(
Manifest.permission.WRITE_EXTERNAL_STORAGE);
@Test
public void displaySimpleTextFile() throws InterruptedException {
FileDisplayActivity sut = activityRule.launchActivity(null);
Thread.sleep(3000);
File file = new File(FileStorageUtils.getSavePath(account.name) + "/nonEmpty.txt");
OCFile test = new OCFile("/text.md");
test.setMimeType(MimeTypeUtil.MIMETYPE_TEXT_MARKDOWN);
test.setStoragePath(file.getAbsolutePath());
sut.startTextPreview(test, false);
Thread.sleep(3000);
Screenshot.snapActivity(sut).record();
}
@Test
public void displayJavaSnippetFile() throws IOException, InterruptedException {
FileDisplayActivity sut = activityRule.launchActivity(null);
Thread.sleep(3000);
File file = getFile("java.md");
OCFile test = new OCFile("/java.md");
test.setMimeType(MimeTypeUtil.MIMETYPE_TEXT_MARKDOWN);
test.setStoragePath(file.getAbsolutePath());
sut.startTextPreview(test, false);
Thread.sleep(3000);
Screenshot.snapActivity(sut).record();
}
}
@@ -1,17 +1,20 @@
Software, který můžete nasadit na vlastní server a ten organizuje ukládání a synchronizaci souborů. Díky doplňkům jde o kompletní groupwarové řešení.
U vás hostovaná platforma pro produktivitu, která ponechává kontrolu vám
Funkce:
* Soubory nahrané do nexcloudu lze snadno sdílet s ostatními.
* Přístup odkudkoli přes webové a mobilní rozhraní.
* Synchronizace s počítačem umožňující offline práci.
* Vaše data jsou na vašem serveru a máte nad nimi plnou kontrolu.
* Jde o svobodný software, který snadno můžete sami hostovat a volně si ho přizplsobit. V případě potřeby je ale k dispozici komerční podpora.
* Vyhledávání napříč soubory.
* Synchronizace kontaktů a zpráv.
* Sdílení kalendářů do mobilu (DAVx5/DAVdroid)
* Neomezený počet uživatelů, autoupload fotek přímo z mobilu, oznámení,
* Klienti pro WIndows, MacOS, iOS, Android, web.
* Mnoho dalších doplňků s dalšími funkcemi.
* Snadno použitelné moderní rozhraní, s motivem vzhledu sladěným s tím nastaveným na serveru
* Nahrávání souborů na vámi využívaný Nextcloud server
* Jejich sdílení s ostatními
* Udržování vašich oblíbených souborů a složek synchronizovaných
* Vyhledávání napříč všemi složkami na vámi využívaném serveru
* Automatické nahrávání fotek a videí pořízených vaším zařízením
* Budete v obraze díky upozorněním
* Podpora vícero účtů
* Zabezpečení přístupu k vašim datům otiskem prstu nebo PIN kódem
* Propojení s aplikací DAVx5 (dříve známé jako DAVdroid) pro snadné nastavení synchronizace kalendáře a kontaktů
Díky Nextcloudu budete mít kompletní privátní řešení pro všechy vaše soubory, fotky, kalendáře a kontakty.
Připomínky zasílejte na https://github.com/nextcloud/android/issues, diskutovat lze na https://help.nextcloud.com/c/clients a vše ostatní najdete na https://nextcloud.com 
Veškeré problémy prosíme hlaste na https://github.com/nextcloud/android/issues, diskutovat lze na https://help.nextcloud.com/c/clients/android
Ještě Nextcloud neznáte? Je to server pro komunikaci, synchronizaci a sdílení vašich dat. Jedná se o svobodný software, který můžete provozovat sami, nebo si jako službu koupit u jiné společnosti. Díky tomu máte kontrolu nad svými fotkami, kalendářem, kontakty i dokumenty a vším ostatním.
Další informace o Nextcloud naleznete na https://nextcloud.com
@@ -0,0 +1 @@
Η αυτόνομη πλατφόρμα λειτουργικότητας που σας κρατά υπό έλεγχο.
@@ -0,0 +1 @@
بستر تولیدی خود میزبان که شما را کنترل می کند. \ n \ n ویژگی ها: \ n * رابط کاربری آسان و مدرن ،
@@ -0,0 +1 @@
بستر تولیدی خود میزبان که شما را کنترل می کند
@@ -0,0 +1 @@
Nextcloud
@@ -0,0 +1 @@
Samo-gostujoče produkcijsko okolje pod vašim nadzorom.
@@ -0,0 +1 @@
Nextcloud
Binary file not shown.

After

Width:  |  Height:  |  Size: 44 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 44 KiB

After

Width:  |  Height:  |  Size: 23 KiB

@@ -23,6 +23,8 @@ package com.nextcloud.client.account
import android.accounts.Account
import android.content.Context
import android.net.Uri
import android.os.Parcel
import android.os.Parcelable
import com.owncloud.android.MainApp
import com.owncloud.android.R
import com.owncloud.android.lib.common.OwnCloudAccount
@@ -34,7 +36,7 @@ import java.net.URI
* It serves as a semantically correct "empty value", allowing simplification of logic
* in various components requiring user data, such as DB queries.
*/
internal class AnonymousUser(private val accountType: String) : User {
internal data class AnonymousUser(private val accountType: String) : User, Parcelable {
companion object {
@JvmStatic
@@ -42,9 +44,19 @@ internal class AnonymousUser(private val accountType: String) : User {
val type = context.getString(R.string.account_type)
return AnonymousUser(type)
}
@JvmField
val CREATOR: Parcelable.Creator<AnonymousUser> = object : Parcelable.Creator<AnonymousUser> {
override fun createFromParcel(source: Parcel): AnonymousUser = AnonymousUser(source)
override fun newArray(size: Int): Array<AnonymousUser?> = arrayOfNulls(size)
}
}
override val accountName: String = "anonymous"
private constructor(source: Parcel) : this(
source.readString() as String
)
override val accountName: String = "anonymous@nohost"
override val server = Server(URI.create(""), MainApp.MINIMUM_SUPPORTED_SERVER_VERSION)
override val isAnonymous = true
@@ -55,4 +67,14 @@ internal class AnonymousUser(private val accountType: String) : User {
override fun toOwnCloudAccount(): OwnCloudAccount {
return OwnCloudAccount(Uri.EMPTY, OwnCloudBasicCredentials("", ""))
}
override fun nameEquals(user: User?): Boolean {
return user?.accountName.equals(accountName, true)
}
override fun describeContents() = 0
override fun writeToParcel(dest: Parcel, flags: Int) = with(dest) {
writeString(accountType)
}
}
@@ -21,16 +21,33 @@
package com.nextcloud.client.account
import android.accounts.Account
import android.os.Parcel
import android.os.Parcelable
import com.owncloud.android.lib.common.OwnCloudAccount
/**
* This class represents normal user logged into the Nextcloud server.
*/
internal class RegisteredUser(
internal data class RegisteredUser(
private val account: Account,
private val ownCloudAccount: OwnCloudAccount,
override val server: Server
) : User {
companion object {
@JvmField
val CREATOR: Parcelable.Creator<RegisteredUser> = object : Parcelable.Creator<RegisteredUser> {
override fun createFromParcel(source: Parcel): RegisteredUser = RegisteredUser(source)
override fun newArray(size: Int): Array<RegisteredUser?> = arrayOfNulls(size)
}
}
private constructor(source: Parcel) : this(
source.readParcelable<Account>(Account::class.java.classLoader) as Account,
source.readParcelable<OwnCloudAccount>(OwnCloudAccount::class.java.classLoader) as OwnCloudAccount,
source.readParcelable<Server>(Server::class.java.classLoader) as Server
)
override val isAnonymous = false
override val accountName: String get() {
@@ -44,4 +61,16 @@ internal class RegisteredUser(
override fun toOwnCloudAccount(): OwnCloudAccount {
return ownCloudAccount
}
override fun nameEquals(user: User?): Boolean {
return user?.accountName.equals(accountName, true)
}
override fun describeContents() = 0
override fun writeToParcel(dest: Parcel, flags: Int) = with(dest) {
writeParcelable(account, 0)
writeParcelable(ownCloudAccount, 0)
writeParcelable(server, 0)
}
}
@@ -20,6 +20,8 @@
*/
package com.nextcloud.client.account
import android.os.Parcel
import android.os.Parcelable
import com.owncloud.android.lib.resources.status.OwnCloudVersion
import java.net.URI
@@ -27,4 +29,25 @@ import java.net.URI
* This object provides all information necessary to interact
* with backend server.
*/
data class Server(val uri: URI, val version: OwnCloudVersion)
data class Server(val uri: URI, val version: OwnCloudVersion) : Parcelable {
constructor(source: Parcel) : this(
source.readSerializable() as URI,
source.readParcelable<Parcelable>(OwnCloudVersion::class.java.classLoader) as OwnCloudVersion
)
override fun describeContents() = 0
override fun writeToParcel(dest: Parcel, flags: Int) = with(dest) {
writeSerializable(uri)
writeParcelable(version, 0)
}
companion object {
@JvmField
val CREATOR: Parcelable.Creator<Server> = object : Parcelable.Creator<Server> {
override fun createFromParcel(source: Parcel): Server = Server(source)
override fun newArray(size: Int): Array<Server?> = arrayOfNulls(size)
}
}
}
@@ -21,9 +21,10 @@
package com.nextcloud.client.account
import android.accounts.Account
import android.os.Parcelable
import com.owncloud.android.lib.common.OwnCloudAccount
interface User {
interface User : Parcelable {
val accountName: String
val server: Server
val isAnonymous: Boolean
@@ -51,4 +52,11 @@ interface User {
*/
@Deprecated("Temporary workaround")
fun toOwnCloudAccount(): OwnCloudAccount
/**
* Compare account names, case insensitive.
*
* @return true if account names are same, false otherwise
*/
fun nameEquals(user: User?): Boolean
}
@@ -20,6 +20,8 @@
package com.nextcloud.client.account;
import android.accounts.Account;
import android.app.Activity;
import android.content.Intent;
import com.nextcloud.java.util.Optional;
import com.owncloud.android.datamodel.OCFile;
@@ -46,6 +48,14 @@ public interface UserAccountManager extends CurrentAccountProvider {
*/
void removeAllAccounts();
/**
* Remove registered user.
*
* @param user user to remove
* @return true if account was removed successfully, false otherwise
*/
boolean removeUser(User user);
/**
* Get configured NextCloud's user accounts.
*
@@ -141,4 +151,12 @@ public interface UserAccountManager extends CurrentAccountProvider {
}
}
/**
* Launch account registration activity.
*
* This method returns immediately. Authenticator activity will be launched asynchronously.
*
* @param activity Activity used to launch authenticator flow via {@link Activity#startActivity(Intent)}
*/
void startAccountCreation(Activity activity);
}
@@ -22,6 +22,10 @@ package com.nextcloud.client.account;
import android.accounts.Account;
import android.accounts.AccountManager;
import android.app.Activity;
import android.accounts.AccountManagerFuture;
import android.accounts.AuthenticatorException;
import android.accounts.OperationCanceledException;
import android.content.Context;
import android.content.SharedPreferences;
import android.preference.PreferenceManager;
@@ -42,6 +46,7 @@ import com.owncloud.android.lib.common.utils.Log_OC;
import com.owncloud.android.lib.resources.status.OwnCloudVersion;
import com.owncloud.android.lib.resources.users.GetUserInfoRemoteOperation;
import java.io.IOException;
import java.net.URI;
import java.util.ArrayList;
import java.util.List;
@@ -80,6 +85,18 @@ public class UserAccountManagerImpl implements UserAccountManager {
}
}
@Override
public boolean removeUser(User user) {
try {
AccountManagerFuture<Boolean> result = accountManager.removeAccount(user.toPlatformAccount(),
null,
null);
return result.getResult();
} catch (OperationCanceledException| AuthenticatorException| IOException ex) {
return false;
}
}
@Override
@NonNull
public Account[] getAccounts() {
@@ -227,7 +244,7 @@ public class UserAccountManagerImpl implements UserAccountManager {
public Optional<User> getUser(CharSequence accountName) {
Account account = getAccountByName(accountName.toString());
User user = createUserFromAccount(account);
return Optional.of(user);
return Optional.ofNullable(user);
}
@Override
@@ -376,4 +393,15 @@ public class UserAccountManagerImpl implements UserAccountManager {
private String getAccountType() {
return context.getString(R.string.account_type);
}
@Override
public void startAccountCreation(final Activity activity) {
accountManager.addAccount(getAccountType(),
null,
null,
null,
activity,
null,
null);
}
}
@@ -28,5 +28,14 @@ typealias OnErrorCallback = (Throwable) -> Unit
* It is provided as an alternative for heavy, platform specific and virtually untestable [android.os.AsyncTask]
*/
interface AsyncRunner {
/**
* Post a background task and return immediately returning task cancellation interface.
*
* @param task Task function returning result T; error shall be signalled by throwing an exception.
* @param onResult Callback called when task function returns a result
* @param onError Callback called when task function throws an exception
* @return Cancellable interface, allowing to cancel running task.
*/
fun <T> post(task: () -> T, onResult: OnResultCallback<T>? = null, onError: OnErrorCallback? = null): Cancellable
}
@@ -19,6 +19,20 @@
*/
package com.nextcloud.client.core
/**
* Interface allowing cancellation of a running task.
* Once must be careful when cancelling a non-idempotent task,
* as cancellation does not guarantee a task termination.
* One trivial case would be a task finished and cancelled
* before result delivery.
*
* @see [com.nextcloud.client.core.AsyncRunner]
*/
interface Cancellable {
/**
* Cancel running task. Task termination is not guaranteed, but the result
* shall not be delivered.
*/
fun cancel()
}
@@ -23,7 +23,6 @@ package com.nextcloud.client.di;
import android.app.Activity;
import android.app.Application;
import android.os.Bundle;
import androidx.fragment.app.FragmentActivity;
import androidx.fragment.app.FragmentManager;
import dagger.android.AndroidInjection;
@@ -72,4 +71,3 @@ public class ActivityInjector implements Application.ActivityLifecycleCallbacks
// not needed
}
}
@@ -52,6 +52,8 @@ import com.owncloud.android.ui.activities.data.files.FilesRepository;
import com.owncloud.android.ui.activities.data.files.FilesServiceApiImpl;
import com.owncloud.android.ui.activities.data.files.RemoteFilesRepository;
import org.greenrobot.eventbus.EventBus;
import java.io.File;
import javax.inject.Singleton;
@@ -164,4 +166,10 @@ class AppModule {
AudioManager audioManager(Context context) {
return (AudioManager)context.getSystemService(Context.AUDIO_SERVICE);
}
@Provides
@Singleton
EventBus eventBus() {
return EventBus.getDefault();
}
}
@@ -19,23 +19,53 @@
*/
package com.nextcloud.client.etm
import android.accounts.Account
import android.accounts.AccountManager
import android.content.SharedPreferences
import android.content.res.Resources
import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.ViewModel
import com.nextcloud.client.etm.pages.EtmAccountsFragment
import com.nextcloud.client.etm.pages.EtmPreferencesFragment
import com.owncloud.android.R
import com.owncloud.android.lib.common.accounts.AccountUtils
import javax.inject.Inject
class EtmViewModel @Inject constructor(
private val defaultPreferences: SharedPreferences
private val defaultPreferences: SharedPreferences,
private val platformAccountManager: AccountManager,
private val resources: Resources
) : ViewModel() {
companion object {
val ACCOUNT_USER_DATA_KEYS = listOf(
// AccountUtils.Constants.KEY_COOKIES, is disabled
AccountUtils.Constants.KEY_DISPLAY_NAME,
AccountUtils.Constants.KEY_OC_ACCOUNT_VERSION,
AccountUtils.Constants.KEY_OC_BASE_URL,
AccountUtils.Constants.KEY_OC_VERSION,
AccountUtils.Constants.KEY_USER_ID
)
}
/**
* This data class holds all relevant account information that is
* otherwise kept in separate collections.
*/
data class AccountData(val account: Account, val userData: Map<String, String?>)
val currentPage: LiveData<EtmMenuEntry?> = MutableLiveData()
val pages: List<EtmMenuEntry> = listOf(
EtmMenuEntry(
iconRes = R.drawable.ic_settings,
titleRes = R.string.etm_preferences,
pageClass = EtmPreferencesFragment::class
),
EtmMenuEntry(
iconRes = R.drawable.ic_user,
titleRes = R.string.etm_accounts,
pageClass = EtmAccountsFragment::class
)
)
@@ -46,6 +76,16 @@ class EtmViewModel @Inject constructor(
.toMap()
}
val accounts: List<AccountData> get() {
val accountType = resources.getString(R.string.account_type)
return platformAccountManager.getAccountsByType(accountType).map { account ->
val userData: Map<String, String?> = ACCOUNT_USER_DATA_KEYS.map { key ->
key to platformAccountManager.getUserData(account, key)
}.toMap()
AccountData(account, userData)
}
}
init {
(currentPage as MutableLiveData).apply {
value = null
@@ -0,0 +1,79 @@
/*
* Nextcloud Android client application
*
* @author Chris Narkiewicz
* Copyright (C) 2019 Chris Narkiewicz <[email protected]>
*
* 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.nextcloud.client.etm.pages
import android.content.Intent
import android.os.Bundle
import android.view.LayoutInflater
import android.view.Menu
import android.view.MenuInflater
import android.view.MenuItem
import android.view.View
import android.view.ViewGroup
import com.nextcloud.client.etm.EtmBaseFragment
import com.owncloud.android.R
import kotlinx.android.synthetic.main.fragment_etm_accounts.*
import kotlinx.android.synthetic.main.fragment_etm_preferences.*
class EtmAccountsFragment : EtmBaseFragment() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setHasOptionsMenu(true)
}
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
return inflater.inflate(R.layout.fragment_etm_accounts, container, false)
}
override fun onResume() {
super.onResume()
val builder = StringBuilder()
vm.accounts.forEach {
builder.append("Account: ${it.account.name}\n")
it.userData.forEach {
builder.append("\t${it.key}: ${it.value}\n")
}
}
etm_accounts_text.text = builder.toString()
}
override fun onCreateOptionsMenu(menu: Menu, inflater: MenuInflater) {
super.onCreateOptionsMenu(menu, inflater)
inflater.inflate(R.menu.fragment_etm_accounts, menu)
}
override fun onOptionsItemSelected(item: MenuItem): Boolean {
return when (item.itemId) {
R.id.etm_accounts_share -> {
onClickedShare(); true
}
else -> super.onOptionsItemSelected(item)
}
}
private fun onClickedShare() {
val intent = Intent(Intent.ACTION_SEND)
intent.putExtra(Intent.EXTRA_SUBJECT, "Nextcloud accounts information")
intent.putExtra(Intent.EXTRA_TEXT, etm_accounts_text.text)
intent.type = "text/plain"
startActivity(intent)
}
}
@@ -0,0 +1,40 @@
/*
* Nextcloud Android client application
*
* @author Chris Narkiewicz
* Copyright (C) 2020 Chris Narkiewicz <[email protected]>
* Copyright (C) 2020 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.nextcloud.client.mixins
import android.content.Intent
import android.os.Bundle
/**
* Interface allowing to implement part of [android.app.Activity] logic as
* a mix-in.
*/
interface ActivityMixin {
fun onNewIntent(intent: Intent) { /* no-op */ }
fun onSaveInstanceState(outState: Bundle) { /* no-op */ }
fun onCreate(savedInstanceState: Bundle?) { /* no-op */ }
fun onRestart() { /* no-op */ }
fun onStart() { /* no-op */ }
fun onResume() { /* no-op */ }
fun onPause() { /* no-op */ }
fun onStop() { /* no-op */ }
fun onDestroy() { /* no-op */ }
}
@@ -0,0 +1,88 @@
/*
* Nextcloud Android client application
*
* @author Chris Narkiewicz
* Copyright (C) 2020 Chris Narkiewicz <[email protected]>
* Copyright (C) 2020 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.nextcloud.client.mixins
import android.content.Intent
import android.os.Bundle
/**
* Mix-in registry allows forwards lifecycle calls to all
* registered mix-ins.
*
* Once instantiated, all [android.app.Activity] lifecycle methods
* must call relevant registry companion methods.
*
* Calling the registry from [android.app.Application.ActivityLifecycleCallbacks] is
* not possible as not all callbacks are supported by this interface.
*/
class MixinRegistry : ActivityMixin {
private val mixins = mutableListOf<ActivityMixin>()
fun add(vararg mixins: ActivityMixin) {
mixins.forEach { this.mixins.add(it) }
}
override fun onNewIntent(intent: Intent) {
super.onNewIntent(intent)
mixins.forEach { it.onNewIntent(intent) }
}
override fun onSaveInstanceState(outState: Bundle) {
super.onSaveInstanceState(outState)
mixins.forEach { it.onSaveInstanceState(outState) }
}
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
mixins.forEach { it.onCreate(savedInstanceState) }
}
override fun onRestart() {
super.onRestart()
mixins.forEach { it.onRestart() }
}
override fun onStart() {
super.onStart()
mixins.forEach { it.onStart() }
}
override fun onResume() {
super.onResume()
mixins.forEach { it.onResume() }
}
override fun onPause() {
super.onPause()
mixins.forEach { it.onPause() }
}
override fun onStop() {
super.onStop()
mixins.forEach { it.onStop() }
}
override fun onDestroy() {
super.onDestroy()
mixins.forEach { it.onDestroy() }
}
}
@@ -0,0 +1,10 @@
# Package com.nextcloud.client.mixins
This package provides utilities and interfaces
allowing implementation of UI logic as mix-ins.
Mix-ins allow encapsulation of non-visual logic
as classes facilitating composition over inheritance.
For more information about mix-in concept, please
refer to [article on Wikipedia](https://en.wikipedia.org/wiki/Mixin).
@@ -0,0 +1,133 @@
/*
* Nextcloud Android client application
*
* @author Chris Narkiewicz
* Copyright (C) 2020 Chris Narkiewicz <[email protected]>
* Copyright (C) 2020 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.nextcloud.client.mixins
import android.accounts.Account
import android.app.Activity
import android.content.ContentResolver
import android.content.Intent
import android.os.Bundle
import com.nextcloud.client.account.User
import com.nextcloud.client.account.UserAccountManager
import com.nextcloud.java.util.Optional
import com.owncloud.android.datamodel.FileDataStorageManager
import com.owncloud.android.lib.resources.status.OCCapability
import com.owncloud.android.ui.activity.BaseActivity
/**
* Session mixin collects all account / user handling logic currently
* spread over various activities.
*
* It is an intermediary step facilitating comprehensive rework of
* account handling logic.
*/
class SessionMixin constructor(
private val activity: Activity,
private val contentResolver: ContentResolver,
private val accountManager: UserAccountManager
) : ActivityMixin {
private companion object {
private val TAG = BaseActivity::class.java.simpleName
}
var currentAccount: Account? = null
private set
var storageManager: FileDataStorageManager? = null
private set
var capabilities: OCCapability? = null
private set
fun setAccount(account: Account?) {
val validAccount = account != null && accountManager.setCurrentOwnCloudAccount(account.name)
if (validAccount) {
currentAccount = account
} else {
swapToDefaultAccount()
}
currentAccount?.let {
val storageManager = FileDataStorageManager(currentAccount, contentResolver)
this.storageManager = storageManager
this.capabilities = storageManager.getCapability(it.name)
}
}
fun setUser(user: User) {
setAccount(user.toPlatformAccount())
}
fun getUser(): Optional<User> = when (val it = this.currentAccount) {
null -> Optional.empty()
else -> accountManager.getUser(it.name)
}
/**
* Tries to swap the current ownCloud [Account] for other valid and existing.
*
* If no valid ownCloud [Account] exists, then the user is requested
* to create a new ownCloud [Account].
*/
private fun swapToDefaultAccount() {
// default to the most recently used account
val newAccount = accountManager.currentAccount
if (newAccount == null) {
// no account available: force account creation
startAccountCreation()
} else {
currentAccount = newAccount
}
}
/**
* Launches the account creation activity.
*/
fun startAccountCreation() {
accountManager.startAccountCreation(activity)
}
override fun onNewIntent(intent: Intent) {
super.onNewIntent(intent)
val current = accountManager.currentAccount
val currentAccount = this.currentAccount
if (current != null && currentAccount != null && !currentAccount.name.equals(current.name)) {
this.currentAccount = current
}
}
/**
* Since ownCloud {@link Account} can be managed from the system setting menu, the existence of the {@link
* Account} associated to the instance must be checked every time it is restarted.
*/
override fun onRestart() {
super.onRestart()
val validAccount = currentAccount != null && accountManager.exists(currentAccount)
if (!validAccount) {
swapToDefaultAccount()
}
}
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
val account = accountManager.currentAccount
setAccount(account)
}
}
@@ -72,8 +72,6 @@ public class FirstRunActivity extends BaseActivity implements ViewPager.OnPageCh
@Override
protected void onCreate(Bundle savedInstanceState) {
enableAccountHandling = false;
super.onCreate(savedInstanceState);
setContentView(R.layout.first_run_activity);
@@ -30,7 +30,6 @@ import com.nextcloud.client.account.User;
import com.nextcloud.client.account.UserAccountManagerImpl;
import com.owncloud.android.datamodel.ArbitraryDataProvider;
import com.owncloud.android.datamodel.FileDataStorageManager;
import com.owncloud.android.datamodel.FileDataStorageManagerImpl;
import com.owncloud.android.datamodel.OCFile;
import com.owncloud.android.ui.activity.PassCodeActivity;
import com.owncloud.android.ui.activity.SettingsActivity;
@@ -415,10 +414,10 @@ public final class AppPreferencesImpl implements AppPreferences {
@Override
public DarkMode getDarkThemeMode() {
try {
return DarkMode.valueOf(preferences.getString(PREF__DARK_THEME, DarkMode.LIGHT.name()));
return DarkMode.valueOf(preferences.getString(PREF__DARK_THEME, DarkMode.SYSTEM.name()));
} catch (ClassCastException e) {
preferences.edit().putString(PREF__DARK_THEME, DarkMode.LIGHT.name()).apply();
return DarkMode.DARK;
preferences.edit().putString(PREF__DARK_THEME, DarkMode.SYSTEM.name()).apply();
return DarkMode.SYSTEM;
}
}
@@ -586,8 +585,7 @@ public final class AppPreferencesImpl implements AppPreferences {
}
ArbitraryDataProvider dataProvider = new ArbitraryDataProvider(context.getContentResolver());
FileDataStorageManager storageManager = new FileDataStorageManagerImpl(user.toPlatformAccount(),
context);
FileDataStorageManager storageManager = new FileDataStorageManager(user.toPlatformAccount(), context.getContentResolver());
String value = dataProvider.getValue(user.getAccountName(), getKeyFromFolder(preferenceName, folder));
OCFile prefFolder = folder;
@@ -84,6 +84,7 @@ import com.owncloud.android.utils.ReceiversHelper;
import com.owncloud.android.utils.SecurityUtils;
import org.conscrypt.Conscrypt;
import org.greenrobot.eventbus.EventBus;
import java.lang.reflect.Method;
import java.security.NoSuchAlgorithmException;
@@ -166,6 +167,9 @@ public class MainApp extends MultiDexApplication implements HasAndroidInjector {
@Inject
Clock clock;
@Inject
EventBus eventBus;
private PassCodeManager passCodeManager;
@SuppressWarnings("unused")
@@ -274,7 +278,8 @@ public class MainApp extends MultiDexApplication implements HasAndroidInjector {
uploadsStorageManager,
connectivityService,
powerManagementService,
clock
clock,
eventBus
)
);
@@ -768,7 +773,7 @@ public class MainApp extends MultiDexApplication implements HasAndroidInjector {
for (SyncedFolder syncedFolder : syncedFolderProvider.getSyncedFolders()) {
if (syncedFolder.isEnabled()) {
FilesSyncHelper.insertAllDBEntriesForSyncedFolder(syncedFolder);
FilesSyncHelper.insertAllDBEntriesForSyncedFolder(syncedFolder, true);
}
}
@@ -129,6 +129,7 @@ import com.owncloud.android.ui.dialog.SslUntrustedCertDialog.OnSslUntrustedCertL
import com.owncloud.android.utils.DisplayUtils;
import com.owncloud.android.utils.ErrorMessageAdapter;
import com.owncloud.android.utils.PermissionUtil;
import com.owncloud.android.utils.ThemeUtils;
import java.io.ByteArrayInputStream;
import java.io.InputStream;
@@ -621,6 +622,7 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
scanQR = findViewById(R.id.scanQR);
if (deviceInfo.hasCamera(this)) {
scanQR.setOnClickListener(v -> onScan());
ThemeUtils.tintDrawable(scanQR.getDrawable(), getResources().getColor(R.color.login_text_color));
} else {
scanQR.setVisibility(View.GONE);
}
@@ -1,4 +1,4 @@
/**
/*
* Nextcloud Android client application
*
* Copyright (C) 2017 Tobias Kaminsky
@@ -9,12 +9,12 @@
* 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.
* <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/>.
*/
@@ -29,8 +29,6 @@ import android.net.Uri;
import com.owncloud.android.db.ProviderMeta;
import com.owncloud.android.lib.common.utils.Log_OC;
import java.util.List;
import androidx.annotation.NonNull;
/**
@@ -61,15 +59,6 @@ public class ArbitraryDataProvider {
);
}
public int deleteForKeyWhereAccountNotIn(List<String> accounts, String key) {
return contentResolver.delete(
ProviderMeta.ProviderTableMeta.CONTENT_URI_ARBITRARY_DATA,
ProviderMeta.ProviderTableMeta.ARBITRARY_DATA_CLOUD_ID + " NOT IN (?) AND " +
ProviderMeta.ProviderTableMeta.ARBITRARY_DATA_KEY + "= ?",
new String[]{String.valueOf(accounts), key}
);
}
public void storeOrUpdateKeyValue(String accountName, String key, long newValue) {
storeOrUpdateKeyValue(accountName, key, String.valueOf(newValue));
}
@@ -112,11 +101,11 @@ public class ArbitraryDataProvider {
}
}
public Long getLongValue(String accountName, String key) {
Long getLongValue(String accountName, String key) {
String value = getValue(accountName, key);
if (value.isEmpty()) {
return -1l;
return -1L;
} else {
return Long.valueOf(value);
}
@@ -138,9 +127,9 @@ public class ArbitraryDataProvider {
/**
* returns integer if found else -1
*
* @param accountName
* @param key
* @return
* @param accountName name of account
* @param key key to get value for
* @return Integer specified by account and key
*/
public Integer getIntegerValue(String accountName, String key) {
String value = getValue(accountName, key);
@@ -152,17 +141,6 @@ public class ArbitraryDataProvider {
}
}
/**
* returns integer if found else -1
*
* @param account
* @param key
* @return
*/
public Integer getIntegerValue(Account account, String key) {
return getIntegerValue(account.name, key);
}
/**
* Returns stored value as string or empty string
* @return string if value found or empty string
@@ -238,34 +216,6 @@ public class ArbitraryDataProvider {
}
public class ArbitraryDataSet {
private int id;
private String cloudId;
private String key;
private String value;
public ArbitraryDataSet(int id, String cloudId, String key, String value) {
this.id = id;
this.cloudId = cloudId;
this.key = key;
this.value = value;
}
public int getId() {
return id;
}
public String getCloudId() {
return cloudId;
}
public String getKey() {
return key;
}
public String getValue() {
return value;
}
}
}
@@ -0,0 +1,43 @@
/*
*
* Nextcloud Android client application
*
* @author Tobias Kaminsky
* Copyright (C) 2020 Tobias Kaminsky
* Copyright (C) 2020 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 <https://www.gnu.org/licenses/>.
*/
package com.owncloud.android.datamodel;
import lombok.Getter;
/**
* Data set for {@link ArbitraryDataProvider}
*/
@Getter
class ArbitraryDataSet {
private int id;
private String cloudId;
private String key;
private String value;
ArbitraryDataSet(int id, String cloudId, String key, String value) {
this.id = id;
this.cloudId = cloudId;
this.key = key;
this.value = value;
}
}
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
@@ -128,7 +128,7 @@ public class FilesystemDataProvider {
cv.put(ProviderMeta.ProviderTableMeta.FILESYSTEM_FILE_LOCAL_PATH, localPath);
cv.put(ProviderMeta.ProviderTableMeta.FILESYSTEM_FILE_IS_FOLDER, isFolderValue);
cv.put(ProviderMeta.ProviderTableMeta.FILESYSTEM_FILE_SENT_FOR_UPLOAD, false);
cv.put(ProviderMeta.ProviderTableMeta.FILESYSTEM_FILE_SENT_FOR_UPLOAD, Boolean.FALSE);
cv.put(ProviderMeta.ProviderTableMeta.FILESYSTEM_SYNCED_FOLDER_ID, syncedFolder.getId());
long newCrc32 = getFileChecksum(localPath);
@@ -39,6 +39,7 @@ public class SyncedFolder implements Serializable, Cloneable {
@Getter @Setter private String remotePath;
@Getter @Setter private boolean wifiOnly;
@Getter @Setter private boolean chargingOnly;
@Getter @Setter private boolean existing;
@Getter @Setter private boolean subfolderByDate;
@Getter @Setter private String account;
@Getter @Setter private int uploadAction;
@@ -54,6 +55,7 @@ public class SyncedFolder implements Serializable, Cloneable {
* @param remotePath remote path
* @param wifiOnly upload on wifi only flag
* @param chargingOnly upload on charging only
* @param existing upload existing files
* @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
@@ -66,6 +68,7 @@ public class SyncedFolder implements Serializable, Cloneable {
String remotePath,
boolean wifiOnly,
boolean chargingOnly,
boolean existing,
boolean subfolderByDate,
String account,
int uploadAction,
@@ -73,8 +76,8 @@ public class SyncedFolder implements Serializable, Cloneable {
long timestampMs,
MediaFolderType type,
boolean hidden) {
this(UNPERSISTED_ID, localPath, remotePath, wifiOnly, chargingOnly, subfolderByDate, account, uploadAction,
enabled, timestampMs, type, hidden);
this(UNPERSISTED_ID, localPath, remotePath, wifiOnly, chargingOnly, existing, subfolderByDate, account,
uploadAction, enabled, timestampMs, type, hidden);
}
/**
@@ -87,6 +90,7 @@ public class SyncedFolder implements Serializable, Cloneable {
String remotePath,
boolean wifiOnly,
boolean chargingOnly,
boolean existing,
boolean subfolderByDate,
String account,
int uploadAction,
@@ -99,6 +103,7 @@ public class SyncedFolder implements Serializable, Cloneable {
this.remotePath = remotePath;
this.wifiOnly = wifiOnly;
this.chargingOnly = chargingOnly;
this.existing = existing;
this.subfolderByDate = subfolderByDate;
this.account = account;
this.uploadAction = uploadAction;
@@ -45,6 +45,7 @@ public class SyncedFolderDisplayItem extends SyncedFolder {
* @param remotePath remote path
* @param wifiOnly upload on wifi only flag
* @param chargingOnly upload on charging only
* @param existing also upload existing
* @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
@@ -60,6 +61,7 @@ public class SyncedFolderDisplayItem extends SyncedFolder {
String remotePath,
boolean wifiOnly,
boolean chargingOnly,
boolean existing,
boolean subfolderByDate,
String account,
int uploadAction,
@@ -70,8 +72,8 @@ public class SyncedFolderDisplayItem extends SyncedFolder {
long numberOfFiles,
MediaFolderType type,
boolean hidden) {
super(id, localPath, remotePath, wifiOnly, chargingOnly, subfolderByDate, account, uploadAction, enabled,
timestampMs, type, hidden);
super(id, localPath, remotePath, wifiOnly, chargingOnly, existing, subfolderByDate, account, uploadAction,
enabled, timestampMs, type, hidden);
this.filePaths = filePaths;
this.folderName = folderName;
this.numberOfFiles = numberOfFiles;
@@ -82,14 +84,15 @@ public class SyncedFolderDisplayItem extends SyncedFolder {
String remotePath,
boolean wifiOnly,
boolean chargingOnly,
boolean existing,
boolean subfolderByDate,
String account,
int uploadAction,
boolean enabled,
long timestampMs,
String folderName, MediaFolderType type, boolean hidden) {
super(id, localPath, remotePath, wifiOnly, chargingOnly, subfolderByDate, account, uploadAction, enabled,
timestampMs, type, hidden);
super(id, localPath, remotePath, wifiOnly, chargingOnly, existing, subfolderByDate, account, uploadAction,
enabled, timestampMs, type, hidden);
this.folderName = folderName;
}
}
@@ -342,6 +342,8 @@ public class SyncedFolderProvider extends Observable {
ProviderMeta.ProviderTableMeta.SYNCED_FOLDER_WIFI_ONLY)) == 1;
boolean chargingOnly = cursor.getInt(cursor.getColumnIndex(
ProviderMeta.ProviderTableMeta.SYNCED_FOLDER_CHARGING_ONLY)) == 1;
boolean existing = cursor.getInt(cursor.getColumnIndex(
ProviderMeta.ProviderTableMeta.SYNCED_FOLDER_EXISTING)) == 1;
boolean subfolderByDate = cursor.getInt(cursor.getColumnIndex(
ProviderMeta.ProviderTableMeta.SYNCED_FOLDER_SUBFOLDER_BY_DATE)) == 1;
String accountName = cursor.getString(cursor.getColumnIndex(
@@ -357,8 +359,9 @@ public class SyncedFolderProvider extends Observable {
boolean hidden = cursor.getInt(cursor.getColumnIndex(
ProviderMeta.ProviderTableMeta.SYNCED_FOLDER_HIDDEN)) == 1;
syncedFolder = new SyncedFolder(id, localPath, remotePath, wifiOnly, chargingOnly, subfolderByDate,
accountName, uploadAction, enabled, enabledTimestampMs, type, hidden);
syncedFolder = new SyncedFolder(id, localPath, remotePath, wifiOnly, chargingOnly, existing,
subfolderByDate, accountName, uploadAction, enabled, enabledTimestampMs,
type, hidden);
}
return syncedFolder;
}
@@ -376,6 +379,7 @@ public class SyncedFolderProvider extends Observable {
cv.put(ProviderMeta.ProviderTableMeta.SYNCED_FOLDER_REMOTE_PATH, syncedFolder.getRemotePath());
cv.put(ProviderMeta.ProviderTableMeta.SYNCED_FOLDER_WIFI_ONLY, syncedFolder.isWifiOnly());
cv.put(ProviderMeta.ProviderTableMeta.SYNCED_FOLDER_CHARGING_ONLY, syncedFolder.isChargingOnly());
cv.put(ProviderMeta.ProviderTableMeta.SYNCED_FOLDER_EXISTING, syncedFolder.isExisting());
cv.put(ProviderMeta.ProviderTableMeta.SYNCED_FOLDER_ENABLED, syncedFolder.isEnabled());
cv.put(ProviderMeta.ProviderTableMeta.SYNCED_FOLDER_ENABLED_TIMESTAMP_MS, syncedFolder.getEnabledTimestampMs());
cv.put(ProviderMeta.ProviderTableMeta.SYNCED_FOLDER_SUBFOLDER_BY_DATE, syncedFolder.isSubfolderByDate());
@@ -410,12 +410,23 @@ public final class ThumbnailsCacheManager {
private String mImageKey;
private FileDataStorageManager mStorageManager;
private GetMethod getMethod;
private boolean roundedCorners = false;
public ThumbnailGenerationTask(ImageView imageView, FileDataStorageManager storageManager, Account account)
throws IllegalArgumentException {
this(imageView, storageManager, account, null);
}
public ThumbnailGenerationTask(ImageView imageView,
FileDataStorageManager storageManager,
Account account,
List<ThumbnailGenerationTask> asyncTasks,
boolean roundedCorners)
throws IllegalArgumentException {
this(imageView, storageManager, account, asyncTasks);
this.roundedCorners = roundedCorners;
}
public ThumbnailGenerationTask(ImageView imageView, FileDataStorageManager storageManager,
Account account, List<ThumbnailGenerationTask> asyncTasks)
throws IllegalArgumentException {
@@ -433,7 +444,7 @@ public final class ThumbnailsCacheManager {
return getMethod;
}
public ThumbnailGenerationTask(FileDataStorageManager storageManager, Account account) {
public ThumbnailGenerationTask(FileDataStorageManager storageManager, Account account){
if (storageManager == null) {
throw new IllegalArgumentException("storageManager must not be NULL");
}
@@ -508,7 +519,11 @@ public final class ThumbnailsCacheManager {
tagId = String.valueOf(((TrashbinFile) mFile).getRemoteId());
}
if (String.valueOf(imageView.getTag()).equals(tagId)) {
imageView.setImageBitmap(bitmap);
if (roundedCorners) {
BitmapUtils.setRoundedBitmap(bitmap, imageView);
} else {
imageView.setImageBitmap(bitmap);
}
}
}
}
@@ -809,9 +824,14 @@ public final class ThumbnailsCacheManager {
private Context mContext;
public AvatarGenerationTask(AvatarGenerationListener avatarGenerationListener, Object callContext,
Account account, Resources resources, float avatarRadius, String userId,
String serverName, Context context) {
public AvatarGenerationTask(AvatarGenerationListener avatarGenerationListener,
Object callContext,
Account account,
Resources resources,
float avatarRadius,
String userId,
String serverName,
Context context) {
mAvatarGenerationListener = new WeakReference<>(avatarGenerationListener);
mCallContext = callContext;
mAccount = account;
@@ -850,7 +870,8 @@ public final class ThumbnailsCacheManager {
AvatarGenerationListener listener = mAvatarGenerationListener.get();
if (listener != null) {
AvatarGenerationTask avatarWorkerTask = getAvatarWorkerTask(mCallContext);
if (this == avatarWorkerTask && listener.shouldCallGeneratedCallback(mUserId, mCallContext)) {
String accountName = mUserId + "@" + mServerName;
if (this == avatarWorkerTask && listener.shouldCallGeneratedCallback(accountName, mCallContext)) {
listener.avatarGenerated(drawable, mCallContext);
}
}
@@ -84,7 +84,7 @@ public class UploadsStorageManager extends Observable {
cv.put(ProviderTableMeta.UPLOADS_FILE_SIZE, ocUpload.getFileSize());
cv.put(ProviderTableMeta.UPLOADS_STATUS, ocUpload.getUploadStatus().value);
cv.put(ProviderTableMeta.UPLOADS_LOCAL_BEHAVIOUR, ocUpload.getLocalAction());
cv.put(ProviderTableMeta.UPLOADS_FORCE_OVERWRITE, ocUpload.isForceOverwrite() ? 1 : 0);
cv.put(ProviderTableMeta.UPLOADS_NAME_COLLISION_POLICY, ocUpload.getNameCollisionPolicy().serialize());
cv.put(ProviderTableMeta.UPLOADS_IS_CREATE_REMOTE_FOLDER, ocUpload.isCreateRemoteFolder() ? 1 : 0);
cv.put(ProviderTableMeta.UPLOADS_LAST_RESULT, ocUpload.getLastResult().getValue());
cv.put(ProviderTableMeta.UPLOADS_CREATED_BY, ocUpload.getCreatedBy());
@@ -305,7 +305,7 @@ public class UploadsStorageManager extends Observable {
} else {
list[c.getPosition()] = upload;
}
} while (c.moveToNext());
} while (c.moveToNext() && !c.isAfterLast());
}
c.close();
} else {
@@ -329,8 +329,8 @@ public class UploadsStorageManager extends Observable {
UploadStatus.fromValue(c.getInt(c.getColumnIndex(ProviderTableMeta.UPLOADS_STATUS)))
);
upload.setLocalAction(c.getInt(c.getColumnIndex(ProviderTableMeta.UPLOADS_LOCAL_BEHAVIOUR)));
upload.setForceOverwrite(c.getInt(
c.getColumnIndex(ProviderTableMeta.UPLOADS_FORCE_OVERWRITE)) == 1);
upload.setNameCollisionPolicy(FileUploader.NameCollisionPolicy.deserialize(c.getInt(
c.getColumnIndex(ProviderTableMeta.UPLOADS_NAME_COLLISION_POLICY))));
upload.setCreateRemoteFolder(c.getInt(
c.getColumnIndex(ProviderTableMeta.UPLOADS_IS_CREATE_REMOTE_FOLDER)) == 1);
upload.setUploadEndTimestamp(c.getLong(c.getColumnIndex(ProviderTableMeta.UPLOADS_UPLOAD_END_TIMESTAMP)));
@@ -77,9 +77,9 @@ public class OCUpload implements Parcelable {
@Getter @Setter private int localAction;
/**
* Overwrite destination file?
* What to do in case of name collision.
*/
@Getter @Setter private boolean forceOverwrite;
@Getter @Setter private FileUploader.NameCollisionPolicy nameCollisionPolicy;
/**
* Create destination folder?
@@ -172,7 +172,7 @@ public class OCUpload implements Parcelable {
fileSize = -1;
uploadId = -1;
localAction = FileUploader.LOCAL_BEHAVIOUR_COPY;
forceOverwrite = false;
nameCollisionPolicy = FileUploader.NameCollisionPolicy.DEFAULT;
createRemoteFolder = false;
uploadStatus = UploadStatus.UPLOAD_IN_PROGRESS;
lastResult = UploadResult.UNKNOWN;
@@ -281,7 +281,7 @@ public class OCUpload implements Parcelable {
remotePath = source.readString();
accountName = source.readString();
localAction = source.readInt();
forceOverwrite = source.readInt() == 1;
nameCollisionPolicy = FileUploader.NameCollisionPolicy.deserialize(source.readInt());
createRemoteFolder = source.readInt() == 1;
try {
uploadStatus = UploadStatus.valueOf(source.readString());
@@ -312,7 +312,7 @@ public class OCUpload implements Parcelable {
dest.writeString(remotePath);
dest.writeString(accountName);
dest.writeInt(localAction);
dest.writeInt(forceOverwrite ? 1 : 0);
dest.writeInt(nameCollisionPolicy.serialize());
dest.writeInt(createRemoteFolder ? 1 : 0);
dest.writeString(uploadStatus.name());
dest.writeLong(uploadEndTimestamp);
@@ -31,7 +31,7 @@ import com.owncloud.android.MainApp;
*/
public class ProviderMeta {
public static final String DB_NAME = "filelist";
public static final int DB_VERSION = 53;
public static final int DB_VERSION = 54;
private ProviderMeta() {
// No instance
@@ -208,7 +208,7 @@ public class ProviderMeta {
public static final String UPLOADS_STATUS = "status";
public static final String UPLOADS_LOCAL_BEHAVIOUR = "local_behaviour";
public static final String UPLOADS_UPLOAD_TIME = "upload_time";
public static final String UPLOADS_FORCE_OVERWRITE = "force_overwrite";
public static final String UPLOADS_NAME_COLLISION_POLICY = "name_collision_policy";
public static final String UPLOADS_IS_CREATE_REMOTE_FOLDER = "is_create_remote_folder";
public static final String UPLOADS_UPLOAD_END_TIMESTAMP = "upload_end_timestamp";
public static final String UPLOADS_LAST_RESULT = "last_result";
@@ -223,6 +223,7 @@ public class ProviderMeta {
public static final String SYNCED_FOLDER_REMOTE_PATH = "remote_path";
public static final String SYNCED_FOLDER_WIFI_ONLY = "wifi_only";
public static final String SYNCED_FOLDER_CHARGING_ONLY = "charging_only";
public static final String SYNCED_FOLDER_EXISTING = "existing";
public static final String SYNCED_FOLDER_ENABLED = "enabled";
public static final String SYNCED_FOLDER_ENABLED_TIMESTAMP_MS = "enabled_timestamp_ms";
public static final String SYNCED_FOLDER_TYPE = "type";
@@ -42,8 +42,9 @@ import com.nextcloud.client.account.UserAccountManager;
import com.owncloud.android.R;
import com.owncloud.android.authentication.AuthenticatorActivity;
import com.owncloud.android.datamodel.FileDataStorageManager;
import com.owncloud.android.datamodel.FileDataStorageManagerImpl;
import com.owncloud.android.datamodel.OCFile;
import com.owncloud.android.datamodel.UploadsStorageManager;
import com.owncloud.android.db.OCUpload;
import com.owncloud.android.lib.common.OwnCloudAccount;
import com.owncloud.android.lib.common.OwnCloudClient;
import com.owncloud.android.lib.common.OwnCloudClientManagerFactory;
@@ -88,6 +89,7 @@ public class FileDownloader extends Service
public static final String EXTRA_FILE_PATH = "FILE_PATH";
public static final String EXTRA_REMOTE_PATH = "REMOTE_PATH";
public static final String EXTRA_LINKED_TO_PATH = "LINKED_TO";
public static final String EXTRA_CONFLICT_UPLOAD = "CONFLICT_UPLOAD";
public static final String ACCOUNT_NAME = "ACCOUNT_NAME";
private static final int FOREGROUND_SERVICE_ID = 412;
@@ -111,7 +113,10 @@ public class FileDownloader extends Service
private Notification mNotification;
private OCUpload conflictUpload;
@Inject UserAccountManager accountManager;
@Inject UploadsStorageManager uploadsStorageManager;
public static String getDownloadAddedMessage() {
return FileDownloader.class.getName() + DOWNLOAD_ADDED_MESSAGE;
@@ -196,6 +201,7 @@ public class FileDownloader extends Service
final String behaviour = intent.getStringExtra(OCFileListFragment.DOWNLOAD_BEHAVIOUR);
String activityName = intent.getStringExtra(SendShareDialog.ACTIVITY_NAME);
String packageName = intent.getStringExtra(SendShareDialog.PACKAGE_NAME);
this.conflictUpload = intent.getParcelableExtra(FileDownloader.EXTRA_CONFLICT_UPLOAD);
AbstractList<String> requestedDownloads = new Vector<String>();
try {
DownloadFileOperation newDownload = new DownloadFileOperation(account, file, behaviour, activityName,
@@ -440,7 +446,10 @@ public class FileDownloader extends Service
if (mCurrentAccount == null ||
!mCurrentAccount.equals(mCurrentDownload.getAccount())) {
mCurrentAccount = mCurrentDownload.getAccount();
mStorageManager = new FileDataStorageManagerImpl(mCurrentAccount, getBaseContext());
mStorageManager = new FileDataStorageManager(
mCurrentAccount,
getContentResolver()
);
} // else, reuse storage manager from previous operation
// always get client from client manager, to get fresh credentials in case
@@ -504,7 +513,7 @@ public class FileDownloader extends Service
file.setRemoteId(mCurrentDownload.getFile().getRemoteId());
mStorageManager.saveFile(file);
if (MimeTypeUtil.isMedia(mCurrentDownload.getMimeType())) {
mStorageManager.triggerMediaScan(file.getStoragePath());
FileDataStorageManager.triggerMediaScan(file.getStoragePath());
}
mStorageManager.saveConflict(file, null);
}
@@ -632,6 +641,10 @@ public class FileDownloader extends Service
// Remove success notification
if (downloadResult.isSuccess()) {
if (this.conflictUpload != null) {
uploadsStorageManager.removeUpload(this.conflictUpload);
}
// Sleep 2 seconds, so show the notification before remove it
NotificationUtils.cancelWithDelay(mNotificationManager,
R.string.downloader_download_succeeded_ticker, 2000);
File diff suppressed because it is too large. Load diff
@@ -26,8 +26,6 @@ package com.owncloud.android.jobs;
import android.accounts.Account;
import android.accounts.AccountManager;
import android.accounts.AccountManagerCallback;
import android.accounts.AccountManagerFuture;
import android.content.Context;
import android.net.Uri;
import android.os.Build;
@@ -37,21 +35,22 @@ import android.text.TextUtils;
import com.evernote.android.job.Job;
import com.evernote.android.job.util.support.PersistableBundleCompat;
import com.google.gson.Gson;
import com.nextcloud.client.account.User;
import com.nextcloud.client.account.UserAccountManager;
import com.nextcloud.client.core.Clock;
import com.nextcloud.client.preferences.AppPreferencesImpl;
import com.nextcloud.java.util.Optional;
import com.owncloud.android.MainApp;
import com.owncloud.android.R;
import com.owncloud.android.datamodel.ArbitraryDataProvider;
import com.owncloud.android.datamodel.FileDataStorageManager;
import com.owncloud.android.datamodel.FileDataStorageManagerImpl;
import com.owncloud.android.datamodel.FilesystemDataProvider;
import com.owncloud.android.datamodel.PushConfigurationState;
import com.owncloud.android.datamodel.SyncedFolder;
import com.owncloud.android.datamodel.SyncedFolderProvider;
import com.owncloud.android.datamodel.UploadsStorageManager;
import com.owncloud.android.lib.common.OwnCloudAccount;
import com.owncloud.android.lib.common.OwnCloudClient;
import com.owncloud.android.lib.common.OwnCloudClientManager;
import com.owncloud.android.lib.common.OwnCloudClientManagerFactory;
import com.owncloud.android.lib.common.utils.Log_OC;
import com.owncloud.android.lib.resources.users.RemoteWipeSuccessRemoteOperation;
@@ -68,7 +67,6 @@ import java.util.ArrayList;
import java.util.List;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import static android.content.Context.ACCOUNT_SERVICE;
import static com.owncloud.android.ui.activity.ManageAccountsActivity.PENDING_FOR_REMOVAL;
@@ -76,7 +74,7 @@ import static com.owncloud.android.ui.activity.ManageAccountsActivity.PENDING_FO
/**
* Removes account and all local files
*/
public class AccountRemovalJob extends Job implements AccountManagerCallback<Boolean> {
public class AccountRemovalJob extends Job {
public static final String TAG = "AccountRemovalJob";
public static final String ACCOUNT = "account";
public static final String REMOTE_WIPE = "remote_wipe";
@@ -84,11 +82,16 @@ public class AccountRemovalJob extends Job implements AccountManagerCallback<Boo
private final UploadsStorageManager uploadsStorageManager;
private final UserAccountManager userAccountManager;
private final Clock clock;
private final EventBus eventBus;
public AccountRemovalJob(UploadsStorageManager uploadStorageManager, UserAccountManager accountManager, Clock clock) {
public AccountRemovalJob(UploadsStorageManager uploadStorageManager,
UserAccountManager accountManager,
Clock clock,
EventBus eventBus) {
this.uploadsStorageManager = uploadStorageManager;
this.userAccountManager = accountManager;
this.clock = clock;
this.eventBus = eventBus;
}
@NonNull
@@ -96,80 +99,96 @@ public class AccountRemovalJob extends Job implements AccountManagerCallback<Boo
protected Result onRunJob(@NonNull Params params) {
Context context = MainApp.getAppContext();
PersistableBundleCompat bundle = params.getExtras();
Account account = userAccountManager.getAccountByName(bundle.getString(ACCOUNT, ""));
String accountName = bundle.getString(ACCOUNT, "");
if (TextUtils.isEmpty(accountName)) {
// didn't receive account to delete
return Result.FAILURE;
}
Optional<User> optionalUser = userAccountManager.getUser(accountName);
if (!optionalUser.isPresent()) {
// trying to delete non-existing user
return Result.FAILURE;
}
AccountManager accountManager = (AccountManager) context.getSystemService(ACCOUNT_SERVICE);
if (accountManager == null) {
return Result.FAILURE;
}
boolean remoteWipe = bundle.getBoolean(REMOTE_WIPE, false);
if (account != null && accountManager != null) {
ArbitraryDataProvider arbitraryDataProvider = new ArbitraryDataProvider(context.getContentResolver());
ArbitraryDataProvider arbitraryDataProvider = new ArbitraryDataProvider(context.getContentResolver());
// disable contact backup job
ContactsPreferenceActivity.cancelContactBackupJobForAccount(context, account);
User user = optionalUser.get();
// disable contact backup job
ContactsPreferenceActivity.cancelContactBackupJobForAccount(context, user);
removeAccount(account, accountManager);
final boolean userRemoved = userAccountManager.removeUser(user);
if (userRemoved) {
eventBus.post(new AccountRemovedEvent());
}
FileDataStorageManager storageManager = new FileDataStorageManagerImpl(account, context);
FileDataStorageManager storageManager = new FileDataStorageManager(user.toPlatformAccount(), context.getContentResolver());
// remove all files
removeFiles(account, storageManager);
// remove all files
removeFiles(user, storageManager);
// delete all database entries
storageManager.deleteAllFiles();
// delete all database entries
storageManager.deleteAllFiles();
// remove contact backup job
ContactsPreferenceActivity.cancelContactBackupJobForAccount(context, account);
// remove contact backup job
ContactsPreferenceActivity.cancelContactBackupJobForAccount(context, user);
// disable daily backup
arbitraryDataProvider.storeOrUpdateKeyValue(account.name,
ContactsPreferenceActivity.PREFERENCE_CONTACTS_AUTOMATIC_BACKUP,
"false");
// disable daily backup
arbitraryDataProvider.storeOrUpdateKeyValue(user.getAccountName(),
ContactsPreferenceActivity.PREFERENCE_CONTACTS_AUTOMATIC_BACKUP,
"false");
// unregister push notifications
unregisterPushNotifications(context, account, arbitraryDataProvider);
// unregister push notifications
unregisterPushNotifications(context, user, arbitraryDataProvider);
// remove pending account removal
arbitraryDataProvider.deleteKeyForAccount(account.name, PENDING_FOR_REMOVAL);
// remove pending account removal
arbitraryDataProvider.deleteKeyForAccount(user.getAccountName(), PENDING_FOR_REMOVAL);
// remove synced folders set for account
remoceSyncedFolders(context, account, clock);
// remove synced folders set for account
remoceSyncedFolders(context, user.toPlatformAccount(), clock);
// delete all uploads for account
uploadsStorageManager.removeAccountUploads(account);
// delete all uploads for account
uploadsStorageManager.removeAccountUploads(user.toPlatformAccount());
// delete stored E2E keys
arbitraryDataProvider.deleteKeyForAccount(account.name, EncryptionUtils.PRIVATE_KEY);
arbitraryDataProvider.deleteKeyForAccount(account.name, EncryptionUtils.PUBLIC_KEY);
// delete stored E2E keys
arbitraryDataProvider.deleteKeyForAccount(user.getAccountName(), EncryptionUtils.PRIVATE_KEY);
arbitraryDataProvider.deleteKeyForAccount(user.getAccountName(), EncryptionUtils.PUBLIC_KEY);
OwnCloudClient client = createClient(account);
if (remoteWipe && client != null) {
if (remoteWipe) {
Optional<OwnCloudClient> optionalClient = createClient(user);
if (optionalClient.isPresent()) {
OwnCloudClient client = optionalClient.get();
String authToken = client.getCredentials().getAuthToken();
new RemoteWipeSuccessRemoteOperation(authToken).execute(client);
}
// notify Document Provider
if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
String authority = context.getResources().getString(R.string.document_provider_authority);
Uri rootsUri = DocumentsContract.buildRootsUri(authority);
context.getContentResolver().notifyChange(rootsUri, null);
}
return Result.SUCCESS;
} else {
return Result.FAILURE;
}
// notify Document Provider
if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
String authority = context.getResources().getString(R.string.document_provider_authority);
Uri rootsUri = DocumentsContract.buildRootsUri(authority);
context.getContentResolver().notifyChange(rootsUri, null);
}
return Result.SUCCESS;
}
private void unregisterPushNotifications(Context context, Account account, ArbitraryDataProvider arbitraryDataProvider) {
String arbitraryDataPushString;
if (!TextUtils.isEmpty(arbitraryDataPushString = arbitraryDataProvider.getValue(
account, PushUtils.KEY_PUSH)) &&
!TextUtils.isEmpty(context.getResources().getString(R.string.push_server_url))) {
private void unregisterPushNotifications(Context context,
User user,
ArbitraryDataProvider arbitraryDataProvider) {
final String arbitraryDataPushString = arbitraryDataProvider.getValue(user.toPlatformAccount(),
PushUtils.KEY_PUSH);
final String pushServerUrl = context.getResources().getString(R.string.push_server_url);
if (!TextUtils.isEmpty(arbitraryDataPushString) && !TextUtils.isEmpty(pushServerUrl)) {
Gson gson = new Gson();
PushConfigurationState pushArbitraryData = gson.fromJson(arbitraryDataPushString,
PushConfigurationState.class);
pushArbitraryData.setShouldBeDeleted(true);
arbitraryDataProvider.storeOrUpdateKeyValue(account.name, PushUtils.KEY_PUSH,
arbitraryDataProvider.storeOrUpdateKeyValue(user.getAccountName(), PushUtils.KEY_PUSH,
gson.toJson(pushArbitraryData));
PushUtils.pushRegistrationToServer(userAccountManager, pushArbitraryData.getPushToken());
@@ -199,44 +218,23 @@ public class AccountRemovalJob extends Job implements AccountManagerCallback<Boo
}
}
private void removeFiles(Account account, FileDataStorageManager storageManager) {
File tempDir = new File(FileStorageUtils.getTemporalPath(account.name));
File saveDir = new File(FileStorageUtils.getSavePath(account.name));
private void removeFiles(User user, FileDataStorageManager storageManager) {
File tempDir = new File(FileStorageUtils.getTemporalPath(user.getAccountName()));
File saveDir = new File(FileStorageUtils.getSavePath(user.getAccountName()));
FileStorageUtils.deleteRecursively(tempDir, storageManager);
FileStorageUtils.deleteRecursively(saveDir, storageManager);
}
private void removeAccount(Account account, AccountManager accountManager) {
private Optional<OwnCloudClient> createClient(User user) {
try {
AccountManagerFuture<Boolean> accountRemoval = accountManager.removeAccount(account, this, null);
boolean removal = accountRemoval.getResult();
if (!removal) {
Log_OC.e(this, "Account removal of " + account.name + " failed!");
}
} catch (Exception e) {
Log_OC.e(this, "Account removal of " + account.name + " failed!", e);
}
}
@Nullable
private OwnCloudClient createClient(Account account) {
OwnCloudClient client = null;
try {
OwnCloudAccount ocAccount = new OwnCloudAccount(account, MainApp.getAppContext());
client = OwnCloudClientManagerFactory.getDefaultSingleton().getClientFor(ocAccount,
MainApp.getAppContext());
Context context = MainApp.getAppContext();
OwnCloudClientManager factory = OwnCloudClientManagerFactory.getDefaultSingleton();
OwnCloudClient client = factory.getClientFor(user.toOwnCloudAccount(), context);
return Optional.of(client);
} catch (Exception e) {
Log_OC.e(this, "Could not create client", e);
}
return client;
}
@Override
public void run(AccountManagerFuture<Boolean> future) {
if (future.isDone()) {
EventBus.getDefault().post(new AccountRemovedEvent());
return Optional.empty();
}
}
}
@@ -21,7 +21,6 @@
package com.owncloud.android.jobs;
import android.accounts.Account;
import android.content.ComponentName;
import android.content.Intent;
import android.content.ServiceConnection;
@@ -29,15 +28,17 @@ import android.database.Cursor;
import android.net.Uri;
import android.os.IBinder;
import android.provider.ContactsContract;
import android.text.TextUtils;
import android.text.format.DateFormat;
import com.evernote.android.job.Job;
import com.evernote.android.job.util.support.PersistableBundleCompat;
import com.nextcloud.client.account.User;
import com.nextcloud.client.account.UserAccountManager;
import com.nextcloud.java.util.Optional;
import com.owncloud.android.R;
import com.owncloud.android.datamodel.ArbitraryDataProvider;
import com.owncloud.android.datamodel.FileDataStorageManager;
import com.owncloud.android.datamodel.FileDataStorageManagerImpl;
import com.owncloud.android.datamodel.OCFile;
import com.owncloud.android.files.services.FileUploader;
import com.owncloud.android.lib.common.utils.Log_OC;
@@ -54,6 +55,8 @@ import java.util.Calendar;
import java.util.List;
import androidx.annotation.NonNull;
import ezvcard.Ezvcard;
import ezvcard.VCardVersion;
import static com.owncloud.android.ui.activity.ContactsPreferenceActivity.PREFERENCE_CONTACTS_LAST_BACKUP;
@@ -79,14 +82,20 @@ public class ContactsBackupJob extends Job {
protected Result onRunJob(@NonNull Params params) {
PersistableBundleCompat bundle = params.getExtras();
final Account account = accountManager.getAccountByName(bundle.getString(ACCOUNT, ""));
if (account == null) {
final String accountName = bundle.getString(ACCOUNT, "");
if (TextUtils.isEmpty(accountName)) {
// no account provided
return Result.FAILURE;
}
final Optional<User> optionalUser = accountManager.getUser(accountName);
if (!optionalUser.isPresent()) {
return Result.FAILURE;
}
User user = optionalUser.get();
ArbitraryDataProvider arbitraryDataProvider = new ArbitraryDataProvider(getContext().getContentResolver());
Long lastExecution = arbitraryDataProvider.getLongValue(account, PREFERENCE_CONTACTS_LAST_BACKUP);
Long lastExecution = arbitraryDataProvider.getLongValue(user.toPlatformAccount(),
PREFERENCE_CONTACTS_LAST_BACKUP);
boolean force = bundle.getBoolean(FORCE, false);
if (force || (lastExecution + 24 * 60 * 60 * 1000) < Calendar.getInstance().getTimeInMillis()) {
@@ -96,16 +105,18 @@ public class ContactsBackupJob extends Job {
OCFile.PATH_SEPARATOR;
Integer daysToExpire = getContext().getResources().getInteger(R.integer.contacts_backup_expire);
backupContact(account, backupFolder);
backupContact(user, backupFolder);
// bind to Operations Service
operationsServiceConnection = new OperationsServiceConnection(daysToExpire, backupFolder, account);
operationsServiceConnection = new OperationsServiceConnection(daysToExpire,
backupFolder,
user);
getContext().bindService(new Intent(getContext(), OperationsService.class), operationsServiceConnection,
OperationsService.BIND_AUTO_CREATE);
// store execution date
arbitraryDataProvider.storeOrUpdateKeyValue(account.name,
arbitraryDataProvider.storeOrUpdateKeyValue(user.getAccountName(),
PREFERENCE_CONTACTS_LAST_BACKUP,
Calendar.getInstance().getTimeInMillis());
} else {
@@ -115,7 +126,7 @@ public class ContactsBackupJob extends Job {
return Result.SUCCESS;
}
private void backupContact(Account account, String backupFolder) {
private void backupContact(User user, String backupFolder) {
ArrayList<String> vCard = new ArrayList<>();
Cursor cursor = getContext().getContentResolver().query(ContactsContract.Contacts.CONTENT_URI, null,
@@ -158,25 +169,26 @@ public class ContactsBackupJob extends Job {
}
}
FileUploader.UploadRequester requester = new FileUploader.UploadRequester();
requester.uploadNewFile(
getContext(),
account,
file.getAbsolutePath(),
backupFolder + filename,
FileUploader.LOCAL_BEHAVIOUR_MOVE,
null,
true,
UploadFileOperation.CREATED_BY_USER,
false,
false
FileUploader.uploadNewFile(
getContext(),
user.toPlatformAccount(),
file.getAbsolutePath(),
backupFolder + filename,
FileUploader.LOCAL_BEHAVIOUR_MOVE,
null,
true,
UploadFileOperation.CREATED_BY_USER,
false,
false,
FileUploader.NameCollisionPolicy.ASK_USER
);
}
private void expireFiles(Integer daysToExpire, String backupFolderString, Account account) {
private void expireFiles(Integer daysToExpire, String backupFolderString, User account) {
// -1 disables expiration
if (daysToExpire > -1) {
FileDataStorageManager storageManager = new FileDataStorageManagerImpl(account, getContext());
FileDataStorageManager storageManager = new FileDataStorageManager(account.toPlatformAccount(),
getContext().getContentResolver());
OCFile backupFolder = storageManager.getFileByPath(backupFolderString);
Calendar cal = Calendar.getInstance();
cal.add(Calendar.DAY_OF_YEAR, -daysToExpire);
@@ -234,7 +246,8 @@ public class ContactsBackupJob extends Job {
vCard = stringBuilder.toString();
return vCard;
// bump to vCard 3.0 format (min version supported by server) since Android OS exports to 2.1
return Ezvcard.write(Ezvcard.parse(vCard).all()).version(VCardVersion.V3_0).go();
} catch (IOException e) {
Log_OC.d(TAG, e.getMessage());
@@ -259,12 +272,12 @@ public class ContactsBackupJob extends Job {
private class OperationsServiceConnection implements ServiceConnection {
private Integer daysToExpire;
private String backupFolder;
private Account account;
private User user;
OperationsServiceConnection(Integer daysToExpire, String backupFolder, Account account) {
OperationsServiceConnection(Integer daysToExpire, String backupFolder, User user) {
this.daysToExpire = daysToExpire;
this.backupFolder = backupFolder;
this.account = account;
this.user = user;
}
@Override
@@ -274,7 +287,7 @@ public class ContactsBackupJob extends Job {
if (component.equals(new ComponentName(getContext(), OperationsService.class))) {
operationsServiceBinder = (OperationsService.OperationsServiceBinder) service;
expireFiles(daysToExpire, backupFolder, account);
expireFiles(daysToExpire, backupFolder, user);
}
}
@@ -23,7 +23,6 @@
package com.owncloud.android.jobs;
import android.accounts.Account;
import android.content.ContentResolver;
import android.content.Context;
import android.content.res.Resources;
@@ -33,11 +32,13 @@ import android.text.TextUtils;
import com.evernote.android.job.Job;
import com.evernote.android.job.util.support.PersistableBundleCompat;
import com.nextcloud.client.account.User;
import com.nextcloud.client.account.UserAccountManager;
import com.nextcloud.client.core.Clock;
import com.nextcloud.client.device.PowerManagementService;
import com.nextcloud.client.network.ConnectivityService;
import com.nextcloud.client.preferences.AppPreferences;
import com.nextcloud.java.util.Optional;
import com.owncloud.android.MainApp;
import com.owncloud.android.R;
import com.owncloud.android.datamodel.ArbitraryDataProvider;
@@ -130,7 +131,7 @@ public class FilesSyncJob extends Job {
userAccountManager,
connectivityService,
powerManagementService);
FilesSyncHelper.insertAllDBEntries(preferences, clock, skipCustom);
FilesSyncHelper.insertAllDBEntries(preferences, clock, skipCustom, false);
// Create all the providers we'll need
final ContentResolver contentResolver = context.getContentResolver();
@@ -140,12 +141,11 @@ public class FilesSyncJob extends Job {
Locale currentLocale = context.getResources().getConfiguration().locale;
SimpleDateFormat sFormatter = new SimpleDateFormat("yyyy:MM:dd HH:mm:ss", currentLocale);
sFormatter.setTimeZone(TimeZone.getTimeZone(TimeZone.getDefault().getID()));
FileUploader.UploadRequester requester = new FileUploader.UploadRequester();
for (SyncedFolder syncedFolder : syncedFolderProvider.getSyncedFolders()) {
if ((syncedFolder.isEnabled()) && (!skipCustom || MediaFolderType.CUSTOM != syncedFolder.getType())) {
syncFolder(context, resources, lightVersion, filesystemDataProvider, currentLocale, sFormatter,
requester, syncedFolder);
syncedFolder);
}
}
@@ -156,10 +156,15 @@ public class FilesSyncJob extends Job {
return Result.SUCCESS;
}
private void syncFolder(Context context, Resources resources, boolean lightVersion,
FilesystemDataProvider filesystemDataProvider, Locale currentLocale,
SimpleDateFormat sFormatter, FileUploader.UploadRequester requester,
SyncedFolder syncedFolder) {
private void syncFolder(
Context context,
Resources resources,
boolean lightVersion,
FilesystemDataProvider filesystemDataProvider,
Locale currentLocale,
SimpleDateFormat sFormatter,
SyncedFolder syncedFolder
) {
String remotePath;
boolean subfolderByDate;
Integer uploadAction;
@@ -167,7 +172,12 @@ public class FilesSyncJob extends Job {
boolean needsWifi;
File file;
ArbitraryDataProvider arbitraryDataProvider;
Account account = userAccountManager.getAccountByName(syncedFolder.getAccount());
String accountName = syncedFolder.getAccount();
Optional<User> optionalUser = userAccountManager.getUser(accountName);
if (!optionalUser.isPresent()) {
return;
}
User user = optionalUser.get();
if (lightVersion) {
arbitraryDataProvider = new ArbitraryDataProvider(context.getContentResolver());
@@ -183,13 +193,11 @@ public class FilesSyncJob extends Job {
if (lightVersion) {
needsCharging = resources.getBoolean(R.bool.syncedFolder_light_on_charging);
needsWifi = account == null || arbitraryDataProvider.getBooleanValue(account.name,
SettingsActivity.SYNCED_FOLDER_LIGHT_UPLOAD_ON_WIFI);
needsWifi = arbitraryDataProvider.getBooleanValue(accountName,
SettingsActivity.SYNCED_FOLDER_LIGHT_UPLOAD_ON_WIFI);
String uploadActionString = resources.getString(R.string.syncedFolder_light_upload_behaviour);
uploadAction = getUploadAction(uploadActionString);
subfolderByDate = resources.getBoolean(R.bool.syncedFolder_light_use_subfolders);
remotePath = resources.getString(R.string.syncedFolder_remote_folder);
} else {
needsCharging = syncedFolder.isChargingOnly();
@@ -199,24 +207,24 @@ public class FilesSyncJob extends Job {
remotePath = syncedFolder.getRemotePath();
}
requester.uploadFileWithOverwrite(
context,
account,
file.getAbsolutePath(),
FileStorageUtils.getInstantUploadFilePath(
FileUploader.uploadNewFile(
context,
user.toPlatformAccount(),
file.getAbsolutePath(),
FileStorageUtils.getInstantUploadFilePath(
file,
currentLocale,
remotePath,
syncedFolder.getLocalPath(),
lastModificationTime,
subfolderByDate),
uploadAction,
mimeType,
true, // create parent folder if not existent
UploadFileOperation.CREATED_AS_INSTANT_PICTURE,
needsWifi,
needsCharging,
true
uploadAction,
mimeType,
true, // create parent folder if not existent
UploadFileOperation.CREATED_AS_INSTANT_PICTURE,
needsWifi,
needsCharging,
FileUploader.NameCollisionPolicy.ASK_USER
);
filesystemDataProvider.updateFilesystemFileAsSentForUpload(path,
@@ -23,8 +23,6 @@
*/
package com.owncloud.android.jobs;
import android.accounts.Account;
import android.app.Activity;
import android.app.NotificationManager;
import android.app.PendingIntent;
@@ -38,6 +36,7 @@ import android.text.TextUtils;
import com.evernote.android.job.Job;
import com.google.gson.Gson;
import com.nextcloud.client.account.User;
import com.nextcloud.client.account.UserAccountManager;
import com.nextcloud.client.core.Clock;
import com.nextcloud.client.preferences.AppPreferences;
@@ -47,6 +46,7 @@ import com.owncloud.android.datamodel.ArbitraryDataProvider;
import com.owncloud.android.datamodel.MediaFolder;
import com.owncloud.android.datamodel.MediaFoldersModel;
import com.owncloud.android.datamodel.MediaProvider;
import com.owncloud.android.datamodel.SyncedFolder;
import com.owncloud.android.datamodel.SyncedFolderProvider;
import com.owncloud.android.lib.common.utils.Log_OC;
import com.owncloud.android.ui.activity.ManageAccountsActivity;
@@ -138,32 +138,41 @@ public class MediaFoldersDetectionJob extends Job {
videoMediaFolderPaths.removeAll(mediaFoldersModel.getVideoMediaFolders());
if (!imageMediaFolderPaths.isEmpty() || !videoMediaFolderPaths.isEmpty()) {
Account[] accounts = userAccountManager.getAccounts();
List<Account> accountList = new ArrayList<>();
for (Account account : accounts) {
if (!arbitraryDataProvider.getBooleanValue(account, ManageAccountsActivity.PENDING_FOR_REMOVAL)) {
accountList.add(account);
List<User> allUsers = userAccountManager.getAllUsers();
List<User> activeUsers = new ArrayList<>();
for (User account : allUsers) {
if (!arbitraryDataProvider.getBooleanValue(account.toPlatformAccount(),
ManageAccountsActivity.PENDING_FOR_REMOVAL)) {
activeUsers.add(account);
}
}
for (Account account : accountList) {
for (User user : activeUsers) {
for (String imageMediaFolder : imageMediaFolderPaths) {
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
),
account, imageMediaFolder, 1);
final SyncedFolder folder = syncedFolderProvider.findByLocalPathAndAccount(imageMediaFolder,
user.toPlatformAccount());
if (folder == null) {
String contentTitle = String.format(context.getString(R.string.new_media_folder_detected),
context.getString(R.string.new_media_folder_photos));
sendNotification(contentTitle,
imageMediaFolder.substring(imageMediaFolder.lastIndexOf('/') + 1),
user,
imageMediaFolder,
1);
}
}
for (String videoMediaFolder : videoMediaFolderPaths) {
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
),
account, videoMediaFolder, 2);
final SyncedFolder folder = syncedFolderProvider.findByLocalPathAndAccount(videoMediaFolder,
user.toPlatformAccount());
if (folder == null) {
String contentTitle = String.format(context.getString(R.string.new_media_folder_detected),
context.getString(R.string.new_media_folder_videos));
sendNotification(contentTitle,
videoMediaFolder.substring(videoMediaFolder.lastIndexOf('/') + 1),
user,
videoMediaFolder,
2);
}
}
}
@@ -179,14 +188,14 @@ public class MediaFoldersDetectionJob extends Job {
return Result.SUCCESS;
}
private void sendNotification(String contentTitle, String subtitle, Account account, String path, int type) {
private void sendNotification(String contentTitle, String subtitle, User user, String path, int type) {
int notificationId = randomId.nextInt();
Context context = getContext();
Intent intent = new Intent(getContext(), SyncedFoldersActivity.class);
intent.putExtra(NOTIFICATION_ID, notificationId);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
intent.putExtra(NotificationJob.KEY_NOTIFICATION_ACCOUNT, account.name);
intent.putExtra(NotificationJob.KEY_NOTIFICATION_ACCOUNT, user.getAccountName());
intent.putExtra(KEY_MEDIA_FOLDER_PATH, path);
intent.putExtra(KEY_MEDIA_FOLDER_TYPE, type);
intent.putExtra(SyncedFoldersActivity.EXTRA_SHOW_SIDEBAR, true);
@@ -197,7 +206,7 @@ public class MediaFoldersDetectionJob extends Job {
.setSmallIcon(R.drawable.notification_icon)
.setLargeIcon(BitmapFactory.decodeResource(context.getResources(), R.drawable.notification_icon))
.setColor(ThemeUtils.primaryColor(getContext()))
.setSubText(account.name)
.setSubText(user.getAccountName())
.setContentTitle(contentTitle)
.setContentText(subtitle)
.setSound(RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION))
@@ -35,6 +35,8 @@ import com.nextcloud.client.network.ConnectivityService;
import com.nextcloud.client.preferences.AppPreferences;
import com.owncloud.android.datamodel.UploadsStorageManager;
import org.greenrobot.eventbus.EventBus;
import androidx.annotation.NonNull;
/**
@@ -50,6 +52,7 @@ public class NCJobCreator implements JobCreator {
private final ConnectivityService connectivityService;
private final PowerManagementService powerManagementService;
private final Clock clock;
private final EventBus eventBus;
public NCJobCreator(
Context context,
@@ -58,7 +61,8 @@ public class NCJobCreator implements JobCreator {
UploadsStorageManager uploadsStorageManager,
ConnectivityService connectivityServices,
PowerManagementService powerManagementService,
Clock clock
Clock clock,
EventBus eventBus
) {
this.context = context;
this.accountManager = accountManager;
@@ -67,6 +71,7 @@ public class NCJobCreator implements JobCreator {
this.connectivityService = connectivityServices;
this.powerManagementService = powerManagementService;
this.clock = clock;
this.eventBus = eventBus;
}
@Override
@@ -77,7 +82,7 @@ public class NCJobCreator implements JobCreator {
case ContactsImportJob.TAG:
return new ContactsImportJob();
case AccountRemovalJob.TAG:
return new AccountRemovalJob(uploadsStorageManager, accountManager, clock);
return new AccountRemovalJob(uploadsStorageManager, accountManager, clock, eventBus);
case FilesSyncJob.TAG:
return new FilesSyncJob(accountManager,
preferences,
@@ -22,7 +22,6 @@
package com.owncloud.android.jobs;
import android.accounts.Account;
import android.accounts.AuthenticatorException;
import android.accounts.OperationCanceledException;
import android.app.Activity;
@@ -42,11 +41,12 @@ import android.util.Log;
import com.evernote.android.job.Job;
import com.evernote.android.job.util.support.PersistableBundleCompat;
import com.google.gson.Gson;
import com.nextcloud.client.account.User;
import com.nextcloud.client.account.UserAccountManager;
import com.nextcloud.java.util.Optional;
import com.owncloud.android.R;
import com.owncloud.android.datamodel.DecryptedPushMessage;
import com.owncloud.android.datamodel.SignatureVerification;
import com.owncloud.android.lib.common.OwnCloudAccount;
import com.owncloud.android.lib.common.OwnCloudClient;
import com.owncloud.android.lib.common.OwnCloudClientManagerFactory;
import com.owncloud.android.lib.common.operations.RemoteOperation;
@@ -140,7 +140,9 @@ public class NotificationJob extends Job {
} else if (decryptedPushMessage.deleteAll) {
notificationManager.cancelAll();
} else {
fetchCompleteNotification(signatureVerification.getAccount(), decryptedPushMessage);
final User user = accountManager.getUser(signatureVerification.getAccount().name)
.orElseThrow(RuntimeException::new);
fetchCompleteNotification(user, decryptedPushMessage);
}
}
} catch (NoSuchAlgorithmException | NoSuchPaddingException | InvalidKeyException e1) {
@@ -154,7 +156,7 @@ public class NotificationJob extends Job {
return Result.SUCCESS;
}
private void sendNotification(Notification notification, Account account) {
private void sendNotification(Notification notification, User user) {
SecureRandom randomId = new SecureRandom();
RichObject file = notification.subjectRichParameters.get("file");
@@ -166,7 +168,7 @@ public class NotificationJob extends Job {
intent.setAction(Intent.ACTION_VIEW);
intent.putExtra(FileDisplayActivity.KEY_FILE_ID, file.id);
}
intent.putExtra(KEY_NOTIFICATION_ACCOUNT, account.name);
intent.putExtra(KEY_NOTIFICATION_ACCOUNT, user.getAccountName());
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
PendingIntent pendingIntent = PendingIntent.getActivity(context, 0, intent, PendingIntent.FLAG_ONE_SHOT);
@@ -176,9 +178,9 @@ public class NotificationJob extends Job {
new NotificationCompat.Builder(context, NotificationUtils.NOTIFICATION_CHANNEL_PUSH)
.setSmallIcon(R.drawable.notification_icon)
.setLargeIcon(BitmapFactory.decodeResource(context.getResources(), R.drawable.notification_icon))
.setColor(ThemeUtils.primaryColor(account, false, context))
.setColor(ThemeUtils.primaryColor(user.toPlatformAccount(), false, context))
.setShowWhen(true)
.setSubText(account.name)
.setSubText(user.getAccountName())
.setContentTitle(notification.getSubject())
.setContentText(notification.getMessage())
.setSound(RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION))
@@ -191,7 +193,7 @@ public class NotificationJob extends Job {
Intent disableDetection = new Intent(context, NotificationJob.NotificationReceiver.class);
disableDetection.putExtra(NUMERIC_NOTIFICATION_ID, notification.getNotificationId());
disableDetection.putExtra(PUSH_NOTIFICATION_ID, pushNotificationId);
disableDetection.putExtra(KEY_NOTIFICATION_ACCOUNT, account.name);
disableDetection.putExtra(KEY_NOTIFICATION_ACCOUNT, user.getAccountName());
PendingIntent disableIntent = PendingIntent.getBroadcast(context, pushNotificationId, disableDetection,
PendingIntent.FLAG_CANCEL_CURRENT);
@@ -204,7 +206,7 @@ public class NotificationJob extends Job {
Intent actionIntent = new Intent(context, NotificationJob.NotificationReceiver.class);
actionIntent.putExtra(NUMERIC_NOTIFICATION_ID, notification.getNotificationId());
actionIntent.putExtra(PUSH_NOTIFICATION_ID, pushNotificationId);
actionIntent.putExtra(KEY_NOTIFICATION_ACCOUNT, account.name);
actionIntent.putExtra(KEY_NOTIFICATION_ACCOUNT, user.getAccountName());
actionIntent.putExtra(KEY_NOTIFICATION_ACTION_LINK, action.link);
actionIntent.putExtra(KEY_NOTIFICATION_ACTION_TYPE, action.type);
@@ -228,9 +230,9 @@ public class NotificationJob extends Job {
new NotificationCompat.Builder(context, NotificationUtils.NOTIFICATION_CHANNEL_PUSH)
.setSmallIcon(R.drawable.notification_icon)
.setLargeIcon(BitmapFactory.decodeResource(context.getResources(), R.drawable.notification_icon))
.setColor(ThemeUtils.primaryColor(account, false, context))
.setColor(ThemeUtils.primaryColor(user.toPlatformAccount(), false, context))
.setShowWhen(true)
.setSubText(account.name)
.setSubText(user.getAccountName())
.setContentTitle(context.getString(R.string.new_notification))
.setSound(RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION))
.setAutoCancel(true)
@@ -241,18 +243,18 @@ public class NotificationJob extends Job {
notificationManager.notify(notification.getNotificationId(), notificationBuilder.build());
}
private void fetchCompleteNotification(Account account, DecryptedPushMessage decryptedPushMessage) {
Account currentAccount = accountManager.getAccountByName(account.name);
private void fetchCompleteNotification(User account, DecryptedPushMessage decryptedPushMessage) {
Optional<User> optionalUser = accountManager.getUser(account.getAccountName());
if (currentAccount == null) {
if (!optionalUser.isPresent()) {
Log_OC.e(this, "Account may not be null");
return;
}
User user = optionalUser.get();
try {
OwnCloudAccount ocAccount = new OwnCloudAccount(currentAccount, context);
OwnCloudClient client = OwnCloudClientManagerFactory.getDefaultSingleton()
.getClientFor(ocAccount, context);
.getClientFor(user.toOwnCloudAccount(), context);
RemoteOperationResult result = new GetNotificationRemoteOperation(decryptedPushMessage.nid)
.execute(client);
@@ -295,16 +297,14 @@ public class NotificationJob extends Job {
}
try {
Account currentAccount = accountManager.getAccountByName(accountName);
if (currentAccount == null) {
Optional<User> optionalUser = accountManager.getUser(accountName);
if (!optionalUser.isPresent()) {
Log_OC.e(this, "Account may not be null");
return;
}
OwnCloudAccount ocAccount = new OwnCloudAccount(currentAccount, context);
User user = optionalUser.get();
OwnCloudClient client = OwnCloudClientManagerFactory.getDefaultSingleton()
.getClientFor(ocAccount, context);
.getClientFor(user.toOwnCloudAccount(), context);
String actionType = intent.getStringExtra(KEY_NOTIFICATION_ACTION_TYPE);
String actionLink = intent.getStringExtra(KEY_NOTIFICATION_ACTION_LINK);
@@ -325,8 +325,7 @@ public class NotificationJob extends Job {
} else if (notificationManager != null) {
notificationManager.notify(numericNotificationId, oldNotification);
}
} catch (com.owncloud.android.lib.common.accounts.AccountUtils.AccountNotFoundException |
IOException | OperationCanceledException | AuthenticatorException e) {
} catch (IOException | OperationCanceledException | AuthenticatorException e) {
Log_OC.e(TAG, "Error initializing client", e);
}
}).start();
@@ -21,7 +21,6 @@
*/
package com.owncloud.android.jobs;
import android.accounts.Account;
import android.content.Context;
import android.os.Build;
import android.os.PowerManager;
@@ -29,12 +28,12 @@ import android.os.PowerManager;
import com.evernote.android.job.Job;
import com.evernote.android.job.JobManager;
import com.evernote.android.job.JobRequest;
import com.nextcloud.client.account.User;
import com.nextcloud.client.account.UserAccountManager;
import com.nextcloud.client.device.PowerManagementService;
import com.nextcloud.client.network.ConnectivityService;
import com.owncloud.android.MainApp;
import com.owncloud.android.datamodel.FileDataStorageManager;
import com.owncloud.android.datamodel.FileDataStorageManagerImpl;
import com.owncloud.android.datamodel.OCFile;
import com.owncloud.android.lib.common.operations.RemoteOperationResult;
import com.owncloud.android.lib.common.utils.Log_OC;
@@ -43,6 +42,7 @@ import com.owncloud.android.operations.SynchronizeFileOperation;
import com.owncloud.android.utils.FileStorageUtils;
import java.io.File;
import java.util.List;
import java.util.Set;
import androidx.annotation.NonNull;
@@ -90,10 +90,11 @@ public class OfflineSyncJob extends Job {
}
}
Account[] accounts = userAccountManager.getAccounts();
List<User> users = userAccountManager.getAllUsers();
for (Account account : accounts) {
FileDataStorageManager storageManager = new FileDataStorageManagerImpl(account, getContext());
for (User user : users) {
FileDataStorageManager storageManager = new FileDataStorageManager(user.toPlatformAccount(),
getContext().getContentResolver());
OCFile ocRoot = storageManager.getFileByPath(ROOT_PATH);
@@ -101,7 +102,7 @@ public class OfflineSyncJob extends Job {
break;
}
recursive(new File(ocRoot.getStoragePath()), storageManager, account);
recursive(new File(ocRoot.getStoragePath()), storageManager, user);
}
if (wakeLock != null) {
@@ -112,8 +113,8 @@ public class OfflineSyncJob extends Job {
return Result.SUCCESS;
}
private void recursive(File folder, FileDataStorageManager storageManager, Account account) {
String downloadFolder = FileStorageUtils.getSavePath(account.name);
private void recursive(File folder, FileDataStorageManager storageManager, User user) {
String downloadFolder = FileStorageUtils.getSavePath(user.getAccountName());
String folderName = folder.getAbsolutePath().replaceFirst(downloadFolder, "") + PATH_SEPARATOR;
Log_OC.d(TAG, folderName + ": enter");
@@ -128,7 +129,7 @@ public class OfflineSyncJob extends Job {
// check for etag change, if false, skip
CheckEtagRemoteOperation checkEtagOperation = new CheckEtagRemoteOperation(ocFolder.getRemotePath(),
ocFolder.getEtagOnServer());
RemoteOperationResult result = checkEtagOperation.execute(account, getContext());
RemoteOperationResult result = checkEtagOperation.execute(user.toPlatformAccount(), getContext());
// eTag changed, sync file
switch (result.getCode()) {
@@ -156,7 +157,7 @@ public class OfflineSyncJob extends Job {
for (File file : files) {
OCFile ocFile = storageManager.getFileByLocalPath(file.getPath());
SynchronizeFileOperation synchronizeFileOperation = new SynchronizeFileOperation(ocFile.getRemotePath(),
account, true, getContext());
user.toPlatformAccount(), true, getContext());
synchronizeFileOperation.execute(storageManager, getContext());
}
@@ -167,7 +168,7 @@ public class OfflineSyncJob extends Job {
if (subfolders != null) {
for (File subfolder : subfolders) {
recursive(subfolder, storageManager, account);
recursive(subfolder, storageManager, user);
}
}
@@ -21,7 +21,6 @@
package com.owncloud.android.operations;
import com.nextcloud.client.logger.Logger;
import com.owncloud.android.datamodel.OCFile;
import com.owncloud.android.lib.common.OwnCloudClient;
import com.owncloud.android.lib.common.operations.OnRemoteOperationListener;
@@ -35,8 +34,6 @@ import com.owncloud.android.operations.common.SyncOperation;
import com.owncloud.android.utils.FileStorageUtils;
import com.owncloud.android.utils.MimeType;
import javax.inject.Inject;
import static com.owncloud.android.datamodel.OCFile.PATH_SEPARATOR;
import static com.owncloud.android.datamodel.OCFile.ROOT_PATH;
@@ -52,7 +49,6 @@ public class CreateFolderOperation extends SyncOperation implements OnRemoteOper
protected String mRemotePath;
private boolean mCreateFullPath;
private RemoteFile createdRemoteFolder;
@Inject Logger logger;
/**
* Constructor
@@ -67,11 +63,11 @@ public class CreateFolderOperation extends SyncOperation implements OnRemoteOper
@Override
public RemoteOperationResult run(OwnCloudClient client) {
RemoteOperationResult result = createCreateFolderRemoteOperation(mRemotePath, mCreateFullPath).execute(client);
protected RemoteOperationResult run(OwnCloudClient client) {
RemoteOperationResult result = new CreateFolderRemoteOperation(mRemotePath, mCreateFullPath).execute(client);
if (result.isSuccess()) {
RemoteOperationResult remoteFolderOperationResult = createReadFolderRemoteOperation(mRemotePath)
RemoteOperationResult remoteFolderOperationResult = new ReadFolderRemoteOperation(mRemotePath)
.execute(client);
createdRemoteFolder = (RemoteFile) remoteFolderOperationResult.getData().get(0);
@@ -83,14 +79,6 @@ public class CreateFolderOperation extends SyncOperation implements OnRemoteOper
return result;
}
CreateFolderRemoteOperation createCreateFolderRemoteOperation(String remotePath, boolean createFullPath) {
return new CreateFolderRemoteOperation(remotePath, createFullPath);
}
ReadFolderRemoteOperation createReadFolderRemoteOperation(String remotePath) {
return new ReadFolderRemoteOperation(remotePath);
}
@Override
public void onRemoteOperationFinish(RemoteOperation operation, RemoteOperationResult result) {
if (operation instanceof CreateFolderRemoteOperation) {
@@ -136,7 +124,7 @@ public class CreateFolderOperation extends SyncOperation implements OnRemoteOper
newDir.setPermissions(createdRemoteFolder.getPermissions());
getStorageManager().saveFile(newDir);
logger.d(TAG, "Create directory " + mRemotePath + " in Database");
Log_OC.d(TAG, "Create directory " + mRemotePath + " in Database");
}
}
Loaded 100 of 296 files, more files were not shown because too many files have changed in this diff. Show more