Skip to content

Commit

Permalink
Import v1.5.2 from Element Android
Browse files Browse the repository at this point in the history
  • Loading branch information
bmarty committed Oct 5, 2022
1 parent d8d660e commit f69620c
Show file tree
Hide file tree
Showing 60 changed files with 2,487 additions and 2,476 deletions.
37 changes: 21 additions & 16 deletions dependencies.gradle
Original file line number Diff line number Diff line change
@@ -1,36 +1,37 @@
ext.versions = [

'minSdk' : 21,
'compileSdk' : 31,
'targetSdk' : 31,
'compileSdk' : 32,
'targetSdk' : 32,
'sourceCompat' : JavaVersion.VERSION_11,
'targetCompat' : JavaVersion.VERSION_11,
]


// Pinned to 7.1.3 because of https://github.com/vector-im/element-android/issues/6142
// Please test carefully before upgrading again.
def gradle = "7.1.3"
def gradle = "7.2.2"
// Ref: https://kotlinlang.org/releases.html
def kotlin = "1.6.21"
def kotlin = "1.7.20"
def kotlinCoroutines = "1.6.4"
def dagger = "2.42"
def dagger = "2.44"
def appDistribution = "16.0.0-beta04"
def retrofit = "2.9.0"
def arrow = "0.8.2"
def markwon = "4.6.2"
def moshi = "1.13.0"
def moshi = "1.14.0"
def lifecycle = "2.5.1"
def flowBinding = "1.2.0"
def flipper = "0.164.0"
def epoxy = "4.6.2"
def mavericks = "2.7.0"
def glide = "4.13.2"
def glide = "4.14.1"
def bigImageViewer = "1.8.1"
def jjwt = "0.11.5"
def vanniktechEmoji = "0.15.0"
// Temporary version to unblock #6929. Once 0.16.0 is released we should use it, and revert
// the whole commit which set version 0.16.0-SNAPSHOT
def vanniktechEmoji = "0.16.0-SNAPSHOT"

def sentry = "6.4.1"

def fragment = "1.5.2"
def fragment = "1.5.3"

// 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
Expand All @@ -51,7 +52,7 @@ ext.libs = [
],
androidx : [
'activity' : "androidx.activity:activity:1.5.1",
'appCompat' : "androidx.appcompat:appcompat:1.4.2",
'appCompat' : "androidx.appcompat:appcompat:1.5.1",
'biometric' : "androidx.biometric:biometric:1.1.0",
'core' : "androidx.core:core-ktx:1.8.0",
'recyclerview' : "androidx.recyclerview:recyclerview:1.2.1",
Expand Down Expand Up @@ -86,7 +87,7 @@ ext.libs = [
'appdistributionApi' : "com.google.firebase:firebase-appdistribution-api-ktx:$appDistribution",
'appdistribution' : "com.google.firebase:firebase-appdistribution:$appDistribution",
// Phone number https://github.com/google/libphonenumber
'phonenumber' : "com.googlecode.libphonenumber:libphonenumber:8.12.55"
'phonenumber' : "com.googlecode.libphonenumber:libphonenumber:8.12.56"
],
dagger : [
'dagger' : "com.google.dagger:dagger:$dagger",
Expand All @@ -100,7 +101,7 @@ ext.libs = [
'flipperNetworkPlugin' : "com.facebook.flipper:flipper-network-plugin:$flipper",
],
element : [
'opusencoder' : "io.element.android:opusencoder:1.0.4",
'opusencoder' : "io.element.android:opusencoder:1.1.0",
],
squareup : [
'moshi' : "com.squareup.moshi:moshi:$moshi",
Expand All @@ -120,6 +121,7 @@ ext.libs = [
markwon : [
'core' : "io.noties.markwon:core:$markwon",
'extLatex' : "io.noties.markwon:ext-latex:$markwon",
'imageGlide' : "io.noties.markwon:image-glide:$markwon",
'inlineParser' : "io.noties.markwon:inline-parser:$markwon",
'html' : "io.noties.markwon:html:$markwon"
],
Expand Down Expand Up @@ -165,10 +167,13 @@ ext.libs = [
apache : [
'commonsImaging' : "org.apache.sanselan:sanselan:0.97-incubator"
],
sentry: [
'sentryAndroid' : "io.sentry:sentry-android:$sentry"
],
tests : [
'kluent' : "org.amshove.kluent:kluent-android:1.68",
'timberJunitRule' : "net.lachlanmckee:timber-junit-rule:1.0.1",
'junit' : "junit:junit:4.13.2"
'junit' : "junit:junit:4.13.2",
]
]

Expand Down
17 changes: 15 additions & 2 deletions dependencies_groups.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,18 @@ ext.groups = [
'com.google.testing.platform',
]
],
snapshot: [
regex: [
],
group: [
'com.vanniktech',
]
],
mavenCentral: [
regex: [
],
group: [
'app.cash.paparazzi',
'ch.qos.logback',
'com.adevinta.android',
'com.airbnb.android',
Expand Down Expand Up @@ -118,7 +126,7 @@ ext.groups = [
'com.sun.xml.bind.mvn',
'com.sun.xml.fastinfoset',
'com.thoughtworks.qdox',
'com.vanniktech',
// 'com.vanniktech',
'commons-cli',
'commons-codec',
'commons-io',
Expand All @@ -140,14 +148,18 @@ ext.groups = [
'io.opencensus',
'io.reactivex.rxjava2',
'io.realm',
'io.sentry',
'it.unimi.dsi',
'jakarta.activation',
'jakarta.xml.bind',
'javax.activation',
'javax.annotation',
'javax.inject',
'javax.xml.bind',
'jline',
'jp.wasabeef',
'junit',
'kxml2',
'me.saket',
'net.bytebuddy',
'net.java',
Expand Down Expand Up @@ -176,11 +188,13 @@ ext.groups = [
'org.hamcrest',
'org.jacoco',
'org.java-websocket',
'org.jcodec',
'org.jetbrains',
'org.jetbrains.dokka',
'org.jetbrains.intellij.deps',
'org.jetbrains.kotlin',
'org.jetbrains.kotlinx',
'org.jetbrains.trove4j',
'org.json',
'org.jsoup',
'org.junit',
Expand All @@ -197,7 +211,6 @@ ext.groups = [
'org.ow2.asm',
'org.ow2.asm',
'org.reactivestreams',
'org.robolectric',
'org.slf4j',
'org.sonatype.oss',
'org.testng',
Expand Down
2 changes: 2 additions & 0 deletions matrix-sdk-android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,8 @@ dependencies {
androidTestImplementation libs.mockk.mockkAndroid
androidTestImplementation libs.androidx.coreTesting
androidTestImplementation libs.jetbrains.coroutinesAndroid
androidTestImplementation libs.jetbrains.coroutinesTest

// Plant Timber tree for test
androidTestImplementation libs.tests.timberJunitRule

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,7 @@ class ChangePasswordTest : InstrumentedTest {
val session = commonTestHelper.createAccount(TestConstants.USER_ALICE, SessionTestParams(withInitialSync = false))

// Change password
commonTestHelper.runBlockingTest {
session.accountService().changePassword(TestConstants.PASSWORD, NEW_PASSWORD)
}
session.accountService().changePassword(TestConstants.PASSWORD, NEW_PASSWORD)

// Try to login with the previous password, it will fail
val throwable = commonTestHelper.logAccountWithError(session.myUserId, TestConstants.PASSWORD)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,26 +40,24 @@ import kotlin.coroutines.resume
class DeactivateAccountTest : InstrumentedTest {

@Test
fun deactivateAccountTest() = runSessionTest(context(), false /* session will be deactivated */) { commonTestHelper ->
fun deactivateAccountTest() = runSessionTest(context(), autoSignoutOnClose = false /* session will be deactivated */) { commonTestHelper ->
val session = commonTestHelper.createAccount(TestConstants.USER_ALICE, SessionTestParams(withInitialSync = true))

// Deactivate the account
commonTestHelper.runBlockingTest {
session.accountService().deactivateAccount(
eraseAllData = false,
userInteractiveAuthInterceptor = object : UserInteractiveAuthInterceptor {
override fun performStage(flowResponse: RegistrationFlowResponse, errCode: String?, promise: Continuation<UIABaseAuth>) {
promise.resume(
UserPasswordAuth(
user = session.myUserId,
password = TestConstants.PASSWORD,
session = flowResponse.session
)
)
}
session.accountService().deactivateAccount(
eraseAllData = false,
userInteractiveAuthInterceptor = object : UserInteractiveAuthInterceptor {
override fun performStage(flowResponse: RegistrationFlowResponse, errCode: String?, promise: Continuation<UIABaseAuth>) {
promise.resume(
UserPasswordAuth(
user = session.myUserId,
password = TestConstants.PASSWORD,
session = flowResponse.session
)
)
}
)
}
}
)

// Try to login on the previous account, it will fail (M_USER_DEACTIVATED)
val throwable = commonTestHelper.logAccountWithError(session.myUserId, TestConstants.PASSWORD)
Expand All @@ -74,23 +72,19 @@ class DeactivateAccountTest : InstrumentedTest {
// Try to create an account with the deactivate account user id, it will fail (M_USER_IN_USE)
val hs = commonTestHelper.createHomeServerConfig()

commonTestHelper.runBlockingTest {
commonTestHelper.matrix.authenticationService.getLoginFlow(hs)
}
commonTestHelper.matrix.authenticationService.getLoginFlow(hs)

var accountCreationError: Throwable? = null
commonTestHelper.runBlockingTest {
try {
commonTestHelper.matrix.authenticationService
.getRegistrationWizard()
.createAccount(
session.myUserId.substringAfter("@").substringBefore(":"),
TestConstants.PASSWORD,
null
)
} catch (failure: Throwable) {
accountCreationError = failure
}
try {
commonTestHelper.matrix.authenticationService
.getRegistrationWizard()
.createAccount(
session.myUserId.substringAfter("@").substringBefore(":"),
TestConstants.PASSWORD,
null
)
} catch (failure: Throwable) {
accountCreationError = failure
}

// Test the error
Expand Down
Loading

0 comments on commit f69620c

Please sign in to comment.