Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f004ce8e5d | ||
|
|
2d9cc06165 | ||
|
|
ab23c04def | ||
|
|
eaf1230d2e | ||
|
|
8e28921113 | ||
|
|
a639e8441c | ||
|
|
311e7fcd62 | ||
|
|
8d1f889594 | ||
|
|
ae9bd40427 | ||
|
|
0d46d951e7 | ||
|
|
860558c294 | ||
|
|
f91550c1b2 | ||
|
|
72abd7ba3a | ||
|
|
890090e3f8 | ||
|
|
e4d26e44d4 | ||
|
|
8567559cd1 | ||
|
|
333b844878 | ||
|
|
ce11af238f | ||
|
|
10d44368db | ||
|
|
fb26ddd88f | ||
|
|
fd8aae8e40 | ||
|
|
e8ce558a4e | ||
|
|
c9246210de | ||
|
|
719551505e | ||
|
|
a037786328 | ||
|
|
195703a527 | ||
|
|
a24e6e9cfc | ||
|
|
503d6685a2 | ||
|
|
22c916e6db | ||
|
|
879286d05f | ||
|
|
9e33a11930 | ||
|
|
c09eb33fd4 | ||
|
|
27632fecae | ||
|
|
67da5e0a6f | ||
|
|
065d19163f | ||
|
|
0f9e4feb79 | ||
|
|
6faceec5a5 | ||
|
|
d3502b7bba | ||
|
|
875f4ae7eb | ||
|
|
fb6cb271fe | ||
|
|
9f7699835e | ||
|
|
afaa537a45 | ||
|
|
f2c14abccb | ||
|
|
da39e19805 | ||
|
|
3a72604a78 | ||
|
|
ebd608c179 | ||
|
|
3a225d6462 | ||
|
|
ec56997da8 | ||
|
|
b6ceec7904 | ||
|
|
6c5c055855 | ||
|
|
4265f06160 | ||
|
|
3256b459e7 | ||
|
|
e8488b773c | ||
|
|
29d9ba4e52 | ||
|
|
1a7ee3e179 | ||
|
|
eaf605b2be | ||
|
|
87e859858b | ||
|
|
b3fa1e3262 | ||
|
|
b1aa3dcdaf | ||
|
|
be5cdc4169 | ||
|
|
c855ae3c00 |
No files matched your search
@@ -263,9 +263,7 @@ steps:
|
||||
- master
|
||||
- stable-*
|
||||
trigger:
|
||||
branch:
|
||||
- master
|
||||
event:
|
||||
- cron
|
||||
cron:
|
||||
- nightly
|
||||
- daily
|
||||
@@ -1,91 +1,17 @@
|
||||
version: 2
|
||||
updates:
|
||||
- package-ecosystem: "github-actions"
|
||||
directory: "/" # Location of package manifests
|
||||
schedule:
|
||||
interval: "weekly"
|
||||
directory: "/"
|
||||
schedule:
|
||||
interval: "weekly"
|
||||
- package-ecosystem: gradle
|
||||
directory: "/"
|
||||
schedule:
|
||||
interval: daily
|
||||
time: "03:00"
|
||||
timezone: Europe/Paris
|
||||
open-pull-requests-limit: 10
|
||||
labels:
|
||||
- 2. to review
|
||||
- dependencies
|
||||
ignore:
|
||||
- dependency-name: com.github.albfernandez:juniversalchardet
|
||||
versions:
|
||||
- "> 2.0.3"
|
||||
- dependency-name: com.github.albfernandez:juniversalchardet
|
||||
versions:
|
||||
- "< v2.2.0.999999"
|
||||
- ">= v2.2.0.a"
|
||||
- dependency-name: com.github.albfernandez:juniversalchardet
|
||||
versions:
|
||||
- "< v2.3.999999"
|
||||
- ">= v2.3.a"
|
||||
- dependency-name: com.github.bumptech.glide:glide
|
||||
versions:
|
||||
- ">= 4.9.a"
|
||||
- "< 4.10"
|
||||
- dependency-name: com.github.bumptech.glide:glide
|
||||
versions:
|
||||
- ">= 4.a"
|
||||
- "< 5"
|
||||
- dependency-name: com.github.nextcloud:android-library
|
||||
versions:
|
||||
- "< 2"
|
||||
- ">= 1.a"
|
||||
- dependency-name: gradle.plugin.com.github.spotbugs:spotbugs-gradle-plugin
|
||||
versions:
|
||||
- ">= 1.6.10.a"
|
||||
- "< 1.6.11"
|
||||
- dependency-name: gradle.plugin.com.github.spotbugs:spotbugs-gradle-plugin
|
||||
versions:
|
||||
- ">= 1.6.11.a"
|
||||
- "< 1.6.12"
|
||||
- dependency-name: gradle.plugin.com.github.spotbugs:spotbugs-gradle-plugin
|
||||
versions:
|
||||
- ">= 1.7.0.a"
|
||||
- "< 1.7.1"
|
||||
- dependency-name: gradle.plugin.com.github.spotbugs:spotbugs-gradle-plugin
|
||||
versions:
|
||||
- ">= 1.7.1.a"
|
||||
- "< 1.7.2"
|
||||
- dependency-name: org.apache.jackrabbit:jackrabbit-webdav
|
||||
versions:
|
||||
- ">= 2.16.a"
|
||||
- "< 2.17"
|
||||
- dependency-name: org.apache.jackrabbit:jackrabbit-webdav
|
||||
versions:
|
||||
- ">= 2.17.a"
|
||||
- "< 2.18"
|
||||
- dependency-name: org.apache.jackrabbit:jackrabbit-webdav
|
||||
versions:
|
||||
- ">= 2.18.a"
|
||||
- "< 2.19"
|
||||
- dependency-name: org.apache.jackrabbit:jackrabbit-webdav
|
||||
versions:
|
||||
- ">= 2.19.a"
|
||||
- "< 2.20"
|
||||
- dependency-name: org.apache.jackrabbit:jackrabbit-webdav
|
||||
versions:
|
||||
- ">= 2.20.a"
|
||||
- "< 2.21"
|
||||
- dependency-name: org.apache.jackrabbit:jackrabbit-webdav
|
||||
versions:
|
||||
- ">= 2.21.a"
|
||||
- "< 2.22"
|
||||
- dependency-name: org.objenesis:objenesis
|
||||
versions:
|
||||
- "> 2.6"
|
||||
- dependency-name: pl.droidsonroids.gif:android-gif-drawable
|
||||
versions:
|
||||
- "< 1.2.17"
|
||||
- ">= 1.2.16.a"
|
||||
- dependency-name: pl.droidsonroids.gif:android-gif-drawable
|
||||
versions:
|
||||
- ">= 1.2.17.a"
|
||||
- "< 1.2.18"
|
||||
directory: "/"
|
||||
schedule:
|
||||
interval: daily
|
||||
time: "03:00"
|
||||
timezone: Europe/Paris
|
||||
rebase-strategy: "disabled"
|
||||
open-pull-requests-limit: 10
|
||||
labels:
|
||||
- 2. to review
|
||||
- dependencies
|
||||
@@ -7,7 +7,7 @@ jobs:
|
||||
auto-approve:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: hmarr/auto-approve-action@v2.0.0
|
||||
- uses: hmarr/auto-approve-action@v2.1.0
|
||||
if: github.actor == 'dependabot[bot]' || github.actor == 'dependabot-preview[bot]'
|
||||
with:
|
||||
github-token: "${{ secrets.GITHUB_TOKEN }}"
|
||||
@@ -6,41 +6,41 @@
|
||||
name: Rebase command
|
||||
|
||||
on:
|
||||
issue_comment:
|
||||
types: created
|
||||
issue_comment:
|
||||
types: created
|
||||
|
||||
jobs:
|
||||
rebase:
|
||||
runs-on: ubuntu-latest
|
||||
rebase:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
# On pull requests and if the comment starts with `/rebase`
|
||||
if: github.event.issue.pull_request != '' && startsWith(github.event.comment.body, '/rebase')
|
||||
# On pull requests and if the comment starts with `/rebase`
|
||||
if: github.event.issue.pull_request != '' && startsWith(github.event.comment.body, '/rebase')
|
||||
|
||||
steps:
|
||||
- name: Add reaction on start
|
||||
uses: peter-evans/create-or-update-comment@v1
|
||||
with:
|
||||
token: ${{ secrets.COMMAND_BOT_PAT }}
|
||||
repository: ${{ github.event.repository.full_name }}
|
||||
comment-id: ${{ github.event.comment.id }}
|
||||
reaction-type: "+1"
|
||||
steps:
|
||||
- name: Add reaction on start
|
||||
uses: peter-evans/create-or-update-comment@v1
|
||||
with:
|
||||
token: ${{ secrets.COMMAND_BOT_PAT }}
|
||||
repository: ${{ github.event.repository.full_name }}
|
||||
comment-id: ${{ github.event.comment.id }}
|
||||
reaction-type: "+1"
|
||||
|
||||
- name: Checkout the latest code
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: 0
|
||||
token: ${{ secrets.COMMAND_BOT_PAT }}
|
||||
- name: Checkout the latest code
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: 0
|
||||
token: ${{ secrets.COMMAND_BOT_PAT }}
|
||||
|
||||
- name: Automatic Rebase
|
||||
uses: cirrus-actions/[email protected]
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.COMMAND_BOT_PAT }}
|
||||
- name: Automatic Rebase
|
||||
uses: cirrus-actions/[email protected]
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.COMMAND_BOT_PAT }}
|
||||
|
||||
- name: Add reaction on failure
|
||||
uses: peter-evans/create-or-update-comment@v1
|
||||
if: failure()
|
||||
with:
|
||||
token: ${{ secrets.COMMAND_BOT_PAT }}
|
||||
repository: ${{ github.event.repository.full_name }}
|
||||
comment-id: ${{ github.event.comment.id }}
|
||||
reaction-type: "-1"
|
||||
- name: Add reaction on failure
|
||||
uses: peter-evans/create-or-update-comment@v1
|
||||
if: failure()
|
||||
with:
|
||||
token: ${{ secrets.COMMAND_BOT_PAT }}
|
||||
repository: ${{ github.event.repository.full_name }}
|
||||
comment-id: ${{ github.event.comment.id }}
|
||||
reaction-type: "-1"
|
||||
@@ -12,34 +12,70 @@ jobs:
|
||||
matrix:
|
||||
scheme: [ Light ]
|
||||
color: [ blue ]
|
||||
api-level: [ 27 ]
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: set up JDK 11
|
||||
uses: actions/setup-java@v2
|
||||
|
||||
- name: Gradle cache
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: |
|
||||
~/.gradle/caches
|
||||
~/.gradle/wrapper
|
||||
key: gradle-${{ runner.os }}-${{ hashFiles('**/*.gradle*') }}-${{ hashFiles('**/gradle/wrapper/gradle-wrapper.properties') }}
|
||||
- name: AVD cache
|
||||
uses: actions/cache@v2
|
||||
id: avd-cache
|
||||
with:
|
||||
path: |
|
||||
~/.android/avd/*
|
||||
~/.android/adb*
|
||||
key: avd-${{ matrix.api-level }}
|
||||
|
||||
- uses: actions/setup-java@v2
|
||||
with:
|
||||
distribution: "adopt"
|
||||
java-version: 11
|
||||
- name: Build gplay
|
||||
|
||||
- name: create AVD and generate snapshot for caching
|
||||
if: steps.avd-cache.outputs.cache-hit != 'true'
|
||||
uses: reactivecircus/android-emulator-runner@v2
|
||||
with:
|
||||
api-level: ${{ matrix.api-level }}
|
||||
force-avd-creation: false
|
||||
arch: x86
|
||||
sdcard-path-or-size: 100M
|
||||
target: google_apis
|
||||
emulator-options: -no-window -gpu swiftshader_indirect -no-snapshot -noaudio -no-boot-anim -skin 500x833
|
||||
script: echo "Generated AVD snapshot for caching."
|
||||
|
||||
- name: Configure gradle daemon
|
||||
run: |
|
||||
mkdir -p $HOME/.gradle
|
||||
echo "org.gradle.jvmargs=-Xmx2g -XX:MaxMetaspaceSize=512m -XX:+HeapDumpOnOutOfMemoryError" > $HOME/.gradle/gradle.properties
|
||||
./gradlew assembleGplayDebug
|
||||
echo "org.gradle.caching=true" >> $HOME/.gradle/gradle.properties
|
||||
|
||||
- name: Build gplay
|
||||
run: ./gradlew assembleGplayDebug
|
||||
|
||||
- name: Delete old comments
|
||||
if: ${{ always() }}
|
||||
run: scripts/deleteOldComments.sh "${{ matrix.color }}-${{ matrix.scheme }}" "Screenshot" ${{github.event.number}} ${{ secrets.GITHUB_TOKEN }}
|
||||
- name: run tests
|
||||
|
||||
- name: Run screenshot tests
|
||||
uses: reactivecircus/android-emulator-runner@v2
|
||||
with:
|
||||
api-level: 27
|
||||
api-level: ${{ matrix.api-level }}
|
||||
force-avd-creation: false
|
||||
arch: x86
|
||||
sdcard-path-or-size: 100M
|
||||
target: google_apis
|
||||
emulator-options: -no-window -gpu swiftshader_indirect -no-snapshot -noaudio -no-boot-anim -skin 500x833
|
||||
script: ./gradlew gplayDebugExecuteScreenshotTests -Pandroid.testInstrumentationRunnerArguments.annotation=com.owncloud.android.utils.ScreenshotTest -Pandroid.testInstrumentationRunnerArguments.COLOR=${{ matrix.color }} -Pandroid.testInstrumentationRunnerArguments.DARKMODE=${{ matrix.scheme }}
|
||||
- name: upload failing results
|
||||
if: ${{ failure() }}
|
||||
env:
|
||||
LOG_USERNAME: ${{ secrets.LOG_USERNAME }}
|
||||
LOG_PASSWORD: ${{ secrets.LOG_PASSWORD }}
|
||||
run:
|
||||
scripts/uploadReport.sh "$LOG_USERNAME" "$LOG_PASSWORD" ${{github.event.number}} "${{ matrix.color }}-${{ matrix.scheme }}" "Screenshot" ${{github.event.number}} ${{ secrets.GITHUB_TOKEN }}
|
||||
scripts/uploadReport.sh "${{ secrets.LOG_USERNAME }}" "${{ secrets.LOG_PASSWORD }}" ${{github.event.number}} "${{ matrix.color }}-${{ matrix.scheme }}" "Screenshot" ${{github.event.number}} ${{ secrets.GITHUB_TOKEN }}
|
||||
- name: Archive Espresso results
|
||||
uses: actions/upload-artifact@v2
|
||||
if: ${{ always() }}
|
||||
|
||||
@@ -21,7 +21,7 @@ buildscript {
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:7.0.4'
|
||||
classpath 'com.hiya:jacoco-android:0.2'
|
||||
classpath 'com.github.spotbugs.snom:spotbugs-gradle-plugin:5.0.3'
|
||||
classpath 'com.github.spotbugs.snom:spotbugs-gradle-plugin:5.0.4'
|
||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
||||
classpath "io.gitlab.arturbosch.detekt:detekt-gradle-plugin:1.19.0"
|
||||
classpath "commons-httpclient:commons-httpclient:3.1@jar" // remove after entire switch to lib v2
|
||||
@@ -64,7 +64,7 @@ ext {
|
||||
daggerVersion = "2.40.5"
|
||||
markwonVersion = "4.6.2"
|
||||
prismVersion = "2.0.0"
|
||||
androidLibraryVersion ="b729946dd1ea9c6672387551acb9e87c7eee6c15"
|
||||
androidLibraryVersion ="013d5b6eda46fc9bb7da6c66743263a45d495fff"
|
||||
mockitoVersion = "4.2.0"
|
||||
mockkVersion = "1.12.2"
|
||||
powermockVersion = "2.0.9"
|
||||
@@ -173,8 +173,8 @@ android {
|
||||
versionDev {
|
||||
applicationId "com.nextcloud.android.beta"
|
||||
dimension "default"
|
||||
versionCode 20220107
|
||||
versionName "20220107"
|
||||
versionCode 20220113
|
||||
versionName "20220113"
|
||||
}
|
||||
|
||||
qa {
|
||||
@@ -251,7 +251,7 @@ dependencies {
|
||||
|
||||
compileOnly 'org.jbundle.util.osgi.wrapped:org.jbundle.util.osgi.wrapped.org.apache.http.client:4.1.2' // remove after entire switch to lib v2
|
||||
implementation "commons-httpclient:commons-httpclient:3.1@jar" // remove after entire switch to lib v2
|
||||
implementation 'org.apache.jackrabbit:jackrabbit-webdav:2.13.1' // remove after entire switch to lib v2
|
||||
implementation 'org.apache.jackrabbit:jackrabbit-webdav:2.13.5' // remove after entire switch to lib v2
|
||||
implementation 'androidx.constraintlayout:constraintlayout:2.1.2'
|
||||
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
|
||||
implementation 'com.google.android.material:material:1.4.0'
|
||||
@@ -264,7 +264,7 @@ dependencies {
|
||||
implementation "androidx.work:work-runtime:$workRuntime"
|
||||
implementation "androidx.work:work-runtime-ktx:$workRuntime"
|
||||
implementation "androidx.fragment:fragment-ktx:1.4.0"
|
||||
implementation 'com.github.albfernandez:juniversalchardet:2.0.3' // need this version for Android <7
|
||||
implementation 'com.github.albfernandez:juniversalchardet:2.3.2' // need this version for Android <7
|
||||
compileOnly 'com.google.code.findbugs:annotations:3.0.1u2'
|
||||
implementation 'commons-io:commons-io:2.11.0'
|
||||
implementation 'org.greenrobot:eventbus:3.3.1'
|
||||
@@ -317,14 +317,14 @@ dependencies {
|
||||
implementation "io.noties:prism4j:$prismVersion"
|
||||
kapt "io.noties:prism4j-bundler:$prismVersion"
|
||||
|
||||
implementation ('org.mnode.ical4j:ical4j:1.0.6') {
|
||||
implementation ('org.mnode.ical4j:ical4j:1.0.8') {
|
||||
['org.apache.commons','commons-logging'].each {
|
||||
exclude group: "$it"
|
||||
}
|
||||
}
|
||||
|
||||
if (!ciBuild) {
|
||||
debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.8'
|
||||
debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.8.1'
|
||||
}
|
||||
|
||||
// dependencies for local unit tests
|
||||
@@ -456,6 +456,9 @@ detekt {
|
||||
|
||||
shot {
|
||||
showOnlyFailingTestsInReports = ciBuild
|
||||
// CI environment renders some shadows slightly different from local VMs
|
||||
// Add a 0.5% tolerance to account for that
|
||||
tolerance = ciBuild ? 0.5: 0
|
||||
}
|
||||
|
||||
jacoco {
|
||||
|
||||
|
After Width: | Height: | Size: 14 KiB |
|
After Width: | Height: | Size: 11 KiB |
|
After Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 8.1 KiB |
|
After Width: | Height: | Size: 8.6 KiB |
|
Before Width: | Height: | Size: 23 KiB After Width: | Height: | Size: 20 KiB |
|
After Width: | Height: | Size: 21 KiB |
|
After Width: | Height: | Size: 18 KiB |
|
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 20 KiB |
|
Before Width: | Height: | Size: 22 KiB After Width: | Height: | Size: 22 KiB |
|
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 11 KiB |
|
Before Width: | Height: | Size: 35 KiB After Width: | Height: | Size: 36 KiB |
|
Before Width: | Height: | Size: 36 KiB After Width: | Height: | Size: 38 KiB |
|
Before Width: | Height: | Size: 9.6 KiB After Width: | Height: | Size: 9.6 KiB |
|
Before Width: | Height: | Size: 22 KiB After Width: | Height: | Size: 22 KiB |
|
Before Width: | Height: | Size: 16 KiB |
|
Before Width: | Height: | Size: 17 KiB After Width: | Height: | Size: 16 KiB |
|
Before Width: | Height: | Size: 17 KiB After Width: | Height: | Size: 16 KiB |
|
Before Width: | Height: | Size: 17 KiB After Width: | Height: | Size: 16 KiB |
|
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 16 KiB |
|
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 16 KiB |
|
Before Width: | Height: | Size: 7.5 KiB After Width: | Height: | Size: 7.9 KiB |
|
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 15 KiB |
|
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 12 KiB |
|
Before Width: | Height: | Size: 5.8 KiB After Width: | Height: | Size: 27 KiB |
|
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |
|
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 11 KiB |
|
Before Width: | Height: | Size: 8.1 KiB |
|
Before Width: | Height: | Size: 8.2 KiB |
|
Before Width: | Height: | Size: 8.2 KiB |
|
Before Width: | Height: | Size: 8.2 KiB |
|
Before Width: | Height: | Size: 8.2 KiB |
|
Before Width: | Height: | Size: 8.2 KiB |
|
Before Width: | Height: | Size: 43 KiB After Width: | Height: | Size: 43 KiB |
|
Before Width: | Height: | Size: 5.6 KiB After Width: | Height: | Size: 5.6 KiB |
|
Before Width: | Height: | Size: 6.6 KiB After Width: | Height: | Size: 6.6 KiB |
|
Before Width: | Height: | Size: 9.3 KiB After Width: | Height: | Size: 9.3 KiB |
|
Before Width: | Height: | Size: 26 KiB After Width: | Height: | Size: 27 KiB |
|
Before Width: | Height: | Size: 19 KiB After Width: | Height: | Size: 20 KiB |
|
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 14 KiB |
|
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 22 KiB |
|
Before Width: | Height: | Size: 21 KiB After Width: | Height: | Size: 22 KiB |
|
Before Width: | Height: | Size: 21 KiB After Width: | Height: | Size: 22 KiB |
|
Before Width: | Height: | Size: 19 KiB After Width: | Height: | Size: 20 KiB |
|
Before Width: | Height: | Size: 19 KiB After Width: | Height: | Size: 20 KiB |
|
Before Width: | Height: | Size: 25 KiB After Width: | Height: | Size: 26 KiB |
|
Before Width: | Height: | Size: 8.9 KiB After Width: | Height: | Size: 19 KiB |
|
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 23 KiB |
|
Before Width: | Height: | Size: 4.9 KiB After Width: | Height: | Size: 5.4 KiB |
|
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 13 KiB |
|
Before Width: | Height: | Size: 19 KiB After Width: | Height: | Size: 19 KiB |
|
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 14 KiB |
|
Before Width: | Height: | Size: 17 KiB After Width: | Height: | Size: 17 KiB |
|
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 16 KiB |
|
Before Width: | Height: | Size: 5.7 KiB After Width: | Height: | Size: 5.3 KiB |
|
Before Width: | Height: | Size: 50 KiB After Width: | Height: | Size: 52 KiB |
|
Before Width: | Height: | Size: 9.6 KiB After Width: | Height: | Size: 9.6 KiB |
|
Before Width: | Height: | Size: 39 KiB After Width: | Height: | Size: 39 KiB |
|
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 11 KiB |
|
Before Width: | Height: | Size: 8.7 KiB After Width: | Height: | Size: 8.7 KiB |
|
Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 18 KiB |
@@ -80,10 +80,10 @@ else
|
||||
-X POST https://api.github.com/repos/nextcloud/android/issues/$PR/comments \
|
||||
-d "{ \"body\" : \"$BRANCH_TYPE test failed, but no output was generated. Maybe a preliminary stage failed. \" }"
|
||||
|
||||
if [ -e build/reports/androidTests/connected/flavors/gplayDebugAndroidTest ] ; then
|
||||
if [ -e build/reports/androidTests/connected/flavors/gplay ] ; then
|
||||
TYPE="IT"
|
||||
BRANCH_TYPE=$BRANCH-$TYPE
|
||||
upload "build/reports/androidTests/connected/flavors/gplayDebugAndroidTest"
|
||||
upload "build/reports/androidTests/connected/flavors/gplay"
|
||||
fi
|
||||
|
||||
if [ -e build/reports/tests/testGplayDebugUnitTest ] ; then
|
||||
|
||||
@@ -1,69 +0,0 @@
|
||||
/*
|
||||
*
|
||||
* Nextcloud Android client application
|
||||
*
|
||||
* @author Tobias Kaminsky
|
||||
* Copyright (C) 2020 Tobias Kaminsky
|
||||
* Copyright (C) 2020 Nextcloud GmbH
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.nextcloud.client;
|
||||
|
||||
import android.view.View;
|
||||
|
||||
import com.owncloud.android.AbstractIT;
|
||||
import com.owncloud.android.R;
|
||||
import com.owncloud.android.ui.activities.ActivitiesActivity;
|
||||
import com.owncloud.android.utils.ScreenshotTest;
|
||||
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.rules.TestRule;
|
||||
|
||||
import androidx.test.espresso.contrib.DrawerActions;
|
||||
import androidx.test.espresso.intent.rule.IntentsTestRule;
|
||||
|
||||
import static androidx.test.espresso.Espresso.onView;
|
||||
import static androidx.test.espresso.matcher.ViewMatchers.withId;
|
||||
|
||||
|
||||
public class ActivitiesActivityIT extends AbstractIT {
|
||||
@Rule public IntentsTestRule<ActivitiesActivity> activityRule = new IntentsTestRule<>(ActivitiesActivity.class,
|
||||
true,
|
||||
false);
|
||||
|
||||
@Rule
|
||||
public final TestRule permissionRule = GrantStoragePermissionRule.grant();
|
||||
|
||||
@Test
|
||||
@ScreenshotTest
|
||||
public void openDrawer() {
|
||||
ActivitiesActivity sut = activityRule.launchActivity(null);
|
||||
|
||||
shortSleep();
|
||||
|
||||
onView(withId(R.id.drawer_layout)).perform(DrawerActions.open());
|
||||
|
||||
sut.runOnUiThread(() -> {
|
||||
sut.getBinding().emptyList.emptyListView.setVisibility(View.VISIBLE);
|
||||
sut.getBinding().list.setVisibility(View.INVISIBLE);
|
||||
});
|
||||
|
||||
waitForIdleSync();
|
||||
|
||||
screenshot(sut);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,188 @@
|
||||
/*
|
||||
*
|
||||
* Nextcloud Android client application
|
||||
*
|
||||
* @author Tobias Kaminsky
|
||||
* Copyright (C) 2020 Tobias Kaminsky
|
||||
* Copyright (C) 2020 Nextcloud GmbH
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.nextcloud.client
|
||||
|
||||
import android.view.View
|
||||
import androidx.test.espresso.Espresso
|
||||
import androidx.test.espresso.contrib.DrawerActions
|
||||
import androidx.test.espresso.intent.rule.IntentsTestRule
|
||||
import androidx.test.espresso.matcher.ViewMatchers.withId
|
||||
import com.facebook.testing.screenshot.Screenshot
|
||||
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.Rule
|
||||
import org.junit.Test
|
||||
import java.util.GregorianCalendar
|
||||
|
||||
class ActivitiesActivityIT : AbstractIT() {
|
||||
@get:Rule
|
||||
var activityRule = IntentsTestRule(ActivitiesActivity::class.java, true, false)
|
||||
|
||||
@Test
|
||||
@ScreenshotTest
|
||||
fun openDrawer() {
|
||||
val sut = activityRule.launchActivity(null)
|
||||
shortSleep()
|
||||
Espresso.onView(withId(R.id.drawer_layout)).perform(DrawerActions.open())
|
||||
sut.runOnUiThread {
|
||||
sut.binding.emptyList.emptyListView.visibility = View.VISIBLE
|
||||
sut.binding.list.visibility = View.INVISIBLE
|
||||
}
|
||||
waitForIdleSync()
|
||||
screenshot(sut)
|
||||
}
|
||||
|
||||
@Test
|
||||
@ScreenshotTest
|
||||
fun loading() {
|
||||
val sut: ActivitiesActivity = activityRule.launchActivity(null)
|
||||
|
||||
Screenshot.snapActivity(sut).record()
|
||||
}
|
||||
|
||||
@Test
|
||||
@ScreenshotTest
|
||||
fun empty() {
|
||||
val sut: ActivitiesActivity = activityRule.launchActivity(null)
|
||||
|
||||
sut.runOnUiThread {
|
||||
sut.showActivities(mutableListOf(), nextcloudClient, -1)
|
||||
sut.setProgressIndicatorState(false)
|
||||
}
|
||||
|
||||
shortSleep()
|
||||
|
||||
screenshot(sut)
|
||||
}
|
||||
|
||||
@Test
|
||||
@ScreenshotTest
|
||||
@SuppressWarnings("MagicNumber")
|
||||
fun showActivities() {
|
||||
val capability = OCCapability()
|
||||
capability.versionMayor = 20
|
||||
fileDataStorageManager.saveCapabilities(capability)
|
||||
|
||||
val sut: ActivitiesActivity = activityRule.launchActivity(null)
|
||||
|
||||
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<PreviewObject>(),
|
||||
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)
|
||||
)
|
||||
)
|
||||
|
||||
sut.runOnUiThread {
|
||||
sut.showActivities(activities as List<Any>?, nextcloudClient, -1)
|
||||
sut.setProgressIndicatorState(false)
|
||||
}
|
||||
|
||||
shortSleep()
|
||||
|
||||
screenshot(sut)
|
||||
}
|
||||
|
||||
@Test
|
||||
@ScreenshotTest
|
||||
fun error() {
|
||||
val sut: ActivitiesActivity = activityRule.launchActivity(null)
|
||||
|
||||
sut.runOnUiThread {
|
||||
sut.showEmptyContent("Error", "Error! Please try again later!")
|
||||
sut.setProgressIndicatorState(false)
|
||||
}
|
||||
|
||||
shortSleep()
|
||||
|
||||
screenshot(sut)
|
||||
}
|
||||
}
|
||||
@@ -20,6 +20,9 @@
|
||||
|
||||
package com.nextcloud.client;
|
||||
|
||||
import android.Manifest;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.owncloud.android.AbstractIT;
|
||||
import com.owncloud.android.R;
|
||||
import com.owncloud.android.authentication.AuthenticatorActivity;
|
||||
@@ -49,7 +52,7 @@ public class AuthenticatorActivityIT extends AbstractIT {
|
||||
@ScreenshotTest
|
||||
public void login() {
|
||||
AuthenticatorActivity sut = activityRule.launchActivity(null);
|
||||
onView(withId(R.id.host_url_input)).perform(typeText(URL));
|
||||
((TextView) sut.findViewById(R.id.host_url_input)).setText(URL);
|
||||
sut.runOnUiThread(() -> sut.getAccountSetupBinding().hostUrlInput.clearFocus());
|
||||
screenshot(sut);
|
||||
}
|
||||
|
||||
@@ -41,7 +41,6 @@ import org.greenrobot.eventbus.EventBus;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.rules.TestRule;
|
||||
|
||||
import androidx.test.espresso.Espresso;
|
||||
import androidx.test.espresso.contrib.DrawerActions;
|
||||
@@ -60,9 +59,6 @@ public class FileDisplayActivityIT extends AbstractOnServerIT {
|
||||
true,
|
||||
false);
|
||||
|
||||
@Rule
|
||||
public final TestRule permissionRule = GrantStoragePermissionRule.grant();
|
||||
|
||||
@Test
|
||||
// @ScreenshotTest // todo run without real server
|
||||
public void showShares() {
|
||||
|
||||
@@ -1,114 +0,0 @@
|
||||
/*
|
||||
*
|
||||
* Nextcloud Android client application
|
||||
*
|
||||
* @author Tobias Kaminsky
|
||||
* Copyright (C) 2019 Tobias Kaminsky
|
||||
* Copyright (C) 2019 Nextcloud GmbH
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.nextcloud.client;
|
||||
|
||||
import com.owncloud.android.AbstractIT;
|
||||
import com.owncloud.android.R;
|
||||
import com.owncloud.android.ui.activity.FileDisplayActivity;
|
||||
import com.owncloud.android.ui.fragment.OCFileListFragment;
|
||||
import com.owncloud.android.utils.ScreenshotTest;
|
||||
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.rules.TestRule;
|
||||
|
||||
import androidx.test.espresso.contrib.DrawerActions;
|
||||
import androidx.test.espresso.contrib.NavigationViewActions;
|
||||
import androidx.test.espresso.intent.rule.IntentsTestRule;
|
||||
|
||||
import static androidx.test.espresso.Espresso.onView;
|
||||
import static androidx.test.espresso.matcher.ViewMatchers.withId;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
|
||||
public class FileDisplayActivityScreenshotIT extends AbstractIT {
|
||||
@Rule public IntentsTestRule<FileDisplayActivity> activityRule = new IntentsTestRule<>(FileDisplayActivity.class,
|
||||
true,
|
||||
false);
|
||||
|
||||
@Rule
|
||||
public final TestRule permissionRule = GrantStoragePermissionRule.grant();
|
||||
|
||||
@Test
|
||||
@ScreenshotTest
|
||||
public void open() {
|
||||
FileDisplayActivity sut = activityRule.launchActivity(null);
|
||||
|
||||
sut.getListOfFilesFragment().setFabEnabled(false);
|
||||
sut.getListOfFilesFragment().setEmptyListLoadingMessage();
|
||||
sut.getListOfFilesFragment().setLoading(false);
|
||||
waitForIdleSync();
|
||||
|
||||
shortSleep();
|
||||
|
||||
screenshot(sut);
|
||||
}
|
||||
|
||||
//@Test
|
||||
//@ScreenshotTest
|
||||
public void showMediaThenAllFiles() {
|
||||
FileDisplayActivity fileDisplayActivity = activityRule.launchActivity(null);
|
||||
OCFileListFragment sut = fileDisplayActivity.getListOfFilesFragment();
|
||||
assertNotNull(sut);
|
||||
|
||||
sut.setFabEnabled(false);
|
||||
sut.setEmptyListLoadingMessage();
|
||||
sut.setLoading(false);
|
||||
|
||||
// open drawer
|
||||
onView(withId(R.id.drawer_layout)).perform(DrawerActions.open());
|
||||
|
||||
// click "all files"
|
||||
onView(withId(R.id.nav_view))
|
||||
.perform(NavigationViewActions.navigateTo(R.id.nav_gallery));
|
||||
|
||||
// wait
|
||||
shortSleep();
|
||||
|
||||
// click "all files"
|
||||
onView(withId(R.id.drawer_layout)).perform(DrawerActions.open());
|
||||
onView(withId(R.id.nav_view)).perform(NavigationViewActions.navigateTo(R.id.nav_all_files));
|
||||
|
||||
// then compare screenshot
|
||||
shortSleep();
|
||||
sut.setFabEnabled(false);
|
||||
sut.setEmptyListLoadingMessage();
|
||||
sut.setLoading(false);
|
||||
shortSleep();
|
||||
screenshot(fileDisplayActivity);
|
||||
}
|
||||
|
||||
@Test
|
||||
@ScreenshotTest
|
||||
public void drawer() {
|
||||
FileDisplayActivity sut = activityRule.launchActivity(null);
|
||||
|
||||
onView(withId(R.id.drawer_layout)).perform(DrawerActions.open());
|
||||
|
||||
sut.getListOfFilesFragment().setFabEnabled(false);
|
||||
sut.getListOfFilesFragment().setEmptyListLoadingMessage();
|
||||
sut.getListOfFilesFragment().setLoading(false);
|
||||
waitForIdleSync();
|
||||
|
||||
screenshot(sut);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,116 @@
|
||||
/*
|
||||
*
|
||||
* Nextcloud Android client application
|
||||
*
|
||||
* @author Tobias Kaminsky
|
||||
* Copyright (C) 2019 Tobias Kaminsky
|
||||
* Copyright (C) 2019 Nextcloud GmbH
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.nextcloud.client
|
||||
|
||||
import android.Manifest
|
||||
import androidx.test.espresso.Espresso
|
||||
import androidx.test.espresso.contrib.DrawerActions
|
||||
import androidx.test.espresso.contrib.NavigationViewActions
|
||||
import androidx.test.espresso.intent.rule.IntentsTestRule
|
||||
import androidx.test.espresso.matcher.ViewMatchers
|
||||
import androidx.test.rule.GrantPermissionRule
|
||||
import com.owncloud.android.AbstractIT
|
||||
import com.owncloud.android.R
|
||||
import com.owncloud.android.ui.activity.FileDisplayActivity
|
||||
import com.owncloud.android.utils.ScreenshotTest
|
||||
import org.junit.Assert
|
||||
import org.junit.Rule
|
||||
import org.junit.Test
|
||||
|
||||
class FileDisplayActivityScreenshotIT : AbstractIT() {
|
||||
@get:Rule
|
||||
val activityRule = IntentsTestRule(
|
||||
FileDisplayActivity::class.java,
|
||||
true,
|
||||
false
|
||||
)
|
||||
|
||||
@get:Rule
|
||||
val permissionRule = GrantPermissionRule.grant(
|
||||
Manifest.permission.WRITE_EXTERNAL_STORAGE
|
||||
)
|
||||
|
||||
@Test
|
||||
@ScreenshotTest
|
||||
fun open() {
|
||||
val sut = activityRule.launchActivity(null)
|
||||
sut.listOfFilesFragment!!.setFabEnabled(false)
|
||||
sut.runOnUiThread {
|
||||
sut.listOfFilesFragment!!.setEmptyListLoadingMessage()
|
||||
sut.listOfFilesFragment!!.isLoading = false
|
||||
}
|
||||
|
||||
shortSleep()
|
||||
waitForIdleSync()
|
||||
screenshot(sut)
|
||||
}
|
||||
|
||||
// @Test
|
||||
// @ScreenshotTest
|
||||
fun showMediaThenAllFiles() {
|
||||
val fileDisplayActivity = activityRule.launchActivity(null)
|
||||
val sut = fileDisplayActivity.listOfFilesFragment
|
||||
Assert.assertNotNull(sut)
|
||||
sut!!.setFabEnabled(false)
|
||||
sut.setEmptyListLoadingMessage()
|
||||
sut.isLoading = false
|
||||
|
||||
// open drawer
|
||||
Espresso.onView(ViewMatchers.withId(R.id.drawer_layout)).perform(DrawerActions.open())
|
||||
|
||||
// click "all files"
|
||||
Espresso.onView(ViewMatchers.withId(R.id.nav_view))
|
||||
.perform(NavigationViewActions.navigateTo(R.id.nav_gallery))
|
||||
|
||||
// wait
|
||||
shortSleep()
|
||||
|
||||
// click "all files"
|
||||
Espresso.onView(ViewMatchers.withId(R.id.drawer_layout)).perform(DrawerActions.open())
|
||||
Espresso.onView(ViewMatchers.withId(R.id.nav_view))
|
||||
.perform(NavigationViewActions.navigateTo(R.id.nav_all_files))
|
||||
|
||||
// then compare screenshot
|
||||
shortSleep()
|
||||
sut.setFabEnabled(false)
|
||||
sut.setEmptyListLoadingMessage()
|
||||
sut.isLoading = false
|
||||
shortSleep()
|
||||
screenshot(fileDisplayActivity)
|
||||
}
|
||||
|
||||
@Test
|
||||
@ScreenshotTest
|
||||
fun drawer() {
|
||||
val sut = activityRule.launchActivity(null)
|
||||
Espresso.onView(ViewMatchers.withId(R.id.drawer_layout)).perform(DrawerActions.open())
|
||||
sut.listOfFilesFragment!!.setFabEnabled(false)
|
||||
sut.listOfFilesFragment!!.setEmptyListLoadingMessage()
|
||||
sut.listOfFilesFragment!!.isLoading = false
|
||||
sut.runOnUiThread {
|
||||
sut.hideInfoBox()
|
||||
}
|
||||
|
||||
waitForIdleSync()
|
||||
screenshot(sut)
|
||||
}
|
||||
}
|
||||
@@ -30,7 +30,6 @@ import com.owncloud.android.utils.ScreenshotTest;
|
||||
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.rules.TestRule;
|
||||
|
||||
import androidx.test.espresso.intent.rule.IntentsTestRule;
|
||||
|
||||
@@ -40,9 +39,6 @@ public class FirstRunActivityIT extends AbstractIT {
|
||||
true,
|
||||
false);
|
||||
|
||||
@Rule
|
||||
public final TestRule permissionRule = GrantStoragePermissionRule.grant();
|
||||
|
||||
@Test
|
||||
@ScreenshotTest
|
||||
public void open() {
|
||||
|
||||
@@ -1,90 +0,0 @@
|
||||
/*
|
||||
*
|
||||
* Nextcloud Android client application
|
||||
*
|
||||
* @author Tobias Kaminsky
|
||||
* Copyright (C) 2019 Tobias Kaminsky
|
||||
* Copyright (C) 2019 Nextcloud GmbH
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.nextcloud.client;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Intent;
|
||||
import android.os.Looper;
|
||||
|
||||
import com.owncloud.android.AbstractIT;
|
||||
import com.owncloud.android.datamodel.ArbitraryDataProvider;
|
||||
import com.owncloud.android.ui.activity.RequestCredentialsActivity;
|
||||
import com.owncloud.android.ui.activity.SettingsActivity;
|
||||
import com.owncloud.android.utils.EncryptionUtils;
|
||||
import com.owncloud.android.utils.ScreenshotTest;
|
||||
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.rules.TestRule;
|
||||
|
||||
import androidx.test.espresso.intent.rule.IntentsTestRule;
|
||||
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
|
||||
public class SettingsActivityIT extends AbstractIT {
|
||||
@Rule public IntentsTestRule<SettingsActivity> activityRule = new IntentsTestRule<>(SettingsActivity.class,
|
||||
true,
|
||||
false);
|
||||
|
||||
@Rule
|
||||
public final TestRule permissionRule = GrantStoragePermissionRule.grant();
|
||||
|
||||
@Test
|
||||
@ScreenshotTest
|
||||
public void open() {
|
||||
Activity sut = activityRule.launchActivity(null);
|
||||
|
||||
screenshot(sut);
|
||||
}
|
||||
|
||||
@Test
|
||||
@ScreenshotTest
|
||||
public void showMnemonic_Error() {
|
||||
SettingsActivity sut = activityRule.launchActivity(null);
|
||||
sut.handleMnemonicRequest(null);
|
||||
shortSleep();
|
||||
waitForIdleSync();
|
||||
|
||||
screenshot(sut);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void showMnemonic() {
|
||||
if (Looper.myLooper() == null) {
|
||||
Looper.prepare();
|
||||
}
|
||||
|
||||
Intent intent = new Intent();
|
||||
intent.putExtra(RequestCredentialsActivity.KEY_CHECK_RESULT, RequestCredentialsActivity.KEY_CHECK_RESULT_TRUE);
|
||||
|
||||
ArbitraryDataProvider arbitraryDataProvider = new ArbitraryDataProvider(targetContext.getContentResolver());
|
||||
arbitraryDataProvider.storeOrUpdateKeyValue(user.getAccountName(), EncryptionUtils.MNEMONIC, "Secret mnemonic");
|
||||
|
||||
SettingsActivity sut = activityRule.launchActivity(null);
|
||||
sut.handleMnemonicRequest(intent);
|
||||
|
||||
Looper.myLooper().quitSafely();
|
||||
assertTrue(true); // if we reach this, everything is ok
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
/*
|
||||
*
|
||||
* Nextcloud Android client application
|
||||
*
|
||||
* @author Tobias Kaminsky
|
||||
* Copyright (C) 2019 Tobias Kaminsky
|
||||
* Copyright (C) 2019 Nextcloud GmbH
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.nextcloud.client
|
||||
|
||||
import android.app.Activity
|
||||
import com.owncloud.android.AbstractIT
|
||||
import androidx.test.espresso.intent.rule.IntentsTestRule
|
||||
import com.owncloud.android.ui.activity.SettingsActivity
|
||||
import android.os.Looper
|
||||
import android.content.Intent
|
||||
import com.owncloud.android.ui.activity.RequestCredentialsActivity
|
||||
import com.owncloud.android.datamodel.ArbitraryDataProvider
|
||||
import com.owncloud.android.utils.EncryptionUtils
|
||||
import com.owncloud.android.utils.ScreenshotTest
|
||||
import org.junit.Assert
|
||||
import org.junit.Rule
|
||||
import org.junit.Test
|
||||
|
||||
@Suppress("FunctionNaming")
|
||||
class SettingsActivityIT : AbstractIT() {
|
||||
@get:Rule
|
||||
val activityRule = IntentsTestRule(
|
||||
SettingsActivity::class.java,
|
||||
true,
|
||||
false
|
||||
)
|
||||
|
||||
@get:Rule
|
||||
val permissionRule = GrantStoragePermissionRule.grant()
|
||||
|
||||
@Test
|
||||
@ScreenshotTest
|
||||
fun open() {
|
||||
val sut: Activity = activityRule.launchActivity(null)
|
||||
screenshot(sut)
|
||||
}
|
||||
|
||||
@Test
|
||||
@ScreenshotTest
|
||||
fun showMnemonic_Error() {
|
||||
val sut = activityRule.launchActivity(null)
|
||||
sut.handleMnemonicRequest(null)
|
||||
shortSleep()
|
||||
waitForIdleSync()
|
||||
screenshot(sut)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun showMnemonic() {
|
||||
if (Looper.myLooper() == null) {
|
||||
Looper.prepare()
|
||||
}
|
||||
val intent = Intent()
|
||||
intent.putExtra(RequestCredentialsActivity.KEY_CHECK_RESULT, RequestCredentialsActivity.KEY_CHECK_RESULT_TRUE)
|
||||
val arbitraryDataProvider = ArbitraryDataProvider(targetContext.contentResolver)
|
||||
arbitraryDataProvider.storeOrUpdateKeyValue(user.accountName, EncryptionUtils.MNEMONIC, "Secret mnemonic")
|
||||
val sut = activityRule.launchActivity(null)
|
||||
sut.runOnUiThread {
|
||||
sut.handleMnemonicRequest(intent)
|
||||
}
|
||||
|
||||
Looper.myLooper()?.quitSafely()
|
||||
Assert.assertTrue(true) // if we reach this, everything is ok
|
||||
}
|
||||
}
|
||||
@@ -34,7 +34,6 @@ import com.owncloud.android.utils.ScreenshotTest;
|
||||
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.rules.TestRule;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
@@ -48,9 +47,6 @@ public class SyncedFoldersActivityIT extends AbstractIT {
|
||||
true,
|
||||
false);
|
||||
|
||||
@Rule
|
||||
public final TestRule permissionRule = GrantStoragePermissionRule.grant();
|
||||
|
||||
@Test
|
||||
@ScreenshotTest
|
||||
public void open() {
|
||||
|
||||
@@ -28,7 +28,6 @@ import com.owncloud.android.utils.ScreenshotTest;
|
||||
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.rules.TestRule;
|
||||
|
||||
import androidx.test.espresso.intent.rule.IntentsTestRule;
|
||||
|
||||
@@ -38,9 +37,6 @@ public class UploadListActivityActivityIT extends AbstractIT {
|
||||
true,
|
||||
false);
|
||||
|
||||
@Rule
|
||||
public final TestRule permissionRule = GrantStoragePermissionRule.grant();
|
||||
|
||||
@Test
|
||||
@ScreenshotTest
|
||||
public void openDrawer() {
|
||||
|
||||
@@ -25,7 +25,6 @@ package com.nextcloud.client.etm
|
||||
import android.app.Activity
|
||||
import androidx.test.espresso.intent.rule.IntentsTestRule
|
||||
import androidx.test.internal.runner.junit4.statement.UiThreadStatement
|
||||
import com.nextcloud.client.preferences.AppPreferencesImpl
|
||||
import com.owncloud.android.AbstractIT
|
||||
import com.owncloud.android.utils.ScreenshotTest
|
||||
import org.junit.Rule
|
||||
@@ -45,20 +44,6 @@ class EtmActivityTest : AbstractIT() {
|
||||
screenshot(sut)
|
||||
}
|
||||
|
||||
@Test
|
||||
@ScreenshotTest
|
||||
fun preferences() {
|
||||
val sut: EtmActivity = activityRule.launchActivity(null)
|
||||
|
||||
UiThreadStatement.runOnUiThread {
|
||||
val preferences = AppPreferencesImpl.fromContext(targetContext)
|
||||
preferences.pushToken = "Push token"
|
||||
sut.vm.onPageSelected(0)
|
||||
}
|
||||
|
||||
screenshot(sut)
|
||||
}
|
||||
|
||||
@Test
|
||||
@ScreenshotTest
|
||||
fun accounts() {
|
||||
|
||||
@@ -22,6 +22,8 @@ package com.nextcloud.client.migrations
|
||||
import androidx.test.annotation.UiThreadTest
|
||||
import com.nextcloud.client.appinfo.AppInfo
|
||||
import com.nextcloud.client.core.ManualAsyncRunner
|
||||
import com.nhaarman.mockitokotlin2.any
|
||||
import com.nhaarman.mockitokotlin2.anyOrNull
|
||||
import com.nhaarman.mockitokotlin2.inOrder
|
||||
import com.nhaarman.mockitokotlin2.mock
|
||||
import com.nhaarman.mockitokotlin2.never
|
||||
@@ -42,9 +44,15 @@ class MigrationsManagerTest {
|
||||
const val NEW_APP_VERSION = 42
|
||||
}
|
||||
|
||||
lateinit var migrationStep1: Runnable
|
||||
lateinit var migrationStep2: Runnable
|
||||
lateinit var migrationStep3: Runnable
|
||||
lateinit var migrationStep1Body: (Migrations.Step) -> Unit
|
||||
lateinit var migrationStep1: Migrations.Step
|
||||
|
||||
lateinit var migrationStep2Body: (Migrations.Step) -> Unit
|
||||
lateinit var migrationStep2: Migrations.Step
|
||||
|
||||
lateinit var migrationStep3Body: (Migrations.Step) -> Unit
|
||||
lateinit var migrationStep3: Migrations.Step
|
||||
|
||||
lateinit var migrations: List<Migrations.Step>
|
||||
|
||||
@Mock
|
||||
@@ -60,26 +68,17 @@ class MigrationsManagerTest {
|
||||
@Before
|
||||
fun setUp() {
|
||||
MockitoAnnotations.initMocks(this)
|
||||
migrationStep1 = mock()
|
||||
migrationStep2 = mock()
|
||||
migrationStep3 = mock()
|
||||
migrations = listOf(
|
||||
object : Migrations.Step(0, "first migration", true) {
|
||||
override fun run() {
|
||||
migrationStep1.run()
|
||||
}
|
||||
},
|
||||
object : Migrations.Step(1, "second optional migration", false) {
|
||||
override fun run() {
|
||||
migrationStep2.run()
|
||||
}
|
||||
},
|
||||
object : Migrations.Step(2, "third migration", true) {
|
||||
override fun run() {
|
||||
migrationStep3.run()
|
||||
}
|
||||
}
|
||||
)
|
||||
migrationStep1Body = mock()
|
||||
migrationStep1 = Migrations.Step(0, "first migration", true, migrationStep1Body)
|
||||
|
||||
migrationStep2Body = mock()
|
||||
migrationStep2 = Migrations.Step(1, "second optional migration", false, migrationStep2Body)
|
||||
|
||||
migrationStep3Body = mock()
|
||||
migrationStep3 = Migrations.Step(2, "third migration", true, migrationStep3Body)
|
||||
|
||||
migrations = listOf(migrationStep1, migrationStep2, migrationStep3)
|
||||
|
||||
asyncRunner = ManualAsyncRunner()
|
||||
migrationsDbStore = MockSharedPreferences()
|
||||
migrationsDb = MigrationsDb(migrationsDbStore)
|
||||
@@ -93,14 +92,6 @@ class MigrationsManagerTest {
|
||||
)
|
||||
}
|
||||
|
||||
private fun assertMigrationsRun(vararg migrationSteps: Runnable) {
|
||||
inOrder(migrationSteps).apply {
|
||||
migrationSteps.forEach {
|
||||
verify(it.run())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun inital_status_is_unknown() {
|
||||
// GIVEN
|
||||
@@ -146,20 +137,50 @@ class MigrationsManagerTest {
|
||||
|
||||
// THEN
|
||||
// total migrations count is returned
|
||||
// migration functions are called
|
||||
// migration functions are called with step as argument
|
||||
// migrations are invoked in order
|
||||
// applied migrations are recorded
|
||||
// new app version code is recorded
|
||||
assertEquals(migrations.size, count)
|
||||
inOrder(migrationStep1, migrationStep2, migrationStep3).apply {
|
||||
verify(migrationStep1).run()
|
||||
verify(migrationStep2).run()
|
||||
verify(migrationStep3).run()
|
||||
inOrder(migrationStep1.run, migrationStep2.run, migrationStep3.run).apply {
|
||||
verify(migrationStep1.run).invoke(migrationStep1)
|
||||
verify(migrationStep2.run).invoke(migrationStep2)
|
||||
verify(migrationStep3.run).invoke(migrationStep3)
|
||||
}
|
||||
val allAppliedIds = migrations.map { it.id }
|
||||
assertEquals(allAppliedIds, migrationsDb.getAppliedMigrations())
|
||||
assertEquals(NEW_APP_VERSION, migrationsDb.lastMigratedVersion)
|
||||
}
|
||||
|
||||
@Test
|
||||
@UiThreadTest
|
||||
fun previously_run_migrations_are_not_run_again() {
|
||||
// GIVEN
|
||||
// some migrations were run before
|
||||
whenever(appInfo.versionCode).thenReturn(NEW_APP_VERSION)
|
||||
migrationsDb.lastMigratedVersion = OLD_APP_VERSION
|
||||
migrationsDb.addAppliedMigration(migrationStep1.id, migrationStep2.id)
|
||||
|
||||
// WHEN
|
||||
// migrations are applied
|
||||
val count = migrationsManager.startMigration()
|
||||
assertTrue(asyncRunner.runOne())
|
||||
|
||||
// THEN
|
||||
// applied migrations count is returned
|
||||
// previously applied migrations are not run
|
||||
// required migrations are applied
|
||||
// applied migrations are recorded
|
||||
// new app version code is recorded
|
||||
assertEquals(1, count)
|
||||
verify(migrationStep1.run, never()).invoke(anyOrNull())
|
||||
verify(migrationStep2.run, never()).invoke(anyOrNull())
|
||||
verify(migrationStep3.run).invoke(migrationStep3)
|
||||
val allAppliedIds = migrations.map { it.id }
|
||||
assertEquals(allAppliedIds, migrationsDb.getAppliedMigrations())
|
||||
assertEquals(NEW_APP_VERSION, migrationsDb.lastMigratedVersion)
|
||||
}
|
||||
|
||||
@Test
|
||||
@UiThreadTest
|
||||
fun migration_error_is_recorded() {
|
||||
@@ -174,7 +195,7 @@ class MigrationsManagerTest {
|
||||
// one migration throws
|
||||
val lastMigration = migrations.findLast { it.mandatory } ?: throw IllegalStateException("Test fixture error")
|
||||
val errorMessage = "error message"
|
||||
whenever(lastMigration.run()).thenThrow(RuntimeException(errorMessage))
|
||||
whenever(lastMigration.run.invoke(any())).thenThrow(RuntimeException(errorMessage))
|
||||
migrationsManager.startMigration()
|
||||
assertTrue(asyncRunner.runOne())
|
||||
|
||||
@@ -205,7 +226,7 @@ class MigrationsManagerTest {
|
||||
// status is set to applied
|
||||
assertEquals(0, migrationCount)
|
||||
listOf(migrationStep1, migrationStep2, migrationStep3).forEach {
|
||||
verify(it, never()).run()
|
||||
verify(it.run, never()).invoke(any())
|
||||
}
|
||||
assertEquals(MigrationsManager.Status.APPLIED, migrationsManager.status.value)
|
||||
}
|
||||
@@ -245,7 +266,7 @@ class MigrationsManagerTest {
|
||||
// one migration is optional and fails
|
||||
assertEquals("Fixture should provide 1 optional, failing migration", 1, migrations.count { !it.mandatory })
|
||||
val optionalFailingMigration = migrations.first { !it.mandatory }
|
||||
whenever(optionalFailingMigration.run()).thenThrow(RuntimeException())
|
||||
whenever(optionalFailingMigration.run.invoke(any())).thenThrow(RuntimeException())
|
||||
|
||||
// WHEN
|
||||
// migration is started
|
||||
|
||||
@@ -24,6 +24,7 @@ import com.nextcloud.client.network.Connectivity;
|
||||
import com.nextcloud.client.network.ConnectivityService;
|
||||
import com.nextcloud.client.preferences.AppPreferencesImpl;
|
||||
import com.nextcloud.client.preferences.DarkMode;
|
||||
import com.nextcloud.common.NextcloudClient;
|
||||
import com.nextcloud.java.util.Optional;
|
||||
import com.owncloud.android.datamodel.FileDataStorageManager;
|
||||
import com.owncloud.android.datamodel.OCFile;
|
||||
@@ -79,6 +80,7 @@ public abstract class AbstractIT {
|
||||
public final TestRule permissionRule = GrantStoragePermissionRule.grant();
|
||||
|
||||
protected static OwnCloudClient client;
|
||||
protected static NextcloudClient nextcloudClient;
|
||||
protected static Account account;
|
||||
protected static User user;
|
||||
protected static Context targetContext;
|
||||
@@ -119,6 +121,7 @@ public abstract class AbstractIT {
|
||||
user = optionalUser.orElseThrow(IllegalAccessError::new);
|
||||
|
||||
client = OwnCloudClientFactory.createOwnCloudClient(account, targetContext);
|
||||
nextcloudClient = OwnCloudClientFactory.createNextcloudClient(account, targetContext);
|
||||
} catch (OperationCanceledException e) {
|
||||
e.printStackTrace();
|
||||
} catch (AuthenticatorException e) {
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package com.owncloud.android;
|
||||
|
||||
import com.nextcloud.client.GrantStoragePermissionRule;
|
||||
import com.owncloud.android.lib.common.operations.RemoteOperationResult;
|
||||
import com.owncloud.android.operations.CreateFolderOperation;
|
||||
import com.owncloud.android.operations.common.SyncOperation;
|
||||
@@ -11,9 +10,7 @@ import com.owncloud.android.ui.activity.SyncedFoldersActivity;
|
||||
import org.junit.Assert;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.ClassRule;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.rules.TestRule;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.runners.JUnit4;
|
||||
|
||||
@@ -42,9 +39,6 @@ public class ScreenshotsIT extends AbstractOnServerIT {
|
||||
@ClassRule
|
||||
public static final LocaleTestRule localeTestRule = new LocaleTestRule();
|
||||
|
||||
@Rule
|
||||
public final TestRule permissionRule = GrantStoragePermissionRule.grant();
|
||||
|
||||
@BeforeClass
|
||||
public static void beforeScreenshot() {
|
||||
Screengrab.setDefaultScreenshotStrategy(new UiAutomatorScreenshotStrategy());
|
||||
|
||||
@@ -27,7 +27,6 @@ import android.accounts.AccountManager;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
|
||||
import com.nextcloud.client.GrantStoragePermissionRule;
|
||||
import com.nextcloud.client.account.User;
|
||||
import com.nextcloud.client.account.UserAccountManager;
|
||||
import com.nextcloud.client.account.UserAccountManagerImpl;
|
||||
@@ -39,7 +38,6 @@ import com.owncloud.android.lib.common.accounts.AccountUtils;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.rules.TestRule;
|
||||
|
||||
import androidx.test.espresso.intent.rule.IntentsTestRule;
|
||||
|
||||
@@ -55,8 +53,6 @@ public class DrawerActivityIT extends AbstractIT {
|
||||
true,
|
||||
false);
|
||||
|
||||
@Rule
|
||||
public final TestRule permissionRule = GrantStoragePermissionRule.grant();
|
||||
private static Account account1;
|
||||
private static User user1;
|
||||
private static Account account2;
|
||||
|
||||
@@ -6,7 +6,6 @@ import com.nextcloud.client.GrantStoragePermissionRule;
|
||||
import com.nextcloud.client.onboarding.WhatsNewActivity;
|
||||
import com.owncloud.android.AbstractIT;
|
||||
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.rules.TestRule;
|
||||
|
||||
@@ -17,10 +16,6 @@ import androidx.test.runner.lifecycle.ActivityLifecycleMonitorRegistry;
|
||||
import static androidx.test.runner.lifecycle.Stage.RESUMED;
|
||||
|
||||
public class FileDisplayActivityTest extends AbstractIT {
|
||||
|
||||
@Rule
|
||||
public final TestRule permissionRule = GrantStoragePermissionRule.grant();
|
||||
|
||||
@Test
|
||||
public void testSetupToolbar() {
|
||||
try (ActivityScenario<FileDisplayActivity> scenario = ActivityScenario.launch(FileDisplayActivity.class)) {
|
||||
|
||||
@@ -26,11 +26,15 @@ import android.app.Activity;
|
||||
|
||||
import com.nextcloud.client.account.User;
|
||||
import com.owncloud.android.AbstractIT;
|
||||
import com.owncloud.android.lib.common.Quota;
|
||||
import com.owncloud.android.lib.common.UserInfo;
|
||||
import com.owncloud.android.utils.ScreenshotTest;
|
||||
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import androidx.test.espresso.intent.rule.IntentsTestRule;
|
||||
|
||||
public class ManageAccountsActivityIT extends AbstractIT {
|
||||
@@ -55,7 +59,19 @@ public class ManageAccountsActivityIT extends AbstractIT {
|
||||
ManageAccountsActivity sut = activityRule.launchActivity(null);
|
||||
|
||||
User user = sut.accountManager.getUser();
|
||||
sut.onAccountClicked(user);
|
||||
|
||||
UserInfo userInfo = new UserInfo("test",
|
||||
true,
|
||||
"Test User",
|
||||
"[email protected]",
|
||||
"+49 123 456",
|
||||
"Address 123, Berlin",
|
||||
"https://www.nextcloud.com",
|
||||
"https://twitter.com/Nextclouders",
|
||||
new Quota(),
|
||||
new ArrayList<>());
|
||||
|
||||
sut.showUser(user, userInfo);
|
||||
|
||||
shortSleep();
|
||||
shortSleep();
|
||||
|
||||
@@ -35,18 +35,6 @@ class NotificationsActivityIT : AbstractIT() {
|
||||
@get:Rule
|
||||
var activityRule = IntentsTestRule(NotificationsActivity::class.java, true, false)
|
||||
|
||||
@Test
|
||||
@ScreenshotTest
|
||||
fun loading() {
|
||||
val sut: NotificationsActivity = activityRule.launchActivity(null)
|
||||
|
||||
waitForIdleSync()
|
||||
|
||||
sut.runOnUiThread { sut.setLoadingMessageEmpty() }
|
||||
|
||||
screenshot(sut)
|
||||
}
|
||||
|
||||
@Test
|
||||
@ScreenshotTest
|
||||
fun empty() {
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
package com.owncloud.android.ui.activity
|
||||
|
||||
import android.content.Intent
|
||||
import androidx.test.espresso.Espresso
|
||||
import androidx.test.espresso.intent.rule.IntentsTestRule
|
||||
import com.owncloud.android.AbstractIT
|
||||
import com.owncloud.android.utils.ScreenshotTest
|
||||
@@ -40,8 +41,8 @@ class PassCodeActivityIT : AbstractIT() {
|
||||
waitForIdleSync()
|
||||
|
||||
sut.runOnUiThread { sut.binding.txt0.clearFocus() }
|
||||
Espresso.closeSoftKeyboard()
|
||||
|
||||
shortSleep()
|
||||
screenshot(sut)
|
||||
}
|
||||
|
||||
@@ -53,8 +54,8 @@ class PassCodeActivityIT : AbstractIT() {
|
||||
waitForIdleSync()
|
||||
|
||||
sut.runOnUiThread { sut.binding.txt0.clearFocus() }
|
||||
Espresso.closeSoftKeyboard()
|
||||
|
||||
shortSleep()
|
||||
screenshot(sut)
|
||||
}
|
||||
|
||||
@@ -66,8 +67,8 @@ class PassCodeActivityIT : AbstractIT() {
|
||||
waitForIdleSync()
|
||||
|
||||
sut.runOnUiThread { sut.binding.txt0.clearFocus() }
|
||||
Espresso.closeSoftKeyboard()
|
||||
|
||||
shortSleep()
|
||||
screenshot(sut)
|
||||
}
|
||||
}
|
||||
@@ -84,6 +84,12 @@ public class DialogFragmentIT extends AbstractIT {
|
||||
@Rule public IntentsTestRule<FileDisplayActivity> activityRule =
|
||||
new IntentsTestRule<>(FileDisplayActivity.class, true, false);
|
||||
|
||||
private FileDisplayActivity getFileDisplayActivity() {
|
||||
Intent intent = new Intent(targetContext, FileDisplayActivity.class);
|
||||
return activityRule.launchActivity(intent);
|
||||
}
|
||||
|
||||
|
||||
@After
|
||||
public void quitLooperIfNeeded() {
|
||||
if (Looper.myLooper() != null) {
|
||||
@@ -177,7 +183,8 @@ public class DialogFragmentIT extends AbstractIT {
|
||||
@Test
|
||||
@ScreenshotTest
|
||||
public void testAccountChooserDialog() throws AccountUtils.AccountNotFoundException {
|
||||
UserAccountManager userAccountManager = activityRule.getActivity().getUserAccountManager();
|
||||
FileDisplayActivity activity = getFileDisplayActivity();
|
||||
UserAccountManager userAccountManager = activity.getUserAccountManager();
|
||||
AccountManager accountManager = AccountManager.get(targetContext);
|
||||
for (Account account : accountManager.getAccountsByType(MainApp.getAccountType(targetContext))) {
|
||||
accountManager.removeAccountExplicitly(account);
|
||||
@@ -210,13 +217,14 @@ public class DialogFragmentIT extends AbstractIT {
|
||||
new OwnCloudAccount(newAccount, targetContext),
|
||||
new Server(URI.create(SERVER_URL),
|
||||
OwnCloudVersion.nextcloud_20)));
|
||||
FileDisplayActivity activity = showDialog(sut);
|
||||
showDialog(activity, sut);
|
||||
|
||||
activity.runOnUiThread(() -> sut.setStatus(new Status(StatusType.DND,
|
||||
"Busy fixing 🐛…",
|
||||
"",
|
||||
-1),
|
||||
targetContext));
|
||||
waitForIdleSync();
|
||||
shortSleep();
|
||||
screenshot(sut, "dnd");
|
||||
|
||||
@@ -225,6 +233,7 @@ public class DialogFragmentIT extends AbstractIT {
|
||||
"",
|
||||
-1),
|
||||
targetContext));
|
||||
waitForIdleSync();
|
||||
shortSleep();
|
||||
screenshot(sut, "online");
|
||||
|
||||
@@ -233,14 +242,17 @@ public class DialogFragmentIT extends AbstractIT {
|
||||
"🎉",
|
||||
-1),
|
||||
targetContext));
|
||||
waitForIdleSync();
|
||||
shortSleep();
|
||||
screenshot(sut, "fun");
|
||||
|
||||
activity.runOnUiThread(() -> sut.setStatus(new Status(StatusType.OFFLINE, "", "", -1), targetContext));
|
||||
waitForIdleSync();
|
||||
shortSleep();
|
||||
screenshot(sut, "offline");
|
||||
|
||||
activity.runOnUiThread(() -> sut.setStatus(new Status(StatusType.AWAY, "Vacation", "🌴", -1), targetContext));
|
||||
waitForIdleSync();
|
||||
shortSleep();
|
||||
screenshot(sut, "away");
|
||||
}
|
||||
@@ -259,7 +271,8 @@ public class DialogFragmentIT extends AbstractIT {
|
||||
accountManager.setUserData(newAccount, AccountUtils.Constants.KEY_USER_ID, "test");
|
||||
accountManager.setAuthToken(newAccount, AccountTypeUtils.getAuthTokenTypePass(newAccount.type), "password");
|
||||
|
||||
UserAccountManager userAccountManager = activityRule.getActivity().getUserAccountManager();
|
||||
FileDisplayActivity fda = getFileDisplayActivity();
|
||||
UserAccountManager userAccountManager = fda.getUserAccountManager();
|
||||
User newUser = userAccountManager.getUser(newAccount.name).get();
|
||||
FileDataStorageManager fileDataStorageManager = new FileDataStorageManager(newUser,
|
||||
targetContext.getContentResolver());
|
||||
@@ -274,7 +287,7 @@ public class DialogFragmentIT extends AbstractIT {
|
||||
new OwnCloudAccount(newAccount, targetContext),
|
||||
new Server(URI.create(SERVER_URL),
|
||||
OwnCloudVersion.nextcloud_20)));
|
||||
showDialog(sut);
|
||||
showDialog(fda, sut);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -429,8 +442,17 @@ public class DialogFragmentIT extends AbstractIT {
|
||||
|
||||
private FileDisplayActivity showDialog(DialogFragment dialog) {
|
||||
Intent intent = new Intent(targetContext, FileDisplayActivity.class);
|
||||
FileDisplayActivity sut = activityRule.launchActivity(intent);
|
||||
|
||||
FileDisplayActivity sut = activityRule.getActivity();
|
||||
|
||||
if (sut == null) {
|
||||
sut = activityRule.launchActivity(intent);
|
||||
}
|
||||
|
||||
return showDialog(sut, dialog);
|
||||
}
|
||||
|
||||
private FileDisplayActivity showDialog(FileDisplayActivity sut, DialogFragment dialog) {
|
||||
dialog.show(sut.getSupportFragmentManager(), "");
|
||||
|
||||
getInstrumentation().waitForIdleSync();
|
||||
|
||||
@@ -23,7 +23,7 @@ package com.owncloud.android.ui.dialog
|
||||
|
||||
import android.view.Window
|
||||
import androidx.test.espresso.intent.rule.IntentsTestRule
|
||||
import androidx.test.internal.runner.junit4.statement.UiThreadStatement
|
||||
import androidx.test.internal.runner.junit4.statement.UiThreadStatement.runOnUiThread
|
||||
import com.nextcloud.client.TestActivity
|
||||
import com.owncloud.android.AbstractIT
|
||||
import com.owncloud.android.utils.ScreenshotTest
|
||||
@@ -60,9 +60,10 @@ class SetupEncryptionDialogFragmentIT : AbstractIT() {
|
||||
"accuse"
|
||||
)
|
||||
|
||||
sut.setMnemonic(keyWords)
|
||||
shortSleep()
|
||||
|
||||
UiThreadStatement.runOnUiThread {
|
||||
runOnUiThread {
|
||||
sut.setMnemonic(keyWords)
|
||||
sut.showMnemonicInfo()
|
||||
}
|
||||
|
||||
@@ -80,7 +81,9 @@ class SetupEncryptionDialogFragmentIT : AbstractIT() {
|
||||
|
||||
sut.show(activity.supportFragmentManager, "1")
|
||||
|
||||
UiThreadStatement.runOnUiThread {
|
||||
shortSleep()
|
||||
|
||||
runOnUiThread {
|
||||
sut.errorSavingKeys()
|
||||
}
|
||||
|
||||
|
||||
@@ -137,8 +137,8 @@ class FileDetailFragmentStaticServerIT : AbstractIT() {
|
||||
screenshot(activity)
|
||||
}
|
||||
|
||||
@Test
|
||||
@ScreenshotTest
|
||||
// @Test
|
||||
// @ScreenshotTest
|
||||
fun showDetailsActivitiesNone() {
|
||||
val activity = testActivityRule.launchActivity(null)
|
||||
val sut = FileDetailFragment.newInstance(file, user, 0)
|
||||
|
||||
@@ -41,11 +41,6 @@ import org.junit.rules.TestRule
|
||||
import java.io.File
|
||||
|
||||
class OCFileListFragmentIT : AbstractOnServerIT() {
|
||||
companion object {
|
||||
val SECOND_IN_MILLIS = 1000L
|
||||
val RESULT_PER_PAGE = 50
|
||||
}
|
||||
|
||||
@get:Rule
|
||||
val activityRule = IntentsTestRule(FileDisplayActivity::class.java, true, false)
|
||||
|
||||
|
||||
@@ -77,8 +77,6 @@ class OCFileListFragmentStaticServerIT : AbstractIT() {
|
||||
screenshot(sut)
|
||||
}
|
||||
|
||||
@Test
|
||||
@ScreenshotTest
|
||||
/**
|
||||
* Use same values as {@link FileDetailSharingFragmentIT listSharesFileAllShareTypes }
|
||||
*/
|
||||
|
||||
@@ -22,7 +22,6 @@
|
||||
|
||||
package com.owncloud.android.ui.preview;
|
||||
|
||||
import com.nextcloud.client.GrantStoragePermissionRule;
|
||||
import com.owncloud.android.AbstractIT;
|
||||
import com.owncloud.android.datamodel.OCFile;
|
||||
import com.owncloud.android.ui.activity.FileDisplayActivity;
|
||||
@@ -30,7 +29,6 @@ import com.owncloud.android.utils.MimeTypeUtil;
|
||||
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.rules.TestRule;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
@@ -42,9 +40,6 @@ public class PreviewTextFileFragmentTest extends AbstractIT {
|
||||
true,
|
||||
false);
|
||||
|
||||
@Rule
|
||||
public final TestRule permissionRule = GrantStoragePermissionRule.grant();
|
||||
|
||||
@Test
|
||||
// @ScreenshotTest // todo run without real server
|
||||
public void displaySimpleTextFile() throws IOException {
|
||||
|
||||
@@ -225,15 +225,23 @@ internal class BackgroundJobManagerImpl(
|
||||
|
||||
override fun schedulePeriodicContactsBackup(user: User) {
|
||||
val data = Data.Builder()
|
||||
.putString(ContactsBackupWork.ACCOUNT, user.accountName)
|
||||
.putBoolean(ContactsBackupWork.FORCE, true)
|
||||
.putString(ContactsBackupWork.KEY_ACCOUNT, user.accountName)
|
||||
.putBoolean(ContactsBackupWork.KEY_FORCE, true)
|
||||
.build()
|
||||
|
||||
val constraints = Constraints.Builder()
|
||||
.setRequiredNetworkType(NetworkType.CONNECTED)
|
||||
.build()
|
||||
|
||||
val request = periodicRequestBuilder(
|
||||
jobClass = ContactsBackupWork::class,
|
||||
jobName = JOB_PERIODIC_CONTACTS_BACKUP,
|
||||
intervalMins = PERIODIC_BACKUP_INTERVAL_MINUTES,
|
||||
user = user
|
||||
).setInputData(data).build()
|
||||
)
|
||||
.setInputData(data)
|
||||
.setConstraints(constraints)
|
||||
.build()
|
||||
|
||||
workManager.enqueueUniquePeriodicWork(JOB_PERIODIC_CONTACTS_BACKUP, ExistingPeriodicWorkPolicy.KEEP, request)
|
||||
}
|
||||
@@ -292,8 +300,8 @@ internal class BackgroundJobManagerImpl(
|
||||
|
||||
override fun startImmediateContactsBackup(user: User): LiveData<JobInfo?> {
|
||||
val data = Data.Builder()
|
||||
.putString(ContactsBackupWork.ACCOUNT, user.accountName)
|
||||
.putBoolean(ContactsBackupWork.FORCE, true)
|
||||
.putString(ContactsBackupWork.KEY_ACCOUNT, user.accountName)
|
||||
.putBoolean(ContactsBackupWork.KEY_FORCE, true)
|
||||
.build()
|
||||
|
||||
val request = oneTimeRequestBuilder(ContactsBackupWork::class, JOB_IMMEDIATE_CONTACTS_BACKUP, user)
|
||||
|
||||
@@ -70,9 +70,9 @@ class ContactsBackupWork(
|
||||
|
||||
companion object {
|
||||
val TAG = ContactsBackupWork::class.java.simpleName
|
||||
const val ACCOUNT = "account"
|
||||
const val FORCE = "force"
|
||||
const val JOB_INTERVAL_MS: Long = 24 * 60 * 60 * 1000
|
||||
const val KEY_ACCOUNT = "account"
|
||||
const val KEY_FORCE = "force"
|
||||
const val JOB_INTERVAL_MS: Long = 24L * 60L * 60L * 1000L
|
||||
const val BUFFER_SIZE = 1024
|
||||
}
|
||||
|
||||
@@ -81,7 +81,7 @@ class ContactsBackupWork(
|
||||
|
||||
@Suppress("ReturnCount") // pre-existing issue
|
||||
override fun doWork(): Result {
|
||||
val accountName = inputData.getString(ACCOUNT) ?: ""
|
||||
val accountName = inputData.getString(KEY_ACCOUNT) ?: ""
|
||||
if (TextUtils.isEmpty(accountName)) { // no account provided
|
||||
return Result.failure()
|
||||
}
|
||||
@@ -94,7 +94,7 @@ class ContactsBackupWork(
|
||||
user,
|
||||
ContactsPreferenceActivity.PREFERENCE_CONTACTS_LAST_BACKUP
|
||||
)
|
||||
val force = inputData.getBoolean(FORCE, false)
|
||||
val force = inputData.getBoolean(KEY_FORCE, false)
|
||||
if (force || lastExecution + JOB_INTERVAL_MS < Calendar.getInstance().timeInMillis) {
|
||||
Log_OC.d(TAG, "start contacts backup job")
|
||||
val backupFolder: String = resources.getString(R.string.contacts_backup_folder) + OCFile.PATH_SEPARATOR
|
||||
|
||||
@@ -55,75 +55,82 @@ class Migrations @Inject constructor(
|
||||
* @throws Exception migration logic is permitted to throw any kind of exceptions; all exceptions will be wrapped
|
||||
* into [MigrationException]
|
||||
*/
|
||||
abstract class Step(val id: Int, val description: String, val mandatory: Boolean = true) : Runnable
|
||||
class Step(val id: Int, val description: String, val mandatory: Boolean = true, val run: (s: Step) -> Unit) {
|
||||
override fun toString(): String {
|
||||
return "Migration $id: $description"
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* NOP migration used to replace applied migrations that should be applied again.
|
||||
*/
|
||||
private fun nop(s: Step) {
|
||||
logger.i(TAG, "$s: skipped deprecated migration")
|
||||
}
|
||||
|
||||
/**
|
||||
* Migrate legacy accounts by adding user IDs. This migration can be re-tried until all accounts are
|
||||
* successfully migrated.
|
||||
*/
|
||||
private val migrateUserId = object : Step(0, "Migrate user id", false) {
|
||||
override fun run() {
|
||||
val allAccountsHaveUserId = userAccountManager.migrateUserId()
|
||||
logger.i(TAG, "$description: success = $allAccountsHaveUserId")
|
||||
if (!allAccountsHaveUserId) {
|
||||
throw IllegalStateException("Failed to set user id for all accounts")
|
||||
}
|
||||
private fun migrateUserId(s: Step) {
|
||||
val allAccountsHaveUserId = userAccountManager.migrateUserId()
|
||||
logger.i(TAG, "${s.description}: success = $allAccountsHaveUserId")
|
||||
if (!allAccountsHaveUserId) {
|
||||
throw IllegalStateException("Failed to set user id for all accounts")
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Content observer job must be restarted to use new scheduler abstraction.
|
||||
*/
|
||||
private val migrateContentObserverJob = object : Step(1, "Migrate content observer job", false) {
|
||||
override fun run() {
|
||||
val legacyWork = workManager.getWorkInfosByTag("content_sync").get()
|
||||
legacyWork.forEach {
|
||||
logger.i(TAG, "$description: cancelling legacy work ${it.id}")
|
||||
workManager.cancelWorkById(it.id)
|
||||
}
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
|
||||
jobManager.scheduleContentObserverJob()
|
||||
logger.i(TAG, "$description: enabled")
|
||||
} else {
|
||||
logger.i(TAG, "$description: disabled")
|
||||
}
|
||||
private fun migrateContentObserverJob(s: Step) {
|
||||
val legacyWork = workManager.getWorkInfosByTag("content_sync").get()
|
||||
legacyWork.forEach {
|
||||
logger.i(TAG, "${s.description}: cancelling legacy work ${it.id}")
|
||||
workManager.cancelWorkById(it.id)
|
||||
}
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
|
||||
jobManager.scheduleContentObserverJob()
|
||||
logger.i(TAG, "$s: enabled")
|
||||
} else {
|
||||
logger.i(TAG, "$s: disabled")
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Contacts backup job has been migrated to new job runner framework. Re-start contacts upload
|
||||
* for all users that have it enabled.
|
||||
*
|
||||
* Old job is removed from source code, so we need to restart it for each user using
|
||||
* new jobs API.
|
||||
* Periodic contacts backup job has been changed and should be restarted.
|
||||
*/
|
||||
private val migrateContactsBackupJob = object : Step(2, "Restart contacts backup job") {
|
||||
override fun run() {
|
||||
val users = userAccountManager.allUsers
|
||||
if (users.isEmpty()) {
|
||||
logger.i(TAG, "$description: no users to migrate")
|
||||
} else {
|
||||
users.forEach {
|
||||
val backupEnabled = arbitraryDataProvider.getBooleanValue(
|
||||
it.accountName,
|
||||
ContactsPreferenceActivity.PREFERENCE_CONTACTS_AUTOMATIC_BACKUP
|
||||
)
|
||||
if (backupEnabled) {
|
||||
jobManager.schedulePeriodicContactsBackup(it)
|
||||
}
|
||||
logger.i(TAG, "$description: user = ${it.accountName}, backup enabled = $backupEnabled")
|
||||
private fun restartContactsBackupJobs(s: Step) {
|
||||
val users = userAccountManager.allUsers
|
||||
if (users.isEmpty()) {
|
||||
logger.i(TAG, "$s: no users to migrate")
|
||||
} else {
|
||||
users.forEach {
|
||||
val backupEnabled = arbitraryDataProvider.getBooleanValue(
|
||||
it.accountName,
|
||||
ContactsPreferenceActivity.PREFERENCE_CONTACTS_AUTOMATIC_BACKUP
|
||||
)
|
||||
if (backupEnabled) {
|
||||
jobManager.schedulePeriodicContactsBackup(it)
|
||||
}
|
||||
logger.i(TAG, "$s: user = ${it.accountName}, backup enabled = $backupEnabled")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* List of migration steps. Those steps will be loaded and run by [MigrationsManager]
|
||||
* List of migration steps. Those steps will be loaded and run by [MigrationsManager].
|
||||
*
|
||||
* If a migration should be run again (applicable to periodic job restarts), insert
|
||||
* the migration with new ID. To prevent accidental re-use of older IDs, replace old
|
||||
* migration with this::nop.
|
||||
*/
|
||||
@Suppress("MagicNumber")
|
||||
val steps: List<Step> = listOf(
|
||||
migrateUserId,
|
||||
migrateContentObserverJob,
|
||||
migrateContactsBackupJob
|
||||
Step(0, "Migrate user id", false, this::migrateUserId),
|
||||
Step(1, "Migrate content observer job", false, this::migrateContentObserverJob),
|
||||
Step(2, "Restart contacts backup job", true, this::nop),
|
||||
Step(3, "Restart contacts backup job", true, this::restartContactsBackupJobs)
|
||||
).sortedBy { it.id }.apply {
|
||||
val uniqueIds = associateBy { it.id }.size
|
||||
if (uniqueIds != size) {
|
||||
|
||||
@@ -33,7 +33,7 @@ internal class MigrationsManagerImpl(
|
||||
private val migrations: Collection<Migrations.Step>
|
||||
) : MigrationsManager {
|
||||
|
||||
override val status: LiveData<Status> = MutableLiveData<Status>(Status.UNKNOWN)
|
||||
override val status: LiveData<Status> = MutableLiveData(Status.UNKNOWN)
|
||||
|
||||
override val info: List<MigrationInfo> get() {
|
||||
val applied = migrationsDb.getAppliedMigrations()
|
||||
@@ -77,7 +77,7 @@ internal class MigrationsManagerImpl(
|
||||
migrations.forEach {
|
||||
@Suppress("TooGenericExceptionCaught") // migration code is free to throw anything
|
||||
try {
|
||||
it.run()
|
||||
it.run.invoke(it)
|
||||
migrationsDb.addAppliedMigration(it.id)
|
||||
} catch (t: Throwable) {
|
||||
if (it.mandatory) {
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
/*
|
||||
* Nextcloud Android client application
|
||||
*
|
||||
* @author Álvaro Brey Vilas
|
||||
* Copyright (C) 2021 Álvaro Brey Vilas
|
||||
* Copyright (C) 2021 Nextcloud GmbH
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.nextcloud.client.utils
|
||||
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.net.Uri
|
||||
import com.owncloud.android.datamodel.OCFile
|
||||
|
||||
object IntentUtil {
|
||||
|
||||
@JvmStatic
|
||||
public fun createSendIntent(context: Context, file: OCFile): Intent =
|
||||
createBaseSendFileIntent().apply {
|
||||
type = file.mimeType
|
||||
putExtra(Intent.EXTRA_STREAM, file.getExposedFileUri(context))
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
public fun createSendIntent(context: Context, files: Array<OCFile>): Intent =
|
||||
createBaseSendFileIntent().apply {
|
||||
type = getUniqueMimetype(files)
|
||||
putExtra(Intent.EXTRA_STREAM, getExposedFileUris(context, files))
|
||||
}
|
||||
|
||||
private fun createBaseSendFileIntent(): Intent =
|
||||
Intent(Intent.ACTION_SEND).apply {
|
||||
addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION)
|
||||
}
|
||||
|
||||
private fun getUniqueMimetype(files: Array<OCFile>): String? = when {
|
||||
files.distinctBy { it.mimeType }.size > 1 -> null
|
||||
else -> files[0].mimeType
|
||||
}
|
||||
|
||||
private fun getExposedFileUris(context: Context, files: Array<OCFile>): Array<Uri> =
|
||||
files.map { it.getExposedFileUri(context) }.toTypedArray()
|
||||
}
|
||||
@@ -76,20 +76,24 @@ public class AuthenticatorAsyncTask extends AsyncTask<Object, Void, RemoteOperat
|
||||
RemoteOperationResult<UserInfo> userInfoResult = new GetUserInfoRemoteOperation().execute(nextcloudClient);
|
||||
|
||||
// Operation - try credentials
|
||||
OwnCloudClient client = OwnCloudClientFactory.createOwnCloudClient(uri, context, true);
|
||||
client.setUserId(userInfoResult.getResultData().getId());
|
||||
client.setCredentials(credentials);
|
||||
if (userInfoResult.isSuccess()) {
|
||||
OwnCloudClient client = OwnCloudClientFactory.createOwnCloudClient(uri, context, true);
|
||||
client.setUserId(userInfoResult.getResultData().getId());
|
||||
client.setCredentials(credentials);
|
||||
|
||||
ExistenceCheckRemoteOperation operation = new ExistenceCheckRemoteOperation(ROOT_PATH, SUCCESS_IF_ABSENT);
|
||||
result = operation.execute(client);
|
||||
ExistenceCheckRemoteOperation operation = new ExistenceCheckRemoteOperation(ROOT_PATH, SUCCESS_IF_ABSENT);
|
||||
result = operation.execute(client);
|
||||
|
||||
if (operation.wasRedirected()) {
|
||||
RedirectionPath redirectionPath = operation.getRedirectionPath();
|
||||
String permanentLocation = redirectionPath.getLastPermanentLocation();
|
||||
result.setLastPermanentLocation(permanentLocation);
|
||||
if (operation.wasRedirected()) {
|
||||
RedirectionPath redirectionPath = operation.getRedirectionPath();
|
||||
String permanentLocation = redirectionPath.getLastPermanentLocation();
|
||||
result.setLastPermanentLocation(permanentLocation);
|
||||
}
|
||||
|
||||
result.setResultData(userInfoResult.getResultData());
|
||||
} else {
|
||||
result = userInfoResult;
|
||||
}
|
||||
|
||||
result.setResultData(userInfoResult.getResultData());
|
||||
} else {
|
||||
result = new RemoteOperationResult(RemoteOperationResult.ResultCode.UNKNOWN_ERROR);
|
||||
}
|
||||
|
||||