Skip to content

Commit 9289b4d

Browse files
committed
fix: holding tags in a variable to prevent cleaning in reset method
1 parent cc10033 commit 9289b4d

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

app/src/main/java/to/bitkit/viewmodels/AppViewModel.kt

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -501,7 +501,9 @@ class AppViewModel @Inject constructor(
501501
}
502502

503503
private fun attachTagsToActivity(paymentHashOrTxId: String?, type: ActivityFilter) {
504-
if (_sendUiState.value.selectedTags.isEmpty()) {
504+
val tags = _sendUiState.value.selectedTags
505+
Logger.debug("attachTagsToActivity $tags")
506+
if (tags.isEmpty()) {
505507
Logger.debug("selectedTags empty")
506508
return
507509
}
@@ -524,8 +526,10 @@ class AppViewModel @Inject constructor(
524526
if (paymentHashOrTxId == activity.v1.id) {
525527
coreService.activity.appendTags(
526528
toActivityId = activity.v1.id,
527-
tags = _sendUiState.value.selectedTags
528-
)
529+
tags = tags
530+
).onFailure {
531+
Logger.error("Error attaching tags $tags")
532+
}
529533
} else {
530534
Logger.error("Different activity id. Expected: $paymentHashOrTxId found: ${activity.v1.id}")
531535
}
@@ -535,7 +539,7 @@ class AppViewModel @Inject constructor(
535539
if (paymentHashOrTxId == activity.v1.txId) {
536540
coreService.activity.appendTags(
537541
toActivityId = activity.v1.id,
538-
tags = _sendUiState.value.selectedTags
542+
tags = tags
539543
)
540544
} else {
541545
Logger.error("Different txId. Expected: $paymentHashOrTxId found: ${activity.v1.txId}")

0 commit comments

Comments
 (0)