Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
db407b0b6a | ||
|
|
5b2c912a66 |
No files matched your search
@@ -1,4 +1,4 @@
|
||||
{
|
||||
"name": "NextcloudAndroid",
|
||||
"dockerFile": "Dockerfile"
|
||||
"dockerFile": "Dockerfile",
|
||||
}
|
||||
@@ -32,11 +32,10 @@ services:
|
||||
image: ghcr.io/nextcloud/continuous-integration-shallow-server:latest # also change in updateScreenshots.sh
|
||||
environment:
|
||||
EVAL: true
|
||||
SERVER_VERSION: 'stable27'
|
||||
SERVER_VERSION: 'stable25'
|
||||
commands:
|
||||
- BRANCH="$SERVER_VERSION" /usr/local/bin/initnc.sh
|
||||
- echo 127.0.0.1 server >> /etc/hosts
|
||||
- apt-get update && apt-get install -y composer
|
||||
- su www-data -c "OC_PASS=user1 php /var/www/html/occ user:add --password-from-env --display-name='User One' user1"
|
||||
- su www-data -c "OC_PASS=user2 php /var/www/html/occ user:add --password-from-env --display-name='User Two' user2"
|
||||
- su www-data -c "OC_PASS=user3 php /var/www/html/occ user:add --password-from-env --display-name='User Three' user3"
|
||||
@@ -50,9 +49,6 @@ services:
|
||||
- su www-data -c "php /var/www/html/occ app:enable text"
|
||||
- su www-data -c "git clone -b $SERVER_VERSION https://github.com/nextcloud/end_to_end_encryption.git /var/www/html/apps/end_to_end_encryption/"
|
||||
- su www-data -c "php /var/www/html/occ app:enable end_to_end_encryption"
|
||||
- su www-data -c "git clone -b $SERVER_VERSION https://github.com/nextcloud/photos.git /var/www/html/apps/photos/"
|
||||
- su www-data -c "cd /var/www/html/apps/photos; composer install"
|
||||
- su www-data -c "php /var/www/html/occ app:enable -f photos"
|
||||
- /usr/local/bin/run.sh
|
||||
|
||||
trigger:
|
||||
@@ -94,7 +90,6 @@ services:
|
||||
commands:
|
||||
- /usr/local/bin/initnc.sh
|
||||
- echo 127.0.0.1 server >> /etc/hosts
|
||||
- apt-get update && apt-get install -y composer
|
||||
- su www-data -c "OC_PASS=user1 php /var/www/html/occ user:add --password-from-env --display-name='User One' user1"
|
||||
- su www-data -c "OC_PASS=user2 php /var/www/html/occ user:add --password-from-env --display-name='User Two' user2"
|
||||
- su www-data -c "OC_PASS=user3 php /var/www/html/occ user:add --password-from-env --display-name='User Three' user3"
|
||||
@@ -108,9 +103,6 @@ services:
|
||||
- su www-data -c "php /var/www/html/occ app:enable text"
|
||||
- su www-data -c "git clone -b master https://github.com/nextcloud/end_to_end_encryption/ /var/www/html/apps/end_to_end_encryption/"
|
||||
- su www-data -c "php /var/www/html/occ app:enable end_to_end_encryption"
|
||||
- su www-data -c "git clone https://github.com/nextcloud/photos.git /var/www/html/apps/photos/"
|
||||
- su www-data -c "cd /var/www/html/apps/photos; composer install"
|
||||
- su www-data -c "php /var/www/html/occ app:enable -f photos"
|
||||
- /usr/local/bin/run.sh
|
||||
|
||||
trigger:
|
||||
@@ -179,6 +171,4 @@ name: GIT_TOKEN
|
||||
data: XIoa9IYq+xQ+N5iln8dlpWv0jV6ROr7HuE24ioUr4uQ8m8SjyH0yognWYLYLqnbTKrFWlFZiEMQTH/sZiWjRFvV1iL0=
|
||||
---
|
||||
kind: signature
|
||||
hmac: cf7f9b6403072500d986d4979375676729a9104f98b0c53fba5198c478cccab4
|
||||
|
||||
...
|
||||
hmac: aec1cabcb7b4f98f1be1d5b7a052a629ce3193e19a3692dd52ada48b6e72a1c9
|
||||
@@ -1,11 +1,10 @@
|
||||
# synced from @nextcloud/android-config
|
||||
name: "Analysis"
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches: [ "master", "main", "stable-*" ]
|
||||
branches: [ master, stable-* ]
|
||||
push:
|
||||
branches: [ "master", "main", "stable-*" ]
|
||||
branches: [ master, stable-* ]
|
||||
|
||||
permissions:
|
||||
pull-requests: write
|
||||
@@ -17,7 +16,7 @@ concurrency:
|
||||
|
||||
jobs:
|
||||
analysis:
|
||||
runs-on: ubuntu-22.04
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Setup variables
|
||||
id: get-vars
|
||||
@@ -33,12 +32,12 @@ jobs:
|
||||
echo "pr=${{ github.event.pull_request.number }}" >> "$GITHUB_OUTPUT"
|
||||
echo "repo=${{ github.event.pull_request.head.repo.full_name }}" >> "$GITHUB_OUTPUT"
|
||||
fi
|
||||
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
|
||||
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
|
||||
with:
|
||||
repository: ${{ steps.get-vars.outputs.repo }}
|
||||
ref: ${{ steps.get-vars.outputs.branch }}
|
||||
- name: Set up JDK 17
|
||||
uses: actions/setup-java@387ac29b308b003ca37ba93a6cab5eb57c8f5f93 # v4.0.0
|
||||
uses: actions/setup-java@5ffc13f4174014e2d4d4572b3d74c3fa61aeb2c2 # v3.11.0
|
||||
with:
|
||||
distribution: "temurin"
|
||||
java-version: 17
|
||||
|
||||
@@ -19,9 +19,9 @@ jobs:
|
||||
matrix:
|
||||
flavor: [ Generic, Gplay, Huawei ]
|
||||
steps:
|
||||
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v3
|
||||
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3
|
||||
- name: set up JDK 17
|
||||
uses: actions/setup-java@0ab4596768b603586c0de567f2430c30f5b0d2b0 # v3
|
||||
uses: actions/setup-java@5ffc13f4174014e2d4d4572b3d74c3fa61aeb2c2 # v3
|
||||
with:
|
||||
distribution: "temurin"
|
||||
java-version: 17
|
||||
|
||||
@@ -19,9 +19,9 @@ jobs:
|
||||
matrix:
|
||||
task: [ detekt, spotlessKotlinCheck ]
|
||||
steps:
|
||||
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v3
|
||||
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3
|
||||
- name: Set up JDK 17
|
||||
uses: actions/setup-java@0ab4596768b603586c0de567f2430c30f5b0d2b0 # v3
|
||||
uses: actions/setup-java@5ffc13f4174014e2d4d4572b3d74c3fa61aeb2c2 # v3
|
||||
with:
|
||||
distribution: "temurin"
|
||||
java-version: 17
|
||||
|
||||
@@ -26,17 +26,17 @@ jobs:
|
||||
language: [ 'java' ]
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
|
||||
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
|
||||
- name: Set Swap Space
|
||||
uses: pierotofy/set-swap-space@49819abfb41bd9b44fb781159c033dba90353a7c # v1.0
|
||||
with:
|
||||
swap-size-gb: 10
|
||||
- name: Initialize CodeQL
|
||||
uses: github/codeql-action/init@407ffafae6a767df3e0230c3df91b6443ae8df75 # v2.22.8
|
||||
uses: github/codeql-action/init@6ca1aa8c195c3ca3e77c174fe0356db1bce3b319 # v2.21.1
|
||||
with:
|
||||
languages: ${{ matrix.language }}
|
||||
- name: Set up JDK 17
|
||||
uses: actions/setup-java@387ac29b308b003ca37ba93a6cab5eb57c8f5f93 # v4.0.0
|
||||
uses: actions/setup-java@cd89f46ac9d01407894225f350157564c9c7cee2 # v3.12.0
|
||||
with:
|
||||
distribution: "temurin"
|
||||
java-version: 17
|
||||
@@ -46,4 +46,4 @@ jobs:
|
||||
echo "org.gradle.jvmargs=-Xmx2g -XX:MaxMetaspaceSize=512m -XX:+HeapDumpOnOutOfMemoryError" > "$HOME/.gradle/gradle.properties"
|
||||
./gradlew assembleDebug
|
||||
- name: Perform CodeQL Analysis
|
||||
uses: github/codeql-action/analyze@407ffafae6a767df3e0230c3df91b6443ae8df75 # v2.22.8
|
||||
uses: github/codeql-action/analyze@6ca1aa8c195c3ca3e77c174fe0356db1bce3b319 # v2.21.1
|
||||
@@ -23,7 +23,7 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Add reaction on start
|
||||
uses: peter-evans/create-or-update-comment@23ff15729ef2fc348714a3bb66d2f655ca9066f2 # v3.1.0
|
||||
uses: peter-evans/create-or-update-comment@c6c9a1a66007646a28c153e2a8580a5bad27bcfa # v3.0.2
|
||||
with:
|
||||
token: ${{ secrets.COMMAND_BOT_PAT }}
|
||||
repository: ${{ github.event.repository.full_name }}
|
||||
@@ -31,7 +31,7 @@ jobs:
|
||||
reaction-type: "+1"
|
||||
|
||||
- name: Checkout the latest code
|
||||
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
|
||||
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
|
||||
with:
|
||||
fetch-depth: 0
|
||||
token: ${{ secrets.COMMAND_BOT_PAT }}
|
||||
@@ -42,7 +42,7 @@ jobs:
|
||||
GITHUB_TOKEN: ${{ secrets.COMMAND_BOT_PAT }}
|
||||
|
||||
- name: Add reaction on failure
|
||||
uses: peter-evans/create-or-update-comment@23ff15729ef2fc348714a3bb66d2f655ca9066f2 # v3.1.0
|
||||
uses: peter-evans/create-or-update-comment@c6c9a1a66007646a28c153e2a8580a5bad27bcfa # v3.0.2
|
||||
if: failure()
|
||||
with:
|
||||
token: ${{ secrets.COMMAND_BOT_PAT }}
|
||||
|
||||
@@ -16,9 +16,9 @@ jobs:
|
||||
runs-on: ubuntu-22.04
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v3
|
||||
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3
|
||||
- name: Set up JDK 17
|
||||
uses: actions/setup-java@0ab4596768b603586c0de567f2430c30f5b0d2b0 # v3
|
||||
uses: actions/setup-java@5ffc13f4174014e2d4d4572b3d74c3fa61aeb2c2 # v3
|
||||
with:
|
||||
distribution: "temurin"
|
||||
java-version: 17
|
||||
|
||||
@@ -18,5 +18,5 @@ jobs:
|
||||
name: "Validation"
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
|
||||
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
|
||||
- uses: gradle/wrapper-validation-action@56b90f209b02bf6d1deae490e9ef18b21a389cd4 # v1.1.0
|
||||
@@ -1,8 +1,3 @@
|
||||
# This workflow is provided via the organization template repository
|
||||
#
|
||||
# https://github.com/nextcloud/.github
|
||||
# https://docs.github.com/en/actions/learn-github-actions/sharing-workflows-with-your-organization
|
||||
|
||||
name: 'Ask for feedback on PRs'
|
||||
on:
|
||||
schedule:
|
||||
@@ -10,7 +5,7 @@ on:
|
||||
|
||||
jobs:
|
||||
pr-feedback:
|
||||
runs-on: ubuntu-latest
|
||||
runs-on: ubuntu-22.04
|
||||
steps:
|
||||
- name: The get-github-handles-from-website action
|
||||
uses: marcelklehr/get-github-handles-from-website-action@a739600f6b91da4957f51db0792697afbb2f143c # v1.0.0
|
||||
@@ -23,12 +18,12 @@ jobs:
|
||||
Hello there,
|
||||
Thank you so much for taking the time and effort to create a pull request to our Nextcloud project.
|
||||
|
||||
We hope that the review process is going smooth and is helpful for you. We want to ensure your pull request is reviewed to your satisfaction. If you have a moment, our community management team would very much appreciate your feedback on your experience with this PR review process.
|
||||
We hope that the reviewing process is going smooth and is helpful for you. We want to ensure your pull request is reviewed to your satisfaction. If you have a moment, our community management team would very much appreciate your feedback on your experience with this PR reviewing process.
|
||||
|
||||
Your feedback is valuable to us as we continuously strive to improve our community developer experience. Please take a moment to complete our short survey by clicking on the following link: https://cloud.nextcloud.com/apps/forms/s/i9Ago4EQRZ7TWxjfmeEpPkf6
|
||||
|
||||
Thank you for contributing to Nextcloud and we hope to hear from you soon!
|
||||
days-before-feedback: 14
|
||||
start-date: "2023-07-10"
|
||||
exempt-authors: "${{ steps.scrape.outputs.users }},nextcloud-command,nextcloud-android-bot"
|
||||
exempt-authors: "${{ steps.scrape.outputs.users }}"
|
||||
exempt-bots: true
|
||||
@@ -19,10 +19,10 @@ jobs:
|
||||
- name: Check if secrets are available
|
||||
run: echo "::set-output name=ok::${{ secrets.KS_PASS != '' }}"
|
||||
id: check-secrets
|
||||
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v3
|
||||
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3
|
||||
if: ${{ steps.check-secrets.outputs.ok == 'true' }}
|
||||
- name: set up JDK 17
|
||||
uses: actions/setup-java@0ab4596768b603586c0de567f2430c30f5b0d2b0 # v3
|
||||
uses: actions/setup-java@5ffc13f4174014e2d4d4572b3d74c3fa61aeb2c2 # v3
|
||||
if: ${{ steps.check-secrets.outputs.ok == 'true' }}
|
||||
with:
|
||||
distribution: "temurin"
|
||||
|
||||
@@ -24,12 +24,12 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: "Checkout code"
|
||||
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
|
||||
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
|
||||
with:
|
||||
persist-credentials: false
|
||||
|
||||
- name: "Run analysis"
|
||||
uses: ossf/scorecard-action@0864cf19026789058feabb7e87baa5f140aac736 # v2.3.1
|
||||
uses: ossf/scorecard-action@08b4669551908b1024bb425080c797723083c031 # v2.2.0
|
||||
with:
|
||||
results_file: results.sarif
|
||||
results_format: sarif
|
||||
@@ -37,6 +37,6 @@ jobs:
|
||||
|
||||
# Upload the results to GitHub's code scanning dashboard.
|
||||
- name: "Upload to code-scanning"
|
||||
uses: github/codeql-action/upload-sarif@407ffafae6a767df3e0230c3df91b6443ae8df75 # v2.22.8
|
||||
uses: github/codeql-action/upload-sarif@6ca1aa8c195c3ca3e77c174fe0356db1bce3b319 # v2.21.1
|
||||
with:
|
||||
sarif_file: results.sarif
|
||||
@@ -22,17 +22,17 @@ jobs:
|
||||
color: [ blue ]
|
||||
api-level: [ 27 ]
|
||||
steps:
|
||||
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v3
|
||||
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3
|
||||
|
||||
- name: Gradle cache
|
||||
uses: actions/cache@704facf57e6136b1bc63b828d79edcd491f0ee84 # v3
|
||||
uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3
|
||||
with:
|
||||
path: |
|
||||
~/.gradle/caches
|
||||
~/.gradle/wrapper
|
||||
key: gradle-${{ runner.os }}-${{ hashFiles('**/*.gradle*') }}-${{ hashFiles('**/gradle/wrapper/gradle-wrapper.properties') }}
|
||||
- name: AVD cache
|
||||
uses: actions/cache@704facf57e6136b1bc63b828d79edcd491f0ee84 # v3
|
||||
uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3
|
||||
id: avd-cache
|
||||
with:
|
||||
path: |
|
||||
@@ -40,7 +40,7 @@ jobs:
|
||||
~/.android/adb*
|
||||
key: avd-${{ matrix.api-level }}
|
||||
|
||||
- uses: actions/setup-java@0ab4596768b603586c0de567f2430c30f5b0d2b0 # v3
|
||||
- uses: actions/setup-java@5ffc13f4174014e2d4d4572b3d74c3fa61aeb2c2 # v3
|
||||
with:
|
||||
distribution: "temurin"
|
||||
java-version: 17
|
||||
@@ -88,7 +88,7 @@ jobs:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: scripts/uploadReport.sh "${{ secrets.LOG_USERNAME }}" "${{ secrets.LOG_PASSWORD }}" ${{github.event.number}} "${{ matrix.color }}-${{ matrix.scheme }}" "Screenshot" ${{github.event.number}}
|
||||
- name: Archive Espresso results
|
||||
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32
|
||||
uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce
|
||||
if: ${{ always() }}
|
||||
with:
|
||||
name: Report-${{ matrix.color }}-${{ matrix.scheme }}
|
||||
|
||||
@@ -18,9 +18,9 @@ jobs:
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
|
||||
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
|
||||
- name: Set up JDK 17
|
||||
uses: actions/setup-java@0ab4596768b603586c0de567f2430c30f5b0d2b0 # v3.13.0
|
||||
uses: actions/setup-java@5ffc13f4174014e2d4d4572b3d74c3fa61aeb2c2 # v3.11.0
|
||||
with:
|
||||
distribution: "temurin"
|
||||
java-version: 17
|
||||
@@ -30,7 +30,7 @@ jobs:
|
||||
if: ${{ always() }}
|
||||
run: scripts/deleteOldComments.sh "test" "Unit" ${{github.event.number}}
|
||||
- name: Run unit tests with coverage
|
||||
uses: gradle/gradle-build-action@87a9a15658c426a54dd469d4fc7dc1a73ca9d4a6 # v2.10.0
|
||||
uses: gradle/gradle-build-action@915a66c096a03101667f9df2e56c9efef558b165 # v2.6.1
|
||||
with:
|
||||
arguments: jacocoTestGplayDebugUnitTest
|
||||
- name: Upload failing results
|
||||
@@ -46,7 +46,7 @@ jobs:
|
||||
fail_ci_if_error: true
|
||||
- name: Upload jacoco artifacts
|
||||
if: ${{ failure() }}
|
||||
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32
|
||||
uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce
|
||||
with:
|
||||
name: test-results
|
||||
path: app/build/reports/tests/testGplayDebugUnitTest/
|
||||
@@ -1,30 +1,9 @@
|
||||
## 3.26.0 (September 16, 2023)
|
||||
|
||||
- image editing
|
||||
- image details, with map
|
||||
- show other Nextcloud apps
|
||||
|
||||
Minimum: NC 16 Server, Android 6.0 Marshmallow
|
||||
|
||||
For a full list, please see https://github.com/nextcloud/android/milestone/84
|
||||
|
||||
## 3.25.0 (June 13, 2023)
|
||||
|
||||
- show Groupfolder
|
||||
- Tag in file listing
|
||||
|
||||
Minimum: NC 16 Server, Android 6.0 Marshmallow
|
||||
|
||||
For a full list, please see https://github.com/nextcloud/android/milestone/81
|
||||
|
||||
## 3.24.1 (February 21, 2023)
|
||||
## 3.24.1 (February 21, 2022)
|
||||
|
||||
- Fix crash in previous version when connecting to old server versions
|
||||
|
||||
Minimum: NC 16 Server, Android 6.0 Marshmallow
|
||||
|
||||
For a full list, please see https://github.com/nextcloud/android/milestone/80
|
||||
|
||||
## 3.24.0 (February 13, 2023)
|
||||
|
||||
- Several performance optimizations by @starypatyk
|
||||
|
||||
@@ -297,7 +297,7 @@ We use [shot](https://github.com/Karumi/Shot) for taking screenshots and compare
|
||||
Screenshot.snapActivity(activity).record();
|
||||
```
|
||||
|
||||
- best practice is to first create test with emulator too see behaviour and then create screenshots
|
||||
- best practise is to first create test with emulator too see behaviour and then create screenshots
|
||||
|
||||
## File naming
|
||||
|
||||
|
||||
@@ -15,17 +15,11 @@ height="80">](https://f-droid.org/packages/com.nextcloud.client/)
|
||||
|
||||
## How to contribute :rocket:
|
||||
|
||||
If you want to [contribute](https://nextcloud.com/contribute/) to the Nextcloud Android client app, there are many ways to help whether or not you are a coder:
|
||||
If you want to [contribute](https://nextcloud.com/contribute/) to Nextcloud, you are very welcome:
|
||||
|
||||
* helping out other users on our forum at https://help.nextcloud.com
|
||||
* providing translations of the app on [Transifex](https://app.transifex.com/nextcloud/nextcloud/android/)
|
||||
* reporting problems / suggesting enhancements by [opening new issues](https://github.com/nextcloud/android/issues/new/choose)
|
||||
* implementing proposed bug fixes and enhancement ideas by submitting PRs (associated with a corresponding issue preferably)
|
||||
* reviewing [pull requests](https://github.com/nextcloud/android/pulls) and providing feedback on code, implementation, and functionality
|
||||
* installing and testing [pull request builds](https://github.com/nextcloud/android/pulls), [daily/dev builds](https://github.com/nextcloud/android#development-version-hammer), or [RCs/release candidate builds](https://github.com/nextcloud/android/releases)
|
||||
* enhancing Admin, User, or Developer [documentation](https://github.com/nextcloud/documentation/)
|
||||
* hitting hard on the latest stable release by testing fundamental features and evaluating the user experience
|
||||
* proactively getting familiar with [how to gather debug logs](https://github.com/nextcloud/android#getting-debug-info-via-logcat-mag) from your devices (so that you are prepared to provide a detailed report if you encounter a problem with the app in the future)
|
||||
* our forum at https://help.nextcloud.com
|
||||
* for translations of the app on [Transifex](https://app.transifex.com/nextcloud/nextcloud/android/)
|
||||
* opening issues and PRs (including a corresponding issue)
|
||||
|
||||
## Contribution Guidelines & License :scroll:
|
||||
|
||||
@@ -44,7 +38,7 @@ More information on how to contribute: <https://nextcloud.com/contribute/>
|
||||
## Start contributing :hammer\_and\_wrench:
|
||||
|
||||
Make sure you read [SETUP.md](https://github.com/nextcloud/android/blob/master/SETUP.md) and [CONTRIBUTING.md](https://github.com/nextcloud/android/blob/master/CONTRIBUTING.md) before you start working on this project. But basically: fork this repository and contribute back using pull requests to the master branch.
|
||||
Easy starting points are also reviewing [pull requests](https://github.com/nextcloud/android/pulls) and working on [starter issues](https://github.com/nextcloud/android/issues?q=is%3Aopen+is%3Aissue+label%3A%22good+first+issue%22).
|
||||
Easy starting points are also reviewing [pull requests](https://github.com/nextcloud/android/pulls) and working on [starter issues](https://github.com/nextcloud/android/issues?q=is%3Aopen+is%3Aissue+label%3A%22starter+issue%22).
|
||||
|
||||
### Getting debug info via logcat :mag:
|
||||
|
||||
|
||||
@@ -51,7 +51,7 @@ To set up the project in Android Studio follow the next steps:
|
||||
|
||||
* 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 configuration for the project: ```Settings``` → ```Editor``` → ```Code Style``` → ```Scheme: Project``` and ```Enable EditorConfig support```
|
||||
* Setup Android Studio editor configurtation for the project: ```Settings``` → ```Editor``` → ```Code Style``` → ```Scheme: Project``` and ```Enable EditorConfig support```
|
||||
|
||||
|
||||
### 3. Working in a terminal with Gradle:
|
||||
|
||||
@@ -4,9 +4,9 @@ import org.gradle.internal.jvm.Jvm
|
||||
buildscript {
|
||||
dependencies {
|
||||
classpath "com.android.tools.build:gradle:$androidPluginVersion"
|
||||
classpath 'com.github.spotbugs.snom:spotbugs-gradle-plugin:5.1.3'
|
||||
classpath 'com.github.spotbugs.snom:spotbugs-gradle-plugin:5.0.14'
|
||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
||||
classpath "io.gitlab.arturbosch.detekt:detekt-gradle-plugin:1.23.1"
|
||||
classpath "io.gitlab.arturbosch.detekt:detekt-gradle-plugin:1.23.0"
|
||||
classpath "commons-httpclient:commons-httpclient:3.1@jar" // remove after entire switch to lib v2
|
||||
classpath 'com.karumi:shot:5.14.1'
|
||||
classpath "org.jacoco:org.jacoco.core:$jacoco_version"
|
||||
@@ -17,7 +17,6 @@ buildscript {
|
||||
|
||||
plugins {
|
||||
id "com.diffplug.spotless" version "6.20.0"
|
||||
id 'com.google.devtools.ksp' version '1.8.22-1.0.11' apply false
|
||||
}
|
||||
|
||||
apply plugin: 'com.android.application'
|
||||
@@ -31,13 +30,11 @@ apply from: "$rootProject.projectDir/jacoco.gradle"
|
||||
apply plugin: 'com.github.spotbugs'
|
||||
apply plugin: 'io.gitlab.arturbosch.detekt'
|
||||
apply plugin: 'shot'
|
||||
apply plugin: 'com.google.devtools.ksp'
|
||||
|
||||
|
||||
println "Gradle uses Java ${Jvm.current()}"
|
||||
|
||||
configurations {
|
||||
configureEach {
|
||||
all {
|
||||
exclude group: 'org.jetbrains', module: 'annotations-java5' // via prism4j, already using annotations explicitly
|
||||
|
||||
// check for updates every build
|
||||
@@ -60,7 +57,7 @@ configurations.configureEach {
|
||||
|
||||
// semantic versioning for version code
|
||||
def versionMajor = 3
|
||||
def versionMinor = 27
|
||||
def versionMinor = 26
|
||||
def versionPatch = 0
|
||||
def versionBuild = 0 // 0-50=Alpha / 51-98=RC / 90-99=stable
|
||||
|
||||
@@ -74,6 +71,8 @@ file("$project.rootDir/ndk.env").readLines().each() {
|
||||
def perfAnalysis = project.hasProperty('perfAnalysis')
|
||||
|
||||
android {
|
||||
|
||||
compileSdkVersion 33
|
||||
// install this NDK version and Cmake to produce smaller APKs. Build will still work if not installed
|
||||
ndkVersion "${ndkEnv.get("NDK_VERSION")}"
|
||||
|
||||
@@ -83,9 +82,8 @@ android {
|
||||
|
||||
|
||||
defaultConfig {
|
||||
minSdkVersion 24
|
||||
targetSdkVersion 34
|
||||
compileSdk 34
|
||||
minSdkVersion 23
|
||||
targetSdkVersion 33
|
||||
|
||||
buildConfigField 'boolean', 'CI', ciBuild.toString()
|
||||
buildConfigField 'boolean', 'RUNTIME_PERF_ANALYSIS', perfAnalysis.toString()
|
||||
@@ -118,7 +116,7 @@ android {
|
||||
// adapt structure from Eclipse to Gradle/Android Studio expectations;
|
||||
// see http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Configuring-the-Structure
|
||||
|
||||
flavorDimensions += "default"
|
||||
flavorDimensions "default"
|
||||
|
||||
buildTypes {
|
||||
debug {
|
||||
@@ -193,6 +191,8 @@ android {
|
||||
exclude '**/gen/**'
|
||||
|
||||
reports {
|
||||
xml.enabled = false
|
||||
html.enabled = true
|
||||
xml {
|
||||
destination = file("$project.buildDir/reports/pmd/pmd.xml")
|
||||
}
|
||||
@@ -236,6 +236,7 @@ android {
|
||||
dependencies {
|
||||
// dependencies for app building
|
||||
implementation 'androidx.multidex:multidex:2.0.1'
|
||||
// implementation project('nextcloud-android-library')
|
||||
implementation("com.github.nextcloud:android-library:$androidLibraryVersion") {
|
||||
exclude group: 'org.ogce', module: 'xpp3' // unused in Android and brings wrong Junit version
|
||||
}
|
||||
@@ -246,7 +247,7 @@ dependencies {
|
||||
implementation 'org.apache.jackrabbit:jackrabbit-webdav:2.13.5' // remove after entire switch to lib v2
|
||||
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
|
||||
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
|
||||
implementation 'com.google.android.material:material:1.10.0'
|
||||
implementation 'com.google.android.material:material:1.9.0'
|
||||
implementation 'com.jakewharton:disklrucache:2.0.2'
|
||||
implementation "androidx.appcompat:appcompat:$appCompatVersion"
|
||||
implementation 'androidx.webkit:webkit:1.7.0'
|
||||
@@ -317,8 +318,6 @@ dependencies {
|
||||
// dependencies for image cropping and rotation
|
||||
implementation 'com.vanniktech:android-image-cropper:4.5.0'
|
||||
|
||||
implementation 'org.osmdroid:osmdroid-android:6.1.16'
|
||||
|
||||
implementation('org.mnode.ical4j:ical4j:3.0.0') {
|
||||
['org.apache.commons', 'commons-logging'].each {
|
||||
exclude group: "$it"
|
||||
@@ -374,22 +373,22 @@ dependencies {
|
||||
implementation "com.github.stateless4j:stateless4j:2.6.0"
|
||||
|
||||
// upon each update first test: new registration, receive push
|
||||
gplayImplementation "com.google.firebase:firebase-messaging:23.2.1"
|
||||
gplayImplementation "com.google.firebase:firebase-messaging:23.1.2"
|
||||
gplayImplementation 'com.google.android.play:review-ktx:2.0.1'
|
||||
|
||||
implementation 'com.github.nextcloud.android-common:ui:0.13.0'
|
||||
implementation 'com.github.nextcloud.android-common:ui:0.12.0'
|
||||
|
||||
implementation "androidx.room:room-runtime:$roomVersion"
|
||||
ksp "androidx.room:room-compiler:$roomVersion"
|
||||
kapt "androidx.room:room-compiler:$roomVersion"
|
||||
androidTestImplementation "androidx.room:room-testing:$roomVersion"
|
||||
|
||||
implementation "io.coil-kt:coil:2.4.0"
|
||||
|
||||
// splash screen dependency ref: https://developer.android.com/develop/ui/views/launch/splash-screen/migrate
|
||||
//splash screen dependency ref: https://developer.android.com/develop/ui/views/launch/splash-screen/migrate
|
||||
implementation 'androidx.core:core-splashscreen:1.0.1'
|
||||
}
|
||||
|
||||
configurations.configureEach {
|
||||
configurations.all {
|
||||
resolutionStrategy {
|
||||
cacheChangingModulesFor 0, 'seconds'
|
||||
force 'org.objenesis:objenesis:2.6'
|
||||
@@ -401,15 +400,16 @@ configurations.configureEach {
|
||||
}
|
||||
}
|
||||
|
||||
tasks.withType(Test).configureEach {
|
||||
tasks.withType(Test) {
|
||||
// increased logging for tests
|
||||
testLogging {
|
||||
events "passed", "skipped", "failed"
|
||||
}
|
||||
}
|
||||
|
||||
android.applicationVariants.configureEach { variant ->
|
||||
variant.outputs.configureEach { output -> outputFileName = "${output.baseName}-${variant.versionCode}.apk"
|
||||
android.applicationVariants.all { variant ->
|
||||
variant.outputs.all { output ->
|
||||
outputFileName = "${output.baseName}-${variant.versionCode}.apk"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -421,7 +421,12 @@ spotless {
|
||||
}
|
||||
|
||||
detekt {
|
||||
config.setFrom("detekt.yml")
|
||||
reports {
|
||||
xml {
|
||||
enabled = false
|
||||
}
|
||||
}
|
||||
config = files("detekt.yml")
|
||||
}
|
||||
|
||||
shot {
|
||||
@@ -441,13 +446,13 @@ spotbugs {
|
||||
reportLevel = "medium"
|
||||
}
|
||||
|
||||
tasks.withType(SpotBugsTask).configureEach { task ->
|
||||
tasks.withType(SpotBugsTask) { task ->
|
||||
String variantNameCap = task.name.replace("spotbugs", "")
|
||||
String variantName = variantNameCap.substring(0, 1).toLowerCase() + variantNameCap.substring(1)
|
||||
|
||||
dependsOn "compile${variantNameCap}Sources"
|
||||
|
||||
excludeFilter.set(file("${project.rootDir}/spotbugs-filter.xml"))
|
||||
excludeFilter = file("${project.rootDir}/spotbugs-filter.xml")
|
||||
classes = fileTree("$project.buildDir/intermediates/javac/${variantName}/classes/")
|
||||
reports {
|
||||
xml {
|
||||
@@ -460,7 +465,3 @@ tasks.withType(SpotBugsTask).configureEach { task ->
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ksp {
|
||||
arg('room.schemaLocation', "$projectDir/schemas")
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
build:
|
||||
maxIssues: 2
|
||||
maxIssues: 0
|
||||
weights:
|
||||
# complexity: 2
|
||||
# LongParameterList: 1
|
||||
|
||||
|
Before Width: | Height: | Size: 27 KiB After Width: | Height: | Size: 26 KiB |
|
Before Width: | Height: | Size: 28 KiB After Width: | Height: | Size: 27 KiB |
|
Before Width: | Height: | Size: 42 KiB After Width: | Height: | Size: 39 KiB |
|
Before Width: | Height: | Size: 43 KiB After Width: | Height: | Size: 41 KiB |
|
Before Width: | Height: | Size: 41 KiB After Width: | Height: | Size: 39 KiB |
|
Before Width: | Height: | Size: 28 KiB After Width: | Height: | Size: 26 KiB |
|
Before Width: | Height: | Size: 21 KiB After Width: | Height: | Size: 20 KiB |
|
Before Width: | Height: | Size: 21 KiB After Width: | Height: | Size: 20 KiB |
|
Before Width: | Height: | Size: 21 KiB After Width: | Height: | Size: 20 KiB |
|
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 20 KiB |
|
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 18 KiB |
|
Before Width: | Height: | Size: 17 KiB After Width: | Height: | Size: 17 KiB |
|
Before Width: | Height: | Size: 6.1 KiB After Width: | Height: | Size: 5.6 KiB |
|
Before Width: | Height: | Size: 6.9 KiB After Width: | Height: | Size: 6.5 KiB |
|
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 9.7 KiB |
|
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 14 KiB |
|
Before Width: | Height: | Size: 14 KiB |
|
Before Width: | Height: | Size: 7.4 KiB |
|
Before Width: | Height: | Size: 9.0 KiB |
|
Before Width: | Height: | Size: 6.8 KiB |
|
Before Width: | Height: | Size: 8.4 KiB |
|
Before Width: | Height: | Size: 9.2 KiB After Width: | Height: | Size: 8.4 KiB |
|
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 19 KiB |
|
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 1.9 KiB |
|
Before Width: | Height: | Size: 7.6 KiB After Width: | Height: | Size: 6.3 KiB |
|
Before Width: | Height: | Size: 9.3 KiB After Width: | Height: | Size: 8.5 KiB |
|
Before Width: | Height: | Size: 6.1 KiB After Width: | Height: | Size: 5.1 KiB |
|
Before Width: | Height: | Size: 6.4 KiB After Width: | Height: | Size: 5.5 KiB |
|
Before Width: | Height: | Size: 5.7 KiB After Width: | Height: | Size: 4.8 KiB |
|
Before Width: | Height: | Size: 6.4 KiB After Width: | Height: | Size: 5.5 KiB |
|
Before Width: | Height: | Size: 8.4 KiB After Width: | Height: | Size: 7.3 KiB |
|
Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 18 KiB |
|
Before Width: | Height: | Size: 21 KiB After Width: | Height: | Size: 20 KiB |
|
Before Width: | Height: | Size: 21 KiB After Width: | Height: | Size: 20 KiB |
|
Before Width: | Height: | Size: 24 KiB After Width: | Height: | Size: 23 KiB |
|
Before Width: | Height: | Size: 7.7 KiB After Width: | Height: | Size: 6.6 KiB |
|
Before Width: | Height: | Size: 21 KiB After Width: | Height: | Size: 20 KiB |
|
Before Width: | Height: | Size: 6.0 KiB After Width: | Height: | Size: 5.5 KiB |
|
Before Width: | Height: | Size: 21 KiB |
|
Before Width: | Height: | Size: 53 KiB After Width: | Height: | Size: 53 KiB |
|
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 15 KiB |
|
Before Width: | Height: | Size: 21 KiB After Width: | Height: | Size: 12 KiB |
|
Before Width: | Height: | Size: 26 KiB |
@@ -174,7 +174,7 @@ class ActivitiesActivityIT : AbstractIT() {
|
||||
sut.dismissSnackbar()
|
||||
}
|
||||
|
||||
longSleep()
|
||||
shortSleep()
|
||||
waitForIdleSync()
|
||||
|
||||
screenshot(sut)
|
||||
|
||||
@@ -25,7 +25,6 @@ import android.app.Activity
|
||||
import androidx.test.espresso.Espresso
|
||||
import androidx.test.espresso.Espresso.onView
|
||||
import androidx.test.espresso.action.ViewActions.click
|
||||
import androidx.test.espresso.action.ViewActions.closeSoftKeyboard
|
||||
import androidx.test.espresso.assertion.ViewAssertions.matches
|
||||
import androidx.test.espresso.contrib.DrawerActions
|
||||
import androidx.test.espresso.contrib.NavigationViewActions
|
||||
@@ -239,14 +238,12 @@ class FileDisplayActivityIT : AbstractOnServerIT() {
|
||||
onView(withId(R.id.sort_button)).check(matches(withEffectiveVisibility(ViewMatchers.Visibility.GONE)))
|
||||
|
||||
// browse into folder
|
||||
onView(withId(R.id.list_root))
|
||||
.perform(closeSoftKeyboard())
|
||||
.perform(
|
||||
RecyclerViewActions.actionOnItemAtPosition<OCFileListItemViewHolder>(
|
||||
0,
|
||||
click()
|
||||
)
|
||||
onView(withId(R.id.list_root)).perform(
|
||||
RecyclerViewActions.actionOnItemAtPosition<OCFileListItemViewHolder>(
|
||||
0,
|
||||
click()
|
||||
)
|
||||
)
|
||||
shortSleep()
|
||||
checkToolbarTitle(topFolder)
|
||||
// sort button should now be visible
|
||||
|
||||
@@ -25,7 +25,6 @@ package com.nextcloud.client;
|
||||
import android.app.Activity;
|
||||
import android.content.Intent;
|
||||
|
||||
import com.nextcloud.client.preferences.SubFolderRule;
|
||||
import com.owncloud.android.AbstractIT;
|
||||
import com.owncloud.android.datamodel.MediaFolderType;
|
||||
import com.owncloud.android.datamodel.SyncedFolderDisplayItem;
|
||||
@@ -73,8 +72,7 @@ public class SyncedFoldersActivityIT extends AbstractIT {
|
||||
1000,
|
||||
"Name",
|
||||
MediaFolderType.IMAGE,
|
||||
false,
|
||||
SubFolderRule.YEAR_MONTH);
|
||||
false);
|
||||
SyncedFolderPreferencesDialogFragment sut = SyncedFolderPreferencesDialogFragment.newInstance(item, 0);
|
||||
|
||||
Intent intent = new Intent(targetContext, SyncedFoldersActivity.class);
|
||||
|
||||
@@ -23,10 +23,9 @@ package com.nmc.android.ui
|
||||
|
||||
import androidx.test.espresso.Espresso.onView
|
||||
import androidx.test.espresso.assertion.ViewAssertions.matches
|
||||
import androidx.test.espresso.matcher.ViewMatchers
|
||||
import androidx.test.espresso.matcher.ViewMatchers.isCompletelyDisplayed
|
||||
import androidx.test.espresso.matcher.ViewMatchers.withEffectiveVisibility
|
||||
import androidx.test.espresso.matcher.ViewMatchers.withId
|
||||
import androidx.test.espresso.matcher.ViewMatchers.withText
|
||||
import androidx.test.ext.junit.rules.ActivityScenarioRule
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4
|
||||
import com.owncloud.android.AbstractIT
|
||||
@@ -34,7 +33,6 @@ import com.owncloud.android.R
|
||||
import org.junit.Rule
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
import org.mockito.AdditionalMatchers.not
|
||||
|
||||
@RunWith(AndroidJUnit4::class)
|
||||
class LauncherActivityIT : AbstractIT() {
|
||||
@@ -43,26 +41,13 @@ class LauncherActivityIT : AbstractIT() {
|
||||
val activityRule = ActivityScenarioRule(LauncherActivity::class.java)
|
||||
|
||||
@Test
|
||||
fun testSplashScreenWithEmptyTitlesShouldHideTitles() {
|
||||
waitForIdleSync()
|
||||
|
||||
onView(withId(R.id.ivSplash)).check(matches(isCompletelyDisplayed()))
|
||||
|
||||
onView(withId(R.id.splashScreenBold)).check(matches(withEffectiveVisibility(ViewMatchers.Visibility.GONE)))
|
||||
onView(withId(R.id.splashScreenNormal)).check(matches(withEffectiveVisibility(ViewMatchers.Visibility.GONE)))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testSplashScreenWithTitlesShouldShowTitles() {
|
||||
fun verifyUIElements() {
|
||||
waitForIdleSync()
|
||||
onView(withId(R.id.ivSplash)).check(matches(isCompletelyDisplayed()))
|
||||
onView(withId(R.id.splashScreenBold)).check(matches(isCompletelyDisplayed()))
|
||||
onView(withId(R.id.splashScreenNormal)).check(matches(isCompletelyDisplayed()))
|
||||
|
||||
activityRule.scenario.onActivity {
|
||||
it.setSplashTitles("Example", "Cloud")
|
||||
}
|
||||
|
||||
val onePercentArea = ViewMatchers.isDisplayingAtLeast(1)
|
||||
onView(withId(R.id.splashScreenBold)).check(matches(onePercentArea))
|
||||
onView(withId(R.id.splashScreenNormal)).check(matches(onePercentArea))
|
||||
onView(withId(R.id.splashScreenBold)).check(matches(withText("Magenta")))
|
||||
onView(withId(R.id.splashScreenNormal)).check(matches(withText("CLOUD")))
|
||||
}
|
||||
}
|
||||
@@ -7,8 +7,6 @@ import android.accounts.OperationCanceledException;
|
||||
import android.app.Activity;
|
||||
import android.content.ActivityNotFoundException;
|
||||
import android.content.Context;
|
||||
import android.content.res.Configuration;
|
||||
import android.content.res.Resources;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.text.TextUtils;
|
||||
@@ -39,9 +37,7 @@ import com.owncloud.android.lib.common.OwnCloudClientFactory;
|
||||
import com.owncloud.android.lib.common.accounts.AccountUtils;
|
||||
import com.owncloud.android.lib.common.operations.RemoteOperationResult;
|
||||
import com.owncloud.android.lib.resources.status.CapabilityBooleanType;
|
||||
import com.owncloud.android.lib.resources.status.GetCapabilitiesRemoteOperation;
|
||||
import com.owncloud.android.lib.resources.status.OCCapability;
|
||||
import com.owncloud.android.lib.resources.status.OwnCloudVersion;
|
||||
import com.owncloud.android.operations.CreateFolderOperation;
|
||||
import com.owncloud.android.operations.UploadFileOperation;
|
||||
import com.owncloud.android.utils.FileStorageUtils;
|
||||
@@ -59,8 +55,8 @@ import java.io.File;
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.RandomAccessFile;
|
||||
import java.util.Collection;
|
||||
import java.util.Locale;
|
||||
import java.util.Objects;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
@@ -76,7 +72,6 @@ import static androidx.test.espresso.Espresso.onView;
|
||||
import static androidx.test.espresso.matcher.ViewMatchers.withId;
|
||||
import static com.owncloud.android.lib.common.accounts.AccountUtils.Constants.KEY_USER_ID;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.Assume.assumeTrue;
|
||||
|
||||
|
||||
/**
|
||||
@@ -193,16 +188,6 @@ public abstract class AbstractIT {
|
||||
}
|
||||
}
|
||||
|
||||
protected void testOnlyOnServer(OwnCloudVersion version) throws AccountUtils.AccountNotFoundException {
|
||||
NextcloudClient client = OwnCloudClientFactory.createNextcloudClient(user, targetContext);
|
||||
|
||||
OCCapability ocCapability = (OCCapability) new GetCapabilitiesRemoteOperation()
|
||||
.execute(client)
|
||||
.getSingleData();
|
||||
|
||||
assumeTrue(ocCapability.getVersion().isNewerOrEqual(version));
|
||||
}
|
||||
|
||||
@Before
|
||||
public void enableAccessibilityChecks() {
|
||||
androidx.test.espresso.accessibility.AccessibilityChecks.enable().setRunChecksFromRootView(true);
|
||||
@@ -260,12 +245,35 @@ public abstract class AbstractIT {
|
||||
}
|
||||
}
|
||||
|
||||
public static File createFile(String name, int iteration) throws IOException {
|
||||
File file = new File(FileStorageUtils.getTemporalPath(account.name) + File.separator + name);
|
||||
public static File createFile(String name, long size) throws IOException {
|
||||
File file = new File(FileStorageUtils.getInternalTemporalPath(account.name, targetContext) + File.separator + name);
|
||||
if (!file.getParentFile().exists()) {
|
||||
assertTrue(file.getParentFile().mkdirs());
|
||||
}
|
||||
|
||||
if (file.exists()) {
|
||||
file.delete();
|
||||
}
|
||||
|
||||
file.createNewFile();
|
||||
|
||||
RandomAccessFile randomAccessFile = new RandomAccessFile(file, "rw");
|
||||
randomAccessFile.setLength(size);
|
||||
randomAccessFile.close();
|
||||
|
||||
return file;
|
||||
}
|
||||
|
||||
public static File createFile(String name, int iteration) throws IOException {
|
||||
File file = new File(FileStorageUtils.getInternalTemporalPath(account.name, targetContext) + File.separator + name);
|
||||
if (!file.getParentFile().exists()) {
|
||||
assertTrue(file.getParentFile().mkdirs());
|
||||
}
|
||||
|
||||
if (file.exists()) {
|
||||
file.delete();
|
||||
}
|
||||
|
||||
file.createNewFile();
|
||||
|
||||
FileWriter writer = new FileWriter(file);
|
||||
@@ -317,7 +325,7 @@ public abstract class AbstractIT {
|
||||
return currentActivity;
|
||||
}
|
||||
|
||||
protected static void shortSleep() {
|
||||
protected void shortSleep() {
|
||||
try {
|
||||
Thread.sleep(2000);
|
||||
} catch (InterruptedException e) {
|
||||
@@ -406,22 +414,6 @@ public abstract class AbstractIT {
|
||||
assertTrue(result.getLogMessage(), result.isSuccess());
|
||||
}
|
||||
|
||||
protected void enableRTL() {
|
||||
Locale locale = new Locale("ar");
|
||||
Resources resources = InstrumentationRegistry.getInstrumentation().getTargetContext().getResources();
|
||||
Configuration config = resources.getConfiguration();
|
||||
config.setLocale(locale);
|
||||
resources.updateConfiguration(config, null);
|
||||
}
|
||||
|
||||
protected void resetLocale() {
|
||||
Locale locale = new Locale("en");
|
||||
Resources resources = InstrumentationRegistry.getInstrumentation().getTargetContext().getResources();
|
||||
Configuration config = resources.getConfiguration();
|
||||
config.setLocale(locale);
|
||||
resources.updateConfiguration(config, null);
|
||||
}
|
||||
|
||||
protected void screenshot(View view) {
|
||||
screenshot(view, "");
|
||||
}
|
||||
|
||||
@@ -128,31 +128,17 @@ public abstract class AbstractOnServerIT extends AbstractIT {
|
||||
|
||||
if (!remoteFile.getRemotePath().equals("/")) {
|
||||
if (remoteFile.isEncrypted()) {
|
||||
ToggleEncryptionRemoteOperation operation = new ToggleEncryptionRemoteOperation(remoteFile.getLocalId(),
|
||||
remoteFile.getRemotePath(),
|
||||
false);
|
||||
|
||||
boolean operationResult = operation
|
||||
.execute(client)
|
||||
.isSuccess();
|
||||
|
||||
assertTrue(operationResult);
|
||||
assertTrue(new ToggleEncryptionRemoteOperation(remoteFile.getLocalId(),
|
||||
remoteFile.getRemotePath(),
|
||||
false)
|
||||
.execute(client)
|
||||
.isSuccess());
|
||||
}
|
||||
|
||||
boolean removeResult = false;
|
||||
for (int i = 0; i < 5; i++) {
|
||||
removeResult = new RemoveFileRemoteOperation(remoteFile.getRemotePath())
|
||||
.execute(client)
|
||||
.isSuccess();
|
||||
|
||||
if (removeResult) {
|
||||
break;
|
||||
}
|
||||
|
||||
shortSleep();
|
||||
}
|
||||
|
||||
assertTrue(removeResult);
|
||||
assertTrue(new RemoveFileRemoteOperation(remoteFile.getRemotePath())
|
||||
.execute(client)
|
||||
.isSuccess()
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,16 +31,13 @@ import com.owncloud.android.datamodel.UploadsStorageManager;
|
||||
import com.owncloud.android.db.OCUpload;
|
||||
import com.owncloud.android.files.services.FileUploader;
|
||||
import com.owncloud.android.files.services.NameCollisionPolicy;
|
||||
import com.owncloud.android.lib.common.accounts.AccountUtils;
|
||||
import com.owncloud.android.lib.common.operations.RemoteOperationResult;
|
||||
import com.owncloud.android.lib.resources.files.model.GeoLocation;
|
||||
import com.owncloud.android.lib.resources.files.model.ImageDimension;
|
||||
import com.owncloud.android.lib.resources.status.NextcloudVersion;
|
||||
import com.owncloud.android.operations.RefreshFolderOperation;
|
||||
import com.owncloud.android.operations.RemoveFileOperation;
|
||||
import com.owncloud.android.operations.UploadFileOperation;
|
||||
import com.owncloud.android.utils.FileStorageUtils;
|
||||
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
@@ -55,7 +52,6 @@ import androidx.annotation.NonNull;
|
||||
|
||||
import static junit.framework.TestCase.assertEquals;
|
||||
import static junit.framework.TestCase.assertFalse;
|
||||
import static junit.framework.TestCase.assertNotNull;
|
||||
import static junit.framework.TestCase.assertTrue;
|
||||
|
||||
/**
|
||||
@@ -105,6 +101,29 @@ public class UploadIT extends AbstractOnServerIT {
|
||||
createDummyFiles();
|
||||
}
|
||||
|
||||
@After
|
||||
public void after() {
|
||||
RemoteOperationResult result = new RefreshFolderOperation(getStorageManager().getFileByPath("/"),
|
||||
System.currentTimeMillis() / 1000L,
|
||||
false,
|
||||
true,
|
||||
getStorageManager(),
|
||||
user,
|
||||
targetContext)
|
||||
.execute(client);
|
||||
|
||||
// cleanup only if folder exists
|
||||
if (result.isSuccess() && getStorageManager().getFileByDecryptedRemotePath(FOLDER) != null) {
|
||||
new RemoveFileOperation(getStorageManager().getFileByDecryptedRemotePath(FOLDER),
|
||||
false,
|
||||
user,
|
||||
false,
|
||||
targetContext,
|
||||
getStorageManager())
|
||||
.execute(client);
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testEmptyUpload() {
|
||||
OCUpload ocUpload = new OCUpload(FileStorageUtils.getTemporalPath(account.name) + "/empty.txt",
|
||||
@@ -402,9 +421,7 @@ public class UploadIT extends AbstractOnServerIT {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCreationAndUploadTimestamp() throws IOException, AccountUtils.AccountNotFoundException {
|
||||
testOnlyOnServer(NextcloudVersion.nextcloud_27);
|
||||
|
||||
public void testCreationAndUploadTimestamp() throws IOException {
|
||||
File file = getDummyFile("empty.txt");
|
||||
String remotePath = "/testFile.txt";
|
||||
OCUpload ocUpload = new OCUpload(file.getAbsolutePath(), remotePath, account.name);
|
||||
@@ -452,61 +469,7 @@ public class UploadIT extends AbstractOnServerIT {
|
||||
assertEquals(remotePath, ocFile.getRemotePath());
|
||||
assertEquals(creationTimestamp, ocFile.getCreationTimestamp());
|
||||
assertTrue(uploadTimestamp - 10 < ocFile.getUploadTimestamp() ||
|
||||
uploadTimestamp + 10 > ocFile.getUploadTimestamp());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testMetadata() throws IOException, AccountUtils.AccountNotFoundException {
|
||||
testOnlyOnServer(NextcloudVersion.nextcloud_27);
|
||||
|
||||
File file = getFile("gps.jpg");
|
||||
String remotePath = "/metadata.jpg";
|
||||
OCUpload ocUpload = new OCUpload(file.getAbsolutePath(), remotePath, account.name);
|
||||
|
||||
assertTrue(
|
||||
new UploadFileOperation(
|
||||
uploadsStorageManager,
|
||||
connectivityServiceMock,
|
||||
powerManagementServiceMock,
|
||||
user,
|
||||
null,
|
||||
ocUpload,
|
||||
NameCollisionPolicy.DEFAULT,
|
||||
FileUploader.LOCAL_BEHAVIOUR_COPY,
|
||||
targetContext,
|
||||
false,
|
||||
false,
|
||||
getStorageManager()
|
||||
)
|
||||
.setRemoteFolderToBeCreated()
|
||||
.execute(client)
|
||||
.isSuccess()
|
||||
);
|
||||
|
||||
// RefreshFolderOperation
|
||||
assertTrue(new RefreshFolderOperation(getStorageManager().getFileByDecryptedRemotePath("/"),
|
||||
System.currentTimeMillis() / 1000,
|
||||
false,
|
||||
false,
|
||||
getStorageManager(),
|
||||
user,
|
||||
targetContext).execute(client).isSuccess());
|
||||
|
||||
List<OCFile> files = getStorageManager().getFolderContent(getStorageManager().getFileByDecryptedRemotePath("/"),
|
||||
false);
|
||||
|
||||
OCFile ocFile = null;
|
||||
for (OCFile f : files) {
|
||||
if (f.getFileName().equals("metadata.jpg")) {
|
||||
ocFile = f;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
assertNotNull(ocFile);
|
||||
assertEquals(remotePath, ocFile.getRemotePath());
|
||||
assertEquals(new GeoLocation(64, -46), ocFile.getGeoLocation());
|
||||
assertEquals(new ImageDimension(300f, 200f), ocFile.getImageDimension());
|
||||
uploadTimestamp + 10 > ocFile.getUploadTimestamp());
|
||||
}
|
||||
|
||||
private void verifyStoragePath(OCFile file) {
|
||||
|
||||
@@ -37,7 +37,6 @@ class OCCapabilityIT : AbstractIT() {
|
||||
capability.etag = "123"
|
||||
capability.userStatus = CapabilityBooleanType.TRUE
|
||||
capability.userStatusSupportsEmoji = CapabilityBooleanType.TRUE
|
||||
capability.dropAccount = CapabilityBooleanType.TRUE
|
||||
|
||||
fileDataStorageManager.saveCapabilities(capability)
|
||||
|
||||
@@ -46,6 +45,5 @@ class OCCapabilityIT : AbstractIT() {
|
||||
assertEquals(capability.etag, newCapability.etag)
|
||||
assertEquals(capability.userStatus, newCapability.userStatus)
|
||||
assertEquals(capability.userStatusSupportsEmoji, newCapability.userStatusSupportsEmoji)
|
||||
assertEquals(capability.dropAccount, newCapability.dropAccount)
|
||||
}
|
||||
}
|
||||
@@ -1,105 +0,0 @@
|
||||
/*
|
||||
* Nextcloud Android client application
|
||||
*
|
||||
* @author Alper Ozturk
|
||||
* Copyright (C) 2023 Alper Ozturk
|
||||
* Copyright (C) 2023 Nextcloud GmbH
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.owncloud.android.datamodel
|
||||
|
||||
import com.owncloud.android.R
|
||||
import com.owncloud.android.lib.common.network.WebdavEntry.MountType
|
||||
import org.junit.After
|
||||
import org.junit.Before
|
||||
import org.junit.Test
|
||||
|
||||
class OCFileIconTests {
|
||||
|
||||
private val path = "/path/to/a/file.txt"
|
||||
private var sut: OCFile? = null
|
||||
|
||||
@Before
|
||||
fun setup() {
|
||||
sut = OCFile(path)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testGetFileOverlayIconWhenFileIsAutoUploadFolderShouldReturnFolderOverlayUploadIcon() {
|
||||
val fileOverlayIcon = sut?.getFileOverlayIconId(true)
|
||||
val expectedDrawable = R.drawable.ic_folder_overlay_upload
|
||||
assert(fileOverlayIcon == expectedDrawable)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testGetFileOverlayIconWhenFileIsEncryptedShouldReturnFolderOverlayKeyIcon() {
|
||||
sut?.isEncrypted = true
|
||||
val fileOverlayIcon = sut?.getFileOverlayIconId(false)
|
||||
val expectedDrawable = R.drawable.ic_folder_overlay_key
|
||||
assert(fileOverlayIcon == expectedDrawable)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testGetFileOverlayIconWhenFileIsGroupFolderShouldReturnFolderOverlayAccountGroupIcon() {
|
||||
sut?.mountType = MountType.GROUP
|
||||
val fileOverlayIcon = sut?.getFileOverlayIconId(false)
|
||||
val expectedDrawable = R.drawable.ic_folder_overlay_account_group
|
||||
assert(fileOverlayIcon == expectedDrawable)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testGetFileOverlayIconWhenFileIsSharedViaLinkShouldReturnFolderOverlayLinkIcon() {
|
||||
sut?.isSharedViaLink = true
|
||||
val fileOverlayIcon = sut?.getFileOverlayIconId(false)
|
||||
val expectedDrawable = R.drawable.ic_folder_overlay_link
|
||||
assert(fileOverlayIcon == expectedDrawable)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testGetFileOverlayIconWhenFileIsSharedShouldReturnFolderOverlayShareIcon() {
|
||||
sut?.isSharedWithSharee = true
|
||||
val fileOverlayIcon = sut?.getFileOverlayIconId(false)
|
||||
val expectedDrawable = R.drawable.ic_folder_overlay_share
|
||||
assert(fileOverlayIcon == expectedDrawable)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testGetFileOverlayIconWhenFileIsExternalShouldReturnFolderOverlayExternalIcon() {
|
||||
sut?.mountType = MountType.EXTERNAL
|
||||
val fileOverlayIcon = sut?.getFileOverlayIconId(false)
|
||||
val expectedDrawable = R.drawable.ic_folder_overlay_external
|
||||
assert(fileOverlayIcon == expectedDrawable)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testGetFileOverlayIconWhenFileIsLockedShouldReturnFolderOverlayLockIcon() {
|
||||
sut?.isLocked = true
|
||||
val fileOverlayIcon = sut?.getFileOverlayIconId(false)
|
||||
val expectedDrawable = R.drawable.ic_folder_overlay_lock
|
||||
assert(fileOverlayIcon == expectedDrawable)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testGetFileOverlayIconWhenFileIsFolderShouldReturnNull() {
|
||||
val fileOverlayIcon = sut?.getFileOverlayIconId(false)
|
||||
assert(fileOverlayIcon == null)
|
||||
}
|
||||
|
||||
@After
|
||||
fun destroy() {
|
||||
sut = null
|
||||
}
|
||||
}
|
||||
@@ -70,6 +70,7 @@ public class OCFileUnitTest {
|
||||
mFile = new OCFile(PATH);
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void writeThenReadAsParcelable() {
|
||||
|
||||
|
||||
@@ -20,7 +20,6 @@
|
||||
*/
|
||||
package com.owncloud.android.ui
|
||||
|
||||
import android.os.Build
|
||||
import androidx.test.core.app.ActivityScenario
|
||||
import androidx.test.espresso.Espresso
|
||||
import androidx.test.espresso.action.ViewActions
|
||||
@@ -29,7 +28,6 @@ import androidx.test.espresso.web.sugar.Web
|
||||
import androidx.test.espresso.web.webdriver.DriverAtoms
|
||||
import androidx.test.espresso.web.webdriver.Locator
|
||||
import androidx.test.filters.LargeTest
|
||||
import androidx.test.filters.SdkSuppress
|
||||
import androidx.test.platform.app.InstrumentationRegistry
|
||||
import com.nextcloud.client.account.UserAccountManager
|
||||
import com.nextcloud.client.account.UserAccountManagerImpl
|
||||
@@ -61,12 +59,6 @@ class LoginIT : AbstractIT() {
|
||||
@Test
|
||||
@Throws(InterruptedException::class)
|
||||
@Suppress("MagicNumber", "SwallowedException")
|
||||
|
||||
/**
|
||||
* The CI/CD pipeline is encountering issues related to the Android version for this functionality.
|
||||
* Therefore the test will only be executed on Android versions 10 and above.
|
||||
*/
|
||||
@SdkSuppress(minSdkVersion = Build.VERSION_CODES.Q)
|
||||
fun login() {
|
||||
val arguments = InstrumentationRegistry.getArguments()
|
||||
val baseUrl = arguments.getString("TEST_SERVER_URL")!!
|
||||
|
||||
@@ -130,7 +130,7 @@ public class FolderPickerActivityIT extends AbstractIT {
|
||||
sut.setFile(origin);
|
||||
|
||||
sut.runOnUiThread(() -> {
|
||||
sut.findViewById(R.id.folder_picker_btn_copy).requestFocus();
|
||||
sut.findViewById(R.id.folder_picker_btn_choose).requestFocus();
|
||||
});
|
||||
waitForIdleSync();
|
||||
screenshot(sut);
|
||||
|
||||
@@ -92,7 +92,6 @@ import androidx.activity.result.contract.ActivityResultContract;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.fragment.app.DialogFragment;
|
||||
import androidx.test.espresso.intent.rule.IntentsTestRule;
|
||||
import androidx.test.rule.GrantPermissionRule;
|
||||
import kotlin.Unit;
|
||||
|
||||
import static androidx.test.platform.app.InstrumentationRegistry.getInstrumentation;
|
||||
@@ -108,7 +107,7 @@ public class DialogFragmentIT extends AbstractIT {
|
||||
Intent intent = new Intent(targetContext, FileDisplayActivity.class);
|
||||
return activityRule.launchActivity(intent);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@After
|
||||
public void quitLooperIfNeeded() {
|
||||
@@ -135,38 +134,6 @@ public class DialogFragmentIT extends AbstractIT {
|
||||
showDialog(dialog);
|
||||
}
|
||||
|
||||
@Test
|
||||
@ScreenshotTest
|
||||
public void testConfirmationDialogWithOneAction() {
|
||||
ConfirmationDialogFragment dialog = ConfirmationDialogFragment.newInstance(R.string.upload_list_empty_text_auto_upload, new String[]{}, R.string.filedetails_sync_file, R.string.common_ok, -1, -1);
|
||||
showDialog(dialog);
|
||||
}
|
||||
|
||||
@Test
|
||||
@ScreenshotTest
|
||||
public void testConfirmationDialogWithTwoAction() {
|
||||
ConfirmationDialogFragment dialog = ConfirmationDialogFragment.newInstance(R.string.upload_list_empty_text_auto_upload, new String[]{}, R.string.filedetails_sync_file, R.string.common_ok, R.string.common_cancel, -1);
|
||||
showDialog(dialog);
|
||||
}
|
||||
|
||||
@Test
|
||||
@ScreenshotTest
|
||||
public void testConfirmationDialogWithThreeAction() {
|
||||
ConfirmationDialogFragment dialog = ConfirmationDialogFragment.newInstance(R.string.upload_list_empty_text_auto_upload, new String[]{}, R.string.filedetails_sync_file, R.string.common_ok, R.string.common_cancel, R.string.common_confirm);
|
||||
showDialog(dialog);
|
||||
}
|
||||
|
||||
@Test
|
||||
@ScreenshotTest
|
||||
public void testConfirmationDialogWithThreeActionRTL() {
|
||||
enableRTL();
|
||||
|
||||
ConfirmationDialogFragment dialog = ConfirmationDialogFragment.newInstance(R.string.upload_list_empty_text_auto_upload, new String[] { }, -1, R.string.common_ok, R.string.common_cancel, R.string.common_confirm);
|
||||
showDialog(dialog);
|
||||
|
||||
resetLocale();
|
||||
}
|
||||
|
||||
@Test
|
||||
@ScreenshotTest
|
||||
public void testRemoveFileDialog() {
|
||||
@@ -572,9 +539,9 @@ public class DialogFragmentIT extends AbstractIT {
|
||||
|
||||
final SslCertificate certificate = new SslCertificate("foo", "bar", "2022/01/10", "2022/01/30");
|
||||
final SslError sslError = new SslError(SslError.SSL_UNTRUSTED, certificate);
|
||||
|
||||
final SslErrorHandler handler = Mockito.mock(SslErrorHandler.class);
|
||||
|
||||
|
||||
SslUntrustedCertDialog sut = SslUntrustedCertDialog.newInstanceForEmptySslError(sslError, handler);
|
||||
showDialog(sut);
|
||||
}
|
||||
|
||||
@@ -45,7 +45,6 @@ public class SyncFileNotEnoughSpaceDialogFragmentTest extends AbstractIT {
|
||||
FileDisplayActivity test = activityRule.launchActivity(null);
|
||||
OCFile ocFile = new OCFile("/Document/");
|
||||
ocFile.setFileLength(5000000);
|
||||
ocFile.setFolder();
|
||||
|
||||
SyncFileNotEnoughSpaceDialogFragment dialog = SyncFileNotEnoughSpaceDialogFragment.newInstance(ocFile, 1000);
|
||||
dialog.show(test.getListOfFilesFragment().getFragmentManager(), "1");
|
||||
|
||||
@@ -24,7 +24,6 @@ package com.owncloud.android.ui.fragment
|
||||
|
||||
import androidx.test.espresso.intent.rule.IntentsTestRule
|
||||
import com.nextcloud.test.TestActivity
|
||||
import com.nextcloud.ui.ImageDetailFragment
|
||||
import com.owncloud.android.AbstractIT
|
||||
import com.owncloud.android.R
|
||||
import com.owncloud.android.datamodel.OCFile
|
||||
@@ -41,16 +40,13 @@ class FileDetailFragmentStaticServerIT : AbstractIT() {
|
||||
@get:Rule
|
||||
val testActivityRule = IntentsTestRule(TestActivity::class.java, true, false)
|
||||
|
||||
var file = getFile("gps.jpg")
|
||||
val oCFile = OCFile("/").apply {
|
||||
storagePath = file.absolutePath
|
||||
}
|
||||
val file = OCFile("/")
|
||||
|
||||
@Test
|
||||
@ScreenshotTest
|
||||
fun showFileDetailActivitiesFragment() {
|
||||
val sut = testActivityRule.launchActivity(null)
|
||||
sut.addFragment(FileDetailActivitiesFragment.newInstance(oCFile, user))
|
||||
sut.addFragment(FileDetailActivitiesFragment.newInstance(file, user))
|
||||
|
||||
waitForIdleSync()
|
||||
shortSleep()
|
||||
@@ -62,7 +58,7 @@ class FileDetailFragmentStaticServerIT : AbstractIT() {
|
||||
@ScreenshotTest
|
||||
fun showFileDetailSharingFragment() {
|
||||
val sut = testActivityRule.launchActivity(null)
|
||||
sut.addFragment(FileDetailSharingFragment.newInstance(oCFile, user))
|
||||
sut.addFragment(FileDetailSharingFragment.newInstance(file, user))
|
||||
|
||||
waitForIdleSync()
|
||||
shortSleep()
|
||||
@@ -70,30 +66,12 @@ class FileDetailFragmentStaticServerIT : AbstractIT() {
|
||||
screenshot(sut)
|
||||
}
|
||||
|
||||
@Test
|
||||
@ScreenshotTest
|
||||
fun showFileDetailDetailsFragment() {
|
||||
val activity = testActivityRule.launchActivity(null)
|
||||
val sut = ImageDetailFragment.newInstance(oCFile, user)
|
||||
activity.addFragment(sut)
|
||||
|
||||
shortSleep()
|
||||
shortSleep()
|
||||
waitForIdleSync()
|
||||
|
||||
activity.runOnUiThread {
|
||||
sut.hideMap()
|
||||
}
|
||||
|
||||
screenshot(activity)
|
||||
}
|
||||
|
||||
@Test
|
||||
@ScreenshotTest
|
||||
@Suppress("MagicNumber")
|
||||
fun showDetailsActivities() {
|
||||
val activity = testActivityRule.launchActivity(null)
|
||||
val sut = FileDetailFragment.newInstance(oCFile, user, 0)
|
||||
val sut = FileDetailFragment.newInstance(file, user, 0)
|
||||
activity.addFragment(sut)
|
||||
|
||||
waitForIdleSync()
|
||||
@@ -163,7 +141,7 @@ class FileDetailFragmentStaticServerIT : AbstractIT() {
|
||||
// @ScreenshotTest
|
||||
fun showDetailsActivitiesNone() {
|
||||
val activity = testActivityRule.launchActivity(null)
|
||||
val sut = FileDetailFragment.newInstance(oCFile, user, 0)
|
||||
val sut = FileDetailFragment.newInstance(file, user, 0)
|
||||
activity.addFragment(sut)
|
||||
|
||||
waitForIdleSync()
|
||||
@@ -181,13 +159,12 @@ class FileDetailFragmentStaticServerIT : AbstractIT() {
|
||||
@ScreenshotTest
|
||||
fun showDetailsActivitiesError() {
|
||||
val activity = testActivityRule.launchActivity(null)
|
||||
val sut = FileDetailFragment.newInstance(oCFile, user, 0)
|
||||
val sut = FileDetailFragment.newInstance(file, user, 0)
|
||||
activity.addFragment(sut)
|
||||
|
||||
waitForIdleSync()
|
||||
|
||||
activity.runOnUiThread {
|
||||
sut.fileDetailActivitiesFragment.disableLoadingActivities()
|
||||
sut
|
||||
.fileDetailActivitiesFragment
|
||||
.setErrorContent(targetContext.resources.getString(R.string.file_detail_activity_error))
|
||||
@@ -202,7 +179,7 @@ class FileDetailFragmentStaticServerIT : AbstractIT() {
|
||||
@ScreenshotTest
|
||||
fun showDetailsSharing() {
|
||||
val sut = testActivityRule.launchActivity(null)
|
||||
sut.addFragment(FileDetailFragment.newInstance(oCFile, user, 1))
|
||||
sut.addFragment(FileDetailFragment.newInstance(file, user, 1))
|
||||
|
||||
waitForIdleSync()
|
||||
|
||||
|
||||
@@ -29,12 +29,12 @@ import android.graphics.Paint
|
||||
import androidx.test.espresso.intent.rule.IntentsTestRule
|
||||
import com.nextcloud.test.TestActivity
|
||||
import com.owncloud.android.AbstractIT
|
||||
import com.owncloud.android.datamodel.ImageDimension
|
||||
import com.owncloud.android.datamodel.OCFile
|
||||
import com.owncloud.android.datamodel.ThumbnailsCacheManager
|
||||
import com.owncloud.android.datamodel.ThumbnailsCacheManager.InitDiskCacheTask
|
||||
import com.owncloud.android.datamodel.ThumbnailsCacheManager.PREFIX_RESIZED_IMAGE
|
||||
import com.owncloud.android.lib.common.utils.Log_OC
|
||||
import com.owncloud.android.lib.resources.files.model.ImageDimension
|
||||
import com.owncloud.android.utils.ScreenshotTest
|
||||
import org.junit.After
|
||||
import org.junit.Assert.assertNotNull
|
||||
|
||||
@@ -242,22 +242,6 @@ class OCFileListFragmentStaticServerIT : AbstractIT() {
|
||||
sut.storageManager.saveFile(this)
|
||||
}
|
||||
|
||||
OCFile("/sharedViaLink/").apply {
|
||||
mimeType = MimeType.DIRECTORY
|
||||
isSharedViaLink = true
|
||||
modificationTimestamp = 1619003571000
|
||||
parentId = sut.storageManager.getFileByEncryptedRemotePath("/").fileId
|
||||
sut.storageManager.saveFile(this)
|
||||
}
|
||||
|
||||
OCFile("/share/").apply {
|
||||
mimeType = MimeType.DIRECTORY
|
||||
isSharedWithSharee = true
|
||||
modificationTimestamp = 1619303571000
|
||||
parentId = sut.storageManager.getFileByEncryptedRemotePath("/").fileId
|
||||
sut.storageManager.saveFile(this)
|
||||
}
|
||||
|
||||
OCFile("/groupFolder/").apply {
|
||||
mimeType = MimeType.DIRECTORY
|
||||
modificationTimestamp = 1615003571000
|
||||
@@ -275,15 +259,6 @@ class OCFileListFragmentStaticServerIT : AbstractIT() {
|
||||
sut.storageManager.saveFile(this)
|
||||
}
|
||||
|
||||
OCFile("/locked/").apply {
|
||||
mimeType = MimeType.DIRECTORY
|
||||
isLocked = true
|
||||
decryptedRemotePath = "/locked/"
|
||||
modificationTimestamp = 1613003571000
|
||||
parentId = sut.storageManager.getFileByEncryptedRemotePath("/").fileId
|
||||
sut.storageManager.saveFile(this)
|
||||
}
|
||||
|
||||
sut.addFragment(fragment)
|
||||
|
||||
shortSleep()
|
||||
|
||||
@@ -26,7 +26,7 @@ import com.owncloud.android.R
|
||||
import com.owncloud.android.lib.resources.trashbin.model.TrashbinFile
|
||||
import com.owncloud.android.ui.trashbin.TrashbinRepository.LoadFolderCallback
|
||||
|
||||
class TrashbinLocalRepository(private val testCase: TrashbinActivityIT.TestCase) : TrashbinRepository {
|
||||
class TrashbinLocalRepository(val testCase: TrashbinActivityIT.TestCase) : TrashbinRepository {
|
||||
override fun emptyTrashbin(callback: TrashbinRepository.OperationCallback?) {
|
||||
TODO("Not yet implemented")
|
||||
}
|
||||
|
||||
@@ -35,6 +35,7 @@ import com.owncloud.android.datamodel.DecryptedFolderMetadata;
|
||||
import com.owncloud.android.datamodel.EncryptedFolderMetadata;
|
||||
import com.owncloud.android.lib.common.utils.Log_OC;
|
||||
import com.owncloud.android.utils.CsrHelper;
|
||||
import com.owncloud.android.utils.DisplayUtils;
|
||||
import com.owncloud.android.utils.EncryptionUtils;
|
||||
|
||||
import org.apache.commons.codec.binary.Hex;
|
||||
@@ -44,7 +45,6 @@ import org.junit.runner.RunWith;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.math.BigInteger;
|
||||
import java.security.KeyPair;
|
||||
@@ -65,7 +65,6 @@ import javax.crypto.BadPaddingException;
|
||||
|
||||
import androidx.test.runner.AndroidJUnit4;
|
||||
|
||||
import static com.owncloud.android.utils.EncryptionUtils.EncryptedFile;
|
||||
import static com.owncloud.android.utils.EncryptionUtils.decodeStringToBase64Bytes;
|
||||
import static com.owncloud.android.utils.EncryptionUtils.decryptFile;
|
||||
import static com.owncloud.android.utils.EncryptionUtils.decryptFolderMetaData;
|
||||
@@ -91,6 +90,7 @@ import static junit.framework.Assert.assertFalse;
|
||||
import static junit.framework.Assert.assertTrue;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertNull;
|
||||
|
||||
@RunWith(AndroidJUnit4.class)
|
||||
@@ -401,6 +401,19 @@ public class EncryptionTestIT extends AbstractIT {
|
||||
assertTrue(cryptFile("ia7OEEEyXMoRa1QWQk8r", "78f42172166f9dc8fd1a7156b1753353", key, iv, authTag));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testLargeFile() throws Exception {
|
||||
byte[] key = decodeStringToBase64Bytes("WANM0gRv+DhaexIsI0T3Lg==");
|
||||
byte[] iv = decodeStringToBase64Bytes("gKm3n+mJzeY26q4OfuZEqg==");
|
||||
|
||||
createFile("large1", 500 * 1024 * 1024L);
|
||||
File file = getDummyFile("large1");
|
||||
String md5 = getMD5Sum(file);
|
||||
Log_OC.d("Large file", "Size: " + DisplayUtils.bytesToHumanReadable(file.length()));
|
||||
|
||||
assertTrue(cryptFile(file, md5, key, iv, null));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void cryptFileWithMetadata() throws Exception {
|
||||
DecryptedFolderMetadata metadata = generateFolderMetadata();
|
||||
@@ -751,28 +764,34 @@ public class EncryptionTestIT extends AbstractIT {
|
||||
private boolean cryptFile(String fileName, String md5, byte[] key, byte[] iv, byte[] expectedAuthTag)
|
||||
throws Exception {
|
||||
File file = getFile(fileName);
|
||||
|
||||
return cryptFile(file, md5, key, iv, expectedAuthTag);
|
||||
}
|
||||
|
||||
private boolean cryptFile(File file, String md5, byte[] key, byte[] iv, byte[] expectedAuthTag)
|
||||
throws Exception {
|
||||
assertEquals(md5, getMD5Sum(file));
|
||||
|
||||
EncryptedFile encryptedFile = encryptFile(file, key, iv);
|
||||
File encryptedLargeTempFile = File.createTempFile("largeEncrypted", "tmp");
|
||||
byte[] authenticationTag = encryptFile(file, encryptedLargeTempFile, key, iv);
|
||||
|
||||
File encryptedTempFile = File.createTempFile("file", "tmp");
|
||||
FileOutputStream fileOutputStream = new FileOutputStream(encryptedTempFile);
|
||||
fileOutputStream.write(encryptedFile.encryptedBytes);
|
||||
fileOutputStream.close();
|
||||
|
||||
byte[] authenticationTag = decodeStringToBase64Bytes(encryptedFile.authenticationTag);
|
||||
assertNotNull(authenticationTag);
|
||||
|
||||
// verify authentication tag
|
||||
assertTrue(Arrays.equals(expectedAuthTag, authenticationTag));
|
||||
if (expectedAuthTag != null) {
|
||||
assertEquals(expectedAuthTag, authenticationTag);
|
||||
}
|
||||
|
||||
byte[] decryptedBytes = decryptFile(encryptedTempFile, key, iv, authenticationTag);
|
||||
File decryptedLargeTempFile = File.createTempFile("largeDecrypted", "tmp");
|
||||
assertTrue(decryptFile(encryptedLargeTempFile,
|
||||
decryptedLargeTempFile,
|
||||
key,
|
||||
iv,
|
||||
authenticationTag
|
||||
)
|
||||
);
|
||||
|
||||
File decryptedFile = File.createTempFile("file", "dec");
|
||||
FileOutputStream fileOutputStream1 = new FileOutputStream(decryptedFile);
|
||||
fileOutputStream1.write(decryptedBytes);
|
||||
fileOutputStream1.close();
|
||||
|
||||
return md5.compareTo(getMD5Sum(decryptedFile)) == 0;
|
||||
return md5.compareTo(getMD5Sum(decryptedLargeTempFile)) == 0;
|
||||
}
|
||||
|
||||
private String getMD5Sum(File file) {
|
||||
|
||||
@@ -1,63 +0,0 @@
|
||||
/*
|
||||
* Nextcloud Android client application
|
||||
*
|
||||
* @author Alper Ozturk
|
||||
* Copyright (C) 2023 Alper Ozturk
|
||||
* Copyright (C) 2023 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.utils
|
||||
|
||||
import android.content.Context
|
||||
import android.graphics.Bitmap
|
||||
import android.graphics.drawable.BitmapDrawable
|
||||
import androidx.test.platform.app.InstrumentationRegistry
|
||||
import org.junit.After
|
||||
import org.junit.Assert.fail
|
||||
import org.junit.Before
|
||||
import org.junit.Test
|
||||
|
||||
class DrawableUtilTests {
|
||||
|
||||
private var sut: DrawableUtil? = null
|
||||
private var context: Context? = null
|
||||
|
||||
@Before
|
||||
fun setUp() {
|
||||
sut = DrawableUtil()
|
||||
context = InstrumentationRegistry.getInstrumentation().context
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testAddDrawableAsOverlayWhenGivenValidDrawablesShouldContainTwoDrawable() {
|
||||
val bitmap: Bitmap = Bitmap.createBitmap(2, 2, Bitmap.Config.ARGB_8888)
|
||||
val drawable = BitmapDrawable(context?.resources, bitmap)
|
||||
|
||||
val layerDrawable = sut?.addDrawableAsOverlay(drawable, drawable)
|
||||
|
||||
if (layerDrawable == null) {
|
||||
fail("Layer drawable expected to be not null")
|
||||
}
|
||||
|
||||
assert(layerDrawable?.numberOfLayers == 2)
|
||||
}
|
||||
|
||||
@After
|
||||
fun destroy() {
|
||||
sut = null
|
||||
context = null
|
||||
}
|
||||
}
|
||||
@@ -20,7 +20,6 @@
|
||||
|
||||
package com.owncloud.android.utils
|
||||
|
||||
import com.nextcloud.client.preferences.SubFolderRule
|
||||
import com.owncloud.android.AbstractIT
|
||||
import com.owncloud.android.datamodel.MediaFolder
|
||||
import com.owncloud.android.datamodel.MediaFolderType
|
||||
@@ -186,8 +185,7 @@ class SyncedFolderUtilsTest : AbstractIT() {
|
||||
true,
|
||||
0L,
|
||||
MediaFolderType.IMAGE,
|
||||
false,
|
||||
SubFolderRule.YEAR_MONTH
|
||||
false
|
||||
)
|
||||
Assert.assertFalse(SyncedFolderUtils.isQualifyingMediaFolder(folder))
|
||||
}
|
||||
@@ -209,8 +207,7 @@ class SyncedFolderUtilsTest : AbstractIT() {
|
||||
true,
|
||||
0L,
|
||||
MediaFolderType.IMAGE,
|
||||
false,
|
||||
SubFolderRule.YEAR_MONTH
|
||||
false
|
||||
)
|
||||
Assert.assertFalse(SyncedFolderUtils.isQualifyingMediaFolder(folder))
|
||||
}
|
||||
|
||||
@@ -1,52 +0,0 @@
|
||||
/*
|
||||
*
|
||||
* Nextcloud Android client application
|
||||
*
|
||||
* @author Tobias Kaminsky
|
||||
* Copyright (C) 2023 Tobias Kaminsky
|
||||
* Copyright (C) 2023 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.utils.theme
|
||||
|
||||
import com.owncloud.android.AbstractIT
|
||||
import com.owncloud.android.lib.resources.status.NextcloudVersion
|
||||
import com.owncloud.android.lib.resources.status.OwnCloudVersion
|
||||
import junit.framework.TestCase.assertFalse
|
||||
import junit.framework.TestCase.assertTrue
|
||||
import org.junit.Test
|
||||
|
||||
class CapabilityUtilsIT : AbstractIT() {
|
||||
@Test
|
||||
fun checkOutdatedWarning() {
|
||||
assertFalse(test(NextcloudVersion.nextcloud_27))
|
||||
assertFalse(test(NextcloudVersion.nextcloud_26))
|
||||
assertFalse(test(NextcloudVersion.nextcloud_25))
|
||||
assertFalse(test(NextcloudVersion.nextcloud_24))
|
||||
|
||||
assertTrue(test(NextcloudVersion.nextcloud_23))
|
||||
assertTrue(test(NextcloudVersion.nextcloud_22))
|
||||
assertTrue(test(NextcloudVersion.nextcloud_21))
|
||||
assertTrue(test(OwnCloudVersion.nextcloud_20))
|
||||
assertTrue(test(OwnCloudVersion.nextcloud_19))
|
||||
assertTrue(test(OwnCloudVersion.nextcloud_18))
|
||||
assertTrue(test(OwnCloudVersion.nextcloud_17))
|
||||
assertTrue(test(OwnCloudVersion.nextcloud_16))
|
||||
}
|
||||
|
||||
private fun test(version: OwnCloudVersion): Boolean {
|
||||
return CapabilityUtils.checkOutdatedWarning(targetContext.resources, version, false)
|
||||
}
|
||||
}
|
||||
@@ -29,8 +29,8 @@ import com.google.android.play.core.review.ReviewManagerFactory
|
||||
import com.nextcloud.appReview.AppReviewShownModel
|
||||
import com.nextcloud.appReview.InAppReviewHelper
|
||||
import com.nextcloud.client.preferences.AppPreferences
|
||||
import com.nextcloud.utils.extensions.getFormattedStringDate
|
||||
import com.nextcloud.utils.extensions.isCurrentYear
|
||||
import com.nextcloud.utils.getFormattedStringDate
|
||||
import com.nextcloud.utils.isCurrentYear
|
||||
import com.owncloud.android.lib.common.utils.Log_OC
|
||||
|
||||
// Reference: https://developer.android.com/guide/playcore/in-app-review
|
||||
|
||||
@@ -20,15 +20,14 @@
|
||||
*/
|
||||
package com.owncloud.android.ui.activity
|
||||
|
||||
import android.os.Bundle
|
||||
import android.view.View
|
||||
|
||||
/**
|
||||
* Activity providing information about ways to participate in the app's development.
|
||||
*/
|
||||
class HuaweiCommunityActivity : CommunityActivity() {
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
override fun setupContent() {
|
||||
super.setupContent()
|
||||
binding.communityReleaseCandidatePlaystore.visibility = View.GONE
|
||||
}
|
||||
}
|
||||
@@ -72,9 +72,6 @@
|
||||
<uses-permission android:name="android.permission.READ_MEDIA_IMAGES" />
|
||||
<uses-permission android:name="android.permission.READ_MEDIA_VIDEO" />
|
||||
|
||||
<!-- Needed for Android 14 (API level 34) -->
|
||||
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_MEDIA_PLAYBACK" />
|
||||
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_DATA_SYNC" />
|
||||
|
||||
<!-- Some Chromebooks don't support touch. Although not essential,
|
||||
it's a good idea to explicitly include this declaration. -->
|
||||
@@ -381,19 +378,15 @@
|
||||
android:exported="false" />
|
||||
<service
|
||||
android:name=".files.services.FileDownloader"
|
||||
android:foregroundServiceType="dataSync"
|
||||
android:exported="false" />
|
||||
<service
|
||||
android:name="com.nextcloud.client.files.downloader.FileTransferService"
|
||||
android:foregroundServiceType="dataSync"
|
||||
android:exported="false" />
|
||||
<service
|
||||
android:name=".files.services.FileUploader"
|
||||
android:foregroundServiceType="dataSync"
|
||||
android:exported="false" />
|
||||
<service
|
||||
android:name="com.nextcloud.client.media.PlayerService"
|
||||
android:foregroundServiceType="mediaPlayback"
|
||||
android:exported="false" />
|
||||
|
||||
<activity
|
||||
|
||||
@@ -457,23 +457,16 @@ public class InputStreamBinder extends IInputStreamService.Stub {
|
||||
}
|
||||
|
||||
private boolean isValid(NextcloudRequest request) {
|
||||
String[] callingPackageNames = context.getPackageManager().getPackagesForUid(Binder.getCallingUid());
|
||||
String callingPackageName = context.getPackageManager().getNameForUid(Binder.getCallingUid());
|
||||
|
||||
SharedPreferences sharedPreferences = context.getSharedPreferences(SSO_SHARED_PREFERENCE,
|
||||
Context.MODE_PRIVATE);
|
||||
for (String callingPackageName : callingPackageNames) {
|
||||
String hash = sharedPreferences.getString(callingPackageName + DELIMITER + request.getAccountName(), "");
|
||||
if (hash.isEmpty())
|
||||
continue;
|
||||
if (validateToken(hash, request.getToken())) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
String hash = sharedPreferences.getString(callingPackageName + DELIMITER + request.getAccountName(), "");
|
||||
return validateToken(hash, request.getToken());
|
||||
}
|
||||
|
||||
private boolean validateToken(String hash, String token) {
|
||||
if (!hash.contains("$")) {
|
||||
if (hash.isEmpty() || !hash.contains("$")) {
|
||||
throw new IllegalStateException(EXCEPTION_INVALID_TOKEN);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,96 +0,0 @@
|
||||
/*
|
||||
* Nextcloud Android client application
|
||||
*
|
||||
* @author ZetaTom
|
||||
* Copyright (C) 2023 ZetaTom
|
||||
* Copyright (C) 2023 Nextcloud GmbH
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.nextcloud.client
|
||||
|
||||
import com.google.gson.Gson
|
||||
import com.google.gson.annotations.SerializedName
|
||||
import com.owncloud.android.MainApp
|
||||
import okhttp3.OkHttpClient
|
||||
import okhttp3.Request
|
||||
import okhttp3.internal.http.HTTP_OK
|
||||
import java.net.URLEncoder
|
||||
|
||||
class NominatimClient constructor(geocoderBaseUrl: String, email: String) {
|
||||
private val client = OkHttpClient()
|
||||
private val gson = Gson()
|
||||
private val reverseUrl = "${geocoderBaseUrl}reverse?format=jsonv2&email=${URLEncoder.encode(email, ENCODING_UTF_8)}"
|
||||
|
||||
private fun doRequest(requestUrl: String): String? {
|
||||
val request = Request.Builder().url(requestUrl).header(HEADER_USER_AGENT, MainApp.getUserAgent()).build()
|
||||
|
||||
try {
|
||||
val response = client.newCall(request).execute()
|
||||
if (response.code == HTTP_OK) {
|
||||
return response.body.string()
|
||||
}
|
||||
} catch (_: Exception) {
|
||||
}
|
||||
|
||||
return null
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse geocode specified location - get human readable name suitable for displaying from given coordinates.
|
||||
*
|
||||
* @param latitude GPS latitude
|
||||
* @param longitude GPS longitude
|
||||
* @param zoom level of detail to request
|
||||
*/
|
||||
fun reverseGeocode(
|
||||
latitude: Double,
|
||||
longitude: Double,
|
||||
zoom: ZoomLevel = ZoomLevel.TOWN_BOROUGH
|
||||
): ReverseGeocodingResult? {
|
||||
val response = doRequest("$reverseUrl&addressdetails=0&zoom=${zoom.int}&lat=$latitude&lon=$longitude")
|
||||
return response?.let { gson.fromJson(it, ReverseGeocodingResult::class.java) }
|
||||
}
|
||||
|
||||
companion object {
|
||||
private const val ENCODING_UTF_8 = "UTF-8"
|
||||
private const val HEADER_USER_AGENT = "User-Agent"
|
||||
|
||||
@Suppress("MagicNumber")
|
||||
enum class ZoomLevel(val int: Int) {
|
||||
COUNTRY(3),
|
||||
STATE(5),
|
||||
COUNTY(8),
|
||||
CITY(10),
|
||||
TOWN_BOROUGH(12),
|
||||
VILLAGE_SUBURB(13),
|
||||
NEIGHBOURHOOD(14),
|
||||
LOCALITY(15),
|
||||
MAJOR_STREETS(16),
|
||||
MINOR_STREETS(17),
|
||||
BUILDING(18),
|
||||
MAX(19)
|
||||
}
|
||||
|
||||
data class ReverseGeocodingResult(
|
||||
@SerializedName("lat")
|
||||
val latitude: Double,
|
||||
@SerializedName("lon")
|
||||
val longitude: Double,
|
||||
val name: String,
|
||||
@SerializedName("display_name")
|
||||
val displayName: String
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -66,8 +66,8 @@ public class UserAccountManagerImpl implements UserAccountManager {
|
||||
private static final String TAG = UserAccountManagerImpl.class.getSimpleName();
|
||||
private static final String PREF_SELECT_OC_ACCOUNT = "select_oc_account";
|
||||
|
||||
private final Context context;
|
||||
private final AccountManager accountManager;
|
||||
private Context context;
|
||||
private AccountManager accountManager;
|
||||
|
||||
public static UserAccountManagerImpl fromContext(Context context) {
|
||||
AccountManager am = (AccountManager)context.getSystemService(Context.ACCOUNT_SERVICE);
|
||||
@@ -166,7 +166,7 @@ public class UserAccountManagerImpl implements UserAccountManager {
|
||||
}
|
||||
}
|
||||
|
||||
if (defaultAccount == null) {
|
||||
if (defaultAccount == null && ocAccounts.length > 0) {
|
||||
// take first which is not pending for removal account as fallback
|
||||
for (Account account: ocAccounts) {
|
||||
boolean pendingForRemoval = arbitraryDataProvider.getBooleanValue(account.name,
|
||||
@@ -262,11 +262,7 @@ public class UserAccountManagerImpl implements UserAccountManager {
|
||||
public OwnCloudAccount getCurrentOwnCloudAccount() {
|
||||
try {
|
||||
Account currentPlatformAccount = getCurrentAccount();
|
||||
if (currentPlatformAccount != null) {
|
||||
return new OwnCloudAccount(currentPlatformAccount, context);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
return new OwnCloudAccount(currentPlatformAccount, context);
|
||||
} catch (AccountUtils.AccountNotFoundException | IllegalArgumentException ex) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -40,8 +40,8 @@ import com.nextcloud.client.database.entity.ShareEntity
|
||||
import com.nextcloud.client.database.entity.SyncedFolderEntity
|
||||
import com.nextcloud.client.database.entity.UploadEntity
|
||||
import com.nextcloud.client.database.entity.VirtualEntity
|
||||
import com.nextcloud.client.database.migrations.DatabaseMigrationUtil
|
||||
import com.nextcloud.client.database.migrations.Migration67to68
|
||||
import com.nextcloud.client.database.migrations.Migration70to71
|
||||
import com.nextcloud.client.database.migrations.RoomMigration
|
||||
import com.nextcloud.client.database.migrations.addLegacyMigrations
|
||||
import com.owncloud.android.db.ProviderMeta
|
||||
@@ -63,11 +63,7 @@ import com.owncloud.android.db.ProviderMeta
|
||||
AutoMigration(from = 65, to = 66),
|
||||
AutoMigration(from = 66, to = 67),
|
||||
AutoMigration(from = 68, to = 69),
|
||||
AutoMigration(from = 69, to = 70),
|
||||
AutoMigration(from = 70, to = 71, spec = DatabaseMigrationUtil.ResetCapabilitiesPostMigration::class),
|
||||
AutoMigration(from = 71, to = 72),
|
||||
AutoMigration(from = 72, to = 73),
|
||||
AutoMigration(from = 73, to = 74, spec = DatabaseMigrationUtil.ResetCapabilitiesPostMigration::class)
|
||||
AutoMigration(from = 69, to = 70)
|
||||
],
|
||||
exportSchema = true
|
||||
)
|
||||
@@ -94,9 +90,10 @@ abstract class NextcloudDatabase : RoomDatabase() {
|
||||
INSTANCE = Room
|
||||
.databaseBuilder(context, NextcloudDatabase::class.java, ProviderMeta.DB_NAME)
|
||||
.allowMainThreadQueries()
|
||||
.addLegacyMigrations(clock, context)
|
||||
.addLegacyMigrations(clock)
|
||||
.addMigrations(RoomMigration())
|
||||
.addMigrations(Migration67to68())
|
||||
.addMigrations(Migration70to71())
|
||||
.fallbackToDestructiveMigration()
|
||||
.build()
|
||||
}
|
||||
|
||||
@@ -129,7 +129,5 @@ data class CapabilityEntity(
|
||||
@ColumnInfo(name = ProviderTableMeta.CAPABILITIES_FILES_LOCKING_VERSION)
|
||||
val filesLockingVersion: String?,
|
||||
@ColumnInfo(name = ProviderTableMeta.CAPABILITIES_GROUPFOLDERS)
|
||||
val groupfolders: Int?,
|
||||
@ColumnInfo(name = ProviderTableMeta.CAPABILITIES_DROP_ACCOUNT)
|
||||
val dropAccount: Int?
|
||||
val groupfolders: Int?
|
||||
)
|
||||
@@ -119,7 +119,5 @@ data class FileEntity(
|
||||
@ColumnInfo(name = ProviderTableMeta.FILE_LOCK_TOKEN)
|
||||
val lockToken: String?,
|
||||
@ColumnInfo(name = ProviderTableMeta.FILE_TAGS)
|
||||
val tags: String?,
|
||||
@ColumnInfo(name = ProviderTableMeta.FILE_METADATA_GPS)
|
||||
val metadataGPS: String?
|
||||
val tags: String?
|
||||
)
|
||||
@@ -57,7 +57,5 @@ data class SyncedFolderEntity(
|
||||
@ColumnInfo(name = ProviderTableMeta.SYNCED_FOLDER_TYPE)
|
||||
val type: Int?,
|
||||
@ColumnInfo(name = ProviderTableMeta.SYNCED_FOLDER_HIDDEN)
|
||||
val hidden: Int?,
|
||||
@ColumnInfo(name = ProviderTableMeta.SYNCED_FOLDER_SUBFOLDER_RULE)
|
||||
val subFolderRule: Int?
|
||||
val hidden: Int?
|
||||
)
|
||||
@@ -22,7 +22,6 @@
|
||||
|
||||
package com.nextcloud.client.database.migrations
|
||||
|
||||
import androidx.room.migration.AutoMigrationSpec
|
||||
import androidx.sqlite.db.SupportSQLiteDatabase
|
||||
|
||||
object DatabaseMigrationUtil {
|
||||
@@ -103,14 +102,4 @@ object DatabaseMigrationUtil {
|
||||
database.execSQL("DROP TABLE $tableName")
|
||||
database.execSQL("ALTER TABLE $newTableTempName RENAME TO $tableName")
|
||||
}
|
||||
|
||||
/**
|
||||
* Room AutoMigrationSpec to reset capabilities post migration.
|
||||
*/
|
||||
class ResetCapabilitiesPostMigration : AutoMigrationSpec {
|
||||
override fun onPostMigrate(db: SupportSQLiteDatabase) {
|
||||
resetCapabilities(db)
|
||||
super.onPostMigrate(db)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -22,7 +22,6 @@
|
||||
|
||||
package com.nextcloud.client.database.migrations
|
||||
|
||||
import android.content.Context
|
||||
import androidx.room.RoomDatabase
|
||||
import androidx.room.migration.Migration
|
||||
import androidx.sqlite.db.SupportSQLiteDatabase
|
||||
@@ -37,13 +36,12 @@ private const val MIN_SUPPORTED_DB_VERSION = 24
|
||||
class LegacyMigration(
|
||||
private val from: Int,
|
||||
private val to: Int,
|
||||
private val clock: Clock,
|
||||
private val context: Context
|
||||
private val clock: Clock
|
||||
) : Migration(from, to) {
|
||||
|
||||
override fun migrate(database: SupportSQLiteDatabase) {
|
||||
LegacyMigrationHelper(clock, context)
|
||||
.tryUpgrade(database, from, to)
|
||||
LegacyMigrationHelper(clock)
|
||||
.onUpgrade(database, from, to)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,13 +50,11 @@ class LegacyMigration(
|
||||
*
|
||||
* This is needed because the [Migration] does not know which versions it's dealing with
|
||||
*/
|
||||
@Suppress("ForEachOnRange")
|
||||
fun RoomDatabase.Builder<NextcloudDatabase>.addLegacyMigrations(
|
||||
clock: Clock,
|
||||
context: Context
|
||||
clock: Clock
|
||||
): RoomDatabase.Builder<NextcloudDatabase> {
|
||||
(MIN_SUPPORTED_DB_VERSION until NextcloudDatabase.FIRST_ROOM_DB_VERSION - 1)
|
||||
.map { from -> LegacyMigration(from, from + 1, clock, context) }
|
||||
.map { from -> LegacyMigration(from, from + 1, clock) }
|
||||
.forEach { migration -> this.addMigrations(migration) }
|
||||
return this
|
||||
}
|
||||