Compare commits

..
Author SHA1 Message Date
tobiasKaminsky 99632b39df wip
Signed-off-by: tobiasKaminsky <[email protected]>
2026-01-09 12:32:47 +01:00
tobiasKaminsky 7103b5590a rebased
Signed-off-by: tobiasKaminsky <[email protected]>
2026-01-09 11:05:46 +01:00
tobiasKaminsky 06962348ca allow to create encrypted folder directly via bottom sheet dialog
Signed-off-by: tobiasKaminsky <[email protected]>
2026-01-09 10:57:25 +01:00
797 changed files with 20289 additions and 43309 deletions

No files matched your search

-5
View File
@@ -1,5 +0,0 @@
# SPDX-FileCopyrightText: 2026 Nextcloud GmbH and Nextcloud contributors
# SPDX-License-Identifier: AGPL-3.0-or-later
exclude_paths:
- "app/src/main/cpp/**"
+4 -3
View File
@@ -1,10 +1,10 @@
FROM ubuntu:resolute@sha256:f3d28607ddd78734bb7f71f117f3c6706c666b8b76cbff7c9ff6e5718d46ff64
FROM ubuntu:noble@sha256:c35e29c9450151419d9448b0fd75374fec4fff364a27f176fb458d472dfc9e54
ARG DEBIAN_FRONTEND=noninteractive
ENV ANDROID_HOME=/usr/lib/android-sdk
RUN apt-get update -y
RUN apt-get install -y unzip wget openjdk-21-jdk vim
RUN apt-get install -y unzip wget openjdk-17-jdk vim
RUN wget https://dl.google.com/android/repository/commandlinetools-linux-6858069_latest.zip -O /tmp/commandlinetools.zip
RUN cd /tmp && unzip commandlinetools.zip
@@ -16,4 +16,5 @@ RUN mkdir -p "$HOME/.gradle" && \
echo "org.gradle.jvmargs=-Xmx6g -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 -XX:+UseParallelGC -XX:MaxMetaspaceSize=1g" > "$HOME/.gradle/gradle.properties" && \
echo "org.gradle.caching=true" >> "$HOME/.gradle/gradle.properties" && \
echo "org.gradle.parallel=true" >> "$HOME/.gradle/gradle.properties" && \
echo "org.gradle.configureondemand=true" >> "$HOME/.gradle/gradle.properties"
echo "org.gradle.configureondemand=true" >> "$HOME/.gradle/gradle.properties" && \
echo "kapt.incremental.apt=true" >> "$HOME/.gradle/gradle.properties"
+1 -5
View File
@@ -22,7 +22,6 @@ steps:
from_secret: GIT_TOKEN
commands:
- scripts/checkIfRunDrone.sh $DRONE_PULL_REQUEST || exit 0
- sdkmanager "cmake;4.1.2"
- 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 app/src/main/res/values/setup.xml
- ./gradlew assembleGplayDebugAndroidTest
@@ -41,7 +40,6 @@ services:
commands:
- BRANCH="$SERVER_VERSION" /usr/local/bin/initnc.sh
- echo 127.0.0.1 server >> /etc/hosts
- rm /etc/apt/sources.list.d/php.list
- 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"
@@ -89,7 +87,6 @@ steps:
from_secret: GIT_TOKEN
commands:
- scripts/checkIfRunDrone.sh $DRONE_PULL_REQUEST || exit 0
- sdkmanager "cmake;4.1.2"
- 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 app/src/main/res/values/setup.xml
- scripts/runCombinedTest.sh $DRONE_PULL_REQUEST $LOG_USERNAME $LOG_PASSWORD $DRONE_BUILD_NUMBER
@@ -102,7 +99,6 @@ services:
commands:
- /usr/local/bin/initnc.sh
- echo 127.0.0.1 server >> /etc/hosts
- rm /etc/apt/sources.list.d/php.list
- 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"
@@ -189,6 +185,6 @@ name: GIT_TOKEN
data: XIoa9IYq+xQ+N5iln8dlpWv0jV6ROr7HuE24ioUr4uQ8m8SjyH0yognWYLYLqnbTKrFWlFZiEMQTH/sZiWjRFvV1iL0=
---
kind: signature
hmac: e8d113e2208bae860dd54f60386114ba6841cc5de4e4d6e4606fda82d99103e0
hmac: d52e0df1af49c1b30e42a877655c6699914130adf3a3b881db46a70b90356c3a
...
+1 -16
View File
@@ -8,19 +8,4 @@ Unit tests: https://github.com/nextcloud/android/blob/master/CONTRIBUTING.md#uni
Instrumented tests: https://github.com/nextcloud/android/blob/master/CONTRIBUTING.md#instrumented-tests
UI tests: https://github.com/nextcloud/android/blob/master/CONTRIBUTING.md#ui-tests
-->
### 🖼️ Screenshots
🏚️ Before | 🏡 After
---|---
B | A
### 🏁 Checklist
- [ ] ⛑️ Tests (unit and/or integration) are included or not needed
- [ ] 🔙 Backport requests are created or not needed: `/backport to stable-xx.x`
- [ ] 📅 Milestone is set
- [ ] 🌸 PR title is meaningful (if it should be in the changelog: is it meaningful to users?)
## 🤖 AI (if applicable)
- [ ] The content of this PR was partly or fully generated using AI
- [ ] Tests written, or not not needed
+1 -1
View File
@@ -1,2 +1,2 @@
SPDX-FileCopyrightText: 2019-2024 Nextcloud GmbH and Nextcloud contributors
SPDX-License-Identifier: AGPL-3.0-or-later
SPDX-License-Identifier: AGPL-3.0-or-later OR GPL-2.0-only
-179
View File
@@ -1,179 +0,0 @@
# 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
#
# SPDX-FileCopyrightText: 2026 Nextcloud GmbH and Nextcloud contributors
# SPDX-License-Identifier: MIT
name: AI Policy
on:
pull_request:
types: [opened, synchronize, reopened]
branches: [master, main]
permissions:
contents: read
# Required to add the "AI assisted" label via `gh pr edit --add-label`
pull-requests: write
# Required to create the "AI assisted" label via the REST labels endpoint
# (labels are an issues-scoped resource in the GitHub API)
issues: write
concurrency:
group: ai-policy-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
check-ai-trailers:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
with:
fetch-depth: 0
persist-credentials: false
- name: Collect PR commit messages
id: collect
env:
BASE_REF: ${{ github.base_ref }}
run: |
set -euo pipefail
git fetch origin "${BASE_REF}"
MERGE_BASE=$(git merge-base "origin/${BASE_REF}" HEAD)
git log --format="%B" "${MERGE_BASE}..HEAD" > /tmp/pr_commits.txt
echo "--- PR commit messages ---"
cat /tmp/pr_commits.txt
echo "--------------------------"
- name: Define shared agent detection patterns
run: |
set -euo pipefail
# Email addresses known to be used by coding agents.
# These should never appear in Signed-off-by because the DCO can only be attested by a human.
EMAIL_PATTERN="copilot@github\.com\
|noreply@anthropic\.com\
|devin@cognition\.ai\
|devin@cognition-labs\.com\
|aider@aider\.chat\
|noreply@aider\.chat\
|codex@openai\.com\
|cursor@anysphere\.com\
|windsurf@codeium\.com\
|codeium@codeium\.com\
|amazon-q@amazon\.com\
|codewhisperer@amazon\.com\
|gemini-code-assist@google\.com\
|openhands@all-hands\.dev\
|swe-agent@princeton\.edu"
# Strip embedded whitespace (used above only for readability)
EMAIL_PATTERN=$(echo "$EMAIL_PATTERN" | tr -d ' \n')
echo "AGENT_EMAIL_PATTERN=${EMAIL_PATTERN}" >> "$GITHUB_ENV"
# Display-name prefixes used by known coding agents (shared by Signed-off-by and Co-Authored-By checks)
# shellcheck disable=SC2016
echo 'AGENT_NAMES=GitHub Copilot|Claude( [A-Za-z0-9. -]+)?|Devin( AI)?|aider( \(.*\))?|OpenAI Codex|Cursor( AI)?|Windsurf|Amazon Q|CodeWhisperer|Gemini Code Assist|OpenHands|SWE-agent|AutoCodeRover|Tabnine' >> "$GITHUB_ENV"
- name: Check for AI-assistant / Assisted-by trailers
id: ai_trailers
run: |
set -euo pipefail
AI_ASSISTED=false
if grep -qiE '^(AI-assistant|Assisted-by):' /tmp/pr_commits.txt; then
AI_ASSISTED=true
echo "Found AI-assistant/Assisted-by trailer(s):"
grep -iE '^(AI-assistant|Assisted-by):' /tmp/pr_commits.txt
fi
echo "ai_assisted=${AI_ASSISTED}" >> "$GITHUB_OUTPUT"
- name: Check for coding-agent Signed-off-by trailers
id: agent_signoff
run: |
set -euo pipefail
EMAIL_HITS=$(grep -iE "^Signed-off-by:.*<(${AGENT_EMAIL_PATTERN})>" /tmp/pr_commits.txt 2>/dev/null || true)
NAME_HITS=$(grep -iE "^Signed-off-by: *(${AGENT_NAMES}) *[<(]" /tmp/pr_commits.txt 2>/dev/null || true)
AGENT_LINES=$(printf '%s\n%s' "$EMAIL_HITS" "$NAME_HITS" | sort -u | sed '/^[[:space:]]*$/d')
AGENT_SIGNOFF=false
if [ -n "$AGENT_LINES" ]; then
AGENT_SIGNOFF=true
fi
echo "agent_signoff=${AGENT_SIGNOFF}" >> "$GITHUB_OUTPUT"
{
echo "agent_lines<<AGENT_EOF"
echo "${AGENT_LINES}"
echo "AGENT_EOF"
} >> "$GITHUB_OUTPUT"
- name: Check for coding-agent Co-Authored-By trailers
id: co_authored
run: |
set -euo pipefail
EMAIL_HITS=$(grep -iE "^Co-Authored-By:.*<(${AGENT_EMAIL_PATTERN})>" /tmp/pr_commits.txt 2>/dev/null || true)
NAME_HITS=$(grep -iE "^Co-Authored-By: *(${AGENT_NAMES}) *[<(]" /tmp/pr_commits.txt 2>/dev/null || true)
CO_AUTHORED=false
if [ -n "$EMAIL_HITS" ] || [ -n "$NAME_HITS" ]; then
CO_AUTHORED=true
echo "Found coding-agent Co-Authored-By trailer(s):"
printf '%s\n%s' "$EMAIL_HITS" "$NAME_HITS" | sort -u | sed '/^[[:space:]]*$/d'
fi
echo "co_authored=${CO_AUTHORED}" >> "$GITHUB_OUTPUT"
- name: Create 'AI assisted' label if absent
if: steps.ai_trailers.outputs.ai_assisted == 'true' || steps.agent_signoff.outputs.agent_signoff == 'true' || steps.co_authored.outputs.co_authored == 'true'
env:
GH_TOKEN: ${{ github.token }}
run: |
gh api "repos/${{ github.repository }}/labels" \
--method POST \
-f name="AI assisted" \
-f color="d93f0b" \
-f description="This PR contains AI-assisted commits" \
2>/dev/null || true
- name: Label PR as AI assisted
if: steps.ai_trailers.outputs.ai_assisted == 'true' || steps.agent_signoff.outputs.agent_signoff == 'true' || steps.co_authored.outputs.co_authored == 'true'
env:
GH_TOKEN: ${{ github.token }}
run: |
gh pr edit "${{ github.event.pull_request.number }}" \
--repo "${{ github.repository }}" \
--add-label "AI assisted"
echo "Added 'AI assisted' label to PR #${{ github.event.pull_request.number }}"
- name: Fail on coding-agent Signed-off-by
if: steps.agent_signoff.outputs.agent_signoff == 'true'
env:
AGENT_LINES: ${{ steps.agent_signoff.outputs.agent_lines }}
AGENTS_MD_URL: https://github.com/${{ github.repository }}/blob/${{ github.base_ref }}/AGENTS.md
run: |
echo "::error title=Coding-agent sign-off detected::A Signed-off-by trailer from a known coding agent was found in one or more commits."
echo ""
echo "Offending trailer(s):"
echo "${AGENT_LINES}"
echo ""
echo "The 'Signed-off-by' trailer represents the Developer Certificate of Origin (DCO)"
echo "and must only be attested by a human contributor."
echo "Please amend the affected commit(s) to remove the coding-agent sign-off"
echo "and replace it with an 'Assisted-by' trailer, for example:"
echo ""
echo " Assisted-by: Claude Code:claude-sonnet-4-6"
echo ""
echo "References:"
echo " • AGENTS.md (this repository)"
echo " ${AGENTS_MD_URL}"
echo " • AI Contribution Policy"
echo " https://github.com/nextcloud/.github/blob/master/AI_POLICY.md"
echo " • Contribution Guidelines"
echo " https://github.com/nextcloud/.github/blob/master/CONTRIBUTING.md"
exit 1
+8 -5
View File
@@ -27,6 +27,7 @@ concurrency:
jobs:
analysis:
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- name: Disabled on forks
if: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name != github.repository }}
@@ -51,16 +52,16 @@ jobs:
echo "repo=${{ github.event.pull_request.head.repo.full_name }}"
} >> "$GITHUB_OUTPUT"
fi
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
with:
persist-credentials: false
repository: ${{ steps.get-vars.outputs.repo }}
ref: ${{ steps.get-vars.outputs.branch }}
- name: Set up JDK 21
uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5.2.0
- name: Set up JDK 17
uses: actions/setup-java@f2beeb24e141e01a676f977032f5a29d81c9e27e # v5.1.0
with:
distribution: "temurin"
java-version: 21
java-version: 17
- name: Install dependencies
run: |
sudo apt install python3-defusedxml
@@ -70,7 +71,9 @@ jobs:
run: |
mkdir -p "$HOME/.gradle"
{
echo "org.gradle.jvmargs=-Xmx1g -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8"
echo "org.gradle.jvmargs=-Xmx5g -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 -XX:+UseParallelGC -XX:MaxMetaspaceSize=1g"
echo "org.gradle.configureondemand=true"
echo "org.gradle.configuration-cache=false"
echo "kapt.incremental.apt=true"
} > "$HOME/.gradle/gradle.properties"
scripts/analysis/analysis-wrapper.sh "${{ steps.get-vars.outputs.branch }}" "${{ secrets.LOG_USERNAME }}" "${{ secrets.LOG_PASSWORD }}" "$GITHUB_RUN_NUMBER" "${{ steps.get-vars.outputs.pr }}"
+6 -5
View File
@@ -22,17 +22,18 @@ jobs:
matrix:
flavor: [ Generic, Gplay, Huawei ]
steps:
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
- name: set up JDK 21
uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5.2.0
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
- name: set up JDK 17
uses: actions/setup-java@f2beeb24e141e01a676f977032f5a29d81c9e27e # v5.1.0
with:
distribution: "temurin"
java-version: 21
- uses: gradle/actions/wrapper-validation@50e97c2cd7a37755bbfafc9c5b7cafaece252f6e # v6.1.0
java-version: 17
- uses: gradle/actions/wrapper-validation@4d9f0ba0025fe599b4ebab900eb7f3a1d93ef4c2 # v5.0.0
- name: Build ${{ matrix.flavor }}
run: |
echo "org.gradle.jvmargs=-Xmx6g -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 -XX:+UseParallelGC -XX:MaxMetaspaceSize=1g" >> gradle.properties
echo "org.gradle.caching=true" >> gradle.properties
echo "org.gradle.parallel=true" >> gradle.properties
echo "org.gradle.configureondemand=true" >> gradle.properties
echo "kapt.incremental.apt=true" >> gradle.properties
./gradlew assemble${{ matrix.flavor }}
+4 -4
View File
@@ -22,11 +22,11 @@ jobs:
matrix:
task: [ detekt, spotlessKotlinCheck, lint ]
steps:
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
- name: Set up JDK 21
uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5.2.0
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
- name: Set up JDK 17
uses: actions/setup-java@f2beeb24e141e01a676f977032f5a29d81c9e27e # v5.1.0
with:
distribution: "temurin"
java-version: 21
java-version: 17
- name: Check ${{ matrix.task }}
run: ./gradlew ${{ matrix.task }}
+8 -8
View File
@@ -34,7 +34,7 @@ jobs:
language: [ 'java' ]
steps:
- name: Checkout repository
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
with:
persist-credentials: false
- name: Set Swap Space
@@ -43,18 +43,18 @@ jobs:
with:
swap-size-gb: 10
- name: Initialize CodeQL
uses: github/codeql-action/init@8aad20d150bbac5944a9f9d289da16a4b0d87c1e # v4.36.2
uses: github/codeql-action/init@5d4e8d1aca955e8d8589aabd499c5cae939e33c7 # v4.31.9
with:
languages: ${{ matrix.language }}
- name: Set up JDK 21
uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5.2.0
- name: Set up JDK 17
uses: actions/setup-java@f2beeb24e141e01a676f977032f5a29d81c9e27e # v5.1.0
with:
distribution: "temurin"
java-version: 21
java-version: 17
- name: Assemble
run: |
mkdir -p "$HOME/.gradle"
echo "org.gradle.jvmargs=-Xmx3g -XX:MaxMetaspaceSize=512m -XX:+HeapDumpOnOutOfMemoryError" > "$HOME/.gradle/gradle.properties"
./gradlew --no-daemon assembleDebug
echo "org.gradle.jvmargs=-Xmx4g -XX:MaxMetaspaceSize=512m -XX:+HeapDumpOnOutOfMemoryError" > "$HOME/.gradle/gradle.properties"
./gradlew assembleDebug
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@8aad20d150bbac5944a9f9d289da16a4b0d87c1e # v4.36.2
uses: github/codeql-action/analyze@5d4e8d1aca955e8d8589aabd499c5cae939e33c7 # v4.31.9
+4 -4
View File
@@ -20,11 +20,11 @@ jobs:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
- name: Set up JDK 21
uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5.2.0
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
- name: Set up JDK 17
uses: actions/setup-java@f2beeb24e141e01a676f977032f5a29d81c9e27e # v5.1.0
with:
distribution: "temurin"
java-version: 21
java-version: 17
- name: Detect SNAPSHOT
run: scripts/analysis/detectWrongSettings.sh
+1 -1
View File
@@ -2,7 +2,7 @@
#
# SPDX-FileCopyrightText: 2022-2024 Nextcloud GmbH and Nextcloud contributors
# SPDX-FileCopyrightText: 2022 Álvaro Brey <[email protected]>
# SPDX-License-Identifier: AGPL-3.0-or-later
# SPDX-License-Identifier: AGPL-3.0-or-later OR GPL-2.0-only
#
## This file is intended to be sourced by other scripts
+1 -1
View File
@@ -1,2 +1,2 @@
SPDX-FileCopyrightText: 2019-2025 Nextcloud GmbH and Nextcloud contributors
SPDX-License-Identifier: AGPL-3.0-or-later
SPDX-License-Identifier: AGPL-3.0-or-later OR GPL-2.0-only
-39
View File
@@ -1,39 +0,0 @@
# SPDX-FileCopyrightText: 2026 Nextcloud GmbH and Nextcloud contributors
# SPDX-License-Identifier: MIT
name: Lint translation files
on:
pull_request:
branches: [ master, main, stable-* ]
push:
branches: [ master, main, stable-* ]
permissions:
contents: read
concurrency:
group: lint-php-cs-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
lint:
runs-on: ubuntu-latest-low
name: translations-string-xml
steps:
- name: Checkout
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
with:
persist-credentials: false
- name: Check for new lines in translation strings
id: counter
run: |
grep -P '<string name' app/src/main/res/values/strings.xml | grep -vcP '</string>' | grep '^0$'
- name: Output
if: failure()
run: |
grep -P '<string name' app/src/main/res/values/strings.xml | grep -vP '</string>'
+9 -39
View File
@@ -24,17 +24,17 @@ jobs:
id: check-secrets
- name: Checkout
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
if: ${{ steps.check-secrets.outputs.ok == 'true' }}
with:
persist-credentials: false
- name: set up JDK 21
uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5.2.0
- name: set up JDK 17
uses: actions/setup-java@f2beeb24e141e01a676f977032f5a29d81c9e27e # v5.1.0
if: ${{ steps.check-secrets.outputs.ok == 'true' }}
with:
distribution: "temurin"
java-version: 21
java-version: 17
- name: Build QA
if: ${{ steps.check-secrets.outputs.ok == 'true' }}
@@ -46,40 +46,10 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
mkdir -p "$HOME/.gradle"
echo "org.gradle.jvmargs=-Xmx3g -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 -XX:+UseParallelGC -XX:MaxMetaspaceSize=1g" > "$HOME/.gradle/gradle.properties"
echo "org.gradle.caching=true; org.gradle.parallel=true; org.gradle.configureondemand=true" >> "$HOME/.gradle/gradle.properties"
[ -e app/build.gradle ] && sed -i "/qa/,/\}/ s/versionCode .*/versionCode ${{github.event.number}} /" "app/build.gradle"
[ -e app/build.gradle ] && sed -i "/qa/,/\}/ s/versionName .*/versionName \"${{github.event.number}}\"/" "app/build.gradle"
[ -e app/build.gradle.kts ] && sed -i "/qa/,/\}/ s/versionCode .*/versionCode = ${{github.event.number}} /" "app/build.gradle.kts"
[ -e app/build.gradle.kts ] && sed -i "/qa/,/\}/ s/versionName .*/versionName = \"${{github.event.number}}\"/" "app/build.gradle.kts"
echo "org.gradle.jvmargs=-Xmx6g -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 -XX:+UseParallelGC -XX:MaxMetaspaceSize=1g" > "$HOME/.gradle/gradle.properties"
echo "org.gradle.caching=true; org.gradle.parallel=true; org.gradle.configureondemand=true; kapt.incremental.apt=true" >> "$HOME/.gradle/gradle.properties"
sed -i "/qa/,/\}/ s/versionCode.*/versionCode = ${{ github.event.number }}/" app/build.gradle.kts
sed -i "/qa/,/\}/ s/versionName.*/versionName = \"${{ github.event.number }}\"/" app/build.gradle.kts
./gradlew assembleQaDebug
$(find /usr/local/lib/android/sdk/build-tools/*/apksigner | sort | tail -n1) sign --ks-pass pass:"$KS_PASS" --key-pass pass:"$KEY_PASS" --ks-key-alias key0 --ks ".github/workflows/QA_keystore.jks" app/build/outputs/apk/qa/debug/*qa-debug*.apk
- name: Upload APK
id: upload-apk
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f
with:
path: app/build/outputs/apk/qa/debug/*qa-debug*.apk
retention-days: 7
archive: false
- name: Create QR Code
run: |
sudo apt-get -y install qrencode
qrencode -o qr.png "${{ steps.upload-apk.outputs.artifact-url }}"
- name: Upload QR
id: upload-qr
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f
with:
path: qr.png
retention-days: 7
archive: false
- name: Comment PR
uses: thollander/actions-comment-pull-request@e4a76dd2b0a3c2027c3fd84147a67c22ee4c90fa
with:
message: |
APK file: ${{ steps.upload-apk.outputs.artifact-url }}
To test this change/fix you can simply download above APK file and install and test it in parallel to your existing Nextcloud app.
![qrcode](${{ steps.upload-qr.outputs.artifact-url }}) (please click on link to get QR code displayed)
.github/workflows/uploadArtifact.sh "$LOG_USERNAME" "$LOG_PASSWORD" "${{github.event.number}}" "${{github.event.number}}" "$GITHUB_TOKEN"
+1 -1
View File
@@ -48,7 +48,7 @@ jobs:
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
with:
ref: ${{ github.head_ref }}
+1 -1
View File
@@ -19,7 +19,7 @@ jobs:
runs-on: ubuntu-latest-low
steps:
- name: Checkout
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
with:
persist-credentials: false
+2 -2
View File
@@ -29,7 +29,7 @@ jobs:
steps:
- name: "Checkout code"
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
with:
persist-credentials: false
@@ -42,6 +42,6 @@ jobs:
# Upload the results to GitHub's code scanning dashboard.
- name: "Upload to code-scanning"
uses: github/codeql-action/upload-sarif@8aad20d150bbac5944a9f9d289da16a4b0d87c1e # v4.36.2
uses: github/codeql-action/upload-sarif@5d4e8d1aca955e8d8589aabd499c5cae939e33c7 # v4.31.9
with:
sarif_file: results.sarif
+10 -9
View File
@@ -25,17 +25,17 @@ jobs:
color: [ blue ]
api-level: [ 28 ]
steps:
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
- name: Gradle cache
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
uses: actions/cache@9255dc7a253b0ccc959486e2bca901246202afeb # v5.0.1
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: gradle-${{ runner.os }}-${{ hashFiles('**/*.gradle*') }}-${{ hashFiles('**/gradle/wrapper/gradle-wrapper.properties') }}
- name: AVD cache
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
uses: actions/cache@9255dc7a253b0ccc959486e2bca901246202afeb # v5.0.1
id: avd-cache
with:
path: |
@@ -43,10 +43,10 @@ jobs:
~/.android/adb*
key: avd-${{ matrix.api-level }}
- uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5.2.0
- uses: actions/setup-java@f2beeb24e141e01a676f977032f5a29d81c9e27e # v5.1.0
with:
distribution: "temurin"
java-version: 21
java-version: 17
- name: Enable KVM group perms
run: |
@@ -56,7 +56,7 @@ jobs:
- name: create AVD and generate snapshot for caching
if: steps.avd-cache.outputs.cache-hit != 'true'
uses: reactivecircus/android-emulator-runner@e89f39f1abbbd05b1113a29cf4db69e7540cae5a # v2.37.0
uses: reactivecircus/android-emulator-runner@b530d96654c385303d652368551fb075bc2f0b6b # v2.35.0
with:
api-level: ${{ matrix.api-level }}
force-avd-creation: false
@@ -73,8 +73,9 @@ jobs:
echo "org.gradle.caching=true" >> $HOME/.gradle/gradle.properties
echo "org.gradle.parallel=true" >> $HOME/.gradle/gradle.properties
echo "org.gradle.configureondemand=true" >> $HOME/.gradle/gradle.properties
echo "kapt.incremental.apt=true" >> $HOME/.gradle/gradle.properties
- name: Build generic flavor
- name: Build gplay
run: ./gradlew assembleGenericDebug
- name: Delete old comments
@@ -86,7 +87,7 @@ jobs:
- name: Run screenshot tests
env:
SHOT_TEST: "true"
uses: reactivecircus/android-emulator-runner@e89f39f1abbbd05b1113a29cf4db69e7540cae5a # v2.37.0
uses: reactivecircus/android-emulator-runner@b530d96654c385303d652368551fb075bc2f0b6b # v2.35.0
with:
api-level: ${{ matrix.api-level }}
force-avd-creation: false
@@ -101,7 +102,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@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
if: ${{ always() }}
with:
name: Report-${{ matrix.color }}-${{ matrix.scheme }}
+1 -1
View File
@@ -20,7 +20,7 @@ jobs:
issues: write
pull-requests: write
steps:
- uses: actions/stale@eb5cf3af3ac0a1aa4c9c45633dd1ae542a27a899 # v10.3.0
- uses: actions/stale@997185467fa4f803885201cee163a9f38240193d # v10.1.1
with:
days-before-stale: 28
days-before-close: 14
+7 -7
View File
@@ -22,13 +22,13 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
- name: Set up JDK 21
uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5.2.0
- name: Set up JDK 17
uses: actions/setup-java@f2beeb24e141e01a676f977032f5a29d81c9e27e # v5.1.0
with:
distribution: "temurin"
java-version: 21
java-version: 17
- name: Delete old comments
env:
@@ -37,7 +37,7 @@ jobs:
run: scripts/deleteOldComments.sh "test" "Unit" ${{github.event.number}}
- name: Setup Gradle
uses: gradle/actions/setup-gradle@50e97c2cd7a37755bbfafc9c5b7cafaece252f6e # v6.1.0
uses: gradle/actions/setup-gradle@4d9f0ba0025fe599b4ebab900eb7f3a1d93ef4c2 # v5.0.0
- name: Run unit tests with coverage
run: ./gradlew jacocoTestGplayDebugUnitTest
@@ -49,7 +49,7 @@ jobs:
run: scripts/uploadReport.sh "${{ secrets.LOG_USERNAME }}" "${{ secrets.LOG_PASSWORD }}" ${{github.event.number}} "test" "Unit" ${{github.event.number}}
- name: Upload coverage to codecov
uses: codecov/codecov-action@e79a6962e0d4c0c17b229090214935d2e33f8354 # v6.0.1
uses: codecov/codecov-action@671740ac38dd9b0130fbe1cec585b89eea48d3de # v5.5.2
with:
token: ${{ secrets.CODECOV_TOKEN }}
flags: unit
@@ -58,7 +58,7 @@ jobs:
- name: Upload jacoco artifacts
if: ${{ failure() }}
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
with:
name: test-results
path: app/build/reports/jacoco/jacocoTestGplayDebugUnitTestReport/html/
+1 -1
View File
@@ -3,7 +3,7 @@
#
# SPDX-FileCopyrightText: 2019-2024 Nextcloud GmbH and Nextcloud contributors
# SPDX-FileCopyrightText: 2019-2022 Tobias Kaminsky <[email protected]>
# SPDX-License-Identifier: AGPL-3.0-or-later
# SPDX-License-Identifier: AGPL-3.0-or-later OR GPL-2.0-only
#
#1: LOG_USERNAME
-37
View File
@@ -22,32 +22,9 @@ target/
local.properties
tests/local.properties
# Signing & secrets
*.jks
*.keystore
keystore.properties
release.properties
google-services.json
GoogleService-Info.plist
*.p12
*.pem
secrets.properties
.env
.env.*
# Windows
Thumbs.db
desktop.ini
# Mac .DS_Store files
.DS_Store
# Linux/editor temp files
*~
*.swp
*.swo
.vscode/
# Proguard README
proguard-project.txt
tests/proguard-project.txt
@@ -62,20 +39,6 @@ build
fastlane/Fastfile
*.hprof
# NDK / C++
*.so
obj/
*.o
*.a
.cxx/
# Testing & coverage
.kotlin/
*.lcov
test-results/
jacoco/
*.exec
# fastlane specific
**/fastlane/report.xml
-1
View File
@@ -33,7 +33,6 @@
<option name="composableFile" value="true" />
</inspection_tool>
<inspection_tool class="KotlinUnusedImport" enabled="true" level="ERROR" enabled_by_default="true" />
<inspection_tool class="LongLine" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="PreviewAnnotationInFunctionWithParameters" enabled="true" level="ERROR" enabled_by_default="true">
<option name="composableFile" value="true" />
<option name="previewFile" value="true" />
-190
View File
@@ -1,190 +0,0 @@
<!--
- SPDX-FileCopyrightText: 2026 Nextcloud GmbH and Nextcloud contributors
- SPDX-License-Identifier: AGPL-3.0-or-later
-->
# Agents.md
This file provides guidance to all AI agents (Claude, Codex, Gemini, etc.) working with code in this repository.
You are an experienced engineer specialized on Java, Kotlin and familiar with the platform-specific details of Android.
## Your Role
- You implement features and fix bugs.
- Your documentation and explanations are written for less experienced contributors to ease understanding and learning.
- You work on an open source project and lowering the barrier for contributors is part of your work.
## Project Overview
The Nextcloud Android Client is a application to synchronize files from Nextcloud Server with your Android device.
Java, Kotlin, XML, Jetpack Compose are the key technologies used for building the app.
## Project Structure: AI Agent Handling Guidelines
- `./app/src/main/java/com/owncloud/android/` Legacy components (Activities, datamodel, operations)
- `./app/src/main/java/com/nextcloud/` Modern components (client APIs, DI, repositories, UI with Compose)
- `./app/src/main/java/com/nextcloud/utils/extensions/` Extension functions for common types
- `./app/src/main/java/com/nextcloud/ui/` Jetpack Compose UI components and screens
- `./app/src/main/java/com/nextcloud/client/di/` Dependency injection configuration (Dagger 2)
- `./app/src/main/java/com/nextcloud/client/assistant/` AI features (Assistant screen, chat, conversations, translations)
- `./app/src/test/` Unit tests (small, isolated tests without Android SDK)
- `./app/src/androidTest/` Instrumented tests (require Android SDK)
- `./app/src/main/res/values/` Translations. Only update `./app/src/main/res/values/strings.xml`. Do not modify any other translation files or folders. Ignore all `values-*` directories (e.g., `values-es`, `values-fr`).
## General Guidance
Every new file needs to get a SPDX header in the first rows according to this template.
The year in the first line must be replaced with the year when the file is created (for example, 2026 for files first added in 2026).
The commenting signs need to be used depending on the file type.
New contributions use AGPL-3.0-or-later license. Files may also have `OR GPL-2.0-only` in the license if they originated from GPL-licensed code.
```plaintext
SPDX-FileCopyrightText: <YEAR> Nextcloud GmbH and Nextcloud contributors
SPDX-License-Identifier: AGPL-3.0-or-later
```
Kotlin/Java:
```kotlin
/*
* Nextcloud - Android Client
*
* SPDX-FileCopyrightText: <year> Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
```
XML:
```xml
<!--
~ Nextcloud - Android Client
~
~ SPDX-FileCopyrightText: <year> Nextcloud GmbH and Nextcloud contributors
~ SPDX-License-Identifier: AGPL-3.0-or-later
-->
```
Avoid creating source files that implement multiple types; instead, place each type in its own dedicated source file.
## Design
- Follow Material Design 3 guidelines
- In addition to any Material Design wording guidelines, follow the Nextcloud wording guidelines at https://docs.nextcloud.com/server/latest/developer_manual/design/foundations.html#wording
- Ensure the app works in both light and dark theme
- Ensure the app works with different server primary colors by using the colorTheme of viewThemeUtils
## Architecture & Patterns
### Jetpack Compose
Modern UI is built with Jetpack Compose (Material 3). Key directories:
- `com.nextcloud.ui.composeActivity` - Activities hosting Compose content
- `com.nextcloud.ui.composeComponents` - Reusable Compose components
- `com.nextcloud.client.assistant` - Compose-based Assistant screens and features
Use `StateFlow` and `MutableStateFlow` in ViewModels for state management. Collect state in Compose functions with `collectAsState()`.
### Dependency Injection
Uses Dagger 2 for major Android components (`Activity`, `Fragment`, `Service`, `BroadcastReceiver`, `ContentProvider`). Manual constructor injection for other components.
### Extension Functions
The `com.nextcloud.utils.extensions` package contains helper extensions organized by type (e.g., `FileExtensions.kt`, `StringExtensions.kt`, `ViewExtensions.kt`). Create focused extension files rather than putting multiple types in one file.
## Testing
### Unit Tests (`./app/src/test/`)
- Small, isolated tests without Android SDK
- Use Mockito with `mockito-kotlin` for easier mocking
- Recommended command: `./gradlew jacocoTestGplayDebugUnitTest`
- Tests use JUnit 4 with `@Test`, `@Before`, `@After` annotations
### Instrumented Tests (`./app/src/androidTest/`)
- Tests requiring Android SDK (Activities, Fragments, database access)
- Use Espresso for UI testing
- Tests should inherit from `AbstractOnServerIT` if they need server communication
- Always create a separate test user on test server to avoid data interference
- Run with: `./gradlew createGplayDebugCoverageReport -Pcoverage=true`
- Run specific test class: `./gradlew createGplayDebugCoverageReport -Pcoverage=true -Pandroid.testInstrumentationRunnerArguments.class=<fully.qualified.ClassName>`
- Run one test method: `./gradlew createGplayDebugCoverageReport -Pcoverage=true -Pandroid.testInstrumentationRunnerArguments.class=<fully.qualified.ClassName>#methodName`
### Screenshot Tests (Shot)
- Enabled via `SHOT_TEST=true` environment variable
- Use: `scripts/androidScreenshotTest` to check, `scripts/updateScreenshots.sh` to regenerate
- CI renders shadows differently; 0.5% tolerance is configured
## Code Quality Tools
All code is validated with the following tools. Fix findings in modified files:
- **lint** - Android linting (configured in `app/lint.xml`)
- **spotbugsGplayDebug** - Bug detection for Gplay variant
- **detekt** - Kotlin code analysis (configured in `app/detekt.yml`)
- **spotlessKotlinCheck** - Code formatting with ktlint
Run all checks with: `./gradlew check`
## Nextcloud Contribution Policy
All contributions generated or assisted by this agent must fully comply with:
- **[AI Contribution Policy](https://github.com/nextcloud/.github/blob/master/AI_POLICY.md)** - the primary reference for AI-specific rules, covering disclosure, author accountability, communication, security, licensing, code quality, and autonomous agent behavior.
- **[Contribution Guidelines](https://github.com/nextcloud/.github/blob/master/CONTRIBUTING.md)** - covering testing requirements, the Developer Certificate of Origin (DCO), license headers, conventional commits, and translations. These apply in full to all contributions regardless of how they were produced.
### What this agent must always do
- Add an `Assisted-by: AGENT_NAME:MODEL_VERSION` git trailer to every commit containing AI-assisted content.
- Ensure every pull request includes a disclosure of AI tool use in the PR description.
- Produce focused, scoped pull requests that address exactly one concern. Do not touch unrelated files or introduce incidental refactors.
- Verify all dependencies against actual package registries before suggesting them. Do not use hallucinated or unverified package names.
- Explicitly inform the contributor when any action they are about to take, or have taken, would violate the AI Contribution Policy or the Contribution Guidelines. Do not silently proceed. State which rule is at risk and what the contributor should do instead.
- Warn the contributor if a pull request is growing too large. A PR approaching several thousand lines of changed code is a signal that it should be split into smaller, focused PRs. Suggest a logical split before the PR is opened, not after.
- Recommend opening a ticket for discussion before starting implementation whenever a feature or change is sufficiently complex - for example when it touches multiple subsystems, requires architectural decisions, or the right approach is not yet clear. A ticket allows maintainers and the contributor to align on direction before code is written, avoiding wasted effort on a PR that may be rejected or require fundamental rework.
### What this agent must never do
- Open issues, submit pull requests, post review comments, or send security reports autonomously. Every contribution must be reviewed and submitted by a human.
- Add `Signed-off-by` tags to commits. Only the human contributor can certify the Developer Certificate of Origin.
- Generate or submit security reports without independent human verification. Report verified vulnerabilities via [HackerOne](https://hackerone.com/nextcloud), not as GitHub issues.
- Write PR descriptions, review comments, or issue reports on behalf of the contributor. These must be in the contributor's own words.
- Fully automate the resolution of issues labeled [`good first issue`](https://github.com/issues?q=org%3Anextcloud+label%3A%22good+first+issue%22) or similar beginner-friendly labels.
- Submit code that has not been reviewed and cleaned up by the contributor. Dead code, redundant logic, excessive comments, and unrelated changes must be removed before submission.
## Commit and Pull Request Guidelines
### Commits
- All commits must be signed off (`git commit -s`) per the Developer Certificate of Origin (DCO). All PRs target `master`. Backports use `/backport to stable-X.Y` in a PR comment.
- Commit messages must follow the [Conventional Commits v1.0.0 specification](https://www.conventionalcommits.org/en/v1.0.0/#specification) — e.g. `feat(chat): add voice message playback`, `fix(call): handle MCU disconnect gracefully`.
- Every commit made with AI assistance must include an `Assisted-by: AGENT_NAME:MODEL_VERSION` git trailer identifying the coding agent and model used:
```
Assisted-by: ClaudeCode:claude-sonnet-4-6
Assisted-by: Copilot:claude-sonnet-4-6
```
General pattern: `Assisted-by: <coding-agent>:<model-version>`
### Pull Requests
- Include a short summary of what changed. *Example:* `fix: prevent crash on empty todo title`.
- **Pull Request**: When the agent creates a PR, it should include a description summarizing the changes and why they were made. If a GitHub issue exists, reference it (e.g., “Closes #123”).
## Code Style
- Do not exceed 300 lines of code per file.
- Line length: **120 characters**
- Standard Android Studio formatter with EditorConfig.
- Kotlin preferred for new code; legacy Java still present.
- Do not use decorative section-divider comments of any kind (e.g. `// ── Title ───`, `// ------`, `// ======`).
- Every new file must end with exactly one empty trailing line (no more, no less).
- Do not add comments, documentation for every function you created instead make it self explanatory as much as possible.
- Create models, states in different files instead of doing it one single file.
- Do not use magic numbers.
- Apply fail fast principle instead of using nested if-else statements.
- Do not use multiple boolean flags to determine states instead use enums or sealed classes.
- Use modern Java for Java classes. Optionals, virtual threads, records, streams if necessary.
- Avoid hardcoded strings, colors, dimensions. Use resources.
- Run lint, spotbugsGplayDebug, detekt, spotlessKotlinCheck and fix findings inside the files that have been changed.
-1
View File
@@ -1 +0,0 @@
@AGENTS.md
+10 -39
View File
@@ -14,7 +14,7 @@
1. [Contributing to Source Code](#contributing-to-source-code)
1. [Developing process](#developing-process)
1. [Branching model](#branching-model)
1. [Formatter setup](#formatter-setup)
1. [Android Studio formatter setup](#android-studio-formatter-setup)
1. [Build variants](#build-variants)
1. [Git hooks](#git-hooks)
1. [Contribution process](#contribution-process)
@@ -107,22 +107,12 @@ We are all about quality while not sacrificing speed so we use a very pragmatic
* Hot fixes not relevant for an upcoming feature release but the latest release can target the bug fix branch directly
### Formatter setup
### Android Studio formatter setup
Our formatter setup is rather simple:
* Standard Android Studio
* Line length 120 characters (Settings->Editor->Code Style->Right margin(columns): 120; also set by EditorConfig
* Line length 120 characters (Settings->Editor->Code Style->Right margin(columns): 120)
* Auto optimize imports (Settings->Editor->Auto Import->Optimize imports on the fly)
You can fix Check / check (spotlessKotlinCheck) via following commands:
```bash
./gradlew spotlessApply
./gradlew detekt
./gradlew spotlessCheck
./gradlew spotlessKotlinCheck
```
See section [Git hooks](#git-hooks) to have these run automatically with your commits.
### Build variants
There are three build variants
@@ -132,7 +122,7 @@ There are three build variants
### Git hooks
We provide git hooks to make development process easier for both the developer and the reviewers.
They are stored in [/scripts/hooks](/scripts/hooks) and can be installed with:
To install them, just run:
```bash
./gradlew installGitHooks
@@ -224,44 +214,25 @@ Source code of app:
- small, isolated tests, with no need of Android SDK
- code coverage can be directly shown via right click on test and select "Run Test with Coverage"
```
./gradlew jacocoTestGplayDebugUnitTest
```bash
#### Instrumented tests
- tests to see larger code working in correct way
- tests that require parts of Android SDK
- best to avoid server communication, see https://github.com/nextcloud/android/pull/3624
- run all tests ```./gradlew createGplayDebugCoverageReport -Pcoverage=true```
- run selective test class: ```./gradlew createGplayDebugCoverageReport -Pcoverage=true
-Pandroid.testInstrumentationRunnerArguments.class=com.owncloud.android.datamodel.FileDataStorageManagerContentProviderClientIT```
-Pandroid.testInstrumentationRunnerArguments.class=com.owncloud.android.datamodel.FileDataStorageManagerTest```
- run multiple test classes:
- separate by ","
- ```./gradlew createGplayDebugCoverageReport -Pcoverage=true -Pandroid.testInstrumentationRunnerArguments.class=com.owncloud.android.datamodel.FileDataStorageManagerContentProviderClientIT,com.nextcloud.client.FileDisplayActivityIT```
- ```./gradlew createGplayDebugCoverageReport -Pcoverage=true -Pandroid.testInstrumentationRunnerArguments.class=com.owncloud.android.datamodel.FileDataStorageManagerTest,com.nextcloud.client.FileDisplayActivityIT```
- run one test in class: ```./gradlew createGplayDebugCoverageReport -Pcoverage=true
-Pandroid.testInstrumentationRunnerArguments.class=com.owncloud.android.datamodel.FileDataStorageManagerContentProviderClientIT#saveFile```
-Pandroid.testInstrumentationRunnerArguments.class=com.owncloud.android.datamodel.FileDataStorageManagerTest#saveNewFile```
- JaCoCo results are shown as html: firefox ./build/reports/coverage/gplay/debug/index.html
#### Instrumented tests with server communication
It is best to avoid server communication, see https://github.com/nextcloud/android/pull/3624.
But if a test requires a server, this is how it is done:
- Have a Nextcloud service reachable by your test device. This can be an existing server in the internet or a locally deployed one
as per the [server developer documentation](https://docs.nextcloud.com/server/latest/developer_manual/getting_started/devenv.html)
- Create a separate(!) test user on that server, otherwise the tests will infer with productive data.
- In `gradle.properties`, enter the URL, user name and password via the `NC_TEST_SERVER_...` attributes.
If you want to prevent an accidental commit of those, you can also store them in `~/.gradle/gradle.properties`.
- Your test class should inherit from `AbstractOnServerIT`, e.g.: `public class DownloadIT extends AbstractOnServerIT { ...`
Note that this will automatically delete all files after each test run, so you absolutely NEED a separate test user as mentioned above.
- All preconditions of your test regarding server data, e.g. existing files, need to be established by your test itself.
As a reference, see how `DownloadIT` first uploads the files it later tests the download with.
- Clean up these preconditions again, also in the failure case, using one or multiple `@After` methods in your test class.
#### UI tests
We use [shot](https://github.com/Karumi/Shot) for taking screenshots and compare them.
To exclude the shot dependency from normal builds, the dependency needs to be activated via an environment variable `SHOT_TEST`.
For convenience, this and other prerequisites are encapsulated in utility scripts, so it is advised to use them
- check screenshots: ```scripts/androidScreenshotTest ```
- check the script for a detailed documentation of the parameters
We use [shot](https://github.com/Karumi/Shot) for taking screenshots and compare them
- check screenshots: ```./gradlew gplayDebugExecuteScreenshotTests ```
- update/generate new screenshots: ```scripts/updateScreenshots.sh ```
- in this script are samples how to only execute a given class/test
- this will fire up docker & emulator to ensure that screenshots look the same
+54 -70
View File
@@ -3,13 +3,13 @@ GEM
specs:
CFPropertyList (3.0.8)
abbrev (0.1.2)
addressable (2.9.0)
addressable (2.8.8)
public_suffix (>= 2.0.2, < 8.0)
artifactory (3.0.17)
atomos (0.1.3)
aws-eventstream (1.4.0)
aws-partitions (1.1258.0)
aws-sdk-core (3.251.0)
aws-partitions (1.1201.0)
aws-sdk-core (3.241.2)
aws-eventstream (~> 1, >= 1.3.0)
aws-partitions (~> 1, >= 1.992.0)
aws-sigv4 (~> 1.9)
@@ -17,18 +17,17 @@ GEM
bigdecimal
jmespath (~> 1, >= 1.6.1)
logger
aws-sdk-kms (1.129.0)
aws-sdk-core (~> 3, >= 3.248.0)
aws-sdk-kms (1.119.0)
aws-sdk-core (~> 3, >= 3.241.0)
aws-sigv4 (~> 1.5)
aws-sdk-s3 (1.225.0)
aws-sdk-core (~> 3, >= 3.248.0)
aws-sdk-s3 (1.210.1)
aws-sdk-core (~> 3, >= 3.241.0)
aws-sdk-kms (~> 1)
aws-sigv4 (~> 1.5)
aws-sigv4 (1.12.1)
aws-eventstream (~> 1, >= 1.0.2)
babosa (1.0.4)
base64 (0.3.0)
benchmark (0.5.0)
bigdecimal (3.3.1)
cgi (0.4.2)
claide (1.1.0)
@@ -44,17 +43,16 @@ GEM
dotenv (2.8.1)
emoji_regex (3.2.3)
excon (0.112.0)
faraday (1.10.5)
faraday (1.8.0)
faraday-em_http (~> 1.0)
faraday-em_synchrony (~> 1.0)
faraday-excon (~> 1.1)
faraday-httpclient (~> 1.0)
faraday-multipart (~> 1.0)
faraday-httpclient (~> 1.0.1)
faraday-net_http (~> 1.0)
faraday-net_http_persistent (~> 1.0)
faraday-net_http_persistent (~> 1.1)
faraday-patron (~> 1.0)
faraday-rack (~> 1.0)
faraday-retry (~> 1.0)
multipart-post (>= 1.2, < 3)
ruby2_keywords (>= 0.0.4)
faraday-cookie_jar (0.0.8)
faraday (>= 0.8.0)
@@ -63,26 +61,21 @@ GEM
faraday-em_synchrony (1.0.1)
faraday-excon (1.1.0)
faraday-httpclient (1.0.1)
faraday-multipart (1.2.0)
multipart-post (~> 2.0)
faraday-net_http (1.0.2)
faraday-net_http_persistent (1.2.0)
faraday-patron (1.0.0)
faraday-rack (1.0.0)
faraday-retry (1.0.4)
faraday_middleware (1.2.1)
faraday (~> 1.0)
fastimage (2.4.1)
fastlane (2.236.0)
CFPropertyList (>= 2.3, < 5.0.0)
abbrev (~> 0.1)
fastimage (2.4.0)
fastlane (2.229.0)
CFPropertyList (>= 2.3, < 4.0.0)
abbrev (~> 0.1.2)
addressable (>= 2.8, < 3.0.0)
artifactory (~> 3.0)
aws-sdk-s3 (~> 1.197)
aws-sdk-s3 (~> 1.0)
babosa (>= 1.0.3, < 2.0.0)
base64 (~> 0.2)
benchmark (>= 0.1.0)
bundler (>= 2.4.0, < 5.0.0)
bundler (>= 1.12.0, < 3.0.0)
colored (~> 1.2)
commander (~> 4.6)
csv (~> 3.3)
@@ -93,25 +86,21 @@ GEM
faraday-cookie_jar (~> 0.0.6)
faraday_middleware (~> 1.0)
fastimage (>= 2.1.0, < 3.0.0)
fastlane-sirp (>= 1.1.0)
fastlane-sirp (>= 1.0.0)
gh_inspector (>= 1.1.2, < 2.0.0)
google-apis-androidpublisher_v3 (~> 0.3)
google-apis-playcustomapp_v1 (~> 0.1)
google-cloud-env (>= 1.6.0, < 2.3.0)
google-cloud-env (>= 1.6.0, < 2.0.0)
google-cloud-storage (~> 1.31)
highline (~> 2.0)
http-cookie (~> 1.0.5)
json (< 3.0.0)
jwt (>= 2.10.3, < 4)
logger (>= 1.6, < 2.0)
jwt (>= 2.1.0, < 3)
mini_magick (>= 4.9.4, < 5.0.0)
multi_json (~> 1.12)
multipart-post (>= 2.0.0, < 3.0.0)
mutex_m (~> 0.3)
mutex_m (~> 0.3.0)
naturally (~> 2.2)
nkf (~> 0.2)
optparse (>= 0.1.1, < 1.0.0)
ostruct (>= 0.1.0)
plist (>= 3.1.0, < 4.0.0)
rubyzip (>= 2.0.0, < 3.0.0)
security (= 0.1.5)
@@ -126,48 +115,44 @@ GEM
xcpretty-travis-formatter (>= 0.0.3, < 2.0.0)
fastlane-plugin-huawei_appgallery_connect (1.0.31)
cgi
fastlane-sirp (1.1.0)
fastlane-sirp (1.0.0)
sysrandom (~> 1.0)
gh_inspector (1.1.3)
google-apis-androidpublisher_v3 (0.102.0)
google-apis-core (>= 0.15.0, < 2.a)
google-apis-core (0.18.0)
google-apis-androidpublisher_v3 (0.54.0)
google-apis-core (>= 0.11.0, < 2.a)
google-apis-core (0.11.3)
addressable (~> 2.5, >= 2.5.1)
googleauth (~> 1.9)
httpclient (>= 2.8.3, < 3.a)
googleauth (>= 0.16.2, < 2.a)
httpclient (>= 2.8.1, < 3.a)
mini_mime (~> 1.0)
mutex_m
representable (~> 3.0)
retriable (>= 2.0, < 4.a)
google-apis-iamcredentials_v1 (0.27.0)
google-apis-core (>= 0.15.0, < 2.a)
google-apis-playcustomapp_v1 (0.17.0)
google-apis-core (>= 0.15.0, < 2.a)
google-apis-storage_v1 (0.63.0)
google-apis-core (>= 0.15.0, < 2.a)
rexml
google-apis-iamcredentials_v1 (0.17.0)
google-apis-core (>= 0.11.0, < 2.a)
google-apis-playcustomapp_v1 (0.13.0)
google-apis-core (>= 0.11.0, < 2.a)
google-apis-storage_v1 (0.31.0)
google-apis-core (>= 0.11.0, < 2.a)
google-cloud-core (1.8.0)
google-cloud-env (>= 1.0, < 3.a)
google-cloud-errors (~> 1.0)
google-cloud-env (2.2.2)
base64 (~> 0.2)
faraday (>= 1.0, < 3.a)
google-cloud-errors (1.6.0)
google-cloud-storage (1.60.0)
google-cloud-env (1.6.0)
faraday (>= 0.17.3, < 3.0)
google-cloud-errors (1.5.0)
google-cloud-storage (1.47.0)
addressable (~> 2.8)
digest-crc (~> 0.4)
google-apis-core (>= 0.18, < 2)
google-apis-iamcredentials_v1 (~> 0.18)
google-apis-storage_v1 (>= 0.42)
google-apis-iamcredentials_v1 (~> 0.1)
google-apis-storage_v1 (~> 0.31.0)
google-cloud-core (~> 1.6)
googleauth (~> 1.9)
googleauth (>= 0.16.2, < 2.a)
mini_mime (~> 1.0)
google-logging-utils (0.2.0)
googleauth (1.17.0)
faraday (>= 1.0, < 3.a)
google-cloud-env (~> 2.2)
google-logging-utils (~> 0.1)
jwt (>= 1.4, < 4.0)
googleauth (1.8.1)
faraday (>= 0.17.3, < 3.a)
jwt (>= 1.4, < 3.0)
multi_json (~> 1.11)
os (>= 0.9, < 2.0)
pstore (~> 0.1)
signet (>= 0.16, < 2.a)
highline (2.0.3)
http-cookie (1.0.8)
@@ -175,42 +160,41 @@ GEM
httpclient (2.9.0)
mutex_m
jmespath (1.6.2)
json (2.19.8)
jwt (2.10.3)
json (2.18.0)
jwt (2.10.2)
base64
logger (1.7.0)
mini_magick (4.13.2)
mini_mime (1.1.5)
multi_json (1.21.1)
multi_json (1.19.1)
multipart-post (2.4.1)
mutex_m (0.3.0)
nanaimo (0.4.0)
naturally (2.3.0)
nkf (0.2.0)
optparse (0.8.1)
os (1.1.4)
ostruct (0.6.3)
plist (3.7.2)
pstore (0.2.1)
public_suffix (6.0.2)
rake (13.4.2)
rake (13.3.1)
representable (3.2.0)
declarative (< 0.1.0)
trailblazer-option (>= 0.1.1, < 0.2.0)
uber (< 0.2.0)
retriable (3.8.0)
retriable (3.1.2)
rexml (3.4.4)
rouge (3.28.0)
ruby2_keywords (0.0.5)
rubyzip (2.4.1)
security (0.1.5)
signet (0.22.0)
signet (0.21.0)
addressable (~> 2.8)
faraday (>= 0.17.5, < 3.a)
jwt (>= 1.5, < 4.0)
multi_json (~> 1.10)
simctl (1.6.10)
CFPropertyList
naturally
sysrandom (1.0.5)
terminal-notifier (2.0.0)
terminal-table (3.0.2)
unicode-display_width (>= 1.1.1, < 3)
-1
View File
@@ -48,7 +48,6 @@ If you want to [contribute](https://nextcloud.com/contribute/) to the Nextcloud
* 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
* Add [automated tests](CONTRIBUTING.md#testing) for existing 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
-6
View File
@@ -29,12 +29,6 @@ precedence = "aggregate"
SPDX-FileCopyrightText = "2015-2016 ownCloud Inc."
SPDX-License-Identifier = "GPL-2.0-only"
[[annotations]]
path = ["CLAUDE.md", "app/libs/local-maven/**/*.aar", "app/libs/local-maven/**/*.pom"]
precedence = "aggregate"
SPDX-FileCopyrightText = "2026 Nextcloud GmbH and Nextcloud contributors"
SPDX-License-Identifier = "AGPL-3.0-or-later"
[[annotations]]
path = ["app/src/**/res/mipmap-**dpi/ic_launcher.png", "app/src/**/ic_launcher-web.png", "src/**/fastlane/metadata/en-US/images/*.png", "src/generic/fastlane/metadata/android/en-US/images/icon.png", "src/versionDev/fastlane/metadata/android/en-US/images/icon.png", "app/src/main/ic_launcher-web-round.png"]
precedence = "aggregate"
+1 -2
View File
@@ -1,4 +1,3 @@
# SPDX-FileCopyrightText: 2022-2024 Nextcloud GmbH and Nextcloud contributors
# SPDX-License-Identifier: AGPL-3.0-or-later OR GPL-2.0-only
/build
/.cxx
/build
+39 -39
View File
@@ -6,6 +6,7 @@
*/
@file:Suppress("UnstableApiUsage", "DEPRECATION")
import com.android.build.gradle.internal.api.ApkVariantOutputImpl
import com.github.spotbugs.snom.Confidence
import com.github.spotbugs.snom.Effort
import com.github.spotbugs.snom.SpotBugsTask
@@ -23,9 +24,11 @@ plugins {
alias(libs.plugins.android.application)
alias(libs.plugins.kotlin.compose)
alias(libs.plugins.spotless)
alias(libs.plugins.kapt)
alias(libs.plugins.ksp)
alias(libs.plugins.kotlin.serialization)
alias(libs.plugins.kotlin.parcelize)
alias(libs.plugins.jetbrains.kotlin.android)
alias(libs.plugins.spotbugs)
alias(libs.plugins.detekt)
// needed to make renovate run without shot, as shot requires Android SDK
@@ -59,10 +62,10 @@ configurations.configureEach {
}
// semantic versioning for version code
val versionMajor = 34
val versionMinor = 1
val versionMajor = 3
val versionMinor = 36
val versionPatch = 0
val versionBuild = 50 // 0-50=Alpha / 51-98=RC / 90-99=stable
val versionBuild = 0 // 0-50=Alpha / 51-98=RC / 90-99=stable
val ndkEnv = buildMap {
file("${project.rootDir}/ndk.env").readLines().forEach {
@@ -72,7 +75,7 @@ val ndkEnv = buildMap {
}
val configProps = Properties().apply {
val file = rootProject.file("gradle.properties")
val file = rootProject.file(".gradle/config.properties")
if (file.exists()) load(FileInputStream(file))
}
@@ -81,14 +84,8 @@ val ncTestServerPassword = configProps["NC_TEST_SERVER_PASSWORD"]
val ncTestServerBaseUrl = configProps["NC_TEST_SERVER_BASEURL"]
android {
// install this NDK version and CMake to produce smaller APKs. Build will still work if not installed
// install this NDK version and Cmake to produce smaller APKs. Build will still work if not installed
ndkVersion = "${ndkEnv["NDK_VERSION"]}"
externalNativeBuild {
cmake {
version = "${ndkEnv["CMAKE_VERSION"]}"
path = file("src/main/cpp/CMakeLists.txt")
}
}
namespace = "com.owncloud.android"
testNamespace = "${namespace}.test"
@@ -96,28 +93,29 @@ android {
androidResources.generateLocaleConfig = true
defaultConfig {
testInstrumentationRunnerArguments += mapOf(
"TEST_SERVER_URL" to ncTestServerBaseUrl.toString(),
"TEST_SERVER_USERNAME" to ncTestServerUsername.toString(),
"TEST_SERVER_PASSWORD" to ncTestServerPassword.toString(),
"disableAnalytics" to "true"
)
applicationId = "com.nextcloud.client"
minSdk = 28
targetSdk = 36
compileSdk = 36
ndk {
abiFilters += listOf("arm64-v8a", "x86_64")
}
buildConfigField("boolean", "CI", ciBuild.toString())
buildConfigField("boolean", "RUNTIME_PERF_ANALYSIS", perfAnalysis.toString())
javaCompileOptions.annotationProcessorOptions {
arguments += mapOf("room.schemaLocation" to "$projectDir/schemas")
}
// arguments to be passed to functional tests
testInstrumentationRunner = if (shotTest) "com.karumi.shot.ShotTestRunner"
else "com.nextcloud.client.TestRunner"
testInstrumentationRunnerArguments += mapOf(
"TEST_SERVER_URL" to ncTestServerBaseUrl.toString(),
"TEST_SERVER_USERNAME" to ncTestServerUsername.toString(),
"TEST_SERVER_PASSWORD" to ncTestServerPassword.toString()
)
testInstrumentationRunnerArguments["disableAnalytics"] = "true"
versionCode = versionMajor * 10000000 + versionMinor * 10000 + versionPatch * 100 + versionBuild
versionName = when {
versionBuild > 89 -> "${versionMajor}.${versionMinor}.${versionPatch}"
@@ -137,8 +135,13 @@ android {
debug {
enableUnitTestCoverage = project.hasProperty("coverage")
enableAndroidTestCoverage = project.hasProperty("coverage")
resConfigs("xxxhdpi")
buildConfigField(
"String",
"NC_TEST_SERVER_DATA_STRING",
"\"nc://login/user:${ncTestServerUsername}&password:${ncTestServerPassword}&server:${ncTestServerBaseUrl}\""
)
}
}
@@ -175,6 +178,12 @@ android {
}
}
applicationVariants.configureEach {
outputs.configureEach {
if (this is ApkVariantOutputImpl) this.outputFileName = "${this.baseName}-${this.versionCode}.apk"
}
}
testOptions {
unitTests.isReturnDefaultValues = true
animationsDisabled = true
@@ -193,12 +202,11 @@ android {
viewBinding = true
aidl = true
compose = true
prefab = true
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_21
targetCompatibility = JavaVersion.VERSION_21
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
lint {
@@ -219,9 +227,7 @@ android {
"MissingQuantity",
"IconXmlAndPng",
"SelectedPhotoAccess",
"UnsafeIntentLaunch",
"OldTargetApi",
"AndroidGradlePluginVersion"
"UnsafeIntentLaunch"
)
)
htmlOutput = layout.buildDirectory.file("reports/lint/lint.html").get().asFile
@@ -237,12 +243,11 @@ android {
}
kapt.useBuildCache = true
ksp.arg("room.schemaLocation", "$projectDir/schemas")
// Configure KSP for test variants
ksp.arg("dagger.moduleName", project.name)
kotlin.compilerOptions.jvmTarget.set(JvmTarget.JVM_21)
kotlin.compilerOptions.jvmTarget.set(JvmTarget.JVM_17)
spotless.kotlin {
target("**/*.kt")
@@ -349,7 +354,6 @@ dependencies {
implementation(libs.compose.ui)
implementation(libs.compose.ui.graphics)
implementation(libs.compose.material3)
implementation(libs.compose.activity)
implementation(libs.compose.ui.tooling.preview)
implementation(libs.foundation)
debugImplementation(libs.compose.ui.tooling)
@@ -376,7 +380,6 @@ dependencies {
// region UI
implementation(libs.bundles.ui)
implementation(libs.browser)
// endregion
// region Worker
@@ -426,7 +429,6 @@ dependencies {
// endregion
// region AppScan, document scanner not available on FDroid (generic) due to OpenCV binaries
// To enable the feature for another variant, add it here.
"gplayImplementation"(project(":appscan"))
"huaweiImplementation"(project(":appscan"))
"qaImplementation"(project(":appscan"))
@@ -443,12 +445,10 @@ dependencies {
implementation(libs.dagger.android.support)
ksp(libs.dagger.compiler)
ksp(libs.dagger.processor)
kspAndroidTest(libs.dagger.compiler)
// endregion
// region Crypto
implementation(libs.conscrypt.android)
implementation(libs.android.openssl)
// endregion
// region Library
@@ -461,6 +461,7 @@ dependencies {
// region Markdown rendering
implementation(libs.bundles.markdown.rendering)
kapt(libs.prism4j.bundler)
// endregion
// region Image cropping / rotation
@@ -509,9 +510,8 @@ dependencies {
"gplayImplementation"(libs.bundles.gplay)
// endregion
// region common
// region UI
implementation(libs.ui)
implementation(libs.common.core)
// endregion
// region Image loading
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,203 @@
/*
* Nextcloud - Android Client
*
* SPDX-FileCopyrightText: 2020 Tobias Kaminsky <[email protected]>
* SPDX-FileCopyrightText: 2020 Nextcloud GmbH
* SPDX-License-Identifier: AGPL-3.0-or-later OR GPL-2.0-only
*/
package com.nextcloud.client
import android.view.View
import androidx.test.core.app.launchActivity
import androidx.test.espresso.Espresso.onView
import androidx.test.espresso.assertion.ViewAssertions.matches
import androidx.test.espresso.contrib.DrawerActions
import androidx.test.espresso.matcher.ViewMatchers.isDisplayed
import androidx.test.espresso.matcher.ViewMatchers.isRoot
import androidx.test.espresso.matcher.ViewMatchers.withId
import com.owncloud.android.AbstractIT
import com.owncloud.android.R
import com.owncloud.android.lib.resources.activities.model.Activity
import com.owncloud.android.lib.resources.activities.model.RichElement
import com.owncloud.android.lib.resources.activities.model.RichObject
import com.owncloud.android.lib.resources.activities.models.PreviewObject
import com.owncloud.android.lib.resources.status.OCCapability
import com.owncloud.android.ui.activities.ActivitiesActivity
import com.owncloud.android.utils.ScreenshotTest
import org.junit.Test
import java.util.GregorianCalendar
class ActivitiesActivityIT : AbstractIT() {
private val testClassName = "com.nextcloud.client.ActivitiesActivityIT"
@Test
@ScreenshotTest
fun openDrawer() {
launchActivity<ActivitiesActivity>().use { scenario ->
scenario.onActivity { sut ->
sut.dismissSnackbar()
}
onView(withId(R.id.drawer_layout)).perform(DrawerActions.open())
scenario.onActivity { sut ->
val screenShotName = createName("${testClassName}_openDrawer", "")
screenshotViaName(sut, screenShotName)
}
onView(withId(R.id.drawer_layout)).check(matches(isDisplayed()))
}
}
@Test
@ScreenshotTest
fun loading() {
launchActivity<ActivitiesActivity>().use { scenario ->
scenario.onActivity { sut ->
sut.dismissSnackbar()
sut.binding.emptyList.root.visibility = View.GONE
sut.binding.swipeContainingList.visibility = View.GONE
sut.binding.loadingContent.visibility = View.VISIBLE
}
val screenShotName = createName(testClassName + "_" + "loading", "")
onView(isRoot()).check(matches(isDisplayed()))
scenario.onActivity { sut ->
screenshotViaName(sut, screenShotName)
}
}
}
@Test
@ScreenshotTest
fun empty() {
launchActivity<ActivitiesActivity>().use { scenario ->
scenario.onActivity { sut ->
sut.showActivities(mutableListOf(), nextcloudClient, -1)
sut.setProgressIndicatorState(false)
sut.dismissSnackbar()
}
val screenShotName = createName(testClassName + "_" + "empty", "")
onView(isRoot()).check(matches(isDisplayed()))
scenario.onActivity { sut ->
screenshotViaName(sut, screenShotName)
}
}
}
@Test
@ScreenshotTest
@SuppressWarnings("MagicNumber")
fun showActivities() {
val capability = OCCapability()
capability.versionMayor = 20
fileDataStorageManager.saveCapabilities(capability)
val date = GregorianCalendar()
date.set(2005, 4, 17, 10, 35, 30) // random date
val richObjectList: ArrayList<RichObject> = ArrayList()
richObjectList.add(RichObject("file", "abc", "text.txt", "/text.txt", "link", "tag"))
richObjectList.add(RichObject("file", "1", "text.txt", "/text.txt", "link", "tag"))
val previewObjectList1: ArrayList<PreviewObject> = ArrayList()
previewObjectList1.add(PreviewObject(1, "source", "link", true, "text/plain", "view", "test1.txt"))
val previewObjectList3: ArrayList<PreviewObject> = ArrayList()
previewObjectList3.add(PreviewObject(1, "source", "link", true, "image/jpg", "view", "test1.jpg"))
val activities = mutableListOf(
Activity(
1,
date.time,
date.time,
"files",
"file_changed",
"user1",
"user1",
"You changed text.txt",
"",
"icon",
"link",
"files",
"1",
"/text.txt",
previewObjectList1,
RichElement("", richObjectList)
),
Activity(
1,
date.time,
date.time,
"dav",
"calendar_event",
"user1",
"user1",
"You have deleted calendar entry Appointment",
"",
"icon",
"link",
"calendar",
"35",
"",
ArrayList(),
RichElement()
),
Activity(
1,
date.time,
date.time,
"files",
"file_changed",
"user1",
"user1",
"You changed image.jpg",
"",
"icon",
"link",
"files",
"1",
"/image.jpg",
previewObjectList3,
RichElement("", richObjectList)
)
)
launchActivity<ActivitiesActivity>().use { scenario ->
scenario.onActivity { sut ->
sut.showActivities(activities as List<Any>?, nextcloudClient, -1)
sut.setProgressIndicatorState(false)
sut.dismissSnackbar()
}
val screenShotName = createName(testClassName + "_" + "showActivities", "")
onView(isRoot()).check(matches(isDisplayed()))
scenario.onActivity { sut ->
screenshotViaName(sut, screenShotName)
}
}
}
@Test
@ScreenshotTest
fun error() {
launchActivity<ActivitiesActivity>().use { scenario ->
scenario.onActivity { sut ->
sut.showEmptyContent("Error", "Error! Please try again later!")
sut.setProgressIndicatorState(false)
sut.dismissSnackbar()
}
val screenShotName = createName(testClassName + "_" + "error", "")
onView(isRoot()).check(matches(isDisplayed()))
scenario.onActivity { sut ->
screenshotViaName(sut, screenShotName)
}
}
}
}
Loaded 100 of 797 files, more files were not shown because too many files have changed in this diff. Show more