@@ -198,6 +198,7 @@ class AppViewModel @Inject constructor(
198198 NewTransactionSheetDetails (
199199 type = NewTransactionSheetType .LIGHTNING ,
200200 direction = NewTransactionSheetDirection .RECEIVED ,
201+ paymentHashOrTxId = event.paymentHash,
201202 sats = (event.amountMsat / 1000u ).toLong(),
202203 ),
203204 event = event
@@ -241,6 +242,7 @@ class AppViewModel @Inject constructor(
241242 NewTransactionSheetDetails (
242243 type = NewTransactionSheetType .LIGHTNING ,
243244 direction = NewTransactionSheetDirection .SENT ,
245+ paymentHashOrTxId = event.paymentHash,
244246 sats = ((event.feePaidMsat ? : 0u ) / 1000u ).toLong(),
245247 ),
246248 event = event
@@ -937,6 +939,7 @@ class AppViewModel @Inject constructor(
937939 NewTransactionSheetDetails (
938940 type = NewTransactionSheetType .ONCHAIN ,
939941 direction = NewTransactionSheetDirection .SENT ,
942+ paymentHashOrTxId = txId,
940943 sats = amount.toLong(),
941944 )
942945 )
@@ -1028,19 +1031,22 @@ class AppViewModel @Inject constructor(
10281031 }
10291032
10301033 fun onClickActivityDetail () {
1031- val filter = newTransaction.type.toActivityFilter()
1032- val paymentType = newTransaction.direction.toTxType()
1034+ val activityType = newTransaction.type.toActivityFilter()
1035+ val txType = newTransaction.direction.toTxType()
1036+ val paymentHashOrTxId = newTransaction.paymentHashOrTxId ? : return
10331037
10341038 viewModelScope.launch(bgDispatcher) {
1035- val activity = coreService.activity.get(filter = filter, txType = paymentType, limit = 1u ).firstOrNull()
1036-
1037- if (activity == null ) {
1039+ activityRepo.findActivityByPaymentId(
1040+ paymentHashOrTxId = paymentHashOrTxId,
1041+ type = activityType,
1042+ txType = txType,
1043+ retry = true
1044+ ).onSuccess { activity ->
1045+ val nextRoute = Routes .ActivityDetail (activity.rawId())
1046+ mainScreenEffect(MainScreenEffect .Navigate (nextRoute))
1047+ }.onFailure {
10381048 Logger .error(msg = " Activity not found" , context = TAG )
1039- return @launch
10401049 }
1041-
1042- val nextRoute = Routes .ActivityDetail (activity.rawId())
1043- mainScreenEffect(MainScreenEffect .Navigate (nextRoute))
10441050 }
10451051 }
10461052
@@ -1201,9 +1207,10 @@ class AppViewModel @Inject constructor(
12011207
12021208 var newTransaction by mutableStateOf(
12031209 NewTransactionSheetDetails (
1204- NewTransactionSheetType .LIGHTNING ,
1205- NewTransactionSheetDirection .RECEIVED ,
1206- 0
1210+ type = NewTransactionSheetType .LIGHTNING ,
1211+ direction = NewTransactionSheetDirection .RECEIVED ,
1212+ paymentHashOrTxId = null ,
1213+ sats = 0
12071214 )
12081215 )
12091216
0 commit comments