From b11f965f1e873840d71d41e43c8a053fd953b980 Mon Sep 17 00:00:00 2001 From: Didier Nizard Date: Thu, 16 Feb 2023 00:12:50 +0100 Subject: [PATCH 01/10] Disable threads --- .../vector/app/features/debug/features/DebugVectorFeatures.kt | 2 ++ vector-config/src/btchap/res/values/config-features.xml | 1 + vector-config/src/devTchap/res/values/config-features.xml | 1 + vector-config/src/main/res/values/config-settings.xml | 2 +- vector-config/src/tchap/res/values/config-features.xml | 1 + vector/src/main/java/im/vector/app/features/VectorFeatures.kt | 2 ++ .../java/im/vector/app/features/home/HomeActivityViewModel.kt | 3 ++- 7 files changed, 10 insertions(+), 2 deletions(-) diff --git a/vector-app/src/debug/java/im/vector/app/features/debug/features/DebugVectorFeatures.kt b/vector-app/src/debug/java/im/vector/app/features/debug/features/DebugVectorFeatures.kt index 40849a9558..f4be52ce1c 100644 --- a/vector-app/src/debug/java/im/vector/app/features/debug/features/DebugVectorFeatures.kt +++ b/vector-app/src/debug/java/im/vector/app/features/debug/features/DebugVectorFeatures.kt @@ -46,6 +46,8 @@ class DebugVectorFeatures( override fun tchapIsKeyBackupEnabled() = read(DebugFeatureKeys.tchapIsKeyBackupEnabled) ?: vectorFeatures.tchapIsKeyBackupEnabled() + override fun tchapIsThreadEnabled() = vectorFeatures.tchapIsThreadEnabled() + override fun onboardingVariant(): OnboardingVariant { return readPreferences().getEnum() ?: vectorFeatures.onboardingVariant() } diff --git a/vector-config/src/btchap/res/values/config-features.xml b/vector-config/src/btchap/res/values/config-features.xml index 5542daeda5..f6fda74684 100755 --- a/vector-config/src/btchap/res/values/config-features.xml +++ b/vector-config/src/btchap/res/values/config-features.xml @@ -2,4 +2,5 @@ true true + false diff --git a/vector-config/src/devTchap/res/values/config-features.xml b/vector-config/src/devTchap/res/values/config-features.xml index 5542daeda5..f6fda74684 100755 --- a/vector-config/src/devTchap/res/values/config-features.xml +++ b/vector-config/src/devTchap/res/values/config-features.xml @@ -2,4 +2,5 @@ true true + false diff --git a/vector-config/src/main/res/values/config-settings.xml b/vector-config/src/main/res/values/config-settings.xml index eabd576453..096d38b1e1 100755 --- a/vector-config/src/main/res/values/config-settings.xml +++ b/vector-config/src/main/res/values/config-settings.xml @@ -48,7 +48,7 @@ true true - true + false true false true diff --git a/vector-config/src/tchap/res/values/config-features.xml b/vector-config/src/tchap/res/values/config-features.xml index 5542daeda5..f6fda74684 100755 --- a/vector-config/src/tchap/res/values/config-features.xml +++ b/vector-config/src/tchap/res/values/config-features.xml @@ -2,4 +2,5 @@ true true + false diff --git a/vector/src/main/java/im/vector/app/features/VectorFeatures.kt b/vector/src/main/java/im/vector/app/features/VectorFeatures.kt index 8dc93c3963..a364398449 100644 --- a/vector/src/main/java/im/vector/app/features/VectorFeatures.kt +++ b/vector/src/main/java/im/vector/app/features/VectorFeatures.kt @@ -28,6 +28,7 @@ interface VectorFeatures { fun tchapIsVoipSupported(): Boolean fun tchapIsCrossSigningEnabled(): Boolean fun tchapIsKeyBackupEnabled(): Boolean + fun tchapIsThreadEnabled(): Boolean fun onboardingVariant(): OnboardingVariant fun isOnboardingAlreadyHaveAccountSplashEnabled(): Boolean fun isOnboardingSplashCarouselEnabled(): Boolean @@ -59,6 +60,7 @@ class DefaultVectorFeatures @Inject constructor( override fun tchapIsVoipSupported() = booleanProvider.getBoolean(R.bool.tchap_is_voip_supported) override fun tchapIsCrossSigningEnabled() = booleanProvider.getBoolean(R.bool.tchap_is_cross_signing_enabled) override fun tchapIsKeyBackupEnabled() = booleanProvider.getBoolean(R.bool.tchap_is_key_backup_enabled) + override fun tchapIsThreadEnabled() = booleanProvider.getBoolean(R.bool.tchap_is_thread_enabled) override fun onboardingVariant() = Config.ONBOARDING_VARIANT override fun isOnboardingAlreadyHaveAccountSplashEnabled() = true override fun isOnboardingSplashCarouselEnabled() = false // Tchap: no carousel diff --git a/vector/src/main/java/im/vector/app/features/home/HomeActivityViewModel.kt b/vector/src/main/java/im/vector/app/features/home/HomeActivityViewModel.kt index 007c25352a..dbb06d919b 100644 --- a/vector/src/main/java/im/vector/app/features/home/HomeActivityViewModel.kt +++ b/vector/src/main/java/im/vector/app/features/home/HomeActivityViewModel.kt @@ -267,7 +267,8 @@ class HomeActivityViewModel @AssistedInject constructor( // } when { - !vectorPreferences.areThreadMessagesEnabled() && !vectorPreferences.wasThreadFlagChangedManually() -> { + // Tchap : disable automatic thread migration + !vectorPreferences.areThreadMessagesEnabled() && !vectorPreferences.wasThreadFlagChangedManually() && vectorFeatures.tchapIsThreadEnabled() -> { vectorPreferences.setThreadMessagesEnabled() lightweightSettingsStorage.setThreadMessagesEnabled(vectorPreferences.areThreadMessagesEnabled()) // Clear Cache From 1aefff70bc434e5554b403ca1d9739018334b81a Mon Sep 17 00:00:00 2001 From: Didier Nizard Date: Thu, 16 Feb 2023 17:16:10 +0100 Subject: [PATCH 02/10] Prevent any migration --- .../im/vector/app/features/home/HomeActivityViewModel.kt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/vector/src/main/java/im/vector/app/features/home/HomeActivityViewModel.kt b/vector/src/main/java/im/vector/app/features/home/HomeActivityViewModel.kt index dbb06d919b..4240217e90 100644 --- a/vector/src/main/java/im/vector/app/features/home/HomeActivityViewModel.kt +++ b/vector/src/main/java/im/vector/app/features/home/HomeActivityViewModel.kt @@ -266,9 +266,11 @@ class HomeActivityViewModel @AssistedInject constructor( // lightweightSettingsStorage.setThreadMessagesEnabled(vectorPreferences.areThreadMessagesEnabled()) // } + // Tchap : disable automatic thread migration + if (!vectorFeatures.tchapIsThreadEnabled()) return + when { - // Tchap : disable automatic thread migration - !vectorPreferences.areThreadMessagesEnabled() && !vectorPreferences.wasThreadFlagChangedManually() && vectorFeatures.tchapIsThreadEnabled() -> { + !vectorPreferences.areThreadMessagesEnabled() && !vectorPreferences.wasThreadFlagChangedManually() -> { vectorPreferences.setThreadMessagesEnabled() lightweightSettingsStorage.setThreadMessagesEnabled(vectorPreferences.areThreadMessagesEnabled()) // Clear Cache From 6ec71aff406a298af84be5bbc03ffd7fe00e97cf Mon Sep 17 00:00:00 2001 From: yostyle Date: Fri, 17 Feb 2023 10:58:35 +0100 Subject: [PATCH 03/10] Remove hardcoded colors on send button --- vector/src/main/res/drawable/ic_rich_composer_send.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/vector/src/main/res/drawable/ic_rich_composer_send.xml b/vector/src/main/res/drawable/ic_rich_composer_send.xml index 0f99c1670e..b3df6e92dd 100644 --- a/vector/src/main/res/drawable/ic_rich_composer_send.xml +++ b/vector/src/main/res/drawable/ic_rich_composer_send.xml @@ -5,8 +5,8 @@ android:viewportHeight="36"> + android:fillColor="?colorPrimary"/> + android:fillColor="?colorOnPrimary"/> From 06715c4c5697e6388d2dd5bbc0038bb3ee16f6e2 Mon Sep 17 00:00:00 2001 From: yostyle Date: Mon, 13 Feb 2023 14:45:35 +0100 Subject: [PATCH 04/10] Remove deprecated endpoint /_matrix/client/unstable/users/info --- .../api/session/userinfo/UsersInfoService.kt | 28 ------------ .../api/session/userinfo/model/UserInfo.kt | 31 ------------- .../session/users/GetUsersInfoParams.kt | 28 ------------ .../session/users/GetUsersInfoResult.kt | 25 ----------- .../session/users/GetUsersInfoTask.kt | 44 ------------------- .../session/users/TchapUsersInfoModule.kt | 44 ------------------- .../session/users/TchapUsersInfoService.kt | 32 -------------- .../internal/session/users/UsersInfoAPI.kt | 30 ------------- .../matrix/android/sdk/api/session/Session.kt | 6 --- .../sdk/internal/session/DefaultSession.kt | 4 -- .../sdk/internal/session/SessionComponent.kt | 2 - 11 files changed, 274 deletions(-) delete mode 100644 matrix-sdk-android/src/main/java/fr/gouv/tchap/android/sdk/api/session/userinfo/UsersInfoService.kt delete mode 100644 matrix-sdk-android/src/main/java/fr/gouv/tchap/android/sdk/api/session/userinfo/model/UserInfo.kt delete mode 100644 matrix-sdk-android/src/main/java/fr/gouv/tchap/android/sdk/internal/session/users/GetUsersInfoParams.kt delete mode 100644 matrix-sdk-android/src/main/java/fr/gouv/tchap/android/sdk/internal/session/users/GetUsersInfoResult.kt delete mode 100644 matrix-sdk-android/src/main/java/fr/gouv/tchap/android/sdk/internal/session/users/GetUsersInfoTask.kt delete mode 100644 matrix-sdk-android/src/main/java/fr/gouv/tchap/android/sdk/internal/session/users/TchapUsersInfoModule.kt delete mode 100644 matrix-sdk-android/src/main/java/fr/gouv/tchap/android/sdk/internal/session/users/TchapUsersInfoService.kt delete mode 100644 matrix-sdk-android/src/main/java/fr/gouv/tchap/android/sdk/internal/session/users/UsersInfoAPI.kt diff --git a/matrix-sdk-android/src/main/java/fr/gouv/tchap/android/sdk/api/session/userinfo/UsersInfoService.kt b/matrix-sdk-android/src/main/java/fr/gouv/tchap/android/sdk/api/session/userinfo/UsersInfoService.kt deleted file mode 100644 index 3d0efdcd3e..0000000000 --- a/matrix-sdk-android/src/main/java/fr/gouv/tchap/android/sdk/api/session/userinfo/UsersInfoService.kt +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (c) 2021 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 fr.gouv.tchap.android.sdk.api.session.userinfo - -import fr.gouv.tchap.android.sdk.api.session.userinfo.model.UserInfo - -interface UsersInfoService { - /** - * Get users information. - * - * @param userIds user Matrix Ids - */ - suspend fun getUsersInfo(userIds: List): Map -} diff --git a/matrix-sdk-android/src/main/java/fr/gouv/tchap/android/sdk/api/session/userinfo/model/UserInfo.kt b/matrix-sdk-android/src/main/java/fr/gouv/tchap/android/sdk/api/session/userinfo/model/UserInfo.kt deleted file mode 100644 index 9d5dc49ae1..0000000000 --- a/matrix-sdk-android/src/main/java/fr/gouv/tchap/android/sdk/api/session/userinfo/model/UserInfo.kt +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright (c) 2021 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 fr.gouv.tchap.android.sdk.api.session.userinfo.model - -/** - * Ref: https://gitlab.matrix.org/new-vector/internal/-/wikis/DINSIC#get-_matrixfederationv1queryuser_info-federationsynapse - */ -data class UserInfo( - /** - * Whether the user account is expired. - */ - val expired: Boolean, - /** - * Whether the user account is deactivated. - */ - val deactivated: Boolean -) diff --git a/matrix-sdk-android/src/main/java/fr/gouv/tchap/android/sdk/internal/session/users/GetUsersInfoParams.kt b/matrix-sdk-android/src/main/java/fr/gouv/tchap/android/sdk/internal/session/users/GetUsersInfoParams.kt deleted file mode 100644 index f7999830ad..0000000000 --- a/matrix-sdk-android/src/main/java/fr/gouv/tchap/android/sdk/internal/session/users/GetUsersInfoParams.kt +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (c) 2021 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 fr.gouv.tchap.android.sdk.internal.session.users - -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass - -/** - * @property userIds Required. The list of user Matrix IDs to query information about. - */ -@JsonClass(generateAdapter = true) -internal data class GetUsersInfoParams( - @Json(name = "user_ids") val userIds: List -) diff --git a/matrix-sdk-android/src/main/java/fr/gouv/tchap/android/sdk/internal/session/users/GetUsersInfoResult.kt b/matrix-sdk-android/src/main/java/fr/gouv/tchap/android/sdk/internal/session/users/GetUsersInfoResult.kt deleted file mode 100644 index ce24b61254..0000000000 --- a/matrix-sdk-android/src/main/java/fr/gouv/tchap/android/sdk/internal/session/users/GetUsersInfoResult.kt +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright (c) 2021 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 fr.gouv.tchap.android.sdk.internal.session.users - -import com.squareup.moshi.JsonClass - -@JsonClass(generateAdapter = true) -internal data class GetUsersInfoResult( - val expired: Boolean, - val deactivated: Boolean -) diff --git a/matrix-sdk-android/src/main/java/fr/gouv/tchap/android/sdk/internal/session/users/GetUsersInfoTask.kt b/matrix-sdk-android/src/main/java/fr/gouv/tchap/android/sdk/internal/session/users/GetUsersInfoTask.kt deleted file mode 100644 index 4044eae983..0000000000 --- a/matrix-sdk-android/src/main/java/fr/gouv/tchap/android/sdk/internal/session/users/GetUsersInfoTask.kt +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (c) 2021 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 fr.gouv.tchap.android.sdk.internal.session.users - -import fr.gouv.tchap.android.sdk.api.session.userinfo.model.UserInfo -import org.matrix.android.sdk.internal.network.GlobalErrorReceiver -import org.matrix.android.sdk.internal.network.executeRequest -import org.matrix.android.sdk.internal.task.Task -import javax.inject.Inject - -internal interface GetUsersInfoTask : Task> - -internal class TchapGetUsersInfoTask @Inject constructor( - private val usersAPI: UsersInfoAPI, - private val globalErrorReceiver: GlobalErrorReceiver -) : GetUsersInfoTask { - - override suspend fun execute(params: GetUsersInfoParams): Map { - val result = executeRequest(globalErrorReceiver) { - usersAPI.getUsersInfo(params) - } - - return result.mapValues { - UserInfo( - expired = it.value.expired, - deactivated = it.value.deactivated - ) - } - } -} diff --git a/matrix-sdk-android/src/main/java/fr/gouv/tchap/android/sdk/internal/session/users/TchapUsersInfoModule.kt b/matrix-sdk-android/src/main/java/fr/gouv/tchap/android/sdk/internal/session/users/TchapUsersInfoModule.kt deleted file mode 100644 index fc7b3724ca..0000000000 --- a/matrix-sdk-android/src/main/java/fr/gouv/tchap/android/sdk/internal/session/users/TchapUsersInfoModule.kt +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (c) 2021 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 fr.gouv.tchap.android.sdk.internal.session.users - -import dagger.Binds -import dagger.Module -import dagger.Provides -import fr.gouv.tchap.android.sdk.api.session.userinfo.UsersInfoService -import org.matrix.android.sdk.internal.session.SessionScope -import retrofit2.Retrofit - -@Module -internal abstract class TchapUsersInfoModule { - - @Module - companion object { - @JvmStatic - @Provides - @SessionScope - fun providesUsersInfoAPI(retrofit: Retrofit): UsersInfoAPI { - return retrofit.create(UsersInfoAPI::class.java) - } - } - - @Binds - abstract fun bindUsersInfoService(service: TchapUsersInfoService): UsersInfoService - - @Binds - abstract fun bindGetUsersInfoTask(task: TchapGetUsersInfoTask): GetUsersInfoTask -} diff --git a/matrix-sdk-android/src/main/java/fr/gouv/tchap/android/sdk/internal/session/users/TchapUsersInfoService.kt b/matrix-sdk-android/src/main/java/fr/gouv/tchap/android/sdk/internal/session/users/TchapUsersInfoService.kt deleted file mode 100644 index 76f8d0b954..0000000000 --- a/matrix-sdk-android/src/main/java/fr/gouv/tchap/android/sdk/internal/session/users/TchapUsersInfoService.kt +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright (c) 2021 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 fr.gouv.tchap.android.sdk.internal.session.users - -import fr.gouv.tchap.android.sdk.api.session.userinfo.UsersInfoService -import fr.gouv.tchap.android.sdk.api.session.userinfo.model.UserInfo -import javax.inject.Inject - -internal class TchapUsersInfoService @Inject constructor( - private val getUsersInfoTask: GetUsersInfoTask -) : UsersInfoService { - - override suspend fun getUsersInfo(userIds: List): Map { - return getUsersInfoTask.execute( - GetUsersInfoParams(userIds) - ) - } -} diff --git a/matrix-sdk-android/src/main/java/fr/gouv/tchap/android/sdk/internal/session/users/UsersInfoAPI.kt b/matrix-sdk-android/src/main/java/fr/gouv/tchap/android/sdk/internal/session/users/UsersInfoAPI.kt deleted file mode 100644 index 442984b52e..0000000000 --- a/matrix-sdk-android/src/main/java/fr/gouv/tchap/android/sdk/internal/session/users/UsersInfoAPI.kt +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright (c) 2021 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 fr.gouv.tchap.android.sdk.internal.session.users - -import org.matrix.android.sdk.internal.network.NetworkConstants -import retrofit2.http.Body -import retrofit2.http.POST - -internal interface UsersInfoAPI { - - /** - * Get the expiration and deactivation information about the given user ids. - */ - @POST(NetworkConstants.URI_API_PREFIX_PATH_UNSTABLE + "users/info") - suspend fun getUsersInfo(@Body usersInfoParams: GetUsersInfoParams): Map -} diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/Session.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/Session.kt index 54558337da..5c2854aeb0 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/Session.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/Session.kt @@ -18,7 +18,6 @@ package org.matrix.android.sdk.api.session import androidx.annotation.MainThread import fr.gouv.tchap.android.sdk.api.auth.AccountValidityService -import fr.gouv.tchap.android.sdk.api.session.userinfo.UsersInfoService import io.realm.RealmConfiguration import okhttp3.OkHttpClient import org.matrix.android.sdk.api.MatrixCoroutineDispatchers @@ -274,11 +273,6 @@ interface Session { */ fun accountDataService(): SessionAccountDataService - /** - * Returns the users info service associated with the session. - */ - fun usersInfoService(): UsersInfoService - /** * Returns the account validity service associated with the session. */ diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/DefaultSession.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/DefaultSession.kt index 1017b53e05..f88e78068d 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/DefaultSession.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/DefaultSession.kt @@ -19,7 +19,6 @@ package org.matrix.android.sdk.internal.session import androidx.annotation.MainThread import dagger.Lazy import fr.gouv.tchap.android.sdk.api.auth.AccountValidityService -import fr.gouv.tchap.android.sdk.api.session.userinfo.UsersInfoService import io.realm.RealmConfiguration import kotlinx.coroutines.NonCancellable import kotlinx.coroutines.withContext @@ -132,7 +131,6 @@ internal class DefaultSession @Inject constructor( private val presenceService: Lazy, private val toDeviceService: Lazy, private val eventStreamService: Lazy, - private val usersInfoService: Lazy, private val accountValidityService: Lazy, @UnauthenticatedWithCertificate private val unauthenticatedWithCertificateOkHttpClient: Lazy, @@ -235,8 +233,6 @@ internal class DefaultSession @Inject constructor( override fun accountDataService(): SessionAccountDataService = accountDataService.get() override fun sharedSecretStorageService(): SharedSecretStorageService = sharedSecretStorageService.get() - override fun usersInfoService(): UsersInfoService = usersInfoService.get() - override fun accountValidityService(): AccountValidityService = accountValidityService.get() override fun getOkHttpClient(): OkHttpClient { diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/SessionComponent.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/SessionComponent.kt index 27096524e2..3419dfcf48 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/SessionComponent.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/SessionComponent.kt @@ -19,7 +19,6 @@ package org.matrix.android.sdk.internal.session import dagger.BindsInstance import dagger.Component import fr.gouv.tchap.android.sdk.internal.auth.TchapAccountValidityModule -import fr.gouv.tchap.android.sdk.internal.session.users.TchapUsersInfoModule import org.matrix.android.sdk.api.MatrixCoroutineDispatchers import org.matrix.android.sdk.api.auth.data.SessionParams import org.matrix.android.sdk.api.securestorage.SecureStorageModule @@ -70,7 +69,6 @@ import org.matrix.android.sdk.internal.util.system.SystemModule @Component( dependencies = [MatrixComponent::class], modules = [ - TchapUsersInfoModule::class, TchapAccountValidityModule::class, SessionModule::class, RoomModule::class, From de186d7b7f7dc89257c411dcc5eb3bd18d95f6aa Mon Sep 17 00:00:00 2001 From: Didier Nizard Date: Fri, 17 Feb 2023 15:22:14 +0100 Subject: [PATCH 05/10] Remove email notifications --- vector/src/main/res/xml/vector_settings_notifications.xml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/vector/src/main/res/xml/vector_settings_notifications.xml b/vector/src/main/res/xml/vector_settings_notifications.xml index f4d7ff8cd5..3f515b64f3 100644 --- a/vector/src/main/res/xml/vector_settings_notifications.xml +++ b/vector/src/main/res/xml/vector_settings_notifications.xml @@ -43,9 +43,10 @@ - + Date: Fri, 17 Feb 2023 15:42:23 +0100 Subject: [PATCH 06/10] Add changelog --- changelog.d/811.sdk | 1 + 1 file changed, 1 insertion(+) create mode 100644 changelog.d/811.sdk diff --git a/changelog.d/811.sdk b/changelog.d/811.sdk new file mode 100644 index 0000000000..d26c566dfc --- /dev/null +++ b/changelog.d/811.sdk @@ -0,0 +1 @@ +[Mainlining] Remove deprecated endpoint /_matrix/client/unstable/users/info From 65f605d820fcbbc22a352a0d0892532d70c9fb71 Mon Sep 17 00:00:00 2001 From: Didier Nizard Date: Fri, 17 Feb 2023 15:51:56 +0100 Subject: [PATCH 07/10] Update vector/src/main/res/xml/vector_settings_notifications.xml Co-authored-by: Yoan Pintas --- vector/src/main/res/xml/vector_settings_notifications.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vector/src/main/res/xml/vector_settings_notifications.xml b/vector/src/main/res/xml/vector_settings_notifications.xml index 3f515b64f3..fc7069d573 100644 --- a/vector/src/main/res/xml/vector_settings_notifications.xml +++ b/vector/src/main/res/xml/vector_settings_notifications.xml @@ -43,7 +43,7 @@ - + From 80cc6cb89ac6dca7d3e9b2238b008731ed27d362 Mon Sep 17 00:00:00 2001 From: Yoan Pintas Date: Wed, 22 Feb 2023 14:04:52 +0100 Subject: [PATCH 08/10] Fix crash on logout (#859) --- changelog.d/857.bugfix | 1 + .../SignOutBottomSheetDialogFragment.kt | 2 +- .../workers/signout/SignoutCheckViewModel.kt | 30 +++++++------------ 3 files changed, 13 insertions(+), 20 deletions(-) create mode 100644 changelog.d/857.bugfix diff --git a/changelog.d/857.bugfix b/changelog.d/857.bugfix new file mode 100644 index 0000000000..b9f18b81c5 --- /dev/null +++ b/changelog.d/857.bugfix @@ -0,0 +1 @@ +Crash on logout diff --git a/vector/src/main/java/im/vector/app/features/workers/signout/SignOutBottomSheetDialogFragment.kt b/vector/src/main/java/im/vector/app/features/workers/signout/SignOutBottomSheetDialogFragment.kt index e94815c072..6ae24854d5 100644 --- a/vector/src/main/java/im/vector/app/features/workers/signout/SignOutBottomSheetDialogFragment.kt +++ b/vector/src/main/java/im/vector/app/features/workers/signout/SignOutBottomSheetDialogFragment.kt @@ -103,7 +103,7 @@ class SignOutBottomSheetDialogFragment : override fun invalidate() = withState(viewModel) { state -> views.signoutExportingLoading.isVisible = false - if (!state.isKeyBackupSupported) { + if (!viewModel.isKeyBackupSupported()) { views.bottomSheetSignoutWarningText.text = getString(R.string.tchap_action_sign_out_confirmation) views.setupRecoveryButton.isVisible = false diff --git a/vector/src/main/java/im/vector/app/features/workers/signout/SignoutCheckViewModel.kt b/vector/src/main/java/im/vector/app/features/workers/signout/SignoutCheckViewModel.kt index be3408a69e..aa5608dd5a 100644 --- a/vector/src/main/java/im/vector/app/features/workers/signout/SignoutCheckViewModel.kt +++ b/vector/src/main/java/im/vector/app/features/workers/signout/SignoutCheckViewModel.kt @@ -23,16 +23,15 @@ import com.airbnb.mvrx.MavericksState import com.airbnb.mvrx.MavericksViewModelFactory import com.airbnb.mvrx.Success import com.airbnb.mvrx.Uninitialized -import com.airbnb.mvrx.ViewModelContext import dagger.assisted.Assisted import dagger.assisted.AssistedFactory import dagger.assisted.AssistedInject import im.vector.app.core.di.MavericksAssistedViewModelFactory import im.vector.app.core.di.hiltMavericksViewModelFactory import im.vector.app.core.platform.EmptyViewEvents -import im.vector.app.core.platform.VectorBaseActivity import im.vector.app.core.platform.VectorViewModel import im.vector.app.core.platform.VectorViewModelAction +import im.vector.app.features.VectorFeatures import im.vector.app.features.crypto.keys.KeysExporter import kotlinx.coroutines.flow.distinctUntilChanged import kotlinx.coroutines.flow.map @@ -53,12 +52,12 @@ data class SignoutCheckViewState( val crossSigningSetupAllKeysKnown: Boolean = false, val keysBackupState: KeysBackupState = KeysBackupState.Unknown, val hasBeenExportedToFile: Async = Uninitialized, - val isKeyBackupSupported: Boolean = false ) : MavericksState class SignoutCheckViewModel @AssistedInject constructor( @Assisted initialState: SignoutCheckViewState, private val session: Session, + private val vectorFeatures: VectorFeatures, private val keysExporter: KeysExporter ) : VectorViewModel(initialState), KeysBackupStateListener { @@ -72,22 +71,17 @@ class SignoutCheckViewModel @AssistedInject constructor( override fun create(initialState: SignoutCheckViewState): SignoutCheckViewModel } - // Tchap: init viewState with key backup - companion object : MavericksViewModelFactory by hiltMavericksViewModelFactory() { - override fun initialState(viewModelContext: ViewModelContext): SignoutCheckViewState? { - val isKeyBackupEnabled = (viewModelContext.activity as? VectorBaseActivity<*>)?.vectorFeatures?.tchapIsKeyBackupEnabled().orFalse() - return SignoutCheckViewState(isKeyBackupSupported = isKeyBackupEnabled) - } - } + companion object : MavericksViewModelFactory by hiltMavericksViewModelFactory() init { - withState { state -> - if (state.isKeyBackupSupported) { - init() - } + // Tchap: init when key backup is supported + if (isKeyBackupSupported()) { + init() } } + fun isKeyBackupSupported() = vectorFeatures.tchapIsKeyBackupEnabled().orFalse() + fun init() { session.cryptoService().keysBackupService().addListener(this) session.cryptoService().keysBackupService().checkAndStartKeysBackup() @@ -115,10 +109,8 @@ class SignoutCheckViewModel @AssistedInject constructor( } override fun onCleared() { - withState { state -> - if (state.isKeyBackupSupported) { - session.cryptoService().keysBackupService().removeListener(this) - } + if (isKeyBackupSupported()) { + session.cryptoService().keysBackupService().removeListener(this) } super.onCleared() } @@ -132,7 +124,7 @@ class SignoutCheckViewModel @AssistedInject constructor( } fun refreshRemoteStateIfNeeded() = withState { state -> - if (state.isKeyBackupSupported && state.keysBackupState == KeysBackupState.Disabled) { + if (isKeyBackupSupported() && state.keysBackupState == KeysBackupState.Disabled) { session.cryptoService().keysBackupService().checkAndStartKeysBackup() } } From 694e9b69e88f18cd94943431b647d8ee8fc5ea8f Mon Sep 17 00:00:00 2001 From: Yoan Pintas Date: Thu, 23 Feb 2023 09:37:15 +0100 Subject: [PATCH 09/10] Prevent selecting multiple languages (#860) --- changelog.d/853.bugfix | 1 + vector-app/build.gradle | 3 +++ vector/build.gradle | 3 --- 3 files changed, 4 insertions(+), 3 deletions(-) create mode 100644 changelog.d/853.bugfix diff --git a/changelog.d/853.bugfix b/changelog.d/853.bugfix new file mode 100644 index 0000000000..0f5d1ce979 --- /dev/null +++ b/changelog.d/853.bugfix @@ -0,0 +1 @@ +Prevent selecting multiple languages diff --git a/vector-app/build.gradle b/vector-app/build.gradle index a33879c2f9..a47148a2d8 100644 --- a/vector-app/build.gradle +++ b/vector-app/build.gradle @@ -158,6 +158,9 @@ android { // abiFilters "armeabi-v7a", "x86", 'arm64-v8a', 'x86_64' // } + // Tchap: Use only en and fr + resConfigs "en", "fr" + // Ref: https://developer.android.com/studio/build/configure-apk-splits.html splits { // Configures multiple APKs based on ABI. diff --git a/vector/build.gradle b/vector/build.gradle index 100899e5de..0e6f0bc274 100644 --- a/vector/build.gradle +++ b/vector/build.gradle @@ -48,9 +48,6 @@ android { // abiFilters "armeabi-v7a", "x86", 'arm64-v8a', 'x86_64' // } - // Tchap: Use only en and fr - resConfigs "en", "fr" - // Generate a random app task affinity manifestPlaceholders = [appTaskAffinitySuffix: "H_${gitRevision()}"] From c9a6fecb62502a9fdf97609d5b1ef6099dc217f2 Mon Sep 17 00:00:00 2001 From: yostyle Date: Thu, 23 Feb 2023 10:09:54 +0100 Subject: [PATCH 10/10] Upgrade version and update changelog --- TCHAP_CHANGES.md | 13 +++++++++++++ changelog.d/811.sdk | 1 - changelog.d/853.bugfix | 1 - changelog.d/857.bugfix | 1 - towncrier.toml | 2 +- vector-app/build.gradle | 2 +- 6 files changed, 15 insertions(+), 5 deletions(-) delete mode 100644 changelog.d/811.sdk delete mode 100644 changelog.d/853.bugfix delete mode 100644 changelog.d/857.bugfix diff --git a/TCHAP_CHANGES.md b/TCHAP_CHANGES.md index c5137340c1..ea9e607660 100644 --- a/TCHAP_CHANGES.md +++ b/TCHAP_CHANGES.md @@ -1,3 +1,16 @@ +Changes in Tchap 2.7.1 (2023-02-23) +=================================== + +Bugfixes 🐛 +---------- + - Prevent selecting multiple languages ([#853](https://github.com/tchapgouv/tchap-android-v2/issues/853)) + - Crash on logout ([#857](https://github.com/tchapgouv/tchap-android-v2/issues/857)) + +SDK API changes ⚠️ +------------------ + - [Mainlining] Remove deprecated endpoint /_matrix/client/unstable/users/info ([#811](https://github.com/tchapgouv/tchap-android-v2/issues/811)) + + Changes in Tchap 2.7.0 (2023-02-13) =================================== diff --git a/changelog.d/811.sdk b/changelog.d/811.sdk deleted file mode 100644 index d26c566dfc..0000000000 --- a/changelog.d/811.sdk +++ /dev/null @@ -1 +0,0 @@ -[Mainlining] Remove deprecated endpoint /_matrix/client/unstable/users/info diff --git a/changelog.d/853.bugfix b/changelog.d/853.bugfix deleted file mode 100644 index 0f5d1ce979..0000000000 --- a/changelog.d/853.bugfix +++ /dev/null @@ -1 +0,0 @@ -Prevent selecting multiple languages diff --git a/changelog.d/857.bugfix b/changelog.d/857.bugfix deleted file mode 100644 index b9f18b81c5..0000000000 --- a/changelog.d/857.bugfix +++ /dev/null @@ -1 +0,0 @@ -Crash on logout diff --git a/towncrier.toml b/towncrier.toml index 178c5c7e6b..721b430783 100644 --- a/towncrier.toml +++ b/towncrier.toml @@ -1,5 +1,5 @@ [tool.towncrier] - version = "2.7.0" + version = "2.7.1" directory = "changelog.d" filename = "TCHAP_CHANGES.md" name = "Changes in Tchap" diff --git a/vector-app/build.gradle b/vector-app/build.gradle index a47148a2d8..9253cb9b8a 100644 --- a/vector-app/build.gradle +++ b/vector-app/build.gradle @@ -37,7 +37,7 @@ ext.versionMinor = 7 // Note: even values are reserved for regular release, odd values for hotfix release. // When creating a hotfix, you should decrease the value, since the current value // is the value for the next regular release. -ext.versionPatch = 0 +ext.versionPatch = 1 static def getGitTimestamp() { def cmd = 'git show -s --format=%ct'