Skip to content

Commit

Permalink
chore: add client suffix on debug builds [ACOL-144] (#2678)
Browse files Browse the repository at this point in the history
  • Loading branch information
Garzas authored Feb 9, 2024
1 parent 0f6bace commit 60618af
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
)
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 ->
Expand Down Expand Up @@ -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 */
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
)
)
Expand Down Expand Up @@ -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
)
)
}
Expand Down

0 comments on commit 60618af

Please sign in to comment.