Merge pull request #8860 from element-hq/feature/bma/sdk34
Bump compile and target SDK to 34
This commit is contained in:
commit
96e05ba5c3
|
@ -24,12 +24,17 @@ jobs:
|
|||
group: ${{ github.ref == 'refs/heads/develop' && format('integration-tests-develop-{0}-{1}', matrix.target, github.sha) || format('build-debug-{0}-{1}', matrix.target, github.ref) }}
|
||||
cancel-in-progress: true
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
# https://github.com/actions/checkout/issues/881
|
||||
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
|
||||
- name: Use JDK 17
|
||||
uses: actions/setup-java@v4
|
||||
with:
|
||||
distribution: 'temurin' # See 'Supported distributions' for available options
|
||||
java-version: '17'
|
||||
- name: Configure gradle
|
||||
uses: gradle/gradle-build-action@v2
|
||||
uses: gradle/actions/setup-gradle@v3
|
||||
with:
|
||||
cache-read-only: ${{ github.ref != 'refs/heads/develop' }}
|
||||
- name: Assemble ${{ matrix.target }} debug apk
|
||||
|
@ -48,12 +53,17 @@ jobs:
|
|||
group: ${{ github.ref == 'refs/head/main' && format('build-release-apk-main-{0}', github.sha) || github.ref == 'refs/heads/develop' && format('build-release-apk-develop-{0}', github.sha) || format('build-debug-{0}', github.ref) }}
|
||||
cancel-in-progress: ${{ github.ref != 'refs/head/main' }}
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
# https://github.com/actions/checkout/issues/881
|
||||
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.ref }}
|
||||
- name: Use JDK 17
|
||||
uses: actions/setup-java@v4
|
||||
with:
|
||||
distribution: 'temurin' # See 'Supported distributions' for available options
|
||||
java-version: '17'
|
||||
- name: Configure gradle
|
||||
uses: gradle/gradle-build-action@v2
|
||||
uses: gradle/actions/setup-gradle@v3
|
||||
with:
|
||||
cache-read-only: ${{ github.ref != 'refs/heads/develop' }}
|
||||
- name: Assemble GPlay unsigned apk
|
||||
|
|
|
@ -7,7 +7,7 @@ jobs:
|
|||
runs-on: ubuntu-latest
|
||||
name: Danger
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
- run: |
|
||||
npm install --save-dev @babel/plugin-transform-flow-strip-types
|
||||
- name: Danger
|
||||
|
|
|
@ -10,7 +10,7 @@ jobs:
|
|||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Build docs
|
||||
run: ./gradlew dokkaHtml
|
||||
|
|
|
@ -10,5 +10,5 @@ jobs:
|
|||
runs-on: ubuntu-latest
|
||||
# No concurrency required, this is a prerequisite to other actions and should run every time.
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
- uses: gradle/wrapper-validation-action@v1
|
||||
|
|
|
@ -15,13 +15,18 @@ jobs:
|
|||
name: Build and publish nightly Gplay APK to Firebase
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
- name: Set up Python 3.8
|
||||
uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: 3.8
|
||||
- name: Use JDK 17
|
||||
uses: actions/setup-java@v4
|
||||
with:
|
||||
distribution: 'temurin' # See 'Supported distributions' for available options
|
||||
java-version: '17'
|
||||
- name: Configure gradle
|
||||
uses: gradle/gradle-build-action@v2
|
||||
uses: gradle/actions/setup-gradle@v3
|
||||
with:
|
||||
cache-read-only: ${{ github.ref != 'refs/heads/develop' }}
|
||||
- name: Install towncrier
|
||||
|
|
|
@ -39,17 +39,18 @@ jobs:
|
|||
api-level: [ 28 ]
|
||||
# No concurrency required, runs every time on a schedule.
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
- name: Set up Python 3.8
|
||||
uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: 3.8
|
||||
- uses: actions/setup-java@v3
|
||||
- name: Use JDK 17
|
||||
uses: actions/setup-java@v4
|
||||
with:
|
||||
distribution: 'adopt'
|
||||
java-version: '11'
|
||||
distribution: 'temurin' # See 'Supported distributions' for available options
|
||||
java-version: '17'
|
||||
- name: Configure gradle
|
||||
uses: gradle/gradle-build-action@v2
|
||||
uses: gradle/actions/setup-gradle@v3
|
||||
with:
|
||||
cache-read-only: ${{ github.ref != 'refs/heads/develop' }}
|
||||
- name: Start synapse server
|
||||
|
|
|
@ -7,7 +7,7 @@ on:
|
|||
|
||||
# Enrich gradle.properties for CI/CD
|
||||
env:
|
||||
GRADLE_OPTS: -Dorg.gradle.jvmargs="-Xmx3072m -Dfile.encoding=UTF-8 -XX:+HeapDumpOnOutOfMemoryError" -XX:MaxPermSize=512m -Dkotlin.daemon.jvm.options="-Xmx2g" -Dkotlin.incremental=false
|
||||
GRADLE_OPTS: -Dorg.gradle.jvmargs="-Xmx3072m -Dfile.encoding=UTF-8 -XX:+HeapDumpOnOutOfMemoryError -XX:MaxMetaspaceSize=1g" -Dkotlin.daemon.jvm.options="-Xmx2560m" -Dkotlin.incremental=false
|
||||
CI_GRADLE_ARG_PROPERTIES: --stacktrace -PpreDexEnable=false --max-workers 2 --no-daemon
|
||||
|
||||
jobs:
|
||||
|
@ -15,7 +15,7 @@ jobs:
|
|||
name: Project Check Suite
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
- name: Run code quality check suite
|
||||
run: ./tools/check/check_code_quality.sh
|
||||
|
||||
|
@ -24,7 +24,16 @@ jobs:
|
|||
name: Knit
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
- name: Use JDK 17
|
||||
uses: actions/setup-java@v4
|
||||
with:
|
||||
distribution: 'temurin' # See 'Supported distributions' for available options
|
||||
java-version: '17'
|
||||
- name: Configure gradle
|
||||
uses: gradle/actions/setup-gradle@v3
|
||||
with:
|
||||
cache-read-only: ${{ github.ref != 'refs/heads/develop' }}
|
||||
- name: Run knit
|
||||
run: |
|
||||
./gradlew knitCheck $CI_GRADLE_ARG_PROPERTIES
|
||||
|
@ -38,7 +47,16 @@ jobs:
|
|||
group: ${{ github.ref == 'refs/heads/main' && format('lint-main-{0}', github.sha) || github.ref == 'refs/heads/develop' && format('lint-develop-{0}', github.sha) || format('lint-{0}', github.ref) }}
|
||||
cancel-in-progress: true
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
- name: Use JDK 17
|
||||
uses: actions/setup-java@v4
|
||||
with:
|
||||
distribution: 'temurin' # See 'Supported distributions' for available options
|
||||
java-version: '17'
|
||||
- name: Configure gradle
|
||||
uses: gradle/actions/setup-gradle@v3
|
||||
with:
|
||||
cache-read-only: ${{ github.ref != 'refs/heads/develop' }}
|
||||
- name: Run ktlint
|
||||
run: |
|
||||
./gradlew ktlintCheck $CI_GRADLE_ARG_PROPERTIES --continue
|
||||
|
@ -83,7 +101,16 @@ jobs:
|
|||
group: ${{ github.ref == 'refs/heads/main' && format('dep-main-{0}', github.sha) || github.ref == 'refs/heads/develop' && format('dep-develop-{0}', github.sha) || format('dep-{0}', github.ref) }}
|
||||
cancel-in-progress: true
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
- name: Use JDK 17
|
||||
uses: actions/setup-java@v4
|
||||
with:
|
||||
distribution: 'temurin' # See 'Supported distributions' for available options
|
||||
java-version: '17'
|
||||
- name: Configure gradle
|
||||
uses: gradle/actions/setup-gradle@v3
|
||||
with:
|
||||
cache-read-only: ${{ github.ref != 'refs/heads/develop' }}
|
||||
- name: Dependency analysis
|
||||
run: ./gradlew dependencyCheckAnalyze $CI_GRADLE_ARG_PROPERTIES
|
||||
- name: Upload dependency analysis
|
||||
|
|
|
@ -12,7 +12,7 @@ jobs:
|
|||
if: github.repository == 'element-hq/element-android'
|
||||
# No concurrency required, runs every time on a schedule.
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
- name: Set up Python 3.8
|
||||
uses: actions/setup-python@v4
|
||||
with:
|
||||
|
@ -39,7 +39,7 @@ jobs:
|
|||
if: github.repository == 'element-hq/element-android'
|
||||
# No concurrency required, runs every time on a schedule.
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
- name: Set up Python 3.8
|
||||
uses: actions/setup-python@v4
|
||||
with:
|
||||
|
|
|
@ -25,15 +25,17 @@ jobs:
|
|||
group: ${{ github.ref == 'refs/heads/main' && format('unit-tests-main-{0}', github.sha) || github.ref == 'refs/heads/develop' && format('unit-tests-develop-{0}', github.sha) || format('unit-tests-{0}', github.ref) }}
|
||||
cancel-in-progress: true
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
lfs: true
|
||||
fetch-depth: 0
|
||||
- uses: actions/setup-java@v3
|
||||
- name: Use JDK 17
|
||||
uses: actions/setup-java@v4
|
||||
with:
|
||||
distribution: 'adopt'
|
||||
distribution: 'temurin' # See 'Supported distributions' for available options
|
||||
java-version: '17'
|
||||
- uses: gradle/gradle-build-action@v2
|
||||
- name: Configure gradle
|
||||
uses: gradle/actions/setup-gradle@v3
|
||||
with:
|
||||
cache-read-only: ${{ github.ref != 'refs/heads/develop' }}
|
||||
gradle-home-cache-cleanup: ${{ github.ref == 'refs/heads/develop' }}
|
||||
|
@ -136,13 +138,14 @@ jobs:
|
|||
# group: ${{ github.ref == 'refs/heads/main' && format('unit-tests-main-{0}', github.sha) || github.ref == 'refs/heads/develop' && format('unit-tests-develop-{0}', github.sha) || format('build-android-tests-{0}', github.ref) }}
|
||||
# cancel-in-progress: true
|
||||
# steps:
|
||||
# - uses: actions/checkout@v3
|
||||
# - uses: actions/setup-java@v3
|
||||
# - uses: actions/checkout@v4
|
||||
# - name: Use JDK 17
|
||||
# uses: actions/setup-java@v4
|
||||
# with:
|
||||
# distribution: 'adopt'
|
||||
# java-version: 11
|
||||
# distribution: 'temurin' # See 'Supported distributions' for available options
|
||||
# java-version: '17'
|
||||
# - name: Configure gradle
|
||||
# uses: gradle/gradle-build-action@v2
|
||||
# uses: gradle/actions/setup-gradle@v3
|
||||
# with:
|
||||
# cache-read-only: ${{ github.ref != 'refs/heads/develop' }}
|
||||
# - name: Build Android Tests
|
||||
|
|
|
@ -9,7 +9,7 @@ jobs:
|
|||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Update Gradle Wrapper
|
||||
uses: gradle-update/update-gradle-wrapper-action@v1
|
||||
|
|
|
@ -7,7 +7,7 @@ jobs:
|
|||
runs-on: ubuntu-latest
|
||||
name: Validate
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
lfs: 'true'
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@ buildscript {
|
|||
classpath 'com.google.gms:google-services:4.3.15'
|
||||
classpath 'org.sonarsource.scanner.gradle:sonarqube-gradle-plugin:4.0.0.2929'
|
||||
classpath 'com.google.android.gms:oss-licenses-plugin:0.10.6'
|
||||
classpath "com.likethesalad.android:stem-plugin:2.4.1"
|
||||
classpath "com.likethesalad.android:stem-plugin:2.9.0"
|
||||
classpath 'org.owasp:dependency-check-gradle:8.2.1'
|
||||
classpath "org.jetbrains.dokka:dokka-gradle-plugin:1.8.10"
|
||||
classpath "org.jetbrains.kotlinx:kotlinx-knit:0.4.0"
|
||||
|
@ -45,7 +45,7 @@ plugins {
|
|||
// Detekt
|
||||
id "io.gitlab.arturbosch.detekt" version "1.22.0"
|
||||
// Ksp
|
||||
id "com.google.devtools.ksp" version "1.8.10-1.0.9"
|
||||
id "com.google.devtools.ksp" version "1.9.24-1.0.20"
|
||||
|
||||
// Dependency Analysis
|
||||
id 'com.autonomousapps.dependency-analysis' version "1.20.0"
|
||||
|
|
|
@ -33,9 +33,9 @@ def initializeReport(report, projects, classExcludes) {
|
|||
)
|
||||
}
|
||||
report.reports {
|
||||
xml.enabled true
|
||||
html.enabled true
|
||||
csv.enabled false
|
||||
xml.required = true
|
||||
html.required = true
|
||||
csv.required = false
|
||||
}
|
||||
|
||||
gradle.projectsEvaluated {
|
||||
|
|
|
@ -1,39 +1,39 @@
|
|||
ext.versions = [
|
||||
'minSdk' : 21,
|
||||
'compileSdk' : 33,
|
||||
'targetSdk' : 33,
|
||||
'sourceCompat' : JavaVersion.VERSION_11,
|
||||
'targetCompat' : JavaVersion.VERSION_11,
|
||||
'compileSdk' : 34,
|
||||
'targetSdk' : 34,
|
||||
'sourceCompat' : JavaVersion.VERSION_17,
|
||||
'targetCompat' : JavaVersion.VERSION_17,
|
||||
'jvmTarget' : "17",
|
||||
]
|
||||
|
||||
def gradle = "7.4.2"
|
||||
def gradle = "8.4.2"
|
||||
// Ref: https://kotlinlang.org/releases.html
|
||||
def kotlin = "1.8.10"
|
||||
def kotlinCoroutines = "1.6.4"
|
||||
def dagger = "2.45"
|
||||
def firebaseBom = "32.0.0"
|
||||
def kotlin = "1.9.24"
|
||||
def kotlinCoroutines = "1.8.1"
|
||||
def dagger = "2.51.1"
|
||||
def firebaseBom = "33.1.1"
|
||||
def appDistribution = "16.0.0-beta08"
|
||||
def retrofit = "2.9.0"
|
||||
def retrofit = "2.11.0"
|
||||
def markwon = "4.6.2"
|
||||
def moshi = "1.14.0"
|
||||
def lifecycle = "2.5.1"
|
||||
def moshi = "1.15.1"
|
||||
def lifecycle = "2.8.3"
|
||||
def flowBinding = "1.2.0"
|
||||
def flipper = "0.190.0"
|
||||
def epoxy = "5.0.0"
|
||||
def mavericks = "3.0.7"
|
||||
def glide = "4.15.1"
|
||||
def mavericks = "3.0.9"
|
||||
def glide = "4.16.0"
|
||||
def bigImageViewer = "1.8.1"
|
||||
def jjwt = "0.11.5"
|
||||
def vanniktechEmoji = "0.16.0"
|
||||
def sentry = "6.18.1"
|
||||
// Use 1.6.0 alpha to fix issue with test
|
||||
def fragment = "1.6.0-beta01"
|
||||
def fragment = "1.8.1"
|
||||
// Testing
|
||||
def mockk = "1.12.3" // We need to use 1.12.3 to have mocking in androidTest until a new version is released: https://github.com/mockk/mockk/issues/819
|
||||
def espresso = "3.5.1"
|
||||
def androidxTest = "1.5.0"
|
||||
def androidxOrchestrator = "1.4.2"
|
||||
def paparazzi = "1.2.0"
|
||||
def mockk = "1.13.11"
|
||||
def espresso = "3.6.1"
|
||||
def androidxTest = "1.6.1"
|
||||
def androidxOrchestrator = "1.5.0"
|
||||
def paparazzi = "1.3.4"
|
||||
|
||||
ext.libs = [
|
||||
gradle : [
|
||||
|
@ -47,8 +47,8 @@ ext.libs = [
|
|||
'coroutinesTest' : "org.jetbrains.kotlinx:kotlinx-coroutines-test:$kotlinCoroutines"
|
||||
],
|
||||
androidx : [
|
||||
'activity' : "androidx.activity:activity-ktx:1.7.2",
|
||||
'appCompat' : "androidx.appcompat:appcompat:1.6.1",
|
||||
'activity' : "androidx.activity:activity-ktx:1.9.0",
|
||||
'appCompat' : "androidx.appcompat:appcompat:1.7.0",
|
||||
'biometric' : "androidx.biometric:biometric:1.1.0",
|
||||
'core' : "androidx.core:core-ktx:1.10.1",
|
||||
'recyclerview' : "androidx.recyclerview:recyclerview:1.3.0",
|
||||
|
@ -76,11 +76,11 @@ ext.libs = [
|
|||
'espressoCore' : "androidx.test.espresso:espresso-core:$espresso",
|
||||
'espressoContrib' : "androidx.test.espresso:espresso-contrib:$espresso",
|
||||
'espressoIntents' : "androidx.test.espresso:espresso-intents:$espresso",
|
||||
'viewpager2' : "androidx.viewpager2:viewpager2:1.0.0",
|
||||
'transition' : "androidx.transition:transition:1.4.1",
|
||||
'viewpager2' : "androidx.viewpager2:viewpager2:1.1.0",
|
||||
'transition' : "androidx.transition:transition:1.5.0",
|
||||
],
|
||||
google : [
|
||||
'material' : "com.google.android.material:material:1.9.0",
|
||||
'material' : "com.google.android.material:material:1.12.0",
|
||||
'firebaseBom' : "com.google.firebase:firebase-bom:$firebaseBom",
|
||||
'messaging' : "com.google.firebase:firebase-messaging",
|
||||
'appdistributionApi' : "com.google.firebase:firebase-appdistribution-api-ktx:$appDistribution",
|
||||
|
@ -172,7 +172,7 @@ ext.libs = [
|
|||
'kluent' : "org.amshove.kluent:kluent-android:1.73",
|
||||
'timberJunitRule' : "net.lachlanmckee:timber-junit-rule:1.0.1",
|
||||
'junit' : "junit:junit:4.13.2",
|
||||
'robolectric' : "org.robolectric:robolectric:4.9",
|
||||
'robolectric' : "org.robolectric:robolectric:4.13",
|
||||
]
|
||||
]
|
||||
|
||||
|
|
|
@ -96,6 +96,7 @@ ext.groups = [
|
|||
'com.google.auto.value',
|
||||
'com.google.code.findbugs',
|
||||
'com.google.code.gson',
|
||||
'com.google.crypto.tink',
|
||||
'com.google.dagger',
|
||||
'com.google.devtools.ksp',
|
||||
'com.google.errorprone',
|
||||
|
@ -141,6 +142,7 @@ ext.groups = [
|
|||
'commons-codec',
|
||||
'commons-io',
|
||||
'commons-logging',
|
||||
'dev.drewhamilton.poko',
|
||||
'info.picocli',
|
||||
'io.element.android',
|
||||
'io.github.davidburstrom.contester',
|
||||
|
|
|
@ -62,7 +62,7 @@ class PaparazziExampleScreenshotTest {
|
|||
val view = paparazzi.inflate<ConstraintLayout>(R.layout.item_radio)
|
||||
|
||||
// Bind data to the view
|
||||
view.findViewById<TextView>(R.id.actionTitle).text = paparazzi.resources.getString(R.string.room_settings_all_messages)
|
||||
view.findViewById<TextView>(R.id.actionTitle).text = paparazzi.resources.getString(CommonStrings.room_settings_all_messages)
|
||||
view.findViewById<ImageView>(R.id.radioIcon).setImageResource(R.drawable.ic_radio_on)
|
||||
|
||||
// Record the bound view
|
||||
|
|
|
@ -179,7 +179,7 @@ class SettingsRobot {
|
|||
}
|
||||
|
||||
fun advancedSettings(block: SettingsAdvancedRobot.() -> Unit) {
|
||||
clickOn(R.string.settings_advanced_settings)
|
||||
clickOn(CommonStrings.settings_advanced_settings)
|
||||
block(SettingsAdvancedRobot())
|
||||
pressBack()
|
||||
}
|
||||
|
@ -187,7 +187,7 @@ class SettingsRobot {
|
|||
|
||||
class SettingsAdvancedRobot {
|
||||
fun toggleDeveloperMode() {
|
||||
clickOn(R.string.settings_developer_mode_summary)
|
||||
clickOn(CommonStrings.settings_developer_mode_summary)
|
||||
}
|
||||
}
|
||||
```
|
||||
|
|
|
@ -42,4 +42,4 @@ signing.element.nightly.keyPassword=Secret
|
|||
|
||||
# Customise the Lint version to use a more recent version than the one bundled with AGP
|
||||
# https://googlesamples.github.io/android-custom-lint-rules/usage/newer-lint.md.html
|
||||
android.experimental.lint.version=8.3.0-alpha12
|
||||
android.experimental.lint.version=8.6.0-alpha08
|
||||
|
|
Binary file not shown.
|
@ -1,7 +1,8 @@
|
|||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionSha256Sum=312eb12875e1747e05c2f81a4789902d7e4ec5defbd1eefeaccc08acf096505d
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-all.zip
|
||||
distributionSha256Sum=f8b4f4772d302c8ff580bc40d0f56e715de69b163546944f787c87abf209c961
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-all.zip
|
||||
networkTimeout=10000
|
||||
validateDistributionUrl=true
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
|
|
|
@ -38,7 +38,7 @@ android {
|
|||
targetCompatibility versions.targetCompat
|
||||
}
|
||||
kotlinOptions {
|
||||
jvmTarget = "11"
|
||||
jvmTarget = versions.jvmTarget
|
||||
}
|
||||
|
||||
buildFeatures {
|
||||
|
|
|
@ -31,7 +31,6 @@ import android.view.WindowManager
|
|||
import android.widget.ImageView
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.core.view.GestureDetectorCompat
|
||||
import androidx.core.view.ViewCompat
|
||||
import androidx.core.view.WindowInsetsCompat
|
||||
import androidx.core.view.isVisible
|
||||
|
@ -39,6 +38,7 @@ import androidx.core.view.updatePadding
|
|||
import androidx.transition.TransitionManager
|
||||
import androidx.viewpager2.widget.ViewPager2
|
||||
import im.vector.lib.attachmentviewer.databinding.ActivityAttachmentViewerBinding
|
||||
import im.vector.lib.ui.styles.R
|
||||
import java.lang.ref.WeakReference
|
||||
import kotlin.math.abs
|
||||
|
||||
|
@ -71,7 +71,7 @@ abstract class AttachmentViewerActivity : AppCompatActivity(), AttachmentEventLi
|
|||
private lateinit var swipeDismissHandler: SwipeToDismissHandler
|
||||
private lateinit var directionDetector: SwipeDirectionDetector
|
||||
private lateinit var scaleDetector: ScaleGestureDetector
|
||||
private lateinit var gestureDetector: GestureDetectorCompat
|
||||
private lateinit var gestureDetector: GestureDetector
|
||||
|
||||
var currentPosition = 0
|
||||
private set
|
||||
|
@ -309,7 +309,7 @@ abstract class AttachmentViewerActivity : AppCompatActivity(), AttachmentEventLi
|
|||
ScaleGestureDetector(this, ScaleGestureDetector.SimpleOnScaleGestureListener())
|
||||
|
||||
private fun createGestureDetector() =
|
||||
GestureDetectorCompat(this, object : GestureDetector.SimpleOnGestureListener() {
|
||||
GestureDetector(this, object : GestureDetector.SimpleOnGestureListener() {
|
||||
override fun onSingleTapConfirmed(e: MotionEvent): Boolean {
|
||||
if (isImagePagerIdle) {
|
||||
handleSingleTap(e, isOverlayWasClicked)
|
||||
|
|
|
@ -28,7 +28,6 @@ android {
|
|||
targetSdk versions.targetSdk
|
||||
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
consumerProguardFiles "consumer-rules.pro"
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
|
@ -44,7 +43,7 @@ android {
|
|||
}
|
||||
|
||||
kotlinOptions {
|
||||
jvmTarget = "11"
|
||||
jvmTarget = versions.jvmTarget
|
||||
freeCompilerArgs += [
|
||||
"-opt-in=kotlin.RequiresOptIn"
|
||||
]
|
||||
|
|
|
@ -17,7 +17,7 @@ android {
|
|||
}
|
||||
|
||||
kotlinOptions {
|
||||
jvmTarget = "11"
|
||||
jvmTarget = versions.jvmTarget
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -13,7 +13,6 @@ import android.text.TextWatcher;
|
|||
import android.util.Log;
|
||||
import android.util.TypedValue;
|
||||
import android.view.Gravity;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.EditText;
|
||||
import android.widget.PopupWindow;
|
||||
|
|
|
@ -17,7 +17,7 @@ android {
|
|||
}
|
||||
|
||||
kotlinOptions {
|
||||
jvmTarget = "11"
|
||||
jvmTarget = versions.jvmTarget
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -20,7 +20,6 @@ import android.animation.AnimatorListenerAdapter;
|
|||
import android.content.Context;
|
||||
import android.content.res.Configuration;
|
||||
import android.content.res.Resources;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Build;
|
||||
import android.text.Spannable;
|
||||
import android.text.TextUtils;
|
||||
|
|
|
@ -20,6 +20,7 @@ import android.content.Context;
|
|||
import android.content.res.TypedArray;
|
||||
import android.util.AttributeSet;
|
||||
import android.widget.EditText;
|
||||
|
||||
import com.android.dialer.dialpadview.R;
|
||||
import com.android.dialer.util.ViewUtil;
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@ android {
|
|||
}
|
||||
|
||||
kotlinOptions {
|
||||
jvmTarget = "11"
|
||||
jvmTarget = versions.jvmTarget
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -10,11 +10,11 @@ dependencies {
|
|||
|
||||
task javadocJar(type: Jar, dependsOn: 'javadoc') {
|
||||
from javadoc.destinationDir
|
||||
classifier = 'javadoc'
|
||||
archiveClassifier = 'javadoc'
|
||||
}
|
||||
task sourcesJar(type: Jar, dependsOn: 'classes') {
|
||||
from sourceSets.main.allSource
|
||||
classifier = 'sources'
|
||||
archiveClassifier = 'sources'
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
|
|
|
@ -13,6 +13,15 @@ android {
|
|||
sourceSets {
|
||||
main.java.srcDirs += 'src/main/kotlin'
|
||||
}
|
||||
|
||||
compileOptions {
|
||||
sourceCompatibility versions.sourceCompat
|
||||
targetCompatibility versions.targetCompat
|
||||
}
|
||||
|
||||
kotlinOptions {
|
||||
jvmTarget = versions.jvmTarget
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
|
|
|
@ -1,6 +1,13 @@
|
|||
package com.amulyakhare.textdrawable;
|
||||
|
||||
import android.graphics.*;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.ColorFilter;
|
||||
import android.graphics.Paint;
|
||||
import android.graphics.PixelFormat;
|
||||
import android.graphics.Rect;
|
||||
import android.graphics.RectF;
|
||||
import android.graphics.Typeface;
|
||||
import android.graphics.drawable.ShapeDrawable;
|
||||
import android.graphics.drawable.shapes.OvalShape;
|
||||
import android.graphics.drawable.shapes.RectShape;
|
||||
|
|
|
@ -43,7 +43,7 @@ android {
|
|||
}
|
||||
|
||||
kotlinOptions {
|
||||
jvmTarget = "11"
|
||||
jvmTarget = versions.jvmTarget
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ android {
|
|||
}
|
||||
|
||||
kotlinOptions {
|
||||
jvmTarget = "11"
|
||||
jvmTarget = versions.jvmTarget
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
/*
|
||||
* Copyright (c) 2024 New Vector Ltd
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package im.vector.lib.strings
|
||||
|
||||
typealias CommonStrings = R.string
|
||||
typealias CommonPlurals = R.plurals
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources xmlns:tools="http://schemas.android.com/tools">
|
||||
<resources>
|
||||
<string name="notice_room_invite_no_invitee">دعوت %s</string>
|
||||
<string name="notice_room_invite">%1$s، %2$s را دعوت کرد</string>
|
||||
<string name="notice_room_invite_you">%1$s دعوتتان کرد</string>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources xmlns:tools="http://schemas.android.com/tools">
|
||||
<resources>
|
||||
<string name="notice_room_invite_no_invitee">%s 的邀请</string>
|
||||
<string name="notice_room_invite">%1$s 邀请了 %2$s</string>
|
||||
<string name="notice_room_invite_you">%1$s 邀请了你</string>
|
||||
|
|
|
@ -29,7 +29,6 @@ android {
|
|||
targetSdk versions.targetSdk
|
||||
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
consumerProguardFiles "consumer-rules.pro"
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
|
@ -45,7 +44,7 @@ android {
|
|||
}
|
||||
|
||||
kotlinOptions {
|
||||
jvmTarget = "11"
|
||||
jvmTarget = versions.jvmTarget
|
||||
}
|
||||
|
||||
buildFeatures {
|
||||
|
|
|
@ -28,7 +28,7 @@ android {
|
|||
targetCompatibility versions.targetCompat
|
||||
}
|
||||
kotlinOptions {
|
||||
jvmTarget = "11"
|
||||
jvmTarget = versions.jvmTarget
|
||||
}
|
||||
|
||||
// publishNonDefault true
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" />
|
||||
<manifest />
|
||||
|
|
|
@ -81,7 +81,7 @@ android {
|
|||
buildTypes {
|
||||
debug {
|
||||
if (project.hasProperty("coverage")) {
|
||||
testCoverageEnabled = coverage == "true"
|
||||
testCoverageEnabled = project.properties["coverage"] == "true"
|
||||
}
|
||||
// Set to true to log privacy or sensible data, such as token
|
||||
buildConfigField "boolean", "LOG_PRIVATE_DATA", project.property("vector.debugPrivateData")
|
||||
|
@ -106,7 +106,7 @@ android {
|
|||
}
|
||||
|
||||
kotlinOptions {
|
||||
jvmTarget = "11"
|
||||
jvmTarget = versions.jvmTarget
|
||||
freeCompilerArgs += [
|
||||
// Disabled for now, there are too many errors. Could be handled in another dedicated PR
|
||||
// '-Xexplicit-api=strict', // or warning
|
||||
|
@ -125,6 +125,15 @@ android {
|
|||
}
|
||||
}
|
||||
|
||||
buildFeatures {
|
||||
buildConfig true
|
||||
}
|
||||
|
||||
packaging {
|
||||
pickFirsts.add("META-INF/LICENSE.md")
|
||||
pickFirsts.add("META-INF/LICENSE-notice.md")
|
||||
pickFirsts.add("MANIFEST.MF")
|
||||
}
|
||||
}
|
||||
|
||||
static def gitRevision() {
|
||||
|
|
|
@ -23,7 +23,6 @@ import androidx.test.internal.runner.junit4.statement.UiThreadStatement
|
|||
import kotlinx.coroutines.CompletableDeferred
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.ExperimentalCoroutinesApi
|
||||
import kotlinx.coroutines.Job
|
||||
import kotlinx.coroutines.cancel
|
||||
import kotlinx.coroutines.delay
|
||||
|
@ -58,6 +57,7 @@ import java.util.concurrent.CountDownLatch
|
|||
import java.util.concurrent.TimeUnit
|
||||
import kotlin.coroutines.resume
|
||||
import kotlin.coroutines.suspendCoroutine
|
||||
import kotlin.time.Duration.Companion.milliseconds
|
||||
|
||||
/**
|
||||
* This class exposes methods to be used in common cases
|
||||
|
@ -67,10 +67,9 @@ class CommonTestHelper internal constructor(context: Context, val cryptoConfig:
|
|||
|
||||
companion object {
|
||||
|
||||
@OptIn(ExperimentalCoroutinesApi::class)
|
||||
internal fun runSessionTest(context: Context, cryptoConfig: MXCryptoConfig? = null, autoSignoutOnClose: Boolean = true, block: suspend CoroutineScope.(CommonTestHelper) -> Unit) {
|
||||
val testHelper = CommonTestHelper(context, cryptoConfig)
|
||||
return runTest(dispatchTimeoutMs = TestConstants.timeOutMillis) {
|
||||
return runTest(timeout = TestConstants.timeOutMillis.milliseconds) {
|
||||
try {
|
||||
withContext(Dispatchers.Default) {
|
||||
block(testHelper)
|
||||
|
@ -83,11 +82,10 @@ class CommonTestHelper internal constructor(context: Context, val cryptoConfig:
|
|||
}
|
||||
}
|
||||
|
||||
@OptIn(ExperimentalCoroutinesApi::class)
|
||||
internal fun runCryptoTest(context: Context, cryptoConfig: MXCryptoConfig? = null, autoSignoutOnClose: Boolean = true, block: suspend CoroutineScope.(CryptoTestHelper, CommonTestHelper) -> Unit) {
|
||||
val testHelper = CommonTestHelper(context, cryptoConfig)
|
||||
val cryptoTestHelper = CryptoTestHelper(testHelper)
|
||||
return runTest(dispatchTimeoutMs = TestConstants.timeOutMillis) {
|
||||
return runTest(timeout = TestConstants.timeOutMillis.milliseconds) {
|
||||
try {
|
||||
withContext(Dispatchers.Default) {
|
||||
block(cryptoTestHelper, testHelper)
|
||||
|
@ -100,11 +98,10 @@ class CommonTestHelper internal constructor(context: Context, val cryptoConfig:
|
|||
}
|
||||
}
|
||||
|
||||
@OptIn(ExperimentalCoroutinesApi::class)
|
||||
internal fun runLongCryptoTest(context: Context, cryptoConfig: MXCryptoConfig? = null, autoSignoutOnClose: Boolean = true, block: suspend CoroutineScope.(CryptoTestHelper, CommonTestHelper) -> Unit) {
|
||||
val testHelper = CommonTestHelper(context, cryptoConfig)
|
||||
val cryptoTestHelper = CryptoTestHelper(testHelper)
|
||||
return runTest(dispatchTimeoutMs = TestConstants.timeOutMillis * 4) {
|
||||
return runTest(timeout = (TestConstants.timeOutMillis * 4).milliseconds) {
|
||||
try {
|
||||
withContext(Dispatchers.Default) {
|
||||
block(cryptoTestHelper, testHelper)
|
||||
|
|
|
@ -37,10 +37,10 @@ suspend fun <T> LiveData<T>.first(timeout: Long = TestConstants.timeOutMillis, p
|
|||
withContext(Dispatchers.Main) {
|
||||
suspendCancellableCoroutine { continuation ->
|
||||
val observer = object : Observer<T> {
|
||||
override fun onChanged(data: T) {
|
||||
if (predicate(data)) {
|
||||
override fun onChanged(value: T) {
|
||||
if (predicate(value)) {
|
||||
removeObserver(this)
|
||||
continuation.resume(data)
|
||||
continuation.resume(value)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,7 +26,6 @@ import org.junit.runners.JUnit4
|
|||
import org.junit.runners.MethodSorters
|
||||
import org.matrix.android.sdk.InstrumentedTest
|
||||
import org.matrix.android.sdk.api.session.crypto.MXCryptoError
|
||||
import org.matrix.android.sdk.api.session.getRoom
|
||||
import org.matrix.android.sdk.api.session.room.timeline.getLastMessageContent
|
||||
import org.matrix.android.sdk.common.CommonTestHelper.Companion.runCryptoTest
|
||||
|
||||
|
|
|
@ -21,7 +21,6 @@ import androidx.test.ext.junit.runners.AndroidJUnit4
|
|||
import androidx.test.filters.LargeTest
|
||||
import junit.framework.TestCase.assertEquals
|
||||
import junit.framework.TestCase.assertNotNull
|
||||
import junit.framework.TestCase.assertTrue
|
||||
import org.amshove.kluent.shouldBeEqualTo
|
||||
import org.junit.Assert
|
||||
import org.junit.Assert.assertNull
|
||||
|
|
|
@ -56,7 +56,7 @@ class RealmSessionStoreMigration43Test {
|
|||
}
|
||||
|
||||
@Test
|
||||
fun migrationShouldBeNeeed() {
|
||||
fun migrationShouldBeNeeded() {
|
||||
val realmName = "session_42.realm"
|
||||
val realmConfiguration = configurationFactory.createConfiguration(
|
||||
realmName,
|
||||
|
|
|
@ -27,11 +27,9 @@ import java.io.File
|
|||
import java.io.FileOutputStream
|
||||
import java.io.IOException
|
||||
import java.io.InputStream
|
||||
import java.lang.IllegalStateException
|
||||
import java.util.Collections
|
||||
import java.util.Locale
|
||||
import java.util.concurrent.ConcurrentHashMap
|
||||
import kotlin.Throws
|
||||
|
||||
/**
|
||||
* Based on https://github.com/realm/realm-java/blob/master/realm/realm-library/src/testUtils/java/io/realm/TestRealmConfigurationFactory.java
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools">
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
package org.matrix.android.sdk.internal.crypto.store
|
||||
|
||||
import androidx.lifecycle.LiveData
|
||||
import androidx.lifecycle.Transformations
|
||||
import androidx.lifecycle.map
|
||||
import com.zhuinden.monarchy.Monarchy
|
||||
import io.realm.Realm
|
||||
import io.realm.RealmConfiguration
|
||||
|
@ -280,7 +280,7 @@ internal class RustCryptoStore @Inject constructor(
|
|||
{ entity -> myDeviceLastSeenInfoEntityMapper.map(entity) }
|
||||
)
|
||||
|
||||
return Transformations.map(liveData) {
|
||||
return liveData.map {
|
||||
it.firstOrNull().toOptional()
|
||||
}
|
||||
}
|
||||
|
@ -351,7 +351,7 @@ internal class RustCryptoStore @Inject constructor(
|
|||
)
|
||||
}
|
||||
)
|
||||
return Transformations.map(liveData) {
|
||||
return liveData.map {
|
||||
it.firstOrNull() ?: GlobalCryptoConfig(false, false, false)
|
||||
}
|
||||
}
|
||||
|
@ -372,7 +372,7 @@ internal class RustCryptoStore @Inject constructor(
|
|||
it.blacklistUnverifiedDevices
|
||||
}
|
||||
)
|
||||
return Transformations.map(liveData) {
|
||||
return liveData.map {
|
||||
it.firstOrNull() ?: false
|
||||
}
|
||||
}
|
||||
|
|
|
@ -39,6 +39,7 @@ import org.matrix.android.sdk.internal.crypto.store.db.migration.MigrateCryptoTo
|
|||
import org.matrix.android.sdk.internal.crypto.store.db.migration.MigrateCryptoTo020
|
||||
import org.matrix.android.sdk.internal.crypto.store.db.migration.MigrateCryptoTo021
|
||||
import org.matrix.android.sdk.internal.crypto.store.db.migration.MigrateCryptoTo022
|
||||
import org.matrix.android.sdk.internal.crypto.store.db.migration.MigrateCryptoTo023
|
||||
import org.matrix.android.sdk.internal.util.database.MatrixRealmMigration
|
||||
import org.matrix.android.sdk.internal.util.time.Clock
|
||||
import javax.inject.Inject
|
||||
|
@ -54,7 +55,7 @@ internal class RealmCryptoStoreMigration @Inject constructor(
|
|||
private val rustMigrationInfoProvider: RustMigrationInfoProvider,
|
||||
) : MatrixRealmMigration(
|
||||
dbName = "Crypto",
|
||||
schemaVersion = 22L,
|
||||
schemaVersion = 23L,
|
||||
) {
|
||||
/**
|
||||
* Forces all RealmCryptoStoreMigration instances to be equal.
|
||||
|
@ -91,5 +92,6 @@ internal class RealmCryptoStoreMigration @Inject constructor(
|
|||
rustMigrationInfoProvider.rustEncryptionConfiguration,
|
||||
rustMigrationInfoProvider.migrateMegolmGroupSessions
|
||||
).perform()
|
||||
if (oldVersion < 23) MigrateCryptoTo023(realm).perform()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,30 @@
|
|||
/*
|
||||
* Copyright (c) 2024 The Matrix.org Foundation C.I.C.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.matrix.android.sdk.internal.crypto.store.db.migration
|
||||
|
||||
import io.realm.DynamicRealm
|
||||
import org.matrix.android.sdk.internal.crypto.store.db.model.OutgoingKeyRequestEntityFields
|
||||
import org.matrix.android.sdk.internal.util.database.RealmMigrator
|
||||
|
||||
// Some fields are now required due to upgrade of Kotlin version.
|
||||
// See https://github.com/realm/realm-java/issues/7810 for more details.
|
||||
internal class MigrateCryptoTo023(realm: DynamicRealm) : RealmMigrator(realm, 23) {
|
||||
override fun doMigrate(realm: DynamicRealm) {
|
||||
realm.schema.get("OutgoingKeyRequestEntity")
|
||||
?.setRequired(OutgoingKeyRequestEntityFields.REQUEST_STATE_STR, true)
|
||||
}
|
||||
}
|
|
@ -71,6 +71,7 @@ import org.matrix.android.sdk.internal.database.migration.MigrateSessionTo051
|
|||
import org.matrix.android.sdk.internal.database.migration.MigrateSessionTo052
|
||||
import org.matrix.android.sdk.internal.database.migration.MigrateSessionTo053
|
||||
import org.matrix.android.sdk.internal.database.migration.MigrateSessionTo054
|
||||
import org.matrix.android.sdk.internal.database.migration.MigrateSessionTo055
|
||||
import org.matrix.android.sdk.internal.util.Normalizer
|
||||
import org.matrix.android.sdk.internal.util.database.MatrixRealmMigration
|
||||
import javax.inject.Inject
|
||||
|
@ -79,7 +80,7 @@ internal class RealmSessionStoreMigration @Inject constructor(
|
|||
private val normalizer: Normalizer
|
||||
) : MatrixRealmMigration(
|
||||
dbName = "Session",
|
||||
schemaVersion = 54L,
|
||||
schemaVersion = 55L,
|
||||
) {
|
||||
/**
|
||||
* Forces all RealmSessionStoreMigration instances to be equal.
|
||||
|
@ -143,5 +144,6 @@ internal class RealmSessionStoreMigration @Inject constructor(
|
|||
if (oldVersion < 52) MigrateSessionTo052(realm).perform()
|
||||
if (oldVersion < 53) MigrateSessionTo053(realm).perform()
|
||||
if (oldVersion < 54) MigrateSessionTo054(realm).perform()
|
||||
if (oldVersion < 55) MigrateSessionTo055(realm).perform()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,57 @@
|
|||
/*
|
||||
* Copyright (c) 2024 The Matrix.org Foundation C.I.C.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.matrix.android.sdk.internal.database.migration
|
||||
|
||||
import io.realm.DynamicRealm
|
||||
import org.matrix.android.sdk.internal.database.model.EventEntityFields
|
||||
import org.matrix.android.sdk.internal.database.model.EventInsertEntityFields
|
||||
import org.matrix.android.sdk.internal.database.model.LocalRoomSummaryEntityFields
|
||||
import org.matrix.android.sdk.internal.database.model.PushRulesEntityFields
|
||||
import org.matrix.android.sdk.internal.database.model.PusherEntityFields
|
||||
import org.matrix.android.sdk.internal.database.model.RoomEntityFields
|
||||
import org.matrix.android.sdk.internal.database.model.RoomMemberSummaryEntityFields
|
||||
import org.matrix.android.sdk.internal.database.model.RoomSummaryEntityFields
|
||||
import org.matrix.android.sdk.internal.database.model.presence.UserPresenceEntityFields
|
||||
import org.matrix.android.sdk.internal.util.database.RealmMigrator
|
||||
|
||||
// Some fields are now required due to upgrade of Kotlin version.
|
||||
// See https://github.com/realm/realm-java/issues/7810 for more details.
|
||||
internal class MigrateSessionTo055(realm: DynamicRealm) : RealmMigrator(realm, 55) {
|
||||
override fun doMigrate(realm: DynamicRealm) {
|
||||
realm.schema.get("EventEntity")
|
||||
?.setRequired(EventEntityFields.SEND_STATE_STR, true)
|
||||
?.setRequired(EventEntityFields.THREAD_NOTIFICATION_STATE_STR, true)
|
||||
realm.schema.get("EventInsertEntity")
|
||||
?.setRequired(EventInsertEntityFields.INSERT_TYPE_STR, true)
|
||||
realm.schema.get("LocalRoomSummaryEntity")
|
||||
?.setRequired(LocalRoomSummaryEntityFields.STATE_STR, true)
|
||||
realm.schema.get("PushRulesEntity")
|
||||
?.setRequired(PushRulesEntityFields.KIND_STR, true)
|
||||
realm.schema.get("PusherEntity")
|
||||
?.setRequired(PusherEntityFields.STATE_STR, true)
|
||||
realm.schema.get("RoomEntity")
|
||||
?.setRequired(RoomEntityFields.MEMBERSHIP_STR, true)
|
||||
?.setRequired(RoomEntityFields.MEMBERS_LOAD_STATUS_STR, true)
|
||||
realm.schema.get("RoomMemberSummaryEntity")
|
||||
?.setRequired(RoomMemberSummaryEntityFields.MEMBERSHIP_STR, true)
|
||||
realm.schema.get("RoomSummaryEntity")
|
||||
?.setRequired(RoomSummaryEntityFields.MEMBERSHIP_STR, true)
|
||||
?.setRequired(RoomSummaryEntityFields.VERSIONING_STATE_STR, true)
|
||||
realm.schema.get("UserPresenceEntity")
|
||||
?.setRequired(UserPresenceEntityFields.PRESENCE_STR, true)
|
||||
}
|
||||
}
|
|
@ -84,10 +84,10 @@ internal class WorkManagerProvider @Inject constructor(
|
|||
workManager.enqueue(checkWorkerRequest)
|
||||
val checkWorkerLiveState = workManager.getWorkInfoByIdLiveData(checkWorkerRequest.id)
|
||||
val observer = object : Observer<WorkInfo> {
|
||||
override fun onChanged(workInfo: WorkInfo?) {
|
||||
if (workInfo?.state?.isFinished == true) {
|
||||
override fun onChanged(value: WorkInfo) {
|
||||
if (value.state.isFinished) {
|
||||
checkWorkerLiveState.removeObserver(this)
|
||||
if (workInfo.state == WorkInfo.State.FAILED) {
|
||||
if (value.state == WorkInfo.State.FAILED) {
|
||||
throw RuntimeException(
|
||||
"MatrixWorkerFactory is not being set on your worker configuration.\n" +
|
||||
"Makes sure to add it to a DelegatingWorkerFactory if you have your own factory or use it directly.\n" +
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
package org.matrix.android.sdk.internal.session.contentscanner.db
|
||||
|
||||
import androidx.lifecycle.LiveData
|
||||
import androidx.lifecycle.Transformations
|
||||
import androidx.lifecycle.map
|
||||
import com.zhuinden.monarchy.Monarchy
|
||||
import io.realm.Realm
|
||||
import io.realm.RealmConfiguration
|
||||
|
@ -138,7 +138,7 @@ internal class RealmContentScannerStore @Inject constructor(
|
|||
entity.toModel()
|
||||
}
|
||||
)
|
||||
return Transformations.map(liveData) {
|
||||
return liveData.map {
|
||||
it.firstOrNull().toOptional()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
package org.matrix.android.sdk.internal.session.homeserver
|
||||
|
||||
import androidx.lifecycle.LiveData
|
||||
import androidx.lifecycle.Transformations
|
||||
import androidx.lifecycle.map
|
||||
import com.zhuinden.monarchy.Monarchy
|
||||
import io.realm.Realm
|
||||
import io.realm.kotlin.where
|
||||
|
@ -46,7 +46,7 @@ internal class HomeServerCapabilitiesDataSource @Inject constructor(
|
|||
{ realm: Realm -> realm.where<HomeServerCapabilitiesEntity>() },
|
||||
{ HomeServerCapabilitiesMapper.map(it) }
|
||||
)
|
||||
return Transformations.map(liveData) {
|
||||
return liveData.map {
|
||||
it.firstOrNull().toOptional()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -84,7 +84,10 @@ internal class DefaultIdentityService @Inject constructor(
|
|||
private val sessionParams: SessionParams
|
||||
) : IdentityService, SessionLifecycleObserver {
|
||||
|
||||
private val lifecycleOwner: LifecycleOwner = LifecycleOwner { lifecycleRegistry }
|
||||
private val lifecycleOwner: LifecycleOwner = object : LifecycleOwner {
|
||||
override val lifecycle: Lifecycle
|
||||
get() = lifecycleRegistry
|
||||
}
|
||||
private val lifecycleRegistry: LifecycleRegistry = LifecycleRegistry(lifecycleOwner)
|
||||
|
||||
private val listeners = mutableSetOf<IdentityServiceListener>()
|
||||
|
|
|
@ -64,7 +64,10 @@ internal class IntegrationManager @Inject constructor(
|
|||
SessionLifecycleObserver {
|
||||
|
||||
private val currentConfigs = ArrayList<IntegrationManagerConfig>()
|
||||
private val lifecycleOwner: LifecycleOwner = LifecycleOwner { lifecycleRegistry }
|
||||
private val lifecycleOwner: LifecycleOwner = object : LifecycleOwner {
|
||||
override val lifecycle: Lifecycle
|
||||
get() = lifecycleRegistry
|
||||
}
|
||||
private val lifecycleRegistry: LifecycleRegistry = LifecycleRegistry(lifecycleOwner)
|
||||
|
||||
private val listeners = HashSet<IntegrationManagerService.Listener>()
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
package org.matrix.android.sdk.internal.session.pushrules
|
||||
|
||||
import androidx.lifecycle.LiveData
|
||||
import androidx.lifecycle.Transformations
|
||||
import androidx.lifecycle.map
|
||||
import com.zhuinden.monarchy.Monarchy
|
||||
import org.matrix.android.sdk.api.session.events.model.Event
|
||||
import org.matrix.android.sdk.api.session.pushrules.Action
|
||||
|
@ -160,7 +160,7 @@ internal class DefaultPushRuleService @Inject constructor(
|
|||
result.pushRules.map(PushRuleEntity::ruleId).filter { !it.startsWith(".") }
|
||||
}
|
||||
)
|
||||
return Transformations.map(liveData) { results ->
|
||||
return liveData.map { results ->
|
||||
results.firstOrNull().orEmpty().toSet()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
package org.matrix.android.sdk.internal.session.room
|
||||
|
||||
import androidx.lifecycle.LiveData
|
||||
import androidx.lifecycle.Transformations
|
||||
import androidx.lifecycle.map
|
||||
import androidx.paging.PagedList
|
||||
import com.zhuinden.monarchy.Monarchy
|
||||
import org.matrix.android.sdk.api.session.events.model.Event
|
||||
|
@ -242,7 +242,7 @@ internal class DefaultRoomService @Inject constructor(
|
|||
},
|
||||
{ it.asDomain() }
|
||||
)
|
||||
return Transformations.map(liveData) { results ->
|
||||
return liveData.map { results ->
|
||||
results.firstOrNull().toOptional()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
package org.matrix.android.sdk.internal.session.room
|
||||
|
||||
import androidx.lifecycle.LiveData
|
||||
import androidx.lifecycle.Transformations
|
||||
import androidx.lifecycle.map
|
||||
import com.zhuinden.monarchy.Monarchy
|
||||
import io.realm.Realm
|
||||
import org.matrix.android.sdk.api.extensions.orFalse
|
||||
|
@ -48,7 +48,7 @@ internal class RoomDataSource @Inject constructor(
|
|||
}
|
||||
)
|
||||
|
||||
return Transformations.map(liveData) { results ->
|
||||
return liveData.map { results ->
|
||||
results.firstOrNull().orFalse()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@ package org.matrix.android.sdk.internal.session.room.accountdata
|
|||
|
||||
import androidx.lifecycle.LiveData
|
||||
import androidx.lifecycle.MediatorLiveData
|
||||
import androidx.lifecycle.Transformations
|
||||
import androidx.lifecycle.map
|
||||
import com.zhuinden.monarchy.Monarchy
|
||||
import io.realm.Realm
|
||||
import io.realm.RealmQuery
|
||||
|
@ -44,7 +44,7 @@ internal class RoomAccountDataDataSource @Inject constructor(
|
|||
}
|
||||
|
||||
fun getLiveAccountDataEvent(roomId: String, type: String): LiveData<Optional<RoomAccountDataEvent>> {
|
||||
return Transformations.map(getLiveAccountDataEvents(roomId, setOf(type))) {
|
||||
return getLiveAccountDataEvents(roomId, setOf(type)).map {
|
||||
it.firstOrNull().toOptional()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
package org.matrix.android.sdk.internal.session.room.draft
|
||||
|
||||
import androidx.lifecycle.LiveData
|
||||
import androidx.lifecycle.Transformations
|
||||
import androidx.lifecycle.map
|
||||
import com.zhuinden.monarchy.Monarchy
|
||||
import io.realm.Realm
|
||||
import io.realm.kotlin.createObject
|
||||
|
@ -72,7 +72,7 @@ internal class DraftRepository @Inject constructor(
|
|||
}
|
||||
}
|
||||
)
|
||||
return Transformations.map(liveData) {
|
||||
return liveData.map {
|
||||
it.firstOrNull()?.firstOrNull().toOptional()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
package org.matrix.android.sdk.internal.session.room.location
|
||||
|
||||
import androidx.lifecycle.LiveData
|
||||
import androidx.lifecycle.Transformations
|
||||
import androidx.lifecycle.map
|
||||
import com.zhuinden.monarchy.Monarchy
|
||||
import dagger.assisted.Assisted
|
||||
import dagger.assisted.AssistedFactory
|
||||
|
@ -119,12 +119,12 @@ internal class DefaultLocationSharingService @AssistedInject constructor(
|
|||
}
|
||||
|
||||
override fun getLiveLocationShareSummary(beaconInfoEventId: String): LiveData<Optional<LiveLocationShareAggregatedSummary>> {
|
||||
return Transformations.map(
|
||||
monarchy.findAllMappedWithChanges(
|
||||
return monarchy
|
||||
.findAllMappedWithChanges(
|
||||
{ LiveLocationShareAggregatedSummaryEntity.where(it, roomId = roomId, eventId = beaconInfoEventId) },
|
||||
liveLocationShareAggregatedSummaryMapper
|
||||
)
|
||||
) {
|
||||
.map {
|
||||
it.firstOrNull().toOptional()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
package org.matrix.android.sdk.internal.session.room.notification
|
||||
|
||||
import androidx.lifecycle.LiveData
|
||||
import androidx.lifecycle.Transformations
|
||||
import androidx.lifecycle.map
|
||||
import com.zhuinden.monarchy.Monarchy
|
||||
import dagger.assisted.Assisted
|
||||
import dagger.assisted.AssistedFactory
|
||||
|
@ -42,7 +42,7 @@ internal class DefaultRoomPushRuleService @AssistedInject constructor(
|
|||
}
|
||||
|
||||
override fun getLiveRoomNotificationState(): LiveData<RoomNotificationState> {
|
||||
return Transformations.map(getPushRuleForRoom()) {
|
||||
return getPushRuleForRoom().map {
|
||||
it?.toRoomNotificationState() ?: RoomNotificationState.ALL_MESSAGES
|
||||
}
|
||||
}
|
||||
|
@ -60,7 +60,7 @@ internal class DefaultRoomPushRuleService @AssistedInject constructor(
|
|||
result.toRoomPushRule()
|
||||
}
|
||||
)
|
||||
return Transformations.map(liveData) { results ->
|
||||
return liveData.map { results ->
|
||||
results.firstOrNull()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,7 +17,8 @@
|
|||
package org.matrix.android.sdk.internal.session.room.poll
|
||||
|
||||
import androidx.lifecycle.LiveData
|
||||
import androidx.lifecycle.Transformations
|
||||
import androidx.lifecycle.map
|
||||
import androidx.lifecycle.switchMap
|
||||
import com.zhuinden.monarchy.Monarchy
|
||||
import dagger.assisted.Assisted
|
||||
import dagger.assisted.AssistedFactory
|
||||
|
@ -112,7 +113,7 @@ internal class DefaultPollHistoryService @AssistedInject constructor(
|
|||
override fun getPollEvents(): LiveData<List<TimelineEvent>> {
|
||||
val pollHistoryStatusLiveData = getPollHistoryStatus()
|
||||
|
||||
return Transformations.switchMap(pollHistoryStatusLiveData) { results ->
|
||||
return pollHistoryStatusLiveData.switchMap { results ->
|
||||
val oldestTimestamp = results.firstOrNull()?.oldestTimestampTargetReachedMs ?: clock.epochMillis()
|
||||
getPollStartEventsAfter(oldestTimestamp)
|
||||
}
|
||||
|
@ -132,7 +133,7 @@ internal class DefaultPollHistoryService @AssistedInject constructor(
|
|||
}
|
||||
)
|
||||
|
||||
return Transformations.map(eventsLiveData) { events ->
|
||||
return eventsLiveData.map { events ->
|
||||
events.filter { it.root.getClearType() in EventType.POLL_START.values }
|
||||
.distinctBy { it.eventId }
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
package org.matrix.android.sdk.internal.session.room.read
|
||||
|
||||
import androidx.lifecycle.LiveData
|
||||
import androidx.lifecycle.Transformations
|
||||
import androidx.lifecycle.map
|
||||
import com.zhuinden.monarchy.Monarchy
|
||||
import dagger.assisted.Assisted
|
||||
import dagger.assisted.AssistedFactory
|
||||
|
@ -94,7 +94,7 @@ internal class DefaultReadService @AssistedInject constructor(
|
|||
{ ReadMarkerEntity.where(it, roomId) },
|
||||
{ it.eventId }
|
||||
)
|
||||
return Transformations.map(liveRealmData) {
|
||||
return liveRealmData.map {
|
||||
it.firstOrNull().toOptional()
|
||||
}
|
||||
}
|
||||
|
@ -104,7 +104,7 @@ internal class DefaultReadService @AssistedInject constructor(
|
|||
{ ReadReceiptEntity.where(it, roomId = roomId, userId = userId, threadId = threadId) },
|
||||
{ it.eventId }
|
||||
)
|
||||
return Transformations.map(liveRealmData) {
|
||||
return liveRealmData.map {
|
||||
it.firstOrNull().toOptional()
|
||||
}
|
||||
}
|
||||
|
@ -125,7 +125,7 @@ internal class DefaultReadService @AssistedInject constructor(
|
|||
{ ReadReceiptsSummaryEntity.where(it, eventId) },
|
||||
{ readReceiptsSummaryMapper.map(it) }
|
||||
)
|
||||
return Transformations.map(liveRealmData) {
|
||||
return liveRealmData.map {
|
||||
it.firstOrNull().orEmpty()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
package org.matrix.android.sdk.internal.session.room.relation
|
||||
|
||||
import androidx.lifecycle.LiveData
|
||||
import androidx.lifecycle.Transformations
|
||||
import androidx.lifecycle.map
|
||||
import com.zhuinden.monarchy.Monarchy
|
||||
import dagger.assisted.Assisted
|
||||
import dagger.assisted.AssistedFactory
|
||||
|
@ -163,7 +163,7 @@ internal class DefaultRelationService @AssistedInject constructor(
|
|||
{ EventAnnotationsSummaryEntity.where(it, roomId, eventId) },
|
||||
{ it.asDomain() }
|
||||
)
|
||||
return Transformations.map(liveData) { results ->
|
||||
return liveData.map { results ->
|
||||
results.firstOrNull().toOptional()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
package org.matrix.android.sdk.internal.session.room.state
|
||||
|
||||
import androidx.lifecycle.LiveData
|
||||
import androidx.lifecycle.Transformations
|
||||
import androidx.lifecycle.map
|
||||
import com.zhuinden.monarchy.Monarchy
|
||||
import io.realm.Realm
|
||||
import io.realm.RealmQuery
|
||||
|
@ -52,7 +52,7 @@ internal class StateEventDataSource @Inject constructor(
|
|||
{ realm -> buildStateEventQuery(realm, roomId, setOf(eventType), stateKey) },
|
||||
{ it.root?.asDomain() }
|
||||
)
|
||||
return Transformations.map(liveData) { results ->
|
||||
return liveData.map { results ->
|
||||
results.firstOrNull().toOptional()
|
||||
}
|
||||
}
|
||||
|
@ -72,7 +72,7 @@ internal class StateEventDataSource @Inject constructor(
|
|||
{ realm -> buildStateEventQuery(realm, roomId, eventTypes, stateKey) },
|
||||
{ it.root?.asDomain() }
|
||||
)
|
||||
return Transformations.map(liveData) { results ->
|
||||
return liveData.map { results ->
|
||||
results.filterNotNull()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,7 +19,8 @@ package org.matrix.android.sdk.internal.session.room.summary
|
|||
|
||||
import androidx.lifecycle.LiveData
|
||||
import androidx.lifecycle.MutableLiveData
|
||||
import androidx.lifecycle.Transformations
|
||||
import androidx.lifecycle.map
|
||||
import androidx.lifecycle.switchMap
|
||||
import androidx.paging.LivePagedListBuilder
|
||||
import androidx.paging.PagedList
|
||||
import com.zhuinden.monarchy.Monarchy
|
||||
|
@ -84,7 +85,7 @@ internal class RoomSummaryDataSource @Inject constructor(
|
|||
{ realm -> RoomSummaryEntity.where(realm, roomId).isNotEmpty(RoomSummaryEntityFields.DISPLAY_NAME) },
|
||||
{ roomSummaryMapper.map(it) }
|
||||
)
|
||||
return Transformations.map(liveData) { results ->
|
||||
return liveData.map { results ->
|
||||
results.firstOrNull().toOptional()
|
||||
}
|
||||
}
|
||||
|
@ -113,7 +114,7 @@ internal class RoomSummaryDataSource @Inject constructor(
|
|||
{ realm -> LocalRoomSummaryEntity.where(realm, roomId) },
|
||||
{ localRoomSummaryMapper.map(it) }
|
||||
)
|
||||
return Transformations.map(liveData) { results ->
|
||||
return liveData.map { results ->
|
||||
results.firstOrNull().toOptional()
|
||||
}
|
||||
}
|
||||
|
@ -165,7 +166,7 @@ internal class RoomSummaryDataSource @Inject constructor(
|
|||
roomSummaryMapper.map(it)
|
||||
}
|
||||
)
|
||||
return Transformations.map(liveData) { results ->
|
||||
return liveData.map { results ->
|
||||
results.firstOrNull().toOptional()
|
||||
}
|
||||
}
|
||||
|
@ -292,7 +293,7 @@ internal class RoomSummaryDataSource @Inject constructor(
|
|||
val liveRooms = monarchy.findAllManagedWithChanges {
|
||||
roomSummariesQuery(it, queryParams)
|
||||
}
|
||||
return Transformations.map(liveRooms) {
|
||||
return liveRooms.map {
|
||||
it.realmResults.where().count().toInt()
|
||||
}
|
||||
}
|
||||
|
@ -387,7 +388,7 @@ internal class RoomSummaryDataSource @Inject constructor(
|
|||
// and switch map to listen those?
|
||||
val mediatorLiveData = HierarchyLiveDataHelper(spaceId, memberShips, this).liveData()
|
||||
|
||||
return Transformations.switchMap(mediatorLiveData) { allIds ->
|
||||
return mediatorLiveData.switchMap { allIds ->
|
||||
monarchy.findAllMappedWithChanges(
|
||||
{
|
||||
it.where<RoomSummaryEntity>()
|
||||
|
@ -412,13 +413,14 @@ internal class RoomSummaryDataSource @Inject constructor(
|
|||
}
|
||||
|
||||
fun getFlattenOrphanRoomsLive(): LiveData<List<RoomSummary>> {
|
||||
return Transformations.map(
|
||||
getRoomSummariesLive(roomSummaryQueryParams {
|
||||
return getRoomSummariesLive(
|
||||
roomSummaryQueryParams {
|
||||
memberships = Membership.activeMemberships()
|
||||
excludeType = listOf(RoomType.SPACE)
|
||||
roomCategoryFilter = RoomCategoryFilter.ONLY_ROOMS
|
||||
})
|
||||
) {
|
||||
}
|
||||
)
|
||||
.map {
|
||||
it.filter { isOrphan(it) }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
package org.matrix.android.sdk.internal.session.user
|
||||
|
||||
import androidx.lifecycle.LiveData
|
||||
import androidx.lifecycle.Transformations
|
||||
import androidx.lifecycle.map
|
||||
import androidx.paging.DataSource
|
||||
import androidx.paging.LivePagedListBuilder
|
||||
import androidx.paging.PagedList
|
||||
|
@ -73,7 +73,7 @@ internal class UserDataSource @Inject constructor(
|
|||
{ UserEntity.where(it, userId) },
|
||||
{ it.asDomain() }
|
||||
)
|
||||
return Transformations.map(liveData) { results ->
|
||||
return liveData.map { results ->
|
||||
results.firstOrNull().toOptional()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
package org.matrix.android.sdk.internal.session.user.accountdata
|
||||
|
||||
import androidx.lifecycle.LiveData
|
||||
import androidx.lifecycle.Transformations
|
||||
import androidx.lifecycle.map
|
||||
import com.zhuinden.monarchy.Monarchy
|
||||
import io.realm.Realm
|
||||
import io.realm.RealmQuery
|
||||
|
@ -42,7 +42,7 @@ internal class UserAccountDataDataSource @Inject constructor(
|
|||
}
|
||||
|
||||
fun getLiveAccountDataEvent(type: String): LiveData<Optional<UserAccountDataEvent>> {
|
||||
return Transformations.map(getLiveAccountDataEvents(setOf(type))) {
|
||||
return getLiveAccountDataEvents(setOf(type)).map {
|
||||
it.firstOrNull().toOptional()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@ import androidx.lifecycle.Lifecycle
|
|||
import androidx.lifecycle.LifecycleOwner
|
||||
import androidx.lifecycle.LifecycleRegistry
|
||||
import androidx.lifecycle.LiveData
|
||||
import androidx.lifecycle.Transformations
|
||||
import androidx.lifecycle.map
|
||||
import org.matrix.android.sdk.api.query.QueryStateEventValue
|
||||
import org.matrix.android.sdk.api.query.QueryStringValue
|
||||
import org.matrix.android.sdk.api.session.Session
|
||||
|
@ -57,7 +57,10 @@ internal class WidgetManager @Inject constructor(
|
|||
|
||||
IntegrationManagerService.Listener, SessionLifecycleObserver {
|
||||
|
||||
private val lifecycleOwner: LifecycleOwner = LifecycleOwner { lifecycleRegistry }
|
||||
private val lifecycleOwner: LifecycleOwner = object : LifecycleOwner {
|
||||
override val lifecycle: Lifecycle
|
||||
get() = lifecycleRegistry
|
||||
}
|
||||
private val lifecycleRegistry: LifecycleRegistry = LifecycleRegistry(lifecycleOwner)
|
||||
|
||||
override fun onSessionStarted(session: Session) {
|
||||
|
@ -82,7 +85,7 @@ internal class WidgetManager @Inject constructor(
|
|||
eventTypes = setOf(EventType.STATE_ROOM_WIDGET, EventType.STATE_ROOM_WIDGET_LEGACY),
|
||||
stateKey = widgetId
|
||||
)
|
||||
return Transformations.map(liveWidgetEvents) { widgetEvents ->
|
||||
return liveWidgetEvents.map { widgetEvents ->
|
||||
widgetEvents.mapEventsToWidgets(widgetTypes, excludedTypes)
|
||||
}
|
||||
}
|
||||
|
@ -141,7 +144,7 @@ internal class WidgetManager @Inject constructor(
|
|||
excludedTypes: Set<String>? = null
|
||||
): LiveData<List<Widget>> {
|
||||
val widgetsAccountData = userAccountDataDataSource.getLiveAccountDataEvent(UserAccountDataTypes.TYPE_WIDGETS)
|
||||
return Transformations.map(widgetsAccountData) {
|
||||
return widgetsAccountData.map {
|
||||
it.getOrNull()?.mapToWidgets(widgetTypes, excludedTypes).orEmpty()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,6 +19,6 @@ package org.matrix.android.sdk.internal.util
|
|||
import androidx.collection.LruCache
|
||||
|
||||
@Suppress("NULLABLE_TYPE_PARAMETER_AGAINST_NOT_NULL_TYPE_PARAMETER")
|
||||
internal inline fun <K, V> LruCache<K, V>.getOrPut(key: K, defaultValue: () -> V): V {
|
||||
internal inline fun <K : Any, V : Any> LruCache<K, V>.getOrPut(key: K, defaultValue: () -> V): V {
|
||||
return get(key) ?: defaultValue().also { put(key, it) }
|
||||
}
|
||||
|
|
|
@ -29,7 +29,6 @@ import org.junit.Test
|
|||
import org.matrix.android.sdk.BuildConfig
|
||||
import org.matrix.android.sdk.api.util.getApplicationInfoCompat
|
||||
import org.matrix.android.sdk.api.util.getPackageInfoCompat
|
||||
import java.lang.Exception
|
||||
|
||||
private const val A_PACKAGE_NAME = "org.matrix.sdk"
|
||||
private const val AN_APP_NAME = "Element"
|
||||
|
|
|
@ -16,17 +16,12 @@
|
|||
|
||||
package org.matrix.android.sdk.internal.session.room.location
|
||||
|
||||
import androidx.arch.core.util.Function
|
||||
import androidx.lifecycle.MutableLiveData
|
||||
import androidx.lifecycle.Transformations
|
||||
import io.mockk.coEvery
|
||||
import io.mockk.coVerify
|
||||
import io.mockk.every
|
||||
import io.mockk.just
|
||||
import io.mockk.mockk
|
||||
import io.mockk.mockkStatic
|
||||
import io.mockk.runs
|
||||
import io.mockk.slot
|
||||
import io.mockk.unmockkAll
|
||||
import kotlinx.coroutines.ExperimentalCoroutinesApi
|
||||
import kotlinx.coroutines.test.runTest
|
||||
|
@ -37,7 +32,6 @@ import org.junit.Test
|
|||
import org.matrix.android.sdk.api.session.room.location.UpdateLiveLocationShareResult
|
||||
import org.matrix.android.sdk.api.session.room.model.livelocation.LiveLocationShareAggregatedSummary
|
||||
import org.matrix.android.sdk.api.util.Cancelable
|
||||
import org.matrix.android.sdk.api.util.Optional
|
||||
import org.matrix.android.sdk.api.util.toOptional
|
||||
import org.matrix.android.sdk.internal.database.mapper.LiveLocationShareAggregatedSummaryMapper
|
||||
import org.matrix.android.sdk.internal.database.model.livelocation.LiveLocationShareAggregatedSummaryEntity
|
||||
|
@ -262,25 +256,14 @@ internal class DefaultLocationSharingServiceTest {
|
|||
endOfLiveTimestampMillis = 123,
|
||||
lastLocationDataContent = null
|
||||
)
|
||||
|
||||
fakeMonarchy.givenWhere<LiveLocationShareAggregatedSummaryEntity>()
|
||||
.givenEqualTo(LiveLocationShareAggregatedSummaryEntityFields.ROOM_ID, A_ROOM_ID)
|
||||
.givenEqualTo(LiveLocationShareAggregatedSummaryEntityFields.EVENT_ID, AN_EVENT_ID)
|
||||
val liveData = fakeMonarchy.givenFindAllMappedWithChangesReturns(
|
||||
fakeMonarchy.givenFindAllMappedWithChangesReturns(
|
||||
realmEntities = listOf(entity),
|
||||
mappedResult = listOf(summary),
|
||||
fakeLiveLocationShareAggregatedSummaryMapper
|
||||
)
|
||||
val mapper = slot<Function<List<LiveLocationShareAggregatedSummary>, Optional<LiveLocationShareAggregatedSummary>>>()
|
||||
every {
|
||||
Transformations.map(
|
||||
liveData,
|
||||
capture(mapper)
|
||||
)
|
||||
} answers {
|
||||
val value = secondArg<Function<List<LiveLocationShareAggregatedSummary>, Optional<LiveLocationShareAggregatedSummary>>>().apply(listOf(summary))
|
||||
MutableLiveData(value)
|
||||
}
|
||||
|
||||
val result = defaultLocationSharingService.getLiveLocationShareSummary(AN_EVENT_ID).value
|
||||
|
||||
|
|
|
@ -1,11 +1,10 @@
|
|||
#!/usr/bin/env python3
|
||||
from collections import OrderedDict
|
||||
|
||||
import requests
|
||||
import json
|
||||
import re
|
||||
import os
|
||||
import re
|
||||
import requests
|
||||
from bs4 import BeautifulSoup
|
||||
from collections import OrderedDict
|
||||
|
||||
# A list of words to not capitalize in emoji-names
|
||||
capitalization_exclude = {'with', 'a', 'at', 'of', 'for', 'and', 'over', 'the', 'off', 'on', 'out', 'in', 'but', 'or'}
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
<issue id="TypographyEllipsis" severity="error" />
|
||||
<issue id="ImpliedQuantity" severity="warning" />
|
||||
<issue id="MissingQuantity" severity="warning" />
|
||||
<issue id="UnusedQuantity" severity="error" />
|
||||
<issue id="UnusedQuantity" severity="warning" />
|
||||
<issue id="IconXmlAndPng" severity="error" />
|
||||
<issue id="IconDipSize" severity="error" />
|
||||
<issue id="IconDuplicatesConfig" severity="error" />
|
||||
|
|
|
@ -18,10 +18,10 @@
|
|||
import argparse
|
||||
import json
|
||||
import os
|
||||
# Run `pip3 install requests` if not installed yet
|
||||
import requests
|
||||
# Run `pip3 install re` if not installed yet
|
||||
import re
|
||||
# Run `pip3 install requests` if not installed yet
|
||||
import requests
|
||||
|
||||
# This script downloads artifacts from GitHub.
|
||||
# Ref: https://docs.github.com/en/rest/actions/artifacts#get-an-artifact
|
||||
|
|
|
@ -250,7 +250,7 @@ android {
|
|||
resValue "string", "app_name", "Element - dbg"
|
||||
|
||||
if (project.hasProperty("coverage")) {
|
||||
testCoverageEnabled = coverage == "true"
|
||||
testCoverageEnabled = project.coverage == "true"
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -342,7 +342,7 @@ android {
|
|||
}
|
||||
}
|
||||
|
||||
lintOptions {
|
||||
lint {
|
||||
lintConfig file("../tools/lint/lint.xml")
|
||||
|
||||
checkDependencies true
|
||||
|
@ -355,7 +355,7 @@ android {
|
|||
}
|
||||
|
||||
kotlinOptions {
|
||||
jvmTarget = "11"
|
||||
jvmTarget = versions.jvmTarget
|
||||
freeCompilerArgs += [
|
||||
"-opt-in=kotlin.RequiresOptIn",
|
||||
// Fixes false positive "This is an internal Mavericks API. It is not intended for external use."
|
||||
|
@ -370,6 +370,13 @@ android {
|
|||
|
||||
buildFeatures {
|
||||
viewBinding true
|
||||
buildConfig true
|
||||
}
|
||||
|
||||
packaging {
|
||||
pickFirsts.add("META-INF/LICENSE.md")
|
||||
pickFirsts.add("META-INF/LICENSE-notice.md")
|
||||
pickFirsts.add("MANIFEST.MF")
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -377,6 +384,7 @@ dependencies {
|
|||
implementation project(':vector')
|
||||
implementation project(':vector-config')
|
||||
implementation project(':library:core-utils')
|
||||
implementation project(':library:ui-strings')
|
||||
debugImplementation project(':library:external:span')
|
||||
debugImplementation project(':library:ui-styles')
|
||||
implementation libs.dagger.hilt
|
||||
|
@ -393,7 +401,7 @@ dependencies {
|
|||
debugImplementation 'com.facebook.soloader:soloader:0.10.5'
|
||||
debugImplementation "com.kgurgul.flipper:flipper-realm-android:2.2.0"
|
||||
|
||||
gplayImplementation "com.google.android.gms:play-services-location:21.0.1"
|
||||
gplayImplementation "com.google.android.gms:play-services-location:21.3.0"
|
||||
// UnifiedPush gplay flavor only
|
||||
gplayImplementation platform(libs.google.firebaseBom)
|
||||
gplayImplementation(libs.google.messaging) {
|
||||
|
@ -409,7 +417,7 @@ dependencies {
|
|||
nightlyImplementation libs.google.appdistribution
|
||||
|
||||
// OSS License, gplay flavor only
|
||||
gplayImplementation 'com.google.android.gms:play-services-oss-licenses:17.0.1'
|
||||
gplayImplementation 'com.google.android.gms:play-services-oss-licenses:17.1.0'
|
||||
kapt libs.dagger.hiltCompiler
|
||||
ksp libs.airbnb.epoxyProcessor
|
||||
|
||||
|
|
|
@ -80,3 +80,16 @@
|
|||
# JNA
|
||||
-keep class com.sun.jna.** { *; }
|
||||
-keep class * implements com.sun.jna.** { *; }
|
||||
|
||||
# New
|
||||
-dontwarn com.google.appengine.api.urlfetch.**
|
||||
-dontwarn com.google.common.io.LimitInputStream
|
||||
-dontwarn com.google.firebase.analytics.connector.AnalyticsConnector
|
||||
-dontwarn com.google.javascript.jscomp.**
|
||||
-dontwarn com.likethesalad.android.templates.provider.api.TemplatesProvider
|
||||
-dontwarn com.yahoo.platform.yui.compressor.**
|
||||
-dontwarn java.awt.**
|
||||
-dontwarn org.apache.velocity.**
|
||||
-dontwarn org.commonmark.ext.gfm.strikethrough.Strikethrough
|
||||
-dontwarn org.mozilla.javascript.**
|
||||
-dontwarn org.slf4j.**
|
||||
|
|
|
@ -26,6 +26,7 @@ import androidx.test.filters.LargeTest
|
|||
import com.adevinta.android.barista.internal.viewaction.SleepViewAction
|
||||
import im.vector.app.features.MainActivity
|
||||
import im.vector.app.ui.robot.ElementRobot
|
||||
import im.vector.lib.strings.CommonStrings
|
||||
import org.junit.Rule
|
||||
import org.junit.Test
|
||||
import org.junit.rules.RuleChain
|
||||
|
@ -61,7 +62,7 @@ class CantVerifyTest {
|
|||
|
||||
val activity = EspressoHelper.getCurrentActivity()!!
|
||||
Espresso.onView(ViewMatchers.isRoot())
|
||||
.perform(waitForView(ViewMatchers.withText(R.string.crosssigning_cannot_verify_this_session)))
|
||||
.perform(waitForView(ViewMatchers.withText(CommonStrings.crosssigning_cannot_verify_this_session)))
|
||||
|
||||
// check that the text is correct
|
||||
val popup = activity.findViewById<View>(com.tapadoo.alerter.R.id.llAlertBackground)!!
|
||||
|
@ -73,7 +74,7 @@ class CantVerifyTest {
|
|||
|
||||
Espresso.onView(ViewMatchers.isRoot()).perform(SleepViewAction.sleep(2000))
|
||||
|
||||
Espresso.onView(ViewMatchers.withText(R.string.bottom_sheet_setup_secure_backup_title))
|
||||
Espresso.onView(ViewMatchers.withText(CommonStrings.bottom_sheet_setup_secure_backup_title))
|
||||
.check(ViewAssertions.matches(ViewMatchers.isDisplayed()))
|
||||
}
|
||||
}
|
||||
|
|
|
@ -31,6 +31,7 @@ import androidx.test.filters.LargeTest
|
|||
import im.vector.app.features.MainActivity
|
||||
import im.vector.app.features.analytics.ui.consent.AnalyticsOptInActivity
|
||||
import im.vector.app.features.home.HomeActivity
|
||||
import im.vector.lib.strings.CommonStrings
|
||||
import org.hamcrest.CoreMatchers.not
|
||||
import org.junit.Ignore
|
||||
import org.junit.Rule
|
||||
|
@ -55,7 +56,7 @@ class RegistrationTest {
|
|||
// Check splashscreen is there
|
||||
onView(withId(R.id.loginSplashSubmit))
|
||||
.check(matches(isDisplayed()))
|
||||
.check(matches(withText(R.string.login_splash_submit)))
|
||||
.check(matches(withText(CommonStrings.login_splash_submit)))
|
||||
|
||||
// Click on get started
|
||||
onView(withId(R.id.loginSplashSubmit))
|
||||
|
@ -64,7 +65,7 @@ class RegistrationTest {
|
|||
// Check that homeserver options are shown
|
||||
onView(withId(R.id.loginServerTitle))
|
||||
.check(matches(isDisplayed()))
|
||||
.check(matches(withText(R.string.login_server_title)))
|
||||
.check(matches(withText(CommonStrings.login_server_title)))
|
||||
|
||||
// Chose custom server
|
||||
onView(withId(R.id.loginServerChoiceOther))
|
||||
|
|
|
@ -42,6 +42,7 @@ import im.vector.app.core.utils.getMatrixInstance
|
|||
import im.vector.app.features.MainActivity
|
||||
import im.vector.app.features.crypto.recover.SetupMode
|
||||
import im.vector.app.features.home.HomeActivity
|
||||
import im.vector.lib.strings.CommonStrings
|
||||
import org.hamcrest.CoreMatchers.not
|
||||
import org.junit.Before
|
||||
import org.junit.Ignore
|
||||
|
@ -109,7 +110,7 @@ class SecurityBootstrapTest : VerificationTestBase() {
|
|||
.perform(click())
|
||||
|
||||
onView(isRoot())
|
||||
.perform(waitForView(withText(R.string.bootstrap_info_text_2)))
|
||||
.perform(waitForView(withText(CommonStrings.bootstrap_info_text_2)))
|
||||
|
||||
// test back
|
||||
onView(isRoot()).perform(pressBack())
|
||||
|
@ -124,7 +125,7 @@ class SecurityBootstrapTest : VerificationTestBase() {
|
|||
.perform(click())
|
||||
|
||||
onView(isRoot())
|
||||
.perform(waitForView(withText(R.string.bootstrap_info_text_2)))
|
||||
.perform(waitForView(withText(CommonStrings.bootstrap_info_text_2)))
|
||||
|
||||
onView(withId(R.id.ssss_passphrase_enter_edittext))
|
||||
.perform(typeText("person woman man camera tv"))
|
||||
|
@ -139,7 +140,7 @@ class SecurityBootstrapTest : VerificationTestBase() {
|
|||
onView(withId(R.id.bootstrapSubmit))
|
||||
.perform(closeSoftKeyboard(), click())
|
||||
|
||||
onView(withText(R.string.passphrase_passphrase_does_not_match)).check(matches(isDisplayed()))
|
||||
onView(withText(CommonStrings.passphrase_passphrase_does_not_match)).check(matches(isDisplayed()))
|
||||
|
||||
onView(withId(R.id.ssss_passphrase_enter_edittext))
|
||||
.perform(replaceText("person woman man camera tv"))
|
||||
|
@ -148,7 +149,7 @@ class SecurityBootstrapTest : VerificationTestBase() {
|
|||
.perform(closeSoftKeyboard(), click())
|
||||
|
||||
onView(withId(R.id.bottomSheetScrollView))
|
||||
.perform(waitForView(withText(R.string.bottom_sheet_save_your_recovery_key_content)))
|
||||
.perform(waitForView(withText(CommonStrings.bottom_sheet_save_your_recovery_key_content)))
|
||||
|
||||
intending(hasAction(Intent.ACTION_SEND)).respondWith(ActivityResult(Activity.RESULT_OK, null))
|
||||
|
||||
|
@ -156,12 +157,12 @@ class SecurityBootstrapTest : VerificationTestBase() {
|
|||
.perform(click())
|
||||
|
||||
// Dismiss dialog
|
||||
onView(withText(R.string.ok)).inRoot(RootMatchers.isDialog()).perform(click())
|
||||
onView(withText(CommonStrings.ok)).inRoot(RootMatchers.isDialog()).perform(click())
|
||||
|
||||
onView(withId(R.id.bottomSheetScrollView))
|
||||
.perform(waitForView(withText(R.string.bottom_sheet_save_your_recovery_key_content)))
|
||||
.perform(waitForView(withText(CommonStrings.bottom_sheet_save_your_recovery_key_content)))
|
||||
|
||||
onView(withText(R.string._continue)).perform(click())
|
||||
onView(withText(CommonStrings._continue)).perform(click())
|
||||
|
||||
// Assert that all is configured
|
||||
val crossSigningInitialized = runBlockingTest {
|
||||
|
|
|
@ -27,6 +27,7 @@ import im.vector.app.espresso.tools.waitUntilViewVisible
|
|||
import im.vector.app.features.home.HomeActivity
|
||||
import im.vector.app.ui.robot.AnalyticsRobot
|
||||
import im.vector.app.ui.robot.OnboardingRobot
|
||||
import im.vector.lib.strings.CommonStrings
|
||||
import kotlinx.coroutines.CompletableDeferred
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.DelicateCoroutinesApi
|
||||
|
@ -184,18 +185,18 @@ abstract class VerificationTestBase {
|
|||
Espresso.onView(ViewMatchers.isRoot())
|
||||
.perform(waitForView(ViewMatchers.withId(R.id.bottomSheetFragmentContainer)))
|
||||
|
||||
Espresso.onView(ViewMatchers.withText(R.string.verification_verify_identity))
|
||||
Espresso.onView(ViewMatchers.withText(CommonStrings.verification_verify_identity))
|
||||
.check(ViewAssertions.matches(ViewMatchers.isDisplayed()))
|
||||
|
||||
// 4S is not setup so passphrase option should be hidden
|
||||
Espresso.onView(ViewMatchers.withId(R.id.bottomSheetVerificationRecyclerView))
|
||||
.check(ViewAssertions.matches(CoreMatchers.not(ViewMatchers.hasDescendant(ViewMatchers.withText(R.string.verification_cannot_access_other_session)))))
|
||||
.check(ViewAssertions.matches(CoreMatchers.not(ViewMatchers.hasDescendant(ViewMatchers.withText(CommonStrings.verification_cannot_access_other_session)))))
|
||||
|
||||
Espresso.onView(ViewMatchers.withId(R.id.bottomSheetVerificationRecyclerView))
|
||||
.check(ViewAssertions.matches(ViewMatchers.hasDescendant(ViewMatchers.withText(R.string.verification_verify_with_another_device))))
|
||||
.check(ViewAssertions.matches(ViewMatchers.hasDescendant(ViewMatchers.withText(CommonStrings.verification_verify_with_another_device))))
|
||||
|
||||
Espresso.onView(ViewMatchers.withId(R.id.bottomSheetVerificationRecyclerView))
|
||||
.check(ViewAssertions.matches(ViewMatchers.hasDescendant(ViewMatchers.withText(R.string.bad_passphrase_key_reset_all_action))))
|
||||
.check(ViewAssertions.matches(ViewMatchers.hasDescendant(ViewMatchers.withText(CommonStrings.bad_passphrase_key_reset_all_action))))
|
||||
|
||||
return uiSession
|
||||
}
|
||||
|
|
|
@ -31,6 +31,7 @@ import androidx.test.filters.LargeTest
|
|||
import im.vector.app.core.utils.getMatrixInstance
|
||||
import im.vector.app.features.MainActivity
|
||||
import im.vector.app.ui.robot.ElementRobot
|
||||
import im.vector.lib.strings.CommonStrings
|
||||
import kotlinx.coroutines.test.runTest
|
||||
import org.amshove.kluent.internal.assertEquals
|
||||
import org.junit.After
|
||||
|
@ -117,13 +118,13 @@ class VerifySessionInteractiveTest : VerificationTestBase() {
|
|||
onView(withId(R.id.bottomSheetVerificationRecyclerView))
|
||||
.perform(
|
||||
actionOnItem<RecyclerView.ViewHolder>(
|
||||
hasDescendant(withText(R.string.verification_verify_with_another_device)),
|
||||
hasDescendant(withText(CommonStrings.verification_verify_with_another_device)),
|
||||
click()
|
||||
)
|
||||
)
|
||||
|
||||
onView(withId(R.id.bottomSheetVerificationRecyclerView))
|
||||
.check(matches(hasDescendant(withText(R.string.verification_request_was_sent))))
|
||||
.check(matches(hasDescendant(withText(CommonStrings.verification_request_was_sent))))
|
||||
|
||||
val txId = runBlockingTest {
|
||||
otherRequest.await().transactionId
|
||||
|
@ -139,9 +140,9 @@ class VerifySessionInteractiveTest : VerificationTestBase() {
|
|||
}
|
||||
|
||||
onView(withId(R.id.bottomSheetVerificationRecyclerView))
|
||||
.perform(waitForView(hasDescendant(withText(R.string.verification_scan_self_notice))))
|
||||
.perform(waitForView(hasDescendant(withText(CommonStrings.verification_scan_self_notice))))
|
||||
onView(withId(R.id.bottomSheetVerificationRecyclerView))
|
||||
.perform(waitForView(hasDescendant(withText(R.string.verification_scan_self_emoji_subtitle))))
|
||||
.perform(waitForView(hasDescendant(withText(CommonStrings.verification_scan_self_emoji_subtitle))))
|
||||
|
||||
// there should be the QR code also
|
||||
onView(withId(R.id.bottomSheetVerificationRecyclerView))
|
||||
|
@ -151,16 +152,16 @@ class VerifySessionInteractiveTest : VerificationTestBase() {
|
|||
onView(withId(R.id.bottomSheetVerificationRecyclerView))
|
||||
.perform(
|
||||
actionOnItem<RecyclerView.ViewHolder>(
|
||||
hasDescendant(withText(R.string.verification_scan_self_emoji_subtitle)),
|
||||
hasDescendant(withText(CommonStrings.verification_scan_self_emoji_subtitle)),
|
||||
click()
|
||||
)
|
||||
)
|
||||
|
||||
onView(withId(R.id.bottomSheetVerificationRecyclerView))
|
||||
.perform(waitForView(hasDescendant(withText(R.string.verification_sas_do_not_match))))
|
||||
.perform(waitForView(hasDescendant(withText(CommonStrings.verification_sas_do_not_match))))
|
||||
|
||||
onView(withId(R.id.bottomSheetVerificationRecyclerView))
|
||||
.perform(waitForView(hasDescendant(withText(R.string.verification_sas_match))))
|
||||
.perform(waitForView(hasDescendant(withText(CommonStrings.verification_sas_match))))
|
||||
|
||||
// check that the code matches
|
||||
val uiCode = runBlockingTest {
|
||||
|
@ -190,19 +191,19 @@ class VerifySessionInteractiveTest : VerificationTestBase() {
|
|||
onView(withId(R.id.bottomSheetVerificationRecyclerView))
|
||||
.perform(
|
||||
actionOnItem<RecyclerView.ViewHolder>(
|
||||
hasDescendant(withText(R.string.verification_sas_match)),
|
||||
hasDescendant(withText(CommonStrings.verification_sas_match)),
|
||||
click()
|
||||
)
|
||||
)
|
||||
|
||||
onView(withId(R.id.bottomSheetVerificationRecyclerView))
|
||||
.perform(waitForView(hasDescendant(withText(R.string.verification_conclusion_ok_notice))))
|
||||
.perform(waitForView(hasDescendant(withText(CommonStrings.verification_conclusion_ok_notice))))
|
||||
|
||||
// click on done
|
||||
onView(withId(R.id.bottomSheetVerificationRecyclerView))
|
||||
.perform(
|
||||
actionOnItem<RecyclerView.ViewHolder>(
|
||||
hasDescendant(withText(R.string.done)),
|
||||
hasDescendant(withText(CommonStrings.done)),
|
||||
click()
|
||||
)
|
||||
)
|
||||
|
|
|
@ -31,6 +31,7 @@ import im.vector.app.espresso.tools.waitUntilViewVisible
|
|||
import im.vector.app.features.MainActivity
|
||||
import im.vector.app.features.home.HomeActivity
|
||||
import im.vector.app.ui.robot.ElementRobot
|
||||
import im.vector.lib.strings.CommonStrings
|
||||
import kotlinx.coroutines.test.runTest
|
||||
import org.junit.After
|
||||
import org.junit.Before
|
||||
|
@ -102,13 +103,13 @@ class VerifySessionNavigationTest : VerificationTestBase() {
|
|||
Espresso.onView(ViewMatchers.withId(R.id.bottomSheetVerificationRecyclerView))
|
||||
.perform(
|
||||
RecyclerViewActions.actionOnItem<RecyclerView.ViewHolder>(
|
||||
ViewMatchers.hasDescendant(ViewMatchers.withText(R.string.verification_verify_with_another_device)),
|
||||
ViewMatchers.hasDescendant(ViewMatchers.withText(CommonStrings.verification_verify_with_another_device)),
|
||||
ViewActions.click()
|
||||
)
|
||||
)
|
||||
|
||||
Espresso.onView(ViewMatchers.withId(R.id.bottomSheetVerificationRecyclerView))
|
||||
.check(ViewAssertions.matches(ViewMatchers.hasDescendant(ViewMatchers.withText(R.string.verification_request_was_sent))))
|
||||
.check(ViewAssertions.matches(ViewMatchers.hasDescendant(ViewMatchers.withText(CommonStrings.verification_request_was_sent))))
|
||||
|
||||
val txId = runBlockingTest {
|
||||
otherRequest.await().transactionId
|
||||
|
@ -127,7 +128,7 @@ class VerifySessionNavigationTest : VerificationTestBase() {
|
|||
.perform(waitForView(ViewMatchers.withId(R.id.bottomSheetFragmentContainer)))
|
||||
|
||||
Espresso.onView(ViewMatchers.withId(R.id.bottomSheetVerificationRecyclerView))
|
||||
.check(ViewAssertions.matches(ViewMatchers.hasDescendant(ViewMatchers.withText(R.string.verification_verify_with_another_device))))
|
||||
.check(ViewAssertions.matches(ViewMatchers.hasDescendant(ViewMatchers.withText(CommonStrings.verification_verify_with_another_device))))
|
||||
|
||||
runBlockingTest {
|
||||
otherGetCancelledRequest.await()
|
||||
|
|
|
@ -43,6 +43,7 @@ import im.vector.app.features.crypto.recover.Params
|
|||
import im.vector.app.features.crypto.recover.SetupMode
|
||||
import im.vector.app.features.home.HomeActivity
|
||||
import im.vector.app.ui.robot.AnalyticsRobot
|
||||
import im.vector.lib.strings.CommonStrings
|
||||
import kotlinx.coroutines.runBlocking
|
||||
import org.junit.Before
|
||||
import org.junit.Ignore
|
||||
|
@ -148,17 +149,17 @@ class VerifySessionPassphraseTest : VerificationTestBase() {
|
|||
onView(isRoot())
|
||||
.perform(waitForView(withId(R.id.bottomSheetFragmentContainer)))
|
||||
|
||||
onView(withText(R.string.verification_verify_identity))
|
||||
onView(withText(CommonStrings.verification_verify_identity))
|
||||
.check(matches(isDisplayed()))
|
||||
|
||||
// 4S is setup so passphrase option should be visible
|
||||
onView(withId(R.id.bottomSheetVerificationRecyclerView))
|
||||
.check(matches((hasDescendant(withText(R.string.verification_cannot_access_other_session)))))
|
||||
.check(matches((hasDescendant(withText(CommonStrings.verification_cannot_access_other_session)))))
|
||||
|
||||
onView(withId(R.id.bottomSheetVerificationRecyclerView))
|
||||
.perform(
|
||||
actionOnItem<RecyclerView.ViewHolder>(
|
||||
hasDescendant(withText(R.string.verification_cannot_access_other_session)),
|
||||
hasDescendant(withText(CommonStrings.verification_cannot_access_other_session)),
|
||||
click()
|
||||
)
|
||||
)
|
||||
|
@ -178,14 +179,14 @@ class VerifySessionPassphraseTest : VerificationTestBase() {
|
|||
withIdlingResource(activityIdlingResource(HomeActivity::class.java)) {
|
||||
System.out.println("*** passphrase 1.1")
|
||||
onView(withId(R.id.bottomSheetVerificationRecyclerView))
|
||||
.perform(waitForView(hasDescendant(withText(R.string.verification_conclusion_ok_notice))))
|
||||
.perform(waitForView(hasDescendant(withText(CommonStrings.verification_conclusion_ok_notice))))
|
||||
}
|
||||
|
||||
// click on done
|
||||
onView(withId(R.id.bottomSheetVerificationRecyclerView))
|
||||
.perform(
|
||||
actionOnItem<RecyclerView.ViewHolder>(
|
||||
hasDescendant(withText(R.string.done)),
|
||||
hasDescendant(withText(CommonStrings.done)),
|
||||
click()
|
||||
)
|
||||
)
|
||||
|
|
|
@ -30,13 +30,12 @@ import androidx.test.espresso.matcher.ViewMatchers.isFocusable
|
|||
import androidx.test.espresso.matcher.ViewMatchers.withClassName
|
||||
import androidx.test.espresso.matcher.ViewMatchers.withId
|
||||
import androidx.test.espresso.matcher.ViewMatchers.withText
|
||||
import im.vector.app.R
|
||||
import org.hamcrest.Matchers.allOf
|
||||
import org.hamcrest.Matchers.instanceOf
|
||||
import org.hamcrest.Matchers.`is`
|
||||
|
||||
fun clickOnPreference(@StringRes textResId: Int) {
|
||||
onView(withId(R.id.recycler_view))
|
||||
onView(withId(androidx.preference.R.id.recycler_view))
|
||||
.perform(
|
||||
actionOnItem<RecyclerView.ViewHolder>(
|
||||
allOf(
|
||||
|
|
|
@ -23,13 +23,13 @@ import androidx.test.ext.junit.runners.AndroidJUnit4
|
|||
import androidx.test.filters.LargeTest
|
||||
import androidx.test.platform.app.InstrumentationRegistry
|
||||
import androidx.test.rule.GrantPermissionRule
|
||||
import im.vector.app.R
|
||||
import im.vector.app.espresso.tools.ScreenshotFailureRule
|
||||
import im.vector.app.features.MainActivity
|
||||
import im.vector.app.getString
|
||||
import im.vector.app.ui.robot.ElementRobot
|
||||
import im.vector.app.ui.robot.settings.labs.LabFeaturesPreferences
|
||||
import im.vector.app.ui.robot.withDeveloperMode
|
||||
import im.vector.lib.strings.CommonStrings
|
||||
import org.junit.Rule
|
||||
import org.junit.Test
|
||||
import org.junit.rules.RuleChain
|
||||
|
@ -55,7 +55,7 @@ class UiAllScreensSanityTest {
|
|||
InstrumentationRegistry.getInstrumentation()
|
||||
.targetContext
|
||||
.resources
|
||||
.getBoolean(R.bool.settings_labs_new_app_layout_default)
|
||||
.getBoolean(im.vector.app.config.R.bool.settings_labs_new_app_layout_default)
|
||||
)
|
||||
)
|
||||
|
||||
|
@ -151,7 +151,7 @@ class UiAllScreensSanityTest {
|
|||
advancedSettings { crawlDeveloperOptions() }
|
||||
}
|
||||
roomList {
|
||||
openRoom(getString(R.string.room_displayname_empty_room)) {
|
||||
openRoom(getString(CommonStrings.room_displayname_empty_room)) {
|
||||
val message = "Test view source"
|
||||
postMessage(message)
|
||||
openMessageMenu(message) {
|
||||
|
|
|
@ -23,6 +23,7 @@ import im.vector.app.R
|
|||
import im.vector.app.espresso.tools.waitUntilActivityVisible
|
||||
import im.vector.app.espresso.tools.waitUntilViewVisible
|
||||
import im.vector.app.features.analytics.ui.consent.AnalyticsOptInActivity
|
||||
import im.vector.lib.strings.CommonStrings
|
||||
|
||||
class AnalyticsRobot {
|
||||
|
||||
|
@ -38,7 +39,7 @@ class AnalyticsRobot {
|
|||
waitUntilActivityVisible<AnalyticsOptInActivity> {
|
||||
waitUntilViewVisible(withId(R.id.title))
|
||||
}
|
||||
assertDisplayed(R.id.title, R.string.analytics_opt_in_title)
|
||||
assertDisplayed(R.id.title, CommonStrings.analytics_opt_in_title)
|
||||
if (optIn) {
|
||||
clickOn(R.id.submit)
|
||||
} else {
|
||||
|
|
|
@ -29,6 +29,7 @@ import im.vector.app.R
|
|||
import im.vector.app.espresso.tools.waitUntilActivityVisible
|
||||
import im.vector.app.espresso.tools.waitUntilViewVisible
|
||||
import im.vector.app.features.home.room.detail.RoomDetailActivity
|
||||
import im.vector.lib.strings.CommonStrings
|
||||
import org.hamcrest.CoreMatchers.allOf
|
||||
|
||||
class CreateNewRoomRobot(
|
||||
|
@ -39,7 +40,7 @@ class CreateNewRoomRobot(
|
|||
createdRoom = true
|
||||
BaristaListAssertions.assertListItemCount(R.id.createRoomForm, 12)
|
||||
roomName?.let {
|
||||
onView(allOf(withId(R.id.formTextInputTextInputEditText), withHint(R.string.create_room_name_hint)))
|
||||
onView(allOf(withId(R.id.formTextInputTextInputEditText), withHint(CommonStrings.create_room_name_hint)))
|
||||
.perform(replaceText(roomName))
|
||||
closeSoftKeyboard()
|
||||
}
|
||||
|
@ -53,7 +54,7 @@ class CreateNewRoomRobot(
|
|||
|
||||
fun crawl() {
|
||||
// Room access bottom sheet
|
||||
BaristaClickInteractions.clickOn(R.string.room_settings_room_access_private_title)
|
||||
BaristaClickInteractions.clickOn(CommonStrings.room_settings_room_access_private_title)
|
||||
pressBack()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -49,6 +49,7 @@ import im.vector.app.ui.robot.settings.labs.LabFeature
|
|||
import im.vector.app.ui.robot.settings.labs.LabFeaturesPreferences
|
||||
import im.vector.app.ui.robot.space.SpaceRobot
|
||||
import im.vector.app.withIdlingResource
|
||||
import im.vector.lib.strings.CommonStrings
|
||||
import timber.log.Timber
|
||||
|
||||
class ElementRobot(
|
||||
|
@ -100,7 +101,7 @@ class ElementRobot(
|
|||
openActionBarOverflowOrOptionsMenu(
|
||||
ApplicationProvider.getApplicationContext()
|
||||
)
|
||||
clickOn(R.string.home_layout_preferences)
|
||||
clickOn(CommonStrings.home_layout_preferences)
|
||||
waitUntilDialogVisible(withId(R.id.home_layout_settings_recents))
|
||||
|
||||
block(LayoutPreferencesRobot())
|
||||
|
@ -149,7 +150,7 @@ class ElementRobot(
|
|||
LabFeature.THREAD_MESSAGES -> {
|
||||
settings(shouldGoBack = false) {
|
||||
labs(shouldGoBack = false) {
|
||||
onView(withText(R.string.labs_enable_thread_messages))
|
||||
onView(withText(CommonStrings.labs_enable_thread_messages))
|
||||
.check(ViewAssertions.matches(isDisplayed()))
|
||||
.perform(ViewActions.closeSoftKeyboard(), click())
|
||||
}
|
||||
|
@ -185,9 +186,9 @@ class ElementRobot(
|
|||
onView(withId((R.id.avatar)))
|
||||
.perform(click())
|
||||
waitUntilActivityVisible<VectorSettingsActivity> {
|
||||
clickOn(R.string.settings_general_title)
|
||||
clickOn(CommonStrings.settings_general_title)
|
||||
}
|
||||
clickOnPreference(R.string.action_sign_out)
|
||||
clickOnPreference(CommonStrings.action_sign_out)
|
||||
} else {
|
||||
clickOn(R.id.groupToolbarAvatarImageView)
|
||||
clickOn(R.id.homeDrawerHeaderSignoutView)
|
||||
|
|
|
@ -29,6 +29,7 @@ import im.vector.app.espresso.tools.waitUntilViewVisible
|
|||
import im.vector.app.features.home.room.detail.timeline.edithistory.ViewEditHistoryBottomSheet
|
||||
import im.vector.app.features.reactions.EmojiReactionPickerActivity
|
||||
import im.vector.app.interactWithSheet
|
||||
import im.vector.lib.strings.CommonStrings
|
||||
import java.lang.Thread.sleep
|
||||
|
||||
class MessageMenuRobot(
|
||||
|
@ -36,7 +37,7 @@ class MessageMenuRobot(
|
|||
) {
|
||||
|
||||
fun viewSource() {
|
||||
clickOn(R.string.view_source)
|
||||
clickOn(CommonStrings.view_source)
|
||||
// wait for library
|
||||
sleep(1000)
|
||||
pressBack()
|
||||
|
@ -44,8 +45,8 @@ class MessageMenuRobot(
|
|||
}
|
||||
|
||||
fun editHistory() {
|
||||
clickOn(R.string.message_view_edit_history)
|
||||
interactWithSheet<ViewEditHistoryBottomSheet>(withText(R.string.message_edits), openState = BottomSheetBehavior.STATE_COLLAPSED) {
|
||||
clickOn(CommonStrings.message_view_edit_history)
|
||||
interactWithSheet<ViewEditHistoryBottomSheet>(withText(CommonStrings.message_edits), openState = BottomSheetBehavior.STATE_COLLAPSED) {
|
||||
pressBack()
|
||||
}
|
||||
autoClosed = true
|
||||
|
@ -57,7 +58,7 @@ class MessageMenuRobot(
|
|||
}
|
||||
|
||||
fun addReactionFromEmojiPicker() {
|
||||
clickOn(R.string.message_add_reaction)
|
||||
clickOn(CommonStrings.message_add_reaction)
|
||||
// Wait for emoji to load, it's async now
|
||||
waitUntilActivityVisible<EmojiReactionPickerActivity> {
|
||||
closeSoftKeyboard()
|
||||
|
@ -69,17 +70,17 @@ class MessageMenuRobot(
|
|||
}
|
||||
|
||||
fun edit() {
|
||||
clickOn(R.string.edit)
|
||||
clickOn(CommonStrings.edit)
|
||||
autoClosed = true
|
||||
}
|
||||
|
||||
fun replyInThread() {
|
||||
clickOn(R.string.reply_in_thread)
|
||||
clickOn(CommonStrings.reply_in_thread)
|
||||
autoClosed = true
|
||||
}
|
||||
|
||||
fun viewInRoom() {
|
||||
clickOn(R.string.view_in_room)
|
||||
clickOn(CommonStrings.view_in_room)
|
||||
autoClosed = true
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,16 +20,17 @@ import androidx.test.espresso.Espresso
|
|||
import androidx.test.espresso.matcher.ViewMatchers
|
||||
import im.vector.app.R
|
||||
import im.vector.app.waitForView
|
||||
import im.vector.lib.strings.CommonStrings
|
||||
|
||||
class NewDirectMessageRobot {
|
||||
|
||||
fun verifyQrCodeButton() {
|
||||
Espresso.onView(ViewMatchers.withId(R.id.userListRecyclerView))
|
||||
.perform(waitForView(ViewMatchers.withText(R.string.qr_code)))
|
||||
.perform(waitForView(ViewMatchers.withText(CommonStrings.qr_code)))
|
||||
}
|
||||
|
||||
fun verifyInviteFriendsButton() {
|
||||
Espresso.onView(ViewMatchers.withId(R.id.userListRecyclerView))
|
||||
.perform(waitForView(ViewMatchers.withText(R.string.invite_friends)))
|
||||
.perform(waitForView(ViewMatchers.withText(CommonStrings.invite_friends)))
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,6 +24,7 @@ import im.vector.app.espresso.tools.waitUntilViewVisible
|
|||
import im.vector.app.features.DefaultVectorFeatures
|
||||
import im.vector.app.features.VectorFeatures
|
||||
import im.vector.app.ui.robot.settings.labs.LabFeaturesPreferences
|
||||
import im.vector.lib.strings.CommonStrings
|
||||
|
||||
class NewRoomRobot(
|
||||
var createdRoom: Boolean = false,
|
||||
|
@ -32,7 +33,7 @@ class NewRoomRobot(
|
|||
private val features: VectorFeatures = DefaultVectorFeatures()
|
||||
|
||||
fun createNewRoom(block: CreateNewRoomRobot.() -> Unit) {
|
||||
clickOn(R.string.create_new_room)
|
||||
clickOn(CommonStrings.create_new_room)
|
||||
waitUntilViewVisible(withId(R.id.createRoomForm))
|
||||
val createNewRoomRobot = CreateNewRoomRobot()
|
||||
block(createNewRoomRobot)
|
||||
|
|
|
@ -31,6 +31,7 @@ import im.vector.app.R
|
|||
import im.vector.app.espresso.tools.waitUntilViewVisible
|
||||
import im.vector.app.features.DefaultVectorFeatures
|
||||
import im.vector.app.waitForView
|
||||
import im.vector.lib.strings.CommonStrings
|
||||
|
||||
class OnboardingRobot {
|
||||
private val defaultVectorFeatures = DefaultVectorFeatures()
|
||||
|
@ -46,7 +47,7 @@ class OnboardingRobot {
|
|||
// TODO https://github.com/element-hq/element-android/issues/6652
|
||||
} else {
|
||||
clickOn(R.id.loginSplashSubmit)
|
||||
assertDisplayed(R.id.useCaseHeaderTitle, R.string.ftue_auth_use_case_title)
|
||||
assertDisplayed(R.id.useCaseHeaderTitle, CommonStrings.ftue_auth_use_case_title)
|
||||
clickOn(R.id.useCaseOptionOne)
|
||||
OnboardingServersRobot().crawlSignUp()
|
||||
pressBack()
|
||||
|
@ -71,27 +72,27 @@ class OnboardingRobot {
|
|||
initSession(true, userId, password, homeServerUrl)
|
||||
}
|
||||
|
||||
waitUntilViewVisible(withText(R.string.ftue_account_created_congratulations_title))
|
||||
waitUntilViewVisible(withText(CommonStrings.ftue_account_created_congratulations_title))
|
||||
if (defaultVectorFeatures.isOnboardingPersonalizeEnabled()) {
|
||||
clickOn(R.string.ftue_account_created_personalize)
|
||||
clickOn(CommonStrings.ftue_account_created_personalize)
|
||||
|
||||
waitUntilViewVisible(withText(R.string.ftue_display_name_title))
|
||||
waitUntilViewVisible(withText(CommonStrings.ftue_display_name_title))
|
||||
writeTo(R.id.displayNameInput, "UI automation")
|
||||
clickOn(R.string.ftue_personalize_submit)
|
||||
clickOn(CommonStrings.ftue_personalize_submit)
|
||||
|
||||
waitUntilViewVisible(withText(R.string.ftue_profile_picture_title))
|
||||
clickOn(R.string.ftue_personalize_skip_this_step)
|
||||
waitUntilViewVisible(withText(CommonStrings.ftue_profile_picture_title))
|
||||
clickOn(CommonStrings.ftue_personalize_skip_this_step)
|
||||
|
||||
waitUntilViewVisible(withText(R.string.ftue_personalize_complete_title))
|
||||
clickOn(R.string.ftue_personalize_lets_go)
|
||||
waitUntilViewVisible(withText(CommonStrings.ftue_personalize_complete_title))
|
||||
clickOn(CommonStrings.ftue_personalize_lets_go)
|
||||
} else {
|
||||
clickOn(R.string.ftue_account_created_take_me_home)
|
||||
clickOn(CommonStrings.ftue_account_created_take_me_home)
|
||||
}
|
||||
}
|
||||
|
||||
private fun createAccountViaCombinedRegister(homeServerUrl: String, userId: String, password: String) {
|
||||
waitUntilViewVisible(withId(R.id.loginSplashSubmit))
|
||||
assertDisplayed(R.id.loginSplashSubmit, R.string.login_splash_create_account)
|
||||
assertDisplayed(R.id.loginSplashSubmit, CommonStrings.login_splash_create_account)
|
||||
clickOn(R.id.loginSplashSubmit)
|
||||
clickOn(R.id.useCaseOptionOne)
|
||||
|
||||
|
@ -117,7 +118,7 @@ class OnboardingRobot {
|
|||
|
||||
private fun loginViaCombinedLogin(homeServerUrl: String, userId: String, password: String) {
|
||||
waitUntilViewVisible(withId(R.id.loginSplashSubmit))
|
||||
assertDisplayed(R.id.loginSplashSubmit, R.string.login_splash_create_account)
|
||||
assertDisplayed(R.id.loginSplashSubmit, CommonStrings.login_splash_create_account)
|
||||
clickOn(R.id.loginSplashAlreadyHaveAccount)
|
||||
|
||||
waitUntilViewVisible(withId(R.id.loginRoot))
|
||||
|
@ -139,14 +140,14 @@ class OnboardingRobot {
|
|||
homeServerUrl: String
|
||||
) {
|
||||
waitUntilViewVisible(withId(R.id.loginSplashSubmit))
|
||||
assertDisplayed(R.id.loginSplashSubmit, R.string.login_splash_create_account)
|
||||
assertDisplayed(R.id.loginSplashSubmit, CommonStrings.login_splash_create_account)
|
||||
if (createAccount) {
|
||||
clickOn(R.id.loginSplashSubmit)
|
||||
clickOn(R.id.useCaseOptionOne)
|
||||
} else {
|
||||
clickOn(R.id.loginSplashAlreadyHaveAccount)
|
||||
}
|
||||
assertDisplayed(R.id.loginServerTitle, R.string.login_server_title)
|
||||
assertDisplayed(R.id.loginServerTitle, CommonStrings.login_server_title)
|
||||
// Chose custom server
|
||||
clickOn(R.id.loginServerChoiceOther)
|
||||
// Enter local synapse
|
||||
|
|
|
@ -23,11 +23,12 @@ import com.adevinta.android.barista.interaction.BaristaClickInteractions
|
|||
import com.adevinta.android.barista.interaction.BaristaEditTextInteractions
|
||||
import im.vector.app.R
|
||||
import im.vector.app.espresso.tools.waitUntilViewVisible
|
||||
import im.vector.lib.strings.CommonStrings
|
||||
|
||||
class OnboardingServersRobot {
|
||||
|
||||
fun crawlSignUp() {
|
||||
BaristaVisibilityAssertions.assertDisplayed(R.id.loginServerTitle, R.string.login_server_title)
|
||||
BaristaVisibilityAssertions.assertDisplayed(R.id.loginServerTitle, CommonStrings.login_server_title)
|
||||
crawlMatrixServer(isSignUp = true)
|
||||
crawlEmsServer()
|
||||
crawlOtherServer(isSignUp = true)
|
||||
|
@ -35,7 +36,7 @@ class OnboardingServersRobot {
|
|||
}
|
||||
|
||||
fun crawlSignIn() {
|
||||
BaristaVisibilityAssertions.assertDisplayed(R.id.loginServerTitle, R.string.login_server_title)
|
||||
BaristaVisibilityAssertions.assertDisplayed(R.id.loginServerTitle, CommonStrings.login_server_title)
|
||||
crawlMatrixServer(isSignUp = false)
|
||||
crawlEmsServer()
|
||||
crawlOtherServer(isSignUp = false)
|
||||
|
@ -49,7 +50,7 @@ class OnboardingServersRobot {
|
|||
BaristaClickInteractions.clickOn(R.id.loginServerUrlFormSubmit)
|
||||
waitUntilViewVisible(ViewMatchers.withId(R.id.loginSignupSigninTitle))
|
||||
BaristaVisibilityAssertions.assertDisplayed(R.id.loginSignupSigninText, "Connect to chat.mozilla.org")
|
||||
BaristaVisibilityAssertions.assertDisplayed(R.id.loginSignupSigninSubmit, R.string.login_signin_sso)
|
||||
BaristaVisibilityAssertions.assertDisplayed(R.id.loginSignupSigninSubmit, CommonStrings.login_signin_sso)
|
||||
Espresso.pressBack()
|
||||
|
||||
BaristaEditTextInteractions.writeTo(R.id.loginServerUrlFormHomeServerUrl, "https://matrix.org")
|
||||
|
@ -62,14 +63,14 @@ class OnboardingServersRobot {
|
|||
private fun crawlEmsServer() {
|
||||
BaristaClickInteractions.clickOn(R.id.loginServerChoiceEms)
|
||||
waitUntilViewVisible(ViewMatchers.withId(R.id.loginServerUrlFormTitle))
|
||||
BaristaVisibilityAssertions.assertDisplayed(R.id.loginServerUrlFormTitle, R.string.login_connect_to_modular)
|
||||
BaristaVisibilityAssertions.assertDisplayed(R.id.loginServerUrlFormTitle, CommonStrings.login_connect_to_modular)
|
||||
|
||||
BaristaEditTextInteractions.writeTo(R.id.loginServerUrlFormHomeServerUrl, "https://one.ems.host")
|
||||
BaristaClickInteractions.clickOn(R.id.loginServerUrlFormSubmit)
|
||||
|
||||
waitUntilViewVisible(ViewMatchers.withId(R.id.loginSignupSigninTitle))
|
||||
BaristaVisibilityAssertions.assertDisplayed(R.id.loginSignupSigninText, "one.ems.host")
|
||||
BaristaVisibilityAssertions.assertDisplayed(R.id.loginSignupSigninSubmit, R.string.login_signin_sso)
|
||||
BaristaVisibilityAssertions.assertDisplayed(R.id.loginSignupSigninSubmit, CommonStrings.login_signin_sso)
|
||||
Espresso.pressBack()
|
||||
Espresso.pressBack()
|
||||
}
|
||||
|
@ -91,7 +92,7 @@ class OnboardingServersRobot {
|
|||
private fun crawlSignInWithMatrixId() {
|
||||
BaristaClickInteractions.clickOn(R.id.loginServerIKnowMyIdSubmit)
|
||||
waitUntilViewVisible(ViewMatchers.withId(R.id.loginTitle))
|
||||
BaristaVisibilityAssertions.assertDisplayed(R.id.loginTitle, R.string.login_signin_matrix_id_title)
|
||||
BaristaVisibilityAssertions.assertDisplayed(R.id.loginTitle, CommonStrings.login_signin_matrix_id_title)
|
||||
Espresso.pressBack()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -39,6 +39,7 @@ import im.vector.app.features.home.room.detail.timeline.reactions.ViewReactionsB
|
|||
import im.vector.app.features.reactions.data.EmojiDataSource
|
||||
import im.vector.app.interactWithSheet
|
||||
import im.vector.app.withRetry
|
||||
import im.vector.lib.strings.CommonStrings
|
||||
import java.lang.Thread.sleep
|
||||
|
||||
class RoomDetailRobot {
|
||||
|
@ -93,7 +94,7 @@ class RoomDetailRobot {
|
|||
// Open reactions
|
||||
longClickReaction(quickReaction)
|
||||
// wait for bottom sheet
|
||||
interactWithSheet<ViewReactionsBottomSheet>(withText(R.string.reactions), openState = BottomSheetBehavior.STATE_COLLAPSED) {
|
||||
interactWithSheet<ViewReactionsBottomSheet>(withText(CommonStrings.reactions), openState = BottomSheetBehavior.STATE_COLLAPSED) {
|
||||
pressBack()
|
||||
}
|
||||
println("Room Detail Robot: Open reaction from emoji picker")
|
||||
|
|
|
@ -36,6 +36,7 @@ import im.vector.app.features.home.room.list.home.header.HomeRoomFilter
|
|||
import im.vector.app.features.roomdirectory.RoomDirectoryActivity
|
||||
import im.vector.app.ui.robot.settings.labs.LabFeaturesPreferences
|
||||
import im.vector.app.waitForView
|
||||
import im.vector.lib.strings.CommonStrings
|
||||
|
||||
class RoomListRobot(private val labsPreferences: LabFeaturesPreferences) {
|
||||
|
||||
|
@ -55,7 +56,7 @@ class RoomListRobot(private val labsPreferences: LabFeaturesPreferences) {
|
|||
onView(withId(R.id.roomListView))
|
||||
.perform(
|
||||
RecyclerViewActions.actionOnItem<RecyclerView.ViewHolder>(
|
||||
hasDescendant(withText(R.string.room_displayname_empty_room)),
|
||||
hasDescendant(withText(CommonStrings.room_displayname_empty_room)),
|
||||
ViewActions.longClick()
|
||||
)
|
||||
)
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue