From 60618af20622a848181f10df2297dbf99c8c9e1a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20=C5=BBerko?= Date: Fri, 9 Feb 2024 15:03:30 +0100 Subject: [PATCH] chore: add client suffix on debug builds [ACOL-144] (#2678) --- .../create/code/CreateAccountCodeViewModel.kt | 4 +++- .../devices/register/RegisterDeviceViewModel.kt | 5 ++++- .../devices/remove/RemoveDeviceViewModel.kt | 6 +++++- .../android/ui/authentication/login/LoginViewModel.kt | 8 +++++--- kalium | 2 +- 5 files changed, 18 insertions(+), 7 deletions(-) diff --git a/app/src/main/kotlin/com/wire/android/ui/authentication/create/code/CreateAccountCodeViewModel.kt b/app/src/main/kotlin/com/wire/android/ui/authentication/create/code/CreateAccountCodeViewModel.kt index c7a075c102c..69011f6ed01 100644 --- a/app/src/main/kotlin/com/wire/android/ui/authentication/create/code/CreateAccountCodeViewModel.kt +++ b/app/src/main/kotlin/com/wire/android/ui/authentication/create/code/CreateAccountCodeViewModel.kt @@ -24,6 +24,7 @@ import androidx.compose.ui.text.input.TextFieldValue import androidx.lifecycle.SavedStateHandle import androidx.lifecycle.ViewModel import androidx.lifecycle.viewModelScope +import com.wire.android.BuildConfig import com.wire.android.di.AuthServerConfigProvider import com.wire.android.di.ClientScopeProvider import com.wire.android.di.KaliumCoreLogic @@ -209,7 +210,8 @@ class CreateAccountCodeViewModel @Inject constructor( clientScopeProviderFactory.create(userId).clientScope.getOrRegister( RegisterClientUseCase.RegisterClientParam( password = password, - capabilities = null + capabilities = null, + modelPostfix = if (BuildConfig.PRIVATE_BUILD) " [${BuildConfig.FLAVOR}_${BuildConfig.BUILD_TYPE}]" else null ) ) diff --git a/app/src/main/kotlin/com/wire/android/ui/authentication/devices/register/RegisterDeviceViewModel.kt b/app/src/main/kotlin/com/wire/android/ui/authentication/devices/register/RegisterDeviceViewModel.kt index b7d0354d7f3..55336d9efe5 100644 --- a/app/src/main/kotlin/com/wire/android/ui/authentication/devices/register/RegisterDeviceViewModel.kt +++ b/app/src/main/kotlin/com/wire/android/ui/authentication/devices/register/RegisterDeviceViewModel.kt @@ -24,6 +24,7 @@ import androidx.compose.runtime.setValue import androidx.compose.ui.text.input.TextFieldValue import androidx.lifecycle.ViewModel import androidx.lifecycle.viewModelScope +import com.wire.android.BuildConfig import com.wire.android.datastore.UserDataStore import com.wire.kalium.logic.feature.client.GetOrRegisterClientUseCase import com.wire.kalium.logic.feature.client.RegisterClientResult @@ -79,6 +80,7 @@ class RegisterDeviceViewModel @Inject constructor( RegisterClientUseCase.RegisterClientParam( password = password, capabilities = null, + modelPostfix = if (BuildConfig.PRIVATE_BUILD) " [${BuildConfig.FLAVOR}_${BuildConfig.BUILD_TYPE}]" else null ) )) { is RegisterClientResult.Failure.TooManyClients -> @@ -113,7 +115,8 @@ class RegisterDeviceViewModel @Inject constructor( flowState = RegisterDeviceFlowState.Error.InvalidCredentialsError ) - is RegisterClientResult.Failure.PasswordAuthRequired -> { /* app is already waiting for the user to enter the password */ } + is RegisterClientResult.Failure.PasswordAuthRequired -> { /* app is already waiting for the user to enter the password */ + } } } diff --git a/app/src/main/kotlin/com/wire/android/ui/authentication/devices/remove/RemoveDeviceViewModel.kt b/app/src/main/kotlin/com/wire/android/ui/authentication/devices/remove/RemoveDeviceViewModel.kt index ceb0f3b653f..8b032a358f5 100644 --- a/app/src/main/kotlin/com/wire/android/ui/authentication/devices/remove/RemoveDeviceViewModel.kt +++ b/app/src/main/kotlin/com/wire/android/ui/authentication/devices/remove/RemoveDeviceViewModel.kt @@ -24,6 +24,7 @@ import androidx.compose.runtime.setValue import androidx.compose.ui.text.input.TextFieldValue import androidx.lifecycle.ViewModel import androidx.lifecycle.viewModelScope +import com.wire.android.BuildConfig import com.wire.android.datastore.UserDataStore import com.wire.android.ui.authentication.devices.model.Device import com.wire.kalium.logic.data.client.ClientType @@ -115,7 +116,10 @@ class RemoveDeviceViewModel @Inject constructor( private suspend fun registerClient(password: String?, onCompleted: (initialSyncCompleted: Boolean, isE2EIRequired: Boolean) -> Unit) { registerClientUseCase( - RegisterClientUseCase.RegisterClientParam(password, null) + RegisterClientUseCase.RegisterClientParam( + password, null, + modelPostfix = if (BuildConfig.PRIVATE_BUILD) " [${BuildConfig.FLAVOR}_${BuildConfig.BUILD_TYPE}]" else null + ) ).also { result -> when (result) { is RegisterClientResult.Failure.PasswordAuthRequired -> { diff --git a/app/src/main/kotlin/com/wire/android/ui/authentication/login/LoginViewModel.kt b/app/src/main/kotlin/com/wire/android/ui/authentication/login/LoginViewModel.kt index 5d48582fcca..a0184f6d058 100644 --- a/app/src/main/kotlin/com/wire/android/ui/authentication/login/LoginViewModel.kt +++ b/app/src/main/kotlin/com/wire/android/ui/authentication/login/LoginViewModel.kt @@ -26,6 +26,7 @@ import androidx.compose.ui.text.input.TextFieldValue import androidx.lifecycle.SavedStateHandle import androidx.lifecycle.ViewModel import androidx.lifecycle.viewModelScope +import com.wire.android.BuildConfig import com.wire.android.datastore.UserDataStoreProvider import com.wire.android.di.AuthServerConfigProvider import com.wire.android.di.ClientScopeProvider @@ -84,8 +85,8 @@ open class LoginViewModel @Inject constructor( userIdentifierEnabled = preFilledUserIdentifier is PreFilledUserIdentifierType.None, password = TextFieldValue(String.EMPTY), isProxyAuthRequired = - if (serverConfig.apiProxy?.needsAuthentication != null) serverConfig.apiProxy?.needsAuthentication!! - else false, + if (serverConfig.apiProxy?.needsAuthentication != null) serverConfig.apiProxy?.needsAuthentication!! + else false, isProxyEnabled = serverConfig.apiProxy != null ) ) @@ -136,7 +137,8 @@ open class LoginViewModel @Inject constructor( RegisterClientUseCase.RegisterClientParam( password = password, capabilities = capabilities, - secondFactorVerificationCode = secondFactorVerificationCode + secondFactorVerificationCode = secondFactorVerificationCode, + modelPostfix = if (BuildConfig.PRIVATE_BUILD) " [${BuildConfig.FLAVOR}_${BuildConfig.BUILD_TYPE}]" else null ) ) } diff --git a/kalium b/kalium index 65f9293521b..c534b244682 160000 --- a/kalium +++ b/kalium @@ -1 +1 @@ -Subproject commit 65f9293521b612f83a27353e6b04456c877f7aad +Subproject commit c534b244682b5710fe46072ae01f41fa026be4db