fix: tapping on sync completed notification navigates to history

This commit is contained in:
2026-06-07 18:06:28 +02:00
parent 3b14f2fba9
commit 2574a6e1e6
6 changed files with 134 additions and 22 deletions
@@ -38,6 +38,7 @@ import androidx.compose.runtime.collectAsState
import androidx.compose.runtime.getValue
import cafe.adriel.lyricist.ProvideStrings
import com.bitcointxoko.gudariwallet.data.HistoricalSyncStore
import com.bitcointxoko.gudariwallet.util.NotificationConstants
class MainActivity : AppCompatActivity() {
@@ -70,6 +71,7 @@ class MainActivity : AppCompatActivity() {
// WalletScreen observes this and navigates to the detail screen.
// MutableState so Compose recomposes when it changes.
private val pendingPaymentHash = mutableStateOf<String?>(null)
val pendingNavigateToHistory = mutableStateOf(false)
// Holds a payment URI that arrived via deep link / intent (BTCPay, external apps).
private val pendingPaymentUri = mutableStateOf<String?>(null)
@@ -102,6 +104,10 @@ class MainActivity : AppCompatActivity() {
// Read hash from the intent that launched the activity (cold start from notification)
pendingPaymentHash.value =
intent.getStringExtra(NotificationHelper.EXTRA_PAYMENT_HASH)
if (intent.getBooleanExtra(NotificationConstants.NAVIGATE_TO_HISTORY, false)) {
pendingNavigateToHistory.value = true
}
// Read payment URI from the intent that launched the activity (cold start from deep link)
pendingPaymentUri.value = IntentUtils.extractPaymentUri(intent)
@@ -132,6 +138,7 @@ class MainActivity : AppCompatActivity() {
vm = vm,
nfcVm = nfcVm,
pendingPaymentHash = pendingPaymentHash,
pendingNavigateToHistory = pendingNavigateToHistory,
pendingPaymentUri = pendingPaymentUri,
lyricist = lyricist
)
@@ -187,6 +194,10 @@ class MainActivity : AppCompatActivity() {
pendingPaymentHash.value = hash
}
if (intent.getBooleanExtra(NotificationConstants.NAVIGATE_TO_HISTORY, false)) {
pendingNavigateToHistory.value = true
}
// Deep link / external app URI
val uri = IntentUtils.extractPaymentUri(intent)
if (uri != null) {