feat: notifications localisation
This commit is contained in:
@@ -14,7 +14,6 @@ import com.bitcointxoko.gudariwallet.R
|
||||
object NotificationHelper {
|
||||
|
||||
// ── Intent extra key — read by MainActivity ───────────────────────────────
|
||||
// Public so MainActivity can reference it without a magic string.
|
||||
const val EXTRA_PAYMENT_HASH = "extra_payment_hash"
|
||||
|
||||
// ── Channel setup ─────────────────────────────────────────────────────────
|
||||
@@ -25,10 +24,10 @@ object NotificationHelper {
|
||||
nm.createNotificationChannel(
|
||||
NotificationChannel(
|
||||
NotificationConstants.CHANNEL_PAYMENTS,
|
||||
"Payments",
|
||||
context.getString(R.string.notif_channel_payments_name),
|
||||
NotificationManager.IMPORTANCE_HIGH
|
||||
).apply {
|
||||
description = "Incoming and outgoing Lightning payment alerts"
|
||||
description = context.getString(R.string.notif_channel_payments_desc)
|
||||
enableVibration(true)
|
||||
enableLights(true)
|
||||
}
|
||||
@@ -37,10 +36,10 @@ object NotificationHelper {
|
||||
nm.createNotificationChannel(
|
||||
NotificationChannel(
|
||||
NotificationConstants.CHANNEL_SERVICE_STATUS,
|
||||
"Wallet Monitor",
|
||||
context.getString(R.string.notif_channel_service_name),
|
||||
NotificationManager.IMPORTANCE_LOW
|
||||
).apply {
|
||||
description = "Background service monitoring for incoming payments"
|
||||
description = context.getString(R.string.notif_channel_service_desc)
|
||||
setShowBadge(false)
|
||||
enableVibration(false)
|
||||
setSound(null, null)
|
||||
@@ -56,8 +55,9 @@ object NotificationHelper {
|
||||
* screen for [paymentHash].
|
||||
*/
|
||||
fun notifyPaymentReceived(context: Context, amountSats: Long, memo: String?, paymentHash: String) {
|
||||
val title = "Payment received · +$amountSats sats"
|
||||
val text = if (!memo.isNullOrBlank()) memo else "No memo"
|
||||
val title = context.getString(R.string.notif_payment_received_title, amountSats)
|
||||
val text = if (!memo.isNullOrBlank()) memo
|
||||
else context.getString(R.string.notif_payment_received_no_memo)
|
||||
|
||||
val notification = NotificationCompat.Builder(context, NotificationConstants.CHANNEL_PAYMENTS)
|
||||
.setSmallIcon(R.drawable.ic_notification)
|
||||
@@ -70,7 +70,7 @@ object NotificationHelper {
|
||||
.setStyle(
|
||||
NotificationCompat.BigTextStyle()
|
||||
.bigText(text)
|
||||
.setSummaryText("+$amountSats sats")
|
||||
.setSummaryText(context.getString(R.string.notif_payment_received_summary, amountSats))
|
||||
)
|
||||
.build()
|
||||
|
||||
@@ -83,8 +83,8 @@ object NotificationHelper {
|
||||
* screen for [paymentHash].
|
||||
*/
|
||||
fun notifyPaymentSent(context: Context, amountSats: Long, paymentHash: String) {
|
||||
val title = "Payment sent"
|
||||
val text = "−$amountSats sats"
|
||||
val title = context.getString(R.string.notif_payment_sent_title)
|
||||
val text = context.getString(R.string.notif_payment_sent_text, amountSats)
|
||||
notify(
|
||||
context,
|
||||
NotificationConstants.NOTIF_ID_PAYMENT_SENT,
|
||||
@@ -97,8 +97,8 @@ object NotificationHelper {
|
||||
fun buildServiceNotification(context: Context): Notification {
|
||||
return NotificationCompat.Builder(context, NotificationConstants.CHANNEL_SERVICE_STATUS)
|
||||
.setSmallIcon(R.drawable.ic_notification)
|
||||
.setContentTitle("Gudari Wallet")
|
||||
.setContentText("Monitoring for incoming payments")
|
||||
.setContentTitle(context.getString(R.string.notif_service_title))
|
||||
.setContentText(context.getString(R.string.notif_service_text))
|
||||
.setOngoing(true)
|
||||
.setSilent(true)
|
||||
.setShowWhen(false)
|
||||
@@ -117,9 +117,9 @@ object NotificationHelper {
|
||||
// ── Private helpers ───────────────────────────────────────────────────────
|
||||
|
||||
private fun buildPaymentNotification(
|
||||
context: Context,
|
||||
title: String,
|
||||
text: String,
|
||||
context : Context,
|
||||
title : String,
|
||||
text : String,
|
||||
paymentHash: String
|
||||
): Notification {
|
||||
return NotificationCompat.Builder(context, NotificationConstants.CHANNEL_PAYMENTS)
|
||||
|
||||
Reference in New Issue
Block a user