add a button to cashu preview to redeem on external wallet, additional to melting to ln
This commit is contained in:
@@ -178,12 +178,32 @@ fun CashuPreview(token: CashuToken, accountViewModel: AccountViewModel) {
|
|||||||
Spacer(modifier = StdHorzSpacer)
|
Spacer(modifier = StdHorzSpacer)
|
||||||
|
|
||||||
Text(
|
Text(
|
||||||
stringResource(R.string.cashu_redeem),
|
"⚡",
|
||||||
color = Color.White,
|
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)
|
Spacer(modifier = StdHorzSpacer)
|
||||||
|
|
||||||
Button(
|
Button(
|
||||||
@@ -205,6 +225,7 @@ fun CashuPreview(token: CashuToken, accountViewModel: AccountViewModel) {
|
|||||||
) {
|
) {
|
||||||
Text("⎘", color = Color.White, fontSize = 18.sp)
|
Text("⎘", color = Color.White, fontSize = 18.sp)
|
||||||
}
|
}
|
||||||
|
Spacer(modifier = StdHorzSpacer)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -629,6 +629,7 @@
|
|||||||
|
|
||||||
<string name="cashu_sucessful_redemption">Cashu Received</string>
|
<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_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>
|
<string name="error_unable_to_fetch_invoice">Unable to fetch invoice from receiver\'s servers</string>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user