From 711dfe41b7c50a58fa17a797bb2ce5a8d6f44732 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 6 May 2021 07:11:17 +0000 Subject: [PATCH 1/9] Bump media from 1.3.0 to 1.3.1 Bumps media from 1.3.0 to 1.3.1. Signed-off-by: dependabot[bot] --- vector/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vector/build.gradle b/vector/build.gradle index 3ecdcea524..5a7a8861b6 100644 --- a/vector/build.gradle +++ b/vector/build.gradle @@ -326,7 +326,7 @@ dependencies { implementation 'androidx.constraintlayout:constraintlayout:2.0.4' implementation "androidx.sharetarget:sharetarget:1.1.0" implementation 'androidx.core:core-ktx:1.3.2' - implementation "androidx.media:media:1.3.0" + implementation "androidx.media:media:1.3.1" implementation "org.threeten:threetenbp:1.4.0:no-tzdb" implementation "com.gabrielittner.threetenbp:lazythreetenbp:0.9.0" From 278b0d7f750c910b43437120f73d16a9ff3865c6 Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Wed, 12 May 2021 16:20:55 +0200 Subject: [PATCH 2/9] Sign APK with build tools 30.0.3 --- CHANGES.md | 2 +- tools/release/sign_apk.sh | 2 +- tools/release/sign_apk_unsafe.sh | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 8c10320816..39987201cd 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -17,7 +17,7 @@ SDK API changes ⚠️: - Build 🧱: - - + - Sign APK with build tools 30.0.3 Test: - diff --git a/tools/release/sign_apk.sh b/tools/release/sign_apk.sh index 77af5823c4..7697f58ceb 100755 --- a/tools/release/sign_apk.sh +++ b/tools/release/sign_apk.sh @@ -17,7 +17,7 @@ PARAM_KEYSTORE_PATH=$1 PARAM_APK=$2 # Other params -BUILD_TOOLS_VERSION="29.0.3" +BUILD_TOOLS_VERSION="30.0.3" MIN_SDK_VERSION=21 echo "Signing APK with build-tools version ${BUILD_TOOLS_VERSION} for min SDK version ${MIN_SDK_VERSION}..." diff --git a/tools/release/sign_apk_unsafe.sh b/tools/release/sign_apk_unsafe.sh index b145ad45da..af5b0f0e32 100755 --- a/tools/release/sign_apk_unsafe.sh +++ b/tools/release/sign_apk_unsafe.sh @@ -23,7 +23,7 @@ PARAM_KS_PASS=$3 PARAM_KEY_PASS=$4 # Other params -BUILD_TOOLS_VERSION="29.0.3" +BUILD_TOOLS_VERSION="30.0.3" MIN_SDK_VERSION=21 echo "Signing APK with build-tools version ${BUILD_TOOLS_VERSION} for min SDK version ${MIN_SDK_VERSION}..." From 31df08477e74483f1aa301a311e58130e3fbb4c1 Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Wed, 12 May 2021 16:24:20 +0200 Subject: [PATCH 3/9] Cleanup Travis config. --- .travis.yml | 46 ++-------------------------------------------- 1 file changed, 2 insertions(+), 44 deletions(-) diff --git a/.travis.yml b/.travis.yml index 85bddac7f3..6e67639284 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,4 +1,4 @@ -# FTR: Configuration on https://travis-ci.org/vector-im/riotX-android/settings +# FTR: Configuration on https://travis-ci.org/github/vector-im/element-android/settings # # - Build only if .travis.yml is present -> On # - Limit concurrent jobs -> Off @@ -8,53 +8,11 @@ # - Auto cancel branch builds -> On # - Auto cancel pull request builds -> On -language: android -jdk: oraclejdk8 sudo: false notifications: email: false -android: - components: - # Uncomment the lines below if you want to - # use the latest revision of Android SDK Tools - - tools - - platform-tools - - # The BuildTools version used by your project - - build-tools-29.0.3 - - # The SDK version used to compile your project - - android-29 - -before_cache: - - rm -f $HOME/.gradle/caches/modules-2/modules-2.lock - - rm -fr $HOME/.gradle/caches/*/plugin-resolution/ - -cache: - directories: - - $HOME/.gradle/caches/ - - $HOME/.gradle/wrapper/ - - $HOME/.android/build-cache - -# Build with the development SDK -before_script: - # Not necessary for the moment - # - /bin/sh ./set_debug_env.sh - -# Just build the project for now +# Just run a simple script here script: - # Build app (assembleGplayRelease assembleFdroidRelease) - # Build Android test (assembleAndroidTest) (disabled for now) - # Code quality (lintGplayRelease lintFdroidRelease) - # Split into two steps because if a task contain Fdroid, PlayService will be disabled - # Done by Buildkite now: - ./gradlew clean assembleGplayRelease lintGplayRelease --stacktrace - # Done by Buildkite now: - ./gradlew clean assembleFdroidRelease lintFdroidRelease --stacktrace - # Run unitary test (Disable for now, see https://travis-ci.org/vector-im/riot-android/builds/502504370) - # - ./gradlew testGplayReleaseUnitTest --stacktrace - # Other code quality check - # Done by Buildkite now: - ./tools/check/check_code_quality.sh - ./tools/travis/check_pr.sh - # Check that indonesians file are identical. Due to Android issue, the resource folder must be value-in/, and Weblate export data into value-id/. - # Done by Buildkite now: - diff ./vector/src/main/res/values-id/strings.xml ./vector/src/main/res/values-in/strings.xml From cd9b8c55f4d1009028da213f7cb8b04814a2c5b9 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 13 May 2021 06:27:41 +0000 Subject: [PATCH 4/9] Bump realm-gradle-plugin from 10.4.0 to 10.5.0 Bumps [realm-gradle-plugin](https://github.com/realm/realm-java) from 10.4.0 to 10.5.0. - [Release notes](https://github.com/realm/realm-java/releases) - [Changelog](https://github.com/realm/realm-java/blob/v10.5.0/CHANGELOG.md) - [Commits](https://github.com/realm/realm-java/compare/v10.4.0...v10.5.0) Signed-off-by: dependabot[bot] --- matrix-sdk-android/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/matrix-sdk-android/build.gradle b/matrix-sdk-android/build.gradle index 451d56970a..85904758ef 100644 --- a/matrix-sdk-android/build.gradle +++ b/matrix-sdk-android/build.gradle @@ -9,7 +9,7 @@ buildscript { mavenCentral() } dependencies { - classpath "io.realm:realm-gradle-plugin:10.4.0" + classpath "io.realm:realm-gradle-plugin:10.5.0" } } From 90f6f9f7c1b0884baedf2c809af284cc6f66b29a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 13 May 2021 06:30:31 +0000 Subject: [PATCH 5/9] Bump libphonenumber from 8.12.22 to 8.12.23 Bumps [libphonenumber](https://github.com/google/libphonenumber) from 8.12.22 to 8.12.23. - [Release notes](https://github.com/google/libphonenumber/releases) - [Changelog](https://github.com/google/libphonenumber/blob/master/making-metadata-changes.md) - [Commits](https://github.com/google/libphonenumber/compare/v8.12.22...v8.12.23) Signed-off-by: dependabot[bot] --- matrix-sdk-android/build.gradle | 2 +- vector/build.gradle | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/matrix-sdk-android/build.gradle b/matrix-sdk-android/build.gradle index 451d56970a..1b0559366c 100644 --- a/matrix-sdk-android/build.gradle +++ b/matrix-sdk-android/build.gradle @@ -169,7 +169,7 @@ dependencies { implementation 'com.otaliastudios:transcoder:0.10.3' // Phone number https://github.com/google/libphonenumber - implementation 'com.googlecode.libphonenumber:libphonenumber:8.12.22' + implementation 'com.googlecode.libphonenumber:libphonenumber:8.12.23' testImplementation 'junit:junit:4.13.2' testImplementation 'org.robolectric:robolectric:4.5.1' diff --git a/vector/build.gradle b/vector/build.gradle index d2b5c8d705..a9a8ba0924 100644 --- a/vector/build.gradle +++ b/vector/build.gradle @@ -343,7 +343,7 @@ dependencies { implementation 'com.facebook.stetho:stetho:1.6.0' // Phone number https://github.com/google/libphonenumber - implementation 'com.googlecode.libphonenumber:libphonenumber:8.12.22' + implementation 'com.googlecode.libphonenumber:libphonenumber:8.12.23' // rx implementation 'io.reactivex.rxjava2:rxkotlin:2.4.0' From dca4a31fc63e1dc62e7e83b8630b3d2506abb2da Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Fri, 14 May 2021 11:26:24 +0200 Subject: [PATCH 6/9] Fix a problem with database migration on nightly builds (#3335) --- CHANGES.md | 2 +- .../internal/database/RealmSessionStoreMigration.kt | 13 ++++++++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 8c10320816..beda769d87 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -8,7 +8,7 @@ Improvements 🙌: - Bugfix 🐛: - - + - Fix a problem with database migration on nightly builds (#3335) Translations 🗣: - diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/database/RealmSessionStoreMigration.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/database/RealmSessionStoreMigration.kt index 211059a345..d810c8b1a8 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/database/RealmSessionStoreMigration.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/database/RealmSessionStoreMigration.kt @@ -44,7 +44,7 @@ import javax.inject.Inject class RealmSessionStoreMigration @Inject constructor() : RealmMigration { companion object { - const val SESSION_STORE_SCHEMA_VERSION = 12L + const val SESSION_STORE_SCHEMA_VERSION = 13L } override fun migrate(realm: DynamicRealm, oldVersion: Long, newVersion: Long) { @@ -62,6 +62,7 @@ class RealmSessionStoreMigration @Inject constructor() : RealmMigration { if (oldVersion <= 9) migrateTo10(realm) if (oldVersion <= 10) migrateTo11(realm) if (oldVersion <= 11) migrateTo12(realm) + if (oldVersion <= 12) migrateTo13(realm) } private fun migrateTo1(realm: DynamicRealm) { @@ -274,4 +275,14 @@ class RealmSessionStoreMigration @Inject constructor() : RealmMigration { ?.addField(SpaceChildSummaryEntityFields.SUGGESTED, Boolean::class.java) ?.setNullable(SpaceChildSummaryEntityFields.SUGGESTED, true) } + + private fun migrateTo13(realm: DynamicRealm) { + Timber.d("Step 12 -> 13") + + // Fix issue with the nightly build. Eventually play again the migration which has been included in migrateTo12() + realm.schema.get("SpaceChildSummaryEntity") + ?.takeIf { !it.hasField(SpaceChildSummaryEntityFields.SUGGESTED) } + ?.addField(SpaceChildSummaryEntityFields.SUGGESTED, Boolean::class.java) + ?.setNullable(SpaceChildSummaryEntityFields.SUGGESTED, true) + } } From 946208a84d5a1a9b5584ddd2363c1b8443ccadb7 Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Fri, 14 May 2021 11:39:02 +0200 Subject: [PATCH 7/9] Add documentation on LoginWizard and RegistrationWizard (#3303) ee --- CHANGES.md | 2 +- .../sdk/api/auth/AuthenticationService.kt | 4 ++ .../android/sdk/api/auth/login/LoginWizard.kt | 28 +++++--- .../auth/registration/RegistrationWizard.kt | 68 +++++++++++++++++-- 4 files changed, 89 insertions(+), 13 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 8c10320816..0bb48c4f8c 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -23,7 +23,7 @@ Test: - Other changes: - - + - Add documentation on LoginWizard and RegistrationWizard (#3303) Changes in Element 1.1.7 (2021-05-12) =================================================== diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/auth/AuthenticationService.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/auth/AuthenticationService.kt index a7f5163774..5e35917243 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/auth/AuthenticationService.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/auth/AuthenticationService.kt @@ -51,11 +51,15 @@ interface AuthenticationService { /** * Return a LoginWizard, to login to the homeserver. The login flow has to be retrieved first. + * + * See [LoginWizard] for more details */ fun getLoginWizard(): LoginWizard /** * Return a RegistrationWizard, to create an matrix account on the homeserver. The login flow has to be retrieved first. + * + * See [RegistrationWizard] for more details. */ fun getRegistrationWizard(): RegistrationWizard diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/auth/login/LoginWizard.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/auth/login/LoginWizard.kt index 9c96cba40c..da6eb0c3ac 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/auth/login/LoginWizard.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/auth/login/LoginWizard.kt @@ -17,34 +17,46 @@ package org.matrix.android.sdk.api.auth.login import org.matrix.android.sdk.api.session.Session -import org.matrix.android.sdk.api.util.Cancelable +/** + * Set of methods to be able to login to an existing account on a homeserver. + * + * More documentation can be found in the file https://github.com/vector-im/element-android/blob/main/docs/signin.md + */ interface LoginWizard { - /** - * @param login the login field - * @param password the password field + * Login to the homeserver. + * + * @param login the login field. Can be a user name, or a msisdn (email or phone number) associated to the account + * @param password the password of the account * @param deviceName the initial device name - * @param callback the matrix callback on which you'll receive the result of authentication. - * @return a [Cancelable] + * @return a [Session] if the login is successful */ suspend fun login(login: String, password: String, deviceName: String): Session /** - * Exchange a login token to an access token + * Exchange a login token to an access token. + * + * @param loginToken login token, obtain when login has happen in a WebView, using SSO + * @return a [Session] if the login is successful */ suspend fun loginWithToken(loginToken: String): Session /** - * Reset user password + * Ask the homeserver to reset the user password. The password will not be reset until + * [resetPasswordMailConfirmed] is successfully called. + * + * @param email an email previously associated to the account the user wants the password to be reset. + * @param newPassword the desired new password */ suspend fun resetPassword(email: String, newPassword: String) /** * Confirm the new password, once the user has checked their email + * When this method succeed, tha account password will be effectively modified. */ suspend fun resetPasswordMailConfirmed() } diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/auth/registration/RegistrationWizard.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/auth/registration/RegistrationWizard.kt index f059bf26c4..2fcb501f26 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/auth/registration/RegistrationWizard.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/auth/registration/RegistrationWizard.kt @@ -16,32 +16,92 @@ package org.matrix.android.sdk.api.auth.registration +/** + * Set of methods to be able to create an account on a homeserver. + * + * More documentation can be found in the file https://github.com/vector-im/element-android/blob/main/docs/signup.md + */ interface RegistrationWizard { - + /** + * Call this method to get the possible registration flow of the current homeserver. + * It can be useful to ensure that your application implementation supports all the stages + * required to create an account. If it is not the case, you will have to use the web fallback + * to let the user create an account with your application. + * See [org.matrix.android.sdk.api.auth.AuthenticationService.getFallbackUrl] + */ suspend fun getRegistrationFlow(): RegistrationResult + /** + * Can be call to check is the desired userName is available for registration on the current homeserver. + * It may also fails if the desired userName is not correctly formatted or does not follow any restriction on + * the homeserver. Ex: userName with only digits may be rejected. + * @param userName the desired username. Ex: "alice" + */ + suspend fun registrationAvailable(userName: String): RegistrationAvailability + + /** + * This is the first method to call in order to create an account and start the registration process. + * + * @param userName the desired username. Ex: "alice" + * @param password the desired password + * @param initialDeviceDisplayName the device display name + */ suspend fun createAccount(userName: String?, password: String?, initialDeviceDisplayName: String?): RegistrationResult + /** + * Perform the "m.login.recaptcha" stage. + * + * @param response the response from ReCaptcha + */ suspend fun performReCaptcha(response: String): RegistrationResult + /** + * Perform the "m.login.terms" stage. + */ suspend fun acceptTerms(): RegistrationResult + /** + * Perform the "m.login.dummy" stage. + */ suspend fun dummy(): RegistrationResult + /** + * Perform the "m.login.email.identity" or "m.login.msisdn" stage. + * + * @param threePid the threePid to add to the account. If this is an email, the homeserver will send an email + * to validate it. For a msisdn a SMS will be sent. + */ suspend fun addThreePid(threePid: RegisterThreePid): RegistrationResult + /** + * Ask the homeserver to send again the current threePid (email or msisdn). + */ suspend fun sendAgainThreePid(): RegistrationResult + /** + * Send the code received by SMS to validate a msisdn. + * If the code is correct, the registration request will be executed to validate the msisdn. + */ suspend fun handleValidateThreePid(code: String): RegistrationResult + /** + * Useful to poll the homeserver when waiting for the email to be validated by the user. + * Once the email is validated, this method will return successfully. + * @param delayMillis the SDK can wait before sending the request + */ suspend fun checkIfEmailHasBeenValidated(delayMillis: Long): RegistrationResult - suspend fun registrationAvailable(userName: String): RegistrationAvailability - + /** + * This is the current ThreePid, waiting for validation. The SDK will store it in database, so it can be + * restored even if the app has been killed during the registration + */ val currentThreePid: String? - // True when login and password has been sent with success to the homeserver + /** + * True when login and password have been sent with success to the homeserver, i.e. [createAccount] has been + * called successfully. + */ val isRegistrationStarted: Boolean } From d6e3bb59f493deb63065e375c856e1fd8da32596 Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Wed, 12 May 2021 12:41:19 +0200 Subject: [PATCH 8/9] Minor cleanup on the doc --- .../main/java/org/matrix/android/sdk/api/session/room/Room.kt | 2 +- .../java/im/vector/app/core/utils/ExternalApplicationsUtil.kt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/room/Room.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/room/Room.kt index f3eeb902a8..8c434fc440 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/room/Room.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/room/Room.kt @@ -83,7 +83,7 @@ interface Room : * @param beforeLimit how many events before the result are returned. * @param afterLimit how many events after the result are returned. * @param includeProfile requests that the server returns the historic profile information for the users that sent the events that were returned. - * @param callback Callback to get the search result + * @return The search result */ suspend fun search(searchTerm: String, nextBatch: String?, diff --git a/vector/src/main/java/im/vector/app/core/utils/ExternalApplicationsUtil.kt b/vector/src/main/java/im/vector/app/core/utils/ExternalApplicationsUtil.kt index 859df7d714..90cbb3a7a5 100644 --- a/vector/src/main/java/im/vector/app/core/utils/ExternalApplicationsUtil.kt +++ b/vector/src/main/java/im/vector/app/core/utils/ExternalApplicationsUtil.kt @@ -509,7 +509,7 @@ fun selectTxtFileToWrite( * @param sourceFile the file source path * @param dstDirPath the dst path * @param outputFilename optional the output filename - * @param callback the asynchronous callback + * @return the created file */ @Suppress("DEPRECATION") fun saveFileIntoLegacy(sourceFile: File, dstDirPath: File, outputFilename: String?): File? { From c27b7aec265eeeacb0d86361ff93e782a30fa1c9 Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Fri, 14 May 2021 11:44:44 +0200 Subject: [PATCH 9/9] Add more doc --- .../android/sdk/api/auth/registration/RegistrationWizard.kt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/auth/registration/RegistrationWizard.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/auth/registration/RegistrationWizard.kt index 2fcb501f26..621253faa5 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/auth/registration/RegistrationWizard.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/auth/registration/RegistrationWizard.kt @@ -19,7 +19,13 @@ package org.matrix.android.sdk.api.auth.registration /** * Set of methods to be able to create an account on a homeserver. * + * Common scenario to register an account successfully: + * - Call [getRegistrationFlow] to check that you application supports all the mandatory registration stages + * - Call [createAccount] to start the account creation + * - Fulfill all mandatory stages using the methods [performReCaptcha] [acceptTerms] [dummy], etc. + * * More documentation can be found in the file https://github.com/vector-im/element-android/blob/main/docs/signup.md + * and https://matrix.org/docs/spec/client_server/latest#account-registration-and-management */ interface RegistrationWizard { /**