Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
001cbdf25f | ||
|
|
7fd8724473 | ||
|
|
79864037e4 | ||
|
|
132431b6ce | ||
|
|
a8ccc283f2 | ||
|
|
ed9e427ed0 | ||
|
|
120f940a7a | ||
|
|
e516bda462 | ||
|
|
4ec71da7a1 | ||
|
|
ecbb64bbba | ||
|
|
c1092d15c4 | ||
|
|
aee16ec64a | ||
|
|
770369477a | ||
|
|
3010bb2977 | ||
|
|
a4f3268074 | ||
|
|
a57f8eb989 | ||
|
|
545197d68c | ||
|
|
7ab9e73e13 | ||
|
|
cfae25c137 | ||
|
|
7f9bc4b948 | ||
|
|
a38edb92dd | ||
|
|
c5a06b7225 | ||
|
|
611a3a221b | ||
|
|
5b44ea2408 | ||
|
|
9a1dfc1627 | ||
|
|
556982ad8b | ||
|
|
27dd912bff | ||
|
|
8f4ec8da18 | ||
|
|
7a003bcdab | ||
|
|
5e6e3d4800 | ||
|
|
ede8995e3b | ||
|
|
aa415e6b55 | ||
|
|
f1cb45ab30 | ||
|
|
3e6c9627d1 | ||
|
|
d8fe4cc0a0 | ||
|
|
2866bc3898 | ||
|
|
ab692d92a7 | ||
|
|
6c176c4802 | ||
|
|
a621e29f18 | ||
|
|
70daf0b327 | ||
|
|
9025f6c3ac | ||
|
|
c94311a069 | ||
|
|
8a59cd9c87 | ||
|
|
e78893b1f8 | ||
|
|
00fa174b38 | ||
|
|
7398e64eec | ||
|
|
4d746a0176 | ||
|
|
81799410be | ||
|
|
a057dafab3 | ||
|
|
bd67dd238e | ||
|
|
eaf9f0ca80 | ||
|
|
77d0b06105 | ||
|
|
d98427fdc1 | ||
|
|
e5d9b75b4d | ||
|
|
865a59336b | ||
|
|
6517be09df | ||
|
|
50e0cef895 | ||
|
|
f134cf4cd3 | ||
|
|
bf3a6fb0c3 | ||
|
|
7baa1aa697 | ||
|
|
c6610937f7 | ||
|
|
336c5c84c4 | ||
|
|
7ad1cce4df | ||
|
|
0d90e0a94b | ||
|
|
3fc5be9b07 | ||
|
|
85a43e838e | ||
|
|
f7e629da86 | ||
|
|
131373f066 | ||
|
|
f3f14bfcc4 | ||
|
|
33fa8283cf | ||
|
|
7e1cb0f0df | ||
|
|
6343afb38d | ||
|
|
6a65298699 | ||
|
|
194ca7885c | ||
|
|
fb3957423f | ||
|
|
47689c938c | ||
|
|
4121cd9e50 | ||
|
|
6ab58b7b1a | ||
|
|
aa897677ac | ||
|
|
f6fbfbd4c5 | ||
|
|
9f5db12d13 | ||
|
|
a35a6a3417 | ||
|
|
fa30776100 | ||
|
|
6d39f4963c | ||
|
|
0793f23c0d | ||
|
|
ca1d671707 | ||
|
|
03a1c31a86 | ||
|
|
052df0f42c | ||
|
|
7b1efc7505 | ||
|
|
63284e3aa5 | ||
|
|
7aeb5e7a9e | ||
|
|
8591733fa6 | ||
|
|
7039208461 | ||
|
|
5eba647fb5 | ||
|
|
337ca8393b | ||
|
|
92d3b9c55b | ||
|
|
95e4e8a7a0 | ||
|
|
6b902c68bf | ||
|
|
4c44358c0f | ||
|
|
a1700664d2 | ||
|
|
9c468b3b9f | ||
|
|
d0266cf6e0 | ||
|
|
585a850a54 | ||
|
|
be4efff7b6 | ||
|
|
9190c3afba | ||
|
|
5589d5eaa1 | ||
|
|
b19ee307c9 | ||
|
|
dc27330264 | ||
|
|
f9813bcdcb | ||
|
|
c006691de8 | ||
|
|
3e062a7f8c | ||
|
|
6863a8a637 | ||
|
|
b669fa14ad | ||
|
|
c2182deddf | ||
|
|
f25d85a33e | ||
|
|
17d2cec881 | ||
|
|
4bd14b34b0 | ||
|
|
ee14d7e135 | ||
|
|
8090cd0e13 | ||
|
|
44972891c9 | ||
|
|
00c14377f7 | ||
|
|
31d515c66c | ||
|
|
f4597d879a | ||
|
|
b23f7b9750 | ||
|
|
ed87079885 | ||
|
|
238c7d610d | ||
|
|
3f176674b2 | ||
|
|
cfa12f3c59 | ||
|
|
d46dfa8ded | ||
|
|
c521a875ae | ||
|
|
e4d06418ce | ||
|
|
27b808d8cd | ||
|
|
eceb3a13d4 | ||
|
|
cd10e2db15 | ||
|
|
0e71f05931 | ||
|
|
4a5fc357c8 | ||
|
|
8f176cb46f | ||
|
|
e6074c918f | ||
|
|
d2df21af34 | ||
|
|
299fb77f15 | ||
|
|
5f652ba81c | ||
|
|
edf693ce7d | ||
|
|
38b84562ad | ||
|
|
97e958f7f5 | ||
|
|
17a26ba3ef | ||
|
|
a75dde5283 | ||
|
|
e6a63f8445 | ||
|
|
55bdbc1f55 | ||
|
|
c23ffe93a6 | ||
|
|
7eff86cd3d | ||
|
|
947d0c5115 | ||
|
|
709ee086a1 | ||
|
|
dd46ce928c | ||
|
|
6ca7c9d05f | ||
|
|
b3d499a8fc | ||
|
|
5b2398bf0c | ||
|
|
8b0a8b27ac | ||
|
|
1e84999b35 | ||
|
|
08b2b481fe | ||
|
|
7f995726b3 | ||
|
|
e86ee266d6 | ||
|
|
a4ad5848ff | ||
|
|
f13ebd3abb | ||
|
|
6f212de7ea | ||
|
|
2dbf0a313c | ||
|
|
ece95ef2c0 | ||
|
|
9b8d85d160 | ||
|
|
4332636d78 | ||
|
|
412c5219ea | ||
|
|
f9dae6030b | ||
|
|
dc23baa68f | ||
|
|
7f1f295899 | ||
|
|
a18f6c2fbf | ||
|
|
b0538c5967 | ||
|
|
f5b8bcd906 | ||
|
|
bbbccd5987 | ||
|
|
0fcf49beaa | ||
|
|
ac05b03bae | ||
|
|
00327e27b7 | ||
|
|
aea0f28887 | ||
|
|
20555e7a88 | ||
|
|
b8238ca430 | ||
|
|
e33666b863 | ||
|
|
b583953bb2 | ||
|
|
ffcad70c12 | ||
|
|
28a8ee99a6 | ||
|
|
feb187b291 | ||
|
|
e95c94939b | ||
|
|
02eb42e42a | ||
|
|
dcfef5754f | ||
|
|
2be7b3b4dd | ||
|
|
dbf433ca69 | ||
|
|
aa36056261 | ||
|
|
3805692fd7 | ||
|
|
a66a7e4d9c | ||
|
|
7dd08fb74c | ||
|
|
70218cc7b0 | ||
|
|
cbd36eb47e | ||
|
|
18e5edbf4f | ||
|
|
3d5df69570 | ||
|
|
870e979f12 | ||
|
|
8ac7d46e0f | ||
|
|
706beabdc9 | ||
|
|
6f2ea735a0 | ||
|
|
cf9e190399 | ||
|
|
29d6edc634 | ||
|
|
dadb52e364 | ||
|
|
e47c4a7758 | ||
|
|
f3dd13c7c6 | ||
|
|
3fef7044c3 | ||
|
|
c3846b7d25 | ||
|
|
e39379580d | ||
|
|
7748306083 | ||
|
|
c7ca196631 | ||
|
|
092b605b4a | ||
|
|
cc1e1fbd63 | ||
|
|
3745201b54 | ||
|
|
9d4d26b5f9 | ||
|
|
1a1cef9860 | ||
|
|
240c1b5003 | ||
|
|
eba8e93177 | ||
|
|
b0f5857545 | ||
|
|
442791200b | ||
|
|
c3971575e0 | ||
|
|
17d7910e40 | ||
|
|
a0fce98f85 | ||
|
|
75582183e0 | ||
|
|
7e13dc899c | ||
|
|
4eb2b49e02 | ||
|
|
be1a52a813 | ||
|
|
b7bfdc89e2 | ||
|
|
d8fcea59c8 | ||
|
|
c49b37847d | ||
|
|
9d236a4991 | ||
|
|
b8eb775989 | ||
|
|
8ff31550f6 | ||
|
|
035354535a | ||
|
|
4e8aed0436 | ||
|
|
d6a5e8a40a | ||
|
|
8516e6a4d5 | ||
|
|
2535103a73 | ||
|
|
c9beb66272 | ||
|
|
10a6e519cb | ||
|
|
8cfd9aa8c7 | ||
|
|
e7a321f0a9 | ||
|
|
84edbdedac | ||
|
|
1fdea011a7 | ||
|
|
9f1c79494b | ||
|
|
5e83b6ca90 | ||
|
|
b94a439e4b | ||
|
|
0c9eb86c68 | ||
|
|
14f7dbb3db | ||
|
|
1f15802fdb | ||
|
|
9937274443 | ||
|
|
6664a8e5d9 | ||
|
|
bf2685d247 | ||
|
|
2056d44cc8 | ||
|
|
3b973729e9 | ||
|
|
6b34599103 | ||
|
|
9fdc4eb2b2 | ||
|
|
b33b39cdef | ||
|
|
c867764fde | ||
|
|
c4116456fa | ||
|
|
d99d047885 | ||
|
|
39a682fa1d | ||
|
|
111def7bd4 | ||
|
|
306ea92b36 | ||
|
|
c893834576 | ||
|
|
9171fb1d1c | ||
|
|
61cef4979f | ||
|
|
9a464ca5c5 | ||
|
|
4f5ed31618 | ||
|
|
540a286877 | ||
|
|
9b960cef18 | ||
|
|
b7e033f07e | ||
|
|
fc155f0ba8 | ||
|
|
1d60d23b9d | ||
|
|
4875b20c6c | ||
|
|
59a2187447 | ||
|
|
e7bc146524 | ||
|
|
561cff8157 |
No files matched your search
@@ -1,5 +1,5 @@
|
||||
# Instructions
|
||||
|
||||
1. Start a DevContainer either on GitHub Codespaces or locally in VSCode
|
||||
2. Accept all licenses by running `yes | /usr/lib/android-sdk/cmdline-tools/latest/bin/sdkmanager --licenses`
|
||||
3. You can now build the app using `./gradlew clean build`
|
||||
1. Start a DevContainer either on GitHub Codespaces or locally in VSCode.
|
||||
2. Accept all licenses by running `yes | /usr/lib/android-sdk/cmdline-tools/latest/bin/sdkmanager --licenses`.
|
||||
3. You can now build the app using `./gradlew clean build`.
|
||||
@@ -25,10 +25,12 @@ steps:
|
||||
- ./gradlew assembleGplay
|
||||
- ./gradlew assembleGplayDebug
|
||||
- scripts/wait_for_emulator.sh
|
||||
- ./gradlew jacocoTestGplayDebugUnitTestReport && scripts/deleteOutdatedComments.sh "stable" "Unit" $DRONE_PULL_REQUEST $GIT_USERNAME $GIT_TOKEN || scripts/uploadReport.sh $LOG_USERNAME $LOG_PASSWORD $DRONE_BUILD_NUMBER "stable" "Unit" $DRONE_PULL_REQUEST $GIT_USERNAME $GIT_TOKEN
|
||||
- scripts/deleteOldComments.sh "stable" "Unit" $DRONE_PULL_REQUEST $GIT_TOKEN
|
||||
- ./gradlew jacocoTestGplayDebugUnitTestReport || scripts/uploadReport.sh $LOG_USERNAME $LOG_PASSWORD $DRONE_BUILD_NUMBER "stable" "Unit" $DRONE_PULL_REQUEST $GIT_TOKEN
|
||||
- ./gradlew installGplayDebugAndroidTest
|
||||
- scripts/wait_for_server.sh "server"
|
||||
- ./gradlew createGplayDebugCoverageReport -Pcoverage -Pandroid.testInstrumentationRunnerArguments.notAnnotation=com.owncloud.android.utils.ScreenshotTest && scripts/deleteOutdatedComments.sh "stable" "IT" $DRONE_PULL_REQUEST $GIT_USERNAME $GIT_TOKEN || scripts/uploadReport.sh $LOG_USERNAME $LOG_PASSWORD $DRONE_BUILD_NUMBER "stable" "IT" $DRONE_PULL_REQUEST $GIT_USERNAME $GIT_TOKEN
|
||||
- scripts/deleteOldComments.sh "stable" "IT" $DRONE_PULL_REQUEST $GIT_TOKEN
|
||||
- ./gradlew createGplayDebugCoverageReport -Pcoverage -Pandroid.testInstrumentationRunnerArguments.notAnnotation=com.owncloud.android.utils.ScreenshotTest || scripts/uploadReport.sh $LOG_USERNAME $LOG_PASSWORD $DRONE_BUILD_NUMBER "stable" "IT" $DRONE_PULL_REQUEST $GIT_TOKEN
|
||||
- ./gradlew combinedTestReport
|
||||
- name: notify
|
||||
image: drillster/drone-email
|
||||
@@ -51,6 +53,7 @@ steps:
|
||||
- failure
|
||||
branch:
|
||||
- master
|
||||
- stable-*
|
||||
|
||||
services:
|
||||
- name: server
|
||||
@@ -58,7 +61,7 @@ services:
|
||||
environment:
|
||||
EVAL: true
|
||||
commands:
|
||||
- BRANCH='stable20' /usr/local/bin/initnc.sh
|
||||
- BRANCH='stable21' /usr/local/bin/initnc.sh
|
||||
- echo 127.0.0.1 server >> /etc/hosts
|
||||
- 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"
|
||||
@@ -67,9 +70,9 @@ services:
|
||||
- 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 stable20 https://github.com/nextcloud/activity.git /var/www/html/apps/activity/"
|
||||
- su www-data -c "git clone -b stable21 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 stable20 https://github.com/nextcloud/text.git /var/www/html/apps/text/"
|
||||
- su www-data -c "git clone -b stable21 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 "php /var/www/html/occ app:enable end_to_end_encryption"
|
||||
- /usr/local/bin/run.sh
|
||||
@@ -77,6 +80,7 @@ services:
|
||||
trigger:
|
||||
branch:
|
||||
- master
|
||||
- stable-*
|
||||
event:
|
||||
- push
|
||||
- pull_request
|
||||
@@ -126,6 +130,7 @@ steps:
|
||||
- failure
|
||||
branch:
|
||||
- master
|
||||
- stable-*
|
||||
|
||||
services:
|
||||
- name: server
|
||||
@@ -153,6 +158,7 @@ services:
|
||||
trigger:
|
||||
branch:
|
||||
- master
|
||||
- stable-*
|
||||
event:
|
||||
- push
|
||||
- pull_request
|
||||
@@ -199,10 +205,66 @@ steps:
|
||||
- failure
|
||||
branch:
|
||||
- master
|
||||
- stable-*
|
||||
|
||||
trigger:
|
||||
branch:
|
||||
- master
|
||||
- stable-*
|
||||
event:
|
||||
- push
|
||||
- pull_request
|
||||
---
|
||||
kind: pipeline
|
||||
type: docker
|
||||
name: allScreenshots
|
||||
|
||||
steps:
|
||||
- name: runAllScreenshots
|
||||
image: nextcloudci/android8:android-61
|
||||
privileged: true
|
||||
environment:
|
||||
GIT_USERNAME:
|
||||
from_secret: GIT_USERNAME
|
||||
GIT_TOKEN:
|
||||
from_secret: GIT_TOKEN
|
||||
LOG_USERNAME:
|
||||
from_secret: LOG_USERNAME
|
||||
LOG_PASSWORD:
|
||||
from_secret: LOG_PASSWORD
|
||||
commands:
|
||||
- emulator -avd android -no-snapshot -gpu swiftshader_indirect -no-window -no-audio -skin 500x833 &
|
||||
- sed -i s'#<bool name="is_beta">false</bool>#<bool name="is_beta">true</bool>#'g src/main/res/values/setup.xml
|
||||
- sed -i s'#showOnlyFailingTestsInReports = ciBuild#showOnlyFailingTestsInReports = false#' build.gradle
|
||||
- scripts/wait_for_emulator.sh
|
||||
- scripts/runAllScreenshotCombinations noCI false
|
||||
- scripts/screenshotSummary.sh
|
||||
- name: notify
|
||||
image: drillster/drone-email
|
||||
settings:
|
||||
port: 587
|
||||
from: [email protected]
|
||||
recipients_only: true
|
||||
username:
|
||||
from_secret: EMAIL_USERNAME
|
||||
password:
|
||||
from_secret: EMAIL_PASSWORD
|
||||
recipients:
|
||||
from_secret: EMAIL_RECIPIENTS
|
||||
host:
|
||||
from_secret: EMAIL_HOST
|
||||
when:
|
||||
event:
|
||||
- push
|
||||
status:
|
||||
- failure
|
||||
branch:
|
||||
- master
|
||||
- stable-*
|
||||
trigger:
|
||||
branch:
|
||||
- master
|
||||
event:
|
||||
- cron
|
||||
cron:
|
||||
- nightly
|
||||
@@ -3,25 +3,44 @@
|
||||
# https://github.com/nextcloud/.github
|
||||
# https://docs.github.com/en/actions/learn-github-actions/sharing-workflows-with-your-organization
|
||||
|
||||
name: Rebase command
|
||||
|
||||
on:
|
||||
issue_comment:
|
||||
types: [ created ]
|
||||
name: Automatic Rebase
|
||||
types: created
|
||||
|
||||
jobs:
|
||||
rebase:
|
||||
name: Rebase
|
||||
# On pull requests and if the comment starts with `/rebase`
|
||||
if: github.event.issue.pull_request != '' && startsWith(github.event.comment.body, '/rebase')
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
# On pull requests and if the comment starts with `/rebase`
|
||||
if: github.event.issue.pull_request != '' && startsWith(github.event.comment.body, '/rebase')
|
||||
|
||||
steps:
|
||||
- name: Add reaction on start
|
||||
uses: peter-evans/create-or-update-comment@v1
|
||||
with:
|
||||
token: ${{ secrets.COMMAND_BOT_PAT }}
|
||||
repository: ${{ github.event.repository.full_name }}
|
||||
comment-id: ${{ github.event.comment.id }}
|
||||
reaction-type: "+1"
|
||||
|
||||
- name: Checkout the latest code
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
token: ${{ secrets.COMMAND_BOT_PAT }}
|
||||
|
||||
- name: Automatic Rebase
|
||||
uses: cirrus-actions/[email protected]
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
GITHUB_TOKEN: ${{ secrets.COMMAND_BOT_PAT }}
|
||||
|
||||
- name: Add reaction on failure
|
||||
uses: peter-evans/create-or-update-comment@v1
|
||||
if: failure()
|
||||
with:
|
||||
token: ${{ secrets.COMMAND_BOT_PAT }}
|
||||
repository: ${{ github.event.repository.full_name }}
|
||||
comment-id: ${{ github.event.comment.id }}
|
||||
reaction-type: "-1"
|
||||
@@ -8,12 +8,18 @@ jobs:
|
||||
qa:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Check if secrets are available
|
||||
run: echo "::set-output name=ok::${{ secrets.KS_PASS != '' }}"
|
||||
id: check-secrets
|
||||
- uses: actions/checkout@v2
|
||||
if: ${{ steps.check-secrets.outputs.ok == 'true' }}
|
||||
- name: set up JDK 1.8
|
||||
if: ${{ steps.check-secrets.outputs.ok == 'true' }}
|
||||
uses: actions/setup-java@v1
|
||||
with:
|
||||
java-version: 1.8
|
||||
- name: Build QA
|
||||
if: ${{ steps.check-secrets.outputs.ok == 'true' }}
|
||||
env:
|
||||
KS_PASS: ${{ secrets.KS_PASS }}
|
||||
KEY_PASS: ${{ secrets.KEY_PASS }}
|
||||
|
||||
@@ -10,8 +10,8 @@ jobs:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
scheme: [ Dark, Light ]
|
||||
color: [ blue, white, black ]
|
||||
scheme: [ Light ]
|
||||
color: [ blue ]
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: set up JDK 1.8
|
||||
|
||||
@@ -49,3 +49,4 @@ fastlane/Fastfile
|
||||
**/fastlane/test_output
|
||||
/fastlane/vendor/
|
||||
/.bundle/
|
||||
/fastlane/.bundle/
|
||||
@@ -1,3 +1,13 @@
|
||||
## 3.17.0 (August, 19, 2021)
|
||||
|
||||
UI improvements (Avatar, password dialog)
|
||||
New video player for better streaming
|
||||
Many bug fixes
|
||||
|
||||
Minimum: NC 16 Server, Android 5.1 Lollipop
|
||||
|
||||
For a full list, please see https://github.com/nextcloud/android/milestone/59
|
||||
|
||||
## 3.17.0 (-, -, -)
|
||||
|
||||
- New upload manager @ezaquarii
|
||||
|
||||
@@ -119,6 +119,14 @@ There are three build variants
|
||||
* gplay: with Google Stuff (Push notification), used for Google Play Store
|
||||
* versionDev: based on master and library master, available as direct download and FDroid
|
||||
|
||||
### Git hooks
|
||||
We provide git hooks to make development process easier for both the developer and the reviewers.
|
||||
To install them, just run:
|
||||
|
||||
```bash
|
||||
./gradlew installGitHooks
|
||||
```
|
||||
|
||||
## Contribution process
|
||||
* Contribute your code in the branch 'master'. It will give us a better chance to test your code before merging it with stable code.
|
||||
* For your first contribution start a pull request on master.
|
||||
|
||||
@@ -1,77 +1,94 @@
|
||||
GEM
|
||||
remote: https://rubygems.org/
|
||||
specs:
|
||||
CFPropertyList (3.0.2)
|
||||
addressable (2.7.0)
|
||||
CFPropertyList (3.0.3)
|
||||
addressable (2.8.0)
|
||||
public_suffix (>= 2.0.2, < 5.0)
|
||||
artifactory (3.0.15)
|
||||
atomos (0.1.3)
|
||||
aws-eventstream (1.1.0)
|
||||
aws-partitions (1.343.0)
|
||||
aws-sdk-core (3.104.1)
|
||||
aws-eventstream (1.1.1)
|
||||
aws-partitions (1.479.0)
|
||||
aws-sdk-core (3.117.0)
|
||||
aws-eventstream (~> 1, >= 1.0.2)
|
||||
aws-partitions (~> 1, >= 1.239.0)
|
||||
aws-sigv4 (~> 1.1)
|
||||
jmespath (~> 1.0)
|
||||
aws-sdk-kms (1.36.0)
|
||||
aws-sdk-core (~> 3, >= 3.99.0)
|
||||
aws-sdk-kms (1.44.0)
|
||||
aws-sdk-core (~> 3, >= 3.112.0)
|
||||
aws-sigv4 (~> 1.1)
|
||||
aws-sdk-s3 (1.75.0)
|
||||
aws-sdk-core (~> 3, >= 3.104.1)
|
||||
aws-sdk-s3 (1.96.2)
|
||||
aws-sdk-core (~> 3, >= 3.112.0)
|
||||
aws-sdk-kms (~> 1)
|
||||
aws-sigv4 (~> 1.1)
|
||||
aws-sigv4 (1.2.1)
|
||||
aws-sigv4 (1.2.4)
|
||||
aws-eventstream (~> 1, >= 1.0.2)
|
||||
babosa (1.0.3)
|
||||
babosa (1.0.4)
|
||||
claide (1.0.3)
|
||||
colored (1.2)
|
||||
colored2 (3.1.2)
|
||||
commander-fastlane (4.4.6)
|
||||
highline (~> 1.7.2)
|
||||
commander (4.6.0)
|
||||
highline (~> 2.0.0)
|
||||
declarative (0.0.20)
|
||||
declarative-option (0.1.0)
|
||||
digest-crc (0.6.1)
|
||||
rake (~> 13.0)
|
||||
digest-crc (0.6.3)
|
||||
rake (>= 12.0.0, < 14.0.0)
|
||||
domain_name (0.5.20190701)
|
||||
unf (>= 0.0.5, < 1.0.0)
|
||||
dotenv (2.7.6)
|
||||
emoji_regex (3.0.0)
|
||||
excon (0.75.0)
|
||||
faraday (0.17.3)
|
||||
emoji_regex (3.2.2)
|
||||
excon (0.85.0)
|
||||
faraday (1.5.1)
|
||||
faraday-em_http (~> 1.0)
|
||||
faraday-em_synchrony (~> 1.0)
|
||||
faraday-excon (~> 1.1)
|
||||
faraday-httpclient (~> 1.0.1)
|
||||
faraday-net_http (~> 1.0)
|
||||
faraday-net_http_persistent (~> 1.1)
|
||||
faraday-patron (~> 1.0)
|
||||
multipart-post (>= 1.2, < 3)
|
||||
faraday-cookie_jar (0.0.6)
|
||||
faraday (>= 0.7.4)
|
||||
ruby2_keywords (>= 0.0.4)
|
||||
faraday-cookie_jar (0.0.7)
|
||||
faraday (>= 0.8.0)
|
||||
http-cookie (~> 1.0.0)
|
||||
faraday_middleware (0.14.0)
|
||||
faraday (>= 0.7.4, < 1.0)
|
||||
fastimage (2.1.7)
|
||||
fastlane (2.152.0)
|
||||
faraday-em_http (1.0.0)
|
||||
faraday-em_synchrony (1.0.0)
|
||||
faraday-excon (1.1.0)
|
||||
faraday-httpclient (1.0.1)
|
||||
faraday-net_http (1.0.1)
|
||||
faraday-net_http_persistent (1.2.0)
|
||||
faraday-patron (1.0.0)
|
||||
faraday_middleware (1.0.0)
|
||||
faraday (~> 1.0)
|
||||
fastimage (2.2.4)
|
||||
fastlane (2.188.0)
|
||||
CFPropertyList (>= 2.3, < 4.0.0)
|
||||
addressable (>= 2.3, < 3.0.0)
|
||||
addressable (>= 2.8, < 3.0.0)
|
||||
artifactory (~> 3.0)
|
||||
aws-sdk-s3 (~> 1.0)
|
||||
babosa (>= 1.0.3, < 2.0.0)
|
||||
bundler (>= 1.12.0, < 3.0.0)
|
||||
colored
|
||||
commander-fastlane (>= 4.4.6, < 5.0.0)
|
||||
commander (~> 4.6)
|
||||
dotenv (>= 2.1.1, < 3.0.0)
|
||||
emoji_regex (>= 0.1, < 4.0)
|
||||
excon (>= 0.71.0, < 1.0.0)
|
||||
faraday (>= 0.17, < 1.0)
|
||||
faraday (~> 1.0)
|
||||
faraday-cookie_jar (~> 0.0.6)
|
||||
faraday_middleware (>= 0.13.1, < 2.0)
|
||||
faraday_middleware (~> 1.0)
|
||||
fastimage (>= 2.1.0, < 3.0.0)
|
||||
gh_inspector (>= 1.1.2, < 2.0.0)
|
||||
google-api-client (>= 0.37.0, < 0.39.0)
|
||||
google-cloud-storage (>= 1.15.0, < 2.0.0)
|
||||
highline (>= 1.7.2, < 2.0.0)
|
||||
google-apis-androidpublisher_v3 (~> 0.1)
|
||||
google-apis-playcustomapp_v1 (~> 0.1)
|
||||
google-cloud-storage (~> 1.31)
|
||||
highline (~> 2.0)
|
||||
json (< 3.0.0)
|
||||
jwt (>= 2.1.0, < 3)
|
||||
mini_magick (>= 4.9.4, < 5.0.0)
|
||||
multipart-post (~> 2.0.0)
|
||||
naturally (~> 2.2)
|
||||
plist (>= 3.1.0, < 4.0.0)
|
||||
rubyzip (>= 2.0.0, < 3.0.0)
|
||||
security (= 0.1.3)
|
||||
simctl (~> 1.6.3)
|
||||
slack-notifier (>= 2.0.0, < 3.0.0)
|
||||
terminal-notifier (>= 2.0.0, < 3.0.0)
|
||||
terminal-table (>= 1.4.5, < 2.0.0)
|
||||
tty-screen (>= 0.6.3, < 1.0.0)
|
||||
@@ -80,63 +97,75 @@ GEM
|
||||
xcodeproj (>= 1.13.0, < 2.0.0)
|
||||
xcpretty (~> 0.3.0)
|
||||
xcpretty-travis-formatter (>= 0.0.3)
|
||||
fastlane-plugin-huawei_appgallery_connect (1.0.9)
|
||||
fastlane-plugin-huawei_appgallery_connect (1.0.16)
|
||||
gh_inspector (1.1.3)
|
||||
google-api-client (0.38.0)
|
||||
google-apis-androidpublisher_v3 (0.8.0)
|
||||
google-apis-core (>= 0.4, < 2.a)
|
||||
google-apis-core (0.4.1)
|
||||
addressable (~> 2.5, >= 2.5.1)
|
||||
googleauth (~> 0.9)
|
||||
httpclient (>= 2.8.1, < 3.0)
|
||||
googleauth (>= 0.16.2, < 2.a)
|
||||
httpclient (>= 2.8.1, < 3.a)
|
||||
mini_mime (~> 1.0)
|
||||
representable (~> 3.0)
|
||||
retriable (>= 2.0, < 4.0)
|
||||
signet (~> 0.12)
|
||||
google-cloud-core (1.5.0)
|
||||
retriable (>= 2.0, < 4.a)
|
||||
rexml
|
||||
webrick
|
||||
google-apis-iamcredentials_v1 (0.6.0)
|
||||
google-apis-core (>= 0.4, < 2.a)
|
||||
google-apis-playcustomapp_v1 (0.5.0)
|
||||
google-apis-core (>= 0.4, < 2.a)
|
||||
google-apis-storage_v1 (0.6.0)
|
||||
google-apis-core (>= 0.4, < 2.a)
|
||||
google-cloud-core (1.6.0)
|
||||
google-cloud-env (~> 1.0)
|
||||
google-cloud-errors (~> 1.0)
|
||||
google-cloud-env (1.3.3)
|
||||
google-cloud-env (1.5.0)
|
||||
faraday (>= 0.17.3, < 2.0)
|
||||
google-cloud-errors (1.0.1)
|
||||
google-cloud-storage (1.26.2)
|
||||
google-cloud-errors (1.1.0)
|
||||
google-cloud-storage (1.34.1)
|
||||
addressable (~> 2.5)
|
||||
digest-crc (~> 0.4)
|
||||
google-api-client (~> 0.33)
|
||||
google-cloud-core (~> 1.2)
|
||||
googleauth (~> 0.9)
|
||||
google-apis-iamcredentials_v1 (~> 0.1)
|
||||
google-apis-storage_v1 (~> 0.1)
|
||||
google-cloud-core (~> 1.6)
|
||||
googleauth (>= 0.16.2, < 2.a)
|
||||
mini_mime (~> 1.0)
|
||||
googleauth (0.13.0)
|
||||
googleauth (0.16.2)
|
||||
faraday (>= 0.17.3, < 2.0)
|
||||
jwt (>= 1.4, < 3.0)
|
||||
memoist (~> 0.16)
|
||||
multi_json (~> 1.11)
|
||||
os (>= 0.9, < 2.0)
|
||||
signet (~> 0.14)
|
||||
highline (1.7.10)
|
||||
http-cookie (1.0.3)
|
||||
highline (2.0.3)
|
||||
http-cookie (1.0.4)
|
||||
domain_name (~> 0.5)
|
||||
httpclient (2.8.3)
|
||||
jmespath (1.4.0)
|
||||
json (2.3.1)
|
||||
jwt (2.2.1)
|
||||
json (2.5.1)
|
||||
jwt (2.2.3)
|
||||
memoist (0.16.2)
|
||||
mini_magick (4.10.1)
|
||||
mini_mime (1.0.2)
|
||||
mini_magick (4.11.0)
|
||||
mini_mime (1.1.0)
|
||||
multi_json (1.15.0)
|
||||
multipart-post (2.0.0)
|
||||
nanaimo (0.3.0)
|
||||
naturally (2.2.0)
|
||||
os (1.1.0)
|
||||
plist (3.5.0)
|
||||
public_suffix (4.0.5)
|
||||
rake (13.0.1)
|
||||
representable (3.0.4)
|
||||
naturally (2.2.1)
|
||||
os (1.1.1)
|
||||
plist (3.6.0)
|
||||
public_suffix (4.0.6)
|
||||
rake (13.0.6)
|
||||
representable (3.1.1)
|
||||
declarative (< 0.1.0)
|
||||
declarative-option (< 0.2.0)
|
||||
trailblazer-option (>= 0.1.1, < 0.2.0)
|
||||
uber (< 0.2.0)
|
||||
retriable (3.1.2)
|
||||
rexml (3.2.5)
|
||||
rouge (2.0.7)
|
||||
rubyzip (2.3.0)
|
||||
ruby2_keywords (0.0.5)
|
||||
rubyzip (2.3.2)
|
||||
security (0.1.3)
|
||||
signet (0.14.0)
|
||||
signet (0.15.0)
|
||||
addressable (~> 2.3)
|
||||
faraday (>= 0.17.3, < 2.0)
|
||||
jwt (>= 1.5, < 3.0)
|
||||
@@ -144,10 +173,10 @@ GEM
|
||||
simctl (1.6.8)
|
||||
CFPropertyList
|
||||
naturally
|
||||
slack-notifier (2.3.2)
|
||||
terminal-notifier (2.0.0)
|
||||
terminal-table (1.8.0)
|
||||
unicode-display_width (~> 1.1, >= 1.1.1)
|
||||
trailblazer-option (0.1.1)
|
||||
tty-cursor (0.7.1)
|
||||
tty-screen (0.8.1)
|
||||
tty-spinner (0.9.3)
|
||||
@@ -157,24 +186,26 @@ GEM
|
||||
unf_ext
|
||||
unf_ext (0.0.7.7)
|
||||
unicode-display_width (1.7.0)
|
||||
webrick (1.7.0)
|
||||
word_wrap (1.0.0)
|
||||
xcodeproj (1.17.1)
|
||||
xcodeproj (1.20.0)
|
||||
CFPropertyList (>= 2.3.3, < 4.0)
|
||||
atomos (~> 0.1.3)
|
||||
claide (>= 1.0.2, < 2.0)
|
||||
colored2 (~> 3.1)
|
||||
nanaimo (~> 0.3.0)
|
||||
rexml (~> 3.2.4)
|
||||
xcpretty (0.3.0)
|
||||
rouge (~> 2.0.7)
|
||||
xcpretty-travis-formatter (1.0.0)
|
||||
xcpretty-travis-formatter (1.0.1)
|
||||
xcpretty (~> 0.2, >= 0.0.7)
|
||||
|
||||
PLATFORMS
|
||||
ruby
|
||||
x86_64-linux
|
||||
|
||||
DEPENDENCIES
|
||||
fastlane
|
||||
fastlane-plugin-huawei_appgallery_connect
|
||||
|
||||
BUNDLED WITH
|
||||
2.1.4
|
||||
2.2.18
|
||||
@@ -32,7 +32,7 @@ The next steps will assume you have a GitHub account and that you will get the c
|
||||
|
||||
* In a web browser, go to https://github.com/nextcloud/android, and click the 'Fork' button near the top right corner.
|
||||
* Open a terminal and go on with the next steps in it.
|
||||
* Clone your forked repository: ```git clone --recursive https://github.com/YOURGITHUBNAME/android.git```.
|
||||
* Clone your forked repository: ```git clone https://github.com/YOURGITHUBNAME/android.git```.
|
||||
* Move to the project folder with ```cd android```.
|
||||
* Pull any changes from your remote branch 'master': ```git pull origin master```
|
||||
* Make official Nextcloud repo known as upstream: ```git remote add upstream https://github.com/nextcloud/android.git```
|
||||
@@ -49,7 +49,6 @@ We recommend to use the last version available in the stable channel of Android
|
||||
|
||||
To set up the project in Android Studio follow the next steps:
|
||||
|
||||
* Make sure you have called ```git submodule update``` whenever you switched branches
|
||||
* Open Android Studio and select 'Import Project (Eclipse ADT, Gradle, etc)'. Browse through your file system to the folder 'android' where the project is located. Android Studio will then create the '.iml' files it needs. If you ever close the project but the files are still there, you just select 'Open Project…'. The file chooser will show an Android face as the folder icon, which you can select to reopen the project.
|
||||
* Android Studio will try to build the project directly after importing it. To build it manually, follow the menu path 'Build'/'Make Project', or just click the 'Play' button in the toolbar to build and run it in a mobile device or an emulator. The resulting APK file will be saved in the 'build/outputs/apk/' subdirectory in the project folder.
|
||||
* Setup Android Studio editor configurtation for the project: ```Settings``` → ```Editor``` → ```Code Style``` → ```Scheme: Project``` and ```Enable EditorConfig support```
|
||||
@@ -60,7 +59,6 @@ To set up the project in Android Studio follow the next steps:
|
||||
[Gradle][7] is the build system used by Android Studio to manage the building operations on Android apps. You do not need to install Gradle in your system, and Google recommends not to do it, but instead trusting on the [Gradle wrapper][8] included in the project.
|
||||
|
||||
* Open a terminal and go to the 'android' directory that contains the repository.
|
||||
* Make sure you have called ```git submodule update``` whenever you switched branches
|
||||
* Run the 'clean' and 'build' tasks using the Gradle wrapper provided
|
||||
- Windows: ```gradlew.bat clean build```
|
||||
- Mac OS/Linux: ```./gradlew clean build```
|
||||
|
||||
@@ -18,13 +18,13 @@ buildscript {
|
||||
mavenCentral()
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:4.2.1'
|
||||
classpath 'com.android.tools.build:gradle:4.2.2'
|
||||
classpath 'com.hiya:jacoco-android:0.2'
|
||||
classpath 'gradle.plugin.com.github.spotbugs.snom:spotbugs-gradle-plugin:4.7.1'
|
||||
classpath 'gradle.plugin.com.github.spotbugs.snom:spotbugs-gradle-plugin:4.7.5'
|
||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
||||
classpath "io.gitlab.arturbosch.detekt:detekt-gradle-plugin:1.17.1"
|
||||
classpath "io.gitlab.arturbosch.detekt:detekt-gradle-plugin:1.18.1"
|
||||
classpath "commons-httpclient:commons-httpclient:3.1@jar" // remove after entire switch to lib v2
|
||||
classpath 'com.karumi:shot:5.10.3'
|
||||
classpath 'com.karumi:shot:5.11.2'
|
||||
}
|
||||
}
|
||||
|
||||
@@ -56,18 +56,18 @@ configurations {
|
||||
}
|
||||
|
||||
ext {
|
||||
daggerVersion = "2.36"
|
||||
androidxTestVersion = "1.4.0"
|
||||
daggerVersion = "2.38.1"
|
||||
markwonVersion = "4.6.2"
|
||||
prismVersion = "2.0.0"
|
||||
butterknifeVersion = "10.2.3"
|
||||
androidLibraryVersion = "master-SNAPSHOT"
|
||||
mockitoVersion = "3.11.0"
|
||||
mockitoVersion = "3.12.4"
|
||||
mockkVersion = "1.10.4"
|
||||
powermockVersion = "2.0.9"
|
||||
byteBuddyVersion = "1.11.2"
|
||||
espressoVersion = "3.3.0"
|
||||
byteBuddyVersion = "1.11.18"
|
||||
espressoVersion = "3.4.0"
|
||||
workRuntime = "2.5.0"
|
||||
fidoVersion = "4.4.0"
|
||||
fidoVersion = "4.1.0"
|
||||
|
||||
ciBuild = System.getenv("CI") == "true"
|
||||
|
||||
@@ -266,35 +266,33 @@ dependencies {
|
||||
// dependencies for app building
|
||||
implementation 'androidx.multidex:multidex:2.0.1'
|
||||
// implementation project('nextcloud-android-library')
|
||||
genericImplementation "com.github.nextcloud:android-library:$androidLibraryVersion"
|
||||
gplayImplementation "com.github.nextcloud:android-library:$androidLibraryVersion"
|
||||
versionDevImplementation "com.github.nextcloud:android-library:$androidLibraryVersion"
|
||||
qaImplementation "com.github.nextcloud:android-library:$androidLibraryVersion"
|
||||
implementation ("com.github.nextcloud:android-library:$androidLibraryVersion") {
|
||||
exclude group: 'org.ogce', module: 'xpp3' // unused in Android and brings wrong Junit version
|
||||
}
|
||||
|
||||
compileOnly 'org.jbundle.util.osgi.wrapped:org.jbundle.util.osgi.wrapped.org.apache.http.client:4.1.2' // remove after entire switch to lib v2
|
||||
implementation "commons-httpclient:commons-httpclient:3.1@jar" // remove after entire switch to lib v2
|
||||
implementation 'org.apache.jackrabbit:jackrabbit-webdav:2.13.1' // remove after entire switch to lib v2
|
||||
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
|
||||
implementation 'androidx.constraintlayout:constraintlayout:2.1.1'
|
||||
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
|
||||
implementation 'com.google.android.material:material:1.3.0'
|
||||
implementation 'com.google.android.material:material:1.4.0'
|
||||
implementation 'com.jakewharton:disklrucache:2.0.2'
|
||||
implementation 'androidx.appcompat:appcompat:1.3.0'
|
||||
implementation 'androidx.appcompat:appcompat:1.3.1'
|
||||
implementation 'androidx.webkit:webkit:1.4.0'
|
||||
implementation 'androidx.cardview:cardview:1.0.0'
|
||||
implementation 'androidx.exifinterface:exifinterface:1.3.2'
|
||||
implementation 'androidx.exifinterface:exifinterface:1.3.3'
|
||||
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:2.3.1"
|
||||
implementation "androidx.work:work-runtime:$workRuntime"
|
||||
implementation "androidx.work:work-runtime-ktx:$workRuntime"
|
||||
implementation "androidx.fragment:fragment-ktx:1.3.4"
|
||||
implementation "androidx.fragment:fragment-ktx:1.3.6"
|
||||
implementation 'com.github.albfernandez:juniversalchardet:2.0.3' // need this version for Android <7
|
||||
compileOnly 'com.google.code.findbugs:annotations:3.0.1u2'
|
||||
implementation 'commons-io:commons-io:2.9.0'
|
||||
implementation "com.jakewharton:butterknife:$butterknifeVersion"
|
||||
kapt "com.jakewharton:butterknife-compiler:$butterknifeVersion"
|
||||
implementation 'commons-io:commons-io:2.11.0'
|
||||
implementation 'org.greenrobot:eventbus:3.2.0'
|
||||
implementation 'com.googlecode.ez-vcard:ez-vcard:0.11.2'
|
||||
implementation 'com.googlecode.ez-vcard:ez-vcard:0.11.3'
|
||||
implementation 'org.lukhnos:nnio:0.2'
|
||||
implementation 'org.bouncycastle:bcpkix-jdk15to18:1.68'
|
||||
implementation 'com.google.code.gson:gson:2.8.7'
|
||||
implementation 'org.bouncycastle:bcpkix-jdk15to18:1.69'
|
||||
implementation 'com.google.code.gson:gson:2.8.8'
|
||||
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.21'
|
||||
@@ -307,7 +305,7 @@ dependencies {
|
||||
}
|
||||
implementation 'com.caverock:androidsvg:1.4'
|
||||
implementation 'androidx.annotation:annotation:1.2.0'
|
||||
implementation 'com.vanniktech:emoji-google:0.7.0'
|
||||
implementation 'com.vanniktech:emoji-google:0.8.0'
|
||||
|
||||
implementation "com.github.cotechde.hwsecurity:hwsecurity-fido:$fidoVersion"
|
||||
implementation "com.github.cotechde.hwsecurity:hwsecurity-fido2:$fidoVersion"
|
||||
@@ -321,10 +319,10 @@ dependencies {
|
||||
kapt "com.google.dagger:dagger-compiler:$daggerVersion"
|
||||
kapt "com.google.dagger:dagger-android-processor:$daggerVersion"
|
||||
|
||||
ktlint "com.pinterest:ktlint:0.41.0"
|
||||
ktlint "com.pinterest:ktlint:0.42.1"
|
||||
implementation 'org.conscrypt:conscrypt-android:2.5.2'
|
||||
|
||||
implementation 'com.google.android.exoplayer:exoplayer:2.13.2'
|
||||
implementation 'com.google.android.exoplayer:exoplayer:2.15.1'
|
||||
|
||||
// Shimmer animation
|
||||
implementation 'com.elyeproj.libraries:loaderviewlibrary:2.0.0'
|
||||
@@ -343,7 +341,7 @@ dependencies {
|
||||
// dependencies for local unit tests
|
||||
testImplementation 'junit:junit:4.13.2'
|
||||
testImplementation "org.mockito:mockito-core:$mockitoVersion"
|
||||
testImplementation 'androidx.test:core:1.3.0'
|
||||
testImplementation "androidx.test:core:$androidxTestVersion"
|
||||
testImplementation "org.powermock:powermock-core:$powermockVersion"
|
||||
testImplementation "org.powermock:powermock-module-junit4:$powermockVersion"
|
||||
testImplementation "org.powermock:powermock-api-mockito2:$powermockVersion"
|
||||
@@ -355,11 +353,11 @@ dependencies {
|
||||
|
||||
// dependencies for instrumented tests
|
||||
// JUnit4 Rules
|
||||
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
|
||||
androidTestImplementation 'androidx.test:rules:1.3.0'
|
||||
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
|
||||
androidTestImplementation "androidx.test:rules:$androidxTestVersion"
|
||||
// Android JUnit Runner
|
||||
androidTestImplementation 'androidx.test:runner:1.3.0'
|
||||
androidTestUtil 'androidx.test:orchestrator:1.3.0'
|
||||
androidTestImplementation "androidx.test:runner:$androidxTestVersion"
|
||||
androidTestUtil "androidx.test:orchestrator:$androidxTestVersion"
|
||||
|
||||
// Espresso core
|
||||
androidTestImplementation "androidx.test.espresso:espresso-core:$espressoVersion"
|
||||
@@ -378,12 +376,13 @@ dependencies {
|
||||
androidTestImplementation "net.bytebuddy:byte-buddy-android:$byteBuddyVersion"
|
||||
androidTestImplementation "io.mockk:mockk-android:1.10.4"
|
||||
androidTestImplementation 'androidx.arch.core:core-testing:2.0.1'
|
||||
androidTestImplementation "com.facebook.testing.screenshot:core:0.13.0"
|
||||
|
||||
// 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
|
||||
//androidTestImplementation "com.android.support:support-annotations:${supportLibraryVersion}"
|
||||
androidTestImplementation 'tools.fastlane:screengrab:2.0.0'
|
||||
androidTestImplementation 'tools.fastlane:screengrab:2.1.0'
|
||||
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
||||
androidTestImplementation('com.android.support.test.espresso:espresso-intents:3.0.2')
|
||||
|
||||
@@ -441,6 +440,14 @@ task ktlintFormat(type: JavaExec, group: "formatting") {
|
||||
args "-F", "src/**/*.kt"
|
||||
}
|
||||
|
||||
task installGitHooks(type: Copy, group: "development") {
|
||||
description = "Install git hooks"
|
||||
from("${project.rootDir}/scripts/hooks") {
|
||||
include '*'
|
||||
}
|
||||
into '.git/hooks'
|
||||
}
|
||||
|
||||
detekt {
|
||||
reports {
|
||||
xml {
|
||||
|
||||
@@ -3,4 +3,3 @@
|
||||
# Ensure this file is checked in to source control!
|
||||
|
||||
gem 'fastlane-plugin-huawei_appgallery_connect'
|
||||
gem 'fastlane-plugin-huawei_appgallery_connect'
|
||||
@@ -7,7 +7,7 @@
|
||||
<issue id="InvalidPackage">
|
||||
<ignore path="**/freemarker-2.*.*.jar" />
|
||||
<ignore path="**/nnio-0.2.jar"/>
|
||||
<ignore path="**/bcpkix-jdk15on-1.65.jar" />
|
||||
<ignore path="**/bcpkix-jdk15on-1.69.jar" />
|
||||
</issue>
|
||||
|
||||
<issue id="UnusedResources">
|
||||
|
||||
|
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 20 KiB |
|
Before Width: | Height: | Size: 9.5 KiB After Width: | Height: | Size: 14 KiB |
|
Before Width: | Height: | Size: 23 KiB |
|
Before Width: | Height: | Size: 35 KiB After Width: | Height: | Size: 35 KiB |
|
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 12 KiB |
|
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 16 KiB |
|
Before Width: | Height: | Size: 29 KiB After Width: | Height: | Size: 16 KiB |
|
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 15 KiB |
|
Before Width: | Height: | Size: 5.9 KiB After Width: | Height: | Size: 5.8 KiB |
|
Before Width: | Height: | Size: 8.2 KiB After Width: | Height: | Size: 8.1 KiB |
|
Before Width: | Height: | Size: 30 KiB After Width: | Height: | Size: 43 KiB |
|
Before Width: | Height: | Size: 5.6 KiB After Width: | Height: | Size: 5.6 KiB |
|
Before Width: | Height: | Size: 6.6 KiB After Width: | Height: | Size: 6.6 KiB |
|
Before Width: | Height: | Size: 9.3 KiB After Width: | Height: | Size: 9.3 KiB |
@@ -1 +1 @@
|
||||
305
|
||||
460
|
||||
@@ -1,2 +1,2 @@
|
||||
DO NOT TOUCH; GENERATED BY DRONE
|
||||
<span class="mdl-layout-title">Lint Report: 227 warnings</span>
|
||||
<span class="mdl-layout-title">Lint Report: 68 warnings</span>
|
||||
@@ -1,4 +1,5 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
if [ $# -lt 2 ]; then
|
||||
echo "1: record: true/false
|
||||
@@ -57,8 +58,8 @@ while read line ; do
|
||||
fi
|
||||
done < <(adb devices | cut -f1)
|
||||
|
||||
if [ ! $emulatorIsRunning ] ; then
|
||||
emulator -writable-system -avd uiComparison -no-snapshot -gpu swiftshader_indirect -no-audio -skin 500x833 &
|
||||
if [ "$emulatorIsRunning" == false ] ; then
|
||||
"$(command -v emulator)" -writable-system -avd uiComparison -no-snapshot -gpu swiftshader_indirect -no-audio -skin 500x833 &
|
||||
fi
|
||||
|
||||
if [ -e $5 ] ; then
|
||||
|
||||
@@ -1,28 +1,27 @@
|
||||
#!/usr/bin/env bash
|
||||
#1: LOG_USERNAME
|
||||
#2: LOG_PASSWORD
|
||||
#3: DRONE_BUILD_NUMBER
|
||||
#4: BRANCH (stable or master)
|
||||
#5: TYPE (IT or Unit)
|
||||
#6: DRONE_PULL_REQUEST
|
||||
#7: GITHUB_TOKEN
|
||||
#1: BRANCH
|
||||
#2: TYPE
|
||||
#3: PR
|
||||
#4: GITHUB_TOKEN
|
||||
|
||||
BRANCH=$1
|
||||
TYPE=$2
|
||||
PR=$3
|
||||
GITHUB_USER=$4
|
||||
GITHUB_PASSWORD=$5
|
||||
GITHUB_TOKEN=$4
|
||||
|
||||
BRANCH_TYPE=$BRANCH-$TYPE
|
||||
|
||||
# delete all old comments, matching this type
|
||||
echo "Deleting old comments for $BRANCH_TYPE"
|
||||
oldComments=$(curl 2>/dev/null --header "authorization: Bearer $GITHUB_TOKEN" -X GET https://api.github.com/repos/nextcloud/android/issues/$PR/comments | jq --arg TYPE $BRANCH_TYPE '.[] | (.id |tostring) + "|" + (.user.login | test("nextcloud-android-bot") | tostring) + "|" + (.body | test([$TYPE]) | tostring)'| grep "true|true" | tr -d "\"" | cut -f1 -d"|")
|
||||
count=$(echo $oldComments | grep true | wc -l)
|
||||
oldComments=$(curl 2>/dev/null --header "authorization: Bearer $GITHUB_TOKEN" -X GET https://api.github.com/repos/nextcloud/android/issues/$PR/comments | jq --arg TYPE $BRANCH_TYPE '.[] | (.id |tostring) + "|" + (.user.login | test("(nextcloud-android-bot|github-actions)") | tostring) + "|" + (.body | test([$TYPE]) | tostring)'| grep "true|true" | tr -d "\"" | cut -f1 -d"|")
|
||||
count=$(echo -n "$oldComments" | grep -c '^')
|
||||
echo "Found $count old comments"
|
||||
|
||||
echo $oldComments | while read comment ; do
|
||||
echo "Deleting comment: $comment"
|
||||
curl 2>/dev/null --header "authorization: Bearer $GITHUB_TOKEN" -X DELETE https://api.github.com/repos/nextcloud/android/issues/comments/$comment
|
||||
done
|
||||
if [ "$count" -gt 0 ]; then
|
||||
echo "$oldComments" | while read comment ; do
|
||||
echo "Deleting comment: $comment"
|
||||
curl 2>/dev/null --header "authorization: Bearer $GITHUB_TOKEN" -X DELETE https://api.github.com/repos/nextcloud/android/issues/comments/$comment
|
||||
done
|
||||
fi
|
||||
|
||||
exit 0
|
||||
@@ -1,17 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
BRANCH=$1
|
||||
TYPE=$2
|
||||
PR=$3
|
||||
GITHUB_USER=$4
|
||||
GITHUB_PASSWORD=$5
|
||||
BRANCH_TYPE=$BRANCH-$TYPE
|
||||
|
||||
# delete all old comments, matching this type
|
||||
oldComments=$(curl 2>/dev/null -u $GITHUB_USER:$GITHUB_PASSWORD -X GET https://api.github.com/repos/nextcloud/android/issues/$PR/comments | jq --arg TYPE $BRANCH_TYPE '.[] | (.id |tostring) + "|" + (.user.login | test("nextcloud-android-bot") | tostring) + "|" + (.body | test([$TYPE]) | tostring)'| grep "true|true" | tr -d "\"" | cut -f1 -d"|")
|
||||
|
||||
echo $oldComments | while read comment ; do
|
||||
curl 2>/dev/null -u $GITHUB_USER:$GITHUB_PASSWORD -X DELETE https://api.github.com/repos/nextcloud/android/issues/comments/$comment
|
||||
done
|
||||
|
||||
exit 0
|
||||
@@ -0,0 +1,85 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Nextcloud Android client application
|
||||
#
|
||||
# @author Tobias Kaminsky
|
||||
# Copyright (C) 2021 Tobias Kaminsky
|
||||
# Copyright (C) 2021 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/>.
|
||||
#
|
||||
|
||||
error=0
|
||||
total=0
|
||||
|
||||
cp scripts/screenshotCombinations scripts/screenshotCombinations_
|
||||
grep -v "#" scripts/screenshotCombinations_ > scripts/screenshotCombinations
|
||||
rm scripts/screenshotCombinations_
|
||||
|
||||
echo '<!DOCTYPE html>
|
||||
<html lang="de">
|
||||
<head>
|
||||
<meta charset="utf-8"/>
|
||||
</head>'
|
||||
|
||||
echo "<table>"
|
||||
echo "<tr><td style='width:150px'>Original</td>"
|
||||
while read line; do
|
||||
echo "<td style='width:150px'>$line</td>"
|
||||
done < scripts/screenshotCombinations
|
||||
echo "</tr>"
|
||||
|
||||
#for image in ./build/reports/shot/verification/images/*.png ; do
|
||||
for image in $(/bin/ls -1 ./screenshots/gplay/debug/*.png | grep -v _dark_ | grep -v _light_) ; do
|
||||
cp $image build/screenshotSummary/images/
|
||||
|
||||
echo "<tr style='height:200px'>"
|
||||
echo "<td><a target='_blank' href=\"images/$(basename $image)\"><img width=100px src=\"images/$(basename $image)\"/></a></td>"
|
||||
|
||||
while read line; do
|
||||
echo "<td>"
|
||||
|
||||
mode=$(echo $line | cut -d" " -f1)
|
||||
color=$(echo $line | cut -d" " -f2)
|
||||
total=$((total + 1))
|
||||
|
||||
if [ $mode = "light" -a $color = "blue" ]; then
|
||||
name=$(basename $image)
|
||||
else
|
||||
name=$(basename $image| sed s"/\.png/_${mode}_$color\.png/")
|
||||
fi
|
||||
|
||||
# if image does not exist
|
||||
if [ ! -e ./build/reports/shot/verification/images/$name ]; then
|
||||
echo "<span style='color: red'>✘</span>"
|
||||
error=$((error + 1))
|
||||
elif [ -e ./build/reports/shot/verification/images/diff_$name ]; then
|
||||
# file with "diff_" prefix
|
||||
cp ./build/reports/shot/verification/images/diff_$name build/screenshotSummary/images/
|
||||
echo "<a target='_blank' href=\"images/diff_$name\"><img width=100px src=\"images/diff_$name\"/></a>"
|
||||
error=$((error + 1))
|
||||
else
|
||||
echo "✔"
|
||||
fi
|
||||
|
||||
echo "</td>"
|
||||
done < scripts/screenshotCombinations
|
||||
|
||||
echo "</tr>"
|
||||
done
|
||||
|
||||
echo "</table>"
|
||||
|
||||
echo "ERROR: $error / $total"
|
||||
echo "</html>"
|
||||
@@ -0,0 +1,14 @@
|
||||
#!/bin/bash
|
||||
# Pre-commit hook: don't allow commits if detekt or ktlint fail. Skip with "git commit --no-verify".
|
||||
echo "Running pre-commit checks."
|
||||
|
||||
if ! ./gradlew --daemon ktlint &>/dev/null; then
|
||||
echo >&2 "Lint failed! See report at file://$(pwd)/build/ktlint.txt"
|
||||
echo >&2 "Hint: fix most lint errors with ./gradlew ktlintFormat"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if ! ./gradlew --daemon detekt &>/dev/null; then
|
||||
echo >&2 "Detekt failed! See report at file://$(pwd)/build/reports/detekt/detekt.html"
|
||||
exit 1
|
||||
fi
|
||||
@@ -0,0 +1,27 @@
|
||||
#!/bin/bash
|
||||
# Pre-push: Don't allow commits without Signed-off-by. Skip with "git push --no-verify".
|
||||
set -euo pipefail
|
||||
|
||||
z40=0000000000000000000000000000000000000000 # magic deleted ref
|
||||
|
||||
while read local_ref local_sha remote_ref remote_sha; do
|
||||
if [ "$local_sha" != $z40 ]; then
|
||||
if [ "$remote_sha" = $z40 ]; then
|
||||
# New branch, examine all commits
|
||||
range="$(git merge-base master $local_sha)..$local_sha"
|
||||
else
|
||||
# Update to existing branch, examine new commits
|
||||
range="$remote_sha..$local_sha"
|
||||
fi
|
||||
|
||||
# Check for commits without sign-off
|
||||
commit=$(git rev-list --grep 'Signed-off-by' --invert-grep "$range")
|
||||
if [ -n "$commit" ]; then
|
||||
echo >&2 "Found commits without sign-off in $local_ref. Aborting push. Offending commits:"
|
||||
echo >&2 "$commit"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
exit 0
|
||||
@@ -1,6 +1,6 @@
|
||||
#!/bin/bash
|
||||
|
||||
## $1 noCI/stable/master: wether to run deleteOutdatedComments.sh or uploadReport.sh
|
||||
## $1 noCI/stable/master: wether to run deleteOldComments.sh or uploadReport.sh
|
||||
## $2 true/false: record or verify screenshots
|
||||
## $3 classMethod: piped from androidScreenshotTest
|
||||
## $4 github event number
|
||||
@@ -16,12 +16,12 @@ fi
|
||||
classMethod=$3
|
||||
|
||||
resultCode=0
|
||||
while read line
|
||||
grep -v "#" scripts/screenshotCombinations | while read line
|
||||
do
|
||||
darkMode=$(echo "$line" | cut -d" " -f1)
|
||||
color=$(echo "$line" | cut -d" " -f2)
|
||||
|
||||
echo "Run $color on $darkMode mode"
|
||||
echo -n "Run $color on $darkMode mode"
|
||||
|
||||
if [[ $1 = "noCI" ]]; then
|
||||
./gradlew --console plain gplayDebugExecuteScreenshotTests \
|
||||
@@ -32,7 +32,9 @@ do
|
||||
-Pandroid.testInstrumentationRunnerArguments.DARKMODE="$darkMode" \
|
||||
$classMethod </dev/null > /dev/null
|
||||
if [[ $? -ne 0 ]]; then
|
||||
exit
|
||||
echo " failed!"
|
||||
else
|
||||
echo
|
||||
fi
|
||||
else
|
||||
./gradlew --console plain gplayDebugExecuteScreenshotTests \
|
||||
@@ -40,12 +42,11 @@ do
|
||||
-Pandroid.testInstrumentationRunnerArguments.annotation=com.owncloud.android.utils.ScreenshotTest \
|
||||
-Pandroid.testInstrumentationRunnerArguments.COLOR="$color" \
|
||||
-Pandroid.testInstrumentationRunnerArguments.DARKMODE="$darkMode" </dev/null > /dev/null \
|
||||
&& scripts/deleteOutdatedComments.sh "$1-$darkMode-$color" "Screenshot" "$4" \
|
||||
"$GIT_USERNAME" "$GIT_TOKEN" \
|
||||
&& scripts/deleteOldComments.sh "$1-$darkMode-$color" "Screenshot" "$4" "$GIT_TOKEN" \
|
||||
|| resultCode=1 && scripts/uploadReport.sh "$LOG_USERNAME" "$LOG_PASSWORD" "$4" \
|
||||
"$1-$darkMode-$color" "Screenshot" "$4" "$GIT_USERNAME" "$GIT_TOKEN"
|
||||
"$1-$darkMode-$color" "Screenshot" "$4" "$GIT_TOKEN"
|
||||
fi
|
||||
done < scripts/screenshotCombinations
|
||||
done
|
||||
|
||||
sed -i s'#<bool name="is_beta">true</bool>#<bool name="is_beta">false</bool>#'g src/main/res/values/setup.xml
|
||||
|
||||
|
||||
@@ -7,34 +7,34 @@ LOG_USERNAME=$4
|
||||
LOG_PASSWORD=$5
|
||||
DRONE_BUILD_NUMBER=$6
|
||||
|
||||
scripts/deleteOldComments.sh "master" "Unit" $DRONE_PULL_REQUEST $GIT_TOKEN
|
||||
scripts/deleteOldComments.sh "master" "IT" $DRONE_PULL_REQUEST $GIT_TOKEN
|
||||
|
||||
./gradlew assembleGplay
|
||||
./gradlew assembleGplayDebug
|
||||
|
||||
scripts/wait_for_emulator.sh
|
||||
./gradlew jacocoTestGplayDebugUnitTestReport
|
||||
status=$?
|
||||
stat=$?
|
||||
|
||||
if [ $status -eq 0 ]; then
|
||||
scripts/deleteOutdatedComments.sh "master" "Unit" $DRONE_PULL_REQUEST $GIT_USERNAME $GIT_TOKEN
|
||||
else
|
||||
bash scripts/uploadReport.sh $LOG_USERNAME $LOG_PASSWORD $DRONE_BUILD_NUMBER "master" "Unit" $DRONE_PULL_REQUEST $GIT_USERNAME $GIT_TOKEN
|
||||
if [ ! $stat -eq 0 ]; then
|
||||
bash scripts/uploadReport.sh $LOG_USERNAME $LOG_PASSWORD $DRONE_BUILD_NUMBER "master" "Unit" $DRONE_PULL_REQUEST $GIT_TOKEN
|
||||
fi
|
||||
|
||||
./gradlew installGplayDebugAndroidTest
|
||||
scripts/wait_for_server.sh "server"
|
||||
./gradlew createGplayDebugCoverageReport -Pcoverage -Pandroid.testInstrumentationRunnerArguments.notAnnotation=com.owncloud.android.utils.ScreenshotTest
|
||||
status=$?
|
||||
stat=$(( stat | $? ))
|
||||
|
||||
if [ $status -eq 0 ]; then
|
||||
scripts/deleteOutdatedComments.sh "master" "IT" $DRONE_PULL_REQUEST $GIT_USERNAME $GIT_TOKEN
|
||||
else
|
||||
bash scripts/uploadReport.sh $LOG_USERNAME $LOG_PASSWORD $DRONE_BUILD_NUMBER "master" "IT" $DRONE_PULL_REQUEST $GIT_USERNAME $GIT_TOKEN
|
||||
if [ ! $stat -eq 0 ]; then
|
||||
bash scripts/uploadReport.sh $LOG_USERNAME $LOG_PASSWORD $DRONE_BUILD_NUMBER "master" "IT" $DRONE_PULL_REQUEST $GIT_TOKEN
|
||||
fi
|
||||
|
||||
./gradlew combinedTestReport
|
||||
status=$?
|
||||
stat=$(( stat | $? ))
|
||||
|
||||
curl -o codecov.sh https://codecov.io/bash
|
||||
bash ./codecov.sh -t fc506ba4-33c3-43e4-a760-aada38c24fd5
|
||||
|
||||
exit $status
|
||||
echo "Exit with: " $stat
|
||||
exit $stat
|
||||
@@ -1,4 +1,10 @@
|
||||
light blue
|
||||
dark blue
|
||||
light white
|
||||
dark white
|
||||
#dark blue
|
||||
#light white
|
||||
#dark white
|
||||
#light black
|
||||
#dark black
|
||||
#light red
|
||||
#dark red
|
||||
#light lightgreen
|
||||
dark lightgreen
|
||||
@@ -0,0 +1,30 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Nextcloud Android client application
|
||||
#
|
||||
# @author Tobias Kaminsky
|
||||
# Copyright (C) 2021 Tobias Kaminsky
|
||||
# Copyright (C) 2021 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/>.
|
||||
#
|
||||
|
||||
mkdir -p build/screenshotSummary/images
|
||||
|
||||
scripts/generateScreenshotOverview.sh > build/screenshotSummary/summary.html
|
||||
error=$?
|
||||
|
||||
scripts/uploadScreenshotSummary.sh $LOG_USERNAME $LOG_PASSWORD
|
||||
|
||||
exit $error
|
||||
@@ -1,15 +1,21 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
curl_gh() {
|
||||
curl \
|
||||
--header "authorization: Bearer $GITHUB_TOKEN" \
|
||||
"$@"
|
||||
}
|
||||
|
||||
deleteOldComments() {
|
||||
# delete all old comments, matching this type
|
||||
echo "Deleting old comments for $BRANCH_TYPE"
|
||||
oldComments=$(curl > /dev/null 2>&1 -u $GITHUB_USER:$GITHUB_PASSWORD -X GET https://api.github.com/repos/nextcloud/android/issues/$PR/comments | jq --arg TYPE $BRANCH_TYPE '.[] | (.id |tostring) + "|" + (.user.login | test("nextcloud-android-bot") | tostring) + "|" + (.body | test([$TYPE]) | tostring)'| grep "true|true" | tr -d "\"" | cut -f1 -d"|")
|
||||
oldComments=$(curl_gh > /dev/null 2>&1 -X GET https://api.github.com/repos/nextcloud/android/issues/$PR/comments | jq --arg TYPE $BRANCH_TYPE '.[] | (.id |tostring) + "|" + (.user.login | test("nextcloud-android-bot") | tostring) + "|" + (.body | test([$TYPE]) | tostring)'| grep "true|true" | tr -d "\"" | cut -f1 -d"|")
|
||||
count=$(echo $oldComments | grep true | wc -l)
|
||||
echo "Found $count old comments"
|
||||
|
||||
echo $oldComments | while read comment ; do
|
||||
echo "Deleting comment: $comment"
|
||||
curl > /dev/null 2>&1 -u $GITHUB_USER:$GITHUB_PASSWORD -X DELETE https://api.github.com/repos/nextcloud/android/issues/comments/$comment
|
||||
curl_gh > /dev/null 2>&1 -X DELETE https://api.github.com/repos/nextcloud/android/issues/comments/$comment
|
||||
done
|
||||
}
|
||||
|
||||
@@ -23,7 +29,7 @@ upload() {
|
||||
|
||||
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 \
|
||||
curl_gh -X POST https://api.github.com/repos/nextcloud/android/issues/$PR/comments \
|
||||
-d "{ \"body\" : \"$BRANCH_TYPE test failed: https://www.kaminsky.me/nc-dev/android-integrationTests/$REMOTE_FOLDER \" }"
|
||||
|
||||
exit 1
|
||||
@@ -35,8 +41,7 @@ upload() {
|
||||
#4: BRANCH (stable or master)
|
||||
#5: TYPE (IT or Unit)
|
||||
#6: DRONE_PULL_REQUEST
|
||||
#7: GIT_USERNAME
|
||||
#8: GIT_TOKEN
|
||||
#7: GITHUB_TOKEN
|
||||
|
||||
URL=https://nextcloud.kaminsky.me/remote.php/webdav/android-integrationTests
|
||||
ID=$3
|
||||
@@ -45,8 +50,8 @@ PASS=$2
|
||||
BRANCH=$4
|
||||
TYPE=$5
|
||||
PR=$6
|
||||
GITHUB_USER=$7
|
||||
GITHUB_PASSWORD=$8
|
||||
GITHUB_TOKEN="$7"
|
||||
|
||||
REMOTE_FOLDER=$ID-$TYPE-$BRANCH-$(date +%H-%M)
|
||||
BRANCH_TYPE=$BRANCH-$TYPE
|
||||
|
||||
@@ -71,7 +76,7 @@ else
|
||||
deleteOldComments
|
||||
echo "$BRANCH_TYPE test failed, but no output was generated. Maybe a preliminary stage failed."
|
||||
|
||||
curl > /dev/null 2>&1 -u $GITHUB_USER:$GITHUB_PASSWORD \
|
||||
curl_gh > /dev/null 2>&1 \
|
||||
-X POST https://api.github.com/repos/nextcloud/android/issues/$PR/comments \
|
||||
-d "{ \"body\" : \"$BRANCH_TYPE test failed, but no output was generated. Maybe a preliminary stage failed. \" }"
|
||||
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
#!/bin/bash -x
|
||||
|
||||
#1: LOG_USERNAME
|
||||
#2: LOG_PASSWORD
|
||||
|
||||
DAV_URL=https://nextcloud.kaminsky.me/remote.php/webdav/android-screenshot-summary/
|
||||
PUBLIC_URL=https://www.kaminsky.me/nc-dev/android-screenshot-summary
|
||||
USER=$1
|
||||
PASS=$2
|
||||
|
||||
date=$(date +%F)
|
||||
echo "Uploaded screenshot summary to $PUBLIC_URL/$date/summary.html"
|
||||
|
||||
cd build/screenshotSummary
|
||||
|
||||
find . -type d -exec curl > /dev/null 2>&1 -u $USER:$PASS -X MKCOL $DAV_URL/$date/$(echo {} | sed s#\./##) \;
|
||||
find . -type f -exec curl > /dev/null 2>&1 -u $USER:$PASS -X PUT $DAV_URL/$date/$(echo {} | sed s#\./##) --upload-file {} \;
|
||||
@@ -52,6 +52,7 @@ import net.bytebuddy.utility.RandomString;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.io.File;
|
||||
@@ -84,6 +85,9 @@ public class EndToEndRandomIT extends AbstractOnServerIT {
|
||||
private int actionCount = 20;
|
||||
private String rootEncFolder = "/e/";
|
||||
|
||||
@Rule
|
||||
public RetryTestRule retryTestRule = new RetryTestRule();
|
||||
|
||||
@BeforeClass
|
||||
public static void initClass() {
|
||||
arbitraryDataProvider = new ArbitraryDataProvider(targetContext.getContentResolver());
|
||||
@@ -95,7 +99,9 @@ public class EndToEndRandomIT extends AbstractOnServerIT {
|
||||
|
||||
if (capability.getVersion().equals(new OwnCloudVersion("0.0.0"))) {
|
||||
// fetch new one
|
||||
assertTrue(new GetCapabilitiesOperation().execute(client, getStorageManager()).isSuccess());
|
||||
assertTrue(new GetCapabilitiesOperation(getStorageManager())
|
||||
.execute(client)
|
||||
.isSuccess());
|
||||
}
|
||||
// tests only for NC19+
|
||||
assumeTrue(getStorageManager()
|
||||
@@ -464,8 +470,9 @@ public class EndToEndRandomIT extends AbstractOnServerIT {
|
||||
false,
|
||||
account,
|
||||
false,
|
||||
targetContext)
|
||||
.execute(client, getStorageManager())
|
||||
targetContext,
|
||||
getStorageManager())
|
||||
.execute(client)
|
||||
.isSuccess());
|
||||
}
|
||||
|
||||
@@ -614,8 +621,8 @@ public class EndToEndRandomIT extends AbstractOnServerIT {
|
||||
Log_OC.d(this, "Remove file: " + child.getDecryptedRemotePath());
|
||||
}
|
||||
|
||||
assertTrue(new RemoveFileOperation(child, false, account, false, targetContext)
|
||||
.execute(client, getStorageManager())
|
||||
assertTrue(new RemoveFileOperation(child, false, account, false, targetContext, getStorageManager())
|
||||
.execute(client)
|
||||
.isSuccess()
|
||||
);
|
||||
}
|
||||
|
||||
@@ -135,8 +135,8 @@ public class FileDisplayActivityIT extends AbstractOnServerIT {
|
||||
FileDisplayActivity sut = activityRule.launchActivity(null);
|
||||
|
||||
// given test folder
|
||||
assertTrue(new CreateFolderOperation("/test/", user, targetContext)
|
||||
.execute(client, getStorageManager())
|
||||
assertTrue(new CreateFolderOperation("/test/", user, targetContext, getStorageManager())
|
||||
.execute(client)
|
||||
.isSuccess());
|
||||
|
||||
// navigate into it
|
||||
@@ -162,8 +162,8 @@ public class FileDisplayActivityIT extends AbstractOnServerIT {
|
||||
public void switchToGridView() {
|
||||
activityRule.launchActivity(null);
|
||||
|
||||
assertTrue(new CreateFolderOperation("/test/", user, targetContext)
|
||||
.execute(client, getStorageManager())
|
||||
assertTrue(new CreateFolderOperation("/test/", user, targetContext, getStorageManager())
|
||||
.execute(client)
|
||||
.isSuccess());
|
||||
|
||||
Espresso.onView(withId(R.id.switch_grid_view_button)).perform(click());
|
||||
|
||||
@@ -27,6 +27,7 @@ import android.Manifest;
|
||||
import com.owncloud.android.AbstractIT;
|
||||
import com.owncloud.android.R;
|
||||
import com.owncloud.android.ui.activity.FileDisplayActivity;
|
||||
import com.owncloud.android.ui.fragment.OCFileListFragment;
|
||||
import com.owncloud.android.utils.ScreenshotTest;
|
||||
|
||||
import org.junit.Rule;
|
||||
@@ -39,6 +40,7 @@ import androidx.test.rule.GrantPermissionRule;
|
||||
|
||||
import static androidx.test.espresso.Espresso.onView;
|
||||
import static androidx.test.espresso.matcher.ViewMatchers.withId;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
|
||||
public class FileDisplayActivityScreenshotIT extends AbstractIT {
|
||||
@Rule public IntentsTestRule<FileDisplayActivity> activityRule = new IntentsTestRule<>(FileDisplayActivity.class,
|
||||
@@ -64,14 +66,16 @@ public class FileDisplayActivityScreenshotIT extends AbstractIT {
|
||||
screenshot(sut);
|
||||
}
|
||||
|
||||
@Test
|
||||
@ScreenshotTest
|
||||
//@Test
|
||||
//@ScreenshotTest
|
||||
public void showMediaThenAllFiles() {
|
||||
FileDisplayActivity sut = activityRule.launchActivity(null);
|
||||
FileDisplayActivity fileDisplayActivity = activityRule.launchActivity(null);
|
||||
OCFileListFragment sut = fileDisplayActivity.getListOfFilesFragment();
|
||||
assertNotNull(sut);
|
||||
|
||||
sut.getListOfFilesFragment().setFabEnabled(false);
|
||||
sut.getListOfFilesFragment().setEmptyListLoadingMessage();
|
||||
sut.getListOfFilesFragment().setLoading(false);
|
||||
sut.setFabEnabled(false);
|
||||
sut.setEmptyListLoadingMessage();
|
||||
sut.setLoading(false);
|
||||
|
||||
// open drawer
|
||||
onView(withId(R.id.drawer_layout)).perform(DrawerActions.open());
|
||||
@@ -89,11 +93,11 @@ public class FileDisplayActivityScreenshotIT extends AbstractIT {
|
||||
|
||||
// then compare screenshot
|
||||
shortSleep();
|
||||
sut.getListOfFilesFragment().setFabEnabled(false);
|
||||
sut.getListOfFilesFragment().setEmptyListLoadingMessage();
|
||||
sut.getListOfFilesFragment().setLoading(false);
|
||||
sut.setFabEnabled(false);
|
||||
sut.setEmptyListLoadingMessage();
|
||||
sut.setLoading(false);
|
||||
shortSleep();
|
||||
screenshot(sut);
|
||||
screenshot(fileDisplayActivity);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -86,6 +86,7 @@ public class SettingsActivityIT extends AbstractIT {
|
||||
SettingsActivity sut = activityRule.launchActivity(null);
|
||||
sut.handleMnemonicRequest(intent);
|
||||
|
||||
Looper.myLooper().quitSafely();
|
||||
assertTrue(true); // if we reach this, everything is ok
|
||||
}
|
||||
}
|
||||
@@ -71,7 +71,7 @@ public class SyncedFoldersActivityIT extends AbstractIT {
|
||||
false,
|
||||
false,
|
||||
true,
|
||||
"test@https://server.com",
|
||||
"test@https://nextcloud.localhost",
|
||||
0,
|
||||
0,
|
||||
true,
|
||||
|
||||
@@ -38,7 +38,7 @@ class RegisteredUserTest {
|
||||
|
||||
private companion object {
|
||||
fun buildTestUser(accountName: String): RegisteredUser {
|
||||
val uri = Uri.parse("https://nextcloud.localhost.localdomain")
|
||||
val uri = Uri.parse("https://nextcloud.localhost")
|
||||
val credentials = OwnCloudBasicCredentials("user", "pass")
|
||||
val account = Account(accountName, "test-type")
|
||||
val ownCloudAccount = OwnCloudAccount(uri, credentials)
|
||||
@@ -58,7 +58,7 @@ class RegisteredUserTest {
|
||||
|
||||
@Before
|
||||
fun setUp() {
|
||||
user = buildTestUser("[email protected].localdomain")
|
||||
user = buildTestUser("[email protected]")
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -25,11 +25,9 @@ package com.nextcloud.client.etm
|
||||
import android.app.Activity
|
||||
import androidx.test.espresso.intent.rule.IntentsTestRule
|
||||
import androidx.test.internal.runner.junit4.statement.UiThreadStatement
|
||||
import com.nextcloud.client.preferences.AppPreferencesImpl
|
||||
import com.owncloud.android.AbstractIT
|
||||
import com.owncloud.android.lib.resources.status.OwnCloudVersion
|
||||
import com.owncloud.android.utils.ScreenshotTest
|
||||
import org.junit.Assume
|
||||
import org.junit.Before
|
||||
import org.junit.Rule
|
||||
import org.junit.Test
|
||||
|
||||
@@ -37,16 +35,6 @@ class EtmActivityTest : AbstractIT() {
|
||||
@get:Rule
|
||||
var activityRule = IntentsTestRule(EtmActivity::class.java, true, false)
|
||||
|
||||
@Before
|
||||
fun before() {
|
||||
// tests only on NC 18
|
||||
Assume.assumeTrue(
|
||||
storageManager
|
||||
.getCapability(account.name)
|
||||
.version.compareTo(OwnCloudVersion.nextcloud_18) == 0
|
||||
)
|
||||
}
|
||||
|
||||
@Test
|
||||
@ScreenshotTest
|
||||
fun overview() {
|
||||
@@ -62,7 +50,11 @@ class EtmActivityTest : AbstractIT() {
|
||||
fun preferences() {
|
||||
val sut: EtmActivity = activityRule.launchActivity(null)
|
||||
|
||||
UiThreadStatement.runOnUiThread { sut.vm.onPageSelected(0) }
|
||||
UiThreadStatement.runOnUiThread {
|
||||
val preferences = AppPreferencesImpl.fromContext(targetContext)
|
||||
preferences.pushToken = "Push token"
|
||||
sut.vm.onPageSelected(0)
|
||||
}
|
||||
|
||||
screenshot(sut)
|
||||
}
|
||||
|
||||
@@ -0,0 +1,62 @@
|
||||
/*
|
||||
*
|
||||
* Nextcloud Android client application
|
||||
*
|
||||
* @author Tobias Kaminsky
|
||||
* Copyright (C) 2021 Tobias Kaminsky
|
||||
* Copyright (C) 2021 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.sso
|
||||
|
||||
import com.nextcloud.android.sso.InputStreamBinder
|
||||
import com.nextcloud.android.sso.QueryParam
|
||||
import org.junit.Assert.assertEquals
|
||||
import org.junit.Test
|
||||
|
||||
class InputStreamBinderTest {
|
||||
@Test
|
||||
fun convertMapToNVP() {
|
||||
val source = mutableMapOf<String, String>()
|
||||
source["quality"] = "1024p"
|
||||
source["someOtherParameter"] = "parameterValue"
|
||||
source["duplicate"] = "1"
|
||||
source["duplicate"] = "2" // this overwrites previous parameter
|
||||
|
||||
val output = InputStreamBinder.convertMapToNVP(source)
|
||||
|
||||
assertEquals(source.size, output.size)
|
||||
assertEquals("1024p", output[0].value)
|
||||
assertEquals("parameterValue", output[1].value)
|
||||
assertEquals("2", output[2].value)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun convertListToNVP() {
|
||||
val source = mutableListOf<QueryParam>()
|
||||
source.add(QueryParam("quality", "1024p"))
|
||||
source.add(QueryParam("someOtherParameter", "parameterValue"))
|
||||
source.add(QueryParam("duplicate", "1"))
|
||||
source.add(QueryParam("duplicate", "2")) // here we can have same parameter multiple times
|
||||
|
||||
val output = InputStreamBinder.convertListToNVP(source)
|
||||
|
||||
assertEquals(source.size, output.size)
|
||||
assertEquals("1024p", output[0].value)
|
||||
assertEquals("parameterValue", output[1].value)
|
||||
assertEquals("1", output[2].value)
|
||||
assertEquals("2", output[3].value)
|
||||
}
|
||||
}
|
||||
@@ -103,13 +103,13 @@ public abstract class AbstractIT {
|
||||
}
|
||||
}
|
||||
|
||||
Account temp = new Account("test@https://server.com", MainApp.getAccountType(targetContext));
|
||||
Account temp = new Account("test@https://nextcloud.localhost", MainApp.getAccountType(targetContext));
|
||||
platformAccountManager.addAccountExplicitly(temp, "password", null);
|
||||
platformAccountManager.setUserData(temp, AccountUtils.Constants.KEY_OC_BASE_URL, "https://server.com");
|
||||
platformAccountManager.setUserData(temp, AccountUtils.Constants.KEY_OC_BASE_URL, "https://nextcloud.localhost");
|
||||
platformAccountManager.setUserData(temp, KEY_USER_ID, "test");
|
||||
|
||||
final UserAccountManager userAccountManager = UserAccountManagerImpl.fromContext(targetContext);
|
||||
account = userAccountManager.getAccountByName("test@https://server.com");
|
||||
account = userAccountManager.getAccountByName("test@https://nextcloud.localhost");
|
||||
|
||||
if (account == null) {
|
||||
throw new ActivityNotFoundException();
|
||||
@@ -156,6 +156,10 @@ public abstract class AbstractIT {
|
||||
colorHex = "#000000";
|
||||
break;
|
||||
|
||||
case "lightgreen":
|
||||
colorHex = "#aaff00";
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@@ -312,8 +316,8 @@ public abstract class AbstractIT {
|
||||
}
|
||||
|
||||
public OCFile createFolder(String remotePath) {
|
||||
TestCase.assertTrue(new CreateFolderOperation(remotePath, user, targetContext)
|
||||
.execute(client, getStorageManager())
|
||||
TestCase.assertTrue(new CreateFolderOperation(remotePath, user, targetContext, getStorageManager())
|
||||
.execute(client)
|
||||
.isSuccess());
|
||||
|
||||
return getStorageManager().getFileByDecryptedRemotePath(remotePath);
|
||||
@@ -355,17 +359,18 @@ public abstract class AbstractIT {
|
||||
targetContext.getContentResolver());
|
||||
|
||||
UploadFileOperation newUpload = new UploadFileOperation(
|
||||
uploadsStorageManager,
|
||||
connectivityServiceMock,
|
||||
powerManagementServiceMock,
|
||||
user,
|
||||
null,
|
||||
ocUpload,
|
||||
NameCollisionPolicy.DEFAULT,
|
||||
FileUploader.LOCAL_BEHAVIOUR_COPY,
|
||||
targetContext,
|
||||
false,
|
||||
false
|
||||
uploadsStorageManager,
|
||||
connectivityServiceMock,
|
||||
powerManagementServiceMock,
|
||||
user,
|
||||
null,
|
||||
ocUpload,
|
||||
NameCollisionPolicy.DEFAULT,
|
||||
FileUploader.LOCAL_BEHAVIOUR_COPY,
|
||||
targetContext,
|
||||
false,
|
||||
false,
|
||||
getStorageManager()
|
||||
);
|
||||
newUpload.addRenameUploadListener(() -> {
|
||||
// dummy
|
||||
@@ -373,7 +378,7 @@ public abstract class AbstractIT {
|
||||
|
||||
newUpload.setRemoteFolderToBeCreated();
|
||||
|
||||
RemoteOperationResult result = newUpload.execute(client, getStorageManager());
|
||||
RemoteOperationResult result = newUpload.execute(client);
|
||||
assertTrue(result.getLogMessage(), result.isSuccess());
|
||||
}
|
||||
|
||||
|
||||
@@ -203,17 +203,18 @@ public abstract class AbstractOnServerIT extends AbstractIT {
|
||||
targetContext.getContentResolver());
|
||||
|
||||
UploadFileOperation newUpload = new UploadFileOperation(
|
||||
uploadsStorageManager,
|
||||
connectivityServiceMock,
|
||||
powerManagementServiceMock,
|
||||
user,
|
||||
null,
|
||||
ocUpload,
|
||||
NameCollisionPolicy.DEFAULT,
|
||||
localBehaviour,
|
||||
targetContext,
|
||||
false,
|
||||
false
|
||||
uploadsStorageManager,
|
||||
connectivityServiceMock,
|
||||
powerManagementServiceMock,
|
||||
user,
|
||||
null,
|
||||
ocUpload,
|
||||
NameCollisionPolicy.DEFAULT,
|
||||
localBehaviour,
|
||||
targetContext,
|
||||
false,
|
||||
false,
|
||||
getStorageManager()
|
||||
);
|
||||
newUpload.addRenameUploadListener(() -> {
|
||||
// dummy
|
||||
@@ -221,7 +222,7 @@ public abstract class AbstractOnServerIT extends AbstractIT {
|
||||
|
||||
newUpload.setRemoteFolderToBeCreated();
|
||||
|
||||
RemoteOperationResult result = newUpload.execute(client, getStorageManager());
|
||||
RemoteOperationResult result = newUpload.execute(client);
|
||||
assertTrue(result.getLogMessage(), result.isSuccess());
|
||||
|
||||
OCFile parentFolder = getStorageManager()
|
||||
|
||||
@@ -65,8 +65,9 @@ public class DownloadIT extends AbstractOnServerIT {
|
||||
false,
|
||||
account,
|
||||
false,
|
||||
targetContext)
|
||||
.execute(client, getStorageManager());
|
||||
targetContext,
|
||||
getStorageManager())
|
||||
.execute(client);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -27,8 +27,8 @@ public class FileIT extends AbstractOnServerIT {
|
||||
// folder does not exist yet
|
||||
assertNull(getStorageManager().getFileByPath(path));
|
||||
|
||||
SyncOperation syncOp = new CreateFolderOperation(path, user, targetContext);
|
||||
RemoteOperationResult result = syncOp.execute(client, getStorageManager());
|
||||
SyncOperation syncOp = new CreateFolderOperation(path, user, targetContext, getStorageManager());
|
||||
RemoteOperationResult result = syncOp.execute(client);
|
||||
|
||||
assertTrue(result.toString(), result.isSuccess());
|
||||
|
||||
@@ -37,7 +37,7 @@ public class FileIT extends AbstractOnServerIT {
|
||||
assertTrue(file.isFolder());
|
||||
|
||||
// cleanup
|
||||
new RemoveFileOperation(file, false, account, false, targetContext).execute(client, getStorageManager());
|
||||
new RemoveFileOperation(file, false, account, false, targetContext, getStorageManager()).execute(client);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -46,8 +46,8 @@ public class FileIT extends AbstractOnServerIT {
|
||||
// folder does not exist yet
|
||||
assertNull(getStorageManager().getFileByPath(path));
|
||||
|
||||
SyncOperation syncOp = new CreateFolderOperation(path, user, targetContext);
|
||||
RemoteOperationResult result = syncOp.execute(client, getStorageManager());
|
||||
SyncOperation syncOp = new CreateFolderOperation(path, user, targetContext, getStorageManager());
|
||||
RemoteOperationResult result = syncOp.execute(client);
|
||||
assertTrue(result.toString(), result.isSuccess());
|
||||
|
||||
// folder exists
|
||||
@@ -59,7 +59,8 @@ public class FileIT extends AbstractOnServerIT {
|
||||
false,
|
||||
account,
|
||||
false,
|
||||
targetContext)
|
||||
.execute(client, getStorageManager());
|
||||
targetContext,
|
||||
getStorageManager())
|
||||
.execute(client);
|
||||
}
|
||||
}
|
||||
@@ -73,8 +73,8 @@ public class ScreenshotsIT extends AbstractOnServerIT {
|
||||
|
||||
// folder does not exist yet
|
||||
if (getStorageManager().getFileByEncryptedRemotePath(path) == null) {
|
||||
SyncOperation syncOp = new CreateFolderOperation(path, user, targetContext);
|
||||
RemoteOperationResult result = syncOp.execute(client, getStorageManager());
|
||||
SyncOperation syncOp = new CreateFolderOperation(path, user, targetContext, getStorageManager());
|
||||
RemoteOperationResult result = syncOp.execute(client);
|
||||
|
||||
assertTrue(result.isSuccess());
|
||||
}
|
||||
|
||||
@@ -114,8 +114,9 @@ public class UploadIT extends AbstractOnServerIT {
|
||||
false,
|
||||
account,
|
||||
false,
|
||||
targetContext)
|
||||
.execute(client, getStorageManager());
|
||||
targetContext,
|
||||
getStorageManager())
|
||||
.execute(client);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -224,24 +225,25 @@ public class UploadIT extends AbstractOnServerIT {
|
||||
ocUpload.setWhileChargingOnly(true);
|
||||
|
||||
UploadFileOperation newUpload = new UploadFileOperation(
|
||||
uploadsStorageManager,
|
||||
connectivityServiceMock,
|
||||
powerManagementServiceMock,
|
||||
user,
|
||||
null,
|
||||
ocUpload,
|
||||
NameCollisionPolicy.DEFAULT,
|
||||
FileUploader.LOCAL_BEHAVIOUR_COPY,
|
||||
targetContext,
|
||||
false,
|
||||
true
|
||||
uploadsStorageManager,
|
||||
connectivityServiceMock,
|
||||
powerManagementServiceMock,
|
||||
user,
|
||||
null,
|
||||
ocUpload,
|
||||
NameCollisionPolicy.DEFAULT,
|
||||
FileUploader.LOCAL_BEHAVIOUR_COPY,
|
||||
targetContext,
|
||||
false,
|
||||
true,
|
||||
getStorageManager()
|
||||
);
|
||||
newUpload.setRemoteFolderToBeCreated();
|
||||
newUpload.addRenameUploadListener(() -> {
|
||||
// dummy
|
||||
});
|
||||
|
||||
RemoteOperationResult result = newUpload.execute(client, getStorageManager());
|
||||
RemoteOperationResult result = newUpload.execute(client);
|
||||
assertFalse(result.toString(), result.isSuccess());
|
||||
assertEquals(RemoteOperationResult.ResultCode.DELAYED_FOR_CHARGING, result.getCode());
|
||||
}
|
||||
@@ -271,24 +273,25 @@ public class UploadIT extends AbstractOnServerIT {
|
||||
ocUpload.setWhileChargingOnly(true);
|
||||
|
||||
UploadFileOperation newUpload = new UploadFileOperation(
|
||||
uploadsStorageManager,
|
||||
connectivityServiceMock,
|
||||
powerManagementServiceMock,
|
||||
user,
|
||||
null,
|
||||
ocUpload,
|
||||
NameCollisionPolicy.DEFAULT,
|
||||
FileUploader.LOCAL_BEHAVIOUR_COPY,
|
||||
targetContext,
|
||||
false,
|
||||
true
|
||||
uploadsStorageManager,
|
||||
connectivityServiceMock,
|
||||
powerManagementServiceMock,
|
||||
user,
|
||||
null,
|
||||
ocUpload,
|
||||
NameCollisionPolicy.DEFAULT,
|
||||
FileUploader.LOCAL_BEHAVIOUR_COPY,
|
||||
targetContext,
|
||||
false,
|
||||
true,
|
||||
getStorageManager()
|
||||
);
|
||||
newUpload.setRemoteFolderToBeCreated();
|
||||
newUpload.addRenameUploadListener(() -> {
|
||||
// dummy
|
||||
});
|
||||
|
||||
RemoteOperationResult result = newUpload.execute(client, getStorageManager());
|
||||
RemoteOperationResult result = newUpload.execute(client);
|
||||
assertTrue(result.toString(), result.isSuccess());
|
||||
}
|
||||
|
||||
@@ -310,24 +313,25 @@ public class UploadIT extends AbstractOnServerIT {
|
||||
ocUpload.setUseWifiOnly(true);
|
||||
|
||||
UploadFileOperation newUpload = new UploadFileOperation(
|
||||
uploadsStorageManager,
|
||||
connectivityServiceMock,
|
||||
powerManagementServiceMock,
|
||||
user,
|
||||
null,
|
||||
ocUpload,
|
||||
NameCollisionPolicy.DEFAULT,
|
||||
FileUploader.LOCAL_BEHAVIOUR_COPY,
|
||||
targetContext,
|
||||
true,
|
||||
false
|
||||
uploadsStorageManager,
|
||||
connectivityServiceMock,
|
||||
powerManagementServiceMock,
|
||||
user,
|
||||
null,
|
||||
ocUpload,
|
||||
NameCollisionPolicy.DEFAULT,
|
||||
FileUploader.LOCAL_BEHAVIOUR_COPY,
|
||||
targetContext,
|
||||
true,
|
||||
false,
|
||||
getStorageManager()
|
||||
);
|
||||
newUpload.setRemoteFolderToBeCreated();
|
||||
newUpload.addRenameUploadListener(() -> {
|
||||
// dummy
|
||||
});
|
||||
|
||||
RemoteOperationResult result = newUpload.execute(client, getStorageManager());
|
||||
RemoteOperationResult result = newUpload.execute(client);
|
||||
assertFalse(result.toString(), result.isSuccess());
|
||||
assertEquals(RemoteOperationResult.ResultCode.DELAYED_FOR_WIFI, result.getCode());
|
||||
}
|
||||
@@ -339,24 +343,25 @@ public class UploadIT extends AbstractOnServerIT {
|
||||
ocUpload.setWhileChargingOnly(true);
|
||||
|
||||
UploadFileOperation newUpload = new UploadFileOperation(
|
||||
uploadsStorageManager,
|
||||
connectivityServiceMock,
|
||||
powerManagementServiceMock,
|
||||
user,
|
||||
null,
|
||||
ocUpload,
|
||||
NameCollisionPolicy.DEFAULT,
|
||||
FileUploader.LOCAL_BEHAVIOUR_COPY,
|
||||
targetContext,
|
||||
true,
|
||||
false
|
||||
uploadsStorageManager,
|
||||
connectivityServiceMock,
|
||||
powerManagementServiceMock,
|
||||
user,
|
||||
null,
|
||||
ocUpload,
|
||||
NameCollisionPolicy.DEFAULT,
|
||||
FileUploader.LOCAL_BEHAVIOUR_COPY,
|
||||
targetContext,
|
||||
true,
|
||||
false,
|
||||
getStorageManager()
|
||||
);
|
||||
newUpload.setRemoteFolderToBeCreated();
|
||||
newUpload.addRenameUploadListener(() -> {
|
||||
// dummy
|
||||
});
|
||||
|
||||
RemoteOperationResult result = newUpload.execute(client, getStorageManager());
|
||||
RemoteOperationResult result = newUpload.execute(client);
|
||||
assertTrue(result.toString(), result.isSuccess());
|
||||
|
||||
// cleanup
|
||||
@@ -364,8 +369,9 @@ public class UploadIT extends AbstractOnServerIT {
|
||||
false,
|
||||
account,
|
||||
false,
|
||||
targetContext)
|
||||
.execute(client, getStorageManager());
|
||||
targetContext,
|
||||
getStorageManager())
|
||||
.execute(client);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -387,24 +393,25 @@ public class UploadIT extends AbstractOnServerIT {
|
||||
ocUpload.setUseWifiOnly(true);
|
||||
|
||||
UploadFileOperation newUpload = new UploadFileOperation(
|
||||
uploadsStorageManager,
|
||||
connectivityServiceMock,
|
||||
powerManagementServiceMock,
|
||||
user,
|
||||
null,
|
||||
ocUpload,
|
||||
NameCollisionPolicy.DEFAULT,
|
||||
FileUploader.LOCAL_BEHAVIOUR_COPY,
|
||||
targetContext,
|
||||
true,
|
||||
false
|
||||
uploadsStorageManager,
|
||||
connectivityServiceMock,
|
||||
powerManagementServiceMock,
|
||||
user,
|
||||
null,
|
||||
ocUpload,
|
||||
NameCollisionPolicy.DEFAULT,
|
||||
FileUploader.LOCAL_BEHAVIOUR_COPY,
|
||||
targetContext,
|
||||
true,
|
||||
false,
|
||||
getStorageManager()
|
||||
);
|
||||
newUpload.setRemoteFolderToBeCreated();
|
||||
newUpload.addRenameUploadListener(() -> {
|
||||
// dummy
|
||||
});
|
||||
|
||||
RemoteOperationResult result = newUpload.execute(client, getStorageManager());
|
||||
RemoteOperationResult result = newUpload.execute(client);
|
||||
assertFalse(result.toString(), result.isSuccess());
|
||||
assertEquals(RemoteOperationResult.ResultCode.DELAYED_FOR_WIFI, result.getCode());
|
||||
}
|
||||
|
||||
@@ -50,6 +50,7 @@ import java.util.List;
|
||||
import static com.owncloud.android.lib.resources.files.SearchRemoteOperation.SearchType.GALLERY_SEARCH;
|
||||
import static com.owncloud.android.lib.resources.files.SearchRemoteOperation.SearchType.PHOTO_SEARCH;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
@@ -76,8 +77,10 @@ abstract public class FileDataStorageManagerIT extends AbstractOnServerIT {
|
||||
|
||||
@Test
|
||||
public void simpleTest() {
|
||||
assertTrue(sut.getFileByPath("/").fileExists());
|
||||
assertNull(sut.getFileByPath("/123123"));
|
||||
OCFile file = sut.getFileByDecryptedRemotePath("/");
|
||||
assertNotNull(file);
|
||||
assertTrue(file.fileExists());
|
||||
assertNull(sut.getFileByDecryptedRemotePath("/123123"));
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -112,9 +115,9 @@ abstract public class FileDataStorageManagerIT extends AbstractOnServerIT {
|
||||
.execute(client).isSuccess());
|
||||
|
||||
// sync
|
||||
assertNull(sut.getFileByPath("/1/1/"));
|
||||
assertNull(sut.getFileByDecryptedRemotePath("/1/1/"));
|
||||
|
||||
assertTrue(new RefreshFolderOperation(sut.getFileByPath("/"),
|
||||
assertTrue(new RefreshFolderOperation(sut.getFileByDecryptedRemotePath("/"),
|
||||
System.currentTimeMillis() / 1000,
|
||||
false,
|
||||
false,
|
||||
@@ -122,7 +125,7 @@ abstract public class FileDataStorageManagerIT extends AbstractOnServerIT {
|
||||
account,
|
||||
targetContext).execute(client).isSuccess());
|
||||
|
||||
assertTrue(new RefreshFolderOperation(sut.getFileByPath("/1/"),
|
||||
assertTrue(new RefreshFolderOperation(sut.getFileByDecryptedRemotePath("/1/"),
|
||||
System.currentTimeMillis() / 1000,
|
||||
false,
|
||||
false,
|
||||
@@ -130,7 +133,7 @@ abstract public class FileDataStorageManagerIT extends AbstractOnServerIT {
|
||||
account,
|
||||
targetContext).execute(client).isSuccess());
|
||||
|
||||
assertTrue(new RefreshFolderOperation(sut.getFileByPath("/1/1/"),
|
||||
assertTrue(new RefreshFolderOperation(sut.getFileByDecryptedRemotePath("/1/1/"),
|
||||
System.currentTimeMillis() / 1000,
|
||||
false,
|
||||
false,
|
||||
@@ -138,7 +141,7 @@ abstract public class FileDataStorageManagerIT extends AbstractOnServerIT {
|
||||
account,
|
||||
targetContext).execute(client).isSuccess());
|
||||
|
||||
assertEquals(3, sut.getFolderContent(sut.getFileByPath("/1/1/"), false).size());
|
||||
assertEquals(3, sut.getFolderContent(sut.getFileByDecryptedRemotePath("/1/1/"), false).size());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -150,7 +153,7 @@ abstract public class FileDataStorageManagerIT extends AbstractOnServerIT {
|
||||
String remotePath = "/imageFile.png";
|
||||
VirtualFolderType virtualType = VirtualFolderType.GALLERY;
|
||||
|
||||
assertEquals(0, sut.getFolderContent(sut.getFileByPath("/"), false).size());
|
||||
assertEquals(0, sut.getFolderContent(sut.getFileByDecryptedRemotePath("/"), false).size());
|
||||
assertEquals(1, sut.getAllFiles().size());
|
||||
|
||||
File imageFile = getFile("imageFile.png");
|
||||
@@ -160,18 +163,18 @@ abstract public class FileDataStorageManagerIT extends AbstractOnServerIT {
|
||||
String.valueOf(System.currentTimeMillis() / 1000))
|
||||
.execute(client).isSuccess());
|
||||
|
||||
assertNull(sut.getFileByPath(remotePath));
|
||||
assertNull(sut.getFileByDecryptedRemotePath(remotePath));
|
||||
|
||||
// search
|
||||
SearchRemoteOperation searchRemoteOperation = new SearchRemoteOperation("image/%",
|
||||
PHOTO_SEARCH,
|
||||
false);
|
||||
|
||||
RemoteOperationResult searchResult = searchRemoteOperation.execute(client);
|
||||
RemoteOperationResult<List<RemoteFile>> searchResult = searchRemoteOperation.execute(client);
|
||||
TestCase.assertTrue(searchResult.isSuccess());
|
||||
TestCase.assertEquals(1, searchResult.getData().size());
|
||||
TestCase.assertEquals(1, searchResult.getResultData().size());
|
||||
|
||||
OCFile ocFile = FileStorageUtils.fillOCFile((RemoteFile) searchResult.getData().get(0));
|
||||
OCFile ocFile = FileStorageUtils.fillOCFile(searchResult.getResultData().get(0));
|
||||
sut.saveFile(ocFile);
|
||||
|
||||
List<ContentValues> contentValues = new ArrayList<>();
|
||||
@@ -185,13 +188,13 @@ abstract public class FileDataStorageManagerIT extends AbstractOnServerIT {
|
||||
|
||||
assertEquals(remotePath, ocFile.getRemotePath());
|
||||
|
||||
assertEquals(0, sut.getFolderContent(sut.getFileByPath("/"), false).size());
|
||||
assertEquals(0, sut.getFolderContent(sut.getFileByDecryptedRemotePath("/"), false).size());
|
||||
|
||||
assertEquals(1, sut.getVirtualFolderContent(virtualType, false).size());
|
||||
assertEquals(2, sut.getAllFiles().size());
|
||||
|
||||
// update root
|
||||
assertTrue(new RefreshFolderOperation(sut.getFileByPath("/"),
|
||||
assertTrue(new RefreshFolderOperation(sut.getFileByDecryptedRemotePath("/"),
|
||||
System.currentTimeMillis() / 1000,
|
||||
false,
|
||||
false,
|
||||
@@ -200,12 +203,12 @@ abstract public class FileDataStorageManagerIT extends AbstractOnServerIT {
|
||||
targetContext).execute(client).isSuccess());
|
||||
|
||||
|
||||
assertEquals(1, sut.getFolderContent(sut.getFileByPath("/"), false).size());
|
||||
assertEquals(1, sut.getFolderContent(sut.getFileByDecryptedRemotePath("/"), false).size());
|
||||
assertEquals(1, sut.getVirtualFolderContent(virtualType, false).size());
|
||||
assertEquals(2, sut.getAllFiles().size());
|
||||
|
||||
assertEquals(sut.getVirtualFolderContent(virtualType, false).get(0),
|
||||
sut.getFolderContent(sut.getFileByPath("/"), false).get(0));
|
||||
sut.getFolderContent(sut.getFileByDecryptedRemotePath("/"), false).get(0));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -220,43 +223,46 @@ abstract public class FileDataStorageManagerIT extends AbstractOnServerIT {
|
||||
.acquireContentProviderClient(ProviderMeta.ProviderTableMeta.CONTENT_URI)
|
||||
);
|
||||
|
||||
String remotePath = "/imageFile.png";
|
||||
String imagePath = "/imageFile.png";
|
||||
VirtualFolderType virtualType = VirtualFolderType.GALLERY;
|
||||
|
||||
assertEquals(0, sut.getFolderContent(sut.getFileByPath("/"), false).size());
|
||||
assertEquals(0, sut.getFolderContent(sut.getFileByDecryptedRemotePath("/"), false).size());
|
||||
assertEquals(1, sut.getAllFiles().size());
|
||||
|
||||
File imageFile = getFile("imageFile.png");
|
||||
assertTrue(new UploadFileRemoteOperation(imageFile.getAbsolutePath(),
|
||||
"/imageFile.png",
|
||||
imagePath,
|
||||
"image/png",
|
||||
String.valueOf(System.currentTimeMillis() / 1000))
|
||||
String.valueOf((System.currentTimeMillis() - 10000) / 1000))
|
||||
.execute(client).isSuccess());
|
||||
|
||||
// Check that file does not yet exist in local database
|
||||
assertNull(sut.getFileByPath("/imageFile.png"));
|
||||
assertNull(sut.getFileByDecryptedRemotePath(imagePath));
|
||||
|
||||
String videoPath = "/videoFile.mp4";
|
||||
File videoFile = getFile("videoFile.mp4");
|
||||
assertTrue(new UploadFileRemoteOperation(videoFile.getAbsolutePath(),
|
||||
"/videoFile.mp4",
|
||||
videoPath,
|
||||
"video/mpeg",
|
||||
String.valueOf(System.currentTimeMillis() / 1000))
|
||||
String.valueOf((System.currentTimeMillis() + 10000) / 1000))
|
||||
.execute(client).isSuccess());
|
||||
|
||||
// Check that file does not yet exist in local database
|
||||
assertNull(sut.getFileByPath("/videoFile.mp4"));
|
||||
assertNull(sut.getFileByDecryptedRemotePath(videoPath));
|
||||
|
||||
// search
|
||||
SearchRemoteOperation searchRemoteOperation = new SearchRemoteOperation("",
|
||||
GALLERY_SEARCH,
|
||||
false);
|
||||
|
||||
RemoteOperationResult searchResult = searchRemoteOperation.execute(client);
|
||||
RemoteOperationResult<List<RemoteFile>> searchResult = searchRemoteOperation.execute(client);
|
||||
TestCase.assertTrue(searchResult.isSuccess());
|
||||
TestCase.assertEquals(2, searchResult.getData().size());
|
||||
TestCase.assertEquals(2, searchResult.getResultData().size());
|
||||
|
||||
OCFile ocFile = FileStorageUtils.fillOCFile((RemoteFile) searchResult.getData().get(0));
|
||||
// newest file must be video path (as sorted by recently modified)
|
||||
OCFile ocFile = FileStorageUtils.fillOCFile( searchResult.getResultData().get(0));
|
||||
sut.saveFile(ocFile);
|
||||
assertEquals(videoPath, ocFile.getRemotePath());
|
||||
|
||||
List<ContentValues> contentValues = new ArrayList<>();
|
||||
ContentValues cv = new ContentValues();
|
||||
@@ -265,8 +271,10 @@ abstract public class FileDataStorageManagerIT extends AbstractOnServerIT {
|
||||
|
||||
contentValues.add(cv);
|
||||
|
||||
OCFile ocFile2 = FileStorageUtils.fillOCFile((RemoteFile) searchResult.getData().get(0));
|
||||
// second is image file, as older
|
||||
OCFile ocFile2 = FileStorageUtils.fillOCFile(searchResult.getResultData().get(1));
|
||||
sut.saveFile(ocFile2);
|
||||
assertEquals(imagePath, ocFile2.getRemotePath());
|
||||
|
||||
ContentValues cv2 = new ContentValues();
|
||||
cv2.put(ProviderMeta.ProviderTableMeta.VIRTUAL_TYPE, virtualType.toString());
|
||||
@@ -276,15 +284,13 @@ abstract public class FileDataStorageManagerIT extends AbstractOnServerIT {
|
||||
|
||||
sut.saveVirtuals(contentValues);
|
||||
|
||||
assertEquals(remotePath, ocFile.getRemotePath());
|
||||
|
||||
assertEquals(0, sut.getFolderContent(sut.getFileByPath("/"), false).size());
|
||||
assertEquals(0, sut.getFolderContent(sut.getFileByDecryptedRemotePath("/"), false).size());
|
||||
|
||||
assertEquals(2, sut.getVirtualFolderContent(virtualType, false).size());
|
||||
assertEquals(2, sut.getAllFiles().size());
|
||||
assertEquals(3, sut.getAllFiles().size());
|
||||
|
||||
// update root
|
||||
assertTrue(new RefreshFolderOperation(sut.getFileByPath("/"),
|
||||
assertTrue(new RefreshFolderOperation(sut.getFileByDecryptedRemotePath("/"),
|
||||
System.currentTimeMillis() / 1000,
|
||||
false,
|
||||
false,
|
||||
@@ -293,19 +299,19 @@ abstract public class FileDataStorageManagerIT extends AbstractOnServerIT {
|
||||
targetContext).execute(client).isSuccess());
|
||||
|
||||
|
||||
assertEquals(2, sut.getFolderContent(sut.getFileByPath("/"), false).size());
|
||||
assertEquals(2, sut.getFolderContent(sut.getFileByDecryptedRemotePath("/"), false).size());
|
||||
assertEquals(2, sut.getVirtualFolderContent(virtualType, false).size());
|
||||
assertEquals(3, sut.getAllFiles().size());
|
||||
|
||||
assertEquals(sut.getVirtualFolderContent(virtualType, false).get(0),
|
||||
sut.getFolderContent(sut.getFileByPath("/"), false).get(0));
|
||||
sut.getFolderContent(sut.getFileByDecryptedRemotePath("/"), false).get(0));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSaveNewFile() {
|
||||
assertTrue(new CreateFolderRemoteOperation("/1/1/", true).execute(client).isSuccess());
|
||||
|
||||
assertTrue(new RefreshFolderOperation(sut.getFileByPath("/"),
|
||||
assertTrue(new RefreshFolderOperation(sut.getFileByDecryptedRemotePath("/"),
|
||||
System.currentTimeMillis() / 1000,
|
||||
false,
|
||||
false,
|
||||
@@ -313,7 +319,7 @@ abstract public class FileDataStorageManagerIT extends AbstractOnServerIT {
|
||||
account,
|
||||
targetContext).execute(client).isSuccess());
|
||||
|
||||
assertTrue(new RefreshFolderOperation(sut.getFileByPath("/1/"),
|
||||
assertTrue(new RefreshFolderOperation(sut.getFileByDecryptedRemotePath("/1/"),
|
||||
System.currentTimeMillis() / 1000,
|
||||
false,
|
||||
false,
|
||||
@@ -321,7 +327,7 @@ abstract public class FileDataStorageManagerIT extends AbstractOnServerIT {
|
||||
account,
|
||||
targetContext).execute(client).isSuccess());
|
||||
|
||||
assertTrue(new RefreshFolderOperation(sut.getFileByPath("/1/1/"),
|
||||
assertTrue(new RefreshFolderOperation(sut.getFileByDecryptedRemotePath("/1/1/"),
|
||||
System.currentTimeMillis() / 1000,
|
||||
false,
|
||||
false,
|
||||
|
||||
@@ -58,7 +58,7 @@ public class OCFileUnitTest {
|
||||
private static final long LAST_SYNC_DATE_FOR_PROPERTIES = 5432109876L;
|
||||
private static final long LAST_SYNC_DATE_FOR_DATA = 4321098765L;
|
||||
private static final String ETAG = "adshfas98ferqw8f9yu2";
|
||||
private static final String PUBLIC_LINK = "https://fake.url.net/owncloud/987427448712984sdas29";
|
||||
private static final String PUBLIC_LINK = "https://nextcloud.localhost/owncloud/987427448712984sdas29";
|
||||
private static final String PERMISSIONS = "SRKNVD";
|
||||
private static final String REMOTE_ID = "jadñgiadf8203:9jrp98v2mn3er2089fh";
|
||||
private static final String ETAG_IN_CONFLICT = "2adshfas98ferqw8f9yu";
|
||||
|
||||
@@ -7,6 +7,7 @@ import android.content.ContentResolver;
|
||||
import android.content.Context;
|
||||
|
||||
import com.nextcloud.client.account.CurrentAccountProvider;
|
||||
import com.nextcloud.client.account.User;
|
||||
import com.nextcloud.client.account.UserAccountManager;
|
||||
import com.nextcloud.client.account.UserAccountManagerImpl;
|
||||
import com.owncloud.android.AbstractIT;
|
||||
@@ -47,17 +48,18 @@ import static org.junit.Assert.assertTrue;
|
||||
public class UploadStorageManagerTest extends AbstractIT {
|
||||
private UploadsStorageManager uploadsStorageManager;
|
||||
private CurrentAccountProvider currentAccountProvider = () -> null;
|
||||
private Account account2;
|
||||
private UserAccountManager userAccountManager;
|
||||
private User user2;
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
Context instrumentationCtx = ApplicationProvider.getApplicationContext();
|
||||
ContentResolver contentResolver = instrumentationCtx.getContentResolver();
|
||||
uploadsStorageManager = new UploadsStorageManager(currentAccountProvider, contentResolver);
|
||||
userAccountManager = UserAccountManagerImpl.fromContext(targetContext);
|
||||
|
||||
Account temp = new Account("[email protected]", MainApp.getAccountType(targetContext));
|
||||
UserAccountManager accountManager = UserAccountManagerImpl.fromContext(targetContext);
|
||||
if (!accountManager.exists(temp)) {
|
||||
if (!userAccountManager.exists(temp)) {
|
||||
AccountManager platformAccountManager = AccountManager.get(targetContext);
|
||||
platformAccountManager.addAccountExplicitly(temp, "testPassword", null);
|
||||
platformAccountManager.setUserData(temp, AccountUtils.Constants.KEY_OC_ACCOUNT_VERSION,
|
||||
@@ -68,27 +70,23 @@ public class UploadStorageManagerTest extends AbstractIT {
|
||||
}
|
||||
|
||||
final UserAccountManager userAccountManager = UserAccountManagerImpl.fromContext(targetContext);
|
||||
account2 = userAccountManager.getAccountByName("[email protected]");
|
||||
|
||||
if (account2 == null) {
|
||||
throw new ActivityNotFoundException();
|
||||
}
|
||||
user2 = userAccountManager.getUser("[email protected]").orElseThrow(ActivityNotFoundException::new);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDeleteAllUploads() {
|
||||
// Clean
|
||||
for (Account account : getAllAccounts()) {
|
||||
uploadsStorageManager.removeAccountUploads(account);
|
||||
for (User user : userAccountManager.getAllUsers()) {
|
||||
uploadsStorageManager.removeUserUploads(user);
|
||||
}
|
||||
int accountRowsA = 3;
|
||||
int accountRowsB = 4;
|
||||
insertUploads(account, accountRowsA);
|
||||
insertUploads(account2, accountRowsB);
|
||||
insertUploads(user2.toPlatformAccount(), accountRowsB);
|
||||
|
||||
assertEquals("Expected 4 removed uploads files",
|
||||
4,
|
||||
uploadsStorageManager.removeAccountUploads(account2));
|
||||
uploadsStorageManager.removeUserUploads(user2));
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -212,8 +210,6 @@ public class UploadStorageManagerTest extends AbstractIT {
|
||||
@After
|
||||
public void tearDown() {
|
||||
deleteAllUploads();
|
||||
|
||||
AccountManager platformAccountManager = AccountManager.get(targetContext);
|
||||
platformAccountManager.removeAccountExplicitly(account2);
|
||||
userAccountManager.removeUser(user2);
|
||||
}
|
||||
}
|
||||
@@ -156,7 +156,7 @@ class FileUploaderIT : AbstractOnServerIT() {
|
||||
assertEquals(file.length(), (result.data[0] as RemoteFile).length)
|
||||
|
||||
val ocFile2 = OCFile("/testFile.txt")
|
||||
ocFile2.setStoragePath(getDummyFile("/empty.txt").absolutePath)
|
||||
ocFile2.storagePath = getDummyFile("/empty.txt").absolutePath
|
||||
|
||||
FileUploader.uploadUpdateFile(
|
||||
targetContext,
|
||||
@@ -196,10 +196,11 @@ class FileUploaderIT : AbstractOnServerIT() {
|
||||
FileUploader.LOCAL_BEHAVIOUR_COPY,
|
||||
targetContext,
|
||||
false,
|
||||
false
|
||||
false,
|
||||
storageManager
|
||||
)
|
||||
.setRemoteFolderToBeCreated()
|
||||
.execute(client, storageManager)
|
||||
.execute(client)
|
||||
.isSuccess
|
||||
)
|
||||
|
||||
@@ -223,12 +224,13 @@ class FileUploaderIT : AbstractOnServerIT() {
|
||||
FileUploader.LOCAL_BEHAVIOUR_COPY,
|
||||
targetContext,
|
||||
false,
|
||||
false
|
||||
false,
|
||||
storageManager
|
||||
)
|
||||
.addRenameUploadListener {
|
||||
renameListenerWasTriggered = true
|
||||
}
|
||||
.execute(client, storageManager)
|
||||
.execute(client)
|
||||
.isSuccess
|
||||
)
|
||||
|
||||
@@ -273,7 +275,7 @@ class FileUploaderIT : AbstractOnServerIT() {
|
||||
assertEquals(file.length(), (result.data[0] as RemoteFile).length)
|
||||
|
||||
val ocFile2 = OCFile("/testFile.txt")
|
||||
ocFile2.setStoragePath(getDummyFile("/empty.txt").absolutePath)
|
||||
ocFile2.storagePath = getDummyFile("/empty.txt").absolutePath
|
||||
|
||||
FileUploader.uploadUpdateFile(
|
||||
targetContext,
|
||||
@@ -316,10 +318,11 @@ class FileUploaderIT : AbstractOnServerIT() {
|
||||
FileUploader.LOCAL_BEHAVIOUR_COPY,
|
||||
targetContext,
|
||||
false,
|
||||
false
|
||||
false,
|
||||
storageManager
|
||||
)
|
||||
.setRemoteFolderToBeCreated()
|
||||
.execute(client, storageManager)
|
||||
.execute(client)
|
||||
.isSuccess
|
||||
)
|
||||
|
||||
@@ -342,9 +345,10 @@ class FileUploaderIT : AbstractOnServerIT() {
|
||||
FileUploader.LOCAL_BEHAVIOUR_COPY,
|
||||
targetContext,
|
||||
false,
|
||||
false
|
||||
false,
|
||||
storageManager
|
||||
)
|
||||
.execute(client, storageManager).isSuccess
|
||||
.execute(client).isSuccess
|
||||
)
|
||||
|
||||
val result2 = ReadFileRemoteOperation("/testFile.txt").execute(client)
|
||||
@@ -382,7 +386,7 @@ class FileUploaderIT : AbstractOnServerIT() {
|
||||
assertEquals(file.length(), (result.data[0] as RemoteFile).length)
|
||||
|
||||
val ocFile2 = OCFile("/testFile.txt")
|
||||
ocFile2.setStoragePath(getDummyFile("/empty.txt").absolutePath)
|
||||
ocFile2.storagePath = getDummyFile("/empty.txt").absolutePath
|
||||
|
||||
FileUploader.uploadUpdateFile(
|
||||
targetContext,
|
||||
@@ -420,10 +424,11 @@ class FileUploaderIT : AbstractOnServerIT() {
|
||||
FileUploader.LOCAL_BEHAVIOUR_COPY,
|
||||
targetContext,
|
||||
false,
|
||||
false
|
||||
false,
|
||||
storageManager
|
||||
)
|
||||
.setRemoteFolderToBeCreated()
|
||||
.execute(client, storageManager)
|
||||
.execute(client)
|
||||
.isSuccess
|
||||
)
|
||||
|
||||
@@ -445,9 +450,10 @@ class FileUploaderIT : AbstractOnServerIT() {
|
||||
FileUploader.LOCAL_BEHAVIOUR_COPY,
|
||||
targetContext,
|
||||
false,
|
||||
false
|
||||
false,
|
||||
storageManager
|
||||
)
|
||||
.execute(client, storageManager)
|
||||
.execute(client)
|
||||
|
||||
assertFalse(uploadResult.isSuccess)
|
||||
assertTrue(uploadResult.exception is OperationCancelledException)
|
||||
@@ -487,7 +493,7 @@ class FileUploaderIT : AbstractOnServerIT() {
|
||||
assertEquals(file.length(), (result.data[0] as RemoteFile).length)
|
||||
|
||||
val ocFile2 = OCFile("/testFile.txt")
|
||||
ocFile2.setStoragePath(getDummyFile("/empty.txt").absolutePath)
|
||||
ocFile2.storagePath = getDummyFile("/empty.txt").absolutePath
|
||||
|
||||
FileUploader.uploadUpdateFile(
|
||||
targetContext,
|
||||
|
||||
@@ -0,0 +1,85 @@
|
||||
/*
|
||||
*
|
||||
* Nextcloud Android client application
|
||||
*
|
||||
* @author Tobias Kaminsky
|
||||
* Copyright (C) 2021 Tobias Kaminsky
|
||||
* Copyright (C) 2021 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.operations
|
||||
|
||||
import com.owncloud.android.AbstractOnServerIT
|
||||
import com.owncloud.android.lib.resources.files.CreateFolderRemoteOperation
|
||||
import com.owncloud.android.lib.resources.shares.CreateShareRemoteOperation
|
||||
import com.owncloud.android.lib.resources.shares.OCShare
|
||||
import com.owncloud.android.lib.resources.shares.ShareType
|
||||
import junit.framework.TestCase
|
||||
import org.junit.Assert.assertEquals
|
||||
import org.junit.Assert.assertTrue
|
||||
import org.junit.Test
|
||||
|
||||
@Suppress("MagicNumber")
|
||||
class GetSharesForFileOperationIT : AbstractOnServerIT() {
|
||||
@Test
|
||||
fun shares() {
|
||||
val remotePath = "/share/"
|
||||
assertTrue(CreateFolderRemoteOperation(remotePath, true).execute(client).isSuccess)
|
||||
|
||||
// share folder to user "admin"
|
||||
TestCase.assertTrue(
|
||||
CreateShareRemoteOperation(
|
||||
remotePath,
|
||||
ShareType.USER,
|
||||
"admin",
|
||||
false,
|
||||
"",
|
||||
OCShare.MAXIMUM_PERMISSIONS_FOR_FOLDER
|
||||
)
|
||||
.execute(client).isSuccess
|
||||
)
|
||||
|
||||
// share folder via public link
|
||||
TestCase.assertTrue(
|
||||
CreateShareRemoteOperation(
|
||||
remotePath,
|
||||
ShareType.PUBLIC_LINK,
|
||||
"",
|
||||
true,
|
||||
"",
|
||||
OCShare.READ_PERMISSION_FLAG
|
||||
)
|
||||
.execute(client).isSuccess
|
||||
)
|
||||
|
||||
// share folder to group
|
||||
assertTrue(
|
||||
CreateShareRemoteOperation(
|
||||
remotePath,
|
||||
ShareType.GROUP,
|
||||
"users",
|
||||
false,
|
||||
"",
|
||||
OCShare.NO_PERMISSION
|
||||
)
|
||||
.execute(client).isSuccess
|
||||
)
|
||||
|
||||
val shareResult = GetSharesForFileOperation(remotePath, false, false, storageManager).execute(client)
|
||||
assertTrue(shareResult.isSuccess)
|
||||
|
||||
assertEquals(3, (shareResult.data as ArrayList<OCShare>).size)
|
||||
}
|
||||
}
|
||||
@@ -38,7 +38,7 @@ public class RemoveFileOperationIT extends AbstractOnServerIT {
|
||||
public void deleteFolder() {
|
||||
String parent = "/test/";
|
||||
String path = parent + "folder1/";
|
||||
assertTrue(new CreateFolderOperation(path, user, targetContext).execute(client, getStorageManager())
|
||||
assertTrue(new CreateFolderOperation(path, user, targetContext, getStorageManager()).execute(client)
|
||||
.isSuccess());
|
||||
|
||||
OCFile folder = getStorageManager().getFileByPath(path);
|
||||
@@ -49,8 +49,9 @@ public class RemoveFileOperationIT extends AbstractOnServerIT {
|
||||
false,
|
||||
account,
|
||||
false,
|
||||
targetContext)
|
||||
.execute(client, getStorageManager())
|
||||
targetContext,
|
||||
getStorageManager())
|
||||
.execute(client)
|
||||
.isSuccess());
|
||||
|
||||
OCFile parentFolder = getStorageManager().getFileByPath(parent);
|
||||
@@ -60,8 +61,9 @@ public class RemoveFileOperationIT extends AbstractOnServerIT {
|
||||
false,
|
||||
account,
|
||||
false,
|
||||
targetContext)
|
||||
.execute(client, getStorageManager())
|
||||
targetContext,
|
||||
getStorageManager())
|
||||
.execute(client)
|
||||
.isSuccess());
|
||||
}
|
||||
|
||||
@@ -81,8 +83,9 @@ public class RemoveFileOperationIT extends AbstractOnServerIT {
|
||||
false,
|
||||
account,
|
||||
false,
|
||||
targetContext)
|
||||
.execute(client, getStorageManager())
|
||||
targetContext,
|
||||
getStorageManager())
|
||||
.execute(client)
|
||||
.isSuccess());
|
||||
|
||||
OCFile parentFolder = getStorageManager().getFileByPath(parent);
|
||||
@@ -92,8 +95,9 @@ public class RemoveFileOperationIT extends AbstractOnServerIT {
|
||||
false,
|
||||
account,
|
||||
false,
|
||||
targetContext)
|
||||
.execute(client, getStorageManager())
|
||||
targetContext,
|
||||
getStorageManager())
|
||||
.execute(client)
|
||||
.isSuccess());
|
||||
}
|
||||
}
|
||||
@@ -6,7 +6,6 @@ import androidx.documentfile.provider.DocumentFile
|
||||
import com.owncloud.android.AbstractOnServerIT
|
||||
import com.owncloud.android.R
|
||||
import com.owncloud.android.datamodel.OCFile.ROOT_PATH
|
||||
import com.owncloud.android.lib.common.network.WebdavUtils
|
||||
import com.owncloud.android.providers.DocumentsProviderUtils.assertExistsOnServer
|
||||
import com.owncloud.android.providers.DocumentsProviderUtils.assertListFilesEquals
|
||||
import com.owncloud.android.providers.DocumentsProviderUtils.assertReadEquals
|
||||
@@ -183,7 +182,9 @@ class DocumentsStorageProviderIT : AbstractOnServerIT() {
|
||||
val file1 = rootDir.createFile("text/plain", RandomString.make())!!
|
||||
file1.assertRegularFile(size = 0L)
|
||||
|
||||
val createdETag = file1.getOCFile(storageManager)!!.etag
|
||||
val createdETag = file1.getOCFile(storageManager)!!.etagOnServer
|
||||
|
||||
assertTrue(createdETag.isNotEmpty())
|
||||
|
||||
val content1 = "initial content".toByteArray()
|
||||
|
||||
@@ -192,8 +193,10 @@ class DocumentsStorageProviderIT : AbstractOnServerIT() {
|
||||
it!!.write(content1)
|
||||
}
|
||||
|
||||
while (file1.getOCFile(storageManager)!!.etag == createdETag) {
|
||||
// refresh
|
||||
while (file1.getOCFile(storageManager)!!.etagOnServer == createdETag) {
|
||||
shortSleep()
|
||||
rootDir.listFiles()
|
||||
}
|
||||
|
||||
val remotePath = file1.getOCFile(storageManager)!!.remotePath
|
||||
@@ -201,7 +204,7 @@ class DocumentsStorageProviderIT : AbstractOnServerIT() {
|
||||
val content2 = "new content".toByteArray()
|
||||
|
||||
// modify content on server side
|
||||
val putMethod = PutMethod(client.webdavUri.toString() + WebdavUtils.encodePath(remotePath))
|
||||
val putMethod = PutMethod(client.getFilesDavUri(remotePath))
|
||||
putMethod.requestEntity = ByteArrayRequestEntity(content2)
|
||||
assertEquals(HttpStatus.SC_NO_CONTENT, client.executeMethod(putMethod))
|
||||
client.exhaustResponse(putMethod.responseBodyAsStream)
|
||||
|
||||
@@ -40,6 +40,10 @@ class NotificationsActivityIT : AbstractIT() {
|
||||
fun loading() {
|
||||
val sut: NotificationsActivity = activityRule.launchActivity(null)
|
||||
|
||||
waitForIdleSync()
|
||||
|
||||
sut.runOnUiThread { sut.setLoadingMessageEmpty() }
|
||||
|
||||
screenshot(sut)
|
||||
}
|
||||
|
||||
@@ -87,9 +91,10 @@ class NotificationsActivityIT : AbstractIT() {
|
||||
)
|
||||
)
|
||||
|
||||
val actions = ArrayList<Action>()
|
||||
actions.add(Action("Send usage", "link", "url", true))
|
||||
actions.add(Action("Not now", "link", "url", false))
|
||||
val actions = ArrayList<Action>().apply {
|
||||
add(Action("Send usage", "link", "url", true))
|
||||
add(Action("Not now", "link", "url", false))
|
||||
}
|
||||
|
||||
notifications.add(
|
||||
Notification(
|
||||
@@ -112,6 +117,34 @@ class NotificationsActivityIT : AbstractIT() {
|
||||
)
|
||||
)
|
||||
|
||||
val moreAction = ArrayList<Action>().apply {
|
||||
add(Action("Send usage", "link", "url", true))
|
||||
add(Action("Not now", "link", "url", false))
|
||||
add(Action("third action", "link", "url", false))
|
||||
add(Action("Delay", "link", "url", false))
|
||||
}
|
||||
|
||||
notifications.add(
|
||||
Notification(
|
||||
2,
|
||||
"files",
|
||||
"user",
|
||||
date.time,
|
||||
"objectType",
|
||||
"objectId",
|
||||
"Help improve Nextcloud",
|
||||
"SubjectRich",
|
||||
HashMap<String, RichObject>(),
|
||||
"Do you want to help us to improve Nextcloud by providing some anonymize data about your setup and " +
|
||||
"usage?",
|
||||
"MessageRich",
|
||||
HashMap<String, RichObject>(),
|
||||
"link",
|
||||
"icon",
|
||||
moreAction
|
||||
)
|
||||
)
|
||||
|
||||
sut.runOnUiThread { sut.populateList(notifications) }
|
||||
|
||||
shortSleep()
|
||||
|
||||
@@ -44,6 +44,7 @@ import com.owncloud.android.lib.common.Creator;
|
||||
import com.owncloud.android.lib.common.DirectEditing;
|
||||
import com.owncloud.android.lib.common.Editor;
|
||||
import com.owncloud.android.lib.common.OwnCloudAccount;
|
||||
import com.owncloud.android.lib.common.accounts.AccountTypeUtils;
|
||||
import com.owncloud.android.lib.common.accounts.AccountUtils;
|
||||
import com.owncloud.android.lib.resources.status.CapabilityBooleanType;
|
||||
import com.owncloud.android.lib.resources.status.OCCapability;
|
||||
@@ -56,6 +57,7 @@ import com.owncloud.android.ui.fragment.OCFileListBottomSheetDialog;
|
||||
import com.owncloud.android.utils.MimeTypeUtil;
|
||||
import com.owncloud.android.utils.ScreenshotTest;
|
||||
|
||||
import org.junit.After;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
|
||||
@@ -70,9 +72,19 @@ import androidx.test.espresso.intent.rule.IntentsTestRule;
|
||||
import static androidx.test.platform.app.InstrumentationRegistry.getInstrumentation;
|
||||
|
||||
public class DialogFragmentIT extends AbstractIT {
|
||||
|
||||
private final String SERVER_URL = "https://nextcloud.localhost";
|
||||
|
||||
@Rule public IntentsTestRule<FileDisplayActivity> activityRule =
|
||||
new IntentsTestRule<>(FileDisplayActivity.class, true, false);
|
||||
|
||||
@After
|
||||
public void quitLooperIfNeeded() {
|
||||
if (Looper.myLooper() != null) {
|
||||
Looper.myLooper().quitSafely();
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
@ScreenshotTest
|
||||
public void testRenameFileDialog() {
|
||||
@@ -164,17 +176,20 @@ public class DialogFragmentIT extends AbstractIT {
|
||||
accountManager.removeAccountExplicitly(account);
|
||||
}
|
||||
|
||||
Account newAccount = new Account("test@https://server.com", MainApp.getAccountType(targetContext));
|
||||
Account newAccount = new Account("test@https://nextcloud.localhost", MainApp.getAccountType(targetContext));
|
||||
accountManager.addAccountExplicitly(newAccount, "password", null);
|
||||
accountManager.setUserData(newAccount, AccountUtils.Constants.KEY_OC_BASE_URL, "https://server.com");
|
||||
accountManager.setUserData(newAccount, AccountUtils.Constants.KEY_OC_BASE_URL, SERVER_URL);
|
||||
accountManager.setUserData(newAccount, AccountUtils.Constants.KEY_USER_ID, "test");
|
||||
accountManager.setAuthToken(newAccount, AccountTypeUtils.getAuthTokenTypePass(newAccount.type), "password");
|
||||
|
||||
|
||||
Account newAccount2 = new Account("user1@server.com", MainApp.getAccountType(targetContext));
|
||||
Account newAccount2 = new Account("user1@nextcloud.localhost", MainApp.getAccountType(targetContext));
|
||||
accountManager.addAccountExplicitly(newAccount2, "password", null);
|
||||
accountManager.setUserData(newAccount2, AccountUtils.Constants.KEY_OC_BASE_URL, "https://server.com");
|
||||
accountManager.setUserData(newAccount2, AccountUtils.Constants.KEY_OC_BASE_URL, SERVER_URL);
|
||||
accountManager.setUserData(newAccount2, AccountUtils.Constants.KEY_USER_ID, "user1");
|
||||
accountManager.setUserData(newAccount2, AccountUtils.Constants.KEY_OC_VERSION, "20.0.0");
|
||||
accountManager.setAuthToken(newAccount2, AccountTypeUtils.getAuthTokenTypePass(newAccount.type), "password");
|
||||
|
||||
|
||||
FileDataStorageManager fileDataStorageManager = new FileDataStorageManager(newAccount,
|
||||
targetContext.getContentResolver());
|
||||
@@ -187,7 +202,7 @@ public class DialogFragmentIT extends AbstractIT {
|
||||
ChooseAccountDialogFragment sut =
|
||||
ChooseAccountDialogFragment.newInstance(new RegisteredUser(newAccount,
|
||||
new OwnCloudAccount(newAccount, targetContext),
|
||||
new Server(URI.create("https://server.com"),
|
||||
new Server(URI.create(SERVER_URL),
|
||||
OwnCloudVersion.nextcloud_20)));
|
||||
FileDisplayActivity activity = showDialog(sut);
|
||||
|
||||
@@ -232,10 +247,11 @@ public class DialogFragmentIT extends AbstractIT {
|
||||
accountManager.removeAccountExplicitly(account);
|
||||
}
|
||||
|
||||
Account newAccount = new Account("test@https://server.com", MainApp.getAccountType(targetContext));
|
||||
Account newAccount = new Account("test@https://nextcloud.localhost", MainApp.getAccountType(targetContext));
|
||||
accountManager.addAccountExplicitly(newAccount, "password", null);
|
||||
accountManager.setUserData(newAccount, AccountUtils.Constants.KEY_OC_BASE_URL, "https://server.com");
|
||||
accountManager.setUserData(newAccount, AccountUtils.Constants.KEY_OC_BASE_URL, SERVER_URL);
|
||||
accountManager.setUserData(newAccount, AccountUtils.Constants.KEY_USER_ID, "test");
|
||||
accountManager.setAuthToken(newAccount, AccountTypeUtils.getAuthTokenTypePass(newAccount.type), "password");
|
||||
|
||||
FileDataStorageManager fileDataStorageManager = new FileDataStorageManager(newAccount,
|
||||
targetContext.getContentResolver());
|
||||
@@ -248,7 +264,7 @@ public class DialogFragmentIT extends AbstractIT {
|
||||
ChooseAccountDialogFragment sut =
|
||||
ChooseAccountDialogFragment.newInstance(new RegisteredUser(newAccount,
|
||||
new OwnCloudAccount(newAccount, targetContext),
|
||||
new Server(URI.create("https://server.com"),
|
||||
new Server(URI.create(SERVER_URL),
|
||||
OwnCloudVersion.nextcloud_20)));
|
||||
showDialog(sut);
|
||||
}
|
||||
|
||||
@@ -56,7 +56,7 @@ class AvatarIT : AbstractIT() {
|
||||
fragment.addAvatar("winston brent", avatarRadius, width, targetContext)
|
||||
fragment.addAvatar("Baker James Lorena", avatarRadius, width, targetContext)
|
||||
fragment.addAvatar("Baker James Lorena", avatarRadius, width, targetContext)
|
||||
fragment.addAvatar("email@server.com", avatarRadius, width, targetContext)
|
||||
fragment.addAvatar("email@nextcloud.localhost", avatarRadius, width, targetContext)
|
||||
}
|
||||
|
||||
shortSleep()
|
||||
|
||||
@@ -110,7 +110,7 @@ class FileDetailSharingFragmentIT : AbstractIT() {
|
||||
OCShare(file.decryptedRemotePath).apply {
|
||||
remoteId = 3
|
||||
shareType = ShareType.EMAIL
|
||||
sharedWithDisplayName = "admin@nextcloud.server.com"
|
||||
sharedWithDisplayName = "admin@nextcloud.localhost"
|
||||
userId = getUserId(user)
|
||||
activity.storageManager.saveShare(this)
|
||||
}
|
||||
@@ -132,7 +132,7 @@ class FileDetailSharingFragmentIT : AbstractIT() {
|
||||
OCShare(file.decryptedRemotePath).apply {
|
||||
remoteId = 6
|
||||
shareType = ShareType.FEDERATED
|
||||
sharedWithDisplayName = "admin@nextcloud.remoteserver.com"
|
||||
sharedWithDisplayName = "admin@nextcloud.localhost"
|
||||
permissions = OCShare.FEDERATED_PERMISSIONS_FOR_FILE
|
||||
userId = getUserId(user)
|
||||
activity.storageManager.saveShare(this)
|
||||
|
||||
@@ -104,7 +104,7 @@ class OCFileListFragmentStaticServerIT : AbstractIT() {
|
||||
val emailShare = OCFile("/sharedToEmail.jpg").apply {
|
||||
parentId = sut.storageManager.getFileByEncryptedRemotePath("/").fileId
|
||||
isSharedWithSharee = true
|
||||
sharees = listOf(ShareeUser("admin@nextcloud.server.com", "admin@nextcloud.server.com", ShareType.EMAIL))
|
||||
sharees = listOf(ShareeUser("admin@nextcloud.localhost", "admin@nextcloud.localhost", ShareType.EMAIL))
|
||||
}
|
||||
sut.storageManager.saveFile(emailShare)
|
||||
|
||||
|
||||
@@ -123,15 +123,15 @@ class TrashbinActivityIT : AbstractIT() {
|
||||
|
||||
@Test
|
||||
fun differentUser() {
|
||||
val temp = Account("differentUser@https://server.com", MainApp.getAccountType(targetContext))
|
||||
val temp = Account("differentUser@https://nextcloud.localhost", MainApp.getAccountType(targetContext))
|
||||
|
||||
val platformAccountManager = AccountManager.get(targetContext)
|
||||
platformAccountManager.addAccountExplicitly(temp, "password", null)
|
||||
platformAccountManager.setUserData(temp, AccountUtils.Constants.KEY_OC_BASE_URL, "https://server.com")
|
||||
platformAccountManager.setUserData(temp, AccountUtils.Constants.KEY_OC_BASE_URL, "https://nextcloud.localhost")
|
||||
platformAccountManager.setUserData(temp, AccountUtils.Constants.KEY_USER_ID, "differentUser")
|
||||
|
||||
val intent = Intent()
|
||||
intent.putExtra(Intent.EXTRA_USER, "differentUser@https://server.com")
|
||||
intent.putExtra(Intent.EXTRA_USER, "differentUser@https://nextcloud.localhost")
|
||||
val sut: TrashbinActivity = activityRule.launchActivity(intent)
|
||||
|
||||
val trashbinRepository = TrashbinLocalRepository(TestCase.EMPTY)
|
||||
|
||||
@@ -26,6 +26,7 @@ import android.text.TextUtils;
|
||||
import com.google.gson.JsonElement;
|
||||
import com.google.gson.JsonParser;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
import com.nextcloud.client.RetryTestRule;
|
||||
import com.owncloud.android.datamodel.DecryptedFolderMetadata;
|
||||
import com.owncloud.android.datamodel.EncryptedFolderMetadata;
|
||||
import com.owncloud.android.lib.common.utils.Log_OC;
|
||||
@@ -35,6 +36,7 @@ import com.owncloud.android.utils.EncryptionUtils;
|
||||
import net.bytebuddy.utility.RandomString;
|
||||
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
@@ -84,16 +86,18 @@ import static org.junit.Assert.assertEquals;
|
||||
|
||||
@RunWith(AndroidJUnit4.class)
|
||||
public class EncryptionTestIT {
|
||||
@Rule public RetryTestRule retryTestRule = new RetryTestRule();
|
||||
|
||||
private String privateKey = "MIIEvwIBADANBgkqhkiG9w0BAQEFAASCBKkwggSlAgEAAo" +
|
||||
"IBAQDsn0JKS/THu328z1IgN0VzYU53HjSX03WJIgWkmyTaxbiKpoJaKbksXmfSpgzV" +
|
||||
"GzKFvGfZ03fwFrN7Q8P8R2e8SNiell7mh1TDw9/0P7Bt/ER8PJrXORo+GviKHxaLr7" +
|
||||
"Y0BJX9i/nW/L0L/VaE8CZTAqYBdcSJGgHJjY4UMf892ZPTa9T2Dl3ggdMZ7BQ2kiCi" +
|
||||
"CC3qV99b0igRJGmmLQaGiAflhFzuDQPMifUMq75wI8RSRPdxUAtjTfkl68QHu7Umye" +
|
||||
"yy33OQgdUKaTl5zcS3VSQbNjveVCNM4RDH1RlEc+7Wf1BY8APqT6jbiBcROJD2CeoL" +
|
||||
"H2eiIJCi+61ZkSGfAgMBAAECggEBALFStCHrhBf+GL9a+qer4/8QZ/X6i91PmaBX/7" +
|
||||
"SYk2jjjWVSXRNmex+V6+Y/jBRT2mvAgm8J+7LPwFdatE+lz0aZrMRD2gCWYF6Itpda" +
|
||||
"90OlLkmQPVWWtGTgX2ta2tF5r2iSGzk0IdoL8zw98Q2UzpOcw30KnWtFMxuxWk0mHq" +
|
||||
"pgp00g80cDWg3+RPbWOhdLp5bflQ36fKDfmjq05cGlIk6unnVyC5HXpvh4d4k2EWlX" +
|
||||
"IBAQDsn0JKS/THu328z1IgN0VzYU53HjSX03WJIgWkmyTaxbiKpoJaKbksXmfSpgzV" +
|
||||
"GzKFvGfZ03fwFrN7Q8P8R2e8SNiell7mh1TDw9/0P7Bt/ER8PJrXORo+GviKHxaLr7" +
|
||||
"Y0BJX9i/nW/L0L/VaE8CZTAqYBdcSJGgHJjY4UMf892ZPTa9T2Dl3ggdMZ7BQ2kiCi" +
|
||||
"CC3qV99b0igRJGmmLQaGiAflhFzuDQPMifUMq75wI8RSRPdxUAtjTfkl68QHu7Umye" +
|
||||
"yy33OQgdUKaTl5zcS3VSQbNjveVCNM4RDH1RlEc+7Wf1BY8APqT6jbiBcROJD2CeoL" +
|
||||
"H2eiIJCi+61ZkSGfAgMBAAECggEBALFStCHrhBf+GL9a+qer4/8QZ/X6i91PmaBX/7" +
|
||||
"SYk2jjjWVSXRNmex+V6+Y/jBRT2mvAgm8J+7LPwFdatE+lz0aZrMRD2gCWYF6Itpda" +
|
||||
"90OlLkmQPVWWtGTgX2ta2tF5r2iSGzk0IdoL8zw98Q2UzpOcw30KnWtFMxuxWk0mHq" +
|
||||
"pgp00g80cDWg3+RPbWOhdLp5bflQ36fKDfmjq05cGlIk6unnVyC5HXpvh4d4k2EWlX" +
|
||||
"rjGsndVBPCjGkZePlLRgDHxT06r+5XdJ+1CBDZgCsmjGz3M8uOHyCfVW0WhB7ynzDT" +
|
||||
"agVgz0iqpuhAi9sPt6iWWwpAnRw8cQgqEKw9bvKKECgYEA/WPi2PJtL6u/xlysh/H7" +
|
||||
"A717CId6fPHCMDace39ZNtzUzc0nT5BemlcF0wZ74NeJSur3Q395YzB+eBMLs5p8mA" +
|
||||
|
||||
@@ -22,9 +22,11 @@
|
||||
package com.owncloud.android.util;
|
||||
|
||||
import android.accounts.Account;
|
||||
import android.content.Context;
|
||||
import android.content.res.Resources;
|
||||
|
||||
import com.owncloud.android.MainApp;
|
||||
import com.owncloud.android.datamodel.FileDataStorageManager;
|
||||
import com.owncloud.android.datamodel.OCFile;
|
||||
import com.owncloud.android.lib.common.operations.RemoteOperationResult;
|
||||
import com.owncloud.android.operations.RemoveFileOperation;
|
||||
@@ -48,12 +50,18 @@ public class ErrorMessageAdapterIT {
|
||||
public void getErrorCauseMessageForForbiddenRemoval() {
|
||||
Resources resources = InstrumentationRegistry.getInstrumentation().getTargetContext().getResources();
|
||||
Account account = new Account("name", ACCOUNT_TYPE);
|
||||
Context context = MainApp.getAppContext();
|
||||
|
||||
String errorMessage = ErrorMessageAdapter.getErrorCauseMessage(
|
||||
new RemoteOperationResult(RemoteOperationResult.ResultCode.FORBIDDEN),
|
||||
new RemoveFileOperation(new OCFile(PATH_TO_DELETE), false, account, false, MainApp.getAppContext()),
|
||||
new RemoveFileOperation(new OCFile(PATH_TO_DELETE),
|
||||
false,
|
||||
account,
|
||||
false,
|
||||
context,
|
||||
new FileDataStorageManager(account, context.getContentResolver())),
|
||||
resources
|
||||
);
|
||||
);
|
||||
|
||||
assertEquals(EXPECTED_ERROR_MESSAGE, errorMessage);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
Platforma de productivitate ce îți oferă ție ontrolul și poate fi găzduită de tine.
|
||||
\Caracteristici:
|
||||
* Interfață facilă, modernă, complet personalizată in aliniere cu tema serverului tău
|
||||
* Încarcă fișiere pe serverul tău Nextcloud
|
||||
* Partajează fișierele tale cu alții
|
||||
* Păstrează-ți fișierele și folderele preferate sincronizate
|
||||
* Căutare în toate folderele de pe serverul tău
|
||||
* Încărcare automată a fotografiilor și videoclipurilor făcute cu dispozitivul tău
|
||||
* Fii la curent cu toate notificările
|
||||
* Suport pentru conturi multiple
|
||||
* Acces securizat la datele tale prin amprentă sau PIN
|
||||
* Integrare cu DAVx5 (în trecut cunoscut ca DAVdroid) pentru configurarea ușoară a sincronizarii Calendarelor si Contactelor.
|
||||
Te rugăm să anunți orice fel de probleme la https://github.com/nextcloud/android/issues și să discuți despre această aplicație la https://help.nextcloud.com/c/clients/android
|
||||
|
||||
Ești nou la Nextcloud? Nextcloud este un server privat pentru comunicare, sincronizare & și partajare de fișiere. Este în întregime open-source și îl poți găzdui tu, sau poți plăti o companie să facă asta pentru tine. În acest fel, ești pe deplin în control asupra fotografiilor tale, a calendarului și informațiilor de contact, a documentelor și a orice altceva.
|
||||
|
||||
Află mai multe despre Nextcloud la https://nextcloud.com
|
||||
@@ -0,0 +1 @@
|
||||
Platforma găzduită și controlată de tine
|
||||
@@ -0,0 +1 @@
|
||||
Nextcloud
|
||||
@@ -70,9 +70,12 @@ import java.io.InputStreamReader;
|
||||
import java.io.ObjectInputStream;
|
||||
import java.io.ObjectOutputStream;
|
||||
import java.io.Serializable;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import androidx.annotation.VisibleForTesting;
|
||||
|
||||
import static com.nextcloud.android.sso.Constants.DELIMITER;
|
||||
import static com.nextcloud.android.sso.Constants.EXCEPTION_ACCOUNT_NOT_FOUND;
|
||||
import static com.nextcloud.android.sso.Constants.EXCEPTION_HTTP_REQUEST_FAILED;
|
||||
@@ -260,6 +263,20 @@ public class InputStreamBinder extends IInputStreamService.Stub {
|
||||
}
|
||||
break;
|
||||
|
||||
case "PATCH":
|
||||
method = new PatchMethod(requestUrl);
|
||||
if (requestBodyInputStream != null) {
|
||||
RequestEntity requestEntity = new InputStreamRequestEntity(requestBodyInputStream);
|
||||
((PatchMethod) method).setRequestEntity(requestEntity);
|
||||
} else if (request.getRequestBody() != null) {
|
||||
StringRequestEntity requestEntity = new StringRequestEntity(
|
||||
request.getRequestBody(),
|
||||
CONTENT_TYPE_APPLICATION_JSON,
|
||||
CHARSET_UTF8);
|
||||
((PatchMethod) method).setRequestEntity(requestEntity);
|
||||
}
|
||||
break;
|
||||
|
||||
case "PUT":
|
||||
method = new PutMethod(requestUrl);
|
||||
if (requestBodyInputStream != null) {
|
||||
@@ -295,8 +312,8 @@ public class InputStreamBinder extends IInputStreamService.Stub {
|
||||
break;
|
||||
|
||||
case "HEAD":
|
||||
method = new HeadMethod(requestUrl);
|
||||
break;
|
||||
method = new HeadMethod(requestUrl);
|
||||
break;
|
||||
|
||||
default:
|
||||
throw new UnsupportedOperationException(EXCEPTION_UNSUPPORTED_METHOD);
|
||||
@@ -331,7 +348,11 @@ public class InputStreamBinder extends IInputStreamService.Stub {
|
||||
|
||||
HttpMethodBase method = buildMethod(request, client.getBaseUri(), requestBodyInputStream);
|
||||
|
||||
method.setQueryString(convertMapToNVP(request.getParameter()));
|
||||
if (request.getParameterV2() != null && !request.getParameterV2().isEmpty()) {
|
||||
method.setQueryString(convertListToNVP(request.getParameterV2()));
|
||||
} else {
|
||||
method.setQueryString(convertMapToNVP(request.getParameter()));
|
||||
}
|
||||
method.addRequestHeader("OCS-APIREQUEST", "true");
|
||||
|
||||
for (Map.Entry<String, List<String>> header : request.getHeader().entrySet()) {
|
||||
@@ -394,7 +415,12 @@ public class InputStreamBinder extends IInputStreamService.Stub {
|
||||
|
||||
HttpMethodBase method = buildMethod(request, client.getBaseUri(), requestBodyInputStream);
|
||||
|
||||
method.setQueryString(convertMapToNVP(request.getParameter()));
|
||||
if (request.getParameterV2() != null && !request.getParameterV2().isEmpty()) {
|
||||
method.setQueryString(convertListToNVP(request.getParameterV2()));
|
||||
} else {
|
||||
method.setQueryString(convertMapToNVP(request.getParameter()));
|
||||
}
|
||||
|
||||
method.addRequestHeader("OCS-APIREQUEST", "true");
|
||||
|
||||
for (Map.Entry<String, List<String>> header : request.getHeader().entrySet()) {
|
||||
@@ -482,7 +508,8 @@ public class InputStreamBinder extends IInputStreamService.Stub {
|
||||
}
|
||||
}
|
||||
|
||||
private static NameValuePair[] convertMapToNVP(Map<String, String> map) {
|
||||
@VisibleForTesting
|
||||
public static NameValuePair[] convertMapToNVP(Map<String, String> map) {
|
||||
NameValuePair[] nvp = new NameValuePair[map.size()];
|
||||
int i = 0;
|
||||
for (String key : map.keySet()) {
|
||||
@@ -491,4 +518,15 @@ public class InputStreamBinder extends IInputStreamService.Stub {
|
||||
}
|
||||
return nvp;
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
public static NameValuePair[] convertListToNVP(Collection<QueryParam> list) {
|
||||
NameValuePair[] nvp = new NameValuePair[list.size()];
|
||||
int i = 0;
|
||||
for (QueryParam pair : list) {
|
||||
nvp[i] = new NameValuePair(pair.key, pair.value);
|
||||
i++;
|
||||
}
|
||||
return nvp;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,118 @@
|
||||
/*
|
||||
* Nextcloud SingleSignOn
|
||||
*
|
||||
* @author Timo Triebensky
|
||||
* Copyright (C) 2021 Timo Triebensky
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* More information here: https://github.com/abeluck/android-streams-ipc
|
||||
*
|
||||
* ====================================================================
|
||||
*
|
||||
* The required methods of this class are copied and customized from PostMethod.
|
||||
*/
|
||||
|
||||
package com.nextcloud.android.sso;
|
||||
|
||||
import org.apache.commons.httpclient.methods.ByteArrayRequestEntity;
|
||||
import org.apache.commons.httpclient.methods.EntityEnclosingMethod;
|
||||
import org.apache.commons.httpclient.methods.PostMethod;
|
||||
import org.apache.commons.httpclient.methods.RequestEntity;
|
||||
import org.apache.commons.httpclient.util.EncodingUtil;
|
||||
|
||||
import java.util.Vector;
|
||||
|
||||
public class PatchMethod extends PostMethod {
|
||||
|
||||
/**
|
||||
* The buffered request body consisting of <code>NameValuePair</code>s.
|
||||
*/
|
||||
private Vector params = new Vector();
|
||||
|
||||
/**
|
||||
* No-arg constructor.
|
||||
*/
|
||||
public PatchMethod() {
|
||||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor specifying a URI.
|
||||
*
|
||||
* @param uri either an absolute or relative URI
|
||||
*/
|
||||
public PatchMethod(String uri) {
|
||||
super(uri);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns <tt>"PATCH"</tt>.
|
||||
*
|
||||
* @return <tt>"PATCH"</tt>
|
||||
* @since 2.0
|
||||
*/
|
||||
@Override
|
||||
public String getName() {
|
||||
return "PATCH";
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns <tt>true</tt> if there is a request body to be sent.
|
||||
*
|
||||
* @return boolean
|
||||
* @since 2.0beta1
|
||||
*/
|
||||
protected boolean hasRequestContent() {
|
||||
if (!this.params.isEmpty()) {
|
||||
return true;
|
||||
} else {
|
||||
return super.hasRequestContent();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Clears request body.
|
||||
*
|
||||
* @since 2.0beta1
|
||||
*/
|
||||
protected void clearRequestBody() {
|
||||
this.params.clear();
|
||||
super.clearRequestBody();
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates a request entity from the patch parameters, if present. Calls {@link
|
||||
* EntityEnclosingMethod#generateRequestBody()} if parameters have not been set.
|
||||
*
|
||||
* @since 3.0
|
||||
*/
|
||||
protected RequestEntity generateRequestEntity() {
|
||||
if (!this.params.isEmpty()) {
|
||||
// Use a ByteArrayRequestEntity instead of a StringRequestEntity.
|
||||
// This is to avoid potential encoding issues. Form url encoded strings
|
||||
// are ASCII by definition but the content type may not be. Treating the content
|
||||
// as bytes allows us to keep the current charset without worrying about how
|
||||
// this charset will effect the encoding of the form url encoded string.
|
||||
String content = EncodingUtil.formUrlEncode(getParameters(), getRequestCharSet());
|
||||
ByteArrayRequestEntity entity = new ByteArrayRequestEntity(
|
||||
EncodingUtil.getAsciiBytes(content),
|
||||
FORM_URL_ENCODED_CONTENT_TYPE
|
||||
);
|
||||
return entity;
|
||||
} else {
|
||||
return super.generateRequestEntity();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
/*
|
||||
*
|
||||
* Nextcloud Android client application
|
||||
*
|
||||
* @author Tobias Kaminsky
|
||||
* Copyright (C) 2021 Tobias Kaminsky
|
||||
* Copyright (C) 2021 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.android.sso;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
public class QueryParam implements Serializable {
|
||||
public String key;
|
||||
public String value;
|
||||
|
||||
public QueryParam(String key, String value) {
|
||||
this.key = key;
|
||||
this.value = value;
|
||||
}
|
||||
}
|
||||
@@ -1,3 +1,25 @@
|
||||
/*
|
||||
*
|
||||
* Nextcloud Android client application
|
||||
*
|
||||
* @author Tobias Kaminsky
|
||||
* Copyright (C) 2021 Tobias Kaminsky
|
||||
* Copyright (C) 2021 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/>.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Nextcloud SingleSignOn
|
||||
*
|
||||
@@ -19,8 +41,12 @@
|
||||
|
||||
package com.nextcloud.android.sso.aidl;
|
||||
|
||||
import com.nextcloud.android.sso.QueryParam;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -31,6 +57,7 @@ public class NextcloudRequest implements Serializable {
|
||||
private String method;
|
||||
private Map<String, List<String>> header = new HashMap<>();
|
||||
private Map<String, String> parameter = new HashMap<>();
|
||||
private final Collection<QueryParam> parameterV2 = new LinkedList<>();
|
||||
private String requestBody;
|
||||
private String url;
|
||||
private String token;
|
||||
@@ -144,4 +171,8 @@ public class NextcloudRequest implements Serializable {
|
||||
public boolean isFollowRedirects() {
|
||||
return this.followRedirects;
|
||||
}
|
||||
|
||||
public Collection<QueryParam> getParameterV2() {
|
||||
return parameterV2;
|
||||
}
|
||||
}
|
||||
@@ -86,11 +86,12 @@ class UploadTask(
|
||||
applicationContext,
|
||||
upload.isUseWifiOnly,
|
||||
upload.isWhileChargingOnly,
|
||||
false
|
||||
false,
|
||||
fileDataStorageManager
|
||||
)
|
||||
val client = clientProvider()
|
||||
uploadsStorageManager.updateDatabaseUploadStart(op)
|
||||
val result = op.execute(client, fileDataStorageManager)
|
||||
val result = op.execute(client)
|
||||
uploadsStorageManager.updateDatabaseUploadResult(result, op)
|
||||
return Result(file, result.isSuccess)
|
||||
}
|
||||
|
||||
@@ -76,7 +76,8 @@ public class DeckApiImpl implements DeckApi {
|
||||
|
||||
private PendingIntent createPendingIntent(@NonNull Intent intent, @NonNull Notification notification, @NonNull User user) {
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
return PendingIntent.getActivity(context, 0, putExtrasToIntent(intent, notification, user),
|
||||
return PendingIntent.getActivity(context, notification.getNotificationId(),
|
||||
putExtrasToIntent(intent, notification, user),
|
||||
PendingIntent.FLAG_ONE_SHOT);
|
||||
}
|
||||
|
||||
|
||||
@@ -33,6 +33,7 @@ import com.nextcloud.client.account.User
|
||||
import com.nextcloud.client.account.UserAccountManager
|
||||
import com.nextcloud.client.core.Clock
|
||||
import com.nextcloud.client.preferences.AppPreferencesImpl
|
||||
import com.nextcloud.common.NextcloudClient
|
||||
import com.nextcloud.java.util.Optional
|
||||
import com.owncloud.android.MainApp
|
||||
import com.owncloud.android.R
|
||||
@@ -45,6 +46,7 @@ import com.owncloud.android.datamodel.UploadsStorageManager
|
||||
import com.owncloud.android.lib.common.OwnCloudClient
|
||||
import com.owncloud.android.lib.common.OwnCloudClientManagerFactory
|
||||
import com.owncloud.android.lib.common.utils.Log_OC
|
||||
import com.owncloud.android.lib.resources.users.DeleteAppPasswordRemoteOperation
|
||||
import com.owncloud.android.lib.resources.users.RemoteWipeSuccessRemoteOperation
|
||||
import com.owncloud.android.providers.DocumentsStorageProvider
|
||||
import com.owncloud.android.ui.activity.ContactsPreferenceActivity
|
||||
@@ -110,7 +112,7 @@ class AccountRemovalWork(
|
||||
remoceSyncedFolders(context, user.toPlatformAccount(), clock)
|
||||
|
||||
// delete all uploads for account
|
||||
uploadsStorageManager.removeAccountUploads(user.toPlatformAccount())
|
||||
uploadsStorageManager.removeUserUploads(user)
|
||||
|
||||
// delete stored E2E keys and mnemonic
|
||||
arbitraryDataProvider.deleteKeyForAccount(user.accountName, EncryptionUtils.PRIVATE_KEY)
|
||||
@@ -133,6 +135,14 @@ class AccountRemovalWork(
|
||||
// notify Document Provider
|
||||
DocumentsStorageProvider.notifyRootsChanged(context)
|
||||
|
||||
// delete app password
|
||||
val deleteAppPasswordRemoteOperation = DeleteAppPasswordRemoteOperation()
|
||||
val optionNextcloudClient = createNextcloudClient(user)
|
||||
|
||||
if (optionNextcloudClient.isPresent) {
|
||||
deleteAppPasswordRemoteOperation.execute(optionNextcloudClient.get())
|
||||
}
|
||||
|
||||
if (userRemoved) {
|
||||
eventBus.post(AccountRemovedEvent())
|
||||
}
|
||||
@@ -202,4 +212,17 @@ class AccountRemovalWork(
|
||||
Optional.empty()
|
||||
}
|
||||
}
|
||||
|
||||
private fun createNextcloudClient(user: User): Optional<NextcloudClient> {
|
||||
@Suppress("TooGenericExceptionCaught") // needs migration to newer api to get rid of exceptions
|
||||
return try {
|
||||
val context = MainApp.getAppContext()
|
||||
val factory = OwnCloudClientManagerFactory.getDefaultSingleton()
|
||||
val client = factory.getNextcloudClientFor(user.toOwnCloudAccount(), context)
|
||||
Optional.of(client)
|
||||
} catch (e: Exception) {
|
||||
Log_OC.e(this, "Could not create client", e)
|
||||
Optional.empty()
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -156,7 +156,12 @@ class NotificationWork constructor(
|
||||
}
|
||||
intent.putExtra(KEY_NOTIFICATION_ACCOUNT, user.accountName)
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)
|
||||
pendingIntent = PendingIntent.getActivity(context, 0, intent, PendingIntent.FLAG_ONE_SHOT)
|
||||
pendingIntent = PendingIntent.getActivity(
|
||||
context,
|
||||
notification.getNotificationId(),
|
||||
intent,
|
||||
PendingIntent.FLAG_ONE_SHOT
|
||||
)
|
||||
}
|
||||
|
||||
val pushNotificationId = randomId.nextInt()
|
||||
|
||||
@@ -113,9 +113,10 @@ class OfflineSyncWork constructor(
|
||||
ocFile.remotePath,
|
||||
user,
|
||||
true,
|
||||
context
|
||||
context,
|
||||
storageManager
|
||||
)
|
||||
synchronizeFileOperation.execute(storageManager, context)
|
||||
synchronizeFileOperation.execute(context)
|
||||
}
|
||||
}
|
||||
// recursive into folder
|
||||
|
||||
@@ -81,7 +81,7 @@ class ConnectivityServiceImpl implements ConnectivityService {
|
||||
|
||||
return result;
|
||||
} else {
|
||||
return !getConnectivity().isConnected();
|
||||
return !c.isConnected();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -25,12 +25,20 @@ package com.nextcloud.ui
|
||||
import android.accounts.Account
|
||||
import android.content.Context
|
||||
import com.owncloud.android.lib.common.OwnCloudClientFactory
|
||||
import com.owncloud.android.lib.common.accounts.AccountUtils
|
||||
import com.owncloud.android.lib.common.utils.Log_OC
|
||||
import com.owncloud.android.lib.resources.users.ClearStatusMessageRemoteOperation
|
||||
|
||||
public class ClearStatusTask(val account: Account?, val context: Context?) : Function0<Boolean> {
|
||||
override fun invoke(): Boolean {
|
||||
val client = OwnCloudClientFactory.createNextcloudClient(account, context)
|
||||
return try {
|
||||
val client = OwnCloudClientFactory.createNextcloudClient(account, context)
|
||||
|
||||
return ClearStatusMessageRemoteOperation().execute(client).isSuccess
|
||||
ClearStatusMessageRemoteOperation().execute(client).isSuccess
|
||||
} catch (e: AccountUtils.AccountNotFoundException) {
|
||||
Log_OC.e(this, "Error clearing status", e)
|
||||
|
||||
false
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -25,6 +25,8 @@ package com.nextcloud.ui
|
||||
import android.accounts.Account
|
||||
import android.content.Context
|
||||
import com.owncloud.android.lib.common.OwnCloudClientFactory
|
||||
import com.owncloud.android.lib.common.accounts.AccountUtils
|
||||
import com.owncloud.android.lib.common.utils.Log_OC
|
||||
import com.owncloud.android.lib.resources.users.SetPredefinedCustomStatusMessageRemoteOperation
|
||||
|
||||
public class SetPredefinedCustomStatusTask(
|
||||
@@ -34,8 +36,14 @@ public class SetPredefinedCustomStatusTask(
|
||||
val context: Context?
|
||||
) : Function0<Boolean> {
|
||||
override fun invoke(): Boolean {
|
||||
val client = OwnCloudClientFactory.createNextcloudClient(account, context)
|
||||
return try {
|
||||
val client = OwnCloudClientFactory.createNextcloudClient(account, context)
|
||||
|
||||
return SetPredefinedCustomStatusMessageRemoteOperation(messageId, clearAt).execute(client).isSuccess
|
||||
SetPredefinedCustomStatusMessageRemoteOperation(messageId, clearAt).execute(client).isSuccess
|
||||
} catch (e: AccountUtils.AccountNotFoundException) {
|
||||
Log_OC.e(this, "Error setting predefined status", e)
|
||||
|
||||
false
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -25,6 +25,8 @@ package com.nextcloud.ui
|
||||
import android.accounts.Account
|
||||
import android.content.Context
|
||||
import com.owncloud.android.lib.common.OwnCloudClientFactory
|
||||
import com.owncloud.android.lib.common.accounts.AccountUtils
|
||||
import com.owncloud.android.lib.common.utils.Log_OC
|
||||
import com.owncloud.android.lib.resources.users.SetStatusRemoteOperation
|
||||
import com.owncloud.android.lib.resources.users.StatusType
|
||||
|
||||
@@ -34,8 +36,14 @@ class SetStatusTask(
|
||||
val context: Context?
|
||||
) : Function0<Boolean> {
|
||||
override fun invoke(): Boolean {
|
||||
val client = OwnCloudClientFactory.createNextcloudClient(account, context)
|
||||
return try {
|
||||
val client = OwnCloudClientFactory.createNextcloudClient(account, context)
|
||||
|
||||
return SetStatusRemoteOperation(statusType).execute(client).isSuccess
|
||||
SetStatusRemoteOperation(statusType).execute(client).isSuccess
|
||||
} catch (e: AccountUtils.AccountNotFoundException) {
|
||||
Log_OC.e(this, "Error setting status", e)
|
||||
|
||||
false
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -25,6 +25,8 @@ package com.nextcloud.ui
|
||||
import android.accounts.Account
|
||||
import android.content.Context
|
||||
import com.owncloud.android.lib.common.OwnCloudClientFactory
|
||||
import com.owncloud.android.lib.common.accounts.AccountUtils
|
||||
import com.owncloud.android.lib.common.utils.Log_OC
|
||||
import com.owncloud.android.lib.resources.users.SetUserDefinedCustomStatusMessageRemoteOperation
|
||||
|
||||
public class SetUserDefinedCustomStatusTask(
|
||||
@@ -35,8 +37,14 @@ public class SetUserDefinedCustomStatusTask(
|
||||
val context: Context?
|
||||
) : Function0<Boolean> {
|
||||
override fun invoke(): Boolean {
|
||||
val client = OwnCloudClientFactory.createNextcloudClient(account, context)
|
||||
return try {
|
||||
val client = OwnCloudClientFactory.createNextcloudClient(account, context)
|
||||
|
||||
return SetUserDefinedCustomStatusMessageRemoteOperation(message, icon, clearAt).execute(client).isSuccess
|
||||
return SetUserDefinedCustomStatusMessageRemoteOperation(message, icon, clearAt).execute(client).isSuccess
|
||||
} catch (e: AccountUtils.AccountNotFoundException) {
|
||||
Log_OC.e(this, "Error setting user defined custom status", e)
|
||||
|
||||
false
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -771,6 +771,8 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
|
||||
accountSetupBinding.hostUrlInput.setText(uri);
|
||||
}
|
||||
|
||||
uri = AuthenticatorUrlUtils.normalizeScheme(uri);
|
||||
|
||||
// Handle internationalized domain names
|
||||
try {
|
||||
uri = DisplayUtils.convertIdn(uri, true);
|
||||
@@ -1264,6 +1266,12 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
|
||||
return false;
|
||||
|
||||
} else {
|
||||
UserInfo userInfo = authResult.getResultData();
|
||||
if (userInfo == null) {
|
||||
Log_OC.e(this, "Could not read user data!");
|
||||
return false;
|
||||
}
|
||||
|
||||
mAccount = newAccount;
|
||||
mAccountMgr.addAccountExplicitly(mAccount, webViewPassword, null);
|
||||
|
||||
@@ -1287,13 +1295,6 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
|
||||
// addAccountExplicitly, or in KEY_USERDATA
|
||||
mAccountMgr.setUserData(mAccount, Constants.KEY_OC_VERSION, mServerInfo.mVersion.getVersion());
|
||||
mAccountMgr.setUserData(mAccount, Constants.KEY_OC_BASE_URL, mServerInfo.mBaseUrl);
|
||||
|
||||
UserInfo userInfo = authResult.getResultData();
|
||||
if (userInfo == null) {
|
||||
Log_OC.e(this, "Could not read user data!");
|
||||
return false;
|
||||
}
|
||||
|
||||
mAccountMgr.setUserData(mAccount, Constants.KEY_DISPLAY_NAME, userInfo.getDisplayName());
|
||||
mAccountMgr.setUserData(mAccount, Constants.KEY_USER_ID, userInfo.getId());
|
||||
mAccountMgr.setUserData(mAccount,
|
||||
|
||||
@@ -46,7 +46,7 @@ public class AuthenticatorAsyncTask extends AsyncTask<Object, Void, RemoteOperat
|
||||
|
||||
private static final boolean SUCCESS_IF_ABSENT = false;
|
||||
|
||||
private WeakReference<Context> mWeakContext;
|
||||
private final WeakReference<Context> mWeakContext;
|
||||
private final WeakReference<OnAuthenticatorTaskListener> mListener;
|
||||
|
||||
public AuthenticatorAsyncTask(Activity activity) {
|
||||
@@ -65,15 +65,21 @@ public class AuthenticatorAsyncTask extends AsyncTask<Object, Void, RemoteOperat
|
||||
|
||||
// Client
|
||||
Uri uri = Uri.parse(url);
|
||||
OwnCloudClient client = OwnCloudClientFactory.createOwnCloudClient(uri, context, true);
|
||||
NextcloudClient nextcloudClient = OwnCloudClientFactory.createNextcloudClient(uri,
|
||||
credentials.getUsername(),
|
||||
credentials.toOkHttpCredentials(),
|
||||
context,
|
||||
true);
|
||||
client.setCredentials(credentials);
|
||||
|
||||
|
||||
// Operation - get display name
|
||||
RemoteOperationResult<UserInfo> userInfoResult = new GetUserInfoRemoteOperation().execute(nextcloudClient);
|
||||
|
||||
// Operation - try credentials
|
||||
OwnCloudClient client = OwnCloudClientFactory.createOwnCloudClient(uri, context, true);
|
||||
client.setUserId(userInfoResult.getResultData().getId());
|
||||
client.setCredentials(credentials);
|
||||
|
||||
ExistenceCheckRemoteOperation operation = new ExistenceCheckRemoteOperation(ROOT_PATH, SUCCESS_IF_ABSENT);
|
||||
result = operation.execute(client);
|
||||
|
||||
@@ -82,13 +88,8 @@ public class AuthenticatorAsyncTask extends AsyncTask<Object, Void, RemoteOperat
|
||||
String permanentLocation = redirectionPath.getLastPermanentLocation();
|
||||
result.setLastPermanentLocation(permanentLocation);
|
||||
}
|
||||
|
||||
// Operation - get display name
|
||||
if (result.isSuccess()) {
|
||||
GetUserInfoRemoteOperation remoteUserNameOperation = new GetUserInfoRemoteOperation();
|
||||
result = remoteUserNameOperation.execute(nextcloudClient);
|
||||
}
|
||||
|
||||
|
||||
result.setResultData(userInfoResult.getResultData());
|
||||
} else {
|
||||
result = new RemoteOperationResult(RemoteOperationResult.ResultCode.UNKNOWN_ERROR);
|
||||
}
|
||||
|
||||
@@ -23,6 +23,7 @@ package com.owncloud.android.authentication;
|
||||
|
||||
import android.text.TextUtils;
|
||||
|
||||
import java.net.URI;
|
||||
import java.util.Locale;
|
||||
|
||||
/**
|
||||
@@ -97,4 +98,14 @@ public final class AuthenticatorUrlUtils {
|
||||
|
||||
return strippedUrl;
|
||||
}
|
||||
|
||||
public static String normalizeScheme(String url) {
|
||||
URI uri = URI.create(url);
|
||||
if (uri.getScheme() != null) {
|
||||
String lcScheme = uri.getScheme().toLowerCase(Locale.ROOT);
|
||||
return String.format("%s:%s", lcScheme, uri.getRawSchemeSpecificPart());
|
||||
} else {
|
||||
return url;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -440,7 +440,7 @@ public final class ThumbnailsCacheManager {
|
||||
|
||||
public static class ThumbnailGenerationTask extends AsyncTask<ThumbnailGenerationTaskObject, Void, Bitmap> {
|
||||
private final WeakReference<ImageView> mImageViewReference;
|
||||
private static Account mAccount;
|
||||
private User user;
|
||||
private List<ThumbnailGenerationTask> mAsyncTasks;
|
||||
private Object mFile;
|
||||
private String mImageKey;
|
||||
@@ -449,13 +449,13 @@ public final class ThumbnailsCacheManager {
|
||||
private Listener mListener;
|
||||
private boolean gridViewEnabled = false;
|
||||
|
||||
public ThumbnailGenerationTask(ImageView imageView, FileDataStorageManager storageManager, Account account)
|
||||
public ThumbnailGenerationTask(ImageView imageView, FileDataStorageManager storageManager, User user)
|
||||
throws IllegalArgumentException {
|
||||
this(imageView, storageManager, account, null);
|
||||
this(imageView, storageManager, user, null);
|
||||
}
|
||||
|
||||
public ThumbnailGenerationTask(ImageView imageView, FileDataStorageManager storageManager,
|
||||
Account account, List<ThumbnailGenerationTask> asyncTasks)
|
||||
User user, List<ThumbnailGenerationTask> asyncTasks)
|
||||
throws IllegalArgumentException {
|
||||
// Use a WeakReference to ensure the ImageView can be garbage collected
|
||||
mImageViewReference = new WeakReference<>(imageView);
|
||||
@@ -463,15 +463,15 @@ public final class ThumbnailsCacheManager {
|
||||
throw new IllegalArgumentException("storageManager must not be NULL");
|
||||
}
|
||||
mStorageManager = storageManager;
|
||||
mAccount = account;
|
||||
this.user = user;
|
||||
mAsyncTasks = asyncTasks;
|
||||
}
|
||||
|
||||
public ThumbnailGenerationTask(ImageView imageView, FileDataStorageManager storageManager,
|
||||
Account account, List<ThumbnailGenerationTask> asyncTasks,
|
||||
User user, List<ThumbnailGenerationTask> asyncTasks,
|
||||
boolean gridViewEnabled)
|
||||
throws IllegalArgumentException {
|
||||
this(imageView, storageManager, account, asyncTasks);
|
||||
this(imageView, storageManager, user, asyncTasks);
|
||||
this.gridViewEnabled = gridViewEnabled;
|
||||
}
|
||||
|
||||
@@ -479,12 +479,12 @@ public final class ThumbnailsCacheManager {
|
||||
return getMethod;
|
||||
}
|
||||
|
||||
public ThumbnailGenerationTask(FileDataStorageManager storageManager, Account account){
|
||||
public ThumbnailGenerationTask(FileDataStorageManager storageManager, User user){
|
||||
if (storageManager == null) {
|
||||
throw new IllegalArgumentException("storageManager must not be NULL");
|
||||
}
|
||||
mStorageManager = storageManager;
|
||||
mAccount = account;
|
||||
this.user = user;
|
||||
mImageViewReference = null;
|
||||
}
|
||||
|
||||
@@ -498,11 +498,8 @@ public final class ThumbnailsCacheManager {
|
||||
protected Bitmap doInBackground(ThumbnailGenerationTaskObject... params) {
|
||||
Bitmap thumbnail = null;
|
||||
try {
|
||||
if (mAccount != null) {
|
||||
OwnCloudAccount ocAccount = new OwnCloudAccount(
|
||||
mAccount,
|
||||
MainApp.getAppContext()
|
||||
);
|
||||
if (user != null) {
|
||||
OwnCloudAccount ocAccount = user.toOwnCloudAccount();
|
||||
mClient = OwnCloudClientManagerFactory.getDefaultSingleton().
|
||||
getClientFor(ocAccount, MainApp.getAppContext());
|
||||
}
|
||||
|
||||
@@ -23,7 +23,6 @@
|
||||
*/
|
||||
package com.owncloud.android.datamodel;
|
||||
|
||||
import android.accounts.Account;
|
||||
import android.content.ContentResolver;
|
||||
import android.content.ContentValues;
|
||||
import android.database.Cursor;
|
||||
@@ -59,8 +58,8 @@ public class UploadsStorageManager extends Observable {
|
||||
private static final String AND = " AND ";
|
||||
private static final int SINGLE_RESULT = 1;
|
||||
|
||||
private ContentResolver mContentResolver;
|
||||
private CurrentAccountProvider currentAccountProvider;
|
||||
private final ContentResolver contentResolver;
|
||||
private final CurrentAccountProvider currentAccountProvider;
|
||||
|
||||
public UploadsStorageManager(
|
||||
CurrentAccountProvider currentAccountProvider,
|
||||
@@ -69,7 +68,7 @@ public class UploadsStorageManager extends Observable {
|
||||
if (contentResolver == null) {
|
||||
throw new IllegalArgumentException("Cannot create an instance with a NULL contentResolver");
|
||||
}
|
||||
mContentResolver = contentResolver;
|
||||
this.contentResolver = contentResolver;
|
||||
this.currentAccountProvider = currentAccountProvider;
|
||||
}
|
||||
|
||||
@@ -511,7 +510,7 @@ public class UploadsStorageManager extends Observable {
|
||||
}
|
||||
|
||||
private ContentResolver getDB() {
|
||||
return mContentResolver;
|
||||
return contentResolver;
|
||||
}
|
||||
|
||||
public long clearFailedButNotDelayedUploads() {
|
||||
@@ -647,12 +646,12 @@ public class UploadsStorageManager extends Observable {
|
||||
new String[]{});
|
||||
}
|
||||
|
||||
public int removeAccountUploads(Account account) {
|
||||
Log_OC.v(TAG, "Delete all uploads for account " + account.name);
|
||||
public int removeUserUploads(User user) {
|
||||
Log_OC.v(TAG, "Delete all uploads for account " + user.getAccountName());
|
||||
return getDB().delete(
|
||||
ProviderTableMeta.CONTENT_URI_UPLOADS,
|
||||
ProviderTableMeta.UPLOADS_ACCOUNT_NAME + "=?",
|
||||
new String[]{account.name});
|
||||
new String[]{user.getAccountName()});
|
||||
}
|
||||
|
||||
public enum UploadStatus {
|
||||
|
||||
@@ -490,7 +490,8 @@ public class FileUploader extends Service
|
||||
this,
|
||||
onWifiOnly,
|
||||
whileChargingOnly,
|
||||
disableRetries
|
||||
disableRetries,
|
||||
new FileDataStorageManager(user.toPlatformAccount(), getContentResolver())
|
||||
);
|
||||
newUpload.setCreatedBy(createdBy);
|
||||
if (isCreateRemoteFolder) {
|
||||
@@ -539,7 +540,8 @@ public class FileUploader extends Service
|
||||
this,
|
||||
onWifiOnly,
|
||||
whileChargingOnly,
|
||||
true
|
||||
true,
|
||||
new FileDataStorageManager(user.toPlatformAccount(), getContentResolver())
|
||||
);
|
||||
|
||||
newUpload.addDataTransferProgressListener(this);
|
||||
@@ -639,7 +641,7 @@ public class FileUploader extends Service
|
||||
// uploadResult = uploadEncryptedFileOperation.execute(mUploadClient, mStorageManager);
|
||||
// } else {
|
||||
/// perform the regular upload
|
||||
uploadResult = mCurrentUpload.execute(mUploadClient, mStorageManager);
|
||||
uploadResult = mCurrentUpload.execute(mUploadClient);
|
||||
// }
|
||||
} catch (Exception e) {
|
||||
Log_OC.e(TAG, "Error uploading", e);
|
||||
@@ -667,16 +669,32 @@ public class FileUploader extends Service
|
||||
}
|
||||
|
||||
// generate new Thumbnail
|
||||
final ThumbnailsCacheManager.ThumbnailGenerationTask task =
|
||||
new ThumbnailsCacheManager.ThumbnailGenerationTask(mStorageManager, mCurrentAccount);
|
||||
Optional<User> user = getCurrentUser();
|
||||
if (user.isPresent()) {
|
||||
final ThumbnailsCacheManager.ThumbnailGenerationTask task =
|
||||
new ThumbnailsCacheManager.ThumbnailGenerationTask(mStorageManager, user.get());
|
||||
|
||||
File file = new File(mCurrentUpload.getOriginalStoragePath());
|
||||
String remoteId = mCurrentUpload.getFile().getRemoteId();
|
||||
File file = new File(mCurrentUpload.getOriginalStoragePath());
|
||||
String remoteId = mCurrentUpload.getFile().getRemoteId();
|
||||
|
||||
task.execute(new ThumbnailsCacheManager.ThumbnailGenerationTaskObject(file, remoteId));
|
||||
task.execute(new ThumbnailsCacheManager.ThumbnailGenerationTaskObject(file, remoteId));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert current account to user. This is a temporary workaround until
|
||||
* service is migrated to new user model.
|
||||
*
|
||||
* @return Optional {@link User}
|
||||
*/
|
||||
private Optional<User> getCurrentUser() {
|
||||
if (mCurrentAccount == null) {
|
||||
return Optional.empty();
|
||||
} else {
|
||||
return accountManager.getUser(mCurrentAccount.name);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a status notification to show the upload progress
|
||||
|
||||
@@ -104,7 +104,6 @@ public class MediaControlView extends FrameLayout implements OnClickListener, On
|
||||
handler.removeMessages(SHOW_PROGRESS);
|
||||
}
|
||||
|
||||
|
||||
private void initControllerView(View v) {
|
||||
pauseButton = v.findViewById(R.id.playBtn);
|
||||
if (pauseButton != null) {
|
||||
@@ -162,7 +161,6 @@ public class MediaControlView extends FrameLayout implements OnClickListener, On
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private Handler handler = new Handler() {
|
||||
@Override
|
||||
public void handleMessage(Message msg) {
|
||||
@@ -218,7 +216,6 @@ public class MediaControlView extends FrameLayout implements OnClickListener, On
|
||||
return position;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean dispatchKeyEvent(KeyEvent event) {
|
||||
int keyCode = event.getKeyCode();
|
||||
@@ -277,7 +274,6 @@ public class MediaControlView extends FrameLayout implements OnClickListener, On
|
||||
} else {
|
||||
rewindButton.setVisibility(View.INVISIBLE);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void doPauseResume() {
|
||||
@@ -311,38 +307,29 @@ public class MediaControlView extends FrameLayout implements OnClickListener, On
|
||||
public void onClick(View v) {
|
||||
int pos;
|
||||
boolean playing = playerControl.isPlaying();
|
||||
switch (v.getId()) {
|
||||
case R.id.playBtn:
|
||||
doPauseResume();
|
||||
break;
|
||||
int id = v.getId();
|
||||
|
||||
case R.id.rewindBtn:
|
||||
pos = playerControl.getCurrentPosition();
|
||||
pos -= 5000;
|
||||
playerControl.seekTo(pos);
|
||||
if (!playing) {
|
||||
playerControl.pause(); // necessary in some 2.3.x devices
|
||||
}
|
||||
setProgress();
|
||||
break;
|
||||
|
||||
case R.id.forwardBtn:
|
||||
pos = playerControl.getCurrentPosition();
|
||||
pos += 15000;
|
||||
playerControl.seekTo(pos);
|
||||
if (!playing) {
|
||||
playerControl.pause(); // necessary in some 2.3.x devices
|
||||
}
|
||||
setProgress();
|
||||
break;
|
||||
|
||||
default:
|
||||
// do nothing
|
||||
break;
|
||||
if (id == R.id.playBtn) {
|
||||
doPauseResume();
|
||||
} else if (id == R.id.rewindBtn) {
|
||||
pos = playerControl.getCurrentPosition();
|
||||
pos -= 5000;
|
||||
playerControl.seekTo(pos);
|
||||
if (!playing) {
|
||||
playerControl.pause(); // necessary in some 2.3.x devices
|
||||
}
|
||||
setProgress();
|
||||
} else if (id == R.id.forwardBtn) {
|
||||
pos = playerControl.getCurrentPosition();
|
||||
pos += 15000;
|
||||
playerControl.seekTo(pos);
|
||||
if (!playing) {
|
||||
playerControl.pause(); // necessary in some 2.3.x devices
|
||||
}
|
||||
setProgress();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
|
||||
if (!fromUser) {
|
||||
@@ -370,7 +357,6 @@ public class MediaControlView extends FrameLayout implements OnClickListener, On
|
||||
handler.removeMessages(SHOW_PROGRESS); // grants no more updates with media player progress while dragging
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Called in devices with touchpad when the user finishes the adjusting of the seekbar.
|
||||
*/
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
package com.owncloud.android.operations;
|
||||
|
||||
import com.nextcloud.client.account.User;
|
||||
import com.owncloud.android.datamodel.FileDataStorageManager;
|
||||
import com.owncloud.android.datamodel.OCFile;
|
||||
import com.owncloud.android.lib.common.OwnCloudClient;
|
||||
import com.owncloud.android.lib.common.operations.RemoteOperation;
|
||||
@@ -37,13 +38,14 @@ public class CheckCurrentCredentialsOperation extends SyncOperation {
|
||||
|
||||
private final User user;
|
||||
|
||||
public CheckCurrentCredentialsOperation(User user) {
|
||||
public CheckCurrentCredentialsOperation(User user, FileDataStorageManager storageManager) {
|
||||
super(storageManager);
|
||||
this.user = user;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected RemoteOperationResult run(OwnCloudClient client) {
|
||||
RemoteOperationResult result = null;
|
||||
RemoteOperationResult result;
|
||||
boolean validAccount = user.nameEquals(getStorageManager().getAccount().name);
|
||||
if (!validAccount) {
|
||||
result = new RemoteOperationResult(new IllegalStateException(
|
||||
|
||||
@@ -22,19 +22,18 @@
|
||||
package com.owncloud.android.operations;
|
||||
|
||||
import com.owncloud.android.lib.common.OwnCloudClient;
|
||||
import com.owncloud.android.lib.common.operations.RemoteOperation;
|
||||
import com.owncloud.android.lib.common.operations.RemoteOperationResult;
|
||||
import com.owncloud.android.lib.common.utils.Log_OC;
|
||||
import com.owncloud.android.lib.resources.comments.CommentFileRemoteOperation;
|
||||
import com.owncloud.android.operations.common.SyncOperation;
|
||||
|
||||
|
||||
/**
|
||||
* Comment file
|
||||
*/
|
||||
public class CommentFileOperation extends SyncOperation {
|
||||
public class CommentFileOperation extends RemoteOperation {
|
||||
|
||||
private String message;
|
||||
private String fileId;
|
||||
private final String message;
|
||||
private final String fileId;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
|
||||
package com.owncloud.android.operations;
|
||||
|
||||
import com.owncloud.android.datamodel.FileDataStorageManager;
|
||||
import com.owncloud.android.datamodel.OCFile;
|
||||
import com.owncloud.android.lib.common.OwnCloudClient;
|
||||
import com.owncloud.android.lib.common.operations.RemoteOperationResult;
|
||||
@@ -31,7 +32,7 @@ import com.owncloud.android.operations.common.SyncOperation;
|
||||
*/
|
||||
public class CopyFileOperation extends SyncOperation {
|
||||
|
||||
private String srcPath;
|
||||
private final String srcPath;
|
||||
private String targetParentPath;
|
||||
|
||||
/**
|
||||
@@ -40,7 +41,9 @@ public class CopyFileOperation extends SyncOperation {
|
||||
* @param srcPath Remote path of the {@link OCFile} to move.
|
||||
* @param targetParentPath Path to the folder where the file will be copied into.
|
||||
*/
|
||||
public CopyFileOperation(String srcPath, String targetParentPath) {
|
||||
public CopyFileOperation(String srcPath, String targetParentPath, FileDataStorageManager storageManager) {
|
||||
super(storageManager);
|
||||
|
||||
this.srcPath = srcPath;
|
||||
this.targetParentPath = targetParentPath;
|
||||
if (!this.targetParentPath.endsWith(OCFile.PATH_SEPARATOR)) {
|
||||
|
||||
@@ -28,6 +28,7 @@ import com.nextcloud.client.account.User;
|
||||
import com.owncloud.android.datamodel.ArbitraryDataProvider;
|
||||
import com.owncloud.android.datamodel.DecryptedFolderMetadata;
|
||||
import com.owncloud.android.datamodel.EncryptedFolderMetadata;
|
||||
import com.owncloud.android.datamodel.FileDataStorageManager;
|
||||
import com.owncloud.android.datamodel.OCFile;
|
||||
import com.owncloud.android.lib.common.OwnCloudClient;
|
||||
import com.owncloud.android.lib.common.operations.OnRemoteOperationListener;
|
||||
@@ -67,7 +68,9 @@ public class CreateFolderOperation extends SyncOperation implements OnRemoteOper
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
public CreateFolderOperation(String remotePath, User user, Context context) {
|
||||
public CreateFolderOperation(String remotePath, User user, Context context, FileDataStorageManager storageManager) {
|
||||
super(storageManager);
|
||||
|
||||
this.remotePath = remotePath;
|
||||
this.user = user;
|
||||
this.context = context;
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
|
||||
package com.owncloud.android.operations;
|
||||
|
||||
import com.owncloud.android.datamodel.FileDataStorageManager;
|
||||
import com.owncloud.android.datamodel.OCFile;
|
||||
import com.owncloud.android.lib.common.OwnCloudClient;
|
||||
import com.owncloud.android.lib.common.operations.RemoteOperationResult;
|
||||
@@ -40,7 +41,9 @@ public class CreateShareViaLinkOperation extends SyncOperation {
|
||||
private String path;
|
||||
private String password;
|
||||
|
||||
public CreateShareViaLinkOperation(String path, String password) {
|
||||
public CreateShareViaLinkOperation(String path, String password, FileDataStorageManager storageManager) {
|
||||
super(storageManager);
|
||||
|
||||
this.path = path;
|
||||
this.password = password;
|
||||
}
|
||||
|
||||