Compare commits

...
Author SHA1 Message Date
Tobias Kaminsky fde2de08e0 daily dev 20200422
Update translations
Update Nextcloud Android library
Update 3rd-party dependencies
2020-04-22 03:41:23 +02:00
Tobias Kaminsky f53e509085 Merge remote-tracking branch 'origin/master' into dev 2020-04-22 03:32:05 +02:00
Tobias Kaminsky 5610aa03d0 Merge pull request #5904 from nextcloud/dependabot/gradle/com.android.tools.build-gradle-3.6.3
Bump gradle from 3.6.2 to 3.6.3
2020-04-21 09:02:12 +02:00
Tobias Kaminsky 35c9175e8c Merge pull request #5906 from nextcloud/dependabot/gradle/io.gitlab.arturbosch.detekt-detekt-gradle-plugin-1.8.0
Bump detekt-gradle-plugin from 1.7.4 to 1.8.0
2020-04-21 09:01:50 +02:00
Nextcloud bot 5febcdfd0d [tx-robot] updated from transifex 2020-04-21 03:26:05 +00:00
Tobias Kaminsky d37e0e8254 Merge remote-tracking branch 'origin/master' into dev 2020-04-21 03:33:10 +02:00
dependabot-preview[bot] 76123e6d3d Bump detekt-gradle-plugin from 1.7.4 to 1.8.0
Bumps detekt-gradle-plugin from 1.7.4 to 1.8.0.

Signed-off-by: dependabot-preview[bot] <[email protected]>
2020-04-21 01:12:17 +00:00
Nextcloud bot 525f6076c6 [tx-robot] updated from transifex 2020-04-20 03:25:08 +00:00
dependabot-preview[bot] 620b672344 Bump gradle from 3.6.2 to 3.6.3
Bumps gradle from 3.6.2 to 3.6.3.

Signed-off-by: dependabot-preview[bot] <[email protected]>
2020-04-20 01:12:26 +00:00
Nextcloud bot 0f7fd5c60c [tx-robot] updated from transifex 2020-04-19 03:24:56 +00:00
Nextcloud bot acb78ca293 [tx-robot] updated from transifex 2020-04-18 03:25:45 +00:00
Nextcloud bot bcf40b29f9 [tx-robot] updated from transifex 2020-04-17 03:25:59 +00:00
Tobias Kaminsky c0e80d5ebd daily dev 20200417
code formatting
Make the name collision policy for auto uploads selectable, fixes #5599.
Release connections after usage
[FIX: #5752] Upload files: too much whitespace
Readd enableAccountHandling for show slider
Update 3rd-party dependencies
2020-04-17 03:41:33 +02:00
Tobias Kaminsky f22a7c70b3 Merge remote-tracking branch 'origin/master' into dev 2020-04-17 03:30:56 +02:00
Andy Scherzinger aa9e80f0a7 Merge pull request #5876 from nextcloud/releaseConnections
Release connections after usage
2020-04-16 18:15:25 +02:00
Tobias Kaminsky 47d5552af8 Merge pull request #5741 from nextcloud/fix-#5736master
Readd enableAccountHandling for show slider
2020-04-16 12:48:10 +02:00
Tobias Kaminsky c42d12cc6f Merge pull request #5848 from goforbg/master
[FIX: #5752] Upload files: too much whitespace
2020-04-16 12:00:32 +02:00
Andy Scherzinger f84369b5ed Merge pull request #5870 from nextcloud/dependabot/gradle/kotlin_version-1.3.72
Bump kotlin_version from 1.3.71 to 1.3.72
2020-04-16 10:40:11 +02:00
Tobias Kaminsky af0b39ebe9 Merge pull request #5810 from fodinabor/dontAskAllTheTime
Make the name collision policy for auto uploads selectable
2020-04-16 08:03:25 +02:00
Tobias Kaminsky 8a5d4bec67 daily dev 20200416
fix https://github.com/nextcloud/android/issues/5457
Update translations
2020-04-16 03:38:24 +02:00
Tobias Kaminsky 766b7c755a Merge remote-tracking branch 'origin/master' into dev 2020-04-16 03:30:53 +02:00
tobiasKaminsky 464aaded14 increase spotbugs
Signed-off-by: tobiasKaminsky <[email protected]>
2020-04-15 19:12:43 +02:00
tobiasKaminsky db3bd029ca code formatting
Signed-off-by: tobiasKaminsky <[email protected]>
2020-04-15 19:12:16 +02:00
Joachim Meyer 32da47d6a3 Make the name collision policy for auto uploads selectable, fixes #5599.
Signed-off-by: Joachim Meyer <[email protected]>
2020-04-15 19:12:06 +02:00
Tobias Kaminsky 30e7728dbc Merge pull request #5873 from nextcloud/webAction
Notification handle action type "web"
2020-04-15 17:46:27 +02:00
tobiasKaminsky 4b30ed5993 Release connections after usage
Signed-off-by: tobiasKaminsky <[email protected]>
2020-04-15 17:44:17 +02:00
Tobias Kaminsky fb7d489ed7 Merge pull request #5875 from nextcloud/reverseProxy
add question about reverse proxy
2020-04-15 17:03:36 +02:00
tobiasKaminsky 887ac009eb add question about reverse proxy
Signed-off-by: tobiasKaminsky <[email protected]>
2020-04-15 17:02:25 +02:00
tobiasKaminsky 352dbd575c fix https://github.com/nextcloud/android/issues/5457
Signed-off-by: tobiasKaminsky <[email protected]>
2020-04-15 15:05:58 +02:00
Nextcloud bot 4dc092945b [tx-robot] updated from transifex 2020-04-15 03:30:10 +00:00
Tobias Kaminsky 6c889e62cb daily dev 20200415
Don't put User model into ConflictsResolveActivity account extra
show all files when clicking on show files
Update translations
Update Nextcloud Android library
2020-04-15 03:40:19 +02:00
Tobias Kaminsky 7f3ca4fa9f Merge remote-tracking branch 'origin/master' into dev 2020-04-15 03:32:45 +02:00
dependabot-preview[bot] ffacdbd7f9 Bump kotlin_version from 1.3.71 to 1.3.72
Bumps `kotlin_version` from 1.3.71 to 1.3.72.

Updates `kotlin-gradle-plugin` from 1.3.71 to 1.3.72
- [Release notes](https://github.com/JetBrains/kotlin/releases)
- [Changelog](https://github.com/JetBrains/kotlin/blob/master/ChangeLog.md)
- [Commits](https://github.com/JetBrains/kotlin/commits)

Updates `kotlin-stdlib-jdk7` from 1.3.71 to 1.3.72
- [Release notes](https://github.com/JetBrains/kotlin/releases)
- [Changelog](https://github.com/JetBrains/kotlin/blob/master/ChangeLog.md)
- [Commits](https://github.com/JetBrains/kotlin/commits)

Signed-off-by: dependabot-preview[bot] <[email protected]>
2020-04-15 01:17:17 +00:00
Tobias Kaminsky 0a2e59d63e Merge pull request #5839 from nextcloud/showAllFiles
show all files when clicking on show files
2020-04-14 14:52:29 +02:00
Tobias Kaminsky cac0fc7a69 Merge pull request #5857 from nextcloud/ezaquarii/fix-broken-account-extra-in-conflicts-resolve-activity
Don't put User model into ConflictsResolveActivity account extra
2020-04-14 09:13:08 +02:00
Nextcloud bot 34b93be4e0 [tx-robot] updated from transifex 2020-04-14 03:29:25 +00:00
Chris Narkiewicz 16bb8d3dfc Don't put User model into ConflictsResolveActivity account extra
User model has been put into Intent instead of Account,
causing a crash. Convert User into Account before setting
extras parameters.

Fixes #5849

Signed-off-by: Chris Narkiewicz <[email protected]>
2020-04-12 13:26:08 +01:00
Nextcloud bot a9ea2b5e32 [tx-robot] updated from transifex 2020-04-12 08:11:50 +00:00
techydevil b4db8d8f95 [FIX: #5752] Upload files: too much whitespace 2020-04-11 16:20:37 +05:30
Nextcloud bot 34e7dbd5de [tx-robot] updated from transifex 2020-04-11 03:33:17 +00:00
Tobias Kaminsky e53d40a4e3 daily dev 20200410
Fix OOM during image browsing
Do not tint dialog
Migrate FileDownloader server to User model
2020-04-10 03:37:11 +02:00
Tobias Kaminsky bf7e13efbf Merge remote-tracking branch 'origin/master' into dev 2020-04-10 03:30:52 +02:00
Tobias Kaminsky 517437eba9 Merge pull request #5761 from nextcloud/ezaquarii/migrate-file-downloader-service-to-user-model
Migrate FileDownloader server to User model
2020-04-09 15:08:26 +02:00
Tobias Kaminsky 1013b6b977 Merge pull request #5707 from nextcloud/fixOOMduringImages
Fix OOM during image browsing
2020-04-09 13:27:09 +02:00
tobiasKaminsky 45315f1486 Fix OOM during image browsing
Signed-off-by: tobiasKaminsky <[email protected]>
2020-04-09 10:16:58 +02:00
Andy Scherzinger d251fbb556 Merge pull request #5838 from nextcloud/tintSSO
Do not tint dialog
2020-04-09 09:13:48 +02:00
tobiasKaminsky d10403bd3c show all files when clicking on show files
Signed-off-by: tobiasKaminsky <[email protected]>
2020-04-09 09:06:29 +02:00
tobiasKaminsky 886e28bfc2 Do not tint dialog
Signed-off-by: tobiasKaminsky <[email protected]>
2020-04-09 08:07:41 +02:00
Tobias Kaminsky 7a9e67e788 daily dev 20200409
Log exception in ContactsImportWork catch block
codacy: Avoid unused local variables
codacy: Avoid unused method parameters
reformat code
codacy: Unnecessary use of fully qualified name
codacy: Avoid unused private fields
codacy: Avoid unused imports
check if at least one account is set up, before receiving files
Change pdf icon
Directly show loading spinner show "no files" only if folder is known to be empty
Fix crash while showing ConflictDialog
Rich workspaces: can be null (if disabled), or string (empty or with content)
Search: only parse search if search event is there
NC18+: add possibility to set expiration date on user/group shares
Ninja-fix formatting of CONTRIBUTING.md
Migrate contacts import job to new API
Migrate ChooseRichDocumentsTemplateDialogFragment to User
Migrate EditShareFragment to new User model
Remove deprecated contacts backup job
Update translations
Update Nextcloud Android library
Update 3rd-party dependencies
2020-04-09 03:39:02 +02:00
Tobias Kaminsky fbfefd5235 Merge remote-tracking branch 'origin/master' into dev 2020-04-09 03:30:53 +02:00
Andy Scherzinger a445602f2d Merge pull request #5760 from nextcloud/ezaquarii/migrate-choose-rich-documents-template-dialot-to-new-user-model
Migrate ChooseRichDocumentsTemplateDialogFragment to User
2020-04-08 20:52:20 +02:00
Andy Scherzinger 4914f4ec42 Merge pull request #5835 from nextcloud/ezaquarii/contacts-import-log-whole-exception
Log exception in ContactsImportWork catch block
2020-04-08 20:51:11 +02:00
Chris Narkiewicz a07cc68573 Migrate FileDownloader server to User model
Signed-off-by: Chris Narkiewicz <[email protected]>
2020-04-08 15:03:49 +01:00
Chris Narkiewicz 29cffa4a24 Log exception in ContactsImportWork catch block
Signed-off-by: Chris Narkiewicz <[email protected]>
2020-04-08 14:34:57 +01:00
Tobias Kaminsky 1d8e5a2648 Merge pull request #5757 from nextcloud/ezaquarii/migrate-edit-share-fragment-to-user
Migrate EditShareFragment to new User model
2020-04-08 13:47:35 +02:00
Tobias Kaminsky 43c6daadcc Merge pull request #5756 from nextcloud/ezaquarii/migrate-contacts-import-job-to-worker-api
Migrate contacts import job to new API
2020-04-08 13:47:20 +02:00
Andy Scherzinger 167011caf1 Merge pull request #5652 from nextcloud/codacy
Codacy improvements
2020-04-08 13:13:05 +02:00
Andy Scherzinger ca2420e1d6 codacy: Avoid unused local variables
Signed-off-by: Andy Scherzinger <[email protected]>
2020-04-08 12:39:37 +02:00
Andy Scherzinger e9bdd81029 codacy: Avoid unused method parameters
Signed-off-by: Andy Scherzinger <[email protected]>
2020-04-08 12:39:36 +02:00
Andy Scherzinger 6fc6b6e4a3 reformat code
Signed-off-by: Andy Scherzinger <[email protected]>
2020-04-08 12:39:35 +02:00
Andy Scherzinger 86ca6d5cf8 codacy: Unnecessary use of fully qualified name
Signed-off-by: Andy Scherzinger <[email protected]>
2020-04-08 12:39:34 +02:00
Andy Scherzinger 92ae5122b0 codacy: Avoid unused private fields 2020-04-08 12:39:33 +02:00
Andy Scherzinger 4795aa1571 codacy: Avoid unused imports
Signed-off-by: Andy Scherzinger <[email protected]>
2020-04-08 12:39:22 +02:00
Andy Scherzinger 2c9b0758e4 Merge pull request #5748 from nextcloud/ezaquarii/remove-deprecated-contacts-backup-job
Remove deprecated contacts backup job
2020-04-08 12:37:45 +02:00
Andy Scherzinger f1c8d40817 Merge pull request #5829 from nextcloud/checkAccountBeforeReceivingFiles
check if at least one account is set up, before receiving files
2020-04-08 12:36:13 +02:00
Tobias Kaminsky 7469f8dfb5 Merge pull request #5796 from nextcloud/changePDF
Change pdf icon
2020-04-08 08:21:57 +02:00
tobiasKaminsky 3b13c7156a check if at least one account is set up, before receiving files
Signed-off-by: tobiasKaminsky <[email protected]>
2020-04-08 08:13:01 +02:00
Tobias Kaminsky 2ae9b70c49 Merge pull request #5697 from nextcloud/dependabot/gradle/androidx.work-work-runtime-ktx-2.3.4
Bump work-runtime-ktx from 2.3.3 to 2.3.4
2020-04-08 07:53:10 +02:00
Tobias Kaminsky f8a5643eca Merge pull request #5754 from nextcloud/empty
Show loading instead of empty content
2020-04-08 07:49:18 +02:00
Tobias Kaminsky 9aa8ec066b Merge pull request #5788 from linuxluser/patch-1
Ninja-fix formatting of CONTRIBUTING.md
2020-04-08 07:48:05 +02:00
nextcloud-android-bot 2734e5382b Drone: update Lint results to reflect reduced error/warning count [skip ci]
Signed-off-by: nextcloud-android-bot <[email protected]>
2020-04-08 05:41:42 +00:00
drone 3035a03955 Merge commit '0259a331343616320a752d069adf16816fcfc759' 2020-04-08 05:32:19 +00:00
Tobias Kaminsky 92d69de551 Merge pull request #5791 from nextcloud/ignore-changelog-in-changelogs
Ignore CHANGELOG.md while generating changelogs
2020-04-08 07:30:13 +02:00
tobiasKaminsky 0259a33134 Change pdf icon
Signed-off-by: tobiasKaminsky <[email protected]>
2020-04-08 07:29:01 +02:00
dependabot-preview[bot] a7c7d8de0b Bump work-runtime-ktx from 2.3.3 to 2.3.4
Bumps work-runtime-ktx from 2.3.3 to 2.3.4.

Signed-off-by: dependabot-preview[bot] <[email protected]>
2020-04-08 05:15:20 +00:00
Tobias Kaminsky ade73c3e57 Merge pull request #5822 from nextcloud/conflictToast
Fix crash while showing ConflictDialog
2020-04-08 07:12:25 +02:00
tobiasKaminsky 6f5b671d8c Directly show loading spinner
show "no files" only if folder is known to be empty

Signed-off-by: tobiasKaminsky <[email protected]>
2020-04-08 06:56:18 +02:00
tobiasKaminsky 949a5c3a4f Fix crash while showing ConflictDialog
Signed-off-by: tobiasKaminsky <[email protected]>
2020-04-08 06:38:22 +02:00
Tobias Kaminsky 535624264c Merge remote-tracking branch 'origin/master' into dev 2020-04-08 03:32:01 +02:00
Tobias Kaminsky 676e41092f Merge pull request #5803 from nextcloud/disableRichWorkspace
Rich workspaces: can be null (if disabled), or string (empty or with content)
2020-04-07 17:58:09 +02:00
tobiasKaminsky c43b234ae4 Rich workspaces: can be null (if disabled), or string (empty or with content)
Signed-off-by: tobiasKaminsky <[email protected]>
2020-04-07 16:57:40 +02:00
Andy Scherzinger b413d942ad Merge pull request #5823 from nextcloud/npeSearch
Search: only parse search if search event is there
2020-04-07 14:40:08 +02:00
tobiasKaminsky 54134c43b2 Search: only parse search if search event is there
Signed-off-by: tobiasKaminsky <[email protected]>
2020-04-07 13:33:26 +02:00
Tobias Kaminsky b73040ec62 Merge pull request #5817 from nextcloud/GroupUserExpire
NC18+: add possibility to set expiration date on user/group shares
2020-04-07 10:37:03 +02:00
Nextcloud bot d423baa0a3 [tx-robot] updated from transifex 2020-04-07 03:27:56 +00:00
tobiasKaminsky 4ea0892630 NC18+: add possibility to set expiration date on user/group shares
Signed-off-by: tobiasKaminsky <[email protected]>
2020-04-06 15:34:09 +02:00
Andy Scherzinger e0d4a9df26 Merge pull request #5811 from nextcloud/dependabot/gradle/io.gitlab.arturbosch.detekt-detekt-gradle-plugin-1.7.4
Bump detekt-gradle-plugin from 1.7.3 to 1.7.4
2020-04-06 06:53:40 +02:00
Nextcloud bot 34ee2dd4a9 [tx-robot] updated from transifex 2020-04-06 03:30:22 +00:00
dependabot-preview[bot] 6b851a73df Bump detekt-gradle-plugin from 1.7.3 to 1.7.4
Bumps detekt-gradle-plugin from 1.7.3 to 1.7.4.

Signed-off-by: dependabot-preview[bot] <[email protected]>
2020-04-06 01:12:21 +00:00
Tobias Kaminsky a7bf4aa581 daily dev 20200405
Update translations
Update Nextcloud Android library
Update 3rd-party dependencies
2020-04-05 03:38:20 +02:00
Tobias Kaminsky 67e2fee514 Merge remote-tracking branch 'origin/master' into dev 2020-04-05 03:30:56 +02:00
Nextcloud bot 5cd1feaf7b [tx-robot] updated from transifex 2020-04-04 03:30:19 +00:00
Tobias Kaminsky 7d2d48f1c6 Merge remote-tracking branch 'origin/master' into dev 2020-04-04 03:32:38 +02:00
Andy Scherzinger f83566febc Merge pull request #5793 from nextcloud/dependabot/gradle/androidx.appcompat-appcompat-1.2.0-beta01
Bump appcompat from 1.2.0-alpha03 to 1.2.0-beta01
2020-04-03 19:12:50 +02:00
Nextcloud bot 4fc05e63b4 [tx-robot] updated from transifex 2020-04-03 03:22:56 +00:00
Tobias Kaminsky 7f47effb34 daily dev 20200403
Update translations
Update Nextcloud Android library
Update 3rd-party dependencies
2020-04-03 03:39:12 +02:00
Tobias Kaminsky 7651a9df83 Merge remote-tracking branch 'origin/master' into dev 2020-04-03 03:30:54 +02:00
Andy Scherzinger 0f64f96478 Merge pull request #5698 from nextcloud/dependabot/gradle/androidx.work-work-runtime-2.3.4
Bump work-runtime from 2.3.3 to 2.3.4
2020-04-02 13:48:29 +02:00
Andy Scherzinger c7c6827e18 Merge pull request #5786 from nextcloud/dependabot/gradle/com.android.tools.build-gradle-3.6.2
Bump gradle from 3.6.1 to 3.6.2
2020-04-02 09:35:59 +02:00
dependabot-preview[bot] 98fe1a788e Bump work-runtime from 2.3.3 to 2.3.4
Bumps work-runtime from 2.3.3 to 2.3.4.

Signed-off-by: dependabot-preview[bot] <[email protected]>
2020-04-02 07:23:54 +00:00
dependabot-preview[bot] b2220226d0 Bump appcompat from 1.2.0-alpha03 to 1.2.0-beta01
Bumps appcompat from 1.2.0-alpha03 to 1.2.0-beta01.

Signed-off-by: dependabot-preview[bot] <[email protected]>
2020-04-02 07:23:46 +00:00
Andy Scherzinger 7d0bbc6f37 Merge pull request #5795 from nextcloud/dependabot/gradle/io.gitlab.arturbosch.detekt-detekt-gradle-plugin-1.7.3
Bump detekt-gradle-plugin from 1.7.2 to 1.7.3
2020-04-02 09:23:36 +02:00
Andy Scherzinger fd3daa7968 Merge pull request #5794 from nextcloud/dependabot/gradle/androidx.exifinterface-exifinterface-1.2.0
Bump exifinterface from 1.1.0 to 1.2.0
2020-04-02 09:22:35 +02:00
Andy Scherzinger 4425f8672c Merge pull request #5792 from nextcloud/dependabot/gradle/markwonVersion-4.3.1
Bump markwonVersion from 4.3.0 to 4.3.1
2020-04-02 09:19:32 +02:00
Nextcloud bot 5053c2bf6a [tx-robot] updated from transifex 2020-04-02 03:21:56 +00:00
Tobias Kaminsky d66a60e6af Merge remote-tracking branch 'origin/master' into dev 2020-04-02 03:34:12 +02:00
dependabot-preview[bot] b3f8860fa7 Bump detekt-gradle-plugin from 1.7.2 to 1.7.3
Bumps detekt-gradle-plugin from 1.7.2 to 1.7.3.

Signed-off-by: dependabot-preview[bot] <[email protected]>
2020-04-02 01:14:54 +00:00
dependabot-preview[bot] 05852e9594 Bump exifinterface from 1.1.0 to 1.2.0
Bumps exifinterface from 1.1.0 to 1.2.0.

Signed-off-by: dependabot-preview[bot] <[email protected]>
2020-04-02 01:13:56 +00:00
dependabot-preview[bot] 721a5debce Bump markwonVersion from 4.3.0 to 4.3.1
Bumps `markwonVersion` from 4.3.0 to 4.3.1.

Updates `core` from 4.3.0 to 4.3.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.3.0...v4.3.1)

Updates `ext-strikethrough` from 4.3.0 to 4.3.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.3.0...v4.3.1)

Updates `ext-tables` from 4.3.0 to 4.3.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.3.0...v4.3.1)

Updates `ext-tasklist` from 4.3.0 to 4.3.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.3.0...v4.3.1)

Updates `html` from 4.3.0 to 4.3.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.3.0...v4.3.1)

Updates `syntax-highlight` from 4.3.0 to 4.3.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.3.0...v4.3.1)

Signed-off-by: dependabot-preview[bot] <[email protected]>
2020-04-02 01:13:07 +00:00
AJ Jordan d31dd61b1b Ignore CHANGELOG.md while generating changelogs
I heard you liked changelogs, so I put a changelog in your changelog...
or something. How meta.

Signed-off-by: AJ Jordan <[email protected]>
2020-04-01 20:00:15 -04:00
Dave Erdman 01f138a761 Ninja-fix formatting of CONTRIBUTING.md 2020-04-01 09:28:06 -07:00
Nextcloud bot 5e2241d4ae [tx-robot] updated from transifex 2020-04-01 03:22:49 +00:00
dependabot-preview[bot] de65ab841e Bump gradle from 3.6.1 to 3.6.2
Bumps gradle from 3.6.1 to 3.6.2.

Signed-off-by: dependabot-preview[bot] <[email protected]>
2020-04-01 01:12:52 +00:00
Andy Scherzinger 2acb8c7117 Merge pull request #5781 from nextcloud/dependabot/gradle/org.powermock-powermock-api-mockito2-2.0.7
Bump powermock-api-mockito2 from 2.0.6 to 2.0.7
2020-03-31 16:52:46 +02:00
dependabot-preview[bot] 572c26071f Bump powermock-api-mockito2 from 2.0.6 to 2.0.7
Bumps [powermock-api-mockito2](https://github.com/powermock/powermock) from 2.0.6 to 2.0.7.
- [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.6...powermock-2.0.7)

Signed-off-by: dependabot-preview[bot] <[email protected]>
2020-03-31 12:10:45 +00:00
Andy Scherzinger 2ae6c5f01b Merge pull request #5782 from nextcloud/dependabot/gradle/org.powermock-powermock-module-junit4-2.0.7
Bump powermock-module-junit4 from 2.0.6 to 2.0.7
2020-03-31 14:09:30 +02:00
dependabot-preview[bot] 9e71804337 Bump powermock-module-junit4 from 2.0.6 to 2.0.7
Bumps [powermock-module-junit4](https://github.com/powermock/powermock) from 2.0.6 to 2.0.7.
- [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.6...powermock-2.0.7)

Signed-off-by: dependabot-preview[bot] <[email protected]>
2020-03-31 12:02:33 +00:00
Andy Scherzinger 2a73db1ea3 Merge pull request #5780 from nextcloud/dependabot/gradle/org.powermock-powermock-core-2.0.7
Bump powermock-core from 2.0.6 to 2.0.7
2020-03-31 14:01:21 +02:00
Tobias Kaminsky 697d660d42 daily dev 20200331
if no offline editor is available, use OO/Cool/Text
edit downloaded md/text file is working now
First use preferred mimetypes, then editor for optional mimetypes
Update translations
Update 3rd-party dependencies
2020-03-31 03:38:56 +02:00
Tobias Kaminsky c45ae25414 Merge remote-tracking branch 'origin/master' into dev 2020-03-31 03:30:55 +02:00
dependabot-preview[bot] d25c8f25df Bump powermock-core from 2.0.6 to 2.0.7
Bumps [powermock-core](https://github.com/powermock/powermock) from 2.0.6 to 2.0.7.
- [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.6...powermock-2.0.7)

Signed-off-by: dependabot-preview[bot] <[email protected]>
2020-03-31 01:12:05 +00:00
Andy Scherzinger 61c8cd76dd Merge pull request #5772 from nextcloud/wrongTextOpening
First use preferred mimetypes, then editor for optional mimetypes
2020-03-30 22:35:43 +02:00
Andy Scherzinger c6be91a096 Merge pull request #5775 from nextcloud/fallbackIfNoLocal
if no offline editor is available, use OO/Cool/Text
2020-03-30 20:06:30 +02:00
Andy Scherzinger b130690bd8 Merge pull request #5773 from nextcloud/fixEditText
edit downloaded md/text file is working now
2020-03-30 17:18:57 +02:00
tobiasKaminsky d3f3b98be0 if no offline editor is available, use OO/Cool/Text
Signed-off-by: tobiasKaminsky <[email protected]>
2020-03-30 16:12:16 +02:00
tobiasKaminsky 12a6cdfcea edit downloaded md/text file is working now
Signed-off-by: tobiasKaminsky <[email protected]>
2020-03-30 14:13:09 +02:00
tobiasKaminsky 456ae330dd First use preferred mimetypes, then editor for optional mimetypes
Signed-off-by: tobiasKaminsky <[email protected]>
2020-03-30 13:15:37 +02:00
Andy Scherzinger 62074a00a6 Merge pull request #5770 from nextcloud/dependabot/gradle/io.gitlab.arturbosch.detekt-detekt-gradle-plugin-1.7.2
Bump detekt-gradle-plugin from 1.7.0 to 1.7.2
2020-03-30 09:03:40 +02:00
Nextcloud bot b93b8e6dd8 [tx-robot] updated from transifex 2020-03-30 03:33:05 +00:00
dependabot-preview[bot] ff07f3b8f2 Bump detekt-gradle-plugin from 1.7.0 to 1.7.2
Bumps detekt-gradle-plugin from 1.7.0 to 1.7.2.

Signed-off-by: dependabot-preview[bot] <[email protected]>
2020-03-30 01:11:47 +00:00
Nextcloud bot f72c7ac2c3 [tx-robot] updated from transifex 2020-03-29 03:39:18 +00:00
Chris Narkiewicz 5204ba7541 Migrate contacts import job to new API
Signed-off-by: Chris Narkiewicz <[email protected]>
2020-03-28 22:07:03 +00:00
Chris Narkiewicz 6f34899327 Migrate ChooseRichDocumentsTemplateDialogFragment to User
Signed-off-by: Chris Narkiewicz <[email protected]>
2020-03-28 12:51:12 +00:00
Nextcloud bot 5faff2fa59 [tx-robot] updated from transifex 2020-03-28 03:33:52 +00:00
Chris Narkiewicz ba1c2f517c Migrate EditShareFragment to new User model
Signed-off-by: Chris Narkiewicz <[email protected]>
2020-03-28 00:48:11 +00:00
Nextcloud bot 44bcecf98b [tx-robot] updated from transifex 2020-03-27 03:32:16 +00:00
Tobias Kaminsky 14d6e473a3 daily dev 20200327
Changelog for 3.11.0
Add changelog for 3.11.0
Update translations
2020-03-27 03:37:11 +01:00
Tobias Kaminsky 46051694fe Merge remote-tracking branch 'origin/master' into dev 2020-03-27 03:30:50 +01:00
nextcloud-android-bot 9fa46b0b48 Drone: update FindBugs results to reflect reduced error/warning count [skip ci]
Signed-off-by: nextcloud-android-bot <[email protected]>
2020-03-26 19:17:48 +00:00
Chris Narkiewicz 1a26399051 Remove deprecated contacts backup job
Signed-off-by: Chris Narkiewicz <[email protected]>
2020-03-26 19:06:47 +00:00
Andy Scherzinger cdcacd25fd Changelog for 3.11.0
proper headline formatting
2020-03-26 17:17:31 +01:00
Andy Scherzinger 448435cb8c Merge pull request #5744 from nextcloud/changelog-master-stable-3.11.0
Add changelog for 3.11.0
2020-03-26 16:53:44 +01:00
tobiasKaminsky ae0016a3f6 Add changelog for 3.11.0
Signed-off-by: tobiasKaminsky <[email protected]>
2020-03-26 11:36:01 +01:00
Joris Bodin 4cd105d5ec Readd enableAccountHandling for show slider
Signed-off-by: Joris Bodin <[email protected]>
2020-03-26 09:25:02 +01:00
Nextcloud bot 3f98a6914b [tx-robot] updated from transifex 2020-03-26 03:28:49 +00:00
Nextcloud bot e13c7b9093 [tx-robot] updated from transifex 2020-03-25 03:32:48 +00:00
Tobias Kaminsky 44793c2ba7 daily dev 20200325
Update translations
Update Nextcloud Android library
Update 3rd-party dependencies
2020-03-25 03:42:24 +01:00
Tobias Kaminsky 9caa4ab460 Merge remote-tracking branch 'origin/master' into dev 2020-03-25 03:32:41 +01:00
Andy Scherzinger 0c0e586411 Merge pull request #5732 from nextcloud/dependabot/gradle/kotlin_version-1.3.71
Bump kotlin_version from 1.3.70 to 1.3.71
2020-03-24 15:16:51 +01:00
Tobias Kaminsky 84de3091de Merge pull request #5684 from nextcloud/flakyTests
Add rule to rety failing tests
2020-03-24 09:47:35 +01:00
Andy Scherzinger ef8123369a Merge pull request #5696 from nextcloud/dependabot/gradle/markwonVersion-4.3.0
Bump markwonVersion from 4.2.2 to 4.3.0
2020-03-24 09:07:12 +01:00
Nextcloud bot d969a344d7 [tx-robot] updated from transifex 2020-03-24 03:31:59 +00:00
Tobias Kaminsky 42f5469afc daily dev 20200324
Bump to latest firebase messaging
fix activity image loading
Update translations
Update 3rd-party dependencies
2020-03-24 03:38:55 +01:00
Tobias Kaminsky 0b19e2129d Merge remote-tracking branch 'origin/master' into dev 2020-03-24 03:30:51 +01:00
dependabot-preview[bot] e6f93eaead Bump kotlin_version from 1.3.70 to 1.3.71
Bumps `kotlin_version` from 1.3.70 to 1.3.71.

Updates `kotlin-gradle-plugin` from 1.3.70 to 1.3.71

Updates `kotlin-stdlib-jdk7` from 1.3.70 to 1.3.71
- [Release notes](https://github.com/JetBrains/kotlin/releases)
- [Changelog](https://github.com/JetBrains/kotlin/blob/v1.3.71/ChangeLog.md)
- [Commits](https://github.com/JetBrains/kotlin/compare/v1.3.70...v1.3.71)

Signed-off-by: dependabot-preview[bot] <[email protected]>
2020-03-24 02:16:45 +00:00
Tobias Kaminsky c19cdc0469 Merge pull request #5722 from nextcloud/bumpFirebase
Bump to latest firebase messaging
2020-03-23 12:31:42 +01:00
Andy Scherzinger c2319d3a2c Merge pull request #5719 from nextcloud/question
Add question if problem is reproducible on try.nextcloud.com
2020-03-23 10:06:34 +01:00
Andy Scherzinger e85c272ec4 Merge pull request #5717 from nextcloud/dependabot/gradle/org.powermock-powermock-core-2.0.6
Bump powermock-core from 2.0.5 to 2.0.6
2020-03-23 10:04:41 +01:00
dependabot-preview[bot] f60472c26e Bump powermock-core from 2.0.5 to 2.0.6
Bumps [powermock-core](https://github.com/powermock/powermock) from 2.0.5 to 2.0.6.
- [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.5...powermock-2.0.6)

Signed-off-by: dependabot-preview[bot] <[email protected]>
2020-03-23 09:03:07 +00:00
Andy Scherzinger 4ba70164be Merge pull request #5716 from nextcloud/dependabot/gradle/org.powermock-powermock-api-mockito2-2.0.6
Bump powermock-api-mockito2 from 2.0.5 to 2.0.6
2020-03-23 10:01:49 +01:00
Andy Scherzinger f554b0ca1f Merge pull request #5718 from nextcloud/dependabot/gradle/io.gitlab.arturbosch.detekt-detekt-gradle-plugin-1.7.0
Bump detekt-gradle-plugin from 1.6.0 to 1.7.0
2020-03-23 09:05:18 +01:00
dependabot-preview[bot] 257b27309c Bump powermock-api-mockito2 from 2.0.5 to 2.0.6
Bumps [powermock-api-mockito2](https://github.com/powermock/powermock) from 2.0.5 to 2.0.6.
- [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.5...powermock-2.0.6)

Signed-off-by: dependabot-preview[bot] <[email protected]>
2020-03-23 08:02:06 +00:00
Andy Scherzinger 80b1e23c0e Merge pull request #5715 from nextcloud/dependabot/gradle/org.powermock-powermock-module-junit4-2.0.6
Bump powermock-module-junit4 from 2.0.5 to 2.0.6
2020-03-23 09:00:41 +01:00
nextcloud-android-bot 18cdde1acd Drone: update Lint results to reflect reduced error/warning count [skip ci]
Signed-off-by: nextcloud-android-bot <[email protected]>
2020-03-23 06:55:36 +00:00
tobiasKaminsky 271e163c30 Bump to latest firebase messaging
Signed-off-by: tobiasKaminsky <[email protected]>
2020-03-23 07:41:26 +01:00
Tobias Kaminsky ac6bcb1320 Merge pull request #5725 from nextcloud/fixDrone4
fix drone
2020-03-23 07:39:55 +01:00
tobiasKaminsky 9d96e1e87c fix drone
Signed-off-by: tobiasKaminsky <[email protected]>
2020-03-23 07:39:19 +01:00
Tobias Kaminsky 606d525168 Merge pull request #5723 from nextcloud/fixDrone
fix drone
2020-03-23 07:34:33 +01:00
tobiasKaminsky 9dc695d4a1 fix drone
Signed-off-by: tobiasKaminsky <[email protected]>
2020-03-23 07:33:36 +01:00
Tobias Kaminsky b04c09e82b Merge pull request #5695 from nextcloud/actImage
fix activity image loading
2020-03-23 06:48:11 +01:00
tobiasKaminsky 4ab6e19406 Add question if problem is reproducible on try.nextcloud.com
Signed-off-by: tobiasKaminsky <[email protected]>
2020-03-23 06:42:13 +01:00
Nextcloud bot a0d583c969 [tx-robot] updated from transifex 2020-03-23 03:29:46 +00:00
Tobias Kaminsky 796db9d195 daily dev 20200323
Fix for sso Grant/Deny dialog text color in dark mode.
Wrong string
Update translations
2020-03-23 03:37:18 +01:00
Tobias Kaminsky bc2a0725ac Merge remote-tracking branch 'origin/master' into dev 2020-03-23 03:30:52 +01:00
dependabot-preview[bot] 452e93e581 Bump detekt-gradle-plugin from 1.6.0 to 1.7.0
Bumps detekt-gradle-plugin from 1.6.0 to 1.7.0.

Signed-off-by: dependabot-preview[bot] <[email protected]>
2020-03-23 02:17:00 +00:00
dependabot-preview[bot] 9c5d1e16f6 Bump powermock-module-junit4 from 2.0.5 to 2.0.6
Bumps [powermock-module-junit4](https://github.com/powermock/powermock) from 2.0.5 to 2.0.6.
- [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.5...powermock-2.0.6)

Signed-off-by: dependabot-preview[bot] <[email protected]>
2020-03-23 02:15:10 +00:00
Andy Scherzinger f2c44e39c3 Merge pull request #5705 from nextcloud/fixString
Wrong string
2020-03-22 22:12:43 +01:00
Andy Scherzinger ec70e76d22 Merge pull request #5710 from dan0xii/sso-dark-mode
Fix for sso Allow/Deny dialog text color in dark mode.
2020-03-22 21:50:56 +01:00
Daniel Bailey 19a5bc2f60 Fix for sso Grant/Deny dialog text color in dark mode.
Signed-off-by: Daniel Bailey <[email protected]>
2020-03-22 11:50:06 +00:00
Nextcloud bot 78bf9d5012 [tx-robot] updated from transifex 2020-03-22 03:29:59 +00:00
tobiasKaminsky 7f0aa2661c Wrong string
Signed-off-by: tobiasKaminsky <[email protected]>
2020-03-21 18:13:02 +01:00
Nextcloud bot 791d461e51 [tx-robot] updated from transifex 2020-03-21 03:31:28 +00:00
Nextcloud bot 9079a3299d [tx-robot] updated from transifex 2020-03-20 03:31:02 +00:00
Tobias Kaminsky 78f1289cd5 daily dev 20200320
revert to master lib
Add circle support for searching / displaying
Fixes "Report a bug" button in community tab
Adjusted file list banner background colour in dark mode
Tint buttons in upload
Dark Mode Improvements
fix lint to exclude correct freemarker version
Update translations
Update Nextcloud Android library
Update 3rd-party dependencies
2020-03-20 03:40:13 +01:00
Tobias Kaminsky 1227572edd Merge remote-tracking branch 'origin/master' into dev 2020-03-20 03:32:19 +01:00
dependabot-preview[bot] 9a1dd92e5d Bump markwonVersion from 4.2.2 to 4.3.0
Bumps `markwonVersion` from 4.2.2 to 4.3.0.

Updates `core` from 4.2.2 to 4.3.0
- [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.2...v4.3.0)

Updates `ext-strikethrough` from 4.2.2 to 4.3.0
- [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.2...v4.3.0)

Updates `ext-tables` from 4.2.2 to 4.3.0
- [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.2...v4.3.0)

Updates `ext-tasklist` from 4.2.2 to 4.3.0
- [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.2...v4.3.0)

Updates `html` from 4.2.2 to 4.3.0
- [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.2...v4.3.0)

Updates `syntax-highlight` from 4.2.2 to 4.3.0
- [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.2...v4.3.0)

Signed-off-by: dependabot-preview[bot] <[email protected]>
2020-03-20 02:12:25 +00:00
tobiasKaminsky c0c631fe64 fix activity image loading
Signed-off-by: tobiasKaminsky <[email protected]>
2020-03-19 20:33:48 +01:00
Tobias Kaminsky fac23bf2ea Merge pull request #5693 from nextcloud/changeTestDesc
manually increase lint
2020-03-19 19:40:35 +01:00
tobiasKaminsky 31cd0be017 manually increase lint
Signed-off-by: tobiasKaminsky <[email protected]>
2020-03-19 19:39:57 +01:00
Tobias Kaminsky 555967e774 Merge pull request #5688 from nextcloud/circle
Add circle support for searching / displaying
2020-03-19 19:32:56 +01:00
tobiasKaminsky 25b8886ba2 manually increase lint
Signed-off-by: tobiasKaminsky <[email protected]>
2020-03-19 19:12:36 +01:00
tobiasKaminsky 25c24b961c revert to master lib
Signed-off-by: tobiasKaminsky <[email protected]>
2020-03-19 19:12:23 +01:00
tobiasKaminsky 1a1c42e0a7 move sleep to function
fix errors found by detekt

Signed-off-by: tobiasKaminsky <[email protected]>
2020-03-19 19:12:23 +01:00
tobiasKaminsky 7eb0f66079 Add circle support for searching / displaying
Signed-off-by: tobiasKaminsky <[email protected]>
2020-03-19 19:12:23 +01:00
Tobias Kaminsky bc2790ef10 Merge pull request #5658 from dan0xii/5657-dark-mode
Dark Mode Improvements
2020-03-19 19:06:31 +01:00
Daniel Bailey 7d2ad3afda Fixes "Report a bug" button in community tab
Signed-off-by: Daniel Bailey <[email protected]>
2020-03-19 15:14:33 +00:00
Daniel Bailey aa2f44b92d Adjusted file list banner background colour in dark mode
Signed-off-by: Daniel Bailey <[email protected]>
2020-03-19 14:48:29 +00:00
tobiasKaminsky 1f805e5a57 Tint buttons in upload
Signed-off-by: tobiasKaminsky <[email protected]>
2020-03-19 14:48:29 +00:00
Daniel Bailey 28d35f26af Dark Mode Improvements
Removes conflicts between high contrast server themes and the dark mode.
Made primaryAccentColor() aware of the device theme so that it can
adjust the lightness accordingly.
Switch preference's track and thumb are more visible in device dark
mode.

Signed-off-by: Daniel Bailey <[email protected]>
2020-03-19 14:48:04 +00:00
Tobias Kaminsky 1038cf507c Merge pull request #5674 from nextcloud/dependabot/gradle/com.googlecode.ez-vcard-ez-vcard-0.10.6
Bump ez-vcard from 0.10.5 to 0.10.6
2020-03-19 15:05:58 +01:00
nextcloud-android-bot b34bf03551 Drone: update Lint results to reflect reduced error/warning count [skip ci]
Signed-off-by: nextcloud-android-bot <[email protected]>
2020-03-19 13:17:48 +00:00
tobiasKaminsky f565b6cf48 fix lint to exclude correct freemarker version
Signed-off-by: tobiasKaminsky <[email protected]>
2020-03-19 14:00:24 +01:00
dependabot-preview[bot] 48741d990b Bump ez-vcard from 0.10.5 to 0.10.6
Bumps [ez-vcard](https://github.com/mangstadt/ez-vcard) from 0.10.5 to 0.10.6.
- [Release notes](https://github.com/mangstadt/ez-vcard/releases)
- [Commits](https://github.com/mangstadt/ez-vcard/compare/0.10.5...0.10.6)

Signed-off-by: dependabot-preview[bot] <[email protected]>
2020-03-19 14:00:15 +01:00
Nextcloud bot f94a2d5561 [tx-robot] updated from transifex 2020-03-19 03:34:12 +00:00
Tobias Kaminsky f8428a0d1f daily dev 20200319
remove outdated background for dev
Update translations
2020-03-19 03:37:09 +01:00
Tobias Kaminsky 5f30815410 Merge remote-tracking branch 'origin/master' into dev 2020-03-19 03:30:50 +01:00
Andy Scherzinger 95d6d6a905 Merge pull request #5685 from nextcloud/newIconDev
remove outdated background for dev
2020-03-18 19:27:52 +01:00
tobiasKaminsky 7b0fd67be7 remove outdated background for dev
Signed-off-by: tobiasKaminsky <[email protected]>
2020-03-18 16:46:15 +01:00
tobiasKaminsky 1cb680b4ff Add rule to rety failing tests
Signed-off-by: tobiasKaminsky <[email protected]>
2020-03-18 16:20:18 +01:00
Nextcloud bot bc3d631e8b [tx-robot] updated from transifex 2020-03-18 03:33:04 +00:00
Tobias Kaminsky e568054e94 daily dev 20200318
fix wrong assumption how conflict dialog show work updated tests
Update translations
Update Nextcloud Android library
Update 3rd-party dependencies
2020-03-18 03:37:22 +01:00
Tobias Kaminsky 0c051fd72b Merge remote-tracking branch 'origin/master' into dev 2020-03-18 03:30:52 +01:00
Tobias Kaminsky b0943079c3 Merge pull request #5675 from nextcloud/docStorageConflict
Conflict behaviour fix
2020-03-17 14:01:57 +01:00
tobiasKaminsky 4bf40b5860 fix wrong assumption how conflict dialog show work
updated tests

Signed-off-by: tobiasKaminsky <[email protected]>
2020-03-17 09:49:59 +01:00
Nextcloud bot 779b1b388b [tx-robot] updated from transifex 2020-03-17 03:34:52 +00:00
Tobias Kaminsky 3f1dfed3a8 Merge remote-tracking branch 'origin/master' into dev 2020-03-17 03:32:02 +01:00
Andy Scherzinger 624cba1a7a Merge pull request #5662 from nextcloud/dependabot/gradle/org.mockito-mockito-android-3.3.3
Bump mockito-android from 3.3.1 to 3.3.3
2020-03-16 09:28:57 +01:00
Andy Scherzinger 5e05c072c1 Merge pull request #5663 from nextcloud/dependabot/gradle/org.mockito-mockito-core-3.3.3
Bump mockito-core from 3.3.1 to 3.3.3
2020-03-16 09:28:46 +01:00
Andy Scherzinger 179559e223 Merge pull request #5661 from nextcloud/dependabot/gradle/daggerVersion-2.27
Bump daggerVersion from 2.26 to 2.27
2020-03-16 09:25:35 +01:00
Nextcloud bot 5af031151f [tx-robot] updated from transifex 2020-03-16 03:35:58 +00:00
dependabot-preview[bot] b6d2147ed3 Bump mockito-core from 3.3.1 to 3.3.3
Bumps [mockito-core](https://github.com/mockito/mockito) from 3.3.1 to 3.3.3.
- [Release notes](https://github.com/mockito/mockito/releases)
- [Commits](https://github.com/mockito/mockito/compare/v3.3.1...v3.3.3)

Signed-off-by: dependabot-preview[bot] <[email protected]>
2020-03-16 02:14:50 +00:00
dependabot-preview[bot] 168505570c Bump mockito-android from 3.3.1 to 3.3.3
Bumps [mockito-android](https://github.com/mockito/mockito) from 3.3.1 to 3.3.3.
- [Release notes](https://github.com/mockito/mockito/releases)
- [Commits](https://github.com/mockito/mockito/compare/v3.3.1...v3.3.3)

Signed-off-by: dependabot-preview[bot] <[email protected]>
2020-03-16 02:13:53 +00:00
dependabot-preview[bot] 3a7e1ec43d Bump daggerVersion from 2.26 to 2.27
Bumps `daggerVersion` from 2.26 to 2.27.

Updates `dagger` from 2.26 to 2.27
- [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.26...dagger-2.27)

Updates `dagger-android` from 2.26 to 2.27
- [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.26...dagger-2.27)

Updates `dagger-android-support` from 2.26 to 2.27
- [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.26...dagger-2.27)

Updates `dagger-compiler` from 2.26 to 2.27
- [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.26...dagger-2.27)

Updates `dagger-android-processor` from 2.26 to 2.27
- [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.26...dagger-2.27)

Signed-off-by: dependabot-preview[bot] <[email protected]>
2020-03-16 02:13:24 +00:00
Nextcloud bot ff97bcc23e [tx-robot] updated from transifex 2020-03-15 03:34:35 +00:00
Nextcloud bot a6786831c5 [tx-robot] updated from transifex 2020-03-14 03:29:09 +00:00
Andy Scherzinger 44166a2001 Merge pull request #5651 from nextcloud/dependabot/gradle/org.conscrypt-conscrypt-android-2.4.0
Bump conscrypt-android from 2.2.1 to 2.4.0
2020-03-13 12:41:19 +01:00
dependabot-preview[bot] 07f2e98400 Bump conscrypt-android from 2.2.1 to 2.4.0
Bumps [conscrypt-android](https://github.com/google/conscrypt) from 2.2.1 to 2.4.0.
- [Release notes](https://github.com/google/conscrypt/releases)
- [Commits](https://github.com/google/conscrypt/compare/2.2.1...2.4.0)

Signed-off-by: dependabot-preview[bot] <[email protected]>
2020-03-13 08:39:27 +00:00
Nextcloud bot 9ea27802d0 [tx-robot] updated from transifex 2020-03-13 03:29:22 +00:00
Tobias Kaminsky 0c7bec049f daily dev 20200313
Migrate contacts backup job to new background job manager API
add gradient to preview images in toolbar
fix crash when sorting in folder picker
remove unneeded ressource
adjust share size
Correct font color in dark mode
tint back button correctly
Update translations
2020-03-13 03:37:10 +01:00
Tobias Kaminsky f36ac479a8 Merge remote-tracking branch 'origin/master' into dev 2020-03-13 03:30:52 +01:00
Andy Scherzinger 682ed36006 Merge pull request #5629 from nextcloud/shareSize
adjust share size
2020-03-12 18:04:37 +01:00
Tobias Kaminsky e1b0b521f9 Merge pull request #5482 from nextcloud/ezaquarii/migrate-contacts-backup-job-to-worker-api
Migrate contacts backup job to new background job manager API
2020-03-12 14:34:16 +01:00
Andy Scherzinger 0925f54d84 Merge pull request #5598 from nextcloud/changelog-ancestry-fix
Fix the dev edition changelog excluding stuff
2020-03-12 08:38:37 +01:00
Andy Scherzinger 6df2d58de5 Merge pull request #5634 from nextcloud/previewGradient
Add gradient to preview images in toolbar
2020-03-12 08:14:58 +01:00
Tobias Kaminsky 7ab1377744 Merge pull request #5623 from nextcloud/backButton
tint back button correctly
2020-03-12 07:38:26 +01:00
Tobias Kaminsky c77f212fab Merge pull request #5626 from nextcloud/darkRename
Correct font color in dark mode
2020-03-12 07:38:01 +01:00
Tobias Kaminsky 7b5e3607aa Merge pull request #5632 from nextcloud/sortCrash
fix crash when sorting in folder picker
2020-03-12 07:37:30 +01:00
Nextcloud bot b3153237fd [tx-robot] updated from transifex 2020-03-12 03:30:08 +00:00
Tobias Kaminsky 510c6c26e8 daily dev 20200312
v3.12.-Alpha1
Fix border of disabled FAB
Update translations
Update Nextcloud Android library
2020-03-12 03:39:22 +01:00
Tobias Kaminsky 909c9606ce Merge remote-tracking branch 'origin/master' into dev 2020-03-12 03:31:58 +01:00
Chris Narkiewicz 500fdb919b Migrate contacts backup job to new background job manager API
Signed-off-by: Chris Narkiewicz <[email protected]>
2020-03-11 23:16:56 +00:00
Andy Scherzinger 48d0249e7e Merge pull request #5636 from nextcloud/312_Alpha
v3.12.-Alpha1
2020-03-11 22:06:24 +01:00
Andy Scherzinger d604084496 v3.12.-Alpha1
Signed-off-by: Andy Scherzinger <[email protected]>
2020-03-11 22:03:47 +01:00
Andy Scherzinger 2ede91bceb Merge pull request #5625 from nextcloud/disabledFAB
Fix border of disabled FAB
2020-03-11 20:09:09 +01:00
Andy Scherzinger ed8ef97ec3 add gradient to preview images in toolbar
Resolves #2883

Signed-off-by: Andy Scherzinger <[email protected]>
2020-03-11 18:48:38 +01:00
Andy Scherzinger 287ff2532e Merge pull request #5612 from nextcloud/space
Fix exception on computing available space
2020-03-11 16:26:14 +01:00
tobiasKaminsky 221d3cc327 fix crash when sorting in folder picker
Signed-off-by: tobiasKaminsky <[email protected]>
2020-03-11 15:55:00 +01:00
tobiasKaminsky 8cd2648bd0 remove unneeded ressource
Signed-off-by: tobiasKaminsky <[email protected]>
2020-03-11 15:18:43 +01:00
tobiasKaminsky 8cb003b78e adjust share size
Signed-off-by: tobiasKaminsky <[email protected]>
2020-03-11 14:53:37 +01:00
Andy Scherzinger f7ffbe689f Merge pull request #5608 from nextcloud/accountSwitchingTest
Fix account switching
2020-03-11 14:13:56 +01:00
tobiasKaminsky c771db8bb5 Add missing @ for test
Signed-off-by: tobiasKaminsky <[email protected]>
2020-03-11 11:07:20 +01:00
Andy Scherzinger 2a57580cc7 Merge pull request #5624 from nextcloud/gradleWrapperValidation
Gradle wrapper validation
2020-03-11 10:50:09 +01:00
tobiasKaminsky 52ba845e86 Correct font color in dark mode
Signed-off-by: tobiasKaminsky <[email protected]>
2020-03-11 10:43:43 +01:00
tobiasKaminsky 1b5d37b50c Fix border of disabled FAB
Signed-off-by: tobiasKaminsky <[email protected]>
2020-03-11 10:06:21 +01:00
tobiasKaminsky 65e3c66d14 See: https://github.com/gradle/wrapper-validation-action
Signed-off-by: tobiasKaminsky <[email protected]>
2020-03-11 08:43:06 +01:00
tobiasKaminsky 58ae52d108 tint back button correctly
Signed-off-by: tobiasKaminsky <[email protected]>
2020-03-11 08:39:58 +01:00
Nextcloud bot 7cdf890bf4 [tx-robot] updated from transifex 2020-03-11 03:31:14 +00:00
Tobias Kaminsky 4923a8efa7 daily dev 20200311
All files shows root again annotated functions with correct NonNull
Improve readability on active drawer item
Use UTF8 PostMethod everywhere
Update contributing.md
Update translations
2020-03-11 03:36:49 +01:00
Tobias Kaminsky 3e741eee31 Merge remote-tracking branch 'origin/master' into dev 2020-03-11 03:30:50 +01:00
Andy Scherzinger 4920991618 Merge pull request #5617 from nextcloud/allFiles
All files shows root again
2020-03-11 00:00:59 +01:00
Andy Scherzinger e891411a56 Merge pull request #5614 from nextcloud/postEncoding
Use UTF8 PostMethod everywhere
2020-03-10 22:52:20 +01:00
Andy Scherzinger b97df4eb08 Merge pull request #5616 from nextcloud/darkModeActiveItem
Improve readability on active drawer item
2020-03-10 22:40:34 +01:00
tobiasKaminsky 25a67fe4cb All files shows root again
annotated functions with correct NonNull

Signed-off-by: tobiasKaminsky <[email protected]>
2020-03-10 11:56:34 +01:00
tobiasKaminsky 92dd3a0e94 Improve readability on active drawer item
Signed-off-by: tobiasKaminsky <[email protected]>
2020-03-10 11:18:11 +01:00
Andy Scherzinger 43977198f2 Merge pull request #5611 from nextcloud/staleBot
Stale bot shall close only bugs with "need info" and no reply
2020-03-10 11:18:05 +01:00
tobiasKaminsky adae2e48da Use UTF8 PostMethod everywhere
Signed-off-by: tobiasKaminsky <[email protected]>
2020-03-10 10:42:51 +01:00
tobiasKaminsky 4ce2729a8f Adjust test
Signed-off-by: tobiasKaminsky <[email protected]>
2020-03-10 10:07:10 +01:00
Tobias Kaminsky d5e1209d00 Merge pull request #5607 from nextcloud/viewBinding
Use view bindings: https://developer.android.com/topic/libraries/view-binding
2020-03-10 09:58:27 +01:00
tobiasKaminsky 9ead4432e8 manually increase spotbug/lint
Signed-off-by: tobiasKaminsky <[email protected]>
2020-03-10 09:21:00 +01:00
tobiasKaminsky 3108759dac Fix exception on computing available space
Signed-off-by: tobiasKaminsky <[email protected]>
2020-03-10 08:41:12 +01:00
tobiasKaminsky b0234d895e Update contributing.md
Signed-off-by: tobiasKaminsky <[email protected]>
2020-03-10 07:24:57 +01:00
tobiasKaminsky d741ca7724 stale bot: close only bugs with "need info"
Signed-off-by: tobiasKaminsky <[email protected]>
2020-03-10 07:23:34 +01:00
Nextcloud bot 9710a8a863 [tx-robot] updated from transifex 2020-03-10 03:30:49 +00:00
Tobias Kaminsky 99e3843427 daily dev 20200310
Fix NPE on restoring file detail sharing fragment
Update translations
2020-03-10 03:36:51 +01:00
Tobias Kaminsky 3996901d7c Merge remote-tracking branch 'origin/master' into dev 2020-03-10 03:30:50 +01:00
tobiasKaminsky 14f6353cb3 Integration test for account switching
Signed-off-by: tobiasKaminsky <[email protected]>
2020-03-09 15:39:35 +01:00
tobiasKaminsky 593b684d4d Use view bindings: https://developer.android.com/topic/libraries/view-binding
Signed-off-by: tobiasKaminsky <[email protected]>
2020-03-09 11:34:19 +01:00
Andy Scherzinger cedb397566 Merge pull request #5605 from nextcloud/fixNPEonRestoreSharingFragment
Fix NPE on restoring file detail sharing fragment
2020-03-09 09:38:09 +01:00
tobiasKaminsky 8e45d953f1 Fix NPE on restoring file detail sharing fragment
Signed-off-by: tobiasKaminsky <[email protected]>
2020-03-09 08:51:23 +01:00
Nextcloud bot 19333cef78 [tx-robot] updated from transifex 2020-03-09 03:25:08 +00:00
Nextcloud bot e32364d2fd [tx-robot] updated from transifex 2020-03-08 03:30:50 +00:00
Nextcloud bot a52277e5c0 [tx-robot] updated from transifex 2020-03-07 03:28:49 +00:00
Tobias Kaminsky c09264bc0f daily dev 20200307
remove unused dimens value
remove unneeded call
use correct dimens id
remove sdk17 checks
Remove outdated right/left as now only start/end is needed
change minimum supported Android version to 4.2
Properly signal error when user id migration fails
Enabled migration manager in MainApp
Removed MigrationManager Robolectric tests
Support for optional migrations
Migrations manager
remove ununsed raw files
remove unused class
Update translations
Update 3rd-party dependencies
2020-03-07 03:38:14 +01:00
AJ Jordan 9686d38f95 Expand paths to ignore for dev edition changelogs 2020-03-06 21:34:22 -05:00
AJ Jordan a712d61386 Fix commits missing from dev edition changelogs
Ref #5525

Signed-off-by: AJ Jordan <[email protected]>
2020-03-06 21:34:17 -05:00
Tobias Kaminsky 4f7fd16470 Merge remote-tracking branch 'origin/master' into dev 2020-03-07 03:30:49 +01:00
Andy Scherzinger 3598ed75a3 Merge pull request #5595 from nextcloud/dependabot/gradle/pl.droidsonroids.gif-android-gif-drawable-1.2.19
Bump android-gif-drawable from 1.2.15 to 1.2.19
2020-03-06 13:44:33 +01:00
Andy Scherzinger 770f5264fc Merge pull request #5596 from nextcloud/dependabot/gradle/org.mockito-mockito-android-3.3.1
Bump mockito-android from 3.3.0 to 3.3.1
2020-03-06 13:35:49 +01:00
dependabot-preview[bot] 8e5fc8ea9c Bump android-gif-drawable from 1.2.15 to 1.2.19
Bumps [android-gif-drawable](https://github.com/koral--/android-gif-drawable) from 1.2.15 to 1.2.19.
- [Release notes](https://github.com/koral--/android-gif-drawable/releases)
- [Changelog](https://github.com/koral--/android-gif-drawable/blob/dev/CHANGELOG.md)
- [Commits](https://github.com/koral--/android-gif-drawable/compare/v1.2.15...v1.2.19)

Signed-off-by: dependabot-preview[bot] <[email protected]>
2020-03-06 12:19:19 +00:00
Andy Scherzinger 12d4a93144 Merge pull request #5594 from nextcloud/feature/minSdk17
change minimum supported Android version to 4.2
2020-03-06 13:16:59 +01:00
dependabot-preview[bot] 54889cb418 Bump mockito-android from 3.3.0 to 3.3.1
Bumps [mockito-android](https://github.com/mockito/mockito) from 3.3.0 to 3.3.1.
- [Release notes](https://github.com/mockito/mockito/releases)
- [Commits](https://github.com/mockito/mockito/compare/v3.3.0...v3.3.1)

Signed-off-by: dependabot-preview[bot] <[email protected]>
2020-03-06 12:06:41 +00:00
Andy Scherzinger 03c586bd94 remove unused dimens value
Signed-off-by: Andy Scherzinger <[email protected]>
2020-03-06 12:49:39 +01:00
Andy Scherzinger be4efdd8ce remove unneeded call
Signed-off-by: Andy Scherzinger <[email protected]>
2020-03-06 12:49:38 +01:00
Andy Scherzinger 37cc49b2d0 use correct dimens id
Signed-off-by: Andy Scherzinger <[email protected]>
2020-03-06 12:49:38 +01:00
Andy Scherzinger 3cfec4e0ba remove sdk17 checks
Signed-off-by: Andy Scherzinger <[email protected]>
2020-03-06 12:49:37 +01:00
tobiasKaminsky 7a6ae44d77 Remove outdated right/left as now only start/end is needed
Signed-off-by: tobiasKaminsky <[email protected]>
2020-03-06 12:49:36 +01:00
Andy Scherzinger 4a6f5b2da7 change minimum supported Android version to 4.2
Signed-off-by: Andy Scherzinger <[email protected]>
2020-03-06 12:49:36 +01:00
Andy Scherzinger b960e9c9ba Merge pull request #5584 from nextcloud/dependabot/gradle/androidx.work-work-runtime-ktx-2.3.3
Bump work-runtime-ktx from 2.3.2 to 2.3.3
2020-03-06 12:46:41 +01:00
Tobias Kaminsky 581c12a867 Merge pull request #5546 from nextcloud/ezaquarii/migrations-manager
Migrations manager
2020-03-06 12:25:23 +01:00
dependabot-preview[bot] 4a957714ea Bump work-runtime-ktx from 2.3.2 to 2.3.3
Bumps work-runtime-ktx from 2.3.2 to 2.3.3.

Signed-off-by: dependabot-preview[bot] <[email protected]>
2020-03-06 11:06:50 +00:00
Andy Scherzinger 232c801c9f Merge pull request #5569 from nextcloud/removeUnusedClass
remove unused class
2020-03-06 12:03:37 +01:00
Andy Scherzinger 11aa3e1575 master is at 94 lint warnings
Signed-off-by: Andy Scherzinger <[email protected]>
2020-03-06 11:10:30 +01:00
tobiasKaminsky 5872a973a7 Bump after rebase
Signed-off-by: tobiasKaminsky <[email protected]>
2020-03-06 10:36:10 +01:00
Chris Narkiewicz 1ba288e5e6 Properly signal error when user id migration fails
Previous implementation was returning success status
when *any* account was migrated, despite possible
failures.

Return error when any account fails to be migrated.

The migration remines idempotent and can be re-run
again, until if finally succeeds.

Signed-off-by: Chris Narkiewicz <[email protected]>
2020-03-06 10:35:57 +01:00
Chris Narkiewicz 9ef27576e1 Enabled migration manager in MainApp
Migration manager added to DI.

Migration manager called in place of legacy migration code.

Signed-off-by: Chris Narkiewicz <[email protected]>
2020-03-06 10:35:57 +01:00
Chris Narkiewicz 439dd4ff78 Removed MigrationManager Robolectric tests
Robolectric tests are removed as we don't want to emulate
platform.

Renamed instrumentation tests to match expected naming.

Updated detekt rule to allow human readable test function
names in kt files. This naming convention was adopted in
test code to enable human-readable test reports, but
DEX does not support spaces in names. Underscore _ is
a good replacement providnig similar level of readability.

Signed-off-by: Chris Narkiewicz <[email protected]>
2020-03-06 10:35:57 +01:00
Chris Narkiewicz 1ab8d98d85 Support for optional migrations
Optional migrations care not causing migration failure
and can be applied again on next application run.

Signed-off-by: Chris Narkiewicz <[email protected]>
2020-03-06 10:35:57 +01:00
Chris Narkiewicz b87bf1f10e Migrations manager
Signed-off-by: Chris Narkiewicz <[email protected]>
2020-03-06 10:35:56 +01:00
Andy Scherzinger 98e4acc75a remove ununsed raw files
Signed-off-by: Andy Scherzinger <[email protected]>
2020-03-06 09:59:35 +01:00
tobiasKaminsky 793dd901a2 remove unused class
Signed-off-by: tobiasKaminsky <[email protected]>
2020-03-06 09:59:34 +01:00
Nextcloud bot b4a6ce98c1 [tx-robot] updated from transifex 2020-03-06 03:31:35 +00:00
Tobias Kaminsky d19e9e0556 daily dev 20200306
Fix test
Update Nextcloud Android library
Update 3rd-party dependencies
2020-03-06 03:41:32 +01:00
Tobias Kaminsky 56d7169ca2 Merge remote-tracking branch 'origin/master' into dev 2020-03-06 03:32:20 +01:00
Tobias Kaminsky 2061207e25 Merge pull request #5531 from nextcloud/fix/AS36
Update to Android Studio 3.6
2020-03-05 09:58:46 +01:00
Tobias Kaminsky bac4e9b854 Merge pull request #5582 from nextcloud/dependabot/gradle/androidx.appcompat-appcompat-1.2.0-alpha03
Bump appcompat from 1.2.0-alpha02 to 1.2.0-alpha03
2020-03-05 08:50:22 +01:00
Tobias Kaminsky c00b13df12 Merge pull request #5491 from nextcloud/conflictDialog
Enhance conflict dialog
2020-03-05 08:40:07 +01:00
tobiasKaminsky 30ac72652e Fix test
Signed-off-by: tobiasKaminsky <[email protected]>
2020-03-05 08:22:58 +01:00
dependabot-preview[bot] dc01b2d5ab Merge pull request #5583 from nextcloud/dependabot/gradle/androidx.work-work-runtime-2.3.3 2020-03-05 07:11:55 +00:00
Tobias Kaminsky 3a77d8071d daily dev 20200305
update dev changelog recognition for updating library
Update translations
Update Nextcloud Android library
2020-03-05 07:27:09 +01:00
Tobias Kaminsky a65b208355 Merge remote-tracking branch 'origin/master' into dev 2020-03-05 07:19:03 +01:00
Nextcloud bot 4f47892823 [tx-robot] updated from transifex 2020-03-05 03:31:48 +00:00
Tobias Kaminsky 0f0173ccf3 Merge remote-tracking branch 'origin/master' into dev 2020-03-05 03:32:28 +01:00
dependabot-preview[bot] 9c10afa84e Bump work-runtime from 2.3.2 to 2.3.3
Bumps work-runtime from 2.3.2 to 2.3.3.

Signed-off-by: dependabot-preview[bot] <[email protected]>
2020-03-05 02:13:15 +00:00
dependabot-preview[bot] ca6a4e39c2 Bump appcompat from 1.2.0-alpha02 to 1.2.0-alpha03
Bumps appcompat from 1.2.0-alpha02 to 1.2.0-alpha03.

Signed-off-by: dependabot-preview[bot] <[email protected]>
2020-03-05 02:12:42 +00:00
Andy Scherzinger 4d231841d0 Merge pull request #5575 from nextcloud/devLibraryChange
update dev changelog recognition for updating library
2020-03-04 11:11:01 +01:00
Andy Scherzinger 7e595f713c Merge pull request #5574 from nextcloud/dependabot/gradle/kotlin_version-1.3.70
Bump kotlin_version from 1.3.61 to 1.3.70
2020-03-04 11:10:25 +01:00
tobiasKaminsky 185123c58f update dev changelog recognition for updating library
Signed-off-by: tobiasKaminsky <[email protected]>
2020-03-04 07:40:33 +01:00
Nextcloud bot 24f8bdbd29 [tx-robot] updated from transifex 2020-03-04 03:29:28 +00:00
Tobias Kaminsky 8c2c38d916 daily dev 20200304
switch back to light mode after test
remove unneeded strings
Disable old login method
Update Nextcloud Android library
2020-03-04 03:37:34 +01:00
Tobias Kaminsky 4f0bf90433 Merge remote-tracking branch 'origin/master' into dev 2020-03-04 03:30:48 +01:00
dependabot-preview[bot] f63502a8fa Bump kotlin_version from 1.3.61 to 1.3.70
Bumps `kotlin_version` from 1.3.61 to 1.3.70.

Updates `kotlin-gradle-plugin` from 1.3.61 to 1.3.70

Updates `kotlin-stdlib-jdk7` from 1.3.61 to 1.3.70
- [Release notes](https://github.com/JetBrains/kotlin/releases)
- [Changelog](https://github.com/JetBrains/kotlin/blob/v1.3.70/ChangeLog.md)
- [Commits](https://github.com/JetBrains/kotlin/compare/v1.3.61...v1.3.70)

Signed-off-by: dependabot-preview[bot] <[email protected]>
2020-03-04 02:14:04 +00:00
Andy Scherzinger 2ffb6dab5f Merge pull request #5566 from nextcloud/hideOldLogin
Disable old login method
2020-03-03 13:17:36 +01:00
tobiasKaminsky 7ca6f304ed Use proper dialog instantiation
Signed-off-by: tobiasKaminsky <[email protected]>
2020-03-03 10:31:04 +01:00
tobiasKaminsky b8c4c68275 Fixes during CR
Signed-off-by: tobiasKaminsky <[email protected]>
2020-03-03 10:31:03 +01:00
tobiasKaminsky 836e51fa79 Remove unneeded strings
Signed-off-by: tobiasKaminsky <[email protected]>
2020-03-03 10:31:03 +01:00
tobiasKaminsky 628e58e65e Fixe during CR
Signed-off-by: tobiasKaminsky <[email protected]>
2020-03-03 10:31:03 +01:00
tobiasKaminsky ae08a42f8a Enhance conflict dialog
- fix bug
- add ui tests
- add instrumented tests

Signed-off-by: tobiasKaminsky <[email protected]>
2020-03-03 10:31:03 +01:00
Tobias Kaminsky 3ae41ec9fa Merge pull request #5549 from endre-borcsok/bugfix/crash_in_activities
Fixed crash in Activities tab.
2020-03-03 10:30:21 +01:00
Tobias Kaminsky de7b7f5c06 Merge pull request #5345 from Charon77/deep_link
Allows deep linking to open files
2020-03-03 10:26:06 +01:00
Tobias Kaminsky 1e3c6d1080 Merge pull request #5537 from nextcloud/folderFileString
Split up share internal link
2020-03-03 09:45:22 +01:00
Tobias Kaminsky 3dde163c70 Merge pull request #5496 from nextcloud/fix/5232
properly colorize text preview gradient based on theme (day/night)
2020-03-03 09:44:37 +01:00
Andy Scherzinger b9df3de466 use app namespace instead of android
Signed-off-by: Andy Scherzinger <[email protected]>
2020-03-03 09:39:47 +01:00
tobiasKaminsky 01b1e719ff delombok everything
Signed-off-by: tobiasKaminsky <[email protected]>
2020-03-03 09:39:28 +01:00
Andy Scherzinger e5e4973c60 Update to AS 3.6.1
Signed-off-by: Andy Scherzinger <[email protected]>
2020-03-03 09:39:14 +01:00
Andy Scherzinger bd0d38227a Update to AS3.6
Signed-off-by: Andy Scherzinger <[email protected]>
2020-03-03 09:39:06 +01:00
tobiasKaminsky b9ea5d44ba switch back to light mode after test
Signed-off-by: tobiasKaminsky <[email protected]>
2020-03-03 08:52:32 +01:00
tobiasKaminsky daf3e9aebd remove unneeded strings
Signed-off-by: tobiasKaminsky <[email protected]>
2020-03-03 08:49:13 +01:00
tobiasKaminsky a341ebcc83 Disable old login method
Signed-off-by: tobiasKaminsky <[email protected]>
2020-03-03 08:32:16 +01:00
Tobias Kaminsky bd01843be7 daily dev 20200303
fix dev lib replacement
dev: change library before building
Show slideshow as new activity
Update translations
Update Nextcloud Android library
2020-03-03 07:35:01 +01:00
Tobias Kaminsky d5fe7679da Merge remote-tracking branch 'origin/master' into dev 2020-03-03 07:26:42 +01:00
Tobias Kaminsky 3ca46b9a19 Merge pull request #5564 from nextcloud/devLibrary2
fix dev lib replacement
2020-03-03 07:23:43 +01:00
tobiasKaminsky d8ada799f3 fix dev lib replacement
Signed-off-by: tobiasKaminsky <[email protected]>
2020-03-03 07:22:49 +01:00
Nextcloud bot cd794ab1c1 [tx-robot] updated from transifex 2020-03-03 03:31:11 +00:00
Tobias Kaminsky be11180ca9 Merge remote-tracking branch 'origin/master' into dev 2020-03-03 03:32:22 +01:00
Endre Borcsok bf7d33066b Fixed crash in Activities tab.
Replaced Toast.makeText() methods to DisplayUtils.showSnackMessage().

Signed-off-by: Endre Borcsok <[email protected]>
2020-03-02 20:49:53 +00:00
Tobias Kaminsky 40afe563f3 Merge pull request #5560 from nextcloud/devLibrary
dev: change library before building
2020-03-02 16:16:26 +01:00
tobiasKaminsky 391a9fe8e3 dev: change library before building
Signed-off-by: tobiasKaminsky <[email protected]>
2020-03-02 16:15:42 +01:00
Tobias Kaminsky 6d6d8898cd Merge pull request #5530 from nextcloud/better-dev-changelogs
Improve dev edition changelog generation
2020-03-02 16:13:21 +01:00
tobiasKaminsky 83b67b93ad Update english
Signed-off-by: tobiasKaminsky <[email protected]>
2020-03-02 15:52:54 +01:00
Nextcloud bot db8d3a5d18 [tx-robot] updated from transifex 2020-03-02 11:39:28 +00:00
Andy Scherzinger c578eccade Merge pull request #5557 from nextcloud/slideshow
Show slideshow as new activity
2020-03-02 11:17:59 +01:00
nextcloud-android-bot 059eb9176c Drone: update FindBugs results to reflect reduced error/warning count [skip ci]
Signed-off-by: nextcloud-android-bot <[email protected]>
2020-03-02 08:32:04 +00:00
tobiasKaminsky 4013c47b48 Show slideshow as new activity
Signed-off-by: tobiasKaminsky <[email protected]>
2020-03-02 08:45:33 +01:00
Tobias Kaminsky 9938f2e421 daily dev 20200228
3facd6c20 Merge remote-tracking branch 'origin/master' into dev
d88dac628 Merge pull request #5536 from nextcloud/changeFolderString
42d1dafaf Change to better english
43dfa7a77 Merge pull request #5528 from nextcloud/dependabot/gradle/io.gitlab.arturbosch.detekt-detekt-gradle-plugin-1.6.0
4481af43f Merge pull request #5529 from nextcloud/dependabot/gradle/org.mockito-mockito-core-3.3.1
36dbdf5f6 Merge pull request #5527 from nextcloud/dependabot/gradle/markwonVersion-4.2.2
cd893c685 Bump mockito-core from 3.3.0 to 3.3.1
8b14e8a8b Bump detekt-gradle-plugin from 1.5.1 to 1.6.0
82d0ad98d Bump markwonVersion from 4.2.1 to 4.2.2
eb94a66b2 [tx-robot] updated from transifex
543e25667 [tx-robot] updated from transifex
97c53b38c daily dev 20200225
2020-02-28 03:41:00 +01:00
Tobias Kaminsky 3facd6c200 Merge remote-tracking branch 'origin/master' into dev 2020-02-28 03:32:21 +01:00
tobiasKaminsky 78adcfb3d6 Split up share internal link
Signed-off-by: tobiasKaminsky <[email protected]>
2020-02-27 20:10:51 +01:00
Andy Scherzinger d88dac6284 Merge pull request #5536 from nextcloud/changeFolderString
Change to better english
2020-02-27 20:06:17 +01:00
tobiasKaminsky 42d1dafaff Change to better english
Signed-off-by: tobiasKaminsky <[email protected]>
2020-02-27 19:26:24 +01:00
AJ Jordan a6c95934cf Improve dev edition changelog generation
We:

* No longer include commit ids
* Exclude merges, individual Dependabot commits, commits including only
  non-user-facing changes, or version bump commits
* Collapse all Dependabot commits into a single "Update dependencies"
  changelog entry
* Do the same for Transifex updates, which get turned into a single
  "Update translations" changelog entry
* Say if the Android Nextcloud library has changed instead of including
  its commit id

The list of paths to ignore is probably incomplete, but it's easier to
just revisit this script over time and add to it as new contenders pop
up, rather than trying to find everything now.

Fixes #5525

Signed-off-by: AJ Jordan <[email protected]>
2020-02-27 10:04:34 -05:00
dependabot-preview[bot] 43dfa7a779 Merge pull request #5528 from nextcloud/dependabot/gradle/io.gitlab.arturbosch.detekt-detekt-gradle-plugin-1.6.0 2020-02-27 07:08:36 +00:00
dependabot-preview[bot] 4481af43fc Merge pull request #5529 from nextcloud/dependabot/gradle/org.mockito-mockito-core-3.3.1 2020-02-27 07:06:23 +00:00
dependabot-preview[bot] 36dbdf5f6e Merge pull request #5527 from nextcloud/dependabot/gradle/markwonVersion-4.2.2 2020-02-27 06:59:46 +00:00
dependabot-preview[bot] cd893c685b Bump mockito-core from 3.3.0 to 3.3.1
Bumps [mockito-core](https://github.com/mockito/mockito) from 3.3.0 to 3.3.1.
- [Release notes](https://github.com/mockito/mockito/releases)
- [Commits](https://github.com/mockito/mockito/compare/v3.3.0...v3.3.1)

Signed-off-by: dependabot-preview[bot] <[email protected]>
2020-02-27 02:14:16 +00:00
dependabot-preview[bot] 8b14e8a8bc Bump detekt-gradle-plugin from 1.5.1 to 1.6.0
Bumps detekt-gradle-plugin from 1.5.1 to 1.6.0.

Signed-off-by: dependabot-preview[bot] <[email protected]>
2020-02-27 02:13:46 +00:00
dependabot-preview[bot] 82d0ad98d7 Bump markwonVersion from 4.2.1 to 4.2.2
Bumps `markwonVersion` from 4.2.1 to 4.2.2.

Updates `core` from 4.2.1 to 4.2.2
- [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.1...v4.2.2)

Updates `ext-strikethrough` from 4.2.1 to 4.2.2
- [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.1...v4.2.2)

Updates `ext-tables` from 4.2.1 to 4.2.2
- [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.1...v4.2.2)

Updates `ext-tasklist` from 4.2.1 to 4.2.2
- [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.1...v4.2.2)

Updates `html` from 4.2.1 to 4.2.2
- [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.1...v4.2.2)

Updates `syntax-highlight` from 4.2.1 to 4.2.2
- [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.1...v4.2.2)

Signed-off-by: dependabot-preview[bot] <[email protected]>
2020-02-27 02:13:15 +00:00
Evans Jahja 0467cc37ca Allows deep linking to open files
Signed-off-by: Evans Jahja <[email protected]>
2020-02-26 21:26:48 +07:00
Nextcloud bot eb94a66b2f [tx-robot] updated from transifex 2020-02-26 03:31:45 +00:00
Nextcloud bot 543e25667a [tx-robot] updated from transifex 2020-02-25 03:37:04 +00:00
Tobias Kaminsky 97c53b38ce daily dev 20200225
d7febee4f Merge remote-tracking branch 'origin/master' into dev
a163321fa Merge pull request #5511 from nextcloud/dependabot/gradle/org.mockito-mockito-core-3.3.0
6ab91c959 [tx-robot] updated from transifex
68d6fe555 daily dev 20200224
2020-02-25 03:39:00 +01:00
Tobias Kaminsky d7febee4fa Merge remote-tracking branch 'origin/master' into dev 2020-02-25 03:32:22 +01:00
dependabot-preview[bot] a163321fa1 Merge pull request #5511 from nextcloud/dependabot/gradle/org.mockito-mockito-core-3.3.0 2020-02-24 08:30:24 +00:00
Nextcloud bot 6ab91c959e [tx-robot] updated from transifex 2020-02-24 03:33:24 +00:00
Tobias Kaminsky 68d6fe5557 daily dev 20200224
f782e3d9f Merge remote-tracking branch 'origin/master' into dev
c6bb9744e Merge pull request #5498 from nextcloud/stableMaterial
0b90250b6 [tx-robot] updated from transifex
7b049a99d [tx-robot] updated from transifex
70471b623 [tx-robot] updated from transifex
bdaaf63fc [tx-robot] updated from transifex
1cc383df2 daily dev 20200222
2020-02-24 03:37:29 +01:00
Tobias Kaminsky f782e3d9fd Merge remote-tracking branch 'origin/master' into dev 2020-02-24 03:30:48 +01:00
dependabot-preview[bot] aed8a1ade0 Bump mockito-core from 3.2.4 to 3.3.0
Bumps [mockito-core](https://github.com/mockito/mockito) from 3.2.4 to 3.3.0.
- [Release notes](https://github.com/mockito/mockito/releases)
- [Commits](https://github.com/mockito/mockito/compare/v3.2.4...v3.3.0)

Signed-off-by: dependabot-preview[bot] <[email protected]>
2020-02-24 02:14:20 +00:00
Andy Scherzinger c6bb9744ee Merge pull request #5498 from nextcloud/stableMaterial
Bump material manuelly to 1.1.0, after that dependabot should be on track again
2020-02-23 21:39:10 +01:00
Nextcloud bot 0b90250b69 [tx-robot] updated from transifex 2020-02-23 03:35:10 +00:00
Nextcloud bot 7b049a99d0 [tx-robot] updated from transifex 2020-02-23 03:33:40 +00:00
Nextcloud bot 70471b6233 [tx-robot] updated from transifex 2020-02-22 03:34:29 +00:00
Nextcloud bot bdaaf63fc3 [tx-robot] updated from transifex 2020-02-22 03:32:58 +00:00
Tobias Kaminsky 1cc383df2a daily dev 20200222
84cef3baf Merge remote-tracking branch 'origin/master' into dev
e1b8d525e Merge pull request #5445 from nextcloud/headMethod
92f5e07b9 [tx-robot] updated from transifex
de4fc2cd2 daily dev 20200221
2020-02-22 03:37:31 +01:00
Tobias Kaminsky 84cef3bafc Merge remote-tracking branch 'origin/master' into dev 2020-02-22 03:30:46 +01:00
tobiasKaminsky ecd5379646 Add screenshot tests
Signed-off-by: tobiasKaminsky <[email protected]>
2020-02-21 19:40:43 +01:00
tobiasKaminsky 5969d0a6eb Bump material manuelly to 1.1.0, after that dependabot should be on track again
Signed-off-by: tobiasKaminsky <[email protected]>
2020-02-21 08:42:32 +01:00
Tobias Kaminsky e1b8d525e5 Merge pull request #5445 from nextcloud/headMethod
add HEAD Method support for SSO
2020-02-21 08:37:16 +01:00
Nextcloud bot 92f5e07b9f [tx-robot] updated from transifex 2020-02-21 03:33:33 +00:00
Tobias Kaminsky de4fc2cd2b daily dev 20200221
9b3f00c12 Merge remote-tracking branch 'origin/master' into dev
da6a29a51 Merge pull request #5493 from nextcloud/dependabot/gradle/androidx.work-work-runtime-ktx-2.3.2
2356e839d Bump work-runtime-ktx from 2.3.1 to 2.3.2
7305272bd Merge pull request #5494 from nextcloud/dependabot/gradle/androidx.work-work-runtime-2.3.2
be238a3f9 Merge pull request #5471 from nextcloud/richWorkspace18only
65548c4b4 [tx-robot] updated from transifex
ac6a64b67 Drone: update Lint results to reflect reduced error/warning count [skip ci]
993aa4afb Bump work-runtime from 2.3.0 to 2.3.2
0f1da5238 [tx-robot] updated from transifex
26bbfa353 daily dev 20200219
2020-02-21 03:37:48 +01:00
Tobias Kaminsky 9b3f00c12d Merge remote-tracking branch 'origin/master' into dev 2020-02-21 03:30:48 +01:00
Andy Scherzinger 3ec795f0bf properly colorize text preview gradient based on theme (day/night)
improve preview textview size/gradient position

Fixes #5232

Signed-off-by: Andy Scherzinger <[email protected]>
2020-02-20 18:30:59 +01:00
dependabot-preview[bot] da6a29a51e Merge pull request #5493 from nextcloud/dependabot/gradle/androidx.work-work-runtime-ktx-2.3.2 2020-02-20 09:05:39 +00:00
dependabot-preview[bot] 2356e839d3 Bump work-runtime-ktx from 2.3.1 to 2.3.2
Bumps work-runtime-ktx from 2.3.1 to 2.3.2.

Signed-off-by: dependabot-preview[bot] <[email protected]>
2020-02-20 07:43:07 +00:00
dependabot-preview[bot] 7305272bda Merge pull request #5494 from nextcloud/dependabot/gradle/androidx.work-work-runtime-2.3.2 2020-02-20 06:51:33 +00:00
Tobias Kaminsky be238a3f96 Merge pull request #5471 from nextcloud/richWorkspace18only
Show "add folder info" only if text app is available
2020-02-20 07:49:47 +01:00
Nextcloud bot 65548c4b4b [tx-robot] updated from transifex 2020-02-20 03:32:12 +00:00
nextcloud-android-bot ac6a64b672 Drone: update Lint results to reflect reduced error/warning count [skip ci]
Signed-off-by: nextcloud-android-bot <[email protected]>
2020-02-20 02:25:48 +00:00
dependabot-preview[bot] 993aa4afb2 Bump work-runtime from 2.3.0 to 2.3.2
Bumps work-runtime from 2.3.0 to 2.3.2.

Signed-off-by: dependabot-preview[bot] <[email protected]>
2020-02-20 02:12:17 +00:00
Nextcloud bot 0f1da5238b [tx-robot] updated from transifex 2020-02-19 03:29:10 +00:00
Tobias Kaminsky 26bbfa3538 daily dev 20200219
3f62afabf Merge remote-tracking branch 'origin/master' into dev
5d428fe9a Merge pull request #4788 from nextcloud/instantupload_all
49f3a6725 ConflictsResolveActivity: code style and readability improvements
6540e3ef7 Upload list conflicts: replace trash icon with menu and add resolve action
a4ff1f11d Customize upload sync conflict notification strings
e77ffa00a Fix synced folder layout form control widgets alignment
91ef307e7 Fix database migration of field forceOverwrite to NameCollisionPolicy
52d089b18 FileUploader: fix codacy issues and SpotBugs
ec27f840a FileUploader: code cleanup
7713a28a4 FileUploader: require explicit NameCollisionPolicy and change default used value
6783e8ab4 Make file uploads ask the user what to do when the file already exists on remote
213002f44 Make newly created synced folders auto upload existing files by default
1b7bd72c4 ADD: [instantupload] setting to also upload existing files
c24345316 Merge pull request #5465 from nextcloud/fix/create-folder-crash-autosync
d178cde22 daily dev 20200218
2020-02-19 03:37:25 +01:00
Tobias Kaminsky 3f62afabf6 Merge remote-tracking branch 'origin/master' into dev 2020-02-19 03:30:48 +01: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
Tobias Kaminsky d178cde220 daily dev 20200218
2b26a5176 Merge remote-tracking branch 'origin/master' into dev
4616b0d40 Merge pull request #5447 from nextcloud/ezaquarii/migrate-jobs-to-new-user-model
20b910a64 Merge pull request #5442 from nextcloud/ezaquarii/fix-crash-on-text-file-creation
0977c3791 Fix crash during text file creation
5c74f2b1b [tx-robot] updated from transifex
27fabe745 [tx-robot] updated from transifex
60295480b daily dev 20200215
2020-02-18 03:37:38 +01:00
Tobias Kaminsky 2b26a5176a Merge remote-tracking branch 'origin/master' into dev 2020-02-18 03:30:49 +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
Tobias Kaminsky 60295480b5 daily dev 20200215
020e5a2c3 Merge remote-tracking branch 'origin/master' into dev
490b292ad Merge pull request #5300 from nextcloud/sharedSearchAgain
61027524f test
af93382c6 test
68f06ea15 [tx-robot] updated from transifex
2d82f80e9 daily dev 20200214
2020-02-15 03:37:26 +01:00
Tobias Kaminsky 020e5a2c3b Merge remote-tracking branch 'origin/master' into dev 2020-02-15 03:30:49 +01: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 87df2c8e1c Show "add folder info" only if text app is available
Signed-off-by: tobiasKaminsky <[email protected]>
2020-02-14 10:31:23 +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
Tobias Kaminsky 2d82f80e9c daily dev 20200214
706ae93a3 Merge remote-tracking branch 'origin/master' into dev
045a7aa9e Merge pull request #5466 from nextcloud/squareIcon
eefeda930 Add square google icon
7156aaff2 [tx-robot] updated from transifex
57ce989a5 daily dev 20200213
2020-02-14 03:38:38 +01:00
Tobias Kaminsky 706ae93a32 Merge remote-tracking branch 'origin/master' into dev 2020-02-14 03:31:56 +01: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
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
tobiasKaminsky ebcbf0afac add HEAD Method support for SSO
Signed-off-by: tobiasKaminsky <[email protected]>
2020-02-10 11:56:45 +01:00
418 changed files with 12228 additions and 5968 deletions

No files matched your search

+26 -1
View File
@@ -1,4 +1,5 @@
kind: pipeline
type: docker
name: generic
steps:
@@ -48,6 +49,7 @@ trigger:
---
kind: pipeline
type: docker
name: gplay
steps:
@@ -102,7 +104,28 @@ 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"
- su www-data -c "git clone -b master https://github.com/nextcloud/circles.git /var/www/html/apps/circles/"
- apt-get update; apt-get -y install composer
- su www-data -c "cd /var/www/html/apps/circles; composer install"
- su www-data -c "php /var/www/html/occ app:enable -f circles"
- su www-data -c "php /var/www/html/occ config:app:set circles --value 1 allow_non_ssl_links"
- su www-data -c "php /var/www/html/occ config:app:set circles --value 1 local_is_non_ssl"
- su www-data -c "php /var/www/html/occ circles:manage:create test public publicCircle"
- /usr/local/bin/run.sh
trigger:
branch:
@@ -112,6 +135,7 @@ trigger:
- pull_request
---
kind: pipeline
type: docker
name: analysis
steps:
@@ -161,6 +185,7 @@ trigger:
- pull_request
---
kind: pipeline
type: docker
name: qa
steps:
+7
View File
@@ -16,6 +16,11 @@ labels: bug
### Actual behaviour
- Tell us what happens
### Can you reproduce this problem on https://try.nextcloud.com?
- Please create a test demo account and see if this still happens there.
- If yes, please open up a bug report
- If not, please verify server setup and ask for help on forum
### Environment data
Android version:
@@ -27,6 +32,8 @@ Nextcloud app version:
Nextcloud server version:
Reverse proxy:
### Logs
#### Web server error log
```
+5 -4
View File
@@ -1,8 +1,9 @@
### 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)
[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)
- [ ] Tests written, or not not needed
+6 -8
View File
@@ -2,19 +2,17 @@
daysUntilStale: 28
# Number of days of inactivity before a stale issue is closed
daysUntilClose: 14
# Only issues or pull requests with all of these labels are check if stale. Defaults to `[]` (disabled)
onlyLabels:
- bug
- "needs info/discussion"
# Issues with these labels will never be considered stale
exemptLabels:
- 1. developing
- 2. to review
- 3. to release
- approved
- enhancement
- overview
exemptLabels: []
# Label to use when marking an issue as stale
staleLabel: stale
# Comment to post when marking an issue as stale. Set to `false` to disable
markComment: >
This request did not receive an update in the last 4 weeks.
This bug report did not receive an update in the last 4 weeks.
Please take a look again and update the issue with new details,
otherwise the issue will be automatically closed in 2 weeks. Thank you!
# Comment to post when closing a stale issue. Set to `false` to disable
@@ -0,0 +1,10 @@
name: "Validate Gradle Wrapper"
on: [push, pull_request]
jobs:
validation:
name: "Validation"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: gradle/wrapper-validation-action@v1
+7 -3
View File
@@ -29,9 +29,6 @@
</option>
<option name="RIGHT_MARGIN" value="120" />
<option name="WRAP_WHEN_TYPING_REACHES_RIGHT_MARGIN" value="true" />
<AndroidXmlCodeStyleSettings>
<option name="ARRANGEMENT_SETTINGS_MIGRATED_TO_191" value="true" />
</AndroidXmlCodeStyleSettings>
<JavaCodeStyleSettings>
<option name="IMPORT_LAYOUT_TABLE">
<value>
@@ -73,6 +70,7 @@
</XML>
<codeStyleSettings language="JAVA">
<option name="ALIGN_MULTILINE_PARAMETERS_IN_CALLS" value="true" />
<option name="ALIGN_MULTILINE_METHOD_BRACKETS" value="true" />
<option name="WRAP_COMMENTS" value="true" />
<option name="IF_BRACE_FORCE" value="3" />
<option name="DOWHILE_BRACE_FORCE" value="3" />
@@ -80,6 +78,9 @@
<option name="FOR_BRACE_FORCE" value="3" />
<option name="FIELD_ANNOTATION_WRAP" value="0" />
</codeStyleSettings>
<codeStyleSettings language="Markdown">
<option name="RIGHT_MARGIN" value="120" />
</codeStyleSettings>
<codeStyleSettings language="XML">
<indentOptions>
<option name="CONTINUATION_INDENT_SIZE" value="4" />
@@ -192,5 +193,8 @@
</rules>
</arrangement>
</codeStyleSettings>
<codeStyleSettings language="kotlin">
<option name="ALIGN_MULTILINE_METHOD_BRACKETS" value="true" />
</codeStyleSettings>
</code_scheme>
</component>
+11
View File
@@ -1,3 +1,14 @@
## 3.11.0 (March, 26, 2020)
- not enough space dialog @Shagequi
- fix shared search
- upload existing images in auto upload @koying @ArisuOngaku
- allow deep links @Charon77
- support for circle
- last version supporting Android 4.1
For a full list, please see https://github.com/nextcloud/android/milestone/41
## 3.10.1 (February, 05, 2020)
- fix crash on self-signed certificates
+11 -6
View File
@@ -72,6 +72,7 @@ If your issue appears to be a bug, and hasn't been reported, open a new issue.
### Bug workflow
Every bug should be triaged in approved/needs info in a given time.
* approved: at least one other is able to reproduce it
* needs info: something unclear, or not able to reproduce
* if no response within 1 months, bug will be closed
@@ -277,17 +278,21 @@ We use [shot](https://github.com/Karumi/Shot) for taking screenshots and compare
- 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,
@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();
```
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
+30 -26
View File
@@ -7,7 +7,7 @@
import com.github.spotbugs.SpotBugsTask
buildscript {
ext.kotlin_version = '1.3.61'
ext.kotlin_version = '1.3.72'
repositories {
google()
jcenter()
@@ -20,13 +20,13 @@ buildscript {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.3'
classpath 'com.android.tools.build:gradle:3.6.3'
classpath('com.dicedmelon.gradle:jacoco-android:0.1.4') {
exclude group: 'org.codehaus.groovy', module: 'groovy-all'
}
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.5.1"
classpath "io.gitlab.arturbosch.detekt:detekt-gradle-plugin:1.8.0"
classpath "commons-httpclient:commons-httpclient:3.1@jar" // remove after entire switch to lib v2
classpath 'com.karumi:shot:3.1.0'
}
@@ -60,10 +60,10 @@ configurations {
ext {
jacocoVersion = "0.8.2"
daggerVersion = "2.26"
markwonVersion = "4.2.1"
daggerVersion = "2.27"
markwonVersion = "4.3.1"
prismVersion = "2.0.0"
androidLibraryVersion ="721c01bc369955139daf218377c081d05c82f317"
androidLibraryVersion ="cc78c5da33b65f787e3a6ac87bb69dc3e5114270"
travisBuild = System.getenv("TRAVIS") == "true"
@@ -84,7 +84,7 @@ repositories {
// semantic versioning for version code
def versionMajor = 3
def versionMinor = 11
def versionMinor = 12
def versionPatch = 0
def versionBuild = 0 // 0-50=Alpha / 51-98=RC / 90-99=stable
@@ -129,7 +129,7 @@ android {
compileSdkVersion 29
defaultConfig {
minSdkVersion 16
minSdkVersion 17
targetSdkVersion 29
// arguments to be passed to functional tests
@@ -177,8 +177,8 @@ android {
versionDev {
applicationId "com.nextcloud.android.beta"
dimension "default"
versionCode 20200213
versionName "20200213"
versionCode 20200422
versionName "20200422"
}
qa {
@@ -191,6 +191,7 @@ android {
testOptions {
unitTests.returnDefaultValues = true
// comment out if you run androidTests in Android Studio experiencing test runner crashes
execution 'ANDROIDX_TEST_ORCHESTRATOR'
animationsDisabled true
}
@@ -274,6 +275,10 @@ android {
dataBinding {
enabled true
}
viewBinding {
enabled true
}
}
dependencies {
@@ -289,14 +294,14 @@ 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-rc02'
implementation 'com.google.android.material:material:1.1.0'
implementation 'com.jakewharton:disklrucache:2.0.2'
implementation 'androidx.appcompat:appcompat:1.2.0-alpha02'
implementation 'androidx.appcompat:appcompat:1.2.0-beta01'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'androidx.exifinterface:exifinterface:1.1.0'
implementation 'androidx.exifinterface:exifinterface:1.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 "androidx.work:work-runtime:2.3.4"
implementation "androidx.work:work-runtime-ktx:2.3.4"
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'
@@ -304,13 +309,13 @@ dependencies {
implementation 'com.jakewharton:butterknife:10.2.1'
kapt 'com.jakewharton:butterknife-compiler:10.2.1'
implementation 'org.greenrobot:eventbus:3.2.0'
implementation 'com.googlecode.ez-vcard:ez-vcard:0.10.5'
implementation 'com.googlecode.ez-vcard:ez-vcard:0.10.6'
implementation 'org.lukhnos:nnio:0.2'
implementation 'com.madgag.spongycastle:pkix:1.54.0.0'
implementation 'com.google.code.gson:gson:2.8.6'
implementation 'com.afollestad:sectioned-recyclerview:0.5.0'
implementation 'com.github.chrisbanes:PhotoView:2.3.0'
implementation 'pl.droidsonroids.gif:android-gif-drawable:1.2.15'
implementation 'pl.droidsonroids.gif:android-gif-drawable:1.2.19'
implementation 'com.github.tobiaskaminsky:qrcodescanner:0.1.2.2' // 'com.github.blikoon:QRCodeScanner:0.1.2'
implementation 'com.google.android:flexbox:2.0.1'
implementation 'org.parceler:parceler-api:1.1.13'
@@ -333,11 +338,8 @@ dependencies {
kapt "com.google.dagger:dagger-compiler:$daggerVersion"
kapt "com.google.dagger:dagger-android-processor:$daggerVersion"
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'
implementation 'org.conscrypt:conscrypt-android:2.4.0'
// dependencies for markdown rendering
implementation "io.noties.markwon:core:$markwonVersion"
@@ -352,11 +354,11 @@ dependencies {
// dependencies for local unit tests
testImplementation 'junit:junit:4.13'
testImplementation 'org.mockito:mockito-core:3.2.4'
testImplementation 'org.mockito:mockito-core:3.3.3'
testImplementation 'androidx.test:core:1.2.0'
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.powermock:powermock-core:2.0.7'
testImplementation 'org.powermock:powermock-module-junit4:2.0.7'
testImplementation 'org.powermock:powermock-api-mockito2:2.0.7'
testImplementation 'org.json:json:20190722'
testImplementation "com.nhaarman.mockitokotlin2:mockito-kotlin:2.2.0"
testImplementation "androidx.arch.core:core-testing:2.1.0"
@@ -372,7 +374,7 @@ dependencies {
// Espresso core
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
androidTestImplementation 'androidx.test.espresso:espresso-contrib:3.2.0'
androidTestImplementation 'org.mockito:mockito-core:3.2.4'
androidTestImplementation 'org.mockito:mockito-core:3.3.1'
// UIAutomator - for cross-app UI tests, and to grant screen is turned on in Espresso tests
// androidTestImplementation 'androidx.test.uiautomator:uiautomator:2.2.0'
// fix conflict in dependencies; see http://g.co/androidstudio/app-test-app-conflict for details
@@ -390,6 +392,8 @@ dependencies {
// androidJacocoAnt "org.jacoco:org.jacoco.agent:${jacocoVersion}"
implementation "com.github.stateless4j:stateless4j:2.6.0"
androidTestImplementation "com.nhaarman.mockitokotlin2:mockito-kotlin:2.2.0"
androidTestImplementation "org.mockito:mockito-android:3.3.3"
}
configurations.all {
+1
View File
@@ -265,6 +265,7 @@ naming:
functionPattern: '^([a-z$][a-zA-Z$0-9]*)|(`.*`)$'
excludeClassPattern: '$^'
ignoreOverridden: true
excludes: "**/*Test.kt"
FunctionParameterNaming:
active: true
parameterPattern: '[a-z][A-Za-z0-9]*'
+11 -1
View File
@@ -1 +1,11 @@
<svg xmlns="http://www.w3.org/2000/svg" height="16" viewBox="0 0 16 16" width="16" version="1.1"><path fill="#dc5047" d="m2.5 1c-0.28 0-0.5 0.22-0.5 0.5v13c0 0.28 0.22 0.5 0.5 0.5h11c0.28 0 0.5-0.22 0.5-0.5v-10.5l-3-3zm5.8 3.9s0.07 0.95-0.15 2.3c0.715 2.053 1.5 2.33 1.85 2.5 0.74-0.06 1.565-0.1 2.3 0.3 0.5 0.286 0.894 1.5-0.3 1.5-0.54-0.034-1.537-0.346-2.25-0.7-1.066 0.12-2.39 0.32-3.5 0.8-1.25 2.1-1.81 2.4-2.25 2.4-1.215-0.32-0.56-1.93-0.1-2.2 0.55-0.47 1.195-0.74 1.4-0.8 0.09-0.15 1.384-2.69 1.7-3.75-0.3-1.024-0.37-2.106-0.2-2.75 0.78-1.018 1.5-0.35 1.5 0.4zm-0.7 3.1c-0.27 1.057-1.348 3.084-1.3 3 1.105-0.485 2.1-0.63 3.2-0.8-0.526-0.235-1.146-0.25-1.9-2.2z"/></svg>
<svg width="16" height="16" version="1.1" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg">
<path d="m2.5 1c-0.28 0-0.5 0.22-0.5 0.5v13c0 0.28 0.22 0.5 0.5 0.5h11c0.28 0 0.5-0.22 0.5-0.5v-10.5l-3-3z"
fill="#dc5047" />
<g fill="#fff" aria-label="PDF">
<path
d="m4.9093 8.443v1.057h-0.61813v-3h1.1703q0.33791 0 0.59341 0.12363 0.25755 0.12363 0.3956 0.35234 0.13805 0.22665 0.13805 0.51717 0 0.44093-0.30288 0.69643-0.30082 0.25343-0.83448 0.25343zm0-0.50069h0.5522q0.24519 0 0.37294-0.11538 0.12981-0.11538 0.12981-0.32967 0-0.22047-0.12981-0.35646t-0.35852-0.14011h-0.56662z" />
<path
d="m7.011 9.5v-3h0.92308q0.3956 0 0.70673 0.17926 0.31319 0.1772 0.48832 0.50687 0.17514 0.32761 0.17514 0.74588v0.13805q0 0.41827-0.17308 0.74382-0.17102 0.32555-0.4842 0.50481-0.31319 0.17926-0.70673 0.18132zm0.61813-2.4993v2.0027h0.29876q0.36264 0 0.55426-0.23695 0.19162-0.23695 0.19574-0.67788v-0.15865q0-0.45742-0.18956-0.69231-0.18956-0.23695-0.55426-0.23695z" />
<path d="m11.56 8.274h-1.1868v1.226h-0.61813v-3h1.9533v0.50069h-1.3352v0.77473h1.1868z" />
</g>
</svg>

Before

Width:  |  Height:  |  Size: 676 B

After

Width:  |  Height:  |  Size: 1.1 KiB

+27
View File
@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" viewBox="0 0 57 57" width="64" height="64"
version="1.1" id="svg10" sodipodi:docname="circles.svg" inkscape:version="0.92.4 5da689c313, 2019-01-14">
<metadata id="metadata16">
<rdf:RDF>
<cc:Work rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
</cc:Work>
</rdf:RDF>
</metadata>
<defs id="defs14" />
<sodipodi:namedview pagecolor="#ffffff" bordercolor="#666666" borderopacity="1" objecttolerance="10"
gridtolerance="10" guidetolerance="10" inkscape:pageopacity="0" inkscape:pageshadow="2"
inkscape:window-width="1920" inkscape:window-height="1141" id="namedview12" showgrid="false"
inkscape:zoom="7.375" inkscape:cx="33.445579" inkscape:cy="41.701636" inkscape:window-x="0"
inkscape:window-y="0" inkscape:window-maximized="1" inkscape:current-layer="svg10" />
<path d="M7.1 28.5A21.4 21.4 0 0 1 28.5 7.1m10.7 40A21.4 21.4 0 0 1 10 39M39.2 10A21.4 21.4 0 0 1 47 39.2"
fill="none" stroke="#fff" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" id="path2"
style="stroke:#000000;stroke-opacity:1;stroke-width:3.99979687;stroke-miterlimit:4;stroke-dasharray:none;fill:none;fill-opacity:1" />
<circle cx="28.5" cy="7.1" r="6.5" fill="#fff" id="circle4" style="fill:#000000" />
<circle cx="39.2" cy="-10" r="6.5" transform="rotate(90)" fill="#fff" id="circle6" style="fill:#000000" />
<circle cx="39.2" cy="-47" r="6.5" transform="rotate(90)" fill="#fff" id="circle8" style="fill:#000000" />
</svg>

After

Width:  |  Height:  |  Size: 2.0 KiB

+1 -1
View File
@@ -1,3 +1,3 @@
dependencies {
implementation "com.google.firebase:firebase-messaging:17.3.0"
implementation "com.google.firebase:firebase-messaging:20.1.3"
}
+1 -1
View File
@@ -5,7 +5,7 @@
<ignore regexp="autofillHints"/>
</issue>
<issue id="InvalidPackage">
<ignore path="**/freemarker-2.3.28.jar" />
<ignore path="**/freemarker-2.*.*.jar" />
<ignore path="**/nnio-0.2.jar"/>
<ignore path="**/pkix-1.54.0.0.jar"/>
</issue>
Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

+1 -1
View File
@@ -1 +1 @@
387
384
+1 -1
View File
@@ -1,2 +1,2 @@
DO NOT TOUCH; GENERATED BY DRONE
<span class="mdl-layout-title">Lint Report: 77 warnings</span>
<span class="mdl-layout-title">Lint Report: 1 error and 94 warnings</span>
+28 -7
View File
@@ -1,10 +1,15 @@
#!/bin/bash
date=$(date +%Y%m%d)
oldLibraryCommit=$(grep "androidLibraryVersion\ =" build.gradle)
libraryCommit=$(curl https://api.github.com/repos/nextcloud/android-library/commits/master | jq .sha | sed s'/\"//g')
# use current date for version code/name
sed -i "/versionDev/,/\}/ s/versionCode .*/versionCode $date/" build.gradle
sed -i "/versionDev/,/\}/ s/versionName .*/versionName \"$date\"/" build.gradle
# change library
sed -i s"#androidLibraryVersion\ =.*#androidLibraryVersion =\"$libraryCommit\"#" build.gradle
# build signed apk
./gradlew assembleVersionDevRelease >> /tmp/dev.log 2>&1
@@ -32,17 +37,33 @@ mv latest.apk ~/apks/
# remove all but the latest 5 apks
/bin/ls -t ~/apks/*.apk | awk 'NR>6' | xargs rm -f
lastBuildTime=$(date --date="$(git log -1 --format=%ai $(git tag | grep dev | tail -n1))" +%s)
changelog=$(git log --after=$lastBuildTime --pretty=oneline --abbrev-commit)
lastBuildTag=$(git tag | grep dev | tail -n1)
# Show only the commit subject in the changelog and filter out:
# * Merges
# * Dependabot commits
# * Commits touching only non-user-facing stuff like tests
# * Version bump commits
# * Anything reachable from the previous dev edition tag
changelog=$(git log --no-merges --invert-grep --author=dependabot --pretty='format:%s' HEAD "^$lastBuildTag" -- ':!src/androidTest' ':!.*' ':!scripts/' ':!screenshots' ':!CHANGELOG.md' | grep -vE '^daily dev [[:digit:]]{8}$')
# Make Transifex updates have a nicer description
if echo "$changelog" | grep -q 'tx-robot'; then
changelog=$(echo "$changelog" | grep -v 'tx-robot')
# This is a funky bashism - preceding a single-quote string with $ lets you put escape chars in it
changelog="${changelog}"$'\nUpdate translations'
fi
libraryCommit=$(curl https://api.github.com/repos/nextcloud/android-library/commits/master | jq .sha | sed s'/\"//g')
# Check if the library was updated
if ! echo $oldLibraryCommit | grep -q $libraryCommit; then
changelog="${changelog}"$'\nUpdate Nextcloud Android library'
fi
# Collapse dependency updates into a single "Update dependencies" entry
if git log --pretty='format:%an' HEAD "^$lastBuildTag" | grep -q dependabot; then
changelog="${changelog}"$'\nUpdate 3rd-party dependencies'
fi
# 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"
+34 -5
View File
@@ -6,16 +6,20 @@ if ( [[ $(grep NC_TEST_SERVER_BASEURL ~/.gradle/gradle.properties | grep -v "#
fi
## emulator
if ( [[ $(emulator -list-avds | grep uiComparison -c) -eq 0 ]] ); then
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
emulator -avd uiComparison -no-snapshot -gpu swiftshader_indirect -no-window -no-audio -skin 500x833 1>/dev/null &
if [ $1 == "debug" ]; then
emulator -avd uiComparison -no-snapshot -gpu swiftshader_indirect -no-audio -skin 500x833 1>/dev/null &
else
emulator -avd uiComparison -no-snapshot -gpu swiftshader_indirect -no-window -no-audio -skin 500x833 1>/dev/null &
fi
PID=$(echo $!)
## server
docker run --name=uiComparison nextcloudci/server 1>/dev/null &
docker run --name=uiComparison nextcloudci/server --entrypoint '/usr/local/bin/initnc.sh' 1>/dev/null &
sleep 5
IP=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' uiComparison)
@@ -24,13 +28,34 @@ if [[ $IP = "" ]]; then
exit 1
fi
## wait for server to finish
scripts/wait_for_server.sh $IP
## run on server
cp gradle.properties gradle.properties_
sed -i s"/server/$IP/" gradle.properties
scripts/wait_for_emulator.sh
scripts/wait_for_server.sh ${IP}
## update all screenshots
# setup test server
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 "su www-data -c \"git clone -b master https://github.com/nextcloud/text.git /var/www/html/apps/text/\""
docker exec uiComparison /bin/sh -c "su www-data -c \"php /var/www/html/occ app:enable text\""
docker exec uiComparison /bin/sh -c "su www-data -c \"git clone -b master https://github.com/nextcloud/circles.git /var/www/html/apps/circles/\""
docker exec uiComparison /bin/sh -c "apt-get update; apt-get -y install composer"
docker exec uiComparison /bin/sh -c "su www-data -c \"cd /var/www/html/apps/circles; composer install\""
docker exec uiComparison /bin/sh -c "su www-data -c \"php /var/www/html/occ app:enable -f circles\""
docker exec uiComparison /bin/sh -c "su www-data -c \"php /var/www/html/occ config:app:set circles --value 1 allow_non_ssl_links\""
docker exec uiComparison /bin/sh -c "su www-data -c \"php /var/www/html/occ config:app:set circles --value 1 local_is_non_ssl\""
docker exec uiComparison /bin/sh -c "su www-data -c \"php /var/www/html/occ circles:manage:create test public publicCircle\""
docker exec uiComparison /bin/sh -c "/usr/local/bin/run.sh"
## update/create all screenshots
./gradlew executeScreenshotTests -Precord
## update screenshots in a class
@@ -47,6 +72,10 @@ scripts/wait_for_server.sh ${IP}
mv gradle.properties_ gradle.properties
if [ $1 == "debug" ]; then
exit
fi
# tidy up
kill $PID
docker stop uiComparison
+37 -17
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,6 +27,9 @@ ID=$3
USER=$1
PASS=$2
TYPE=$4
PR=$5
GITHUB_USER=$6
GITHUB_PASSWORD=$7
REMOTE_FOLDER=$ID-$TYPE
set -e
@@ -22,27 +39,30 @@ if [ $TYPE = "IT" ]; then
elif [ $TYPE = "Unit" ]; then
FOLDER=build/reports/tests/testGplayDebugUnitTest
else
FOLDER=build/reports/shot/verification/
FOLDER=build/reports/shot/verification
fi
if [ ! -e $FOLDER ]; then
if [ -e $FOLDER ]; then
upload $FOLDER
else
echo "$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 \
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. \" }"
exit 1
if [ -e build/reports/androidTests/connected/flavors/GPLAY ] ; then
TYPE="IT"
upload "build/reports/androidTests/connected/flavors/GPLAY"
fi
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
cd $FOLDER
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 $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/$REMOTE_FOLDER \" }"
exit 1
+7 -2
View File
@@ -1,18 +1,23 @@
#!/usr/bin/env bash
counter=0
status=""
counter=0
checkcounter=0
until [[ $status = "false" ]]; do
status=$(curl 2>/dev/null "http://$1/status.php" | jq .maintenance)
echo "($checkcounter) $status"
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
fi
let "checkcounter += 1"
sleep 10
done
echo "($checkcounter) Done"
Binary file not shown.

After

Width:  |  Height:  |  Size: 73 KiB

@@ -28,18 +28,37 @@ import android.app.Activity;
import com.facebook.testing.screenshot.Screenshot;
import com.owncloud.android.AbstractIT;
import com.owncloud.android.R;
import com.owncloud.android.datamodel.OCFile;
import com.owncloud.android.lib.common.operations.RemoteOperationResult;
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.GetShareesRemoteOperation;
import com.owncloud.android.lib.resources.shares.OCShare;
import com.owncloud.android.lib.resources.shares.ShareType;
import com.owncloud.android.operations.CreateFolderOperation;
import com.owncloud.android.ui.activity.FileDisplayActivity;
import com.owncloud.android.ui.events.SearchEvent;
import org.greenrobot.eventbus.EventBus;
import org.json.JSONException;
import org.json.JSONObject;
import org.junit.Assert;
import org.junit.Rule;
import org.junit.Test;
import androidx.test.espresso.contrib.DrawerActions;
import androidx.test.espresso.contrib.NavigationViewActions;
import androidx.test.espresso.intent.rule.IntentsTestRule;
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.assertEquals;
import static junit.framework.TestCase.assertTrue;
public class FileDisplayActivityIT extends AbstractIT {
@@ -52,10 +71,10 @@ public class FileDisplayActivityIT extends AbstractIT {
Manifest.permission.WRITE_EXTERNAL_STORAGE);
@Test
public void open() throws InterruptedException {
public void open() {
Activity sut = activityRule.launchActivity(null);
Thread.sleep(3000);
shortSleep();
Screenshot.snapActivity(sut).record();
}
@@ -69,6 +88,69 @@ public class FileDisplayActivityIT extends AbstractIT {
Screenshot.snapActivity(sut).record();
}
@Test
public void showShares() throws JSONException {
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());
assertTrue(new CreateFolderRemoteOperation("/shareToCircle/", 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());
// share folder to circle
// get share
RemoteOperationResult searchResult = new GetShareesRemoteOperation("publicCircle", 1, 50).execute(client);
assertTrue(searchResult.getLogMessage(), searchResult.isSuccess());
JSONObject resultJson = (JSONObject) searchResult.getData().get(0);
String circleId = resultJson.getJSONObject("value").getString("shareWith");
assertTrue(new CreateShareRemoteOperation("/shareToCircle/",
ShareType.CIRCLE,
circleId,
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);
@@ -78,4 +160,31 @@ public class FileDisplayActivityIT extends AbstractIT {
Screenshot.snapActivity(sut).record();
}
@Test
public void allFiles() {
// ActivityScenario<FileDisplayActivity> sut = ActivityScenario.launch(FileDisplayActivity.class);
FileDisplayActivity sut = activityRule.launchActivity(null);
// given test folder
assertTrue(new CreateFolderOperation("/test/", true).execute(client, getStorageManager()).isSuccess());
// navigate into it
OCFile test = getStorageManager().getFileByPath("/test/");
sut.setFile(test);
sut.startSyncFolderOperation(test, false);
assertEquals(getStorageManager().getFileByPath("/test/"), sut.getCurrentDir());
// open drawer
onView(withId(R.id.drawer_layout)).perform(DrawerActions.open());
// click "all files"
onView(withId(R.id.nav_view))
.perform(NavigationViewActions.navigateTo(R.id.nav_all_files));
// then should be in root again
shortSleep();
assertEquals(getStorageManager().getFileByPath("/"), sut.getCurrentDir());
}
}
@@ -0,0 +1,65 @@
/*
*
* 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.util.Log
import org.junit.rules.TestRule
import org.junit.runner.Description
import org.junit.runners.model.Statement
/**
* C&p from https://stackoverflow.com/questions/45635833/how-can-i-use-flakytest-annotation-now on 18.03.2020
*/
class RetryTestRule(val retryCount: Int = 5) : TestRule {
private val TAG = RetryTestRule::class.java.simpleName
override fun apply(base: Statement, description: Description): Statement {
return statement(base, description)
}
private fun statement(base: Statement, description: Description): Statement {
return object : Statement() {
override fun evaluate() {
Log.e(TAG, "Evaluating ${description.methodName}")
var caughtThrowable: Throwable? = null
for (i in 0 until retryCount) {
try {
base.evaluate()
return
} catch (t: Throwable) {
caughtThrowable = t
Log.e(TAG, description.methodName + ": run " + (i + 1) + " failed")
}
}
Log.e(TAG, description.methodName + ": giving up after " + retryCount + " failures")
if (caughtThrowable != null)
throw caughtThrowable
}
}
}
}
@@ -0,0 +1,430 @@
/*
* Nextcloud Android client application
*
* @author Chris Narkiewicz
* Copyright (C) 2020 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.jobs
import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.Observer
import androidx.test.annotation.UiThreadTest
import androidx.work.Data
import androidx.work.ExistingPeriodicWorkPolicy
import androidx.work.ExistingWorkPolicy
import androidx.work.OneTimeWorkRequest
import androidx.work.PeriodicWorkRequest
import androidx.work.WorkInfo
import androidx.work.WorkManager
import com.nextcloud.client.account.User
import com.nextcloud.client.core.Clock
import com.nhaarman.mockitokotlin2.KArgumentCaptor
import com.nhaarman.mockitokotlin2.any
import com.nhaarman.mockitokotlin2.argThat
import com.nhaarman.mockitokotlin2.argumentCaptor
import com.nhaarman.mockitokotlin2.eq
import com.nhaarman.mockitokotlin2.mock
import com.nhaarman.mockitokotlin2.verify
import com.nhaarman.mockitokotlin2.whenever
import org.junit.Assert.assertEquals
import org.junit.Assert.assertFalse
import org.junit.Assert.assertNotNull
import org.junit.Assert.assertNull
import org.junit.Assert.assertTrue
import org.junit.Before
import org.junit.Test
import org.junit.runner.RunWith
import org.junit.runners.Suite
import org.mockito.ArgumentMatcher
import java.util.Date
import java.util.UUID
import java.util.concurrent.CountDownLatch
import java.util.concurrent.TimeUnit
import java.util.concurrent.TimeoutException
/**
* When using IDE to run enire Suite, make sure tests are run using Android Instrumentation Test
* runner. By default IDE runs normal JUnit - this is AS problem. One must configure the
* test run manually.
*/
@RunWith(Suite::class)
@Suite.SuiteClasses(
BackgroundJobManagerTest.Manager::class,
BackgroundJobManagerTest.ContentObserver::class,
BackgroundJobManagerTest.PeriodicContactsBackup::class,
BackgroundJobManagerTest.ImmediateContactsBackup::class,
BackgroundJobManagerTest.ImmediateContactsImport::class,
BackgroundJobManagerTest.Tags::class
)
class BackgroundJobManagerTest {
/**
* Used to help with ambiguous type inference
*/
class IsOneTimeWorkRequest : ArgumentMatcher<OneTimeWorkRequest> {
override fun matches(argument: OneTimeWorkRequest?): Boolean = true
}
/**
* Used to help with ambiguous type inference
*/
class IsPeriodicWorkRequest : ArgumentMatcher<PeriodicWorkRequest> {
override fun matches(argument: PeriodicWorkRequest?): Boolean = true
}
abstract class Fixture {
companion object {
internal const val USER_ACCOUNT_NAME = "user@nextcloud"
internal val TIMESTAMP = System.currentTimeMillis()
}
internal lateinit var user: User
internal lateinit var workManager: WorkManager
internal lateinit var clock: Clock
internal lateinit var backgroundJobManager: BackgroundJobManagerImpl
@Before
fun setUpFixture() {
user = mock()
whenever(user.accountName).thenReturn(USER_ACCOUNT_NAME)
workManager = mock()
clock = mock()
whenever(clock.currentTime).thenReturn(TIMESTAMP)
whenever(clock.currentDate).thenReturn(Date(TIMESTAMP))
backgroundJobManager = BackgroundJobManagerImpl(workManager, clock)
}
fun assertHasRequiredTags(tags: Set<String>, jobName: String, user: User? = null) {
assertTrue("""'all' tag is mandatory""", tags.contains("*"))
assertTrue("name tag is mandatory", tags.contains(BackgroundJobManagerImpl.formatNameTag(jobName, user)))
assertTrue("timestamp tag is mandatory", tags.contains(BackgroundJobManagerImpl.formatTimeTag(TIMESTAMP)))
if (user != null) {
assertTrue("user tag is mandatory", tags.contains(BackgroundJobManagerImpl.formatUserTag(user)))
}
}
fun buildWorkInfo(index: Long): WorkInfo = WorkInfo(
UUID.randomUUID(),
WorkInfo.State.RUNNING,
Data.Builder().build(),
listOf(BackgroundJobManagerImpl.formatTimeTag(1581820284000)),
Data.Builder().build(),
1
)
}
class Manager : Fixture() {
class SyncObserver<T> : Observer<T> {
val latch = CountDownLatch(1)
var value: T? = null
override fun onChanged(t: T) {
value = t
latch.countDown()
}
fun getValue(timeout: Long = 3, timeUnit: TimeUnit = TimeUnit.SECONDS): T? {
val result = latch.await(timeout, timeUnit)
if (!result) {
throw TimeoutException()
}
return value
}
}
@Test
@UiThreadTest
fun get_all_job_info() {
// GIVEN
// work manager has 2 registered workers
val platformWorkInfo = listOf(
buildWorkInfo(0),
buildWorkInfo(1),
buildWorkInfo(2)
)
val lv = MutableLiveData<List<WorkInfo>>()
lv.value = platformWorkInfo
whenever(workManager.getWorkInfosByTagLiveData(eq("*"))).thenReturn(lv)
// WHEN
// job info for all jobs is requested
val jobs = backgroundJobManager.jobs
// THEN
// live data with job info is returned
// live data contains 2 job info instances
// job info is sorted by timestamp from newest to oldest
assertNotNull(jobs)
val observer = SyncObserver<List<JobInfo>>()
jobs.observeForever(observer)
val jobInfo = observer.getValue()
assertNotNull(jobInfo)
assertEquals(platformWorkInfo.size, jobInfo?.size)
jobInfo?.let {
assertEquals(platformWorkInfo[2].id, it[0].id)
assertEquals(platformWorkInfo[1].id, it[1].id)
assertEquals(platformWorkInfo[0].id, it[2].id)
}
}
@Test
fun cancel_all_jobs() {
// WHEN
// all jobs are cancelled
backgroundJobManager.cancelAllJobs()
// THEN
// all jobs with * tag are cancelled
verify(workManager).cancelAllWorkByTag(BackgroundJobManagerImpl.TAG_ALL)
}
}
class ContentObserver : Fixture() {
private lateinit var request: OneTimeWorkRequest
@Before
fun setUp() {
val requestCaptor: KArgumentCaptor<OneTimeWorkRequest> = argumentCaptor()
backgroundJobManager.scheduleContentObserverJob()
verify(workManager).enqueueUniqueWork(
any(),
any(),
requestCaptor.capture()
)
assertEquals(1, requestCaptor.allValues.size)
request = requestCaptor.firstValue
}
@Test
fun job_is_unique() {
verify(workManager).enqueueUniqueWork(
eq(BackgroundJobManagerImpl.JOB_CONTENT_OBSERVER),
eq(ExistingWorkPolicy.KEEP),
argThat(IsOneTimeWorkRequest())
)
}
@Test
fun job_request_has_mandatory_tags() {
assertHasRequiredTags(request.tags, BackgroundJobManagerImpl.JOB_CONTENT_OBSERVER)
}
}
class PeriodicContactsBackup : Fixture() {
private lateinit var request: PeriodicWorkRequest
@Before
fun setUp() {
val requestCaptor: KArgumentCaptor<PeriodicWorkRequest> = argumentCaptor()
backgroundJobManager.schedulePeriodicContactsBackup(user)
verify(workManager).enqueueUniquePeriodicWork(
any(),
any(),
requestCaptor.capture()
)
assertEquals(1, requestCaptor.allValues.size)
request = requestCaptor.firstValue
}
@Test
fun job_is_unique_for_user() {
verify(workManager).enqueueUniquePeriodicWork(
eq(BackgroundJobManagerImpl.JOB_PERIODIC_CONTACTS_BACKUP),
eq(ExistingPeriodicWorkPolicy.KEEP),
argThat(IsPeriodicWorkRequest())
)
}
@Test
fun job_request_has_mandatory_tags() {
assertHasRequiredTags(request.tags, BackgroundJobManagerImpl.JOB_PERIODIC_CONTACTS_BACKUP, user)
}
}
class ImmediateContactsBackup : Fixture() {
private lateinit var workInfo: MutableLiveData<WorkInfo>
private lateinit var jobInfo: LiveData<JobInfo?>
private lateinit var request: OneTimeWorkRequest
@Before
fun setUp() {
val requestCaptor: KArgumentCaptor<OneTimeWorkRequest> = argumentCaptor()
workInfo = MutableLiveData()
whenever(workManager.getWorkInfoByIdLiveData(any())).thenReturn(workInfo)
jobInfo = backgroundJobManager.startImmediateContactsBackup(user)
verify(workManager).enqueueUniqueWork(
any(),
any(),
requestCaptor.capture()
)
assertEquals(1, requestCaptor.allValues.size)
request = requestCaptor.firstValue
}
@Test
fun job_is_unique_for_user() {
verify(workManager).enqueueUniqueWork(
eq(BackgroundJobManagerImpl.JOB_IMMEDIATE_CONTACTS_BACKUP),
eq(ExistingWorkPolicy.KEEP),
argThat(IsOneTimeWorkRequest())
)
}
@Test
fun job_request_has_mandatory_tags() {
assertHasRequiredTags(request.tags, BackgroundJobManagerImpl.JOB_IMMEDIATE_CONTACTS_BACKUP, user)
}
@Test
@UiThreadTest
fun job_info_is_obtained_from_work_info() {
// GIVEN
// work info is available
workInfo.value = buildWorkInfo(0)
// WHEN
// job info has listener
jobInfo.observeForever {}
// THEN
// converted value is available
assertNotNull(jobInfo.value)
assertEquals(workInfo.value?.id, jobInfo.value?.id)
}
}
class ImmediateContactsImport : Fixture() {
private lateinit var workInfo: MutableLiveData<WorkInfo>
private lateinit var jobInfo: LiveData<JobInfo?>
private lateinit var request: OneTimeWorkRequest
@Before
fun setUp() {
val requestCaptor: KArgumentCaptor<OneTimeWorkRequest> = argumentCaptor()
workInfo = MutableLiveData()
whenever(workManager.getWorkInfoByIdLiveData(any())).thenReturn(workInfo)
jobInfo = backgroundJobManager.startImmediateContactsImport(
contactsAccountName = "name",
contactsAccountType = "type",
vCardFilePath = "/path/to/vcard/file",
selectedContacts = intArrayOf(1, 2, 3)
)
verify(workManager).enqueueUniqueWork(
any(),
any(),
requestCaptor.capture()
)
assertEquals(1, requestCaptor.allValues.size)
request = requestCaptor.firstValue
}
@Test
fun job_is_unique() {
verify(workManager).enqueueUniqueWork(
eq(BackgroundJobManagerImpl.JOB_IMMEDIATE_CONTACTS_IMPORT),
eq(ExistingWorkPolicy.KEEP),
argThat(IsOneTimeWorkRequest())
)
}
@Test
fun job_request_has_mandatory_tags() {
assertHasRequiredTags(request.tags, BackgroundJobManagerImpl.JOB_IMMEDIATE_CONTACTS_IMPORT)
}
@Test
@UiThreadTest
fun job_info_is_obtained_from_work_info() {
// GIVEN
// work info is available
workInfo.value = buildWorkInfo(0)
// WHEN
// job info has listener
jobInfo.observeForever {}
// THEN
// converted value is available
assertNotNull(jobInfo.value)
assertEquals(workInfo.value?.id, jobInfo.value?.id)
}
}
class Tags {
@Test
fun split_tag_key_and_value() {
// GIVEN
// valid tag
// tag has colons in value part
val tag = "${BackgroundJobManagerImpl.TAG_PREFIX_NAME}:value:with:colons and spaces"
// WHEN
// tag is parsed
val parsedTag = BackgroundJobManagerImpl.parseTag(tag)
// THEN
// key-value pair is returned
// key is first
// value with colons is second
assertNotNull(parsedTag)
assertEquals(BackgroundJobManagerImpl.TAG_PREFIX_NAME, parsedTag?.first)
assertEquals("value:with:colons and spaces", parsedTag?.second)
}
@Test
fun tags_with_invalid_prefixes_are_rejected() {
// GIVEN
// tag prefix is not on allowed prefixes list
val tag = "invalidprefix:value"
BackgroundJobManagerImpl.PREFIXES.forEach {
assertFalse(tag.startsWith(it))
}
// WHEN
// tag is parsed
val parsedTag = BackgroundJobManagerImpl.parseTag(tag)
// THEN
// tag is rejected
assertNull(parsedTag)
}
@Test
fun strings_without_colon_are_rejected() {
// GIVEN
// strings that are not tags
val tags = listOf(
BackgroundJobManagerImpl.TAG_ALL,
BackgroundJobManagerImpl.TAG_PREFIX_NAME,
"simplestring",
""
)
tags.forEach {
// WHEN
// string is parsed
val parsedTag = BackgroundJobManagerImpl.parseTag(it)
// THEN
// tag is rejected
assertNull(parsedTag)
}
}
}
}
@@ -0,0 +1,129 @@
/*
* Nextcloud Android client application
*
* @author Chris Narkiewicz
* Copyright (C) 2020 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.migrations
import android.content.Context
import android.content.SharedPreferences
import androidx.test.platform.app.InstrumentationRegistry
import com.nhaarman.mockitokotlin2.any
import com.nhaarman.mockitokotlin2.eq
import com.nhaarman.mockitokotlin2.mock
import com.nhaarman.mockitokotlin2.whenever
import org.junit.Assert.assertEquals
import org.junit.Assert.assertFalse
import org.junit.Assert.assertTrue
import org.junit.Before
import org.junit.Test
class MigrationsDbTest {
private lateinit var context: Context
private lateinit var store: MockSharedPreferences
private lateinit var db: MigrationsDb
@Before
fun setUp() {
context = InstrumentationRegistry.getInstrumentation().context
store = MockSharedPreferences()
assertTrue("State from previous test run found?", store.all.isEmpty())
db = MigrationsDb(store)
}
@Test
fun applied_migrations_are_returned_in_order() {
// GIVEN
// some migrations are marked as applied
// migration ids are stored in random order
val mockStore: SharedPreferences = mock()
val storedMigrationIds = LinkedHashSet<String>()
storedMigrationIds.apply {
add("3")
add("0")
add("2")
add("1")
}
whenever(mockStore.getStringSet(eq(MigrationsDb.DB_KEY_APPLIED_MIGRATIONS), any()))
.thenReturn(storedMigrationIds)
// WHEN
// applied migration ids are retrieved
val db = MigrationsDb(mockStore)
val ids = db.getAppliedMigrations()
// THEN
// returned list is sorted
assertEquals(ids, ids.sorted())
}
@Test
@Suppress("MagicNumber")
fun registering_new_applied_migration_preserves_old_ids() {
// WHEN
// some applied migrations are registered
val appliedMigrationIds = setOf("0", "1", "2")
store.edit().putStringSet(MigrationsDb.DB_KEY_APPLIED_MIGRATIONS, appliedMigrationIds).apply()
// WHEN
// new set of migration ids are registered
// some ids are added again
db.addAppliedMigration(2, 3, 4)
// THEN
// new ids are appended to set of existing ids
val expectedIds = setOf("0", "1", "2", "3", "4")
val storedIds = store.getStringSet(MigrationsDb.DB_KEY_APPLIED_MIGRATIONS, mutableSetOf())
assertEquals(expectedIds, storedIds)
}
@Test
fun failed_status_sets_status_flag_and_error_message() {
// GIVEN
// failure flag is not set
assertFalse(db.isFailed)
// WHEN
// failure status is set
val failureReason = "error message"
db.setFailed(0, failureReason)
// THEN
// failed flag is set
// error message is set
assertTrue(db.isFailed)
assertEquals(failureReason, db.failureReason)
}
@Test
fun last_migrated_version_is_set() {
// GIVEN
// last migrated version is not set
val oldVersion = db.lastMigratedVersion
assertEquals(MigrationsDb.NO_LAST_MIGRATED_VERSION, oldVersion)
// WHEN
// migrated version is set to a new value
val newVersion = 200
db.lastMigratedVersion = newVersion
// THEN
// new value is stored
assertEquals(newVersion, db.lastMigratedVersion)
}
}
@@ -0,0 +1,271 @@
/*
* Nextcloud Android client application
*
* @author Chris Narkiewicz
* Copyright (C) 2020 Chris Narkiewicz <hello@ezaquarii.com>
*
* 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.migrations
import androidx.test.annotation.UiThreadTest
import com.nextcloud.client.appinfo.AppInfo
import com.nextcloud.client.core.ManualAsyncRunner
import com.nhaarman.mockitokotlin2.inOrder
import com.nhaarman.mockitokotlin2.mock
import com.nhaarman.mockitokotlin2.never
import com.nhaarman.mockitokotlin2.verify
import com.nhaarman.mockitokotlin2.whenever
import org.junit.Assert.assertEquals
import org.junit.Assert.assertFalse
import org.junit.Assert.assertTrue
import org.junit.Before
import org.junit.Test
import org.mockito.Mock
import org.mockito.MockitoAnnotations
class MigrationsManagerTest {
companion object {
const val OLD_APP_VERSION = 41
const val NEW_APP_VERSION = 42
}
lateinit var migrationStep1: Runnable
lateinit var migrationStep2: Runnable
lateinit var migrationStep3: Runnable
lateinit var migrations: List<Migrations.Step>
@Mock
lateinit var appInfo: AppInfo
lateinit var migrationsDbStore: MockSharedPreferences
lateinit var migrationsDb: MigrationsDb
lateinit var asyncRunner: ManualAsyncRunner
internal lateinit var migrationsManager: MigrationsManagerImpl
@Before
fun setUp() {
MockitoAnnotations.initMocks(this)
migrationStep1 = mock()
migrationStep2 = mock()
migrationStep3 = mock()
migrations = listOf(
object : Migrations.Step(0, "first migration", true) {
override fun run() {
migrationStep1.run()
}
},
object : Migrations.Step(1, "second optional migration", false) {
override fun run() {
migrationStep2.run()
}
},
object : Migrations.Step(2, "third migration", true) {
override fun run() {
migrationStep3.run()
}
}
)
asyncRunner = ManualAsyncRunner()
migrationsDbStore = MockSharedPreferences()
migrationsDb = MigrationsDb(migrationsDbStore)
whenever(appInfo.versionCode).thenReturn(NEW_APP_VERSION)
migrationsManager = MigrationsManagerImpl(
appInfo = appInfo,
migrationsDb = migrationsDb,
asyncRunner = asyncRunner,
migrations = migrations
)
}
private fun assertMigrationsRun(vararg migrationSteps: Runnable) {
inOrder(migrationSteps).apply {
migrationSteps.forEach {
verify(it.run())
}
}
}
@Test
fun inital_status_is_unknown() {
// GIVEN
// migration manager has not been used yets
// THEN
// status is not set
assertEquals(MigrationsManager.Status.UNKNOWN, migrationsManager.status.value)
}
@Test
@UiThreadTest
fun migrations_are_scheduled_on_background_thread() {
// GIVEN
// migrations can be applied
assertEquals(0, migrationsDb.getAppliedMigrations().size)
// WHEN
// migration is started
val count = migrationsManager.startMigration()
// THEN
// all migrations are scheduled on background thread
// single task is scheduled
assertEquals(migrations.size, count)
assertEquals(1, asyncRunner.size)
assertEquals(MigrationsManager.Status.RUNNING, migrationsManager.status.value)
}
@Test
@UiThreadTest
fun applied_migrations_are_recorded() {
// GIVEN
// no migrations are applied yet
// current app version is newer then last recorded migrated version
whenever(appInfo.versionCode).thenReturn(NEW_APP_VERSION)
migrationsDb.lastMigratedVersion = OLD_APP_VERSION
// WHEN
// migration is run
val count = migrationsManager.startMigration()
assertTrue(asyncRunner.runOne())
// THEN
// total migrations count is returned
// migration functions are called
// applied migrations are recorded
// new app version code is recorded
assertEquals(migrations.size, count)
inOrder(migrationStep1, migrationStep2, migrationStep3).apply {
verify(migrationStep1).run()
verify(migrationStep2).run()
verify(migrationStep3).run()
}
val allAppliedIds = migrations.map { it.id }
assertEquals(allAppliedIds, migrationsDb.getAppliedMigrations())
assertEquals(NEW_APP_VERSION, migrationsDb.lastMigratedVersion)
}
@Test
@UiThreadTest
fun migration_error_is_recorded() {
// GIVEN
// no migrations applied yet
// no prior failed migrations
assertFalse(migrationsDb.isFailed)
assertEquals(MigrationsDb.NO_FAILED_MIGRATION_ID, migrationsDb.failedMigrationId)
// WHEN
// migrations are applied
// one migration throws
val lastMigration = migrations.findLast { it.mandatory } ?: throw IllegalStateException("Test fixture error")
val errorMessage = "error message"
whenever(lastMigration.run()).thenThrow(RuntimeException(errorMessage))
migrationsManager.startMigration()
assertTrue(asyncRunner.runOne())
// THEN
// failure is marked in the migration db
// failure message is recorded
// failed migration id is recorded
assertEquals(MigrationsManager.Status.FAILED, migrationsManager.status.value)
assertTrue(migrationsDb.isFailed)
assertEquals(errorMessage, migrationsDb.failureReason)
assertEquals(lastMigration.id, migrationsDb.failedMigrationId)
}
@Test
@UiThreadTest
fun migrations_are_not_run_if_already_run_for_an_app_version() {
// GIVEN
// migrations were already run for the current app version
whenever(appInfo.versionCode).thenReturn(NEW_APP_VERSION)
migrationsDb.lastMigratedVersion = NEW_APP_VERSION
// WHEN
// app is migrated again
val migrationCount = migrationsManager.startMigration()
// THEN
// migration processing is skipped entirely
// status is set to applied
assertEquals(0, migrationCount)
listOf(migrationStep1, migrationStep2, migrationStep3).forEach {
verify(it, never()).run()
}
assertEquals(MigrationsManager.Status.APPLIED, migrationsManager.status.value)
}
@Test
@UiThreadTest
fun new_app_version_is_marked_as_migrated_if_no_new_migrations_are_available() {
// GIVEN
// migrations were applied in previous version
// new version has no new migrations
whenever(appInfo.versionCode).thenReturn(NEW_APP_VERSION)
migrationsDb.lastMigratedVersion = OLD_APP_VERSION
migrations.forEach {
migrationsDb.addAppliedMigration(it.id)
}
// WHEN
// migration is started
val startedCount = migrationsManager.startMigration()
// THEN
// no new migrations are run
// new version is marked as migrated
assertEquals(0, startedCount)
assertEquals(
NEW_APP_VERSION,
migrationsDb.lastMigratedVersion
)
}
@Test
@UiThreadTest
fun optional_migration_failure_does_not_trigger_a_migration_failure() {
// GIVEN
// pending migrations
// mandatory migrations are passing
// one migration is optional and fails
assertEquals("Fixture should provide 1 optional, failing migration",
1,
migrations.count { !it.mandatory }
)
val optionalFailingMigration = migrations.first { !it.mandatory }
whenever(optionalFailingMigration.run()).thenThrow(RuntimeException())
// WHEN
// migration is started
val startedCount = migrationsManager.startMigration()
asyncRunner.runOne()
assertEquals(migrations.size, startedCount)
// THEN
// mandatory migrations are marked as applied
// optional failed migration is not marked
// no error
// status is applied
// failed migration is available during next migration
val appliedMigrations = migrations.filter { it.mandatory }.map { it.id }
assertTrue("Fixture error", appliedMigrations.isNotEmpty())
assertEquals(appliedMigrations, migrationsDb.getAppliedMigrations())
assertFalse(migrationsDb.isFailed)
assertEquals(MigrationsManager.Status.APPLIED, migrationsManager.status.value)
}
}
@@ -0,0 +1,111 @@
/*
* Nextcloud Android client application
*
* @author Chris Narkiewicz
* Copyright (C) 2020 Chris Narkiewicz <hello@ezaquarii.com>
*
* 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.migrations
import android.content.SharedPreferences
import java.lang.UnsupportedOperationException
import java.util.TreeMap
/**
* This shared preferences implementation uses in-memory value store
* and it can be used in tests without using global, file-backed storage,
* improving test isolation.
*
* The implementation is not thread-safe.
*/
@Suppress("TooManyFunctions")
class MockSharedPreferences : SharedPreferences {
class MockEditor(val store: MutableMap<String?, Any?>) : SharedPreferences.Editor {
val editorStore: MutableMap<String?, Any?> = TreeMap()
override fun clear(): SharedPreferences.Editor = throw UnsupportedOperationException()
override fun putLong(key: String?, value: Long): SharedPreferences.Editor =
throw UnsupportedOperationException("Implement as needed")
override fun putInt(key: String?, value: Int): SharedPreferences.Editor {
editorStore.put(key, value)
return this
}
override fun remove(key: String?): SharedPreferences.Editor = throw UnsupportedOperationException()
override fun putBoolean(key: String?, value: Boolean): SharedPreferences.Editor {
editorStore.put(key, value)
return this
}
override fun putStringSet(key: String?, values: MutableSet<String>?): SharedPreferences.Editor {
editorStore.put(key, values?.toMutableSet())
return this
}
override fun commit(): Boolean = true
override fun putFloat(key: String?, value: Float): SharedPreferences.Editor =
throw UnsupportedOperationException("Implement as needed")
override fun apply() = store.putAll(editorStore)
override fun putString(key: String?, value: String?): SharedPreferences.Editor {
editorStore.put(key, value)
return this
}
}
val store: MutableMap<String?, Any?> = TreeMap()
override fun contains(key: String?): Boolean = store.containsKey(key)
override fun getBoolean(key: String?, defValue: Boolean): Boolean = store.getOrDefault(key, defValue) as Boolean
override fun unregisterOnSharedPreferenceChangeListener(
listener: SharedPreferences.OnSharedPreferenceChangeListener?
) = throw UnsupportedOperationException()
override fun getInt(key: String?, defValue: Int): Int = store.getOrDefault(key, defValue) as Int
override fun getAll(): MutableMap<String?, Any?> {
return HashMap(store)
}
override fun edit(): SharedPreferences.Editor {
return MockEditor(store)
}
override fun getLong(key: String?, defValue: Long): Long {
throw UnsupportedOperationException()
}
override fun getFloat(key: String?, defValue: Float): Float {
throw UnsupportedOperationException()
}
override fun getStringSet(key: String?, defValues: MutableSet<String>?): MutableSet<String>? {
return store.getOrDefault(key, defValues) as MutableSet<String>?
}
override fun registerOnSharedPreferenceChangeListener(
listener: SharedPreferences.OnSharedPreferenceChangeListener?
) = throw UnsupportedOperationException()
override fun getString(key: String?, defValue: String?): String? = store.getOrDefault(key, defValue) as String?
}
@@ -0,0 +1,100 @@
/*
* Nextcloud Android client application
*
* @author Chris Narkiewicz
* Copyright (C) 2020 Chris Narkiewicz <hello@ezaquarii.com>
*
* 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.migrations
import org.junit.Before
import org.junit.Test
import org.junit.Assert.assertEquals
import org.junit.Assert.assertFalse
import org.junit.Assert.assertNotSame
import org.junit.Assert.assertTrue
@Suppress("MagicNumber")
class MockSharedPreferencesTest {
private lateinit var mock: MockSharedPreferences
@Before
fun setUp() {
mock = MockSharedPreferences()
}
@Test
fun getSetStringSet() {
val value = setOf("alpha", "bravo", "charlie")
mock.edit().putStringSet("key", value).apply()
val copy = mock.getStringSet("key", mutableSetOf())
assertNotSame(value, copy)
assertEquals(value, copy)
}
@Test
fun getSetInt() {
val value = 42
val editor = mock.edit()
editor.putInt("key", value)
assertEquals(100, mock.getInt("key", 100))
editor.apply()
assertEquals(42, mock.getInt("key", 100))
}
@Test
fun getSetBoolean() {
val value = true
val editor = mock.edit()
editor.putBoolean("key", value)
assertFalse(mock.getBoolean("key", false))
editor.apply()
assertTrue(mock.getBoolean("key", false))
}
@Test
fun getSetString() {
val value = "a value"
val editor = mock.edit()
editor.putString("key", value)
assertEquals("default", mock.getString("key", "default"))
editor.apply()
assertEquals("a value", mock.getString("key", "default"))
}
@Test
fun getAll() {
// GIVEN
// few properties are stored in shared preferences
mock.edit()
.putInt("int", 1)
.putBoolean("bool", true)
.putString("string", "value")
.putStringSet("stringSet", setOf("alpha", "bravo"))
.apply()
assertEquals(4, mock.store.size)
// WHEN
// all properties are retrieved
val all = mock.all
// THEN
// returned map is a different instance
// map is equal to internal storage
assertNotSame(all, mock.store)
assertEquals(all, mock.store)
}
}
@@ -11,20 +11,26 @@ import android.net.Uri;
import android.os.Bundle;
import com.facebook.testing.screenshot.Screenshot;
import com.nextcloud.client.RetryTestRule;
import com.nextcloud.client.account.UserAccountManager;
import com.nextcloud.client.account.UserAccountManagerImpl;
import com.owncloud.android.datamodel.FileDataStorageManager;
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;
import org.junit.Rule;
import java.io.File;
import java.io.FileWriter;
@@ -34,7 +40,6 @@ 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;
@@ -42,14 +47,16 @@ 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;
/**
* Common base for all integration tests
*/
@RunWith(AndroidJUnit4.class)
//@RunWith(AndroidJUnit4.class)
public abstract class AbstractIT {
@Rule public RetryTestRule retryTestRule = new RetryTestRule();
protected static OwnCloudClient client;
protected static Account account;
@@ -91,6 +98,8 @@ public abstract class AbstractIT {
createDummyFiles();
waitForServer(client, baseUrl);
deleteAllFiles(); // makes sure that no file/folder is in root
} catch (OperationCanceledException e) {
e.printStackTrace();
} catch (AuthenticatorException e) {
@@ -102,7 +111,27 @@ public abstract class AbstractIT {
}
}
FileDataStorageManager getStorageManager() {
@After
public void after() {
deleteAllFiles();
}
public static void deleteAllFiles() {
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());
}
}
}
protected FileDataStorageManager getStorageManager() {
return new FileDataStorageManager(account, targetContext.getContentResolver());
}
@@ -164,7 +193,7 @@ public abstract class AbstractIT {
protected void openDrawer(IntentsTestRule activityRule) throws InterruptedException {
Activity sut = activityRule.launchActivity(null);
Thread.sleep(3000);
shortSleep();
onView(withId(R.id.drawer_layout)).perform(DrawerActions.open());
@@ -186,4 +215,20 @@ public abstract class AbstractIT {
return currentActivity;
}
protected void shortSleep() {
try {
Thread.sleep(2000);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
protected void longSleep() {
try {
Thread.sleep(20000);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
@@ -60,7 +60,7 @@ public class ScreenshotsIT extends AbstractIT {
openOverflowMenu();
onView(anyOf(withText(R.string.action_switch_grid_view), withId(R.id.action_switch_view))).perform(click());
Thread.sleep(1000);
shortSleep();
Screengrab.screenshot("01_gridView");
@@ -70,12 +70,12 @@ public class ScreenshotsIT extends AbstractIT {
Assert.assertTrue(true); // if we reach this, everything is ok
}
private void openOverflowMenu() throws InterruptedException {
private void openOverflowMenu() {
try {
Espresso.openContextualActionModeOverflowMenu();
} catch (NoActivityResumedException e) {
ActivityScenario.launch(FileDisplayActivity.class);
Thread.sleep(1000);
shortSleep();
Espresso.openContextualActionModeOverflowMenu();
}
}
@@ -143,12 +143,12 @@ public class ScreenshotsIT extends AbstractIT {
}
@Test
public void davdroidScreenshot() throws InterruptedException {
public void davdroidScreenshot() {
ActivityScenario.launch(SettingsActivity.class);
onData(PreferenceMatchers.withTitle(R.string.prefs_category_more)).perform(ViewActions.scrollTo());
Thread.sleep(1000);
shortSleep();
Screengrab.screenshot("06_davdroid");
@@ -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,380 @@
/*
*
* 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.files.services
import com.evernote.android.job.JobRequest
import com.nextcloud.client.account.UserAccountManager
import com.nextcloud.client.account.UserAccountManagerImpl
import com.nextcloud.client.device.PowerManagementService
import com.nextcloud.client.network.ConnectivityService
import com.owncloud.android.AbstractIT
import com.owncloud.android.datamodel.OCFile
import com.owncloud.android.datamodel.UploadsStorageManager
import com.owncloud.android.db.OCUpload
import com.owncloud.android.lib.resources.files.ReadFileRemoteOperation
import com.owncloud.android.lib.resources.files.model.RemoteFile
import com.owncloud.android.operations.UploadFileOperation
import com.owncloud.android.utils.FileStorageUtils.getSavePath
import junit.framework.Assert.assertEquals
import junit.framework.Assert.assertFalse
import junit.framework.Assert.assertTrue
import org.junit.Before
import org.junit.Test
import java.io.File
class FileUploaderIT : AbstractIT() {
var uploadsStorageManager: UploadsStorageManager? = null
val connectivityServiceMock: ConnectivityService = object : ConnectivityService {
override fun isInternetWalled(): Boolean {
return false
}
override fun isOnlineWithWifi(): Boolean {
return true
}
override fun getActiveNetworkType(): JobRequest.NetworkType {
return JobRequest.NetworkType.ANY
}
}
private val powerManagementServiceMock: PowerManagementService = object : PowerManagementService {
override val isPowerSavingEnabled: Boolean
get() = false
override val isPowerSavingExclusionAvailable: Boolean
get() = false
override val isBatteryCharging: Boolean
get() = false
}
@Before
fun setUp() {
val contentResolver = targetContext.contentResolver
val accountManager: UserAccountManager = UserAccountManagerImpl.fromContext(targetContext)
uploadsStorageManager = UploadsStorageManager(accountManager, contentResolver)
}
/**
* uploads a file, overwrites it with an empty one, check if overwritten
*/
@Test
fun testKeepLocalAndOverwriteRemote() {
val file = File(getSavePath(account.name) + "/chunkedFile.txt")
val ocUpload = OCUpload(file.absolutePath, "/testFile.txt", account.name)
assertTrue(UploadFileOperation(
uploadsStorageManager,
connectivityServiceMock,
powerManagementServiceMock,
account,
null,
ocUpload,
FileUploader.NameCollisionPolicy.DEFAULT,
FileUploader.LOCAL_BEHAVIOUR_COPY,
targetContext,
false,
false)
.setRemoteFolderToBeCreated()
.execute(client, storageManager).isSuccess)
val result = ReadFileRemoteOperation("/testFile.txt").execute(client)
assertTrue(result.isSuccess)
assertEquals(file.length(), (result.data[0] as RemoteFile).length)
val ocUpload2 = OCUpload(getSavePath(account.name) + "/empty.txt", "/testFile.txt", account.name)
assertTrue(UploadFileOperation(
uploadsStorageManager,
connectivityServiceMock,
powerManagementServiceMock,
account,
null,
ocUpload2,
FileUploader.NameCollisionPolicy.OVERWRITE,
FileUploader.LOCAL_BEHAVIOUR_COPY,
targetContext,
false,
false)
.execute(client, storageManager).isSuccess)
val result2 = ReadFileRemoteOperation("/testFile.txt").execute(client)
assertTrue(result2.isSuccess)
assertEquals(0, (result2.data[0] as RemoteFile).length)
}
/**
* uploads a file, overwrites it with an empty one, check if overwritten
*/
@Test
fun testKeepLocalAndOverwriteRemoteStatic() {
val file = File(getSavePath(account.name) + "/chunkedFile.txt")
FileUploader.uploadNewFile(
targetContext,
account,
file.absolutePath,
"/testFile.txt",
FileUploader.LOCAL_BEHAVIOUR_COPY,
null,
true,
UploadFileOperation.CREATED_BY_USER,
false,
false,
FileUploader.NameCollisionPolicy.DEFAULT)
longSleep()
val result = ReadFileRemoteOperation("/testFile.txt").execute(client)
assertTrue(result.isSuccess)
assertEquals(file.length(), (result.data[0] as RemoteFile).length)
val ocFile2 = OCFile("/testFile.txt")
ocFile2.setStoragePath(getSavePath(account.name) + "/empty.txt")
FileUploader.uploadUpdateFile(
targetContext,
account,
ocFile2,
FileUploader.LOCAL_BEHAVIOUR_COPY,
FileUploader.NameCollisionPolicy.OVERWRITE)
shortSleep()
val result2 = ReadFileRemoteOperation("/testFile.txt").execute(client)
assertTrue(result2.isSuccess)
assertEquals(0, (result2.data[0] as RemoteFile).length)
}
/**
* uploads a file, uploads another one with automatically (2) added, check
*/
@Test
fun testKeepBoth() {
var renameListenerWasTriggered = false
val file = File(getSavePath(account.name) + "/chunkedFile.txt")
val ocUpload = OCUpload(file.absolutePath, "/testFile.txt", account.name)
assertTrue(UploadFileOperation(
uploadsStorageManager,
connectivityServiceMock,
powerManagementServiceMock,
account,
null,
ocUpload,
FileUploader.NameCollisionPolicy.DEFAULT,
FileUploader.LOCAL_BEHAVIOUR_COPY,
targetContext,
false,
false)
.setRemoteFolderToBeCreated()
.execute(client, storageManager).isSuccess)
val result = ReadFileRemoteOperation("/testFile.txt").execute(client)
assertTrue(result.isSuccess)
assertEquals(file.length(), (result.data[0] as RemoteFile).length)
val file2 = File(getSavePath(account.name) + "/empty.txt")
val ocUpload2 = OCUpload(file2.absolutePath, "/testFile.txt", account.name)
assertTrue(UploadFileOperation(
uploadsStorageManager,
connectivityServiceMock,
powerManagementServiceMock,
account,
null,
ocUpload2,
FileUploader.NameCollisionPolicy.RENAME,
FileUploader.LOCAL_BEHAVIOUR_COPY,
targetContext,
false,
false)
.addRenameUploadListener {
renameListenerWasTriggered = true
}
.execute(client, storageManager).isSuccess)
val result2 = ReadFileRemoteOperation("/testFile.txt").execute(client)
assertTrue(result2.isSuccess)
assertEquals(file.length(), (result2.data[0] as RemoteFile).length)
val result3 = ReadFileRemoteOperation("/testFile (2).txt").execute(client)
assertTrue(result3.isSuccess)
assertEquals(file2.length(), (result3.data[0] as RemoteFile).length)
assertTrue(renameListenerWasTriggered)
}
/**
* uploads a file, uploads another one with automatically (2) added, check
*/
@Test
fun testKeepBothStatic() {
val file = File(getSavePath(account.name) + "/chunkedFile.txt")
FileUploader.uploadNewFile(
targetContext,
account,
file.absolutePath,
"/testFile.txt",
FileUploader.LOCAL_BEHAVIOUR_COPY,
null,
true,
UploadFileOperation.CREATED_BY_USER,
false,
false,
FileUploader.NameCollisionPolicy.DEFAULT)
longSleep()
val result = ReadFileRemoteOperation("/testFile.txt").execute(client)
assertTrue(result.isSuccess)
assertEquals(file.length(), (result.data[0] as RemoteFile).length)
val ocFile2 = OCFile("/testFile.txt")
ocFile2.setStoragePath(getSavePath(account.name) + "/empty.txt")
FileUploader.uploadUpdateFile(
targetContext,
account,
ocFile2,
FileUploader.LOCAL_BEHAVIOUR_COPY,
FileUploader.NameCollisionPolicy.RENAME)
shortSleep()
val result2 = ReadFileRemoteOperation("/testFile.txt").execute(client)
assertTrue(result2.isSuccess)
assertEquals(file.length(), (result2.data[0] as RemoteFile).length)
val result3 = ReadFileRemoteOperation("/testFile (2).txt").execute(client)
assertTrue(result3.isSuccess)
assertEquals(ocFile2.fileLength, (result3.data[0] as RemoteFile).length)
}
/**
* uploads a file with "keep server" option set, so do nothing
*/
@Test
fun testKeepServer() {
val file = File(getSavePath(account.name) + "/chunkedFile.txt")
val ocUpload = OCUpload(file.absolutePath, "/testFile.txt", account.name)
assertTrue(UploadFileOperation(
uploadsStorageManager,
connectivityServiceMock,
powerManagementServiceMock,
account,
null,
ocUpload,
FileUploader.NameCollisionPolicy.DEFAULT,
FileUploader.LOCAL_BEHAVIOUR_COPY,
targetContext,
false,
false)
.setRemoteFolderToBeCreated()
.execute(client, storageManager).isSuccess)
val result = ReadFileRemoteOperation("/testFile.txt").execute(client)
assertTrue(result.isSuccess)
assertEquals(file.length(), (result.data[0] as RemoteFile).length)
val ocUpload2 = OCUpload(getSavePath(account.name) + "/empty.txt", "/testFile.txt", account.name)
assertFalse(UploadFileOperation(
uploadsStorageManager,
connectivityServiceMock,
powerManagementServiceMock,
account,
null,
ocUpload2,
FileUploader.NameCollisionPolicy.CANCEL,
FileUploader.LOCAL_BEHAVIOUR_COPY,
targetContext,
false,
false)
.execute(client, storageManager).isSuccess)
val result2 = ReadFileRemoteOperation("/testFile.txt").execute(client)
assertTrue(result2.isSuccess)
assertEquals(file.length(), (result2.data[0] as RemoteFile).length)
}
/**
* uploads a file with "keep server" option set, so do nothing
*/
@Test
fun testKeepServerStatic() {
val file = File(getSavePath(account.name) + "/chunkedFile.txt")
FileUploader.uploadNewFile(
targetContext,
account,
file.absolutePath,
"/testFile.txt",
FileUploader.LOCAL_BEHAVIOUR_COPY,
null,
true,
UploadFileOperation.CREATED_BY_USER,
false,
false,
FileUploader.NameCollisionPolicy.DEFAULT)
longSleep()
val result = ReadFileRemoteOperation("/testFile.txt").execute(client)
assertTrue(result.isSuccess)
assertEquals(file.length(), (result.data[0] as RemoteFile).length)
val ocFile2 = OCFile("/testFile.txt")
ocFile2.setStoragePath(getSavePath(account.name) + "/empty.txt")
FileUploader.uploadUpdateFile(
targetContext,
account,
ocFile2,
FileUploader.LOCAL_BEHAVIOUR_COPY,
FileUploader.NameCollisionPolicy.CANCEL)
shortSleep()
val result2 = ReadFileRemoteOperation("/testFile.txt").execute(client)
assertTrue(result2.isSuccess)
assertEquals(file.length(), (result2.data[0] as RemoteFile).length)
}
}
@@ -0,0 +1,321 @@
/*
*
* 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.content.Intent;
import com.facebook.testing.screenshot.Screenshot;
import com.nextcloud.client.account.UserAccountManagerImpl;
import com.owncloud.android.AbstractIT;
import com.owncloud.android.R;
import com.owncloud.android.datamodel.FileDataStorageManager;
import com.owncloud.android.datamodel.OCFile;
import com.owncloud.android.db.OCUpload;
import com.owncloud.android.lib.resources.files.UploadFileRemoteOperation;
import com.owncloud.android.operations.RefreshFolderOperation;
import com.owncloud.android.ui.dialog.ConflictsResolveDialog;
import com.owncloud.android.utils.FileStorageUtils;
import org.junit.Rule;
import org.junit.Test;
import java.io.File;
import java.io.IOException;
import androidx.fragment.app.DialogFragment;
import androidx.test.espresso.intent.rule.IntentsTestRule;
import static androidx.test.espresso.Espresso.onView;
import static androidx.test.espresso.action.ViewActions.click;
import static androidx.test.espresso.matcher.ViewMatchers.withId;
import static androidx.test.espresso.matcher.ViewMatchers.withText;
import static androidx.test.platform.app.InstrumentationRegistry.getInstrumentation;
import static junit.framework.TestCase.assertTrue;
import static org.junit.Assert.assertEquals;
public class ConflictsResolveActivityIT extends AbstractIT {
@Rule public IntentsTestRule<ConflictsResolveActivity> activityRule =
new IntentsTestRule<>(ConflictsResolveActivity.class, true, false);
private boolean returnCode;
@Test
public void screenshotTextFiles() {
OCFile newFile = new OCFile("/newFile.txt");
newFile.setFileLength(56000);
newFile.setModificationTimestamp(1522019340);
newFile.setStoragePath(FileStorageUtils.getSavePath(account.name) + "/nonEmpty.txt");
OCFile existingFile = new OCFile("/newFile.txt");
existingFile.setFileLength(1024000);
existingFile.setModificationTimestamp(1582019340);
FileDataStorageManager storageManager = new FileDataStorageManager(account, targetContext.getContentResolver());
storageManager.saveNewFile(existingFile);
Intent intent = new Intent(targetContext, ConflictsResolveActivity.class);
intent.putExtra(ConflictsResolveActivity.EXTRA_FILE, newFile);
intent.putExtra(ConflictsResolveActivity.EXTRA_EXISTING_FILE, existingFile);
ConflictsResolveActivity sut = activityRule.launchActivity(intent);
ConflictsResolveDialog dialog = ConflictsResolveDialog.newInstance(existingFile,
newFile,
UserAccountManagerImpl
.fromContext(targetContext)
.getUser()
);
dialog.showDialog(sut);
getInstrumentation().waitForIdleSync();
shortSleep();
Screenshot.snap(dialog.getDialog().getWindow().getDecorView()).record();
}
@Test
public void screenshotImages() throws IOException {
FileDataStorageManager storageManager = new FileDataStorageManager(account,
targetContext.getContentResolver());
OCFile newFile = new OCFile("/newFile.txt");
newFile.setFileLength(56000);
newFile.setModificationTimestamp(1522019340);
newFile.setStoragePath(FileStorageUtils.getSavePath(account.name) + "/nonEmpty.txt");
File image = getFile("image.jpg");
assertTrue(new UploadFileRemoteOperation(image.getAbsolutePath(),
"/image.jpg",
"image/jpg",
"10000000").execute(client).isSuccess());
assertTrue(new RefreshFolderOperation(storageManager.getFileByPath("/"),
System.currentTimeMillis(),
false,
true,
storageManager,
account,
targetContext
).execute(client).isSuccess());
OCFile existingFile = storageManager.getFileByPath("/image.jpg");
Intent intent = new Intent(targetContext, ConflictsResolveActivity.class);
intent.putExtra(ConflictsResolveActivity.EXTRA_FILE, newFile);
intent.putExtra(ConflictsResolveActivity.EXTRA_EXISTING_FILE, existingFile);
ConflictsResolveActivity sut = activityRule.launchActivity(intent);
ConflictsResolveDialog.OnConflictDecisionMadeListener listener = decision -> {
};
ConflictsResolveDialog dialog = ConflictsResolveDialog.newInstance(existingFile,
newFile,
UserAccountManagerImpl
.fromContext(targetContext)
.getUser()
);
dialog.showDialog(sut);
dialog.listener = listener;
getInstrumentation().waitForIdleSync();
shortSleep();
Screenshot.snap(dialog.getDialog().getWindow().getDecorView()).record();
}
@Test
public void cancel() {
returnCode = false;
OCUpload newUpload = new OCUpload(FileStorageUtils.getSavePath(account.name) + "/nonEmpty.txt",
"/newFile.txt",
account.name);
OCFile existingFile = new OCFile("/newFile.txt");
existingFile.setFileLength(1024000);
existingFile.setModificationTimestamp(1582019340);
OCFile newFile = new OCFile("/newFile.txt");
newFile.setFileLength(56000);
newFile.setModificationTimestamp(1522019340);
newFile.setStoragePath(FileStorageUtils.getSavePath(account.name) + "/nonEmpty.txt");
FileDataStorageManager storageManager = new FileDataStorageManager(account, targetContext.getContentResolver());
storageManager.saveNewFile(existingFile);
Intent intent = new Intent(targetContext, ConflictsResolveActivity.class);
intent.putExtra(ConflictsResolveActivity.EXTRA_FILE, newFile);
intent.putExtra(ConflictsResolveActivity.EXTRA_EXISTING_FILE, existingFile);
intent.putExtra(ConflictsResolveActivity.EXTRA_CONFLICT_UPLOAD, newUpload);
ConflictsResolveActivity sut = activityRule.launchActivity(intent);
sut.listener = decision -> {
assertEquals(decision, ConflictsResolveDialog.Decision.CANCEL);
returnCode = true;
};
getInstrumentation().waitForIdleSync();
shortSleep();
onView(withText("Cancel")).perform(click());
assertTrue(returnCode);
}
@Test
public void keepExisting() {
returnCode = false;
OCUpload newUpload = new OCUpload(FileStorageUtils.getSavePath(account.name) + "/nonEmpty.txt",
"/newFile.txt",
account.name);
OCFile existingFile = new OCFile("/newFile.txt");
existingFile.setFileLength(1024000);
existingFile.setModificationTimestamp(1582019340);
OCFile newFile = new OCFile("/newFile.txt");
newFile.setFileLength(56000);
newFile.setModificationTimestamp(1522019340);
newFile.setStoragePath(FileStorageUtils.getSavePath(account.name) + "/nonEmpty.txt");
FileDataStorageManager storageManager = new FileDataStorageManager(account, targetContext.getContentResolver());
storageManager.saveNewFile(existingFile);
Intent intent = new Intent(targetContext, ConflictsResolveActivity.class);
intent.putExtra(ConflictsResolveActivity.EXTRA_FILE, newFile);
intent.putExtra(ConflictsResolveActivity.EXTRA_EXISTING_FILE, existingFile);
intent.putExtra(ConflictsResolveActivity.EXTRA_CONFLICT_UPLOAD, newUpload);
ConflictsResolveActivity sut = activityRule.launchActivity(intent);
sut.listener = decision -> {
assertEquals(decision, ConflictsResolveDialog.Decision.KEEP_SERVER);
returnCode = true;
};
getInstrumentation().waitForIdleSync();
onView(withId(R.id.existing_checkbox)).perform(click());
DialogFragment dialog = (DialogFragment) sut.getSupportFragmentManager().findFragmentByTag("conflictDialog");
Screenshot.snap(dialog.getDialog().getWindow().getDecorView()).record();
onView(withText("OK")).perform(click());
assertTrue(returnCode);
}
@Test
public void keepNew() {
returnCode = false;
OCUpload newUpload = new OCUpload(FileStorageUtils.getSavePath(account.name) + "/nonEmpty.txt",
"/newFile.txt",
account.name);
OCFile existingFile = new OCFile("/newFile.txt");
existingFile.setFileLength(1024000);
existingFile.setModificationTimestamp(1582019340);
OCFile newFile = new OCFile("/newFile.txt");
newFile.setFileLength(56000);
newFile.setModificationTimestamp(1522019340);
newFile.setStoragePath(FileStorageUtils.getSavePath(account.name) + "/nonEmpty.txt");
FileDataStorageManager storageManager = new FileDataStorageManager(account, targetContext.getContentResolver());
storageManager.saveNewFile(existingFile);
Intent intent = new Intent(targetContext, ConflictsResolveActivity.class);
intent.putExtra(ConflictsResolveActivity.EXTRA_FILE, newFile);
intent.putExtra(ConflictsResolveActivity.EXTRA_EXISTING_FILE, existingFile);
intent.putExtra(ConflictsResolveActivity.EXTRA_CONFLICT_UPLOAD, newUpload);
ConflictsResolveActivity sut = activityRule.launchActivity(intent);
sut.listener = decision -> {
assertEquals(decision, ConflictsResolveDialog.Decision.KEEP_LOCAL);
returnCode = true;
};
getInstrumentation().waitForIdleSync();
onView(withId(R.id.new_checkbox)).perform(click());
DialogFragment dialog = (DialogFragment) sut.getSupportFragmentManager().findFragmentByTag("conflictDialog");
Screenshot.snap(dialog.getDialog().getWindow().getDecorView()).record();
onView(withText("OK")).perform(click());
assertTrue(returnCode);
}
@Test
public void keepBoth() {
returnCode = false;
OCUpload newUpload = new OCUpload(FileStorageUtils.getSavePath(account.name) + "/nonEmpty.txt",
"/newFile.txt",
account.name);
OCFile existingFile = new OCFile("/newFile.txt");
existingFile.setFileLength(1024000);
existingFile.setModificationTimestamp(1582019340);
OCFile newFile = new OCFile("/newFile.txt");
newFile.setFileLength(56000);
newFile.setModificationTimestamp(1522019340);
newFile.setStoragePath(FileStorageUtils.getSavePath(account.name) + "/nonEmpty.txt");
FileDataStorageManager storageManager = new FileDataStorageManager(account, targetContext.getContentResolver());
storageManager.saveNewFile(existingFile);
Intent intent = new Intent(targetContext, ConflictsResolveActivity.class);
intent.putExtra(ConflictsResolveActivity.EXTRA_FILE, newFile);
intent.putExtra(ConflictsResolveActivity.EXTRA_EXISTING_FILE, existingFile);
intent.putExtra(ConflictsResolveActivity.EXTRA_CONFLICT_UPLOAD, newUpload);
ConflictsResolveActivity sut = activityRule.launchActivity(intent);
sut.listener = decision -> {
assertEquals(decision, ConflictsResolveDialog.Decision.KEEP_BOTH);
returnCode = true;
};
getInstrumentation().waitForIdleSync();
onView(withId(R.id.existing_checkbox)).perform(click());
onView(withId(R.id.new_checkbox)).perform(click());
DialogFragment dialog = (DialogFragment) sut.getSupportFragmentManager().findFragmentByTag("conflictDialog");
Screenshot.snap(dialog.getDialog().getWindow().getDecorView()).record();
onView(withText("OK")).perform(click());
assertTrue(returnCode);
}
}
@@ -0,0 +1,126 @@
/*
*
* 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.Manifest;
import android.accounts.Account;
import android.accounts.AccountManager;
import android.net.Uri;
import android.os.Bundle;
import com.nextcloud.client.account.UserAccountManager;
import com.nextcloud.client.account.UserAccountManagerImpl;
import com.owncloud.android.AbstractIT;
import com.owncloud.android.MainApp;
import com.owncloud.android.R;
import com.owncloud.android.lib.common.accounts.AccountUtils;
import org.junit.BeforeClass;
import org.junit.Rule;
import org.junit.Test;
import androidx.test.espresso.contrib.DrawerActions;
import androidx.test.espresso.intent.rule.IntentsTestRule;
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.espresso.matcher.ViewMatchers.withText;
import static org.hamcrest.Matchers.anyOf;
import static org.junit.Assert.assertEquals;
public class DrawerActivityIT 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);
private static Account account2;
private static String account2Name;
private static String account2DisplayName;
@BeforeClass
public static void beforeClass() {
Bundle arguments = androidx.test.platform.app.InstrumentationRegistry.getArguments();
Uri baseUrl = Uri.parse(arguments.getString("TEST_SERVER_URL"));
String loginName = "user1";
String password = "user1";
Account temp = new Account(loginName + "@" + baseUrl, MainApp.getAccountType(targetContext));
UserAccountManager accountManager = UserAccountManagerImpl.fromContext(targetContext);
if (!accountManager.exists(temp)) {
AccountManager platformAccountManager = AccountManager.get(targetContext);
platformAccountManager.addAccountExplicitly(temp, password, null);
platformAccountManager.setUserData(temp, AccountUtils.Constants.KEY_OC_ACCOUNT_VERSION,
Integer.toString(UserAccountManager.ACCOUNT_VERSION));
platformAccountManager.setUserData(temp, AccountUtils.Constants.KEY_OC_VERSION, "14.0.0.0");
platformAccountManager.setUserData(temp, AccountUtils.Constants.KEY_OC_BASE_URL, baseUrl.toString());
platformAccountManager.setUserData(temp, AccountUtils.Constants.KEY_USER_ID, loginName); // same as userId
}
final UserAccountManager userAccountManager = UserAccountManagerImpl.fromContext(targetContext);
account2 = userAccountManager.getAccountByName(loginName + "@" + baseUrl);
account2Name = loginName + "@" + baseUrl;
account2DisplayName = "User One@" + baseUrl;
}
@Test
public void switchAccountViaAccountList() {
FileDisplayActivity sut = activityRule.launchActivity(null);
assertEquals(account, sut.getUser().get().toPlatformAccount());
onView(withId(R.id.drawer_layout)).perform(DrawerActions.open());
onView(withId(R.id.drawer_active_user)).perform(click());
onView(anyOf(withText(account2Name), withText(account2DisplayName))).perform(click());
waitForIdleSync();
assertEquals(account2, sut.getUser().get().toPlatformAccount());
onView(withId(R.id.drawer_layout)).perform(DrawerActions.open());
onView(withId(R.id.drawer_active_user)).perform(click());
onView(withText(account.name)).perform(click());
}
@Test
public void switchAccountViaAvatar() {
FileDisplayActivity sut = activityRule.launchActivity(null);
assertEquals(account, sut.getUser().get().toPlatformAccount());
onView(withId(R.id.drawer_layout)).perform(DrawerActions.open());
onView(withId(R.id.drawer_account_end)).perform(click());
waitForIdleSync();
assertEquals(account2, sut.getUser().get().toPlatformAccount());
onView(withId(R.id.drawer_layout)).perform(DrawerActions.open());
onView(withId(R.id.drawer_account_end)).perform(click());
}
}
@@ -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);
}
}
@@ -40,22 +40,22 @@ public class ManageAccountsActivityIT extends AbstractIT {
false);
@Test
public void open() throws InterruptedException {
public void open() {
Activity sut = activityRule.launchActivity(null);
Thread.sleep(2000);
shortSleep();
Screenshot.snapActivity(sut).record();
}
@Test
public void userInfoDetail() throws InterruptedException {
public void userInfoDetail() {
ManageAccountsActivity sut = activityRule.launchActivity(null);
User user = sut.accountManager.getUser();
sut.onClick(user);
Thread.sleep(2000);
shortSleep();
Screenshot.snapActivity(getCurrentActivity()).record();
}
@@ -0,0 +1,255 @@
/*
*
* 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.fragment
import android.Manifest
import androidx.test.core.app.ActivityScenario
import androidx.test.espresso.intent.rule.IntentsTestRule
import androidx.test.platform.app.InstrumentationRegistry
import androidx.test.rule.GrantPermissionRule
import com.evernote.android.job.JobRequest
import com.facebook.testing.screenshot.Screenshot
import com.nextcloud.client.account.UserAccountManagerImpl
import com.nextcloud.client.device.PowerManagementService
import com.nextcloud.client.network.ConnectivityService
import com.nextcloud.client.preferences.AppPreferences
import com.nextcloud.client.preferences.AppPreferencesImpl
import com.nextcloud.client.preferences.DarkMode
import com.owncloud.android.AbstractIT
import com.owncloud.android.MainApp
import com.owncloud.android.datamodel.UploadsStorageManager
import com.owncloud.android.db.OCUpload
import com.owncloud.android.files.services.FileUploader
import com.owncloud.android.lib.resources.shares.CreateShareRemoteOperation
import com.owncloud.android.lib.resources.shares.GetShareesRemoteOperation
import com.owncloud.android.lib.resources.shares.OCShare
import com.owncloud.android.lib.resources.shares.ShareType
import com.owncloud.android.operations.CreateFolderOperation
import com.owncloud.android.operations.RefreshFolderOperation
import com.owncloud.android.operations.UploadFileOperation
import com.owncloud.android.ui.activity.FileDisplayActivity
import com.owncloud.android.utils.FileStorageUtils
import junit.framework.TestCase
import org.json.JSONObject
import org.junit.Assert.assertTrue
import org.junit.Rule
import org.junit.Test
class OCFileListFragmentIT : AbstractIT() {
companion object {
val SECOND_IN_MILLIS = 1000L
val RESULT_PER_PAGE = 50
}
@get:Rule
val activityRule = IntentsTestRule(FileDisplayActivity::class.java, true, false)
@get:Rule
val permissionRule = GrantPermissionRule.grant(Manifest.permission.WRITE_EXTERNAL_STORAGE)
private val connectivityServiceMock: ConnectivityService = object : ConnectivityService {
override fun isInternetWalled(): Boolean {
return false
}
override fun isOnlineWithWifi(): Boolean {
return true
}
override fun getActiveNetworkType(): JobRequest.NetworkType {
return JobRequest.NetworkType.ANY
}
}
private val powerManagementServiceMock: PowerManagementService = object : PowerManagementService {
override val isPowerSavingEnabled: Boolean
get() = false
override val isPowerSavingExclusionAvailable: Boolean
get() = false
override val isBatteryCharging: Boolean
get() = false
}
@Test
fun showRichWorkspace() {
assertTrue(CreateFolderOperation("/test/", true).execute(client, storageManager).isSuccess)
val ocUpload = OCUpload(FileStorageUtils.getSavePath(account.name) + "/nonEmpty.txt",
"/test/Readme.md",
account.name)
val newUpload = UploadFileOperation(
UploadsStorageManager(UserAccountManagerImpl.fromContext(targetContext), targetContext.contentResolver),
connectivityServiceMock,
powerManagementServiceMock,
account,
null,
ocUpload,
FileUploader.NameCollisionPolicy.DEFAULT,
FileUploader.LOCAL_BEHAVIOUR_COPY,
targetContext,
false,
false)
newUpload.addRenameUploadListener {}
newUpload.setRemoteFolderToBeCreated()
assertTrue(newUpload.execute(client, storageManager).isSuccess)
assertTrue(RefreshFolderOperation(storageManager.getFileByPath("/test/"),
System.currentTimeMillis() / SECOND_IN_MILLIS,
false,
true,
storageManager,
account,
targetContext).execute(client).isSuccess)
val sut = ActivityScenario.launch(FileDisplayActivity::class.java)
sut.onActivity { activity -> activity.onBrowsedDownTo(storageManager.getFileByPath("/test/")) }
shortSleep()
sut.onActivity { activity ->
Screenshot.snapActivity(activity).setName("richworkspaces_light").record()
}
val preferences: AppPreferences = AppPreferencesImpl.fromContext(targetContext)
preferences.darkThemeMode = DarkMode.DARK
MainApp.setAppTheme(DarkMode.DARK)
sut.onActivity { activity -> activity.onBackPressed() }
sut.recreate()
sut.onActivity { activity -> activity.onBrowsedDownTo(storageManager.getFileByPath("/test/")) }
shortSleep()
sut.onActivity { activity ->
Screenshot.snapActivity(activity).setName("richworkspaces_dark").record()
}
// switch back to light mode
preferences.darkThemeMode = DarkMode.LIGHT
MainApp.setAppTheme(DarkMode.LIGHT)
sut.onActivity { activity -> activity.onBackPressed() }
sut.recreate()
}
@Test
fun createAndShowShareToUser() {
val path = "/shareToAdmin/"
TestCase.assertTrue(CreateFolderOperation(path, true).execute(client, storageManager).isSuccess)
// share folder to user "admin"
TestCase.assertTrue(CreateShareRemoteOperation(path,
ShareType.USER,
"admin",
false,
"",
OCShare.MAXIMUM_PERMISSIONS_FOR_FOLDER)
.execute(client).isSuccess)
val sut: FileDisplayActivity = activityRule.launchActivity(null)
sut.startSyncFolderOperation(storageManager.getFileByPath("/"), true)
shortSleep()
InstrumentationRegistry.getInstrumentation().waitForIdleSync()
Screenshot.snapActivity(sut).record()
}
@Test
fun createAndShowShareToGroup() {
val path = "/shareToGroup/"
TestCase.assertTrue(CreateFolderOperation(path, true).execute(client, storageManager).isSuccess)
// share folder to group
assertTrue(CreateShareRemoteOperation("/shareToGroup/",
ShareType.GROUP,
"users",
false,
"",
OCShare.DEFAULT_PERMISSION)
.execute(client).isSuccess)
val sut: FileDisplayActivity = activityRule.launchActivity(null)
sut.startSyncFolderOperation(storageManager.getFileByPath("/"), true)
shortSleep()
InstrumentationRegistry.getInstrumentation().waitForIdleSync()
Screenshot.snapActivity(sut).record()
}
@Test
fun createAndShowShareToCircle() {
val path = "/shareToCircle/"
TestCase.assertTrue(CreateFolderOperation(path, true).execute(client, storageManager).isSuccess)
// share folder to circle
// get circleId
val searchResult = GetShareesRemoteOperation("publicCircle", 1, RESULT_PER_PAGE).execute(client)
assertTrue(searchResult.logMessage, searchResult.isSuccess)
val resultJson: JSONObject = searchResult.data[0] as JSONObject
val circleId: String = resultJson.getJSONObject("value").getString("shareWith")
assertTrue(CreateShareRemoteOperation("/shareToCircle/",
ShareType.CIRCLE,
circleId,
false,
"",
OCShare.DEFAULT_PERMISSION)
.execute(client).isSuccess)
val sut: FileDisplayActivity = activityRule.launchActivity(null)
sut.startSyncFolderOperation(storageManager.getFileByPath("/"), true)
shortSleep()
InstrumentationRegistry.getInstrumentation().waitForIdleSync()
Screenshot.snapActivity(sut).record()
}
@Test
fun createAndShowShareViaLink() {
val path = "/shareViaLink/"
TestCase.assertTrue(CreateFolderOperation(path, true).execute(client, storageManager).isSuccess)
// share folder via public link
TestCase.assertTrue(CreateShareRemoteOperation("/shareViaLink/",
ShareType.PUBLIC_LINK,
"",
true,
"",
OCShare.READ_PERMISSION_FLAG)
.execute(client).isSuccess)
val sut: FileDisplayActivity = activityRule.launchActivity(null)
sut.startSyncFolderOperation(storageManager.getFileByPath("/"), true)
shortSleep()
InstrumentationRegistry.getInstrumentation().waitForIdleSync()
Screenshot.snapActivity(sut).record()
}
}
@@ -0,0 +1,48 @@
/*
*
* 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.helpers
import com.owncloud.android.MainApp
import junit.framework.Assert.assertEquals
import junit.framework.Assert.assertTrue
import org.junit.Test
class FileOperationsHelperIT {
@Test
fun testNull() {
MainApp.setStoragePath(null)
assertEquals(-1L, FileOperationsHelper.getAvailableSpaceOnDevice())
}
@Test
fun testNonExistingPath() {
MainApp.setStoragePath("/123/123")
assertEquals(-1L, FileOperationsHelper.getAvailableSpaceOnDevice())
}
@Test
fun testExistingPath() {
MainApp.setStoragePath("/sdcard/")
assertTrue(FileOperationsHelper.getAvailableSpaceOnDevice() > 0L)
}
}
@@ -53,7 +53,7 @@ public class PreviewTextFileFragmentTest extends AbstractIT {
public void displaySimpleTextFile() throws InterruptedException {
FileDisplayActivity sut = activityRule.launchActivity(null);
Thread.sleep(3000);
shortSleep();
File file = new File(FileStorageUtils.getSavePath(account.name) + "/nonEmpty.txt");
OCFile test = new OCFile("/text.md");
@@ -61,7 +61,7 @@ public class PreviewTextFileFragmentTest extends AbstractIT {
test.setStoragePath(file.getAbsolutePath());
sut.startTextPreview(test, false);
Thread.sleep(3000);
shortSleep();
Screenshot.snapActivity(sut).record();
}
@@ -70,7 +70,7 @@ public class PreviewTextFileFragmentTest extends AbstractIT {
public void displayJavaSnippetFile() throws IOException, InterruptedException {
FileDisplayActivity sut = activityRule.launchActivity(null);
Thread.sleep(3000);
shortSleep();
File file = getFile("java.md");
OCFile test = new OCFile("/java.md");
@@ -78,7 +78,7 @@ public class PreviewTextFileFragmentTest extends AbstractIT {
test.setStoragePath(file.getAbsolutePath());
sut.startTextPreview(test, false);
Thread.sleep(3000);
shortSleep();
Screenshot.snapActivity(sut).record();
}
@@ -15,7 +15,7 @@ Eigenschaften:
* Bleiben Sie auf dem Laufenden durch Benachrichtigungen
* Mehrere Konten gleichzeitig
* Geschützter Zugriff durch Fingerabdruck oder PIN
* Integration mit DAVx5 (ehemals DAVdroid) für einfaches Konfigurieren der Kalender- & Kontakte-Synchronisation
* Integration mit DAVx5 (ehemals DAVdroid) für einfaches Konfigurieren der Kalender- & Kontakte-Synchronisierung
Bitte melden Sie alle Probleme unter https://github.com/nextcloud/android/issues oder diskutieren Sie über die App auf https://help.nextcloud.com/c/clients/android
@@ -1,19 +1,19 @@
Zure datuak kontrolpean mantentzen dituen auto-ostatutako produktibitate platafoma.
Zure datuak kontrolpean mantentzen dituen norberak ostatatutako produktibitate plataforma.
Ezaugarriak:
* Interfazea erraza eta modernoa, zure zerbitzariaren gaira egokitzen dena
* Kargatu fitxategiak Nextcloud zerbitzarira
* Partekatu itzazu besteekin
* Mantendu zure gogoko fitxategiak eta karpetak sinkronizatuta
* Bilatu zure zerbitzariako karpeta guztietan
* Bilatu zure zerbitzariko karpeta guztietan
* Kargatu automatikoki zure gailuan ateratako argazkiak eta bideoak
* Egunean egon jakinarazpenen bidez
* Kontu anitzeko laguntza
* Sarbide segurua zure datuetarako hatzmarka edo PINaren bidez
* DAVx5-rekin integratua (lehenago DAVdroid izenarekin ezagutzen dena) egutegiaren konfigurazio erraza konfiguratzeko& Kontaktuen sinkronizazioa
* Hainbat kontu erabili daitezke
* Sarbide segurua zure datuetarako hatz-marka edo PIN bidez
* DAVx5-rekin integratua (lehenago DAVdroid izenarekin ezagutzen zena) egutegia erraz konfiguratzeko eta kontaktuak sinkronizatzeko
Eman arazoen berri https://github.com/nextcloud/android/issues orrian eta eztabaidatu aplikazio hau https://help.nextcloud.com/c/clients/android orrian
Berria Nextcloud-en? Nextcloud fitxategi pribatuen sinkronizazio& partekatua eta komunikazio zerbitzaria da. Software librea da, eta zuk zeuk ostatatu dezakezu edo enpresa bat ordaindu zure ordez ostatatzeko. Horrela, zure argazkiak, zure egutegia eta harremanetarako datuak, zure dokumentuak eta gainerako guztia kontrolatzen dituzu.
Berria Nextcloud-en? Nextcloud fitxategiak sinkronizatu eta partekatzeko eta komunikaziorako zerbitzari pribatu bat da. Software librea da, eta zuk zeuk ostatatu dezakezu edo enpresa bat ordaindu zure ordez ostatatzeko. Horrela, zure argazkiak, zure egutegia eta kontaktuen datuak, zure dokumentuak eta gainerako guztia zuk kontrolatzen dituzu.
Ezagutu Nextcloud https://nextcloud.com helbidean
@@ -1 +1 @@
Kontrolpean mantentzen zaituen norberak ostatutako produktibitate plataforma
Kontrola zuri ematen dizun norberak ostatutako produktibitate plataforma
@@ -1,4 +1,4 @@
Samo-hostująca platforma produkcyjna, która zapewnia kontrolę.
Oprogramowanie biurowe uruchamiane na własnym hostingu, który zapewnia kontrolę.
Funkcje:
* Łatwy, nowoczesny interfejs, dostosowany do wyglądu Twojego serwera
@@ -1 +1 @@
Samo-hostująca platforma produkcyjna, która zapewnia kontrolę
Oprogramowanie biurowe uruchamiane na własnym hostingu, który zapewnia kontrolę
@@ -15,4 +15,5 @@ Características:
Favor informar todos os problemas em https://github.com/nextcloud/android/issues e discutir este aplicativo em https://help.nextcloud.com/c/clients/android
Novo no Nextcloud? Nextcloud é uma sincronização de arquivos privada para compartilhamento & comunicação. É um software livre e você pode hospedá-lo sozinho ou pagar uma empresa para fazer isso por você. Dessa forma, você controla suas fotos, dados de calendário e de contato, documentos e tudo mais.
\ nConsulte Nextcloud em https://nextcloud.com
Consulte Nextcloud em https://nextcloud.com
@@ -0,0 +1,19 @@
Okolje, ki gostuje, kjer vi želite, in vam omogoča nadzor.
Možnosti:
* Enostaven za uporabo in sodoben vmesnik, ki je skladen z vašim strežnikom
* Omogoča nalaganje datotek v oblak Nextcloud
* Omogoča izmenjavo datotek z drugimi
* Ohrani vaše datoteke in mape vedno usklajene
* Podpira iskanje po vseh dodeljenih mapah na strežniku
* Podpira samodejno nalaganje fotografij in videoposnetkov z naprave
* Usklajuje in posreduje obvestila
* Podpora je uporaba več računov
* Zagotavlja varen dostop do podatkov s prstnim odtisom ali kodo PIN
* Izvorno podpira sistem DAVx5 (poznan kot DAVdroid) za enostavno nastavitev usklajevanja koledarja in stikov
Poročila o težavah je mogoče poslati na https://github.com/nextcloud/android/isissue in o programu razpravljati na https://help.nextcloud.com/c/clients/android
Ali šele spoznavate oblak Nextcloud? To je je zasebni strežnik za usklajevanje in sporočanje. Je brezplačna programska oprema, ki jo lahko namestite na svojem strežniku ali gostujete pri številnih ponudnikih. Vedno imate nadzor nad fotografijami, koledarjem in podatki stikov, nad dokumenti in vsem drugim.
Vse o Nextcloud izveste na https://nextcloud.com.
@@ -1,6 +1,6 @@
Платформа за продуктивност коју и Ви можете да хостујете и која Вам даје контролу.
Платформа продуктивности на вашем серверу и под вашом контролом.
Особине:
* Лако и модерно сучеље, потпуно усклађено са темом са сервера
* Лако и модерно сучеље, усклађено са темом на серверу
* Отпремање фајлова на Некстклауд сервер
* Дељење фајлова са другима
* Синхронизација омиљених фајлова и фасцикли
@@ -9,10 +9,10 @@
* Обавештења са сервера
* Подршка за више налога
* Безбедан приступ свим подацима преко отиска прста или пина
* Интеграција са DAVx5-ом (раније знаном и као ДАВдроид) за брзо подешавање синхронизације календара & контаката
* Интеграција са DAVx5 (раније знаном као ДАВдроид) за лако подешавање синхронизације календара и контаката
Све проблеме можете да пријавите на https://github.com/nextcloud/android/issues а о апликацији дискутујте на https://help.nextcloud.com/c/clients/android
Нови сте на Некстклауду? Некстклауд је лични сервер за синхронизацију, дељење фајлова & комуникацију. Потпуно је отвореног кода и можете да га сами хостовати или платити компанији да то ради за Вас. На овај начин, сами контролишете своје слике, календаре, контакте, документа и све остало.
Нови сте на Некстклауду? Некстклауд је лични сервер за синхронизацију, дељење фајлова и комуникацију. То је слободан софтвер и можете га сами поставити на свој сервер или платити компанији да то учини уместо вас. На тај начин, сами контролишете своје слике, календаре, контакте, документа и све остало.
Погледајте Некстклауд на https://nextcloud.com
@@ -1 +1 @@
Платформа за продуктивност коју и Ви можете да хостујете и која Вам даје контрол
Платформа продуктивности под вашом контролом
@@ -14,6 +14,6 @@ Funktioner:
Vänligen rapportera alla problem på https://github.com/nextcloud/android/issues och diskutera denna app på https://help.nextcloud.com/c/clients/android
Ny för Nextcloud? Nextcloud är en privat filsynkronisering& dela och kommunikationsserver. Den är libre-programvara, och du kan vara värd själv eller betala ett företag att göra det åt dig. På så sätt har du kontroll över dina foton, din kalender och kontaktdata, dina dokument och allt annat.
Ny på Nextcloud? Nextcloud är en privat filsynkroniseringsserver& där du även kan dela med dig av dina dokument till andra. Den är libre-programvara och du kan vara välja att vara din egen värd eller betala ett företag att göra det åt dig. På så sätt har du full kontroll över dina foton, din kalender, dina kontakter, dina dokument och allt annat.
Kolla in Nextcloud på https://nextcloud.com
-7
View File
@@ -66,13 +66,6 @@
</intent-filter>
</service>
<service
android:name=".services.firebase.NCFirebaseInstanceIDService">
<intent-filter>
<action android:name="com.google.firebase.INSTANCE_ID_EVENT"/>
</intent-filter>
</service>
<service
android:name="com.evernote.android.job.gcm.PlatformGcmService"
android:enabled="true"
@@ -20,14 +20,15 @@
package com.nextcloud.client.di;
import com.owncloud.android.authentication.ModifiedAuthenticatorActivity;
import com.owncloud.android.services.firebase.NCFirebaseInstanceIDService;
import com.owncloud.android.services.firebase.NCFirebaseMessagingService;
import dagger.Module;
import dagger.android.ContributesAndroidInjector;
@Module
abstract class VariantComponentsModule {
@ContributesAndroidInjector abstract NCFirebaseInstanceIDService ncFirebaseInstanceIDService();
@ContributesAndroidInjector
abstract NCFirebaseMessagingService nCFirebaseMessagingService();
@ContributesAndroidInjector
abstract ModifiedAuthenticatorActivity modifiedAuthenticatorActivity();
@@ -1,55 +0,0 @@
/**
* Nextcloud Android client application
*
* @author Mario Danic
* Copyright (C) 2017 Mario Danic
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.owncloud.android.services.firebase;
import android.text.TextUtils;
import com.google.firebase.iid.FirebaseInstanceId;
import com.google.firebase.iid.FirebaseInstanceIdService;
import com.nextcloud.client.account.UserAccountManager;
import com.nextcloud.client.preferences.AppPreferences;
import com.owncloud.android.R;
import com.owncloud.android.utils.PushUtils;
import javax.inject.Inject;
import dagger.android.AndroidInjection;
public class NCFirebaseInstanceIDService extends FirebaseInstanceIdService {
@Inject AppPreferences preferences;
@Inject UserAccountManager accountManager;
@Override
public void onCreate() {
super.onCreate();
AndroidInjection.inject(this);
}
@Override
public void onTokenRefresh() {
//You can implement this method to store the token on your server
if (!TextUtils.isEmpty(getResources().getString(R.string.push_server_url))) {
preferences.setPushToken(FirebaseInstanceId.getInstance().getToken());
PushUtils.pushRegistrationToServer(accountManager, preferences.getPushToken());
}
}
}
@@ -19,28 +19,56 @@
*/
package com.owncloud.android.services.firebase;
import android.text.TextUtils;
import com.evernote.android.job.JobRequest;
import com.evernote.android.job.util.support.PersistableBundleCompat;
import com.google.firebase.messaging.FirebaseMessagingService;
import com.google.firebase.messaging.RemoteMessage;
import com.nextcloud.client.account.UserAccountManager;
import com.nextcloud.client.preferences.AppPreferences;
import com.owncloud.android.R;
import com.owncloud.android.jobs.NotificationJob;
import com.owncloud.android.utils.PushUtils;
import javax.inject.Inject;
import androidx.annotation.NonNull;
import dagger.android.AndroidInjection;
public class NCFirebaseMessagingService extends FirebaseMessagingService {
@Inject AppPreferences preferences;
@Inject UserAccountManager accountManager;
@Override
public void onMessageReceived(RemoteMessage remoteMessage) {
if (remoteMessage != null && remoteMessage.getData() != null) {
PersistableBundleCompat persistableBundleCompat = new PersistableBundleCompat();
persistableBundleCompat.putString(NotificationJob.KEY_NOTIFICATION_SUBJECT, remoteMessage.getData().get
(NotificationJob.KEY_NOTIFICATION_SUBJECT));
persistableBundleCompat.putString(NotificationJob.KEY_NOTIFICATION_SIGNATURE, remoteMessage.getData().get
(NotificationJob.KEY_NOTIFICATION_SIGNATURE));
new JobRequest.Builder(NotificationJob.TAG)
.addExtras(persistableBundleCompat)
.setUpdateCurrent(false)
.startNow()
.build()
.schedule();
public void onCreate() {
super.onCreate();
AndroidInjection.inject(this);
}
@Override
public void onMessageReceived(@NonNull RemoteMessage remoteMessage) {
remoteMessage.getData();
PersistableBundleCompat persistableBundleCompat = new PersistableBundleCompat();
persistableBundleCompat.putString(NotificationJob.KEY_NOTIFICATION_SUBJECT, remoteMessage.getData().get
(NotificationJob.KEY_NOTIFICATION_SUBJECT));
persistableBundleCompat.putString(NotificationJob.KEY_NOTIFICATION_SIGNATURE, remoteMessage.getData().get
(NotificationJob.KEY_NOTIFICATION_SIGNATURE));
new JobRequest.Builder(NotificationJob.TAG)
.addExtras(persistableBundleCompat)
.setUpdateCurrent(false)
.startNow()
.build()
.schedule();
}
@Override
public void onNewToken(@NonNull String newToken) {
super.onNewToken(newToken);
if (!TextUtils.isEmpty(getResources().getString(R.string.push_server_url))) {
preferences.setPushToken(newToken);
PushUtils.pushRegistrationToServer(accountManager, preferences.getPushToken());
}
}
}
+13
View File
@@ -117,6 +117,19 @@
<intent-filter>
<action android:name="android.intent.action.SEARCH" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="http"
android:host="*"
android:pathPattern="/.*index.php/f/.*"
/>
<data android:scheme="https"
android:host="*"
android:pathPattern="/.*index.php/f/.*"
/>
</intent-filter>
<meta-data android:name="android.app.searchable"
android:resource="@xml/users_and_groups_searchable"/>
</activity>
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

@@ -50,6 +50,7 @@ import org.apache.commons.httpclient.HttpState;
import org.apache.commons.httpclient.NameValuePair;
import org.apache.commons.httpclient.methods.DeleteMethod;
import org.apache.commons.httpclient.methods.GetMethod;
import org.apache.commons.httpclient.methods.HeadMethod;
import org.apache.commons.httpclient.methods.InputStreamRequestEntity;
import org.apache.commons.httpclient.methods.PostMethod;
import org.apache.commons.httpclient.methods.PutMethod;
@@ -297,6 +298,10 @@ public class InputStreamBinder extends IInputStreamService.Stub {
method = new MkColMethod(requestUrl);
break;
case "HEAD":
method = new HeadMethod(requestUrl);
break;
default:
throw new UnsupportedOperationException(EXCEPTION_UNSUPPORTED_METHOD);
@@ -27,14 +27,10 @@ import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.Serializable;
import lombok.Getter;
public class PlainHeader implements Serializable {
private static final long serialVersionUID = 3284979177401282512L;
@Getter
private String name;
@Getter
private String value;
PlainHeader(String name, String value) {
@@ -51,4 +47,12 @@ public class PlainHeader implements Serializable {
name = (String) in.readObject();
value = (String) in.readObject();
}
public String getName() {
return this.name;
}
public String getValue() {
return this.value;
}
}
@@ -30,10 +30,7 @@ import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;
import lombok.Getter;
public class Response {
@Getter
private InputStream body;
private Header[] headers;
@@ -62,4 +59,8 @@ public class Response {
Gson gson = new Gson();
return gson.toJson(arrayList);
}
public InputStream getBody() {
return this.body;
}
}
@@ -2,8 +2,8 @@
* Nextcloud Android client application
*
* @author Chris Narkiewicz <hello@ezaquarii.com>
* Copyright (C) 2019 Chris Narkiewicz
* Copyright (C) 2019 Nextcloud GmbH
* 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
@@ -72,6 +72,10 @@ internal data class AnonymousUser(private val accountType: String) : User, Parce
return user?.accountName.equals(accountName, true)
}
override fun nameEquals(accountName: CharSequence?): Boolean {
return accountName?.toString().equals(this.accountType, true)
}
override fun describeContents() = 0
override fun writeToParcel(dest: Parcel, flags: Int) = with(dest) {
@@ -21,7 +21,7 @@ public interface CurrentAccountProvider {
Account getCurrentAccount();
/**
* Get currently active user profile. If there is no actice user, anonymous user is returned.
* Get currently active user profile. If there is no active user, anonymous user is returned.
*
* @return User profile. Profile is never null.
*/
@@ -63,7 +63,11 @@ internal data class RegisteredUser(
}
override fun nameEquals(user: User?): Boolean {
return user?.accountName.equals(accountName, true)
return nameEquals(user?.accountName)
}
override fun nameEquals(accountName: CharSequence?): Boolean {
return accountName?.toString().equals(this.accountName, true)
}
override fun describeContents() = 0
@@ -2,8 +2,8 @@
* Nextcloud Android client application
*
* @author Chris Narkiewicz <hello@ezaquarii.com>
* Copyright (C) 2019 Chris Narkiewicz
* Copyright (C) 2019 Nextcloud GmbH
* 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
@@ -59,4 +59,11 @@ interface User : Parcelable {
* @return true if account names are same, false otherwise
*/
fun nameEquals(user: User?): Boolean
/**
* Compare account names, case insensitive.
*
* @return true if account names are same, false otherwise
*/
fun nameEquals(accountName: CharSequence?): Boolean
}
@@ -48,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.
*
@@ -81,7 +89,11 @@ public interface UserAccountManager extends CurrentAccountProvider {
boolean exists(Account account);
/**
* Verifies that every account has userId set
* Verifies that every account has userId set and sets the user id if not.
* This migration is idempotent and can be run multiple times until
* all accounts are migrated.
*
* @return true if migration was successful, false if any account failed to be migrated
*/
boolean migrateUserId();
@@ -23,6 +23,9 @@ 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;
@@ -43,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;
@@ -81,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() {
@@ -237,8 +253,7 @@ public class UserAccountManagerImpl implements UserAccountManager {
try {
Account currentPlatformAccount = getCurrentAccount();
return new OwnCloudAccount(currentPlatformAccount, context);
} catch (com.owncloud.android.lib.common.accounts.AccountUtils.AccountNotFoundException |
IllegalArgumentException ex) {
} catch (AccountUtils.AccountNotFoundException | IllegalArgumentException ex) {
return null;
}
}
@@ -276,10 +291,10 @@ public class UserAccountManagerImpl implements UserAccountManager {
public boolean setCurrentOwnCloudAccount(int hashCode) {
boolean result = false;
if (hashCode != 0) {
for (final Account account : getAccounts()) {
if (hashCode == account.hashCode()) {
for (final User user : getAllUsers()) {
if (hashCode == user.hashCode()) {
SharedPreferences.Editor appPrefs = PreferenceManager.getDefaultSharedPreferences(context).edit();
appPrefs.putString(PREF_SELECT_OC_ACCOUNT, account.name);
appPrefs.putString(PREF_SELECT_OC_ACCOUNT, user.getAccountName());
appPrefs.apply();
result = true;
break;
@@ -326,12 +341,11 @@ public class UserAccountManagerImpl implements UserAccountManager {
}
public boolean migrateUserId() {
boolean success = false;
Account[] ocAccounts = accountManager.getAccountsByType(MainApp.getAccountType(context));
String userId;
String displayName;
GetUserInfoRemoteOperation remoteUserNameOperation = new GetUserInfoRemoteOperation();
int failed = 0;
for (Account account : ocAccounts) {
String storedUserId = accountManager.getUserData(account, com.owncloud.android.lib.common.accounts.AccountUtils.Constants.KEY_USER_ID);
@@ -354,10 +368,12 @@ public class UserAccountManagerImpl implements UserAccountManager {
} else {
// skip account, try it next time
Log_OC.e(TAG, "Error while getting username for account: " + account.name);
failed++;
continue;
}
} catch (Exception e) {
Log_OC.e(TAG, "Error while getting username: " + e.getMessage());
failed++;
continue;
}
@@ -367,11 +383,9 @@ public class UserAccountManagerImpl implements UserAccountManager {
accountManager.setUserData(account,
com.owncloud.android.lib.common.accounts.AccountUtils.Constants.KEY_USER_ID,
userId);
success = true;
}
return success;
return failed == 0;
}
private String getAccountType() {
@@ -36,6 +36,8 @@ public interface AppInfo {
*/
String getFormattedVersionCode();
int getVersionCode();
boolean isDebugBuild();
String getAppVersion(Context context);
@@ -33,6 +33,11 @@ class AppInfoImpl implements AppInfo {
return Integer.toString(BuildConfig.VERSION_CODE);
}
@Override
public int getVersionCode() {
return BuildConfig.VERSION_CODE;
}
@Override
public boolean isDebugBuild() {
return BuildConfig.DEBUG;
@@ -25,13 +25,15 @@ import android.app.Application;
import android.app.NotificationManager;
import android.content.ContentResolver;
import android.content.Context;
import android.content.SharedPreferences;
import android.content.res.Resources;
import android.os.Handler;
import android.media.AudioManager;
import android.os.Handler;
import com.nextcloud.client.account.CurrentAccountProvider;
import com.nextcloud.client.account.UserAccountManager;
import com.nextcloud.client.account.UserAccountManagerImpl;
import com.nextcloud.client.appinfo.AppInfo;
import com.nextcloud.client.core.AsyncRunner;
import com.nextcloud.client.core.Clock;
import com.nextcloud.client.core.ClockImpl;
@@ -41,6 +43,10 @@ import com.nextcloud.client.logger.FileLogHandler;
import com.nextcloud.client.logger.Logger;
import com.nextcloud.client.logger.LoggerImpl;
import com.nextcloud.client.logger.LogsRepository;
import com.nextcloud.client.migrations.Migrations;
import com.nextcloud.client.migrations.MigrationsDb;
import com.nextcloud.client.migrations.MigrationsManager;
import com.nextcloud.client.migrations.MigrationsManagerImpl;
import com.nextcloud.client.network.ClientFactory;
import com.owncloud.android.datamodel.ArbitraryDataProvider;
import com.owncloud.android.datamodel.UploadsStorageManager;
@@ -52,6 +58,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 +172,26 @@ class AppModule {
AudioManager audioManager(Context context) {
return (AudioManager)context.getSystemService(Context.AUDIO_SERVICE);
}
@Provides
@Singleton
EventBus eventBus() {
return EventBus.getDefault();
}
@Provides
@Singleton
MigrationsDb migrationsDb(Application application) {
SharedPreferences store = application.getSharedPreferences("migrations", Context.MODE_PRIVATE);
return new MigrationsDb(store);
}
@Provides
@Singleton
MigrationsManager migrationsManager(MigrationsDb migrationsDb,
AppInfo appInfo,
AsyncRunner asyncRunner,
Migrations migrations) {
return new MigrationsManagerImpl(appInfo, migrationsDb, asyncRunner, migrations.getSteps());
}
}
@@ -2,7 +2,7 @@
* Nextcloud Android client application
*
* @author Chris Narkiewicz
* Copyright (C) 2019 Chris Narkiewicz <hello@ezaquarii.com>
* Copyright (C) 2020 Chris Narkiewicz <hello@ezaquarii.com>
*
* 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
@@ -74,6 +74,7 @@ import com.owncloud.android.ui.fragment.LocalFileListFragment;
import com.owncloud.android.ui.fragment.OCFileListFragment;
import com.owncloud.android.ui.fragment.PhotoFragment;
import com.owncloud.android.ui.fragment.contactsbackup.ContactListFragment;
import com.owncloud.android.ui.fragment.contactsbackup.ContactsBackupFragment;
import com.owncloud.android.ui.preview.PreviewImageActivity;
import com.owncloud.android.ui.preview.PreviewImageFragment;
import com.owncloud.android.ui.preview.PreviewMediaFragment;
@@ -138,8 +139,8 @@ abstract class ComponentsModule {
@ContributesAndroidInjector abstract FileDetailSharingFragment fileDetailSharingFragment();
@ContributesAndroidInjector abstract ChooseTemplateDialogFragment chooseTemplateDialogFragment();
@ContributesAndroidInjector
abstract ChooseRichDocumentsTemplateDialogFragment chooseRichDocumentsTemplateDialogFragment();
@ContributesAndroidInjector abstract ChooseRichDocumentsTemplateDialogFragment chooseRichDocumentsTemplateDialogFragment();
@ContributesAndroidInjector abstract ContactsBackupFragment contactsBackupFragment();
@ContributesAndroidInjector abstract PreviewImageFragment previewImageFragment();
@ContributesAndroidInjector abstract ContactListFragment chooseContactListFragment();
@ContributesAndroidInjector abstract PreviewMediaFragment previewMediaFragment();
@@ -2,7 +2,7 @@
* Nextcloud Android client application
*
* @author Chris Narkiewicz
* Copyright (C) 2019 Chris Narkiewicz <hello@ezaquarii.com>
* Copyright (C) 2020 Chris Narkiewicz <hello@ezaquarii.com>
*
* 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
@@ -27,7 +27,14 @@ 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.EtmBackgroundJobsFragment
import com.nextcloud.client.etm.pages.EtmMigrations
import com.nextcloud.client.etm.pages.EtmPreferencesFragment
import com.nextcloud.client.jobs.BackgroundJobManager
import com.nextcloud.client.jobs.JobInfo
import com.nextcloud.client.migrations.MigrationInfo
import com.nextcloud.client.migrations.MigrationsDb
import com.nextcloud.client.migrations.MigrationsManager
import com.owncloud.android.R
import com.owncloud.android.lib.common.accounts.AccountUtils
import javax.inject.Inject
@@ -35,7 +42,10 @@ import javax.inject.Inject
class EtmViewModel @Inject constructor(
private val defaultPreferences: SharedPreferences,
private val platformAccountManager: AccountManager,
private val resources: Resources
private val resources: Resources,
private val backgroundJobManager: BackgroundJobManager,
private val migrationsManager: MigrationsManager,
private val migrationsDb: MigrationsDb
) : ViewModel() {
companion object {
@@ -47,6 +57,11 @@ class EtmViewModel @Inject constructor(
AccountUtils.Constants.KEY_OC_VERSION,
AccountUtils.Constants.KEY_USER_ID
)
const val PAGE_SETTINGS = 0
const val PAGE_ACCOUNTS = 1
const val PAGE_JOBS = 2
const val PAGE_MIGRATIONS = 3
}
/**
@@ -66,6 +81,16 @@ class EtmViewModel @Inject constructor(
iconRes = R.drawable.ic_user,
titleRes = R.string.etm_accounts,
pageClass = EtmAccountsFragment::class
),
EtmMenuEntry(
iconRes = R.drawable.ic_clock,
titleRes = R.string.etm_background_jobs,
pageClass = EtmBackgroundJobsFragment::class
),
EtmMenuEntry(
iconRes = R.drawable.ic_arrow_up,
titleRes = R.string.etm_migrations,
pageClass = EtmMigrations::class
)
)
@@ -86,6 +111,22 @@ class EtmViewModel @Inject constructor(
}
}
val backgroundJobs: LiveData<List<JobInfo>> get() {
return backgroundJobManager.jobs
}
val migrationsInfo: List<MigrationInfo> get() {
return migrationsManager.info
}
val migrationsStatus: MigrationsManager.Status get() {
return migrationsManager.status.value ?: MigrationsManager.Status.UNKNOWN
}
val lastMigratedVersion: Int get() {
return migrationsDb.lastMigratedVersion
}
init {
(currentPage as MutableLiveData).apply {
value = null
@@ -108,4 +149,24 @@ class EtmViewModel @Inject constructor(
false
}
}
fun pruneJobs() {
backgroundJobManager.pruneJobs()
}
fun cancelAllJobs() {
backgroundJobManager.cancelAllJobs()
}
fun startTestJob() {
backgroundJobManager.scheduleTestJob()
}
fun cancelTestJob() {
backgroundJobManager.cancelTestJob()
}
fun clearMigrations() {
migrationsDb.clearMigrations()
}
}
@@ -0,0 +1,145 @@
/*
* Nextcloud Android client application
*
* @author Chris Narkiewicz <hello@ezaquarii.com>
* 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.etm.pages
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 android.widget.TextView
import androidx.lifecycle.Observer
import androidx.recyclerview.widget.DividerItemDecoration
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import com.nextcloud.client.etm.EtmBaseFragment
import com.nextcloud.client.jobs.JobInfo
import com.owncloud.android.R
import java.text.SimpleDateFormat
import java.util.Locale
class EtmBackgroundJobsFragment : EtmBaseFragment() {
class Adapter(private val inflater: LayoutInflater) : RecyclerView.Adapter<Adapter.ViewHolder>() {
class ViewHolder(view: View) : RecyclerView.ViewHolder(view) {
val uuid = view.findViewById<TextView>(R.id.etm_background_job_uuid)
val name = view.findViewById<TextView>(R.id.etm_background_job_name)
val user = view.findViewById<TextView>(R.id.etm_background_job_user)
val state = view.findViewById<TextView>(R.id.etm_background_job_state)
val started = view.findViewById<TextView>(R.id.etm_background_job_started)
val progress = view.findViewById<TextView>(R.id.etm_background_job_progress)
private val progressRow = view.findViewById<View>(R.id.etm_background_job_progress_row)
var progressEnabled: Boolean = progressRow.visibility == View.VISIBLE
get() {
return progressRow.visibility == View.VISIBLE
}
set(value) {
field = value
progressRow.visibility = if (value) {
View.VISIBLE
} else {
View.GONE
}
}
}
private val dateFormat = SimpleDateFormat("YYYY-MM-dd HH:MM:ssZ", Locale.getDefault())
var backgroundJobs: List<JobInfo> = emptyList()
set(value) {
field = value
notifyDataSetChanged()
}
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
val view = inflater.inflate(R.layout.etm_background_job_list_item, parent, false)
return ViewHolder(view)
}
override fun getItemCount(): Int {
return backgroundJobs.size
}
override fun onBindViewHolder(vh: ViewHolder, position: Int) {
val info = backgroundJobs[position]
vh.uuid.text = info.id.toString()
vh.name.text = info.name
vh.user.text = info.user
vh.state.text = info.state
vh.started.text = dateFormat.format(info.started)
if (info.progress >= 0) {
vh.progressEnabled = true
vh.progress.text = info.progress.toString()
} else {
vh.progressEnabled = false
}
}
}
private lateinit var list: RecyclerView
private lateinit var adapter: Adapter
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setHasOptionsMenu(true)
}
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
val view = inflater.inflate(R.layout.fragment_etm_background_jobs, container, false)
adapter = Adapter(inflater)
list = view.findViewById(R.id.etm_background_jobs_list)
list.layoutManager = LinearLayoutManager(context)
list.addItemDecoration(DividerItemDecoration(context, DividerItemDecoration.VERTICAL))
list.adapter = adapter
vm.backgroundJobs.observe(this, Observer { onBackgroundJobsUpdated(it) })
return view
}
override fun onCreateOptionsMenu(menu: Menu, inflater: MenuInflater) {
super.onCreateOptionsMenu(menu, inflater)
inflater.inflate(R.menu.fragment_etm_background_jobs, menu)
}
override fun onOptionsItemSelected(item: MenuItem): Boolean {
return when (item.itemId) {
R.id.etm_background_jobs_cancel -> {
vm.cancelAllJobs(); true
}
R.id.etm_background_jobs_prune -> {
vm.pruneJobs(); true
}
R.id.etm_background_jobs_start_test -> {
vm.startTestJob(); true
}
R.id.etm_background_jobs_cancel_test -> {
vm.cancelTestJob(); true
}
else -> super.onOptionsItemSelected(item)
}
}
private fun onBackgroundJobsUpdated(backgroundJobs: List<JobInfo>) {
adapter.backgroundJobs = backgroundJobs
}
}
@@ -0,0 +1,71 @@
package com.nextcloud.client.etm.pages
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_migrations.*
import java.util.Locale
class EtmMigrations : 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_migrations, container, false)
}
override fun onResume() {
super.onResume()
showStatus()
}
fun showStatus() {
val builder = StringBuilder()
val status = vm.migrationsStatus.toString().toLowerCase(Locale.US)
builder.append("Migration status: $status\n")
val lastMigratedVersion = if (vm.lastMigratedVersion >= 0) {
vm.lastMigratedVersion.toString()
} else {
"never"
}
builder.append("Last migrated version: $lastMigratedVersion\n")
builder.append("Migrations:\n")
vm.migrationsInfo.forEach {
val migrationStatus = if (it.applied) {
"applied"
} else {
"pending"
}
builder.append(" - ${it.id} ${it.description} - $migrationStatus\n")
}
etm_migrations_text.text = builder.toString()
}
override fun onCreateOptionsMenu(menu: Menu, inflater: MenuInflater) {
super.onCreateOptionsMenu(menu, inflater)
inflater.inflate(R.menu.fragment_etm_migrations, menu)
}
override fun onOptionsItemSelected(item: MenuItem): Boolean {
return when (item.itemId) {
R.id.etm_migrations_delete -> {
onDeleteMigrationsClicked(); true
}
else -> super.onOptionsItemSelected(item)
}
}
private fun onDeleteMigrationsClicked() {
vm.clearMigrations()
showStatus()
}
}
@@ -2,7 +2,7 @@
* Nextcloud Android client application
*
* @author Chris Narkiewicz
* Copyright (C) 2019 Chris Narkiewicz <hello@ezaquarii.com>
* Copyright (C) 2020 Chris Narkiewicz <hello@ezaquarii.com>
*
* 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
@@ -21,30 +21,37 @@ package com.nextcloud.client.jobs
import android.content.ContentResolver
import android.content.Context
import android.content.res.Resources
import android.os.Build
import androidx.annotation.RequiresApi
import androidx.work.ListenableWorker
import androidx.work.WorkerFactory
import androidx.work.WorkerParameters
import com.nextcloud.client.account.UserAccountManager
import com.nextcloud.client.core.Clock
import com.nextcloud.client.device.DeviceInfo
import com.nextcloud.client.device.PowerManagementService
import com.nextcloud.client.logger.Logger
import com.nextcloud.client.preferences.AppPreferences
import com.owncloud.android.datamodel.ArbitraryDataProvider
import com.owncloud.android.datamodel.SyncedFolderProvider
import javax.inject.Inject
import javax.inject.Provider
/**
* This factory is responsible for creating all background jobs and for injecting
* all jobs dependencies.
* This factory is responsible for creating all background jobs and for injecting job dependencies.
*/
class BackgroundJobFactory @Inject constructor(
private val logger: Logger,
private val preferences: AppPreferences,
private val contentResolver: ContentResolver,
private val clock: Clock,
private val powerManagerService: PowerManagementService,
private val backgroundJobManager: Provider<BackgroundJobManager>,
private val deviceInfo: DeviceInfo
private val deviceInfo: DeviceInfo,
private val accountManager: UserAccountManager,
private val resources: Resources,
private val dataProvider: ArbitraryDataProvider
) : WorkerFactory() {
override fun createWorker(
@@ -61,12 +68,17 @@ class BackgroundJobFactory @Inject constructor(
return when (workerClass) {
ContentObserverWork::class -> createContentObserverJob(context, workerParameters, clock)
ContactsBackupWork::class -> createContactsBackupWork(context, workerParameters)
ContactsImportWork::class -> createContactsImportWork(context, workerParameters)
else -> null // falls back to default factory
}
}
private fun createContentObserverJob(context: Context, workerParameters: WorkerParameters, clock: Clock):
ListenableWorker? {
private fun createContentObserverJob(
context: Context,
workerParameters: WorkerParameters,
clock: Clock
): ListenableWorker? {
val folderResolver = SyncedFolderProvider(contentResolver, preferences, clock)
@RequiresApi(Build.VERSION_CODES.N)
if (deviceInfo.apiLevel >= Build.VERSION_CODES.N) {
@@ -81,4 +93,24 @@ class BackgroundJobFactory @Inject constructor(
return null
}
}
private fun createContactsBackupWork(context: Context, params: WorkerParameters): ContactsBackupWork {
return ContactsBackupWork(
context,
params,
resources,
dataProvider,
contentResolver,
accountManager
)
}
private fun createContactsImportWork(context: Context, params: WorkerParameters): ContactsImportWork {
return ContactsImportWork(
context,
params,
logger,
contentResolver
)
}
}
@@ -2,7 +2,7 @@
* Nextcloud Android client application
*
* @author Chris Narkiewicz
* Copyright (C) 2019 Chris Narkiewicz <hello@ezaquarii.com>
* Copyright (C) 2020 Chris Narkiewicz <hello@ezaquarii.com>
*
* 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
@@ -21,6 +21,8 @@ package com.nextcloud.client.jobs
import android.os.Build
import androidx.annotation.RequiresApi
import androidx.lifecycle.LiveData
import com.nextcloud.client.account.User
/**
* This interface allows to control, schedule and monitor all application
@@ -28,10 +30,68 @@ import androidx.annotation.RequiresApi
*/
interface BackgroundJobManager {
/**
* Information about all application background jobs.
*/
val jobs: LiveData<List<JobInfo>>
/**
* Start content observer job that monitors changes in media folders
* and launches synchronization when needed.
*
* This call is idempotent - there will be only one scheduled job
* regardless of number of calls.
*/
@RequiresApi(Build.VERSION_CODES.N)
fun scheduleContentObserverJob()
/**
* Schedule periodic contacts backups job. Operating system will
* decide when to start the job.
*
* This call is idempotent - there can be only one scheduled job
* at any given time.
*
* @param user User for which job will be scheduled.
*/
fun schedulePeriodicContactsBackup(user: User)
/**
* Cancel periodic contacts backup. Existing tasks might finish, but no new
* invocations will occur.
*/
fun cancelPeriodicContactsBackup(user: User)
/**
* Immediately start single contacts backup job.
* This job will launch independently from periodic contacts backup.
*
* @return Job info with current status; status is null if job does not exist
*/
fun startImmediateContactsBackup(user: User): LiveData<JobInfo?>
/**
* Immediately start contacts import job. Import job will be started only once.
* If new job is started while existing job is running - request will be ignored
* and currently running job will continue running.
*
* @param contactsAccountName Target contacts account name; null for local contacts
* @param contactsAccountType Target contacts account type; null for local contacts
* @param vCardFilePath Path to file containing all contact entries
* @param selectedContacts List of contact indices to import from [vCardFilePath] file
*
* @return Job info with current status; status is null if job does not exist
*/
fun startImmediateContactsImport(
contactsAccountName: String?,
contactsAccountType: String?,
vCardFilePath: String,
selectedContacts: IntArray
): LiveData<JobInfo?>
fun scheduleTestJob()
fun cancelTestJob()
fun pruneJobs()
fun cancelAllJobs()
}
@@ -2,7 +2,7 @@
* Nextcloud Android client application
*
* @author Chris Narkiewicz
* Copyright (C) 2019 Chris Narkiewicz <hello@ezaquarii.com>
* Copyright (C) 2020 Chris Narkiewicz <hello@ezaquarii.com>
*
* 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
@@ -22,18 +22,173 @@ package com.nextcloud.client.jobs
import android.os.Build
import android.provider.MediaStore
import androidx.annotation.RequiresApi
import androidx.lifecycle.LiveData
import androidx.lifecycle.Transformations
import androidx.work.Constraints
import androidx.work.Data
import androidx.work.ExistingPeriodicWorkPolicy
import androidx.work.ExistingWorkPolicy
import androidx.work.ListenableWorker
import androidx.work.OneTimeWorkRequest
import androidx.work.Operation
import androidx.work.PeriodicWorkRequest
import androidx.work.WorkInfo
import androidx.work.WorkManager
import com.nextcloud.client.account.User
import com.nextcloud.client.core.Clock
import java.util.Date
import java.util.UUID
import java.util.concurrent.TimeUnit
import kotlin.reflect.KClass
internal class BackgroundJobManagerImpl(private val workManager: WorkManager) : BackgroundJobManager {
/**
* Note to maintainers
*
* Since [androidx.work.WorkManager] is missing API to easily attach worker metadata,
* we use tags API to attach our custom metadata.
*
* To create new job request, use [BackgroundJobManagerImpl.oneTimeRequestBuilder] and
* [BackgroundJobManagerImpl.periodicRequestBuilder] calls, instead of calling
* platform builders. Those methods will create builders pre-set with mandatory tags.
*
* Since Google is notoriously releasing new background job services, [androidx.work.WorkManager] API is
* considered private implementation detail and should not be leaked through the interface, to minimize
* potential migration cost in the future.
*/
@Suppress("TooManyFunctions") // we expect this implementation to have rich API
internal class BackgroundJobManagerImpl(
private val workManager: WorkManager,
private val clock: Clock
) : BackgroundJobManager {
companion object {
const val TAG_CONTENT_SYNC = "content_sync"
const val TAG_ALL = "*" // This tag allows us to retrieve list of all jobs run by Nextcloud client
const val JOB_CONTENT_OBSERVER = "content_observer"
const val JOB_PERIODIC_CONTACTS_BACKUP = "periodic_contacts_backup"
const val JOB_IMMEDIATE_CONTACTS_BACKUP = "immediate_contacts_backup"
const val JOB_IMMEDIATE_CONTACTS_IMPORT = "immediate_contacts_import"
const val JOB_TEST = "test_job"
const val MAX_CONTENT_TRIGGER_DELAY_MS = 1500L
const val TAG_PREFIX_NAME = "name"
const val TAG_PREFIX_USER = "user"
const val TAG_PREFIX_START_TIMESTAMP = "timestamp"
val PREFIXES = setOf(TAG_PREFIX_NAME, TAG_PREFIX_USER, TAG_PREFIX_START_TIMESTAMP)
const val NOT_SET_VALUE = "not set"
const val DEFAULT_PERIODIC_JOB_INTERVAL_MINUTES = 15L
const val INTERVAL_SECOND = 1000L
const val INTERVAL_MINUTE = 60L * INTERVAL_SECOND
const val INTERVAL_HOUR = 60 * INTERVAL_MINUTE
const val INTERVAL_24H = 24L * INTERVAL_HOUR
fun formatNameTag(name: String, user: User? = null): String {
return if (user == null) {
"$TAG_PREFIX_NAME:$name"
} else {
"$TAG_PREFIX_NAME:$name ${user.accountName}"
}
}
fun formatUserTag(user: User): String = "$TAG_PREFIX_USER:${user.accountName}"
fun formatTimeTag(startTimestamp: Long): String = "$TAG_PREFIX_START_TIMESTAMP:$startTimestamp"
fun parseTag(tag: String): Pair<String, String>? {
val key = tag.substringBefore(":", "")
val value = tag.substringAfter(":", "")
return if (key in PREFIXES) {
key to value
} else {
null
}
}
fun parseTimestamp(timestamp: String): Date {
try {
val ms = timestamp.toLong()
return Date(ms)
} catch (ex: NumberFormatException) {
return Date(0)
}
}
/**
* Convert platform [androidx.work.WorkInfo] object into application-specific [JobInfo] model.
* Conversion extracts work metadata from tags.
*/
fun fromWorkInfo(info: WorkInfo?): JobInfo? {
return if (info != null) {
val metadata = mutableMapOf<String, String>()
info.tags.forEach { parseTag(it)?.let { metadata[it.first] = it.second } }
val timestamp = parseTimestamp(metadata.get(TAG_PREFIX_START_TIMESTAMP) ?: "0")
JobInfo(
id = info.id,
state = info.state.toString(),
name = metadata.get(TAG_PREFIX_NAME) ?: NOT_SET_VALUE,
user = metadata.get(TAG_PREFIX_USER) ?: NOT_SET_VALUE,
started = timestamp,
progress = info.progress.getInt("progress", -1)
)
} else {
null
}
}
}
/**
* Create [OneTimeWorkRequest.Builder] pre-set with common attributes
*/
private fun oneTimeRequestBuilder(
jobClass: KClass<out ListenableWorker>,
jobName: String,
user: User? = null
): OneTimeWorkRequest.Builder {
val builder = OneTimeWorkRequest.Builder(jobClass.java)
.addTag(TAG_ALL)
.addTag(formatNameTag(jobName, user))
.addTag(formatTimeTag(clock.currentTime))
user?.let { builder.addTag(formatUserTag(it)) }
return builder
}
/**
* Create [PeriodicWorkRequest] pre-set with common attributes
*/
private fun periodicRequestBuilder(
jobClass: KClass<out ListenableWorker>,
jobName: String,
intervalMins: Long = DEFAULT_PERIODIC_JOB_INTERVAL_MINUTES,
user: User? = null
): PeriodicWorkRequest.Builder {
val builder = PeriodicWorkRequest.Builder(jobClass.java, intervalMins, TimeUnit.MINUTES)
.addTag(TAG_ALL)
.addTag(formatNameTag(jobName, user))
.addTag(formatTimeTag(clock.currentTime))
user?.let { builder.addTag(formatUserTag(it)) }
return builder
}
private fun WorkManager.getJobInfo(id: UUID): LiveData<JobInfo?> {
val workInfo = getWorkInfoByIdLiveData(id)
return Transformations.map(workInfo) { fromWorkInfo(it) }
}
/**
* Cancel work using name tag with optional user scope.
* All work instances will be cancelled.
*/
private fun WorkManager.cancelJob(name: String, user: User? = null): Operation {
val tag = formatNameTag(name, user)
return cancelAllWorkByTag(tag)
}
override val jobs: LiveData<List<JobInfo>>
get() {
val workInfo = workManager.getWorkInfosByTagLiveData("*")
return Transformations.map(workInfo) {
it.map { fromWorkInfo(it) ?: JobInfo() }.sortedBy { it.started }.reversed()
}
}
@RequiresApi(Build.VERSION_CODES.N)
override fun scheduleContentObserverJob() {
val constrains = Constraints.Builder()
@@ -44,11 +199,90 @@ internal class BackgroundJobManagerImpl(private val workManager: WorkManager) :
.setTriggerContentMaxDelay(MAX_CONTENT_TRIGGER_DELAY_MS, TimeUnit.MILLISECONDS)
.build()
val request = OneTimeWorkRequest.Builder(ContentObserverWork::class.java)
val request = oneTimeRequestBuilder(ContentObserverWork::class, JOB_CONTENT_OBSERVER)
.setConstraints(constrains)
.addTag(TAG_CONTENT_SYNC)
.build()
workManager.enqueue(request)
workManager.enqueueUniqueWork(JOB_CONTENT_OBSERVER, ExistingWorkPolicy.KEEP, request)
}
override fun schedulePeriodicContactsBackup(user: User) {
val data = Data.Builder()
.putString(ContactsBackupWork.ACCOUNT, user.accountName)
.putBoolean(ContactsBackupWork.FORCE, true)
.build()
val request = periodicRequestBuilder(
ContactsBackupWork::class,
JOB_PERIODIC_CONTACTS_BACKUP,
INTERVAL_24H,
user
).setInputData(data).build()
workManager.enqueueUniquePeriodicWork(JOB_PERIODIC_CONTACTS_BACKUP, ExistingPeriodicWorkPolicy.KEEP, request)
}
override fun cancelPeriodicContactsBackup(user: User) {
workManager.cancelJob(JOB_PERIODIC_CONTACTS_BACKUP, user)
}
override fun startImmediateContactsImport(
contactsAccountName: String?,
contactsAccountType: String?,
vCardFilePath: String,
selectedContacts: IntArray
): LiveData<JobInfo?> {
val data = Data.Builder()
.putString(ContactsImportWork.ACCOUNT_NAME, contactsAccountName)
.putString(ContactsImportWork.ACCOUNT_TYPE, contactsAccountType)
.putString(ContactsImportWork.VCARD_FILE_PATH, vCardFilePath)
.putIntArray(ContactsImportWork.SELECTED_CONTACTS_INDICES, selectedContacts)
.build()
val constraints = Constraints.Builder()
.setRequiresCharging(false)
.build()
val request = oneTimeRequestBuilder(ContactsImportWork::class, JOB_IMMEDIATE_CONTACTS_IMPORT)
.setInputData(data)
.setConstraints(constraints)
.build()
workManager.enqueueUniqueWork(JOB_IMMEDIATE_CONTACTS_IMPORT, ExistingWorkPolicy.KEEP, request)
return workManager.getJobInfo(request.id)
}
override fun startImmediateContactsBackup(user: User): LiveData<JobInfo?> {
val data = Data.Builder()
.putString(ContactsBackupWork.ACCOUNT, user.accountName)
.putBoolean(ContactsBackupWork.FORCE, true)
.build()
val request = oneTimeRequestBuilder(ContactsBackupWork::class, JOB_IMMEDIATE_CONTACTS_BACKUP, user)
.setInputData(data)
.build()
workManager.enqueueUniqueWork(JOB_IMMEDIATE_CONTACTS_BACKUP, ExistingWorkPolicy.KEEP, request)
return workManager.getJobInfo(request.id)
}
override fun scheduleTestJob() {
val request = periodicRequestBuilder(TestJob::class, JOB_TEST)
.build()
workManager.enqueueUniquePeriodicWork(JOB_TEST, ExistingPeriodicWorkPolicy.KEEP, request)
}
override fun cancelTestJob() {
workManager.cancelAllWorkByTag(formatNameTag(JOB_TEST))
}
override fun pruneJobs() {
workManager.pruneWork()
}
override fun cancelAllJobs() {
workManager.cancelAllWorkByTag(TAG_ALL)
}
}
@@ -0,0 +1,260 @@
/*
* Nextcloud Android client application
*
* @author Chris Narkiewicz
* Copyright (C) 2020 Chris Narkiewicz <hello@ezaquarii.com>
*
* 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.jobs
import android.content.ComponentName
import android.content.ContentResolver
import android.content.Context
import android.content.Intent
import android.content.ServiceConnection
import android.content.res.Resources
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 androidx.work.Worker
import androidx.work.WorkerParameters
import com.nextcloud.client.account.User
import com.nextcloud.client.account.UserAccountManager
import com.owncloud.android.R
import com.owncloud.android.datamodel.ArbitraryDataProvider
import com.owncloud.android.datamodel.FileDataStorageManager
import com.owncloud.android.datamodel.OCFile
import com.owncloud.android.files.services.FileUploader
import com.owncloud.android.lib.common.utils.Log_OC
import com.owncloud.android.operations.UploadFileOperation
import com.owncloud.android.services.OperationsService
import com.owncloud.android.services.OperationsService.OperationsServiceBinder
import com.owncloud.android.ui.activity.ContactsPreferenceActivity
import ezvcard.Ezvcard
import ezvcard.VCardVersion
import java.io.File
import java.io.FileWriter
import java.io.IOException
import java.io.InputStream
import java.io.InputStreamReader
import java.util.ArrayList
import java.util.Calendar
class ContactsBackupWork(
appContext: Context,
params: WorkerParameters,
private val resources: Resources,
private val arbitraryDataProvider: ArbitraryDataProvider,
private val contentResolver: ContentResolver,
private val accountManager: UserAccountManager
) : Worker(appContext, params) {
companion object {
val TAG = ContactsBackupWork::class.java.simpleName
const val ACCOUNT = "account"
const val FORCE = "force"
const val JOB_INTERVAL_MS: Long = 24 * 60 * 60 * 1000
const val BUFFER_SIZE = 1024
}
private var operationsServiceConnection: OperationsServiceConnection? = null
private var operationsServiceBinder: OperationsServiceBinder? = null
@Suppress("ReturnCount") // pre-existing issue
override fun doWork(): Result {
val accountName = inputData.getString(ACCOUNT) ?: ""
if (TextUtils.isEmpty(accountName)) { // no account provided
return Result.failure()
}
val optionalUser = accountManager.getUser(accountName)
if (!optionalUser.isPresent) {
return Result.failure()
}
val user = optionalUser.get()
val lastExecution = arbitraryDataProvider.getLongValue(user.toPlatformAccount(),
ContactsPreferenceActivity.PREFERENCE_CONTACTS_LAST_BACKUP)
val force = inputData.getBoolean(FORCE, false)
if (force || lastExecution + JOB_INTERVAL_MS < Calendar.getInstance().timeInMillis) {
Log_OC.d(TAG, "start contacts backup job")
val backupFolder: String = resources.getString(R.string.contacts_backup_folder) + OCFile.PATH_SEPARATOR
val daysToExpire: Int = applicationContext.getResources().getInteger(R.integer.contacts_backup_expire)
backupContact(user, backupFolder)
// bind to Operations Service
operationsServiceConnection = OperationsServiceConnection(
this,
daysToExpire,
backupFolder,
user
)
applicationContext.bindService(
Intent(applicationContext, OperationsService::class.java),
operationsServiceConnection as OperationsServiceConnection,
OperationsService.BIND_AUTO_CREATE
)
// store execution date
arbitraryDataProvider.storeOrUpdateKeyValue(
user.accountName,
ContactsPreferenceActivity.PREFERENCE_CONTACTS_LAST_BACKUP,
Calendar.getInstance().timeInMillis
)
} else {
Log_OC.d(TAG, "last execution less than 24h ago")
}
return Result.success()
}
private fun backupContact(user: User, backupFolder: String) {
val vCard = ArrayList<String>()
val cursor = contentResolver.query(ContactsContract.Contacts.CONTENT_URI, null,
null, null, null)
if (cursor != null && cursor.count > 0) {
cursor.moveToFirst()
for (i in 0 until cursor.count) {
vCard.add(getContactFromCursor(cursor))
cursor.moveToNext()
}
}
val filename = DateFormat.format("yyyy-MM-dd_HH-mm-ss", Calendar.getInstance()).toString() + ".vcf"
Log_OC.d(TAG, "Storing: $filename")
val file = File(applicationContext.getCacheDir(), filename)
var fw: FileWriter? = null
try {
fw = FileWriter(file)
for (card in vCard) {
fw.write(card)
}
} catch (e: IOException) {
Log_OC.d(TAG, "Error ", e)
} finally {
cursor?.close()
if (fw != null) {
try {
fw.close()
} catch (e: IOException) {
Log_OC.d(TAG, "Error closing file writer ", e)
}
}
}
FileUploader.uploadNewFile(
applicationContext,
user.toPlatformAccount(),
file.absolutePath,
backupFolder + filename,
FileUploader.LOCAL_BEHAVIOUR_MOVE,
null,
true,
UploadFileOperation.CREATED_BY_USER,
false,
false,
FileUploader.NameCollisionPolicy.ASK_USER
)
}
private fun expireFiles(daysToExpire: Int, backupFolderString: String, account: User) { // -1 disables expiration
if (daysToExpire > -1) {
val storageManager = FileDataStorageManager(account.toPlatformAccount(),
applicationContext.getContentResolver())
val backupFolder: OCFile = storageManager.getFileByPath(backupFolderString)
val cal = Calendar.getInstance()
cal.add(Calendar.DAY_OF_YEAR, -daysToExpire)
val timestampToExpire = cal.timeInMillis
if (backupFolder != null) {
Log_OC.d(TAG, "expire: " + daysToExpire + " " + backupFolder.fileName)
}
val backups: List<OCFile> = storageManager.getFolderContent(backupFolder, false)
for (backup in backups) {
if (timestampToExpire > backup.modificationTimestamp) {
Log_OC.d(TAG, "delete " + backup.remotePath)
// delete backups
val service = Intent(applicationContext, OperationsService::class.java)
service.action = OperationsService.ACTION_REMOVE
service.putExtra(OperationsService.EXTRA_ACCOUNT, account)
service.putExtra(OperationsService.EXTRA_REMOTE_PATH, backup.remotePath)
service.putExtra(OperationsService.EXTRA_REMOVE_ONLY_LOCAL, false)
operationsServiceBinder!!.queueNewOperation(service)
}
}
}
operationsServiceConnection?.let {
applicationContext.unbindService(it)
}
}
@Suppress("NestedBlockDepth")
private fun getContactFromCursor(cursor: Cursor): String {
val lookupKey = cursor.getString(cursor.getColumnIndex(ContactsContract.Contacts.LOOKUP_KEY))
val uri = Uri.withAppendedPath(ContactsContract.Contacts.CONTENT_VCARD_URI, lookupKey)
var vCard = ""
var inputStream: InputStream? = null
var inputStreamReader: InputStreamReader? = null
try {
inputStream = applicationContext.getContentResolver().openInputStream(uri)
val buffer = CharArray(BUFFER_SIZE)
val stringBuilder = StringBuilder()
if (inputStream != null) {
inputStreamReader = InputStreamReader(inputStream)
while (true) {
val byteCount = inputStreamReader.read(buffer, 0, buffer.size)
if (byteCount > 0) {
stringBuilder.append(buffer, 0, byteCount)
} else {
break
}
}
}
vCard = stringBuilder.toString()
// 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 (e: IOException) {
Log_OC.d(TAG, e.message)
} finally {
try {
inputStream?.close()
inputStreamReader?.close()
} catch (e: IOException) {
Log_OC.e(TAG, "failed to close stream")
}
}
return vCard
}
/**
* Implements callback methods for service binding.
*/
private class OperationsServiceConnection internal constructor(
private val worker: ContactsBackupWork,
private val daysToExpire: Int,
private val backupFolder: String,
private val user: User
) : ServiceConnection {
override fun onServiceConnected(component: ComponentName, service: IBinder) {
Log_OC.d(TAG, "service connected")
if (component == ComponentName(worker.applicationContext, OperationsService::class.java)) {
worker.operationsServiceBinder = service as OperationsServiceBinder
worker.expireFiles(daysToExpire, backupFolder, user)
}
}
override fun onServiceDisconnected(component: ComponentName) {
Log_OC.d(TAG, "service disconnected")
if (component == ComponentName(worker.applicationContext, OperationsService::class.java)) {
worker.operationsServiceBinder = null
}
}
}
}
@@ -0,0 +1,128 @@
/*
* Nextcloud Android client application
*
* @author Tobias Kaminsky
* Copyright (C) 2017 Tobias Kaminsky
* Copyright (C) 2017 Nextcloud GmbH.
* Copyright (C) 2020 Chris Narkiewicz <hello@ezaquarii.com>
*
* 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.jobs
import android.content.ContentResolver
import android.content.Context
import android.database.Cursor
import android.net.Uri
import android.provider.ContactsContract
import androidx.work.Worker
import androidx.work.WorkerParameters
import com.nextcloud.client.logger.Logger
import com.owncloud.android.ui.fragment.contactsbackup.ContactListFragment
import com.owncloud.android.ui.fragment.contactsbackup.ContactListFragment.VCardComparator
import ezvcard.Ezvcard
import ezvcard.VCard
import third_parties.ezvcard_android.ContactOperations
import java.io.File
import java.io.IOException
import java.util.ArrayList
import java.util.Collections
import java.util.TreeMap
class ContactsImportWork(
appContext: Context,
params: WorkerParameters,
private val logger: Logger,
private val contentResolver: ContentResolver
) : Worker(appContext, params) {
companion object {
const val TAG = "ContactsImportWork"
const val ACCOUNT_TYPE = "account_type"
const val ACCOUNT_NAME = "account_name"
const val VCARD_FILE_PATH = "vcard_file_path"
const val SELECTED_CONTACTS_INDICES = "selected_contacts_indices"
}
override fun doWork(): Result {
val vCardFilePath = inputData.getString(VCARD_FILE_PATH) ?: ""
val contactsAccountName = inputData.getString(ACCOUNT_NAME)
val contactsAccountType = inputData.getString(ACCOUNT_TYPE)
val selectedContactsIndices = inputData.getIntArray(SELECTED_CONTACTS_INDICES) ?: IntArray(0)
val file = File(vCardFilePath)
val vCards = ArrayList<VCard>()
var cursor: Cursor? = null
try {
val operations = ContactOperations(applicationContext, contactsAccountName, contactsAccountType)
vCards.addAll(Ezvcard.parse(file).all())
Collections.sort(vCards, VCardComparator())
cursor = contentResolver.query(
ContactsContract.Contacts.CONTENT_URI,
null,
null,
null,
null
)
val ownContactMap = TreeMap<VCard, Long?>(VCardComparator())
if (cursor != null && cursor.count > 0) {
cursor.moveToFirst()
for (i in 0 until cursor.count) {
val vCard = getContactFromCursor(cursor)
if (vCard != null) {
ownContactMap[vCard] = cursor.getLong(cursor.getColumnIndex("NAME_RAW_CONTACT_ID"))
}
cursor.moveToNext()
}
}
for (contactIndex in selectedContactsIndices) {
val vCard = vCards[contactIndex]
if (ContactListFragment.getDisplayName(vCard).isEmpty()) {
if (!ownContactMap.containsKey(vCard)) {
operations.insertContact(vCard)
} else {
operations.updateContact(vCard, ownContactMap[vCard])
}
} else {
operations.insertContact(vCard) // Insert All the contacts without name
}
}
} catch (e: Exception) {
logger.e(TAG, "${e.message}", e)
} finally {
cursor?.close()
}
return Result.success()
}
private fun getContactFromCursor(cursor: Cursor): VCard? {
val lookupKey = cursor.getString(cursor.getColumnIndex(ContactsContract.Contacts.LOOKUP_KEY))
val uri = Uri.withAppendedPath(ContactsContract.Contacts.CONTENT_VCARD_URI, lookupKey)
var vCard: VCard? = null
try {
contentResolver.openInputStream(uri).use { inputStream ->
val vCardList = ArrayList<VCard>()
vCardList.addAll(Ezvcard.parse(inputStream).all())
if (vCardList.size > 0) {
vCard = vCardList[0]
}
}
} catch (e: IOException) {
logger.d(TAG, "${e.message}")
}
return vCard
}
}
@@ -0,0 +1,32 @@
/*
* Nextcloud Android client application
*
* @author Chris Narkiewicz
* Copyright (C) 2020 Chris Narkiewicz <hello@ezaquarii.com>
*
* 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.jobs
import java.util.Date
import java.util.UUID
data class JobInfo(
val id: UUID = UUID.fromString("00000000-0000-0000-0000-000000000000"),
val state: String = "",
val name: String = "",
val user: String = "",
val started: Date = Date(0),
val progress: Int = 0
)
@@ -2,7 +2,7 @@
* Nextcloud Android client application
*
* @author Chris Narkiewicz
* Copyright (C) 2019 Chris Narkiewicz <hello@ezaquarii.com>
* Copyright (C) 2020 Chris Narkiewicz <hello@ezaquarii.com>
*
* 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
@@ -23,6 +23,7 @@ import android.content.Context
import android.content.ContextWrapper
import androidx.work.Configuration
import androidx.work.WorkManager
import com.nextcloud.client.core.Clock
import dagger.Module
import dagger.Provides
import javax.inject.Singleton
@@ -32,7 +33,7 @@ class JobsModule {
@Provides
@Singleton
fun backgroundJobManager(context: Context, factory: BackgroundJobFactory): BackgroundJobManager {
fun workManager(context: Context, factory: BackgroundJobFactory): WorkManager {
val configuration = Configuration.Builder()
.setWorkerFactory(factory)
.build()
@@ -44,7 +45,12 @@ class JobsModule {
}
WorkManager.initialize(contextWrapper, configuration)
val wm = WorkManager.getInstance(context)
return BackgroundJobManagerImpl(wm)
return WorkManager.getInstance(context)
}
@Provides
@Singleton
fun backgroundJobManager(workManager: WorkManager, clock: Clock): BackgroundJobManager {
return BackgroundJobManagerImpl(workManager, clock)
}
}
@@ -0,0 +1,48 @@
/*
* Nextcloud Android client application
*
* @author Chris Narkiewicz
* Copyright (C) 2020 Chris Narkiewicz <hello@ezaquarii.com>
*
* 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.jobs
import android.content.Context
import androidx.work.Data
import androidx.work.Worker
import androidx.work.WorkerParameters
class TestJob(
appContext: Context,
params: WorkerParameters
) : Worker(appContext, params) {
companion object {
private const val MAX_PROGRESS = 100
private const val DELAY_MS = 1000L
private const val PROGRESS_KEY = "progress"
}
override fun doWork(): Result {
for (i in 0..MAX_PROGRESS) {
Thread.sleep(DELAY_MS)
val progress = Data.Builder()
.putInt(PROGRESS_KEY, i)
.build()
setProgressAsync(progress)
}
return Result.success()
}
}
@@ -0,0 +1,24 @@
/*
* Nextcloud Android client application
*
* @author Chris Narkiewicz
* Copyright (C) 2020 Chris Narkiewicz <hello@ezaquarii.com>
*
* 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.migrations
class MigrationError(val id: Int, message: String, cause: Throwable?) : RuntimeException(message, cause) {
constructor(id: Int, message: String) : this(id, message, null)
}
@@ -0,0 +1,22 @@
/*
* Nextcloud Android client application
*
* @author Chris Narkiewicz
* Copyright (C) 2020 Chris Narkiewicz <hello@ezaquarii.com>
*
* 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.migrations
data class MigrationInfo(val id: Int, val description: String, val applied: Boolean)
@@ -0,0 +1,131 @@
/*
* Nextcloud Android client application
*
* @author Chris Narkiewicz
* Copyright (C) 2020 Chris Narkiewicz <hello@ezaquarii.com>
*
* 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.migrations
import android.os.Build
import androidx.work.WorkManager
import com.nextcloud.client.account.UserAccountManager
import com.nextcloud.client.jobs.BackgroundJobManager
import com.nextcloud.client.logger.Logger
import com.owncloud.android.datamodel.ArbitraryDataProvider
import com.owncloud.android.ui.activity.ContactsPreferenceActivity
import javax.inject.Inject
/**
* This class collects all migration steps and provides API to supply those
* steps to [MigrationsManager] for execution.
*/
class Migrations @Inject constructor(
private val logger: Logger,
private val userAccountManager: UserAccountManager,
private val workManager: WorkManager,
private val arbitraryDataProvider: ArbitraryDataProvider,
private val jobManager: BackgroundJobManager
) {
companion object {
val TAG = Migrations::class.java.simpleName
}
/**
* This class wraps migration logic with some metadata with some
* metadata required to register and log overall migration progress.
*
* @param id Step id; id must be unique; this is verified upon registration
* @param description Human readable migration step descriptionsss
* @param mandatory If true, failing migration will cause an exception; if false, it will be skipped and repeated
* again on next startup
* @throws Exception migration logic is permitted to throw any kind of exceptions; all exceptions will be wrapped
* into [MigrationException]
*/
abstract class Step(val id: Int, val description: String, val mandatory: Boolean = true) : Runnable
/**
* Migrate legacy accounts by addming user IDs. This migration can be re-tried until all accounts are
* successfully migrated.
*/
private val migrateUserId = object : Step(0, "Migrate user id", false) {
override fun run() {
val allAccountsHaveUserId = userAccountManager.migrateUserId()
logger.i(TAG, "$description: success = $allAccountsHaveUserId")
if (!allAccountsHaveUserId) {
throw IllegalStateException("Failed to set user id for all accounts")
}
}
}
/**
* Content observer job must be restarted to use new scheduler abstraction.
*/
private val migrateContentObserverJob = object : Step(1, "Migrate content observer job", false) {
override fun run() {
val legacyWork = workManager.getWorkInfosByTag("content_sync").get()
legacyWork.forEach {
logger.i(TAG, "$description: cancelling legacy work ${it.id}")
workManager.cancelWorkById(it.id)
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
jobManager.scheduleContentObserverJob()
logger.i(TAG, "$description: enabled")
} else {
logger.i(TAG, "$description: disabled")
}
}
}
/**
* Contacts backup job has been migrated to new job runner framework. Re-start contacts upload
* for all users that have it enabled.
*
* Old job is removed from source code, so we need to restart it for each user using
* new jobs API.
*/
private val migrateContactsBackupJob = object : Step(2, "Restart contacts backup job") {
override fun run() {
val users = userAccountManager.allUsers
if (users.isEmpty()) {
logger.i(TAG, "$description: no users to migrate")
} else {
users.forEach {
val backupEnabled = arbitraryDataProvider.getBooleanValue(it.accountName,
ContactsPreferenceActivity.PREFERENCE_CONTACTS_AUTOMATIC_BACKUP)
if (backupEnabled) {
jobManager.schedulePeriodicContactsBackup(it)
}
logger.i(TAG, "$description: user = ${it.accountName}, backup enabled = $backupEnabled")
}
}
}
}
/**
* List of migration steps. Those steps will be loaded and run by [MigrationsManager]
*/
val steps: List<Step> = listOf(
migrateUserId,
migrateContentObserverJob,
migrateContactsBackupJob
).sortedBy { it.id }.apply {
val uniqueIds = associateBy { it.id }.size
if (uniqueIds != size) {
throw IllegalStateException("All migrations must have unique id")
}
}
}
@@ -0,0 +1,85 @@
/*
* Nextcloud Android client application
*
* @author Chris Narkiewicz
* Copyright (C) 2020 Chris Narkiewicz <hello@ezaquarii.com>
*
* 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.migrations
import android.content.SharedPreferences
import java.util.TreeSet
class MigrationsDb(private val migrationsDb: SharedPreferences) {
companion object {
const val DB_KEY_LAST_MIGRATED_VERSION = "last_migrated_version"
const val DB_KEY_APPLIED_MIGRATIONS = "applied_migrations"
const val DB_KEY_FAILED = "failed"
const val DB_KEY_FAILED_MIGRATION_ID = "failed_migration_id"
const val DB_KEY_FAILED_MIGRATION_ERROR_MESSAGE = "failed_migration_error"
const val NO_LAST_MIGRATED_VERSION = -1
const val NO_FAILED_MIGRATION_ID = -1
}
fun getAppliedMigrations(): List<Int> {
val appliedIdsStr: Set<String> = migrationsDb.getStringSet(DB_KEY_APPLIED_MIGRATIONS, null) ?: TreeSet()
return appliedIdsStr.mapNotNull {
try {
it.toInt()
} catch (_: NumberFormatException) {
null
}
}.sorted()
}
fun addAppliedMigration(vararg migrations: Int) {
val oldApplied = migrationsDb.getStringSet(DB_KEY_APPLIED_MIGRATIONS, null) ?: TreeSet()
val newApplied = TreeSet<String>().apply {
addAll(oldApplied)
addAll(migrations.map { it.toString() })
}
migrationsDb.edit().putStringSet(DB_KEY_APPLIED_MIGRATIONS, newApplied).apply()
}
var lastMigratedVersion: Int
set(value) {
migrationsDb.edit().putInt(DB_KEY_LAST_MIGRATED_VERSION, value).apply()
}
get() {
return migrationsDb.getInt(DB_KEY_LAST_MIGRATED_VERSION, NO_LAST_MIGRATED_VERSION)
}
val isFailed: Boolean get() = migrationsDb.getBoolean(DB_KEY_FAILED, false)
val failureReason: String get() = migrationsDb.getString(DB_KEY_FAILED_MIGRATION_ERROR_MESSAGE, "") ?: ""
val failedMigrationId: Int get() = migrationsDb.getInt(DB_KEY_FAILED_MIGRATION_ID, NO_FAILED_MIGRATION_ID)
fun setFailed(id: Int, error: String) {
migrationsDb
.edit()
.putBoolean(DB_KEY_FAILED, true)
.putString(DB_KEY_FAILED_MIGRATION_ERROR_MESSAGE, error)
.putInt(DB_KEY_FAILED_MIGRATION_ID, id)
.apply()
}
fun clearMigrations() {
migrationsDb.edit()
.putStringSet(DB_KEY_APPLIED_MIGRATIONS, emptySet())
.putInt(DB_KEY_LAST_MIGRATED_VERSION, 0)
.apply()
}
}
@@ -0,0 +1,77 @@
/*
* Nextcloud Android client application
*
* @author Chris Narkiewicz
* Copyright (C) 2020 Chris Narkiewicz <hello@ezaquarii.com>
*
* 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.migrations
import androidx.annotation.MainThread
import androidx.lifecycle.LiveData
/**
* This component allows starting and monitoring of application state migrations.
* Migrations are intended to upgrade any existing, persisted application state
* after upgrade to new version, similarly to database migrations.
*/
interface MigrationsManager {
enum class Status {
/**
* Application migration was not evaluated yet. This is the default
* state just after [android.app.Application] start
*/
UNKNOWN,
/**
* All migrations applied successfully.
*/
APPLIED,
/**
* Migration in progress.
*/
RUNNING,
/**
* Migration failed. Application is in undefined state.
*/
FAILED
}
/**
* Listenable migration progress.
*/
val status: LiveData<Status>
/**
* Information about all pending and applied migrations
*/
val info: List<MigrationInfo>
/**
* Starts application state migration. Migrations will be run in background thread.
* Callers can use [status] to monitor migration progress.
*
* Although the migration process is run in background, status is updated
* immediately and can be accessed immediately after start.
*
* @return Number of migration steps enqueued; 0 if no migrations were started.
*/
@Throws(MigrationError::class)
@MainThread
fun startMigration(): Int
}
Loaded 100 of 418 files, more files were not shown because too many files have changed in this diff. Show more