Skip to content

Commit

Permalink
Merge pull request #1292 from radixdlt/hotfix/1.11.2
Browse files Browse the repository at this point in the history
Hotfix 1.11.2
  • Loading branch information
giannis-rdx authored Dec 23, 2024
2 parents d1adff8 + ed7ee15 commit a5d274f
Show file tree
Hide file tree
Showing 17 changed files with 174 additions and 125 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@ android {
applicationId "com.radixpublishing.radixwallet.android"
minSdk rootProject.ext.minSdk
targetSdk rootProject.ext.targetSdk
versionCode 54
versionName "1.11.1"
versionCode 55
versionName "1.11.2"
buildConfigField "boolean", "DEBUG_MODE", "true"
buildConfigField "boolean", "CRASH_REPORTING_AVAILABLE", "false"
buildConfigField "boolean", "EXPERIMENTAL_FEATURES_ENABLED", "true"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ sealed class RadixWalletException(cause: Throwable? = null) : Throwable(cause =
data object GetEpoch : DappRequestException()
data object RejectedByUser : DappRequestException()
data object InvalidRequest : DappRequestException()
data object UnacceptableManifest : DappRequestException()
data class UnacceptableManifest(override val cause: Throwable) : DappRequestException(cause = cause)
data object InvalidPersona : DappRequestException()
data object InvalidPersonaOrAccounts : DappRequestException()
data object InvalidRequestChallenge : DappRequestException()
Expand Down Expand Up @@ -74,7 +74,7 @@ sealed class RadixWalletException(cause: Throwable? = null) : Throwable(cause =
InvalidRequestChallenge -> DappWalletInteractionErrorType.FAILED_TO_SIGN_AUTH_CHALLENGE
NotPossibleToAuthenticateAutomatically -> DappWalletInteractionErrorType.INVALID_REQUEST
RejectedByUser -> DappWalletInteractionErrorType.REJECTED_BY_USER
UnacceptableManifest -> DappWalletInteractionErrorType.INVALID_REQUEST
is UnacceptableManifest -> DappWalletInteractionErrorType.INVALID_REQUEST
is WrongNetwork -> DappWalletInteractionErrorType.WRONG_NETWORK
is PreviewError -> DappWalletInteractionErrorType.FAILED_TO_PREPARE_TRANSACTION
InvalidPersonaOrAccounts -> DappWalletInteractionErrorType.INVALID_PERSONA_OR_ACCOUNTS
Expand Down Expand Up @@ -292,7 +292,7 @@ fun RadixWalletException.DappRequestException.toUserFriendlyMessage(context: Con
R.string.dAppRequest_validationOutcome_invalidRequestMessage
)

RadixWalletException.DappRequestException.UnacceptableManifest -> context.getString(
is RadixWalletException.DappRequestException.UnacceptableManifest -> context.getString(
R.string.transactionReview_unacceptableManifest_rejected
)

Expand Down Expand Up @@ -471,7 +471,7 @@ fun Throwable.getDappMessage(): String? {
"Wallet is using network ID: $currentNetworkId, request sent specified network ID: $requestNetworkId"
}

else -> message
else -> message ?: cause?.message
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,10 @@ class SignWithDeviceFactorSourceUseCase @Inject constructor(
is EntitySecurityState.Unsecured -> {
val factorInstance = when (signRequest) {
is SignRequest.RolaSignRequest ->
securityState.value.authenticationSigning
?: securityState.value.transactionSigning
// TODO AuthSigningFactorInstance update this when the feature is implemented
// securityState.value.authenticationSigning
// ?:
securityState.value.transactionSigning

is SignRequest.TransactionIntentSignRequest,
is SignRequest.SubintentSignRequest -> securityState.value.transactionSigning
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -257,8 +257,11 @@ class GetSignaturesViewModel @Inject constructor(
is EntitySecurityState.Unsecured -> {
val factorSourceId = when (state.value.signPurpose) {
SignPurpose.SignTransaction -> securityState.value.transactionSigning.factorSourceId.asGeneral()
SignPurpose.SignAuth -> securityState.value.authenticationSigning?.factorSourceId?.asGeneral()
?: securityState.value.transactionSigning.factorSourceId.asGeneral()
SignPurpose.SignAuth ->
// TODO AuthSigningFactorInstance update this when the feature is implemented, for now hiding the button
// securityState.value.authenticationSigning?.factorSourceId?.asGeneral()
// ?:
securityState.value.transactionSigning.factorSourceId.asGeneral()
}
val factorSource = requireNotNull(profile.factorSourceById(factorSourceId))

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import kotlinx.coroutines.flow.mapNotNull
import kotlinx.coroutines.flow.update
import kotlinx.coroutines.launch
import rdx.works.core.sargon.activeAccountsOnCurrentNetwork
import rdx.works.core.sargon.hasAuthSigning
import rdx.works.profile.domain.GetProfileUseCase
import rdx.works.profile.domain.ProfileException
import rdx.works.profile.domain.account.AddAuthSigningFactorInstanceUseCase
Expand Down Expand Up @@ -58,7 +57,9 @@ class DevSettingsViewModel @Inject constructor(
_state.update { state ->
state.copy(
account = account,
hasAuthKey = account.hasAuthSigning
// TODO AuthSigningFactorInstance update this when the feature is implemented, for now hiding the button
// hasAuthKey = account.hasAuthSigning
hasAuthKey = true
)
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
package com.babylon.wallet.android.presentation.common.resetwallet

import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.padding
import androidx.compose.material3.AlertDialog
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.semantics.Role
import com.babylon.wallet.android.R
import com.babylon.wallet.android.designsystem.theme.RadixTheme

@Composable
fun ResetWalletDialog(
modifier: Modifier = Modifier,
onConfirm: () -> Unit,
onDeny: () -> Unit
) {
AlertDialog(
modifier = modifier,
onDismissRequest = onDeny,
shape = RadixTheme.shapes.roundedRectSmall,
containerColor = RadixTheme.colors.defaultBackground,
title = {
Text(
text = stringResource(id = R.string.factoryReset_dialog_title),
style = RadixTheme.typography.body2Header,
color = RadixTheme.colors.gray1
)
},
text = {
Text(
text = stringResource(id = R.string.factoryReset_dialog_message),
style = RadixTheme.typography.body1Regular,
color = RadixTheme.colors.gray1
)
},
confirmButton = {
Text(
modifier = modifier
.clickable(role = Role.Button) { onConfirm() }
.padding(
horizontal = RadixTheme.dimensions.paddingSmall,
vertical = RadixTheme.dimensions.paddingXSmall
),
text = stringResource(id = R.string.common_confirm),
color = RadixTheme.colors.red1
)
},
dismissButton = {
Text(
modifier = modifier
.clickable(role = Role.Button) { onDeny() }
.padding(
horizontal = RadixTheme.dimensions.paddingSmall,
vertical = RadixTheme.dimensions.paddingXSmall
),
text = stringResource(id = R.string.common_cancel),
color = RadixTheme.colors.blue2
)
}
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ import kotlinx.coroutines.flow.update
import kotlinx.coroutines.launch
import rdx.works.core.domain.DApp
import rdx.works.core.sargon.activePersonaOnCurrentNetwork
import rdx.works.core.sargon.hasAuthSigning
import rdx.works.profile.data.repository.DAppConnectionRepository
import rdx.works.profile.domain.ChangeEntityVisibilityUseCase
import rdx.works.profile.domain.GetProfileUseCase
Expand Down Expand Up @@ -77,7 +76,9 @@ class PersonaDetailViewModel @Inject constructor(
authorizedDapps = dApps.toImmutableList(),
persona = personaToDApps.first,
loading = false,
hasAuthKey = personaToDApps.first.hasAuthSigning
// TODO AuthSigningFactorInstance update this when the feature is implemented, for now hiding the button
// hasAuthKey = personaToDApps.first.hasAuthSigning
hasAuthKey = true
)
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package com.babylon.wallet.android.presentation.settings.troubleshooting.reset

import androidx.compose.foundation.background
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
Expand All @@ -15,7 +14,6 @@ import androidx.compose.foundation.layout.navigationBars
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.verticalScroll
import androidx.compose.material3.AlertDialog
import androidx.compose.material3.Icon
import androidx.compose.material3.Scaffold
import androidx.compose.material3.SnackbarHostState
Expand All @@ -29,7 +27,6 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.shadow
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.semantics.Role
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.tooling.preview.PreviewParameter
import androidx.compose.ui.tooling.preview.PreviewParameterProvider
Expand All @@ -38,6 +35,7 @@ import androidx.lifecycle.compose.collectAsStateWithLifecycle
import com.babylon.wallet.android.R
import com.babylon.wallet.android.designsystem.theme.RadixTheme
import com.babylon.wallet.android.designsystem.theme.RadixWalletTheme
import com.babylon.wallet.android.presentation.common.resetwallet.ResetWalletDialog
import com.babylon.wallet.android.presentation.settings.securitycenter.RecoverableStatusCard
import com.babylon.wallet.android.presentation.ui.composables.DSR
import com.babylon.wallet.android.presentation.ui.composables.RadixCenteredTopAppBar
Expand Down Expand Up @@ -86,7 +84,7 @@ private fun FactoryResetScreenContent(
onBackClick: () -> Unit
) {
if (state.deleteWalletDialogVisible) {
DeleteWalletDialog(
ResetWalletDialog(
onConfirm = onDeleteWalletConfirm,
onDeny = onDeleteWalletDeny
)
Expand Down Expand Up @@ -200,58 +198,6 @@ private fun FactoryResetScreenContent(
}
}

@Composable
private fun DeleteWalletDialog(
modifier: Modifier = Modifier,
onConfirm: () -> Unit,
onDeny: () -> Unit
) {
AlertDialog(
modifier = modifier,
onDismissRequest = onDeny,
shape = RadixTheme.shapes.roundedRectSmall,
containerColor = RadixTheme.colors.defaultBackground,
title = {
Text(
text = stringResource(id = R.string.factoryReset_dialog_title),
style = RadixTheme.typography.body2Header,
color = RadixTheme.colors.gray1
)
},
text = {
Text(
text = stringResource(id = R.string.factoryReset_dialog_message),
style = RadixTheme.typography.body1Regular,
color = RadixTheme.colors.gray1
)
},
confirmButton = {
Text(
modifier = modifier
.clickable(role = Role.Button) { onConfirm() }
.padding(
horizontal = RadixTheme.dimensions.paddingSmall,
vertical = RadixTheme.dimensions.paddingXXSmall
),
text = stringResource(id = R.string.common_confirm),
color = RadixTheme.colors.red1
)
},
dismissButton = {
Text(
modifier = modifier
.clickable(role = Role.Button) { onDeny() }
.padding(
horizontal = RadixTheme.dimensions.paddingSmall,
vertical = RadixTheme.dimensions.paddingXXSmall
),
text = stringResource(id = R.string.common_cancel),
color = RadixTheme.colors.blue2
)
}
)
}

@Composable
fun UnrecoverableStatusCard(modifier: Modifier = Modifier, text: String) {
Row(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -268,8 +268,6 @@ class TransactionReviewViewModel @Inject constructor(
}

fun dismissTerminalErrorDialog() {
_state.update { it.copy(error = null) }

viewModelScope.launch {
val error = state.value.error?.error
if (error is DappRequestException) {
Expand All @@ -278,6 +276,7 @@ class TransactionReviewViewModel @Inject constructor(
incomingRequestRepository.requestHandled(args.interactionId)
sendEvent(Event.Dismiss)
}
_state.update { it.copy(error = null) }
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ class TransactionAnalysisDelegate @Inject constructor(
private fun mapPreviewError(error: Throwable): RadixWalletException {
return when (error) {
is CommonException.ReservedInstructionsNotAllowedInManifest -> {
RadixWalletException.DappRequestException.UnacceptableManifest
RadixWalletException.DappRequestException.UnacceptableManifest(cause = error)
}
is CommonException.OneOfReceivingAccountsDoesNotAllowDeposits -> {
RadixWalletException.PrepareTransactionException.ReceivingAccountDoesNotAllowDeposits
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ class TransactionSubmitDelegateImpl @Inject constructor(
val fungibleAsset = (transferable.asset as? Asset.Fungible) ?: return@mapNotNull null

TransactionGuarantee(
amount = amount.estimated,
amount = amount.guaranteed,
instructionIndex = amount.instructionIndex.toULong(),
resourceAddress = fungibleAsset.resource.address,
resourceDivisibility = fungibleAsset.resource.divisibility?.value,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,12 @@ import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import androidx.lifecycle.compose.collectAsStateWithLifecycle
import com.babylon.wallet.android.R
import com.babylon.wallet.android.designsystem.composable.RadixPrimaryButton
import com.babylon.wallet.android.designsystem.composable.RadixTextButton
import com.babylon.wallet.android.designsystem.theme.RadixTheme
import com.babylon.wallet.android.presentation.common.FullscreenCircularProgressContent
import com.babylon.wallet.android.presentation.common.resetwallet.ResetWalletDialog
import com.babylon.wallet.android.presentation.ui.RadixWalletPreviewTheme
import com.babylon.wallet.android.presentation.ui.composables.WarningButton

@Composable
fun ClaimedByAnotherDeviceScreen(
Expand Down Expand Up @@ -62,7 +63,10 @@ fun ClaimedByAnotherDeviceScreen(
.padding(padding)
.padding(vertical = RadixTheme.dimensions.paddingLarge)
.fillMaxSize(),
onClearWalletClick = viewModel::onClearWalletClick,
state = state,
onResetWalletClick = viewModel::onResetWalletClick,
onResetWalletConfirmClick = viewModel::onResetWalletConfirm,
onResetWalletDenyClick = viewModel::onResetWalletDeny,
onTransferControlBackClick = viewModel::onTransferWalletBackClick
)
}
Expand All @@ -72,9 +76,19 @@ fun ClaimedByAnotherDeviceScreen(
@Composable
fun ClaimedByAnotherDeviceContent(
modifier: Modifier = Modifier,
onClearWalletClick: () -> Unit,
state: ClaimedByAnotherDeviceViewModel.State,
onResetWalletClick: () -> Unit,
onResetWalletConfirmClick: () -> Unit,
onResetWalletDenyClick: () -> Unit,
onTransferControlBackClick: () -> Unit
) {
if (state.isResetWalletConfirmationVisible) {
ResetWalletDialog(
onConfirm = onResetWalletConfirmClick,
onDeny = onResetWalletDenyClick
)
}

Column(
modifier = modifier,
horizontalAlignment = Alignment.CenterHorizontally
Expand Down Expand Up @@ -122,12 +136,12 @@ fun ClaimedByAnotherDeviceContent(
}

Spacer(Modifier.weight(0.5f))
RadixPrimaryButton(
WarningButton(
modifier = Modifier
.fillMaxWidth()
.padding(horizontal = RadixTheme.dimensions.paddingDefault),
text = stringResource(id = R.string.configurationBackup_automated_walletTransferredClearButton),
onClick = onClearWalletClick
text = stringResource(id = R.string.factoryReset_resetWallet),
onClick = onResetWalletClick
)
Spacer(modifier = Modifier.height(RadixTheme.dimensions.paddingSmall))
RadixTextButton(
Expand All @@ -148,7 +162,10 @@ fun ClaimedByAnotherDeviceContent(
fun ClaimedByAnotherDeviceScreenPreview() {
RadixWalletPreviewTheme {
ClaimedByAnotherDeviceContent(
onClearWalletClick = {},
state = ClaimedByAnotherDeviceViewModel.State(),
onResetWalletClick = {},
onResetWalletConfirmClick = {},
onResetWalletDenyClick = {},
onTransferControlBackClick = {}
)
}
Expand Down
Loading

0 comments on commit a5d274f

Please sign in to comment.