WIP: Fix the spend URL derp
This commit is contained in:
@@ -847,6 +847,7 @@ fun GajuRouter(
|
||||
|
||||
QRReceiveScreen(
|
||||
account = activeAccount,
|
||||
networkId = activeWallet.networkId,
|
||||
balanceFormat = GajuFormat.Type.valueOf(appState.balanceFormat),
|
||||
balanceUnit = GajuFormat.Unit.valueOf(appState.balanceUnit),
|
||||
onDone = { navigateBack() },
|
||||
|
||||
@@ -57,6 +57,7 @@ import java.net.URLEncoder
|
||||
@Composable
|
||||
fun QRReceiveScreen(
|
||||
account: swiss.qpq.gajumobile.data.models.Account,
|
||||
networkId: String,
|
||||
balanceFormat: GajuFormat.Type,
|
||||
balanceUnit: GajuFormat.Unit,
|
||||
onDone: () -> Unit,
|
||||
@@ -80,14 +81,24 @@ fun QRReceiveScreen(
|
||||
GajuFormat.amount(GajuFormat.standardSpec(balanceFormat, balanceUnit), amountPucks)
|
||||
}
|
||||
|
||||
val generatedUrl = remember(amountPucks, payload, account.gajuId) {
|
||||
val generatedUrl = remember(amountPucks, payload, account.gajuId, networkId) {
|
||||
try {
|
||||
val baseUrl = "grids://gaju/1/s/${account.gajuId}?a=$amountPucks"
|
||||
val baseUrl = "grids://$networkId/1/s/${account.gajuId}"
|
||||
val queryParams = mutableListOf<String>()
|
||||
|
||||
if (amountPucks > BigInteger.ZERO) {
|
||||
queryParams.add("a=$amountPucks")
|
||||
}
|
||||
|
||||
if (payload.isNotBlank()) {
|
||||
val p = URLEncoder.encode(payload, "UTF-8")
|
||||
"$baseUrl&p=$p"
|
||||
} else {
|
||||
queryParams.add("p=$p")
|
||||
}
|
||||
|
||||
if (queryParams.isEmpty()) {
|
||||
baseUrl
|
||||
} else {
|
||||
baseUrl + "?" + queryParams.joinToString("&")
|
||||
}
|
||||
} catch (_: Exception) {
|
||||
""
|
||||
|
||||
+1
-1
Submodule gm-java updated: 7cd299d250...45c6f9c730
Reference in New Issue
Block a user