add a button to cashu preview to redeem on external wallet, additional to melting to ln

This commit is contained in:
Believethehype 2023-12-03 15:02:22 +01:00
parent 7cd09261de
commit 6c3abe17ed
2 changed files with 24 additions and 2 deletions

View File

@ -178,12 +178,32 @@ fun CashuPreview(token: CashuToken, accountViewModel: AccountViewModel) {
Spacer(modifier = StdHorzSpacer)
Text(
stringResource(R.string.cashu_redeem),
"",
color = Color.White,
fontSize = 18.sp
fontSize = 16.sp
)
}
Spacer(modifier = StdHorzSpacer)
Button(
onClick = {
try {
val intent = Intent(Intent.ACTION_VIEW, Uri.parse("cashu://$token"))
intent.flags = Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TASK
startActivity(context, intent, null)
} catch (e: Exception) {
accountViewModel.toast("Cashu", context.getString(R.string.cashu_no_wallet_found))
}
},
shape = QuoteBorder,
colors = ButtonDefaults.buttonColors(
containerColor = MaterialTheme.colorScheme.primary
)
) {
Spacer(modifier = StdHorzSpacer)
Text("\uD83E\uDD5C", color = Color.White, fontSize = 16.sp)
}
Spacer(modifier = StdHorzSpacer)
Button(
@ -205,6 +225,7 @@ fun CashuPreview(token: CashuToken, accountViewModel: AccountViewModel) {
) {
Text("", color = Color.White, fontSize = 18.sp)
}
Spacer(modifier = StdHorzSpacer)
}
}
}

View File

@ -629,6 +629,7 @@
<string name="cashu_sucessful_redemption">Cashu Received</string>
<string name="cashu_sucessful_redemption_explainer">%1$s sats were sent to your wallet. (Fees: %2$s sats)</string>
<string name="cashu_no_wallet_found">No compatible Cashu wallet found on system</string>
<string name="error_unable_to_fetch_invoice">Unable to fetch invoice from receiver\'s servers</string>