Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improved error message on scanning A QR Code Without Internet Connection #1446

Merged
merged 1 commit into from
Dec 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ import kotlinx.serialization.protobuf.ProtoBuf
import timber.log.Timber
import vultisig.keysign.v1.KeysignMessage
import java.math.BigInteger
import java.net.UnknownHostException
import java.util.UUID
import javax.inject.Inject
import kotlin.io.encoding.Base64
Expand All @@ -101,6 +102,7 @@ sealed class JoinKeysignError(val message: UiText) {
data object WrongReShare : JoinKeysignError(R.string.join_keysign_wrong_reshare.asUiText())
data object InvalidQr : JoinKeysignError(R.string.join_keysign_invalid_qr.asUiText())
data object FailedToStart : JoinKeysignError(R.string.join_keysign_failed_to_start.asUiText())
data object FailedConnectToServer : JoinKeysignError(R.string.join_keysign_failed_connect_to_server.asUiText())
}

sealed interface JoinKeysignState {
Expand Down Expand Up @@ -285,6 +287,9 @@ internal class JoinKeysignViewModel @Inject constructor(
} else {
currentState.value = JoinKeysignState.DiscoverService
}
} catch (e: UnknownHostException) {
Timber.d(e, "Failed to resolve request")
currentState.value = JoinKeysignState.Error(JoinKeysignError.FailedConnectToServer)
} catch (e: Exception) {
Timber.d(e, "Failed to parse QR code")
currentState.value = JoinKeysignState.Error(JoinKeysignError.InvalidQr)
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -487,6 +487,7 @@
<string name="swap_screen_invalid_gas_fee_calculation" translatable="false">Gas fee calculation failed</string>
<string name="swap_screen_invalid_quote_calculation" translatable="false">Quote calculation failed</string>
<string name="backup_password_screen_skip" translatable="false">Skip Password</string>
<string name="join_keysign_failed_connect_to_server" translatable="false">Failed connect to server</string>
<string name="backup_password_screen_empty_password" translatable="false">Please use \"Skip Password\" to save without password</string>
<string name="network_connection_lost" translatable="false">Network connection lost. Please check your internet connection</string>
<string name="send_form_polka_reaping_warning" translatable="false">Ensure you leave enough funds to cover the fees. If an account balance falls below 1 DOT (Existential Deposit), the account will be deactivated (reaped) and any remaining funds will be lost. You can reactivate the address with a new deposit larger than the existential deposit at any time. However, this will not recover the lost funds.</string>
Expand Down
Loading