Skip to content

Commit

Permalink
Hint message when ergoauth request scanned from send funds
Browse files Browse the repository at this point in the history
  • Loading branch information
MrStahlfelge committed Jun 7, 2023
1 parent baf67d7 commit 992e3ce
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 5 deletions.
2 changes: 2 additions & 0 deletions android/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@
<string name="hint_readonly_signing_request">You scanned a signing request, but the wallet is
set up as read only. Please restore with your mnemonic.</string>
<string name="error_qr_code_content_unknown">The scanned QR code was not of a known format.</string>
<string name="hint_auth_request">It looks like you scanned an auth request, but this is for sending funds.
Please scan auth requests from the main screen or wallet details screen.</string>

<!-- add wallet -->
<string name="menu_add_wallet">Add wallet</string>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,7 @@ const val STRING_GENERIC_ERROR_USER_CANCELED = "generic_error_user_canceled"
const val STRING_HIDE_BOTTOM_VIEW_ON_SCROLL_BEHAVIOR = "hide_bottom_view_on_scroll_behavior"
const val STRING_HINT_AMOUNT_CURRENCY = "hint_amount_currency"
const val STRING_HINT_APP_URL = "hint_app_url"
const val STRING_HINT_AUTH_REQUEST = "hint_auth_request"
const val STRING_HINT_DESKTOP_KYA = "hint_desktop_kya"
const val STRING_HINT_NO_WEBCAM = "hint_no_webcam"
const val STRING_HINT_PASSWORD = "hint_password"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import org.ergoplatform.*
import org.ergoplatform.appkit.Address
import org.ergoplatform.appkit.ErgoToken
import org.ergoplatform.appkit.Parameters
import org.ergoplatform.ergoauth.isErgoAuthRequestUri
import org.ergoplatform.persistance.IAppDatabase
import org.ergoplatform.persistance.PreferencesProvider
import org.ergoplatform.persistance.TokenInformation
Expand Down Expand Up @@ -514,18 +515,20 @@ abstract class SendFundsUiLogic : SubmitTransactionUiLogic(), FilterTokenListUiL
)
} else {
val content = parsePaymentRequest(qrCodeData)
content?.let {
if (content != null) {
setPaymentRequestDataToUi.invoke(
content.address,
content.amount.let { amount -> if (amount.nanoErgs > 0) amount else null },
if (content.description.isNotBlank()) content.description else null
)
addTokensFromPaymentRequest(content.tokens)
} ?: showErrorMessage(
stringProvider.getString(
STRING_ERROR_QR_CODE_CONTENT_UNKNOWN
} else if (isErgoAuthRequestChunk(qrCodeData) || isErgoAuthRequestUri(qrCodeData)) {
showErrorMessage(stringProvider.getString(STRING_HINT_AUTH_REQUEST))
} else {
showErrorMessage(
stringProvider.getString(STRING_ERROR_QR_CODE_CONTENT_UNKNOWN)
)
)
}
}
}

Expand Down
2 changes: 2 additions & 0 deletions ios/resources/i18n/strings.properties
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,8 @@ generic_error_user_canceled=Authentication canceled by user.
hide_bottom_view_on_scroll_behavior=com.google.android.material.behavior.HideBottomViewOnScrollBehavior
hint_amount_currency=Amount ({0})
hint_app_url=App URL
hint_auth_request=It looks like you scanned an auth request, but this is for sending funds. \
Please scan auth requests from the main screen or wallet details screen.
hint_desktop_kya=Please read and understand our <a href="https://github.com/ergoplatform/ergo-wallet-app/blob/develop/desktop/RUN.md#know-your-assumptions">KYA \
regarding storing your secrets</a>. For best security, use a <a href="https://github.com/ergoplatform/ergo-wallet-app/wiki/Cold-wallet">cold wallet</a>. \
Expand Down

0 comments on commit 992e3ce

Please sign in to comment.