Skip to content

Commit

Permalink
refine logs
Browse files Browse the repository at this point in the history
  • Loading branch information
roeierez committed Mar 28, 2024
1 parent ae5c456 commit fd219cc
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class RedeemSwapJob(
logger.log(TAG, "Received swap updated event: ${swapInfo.bitcoinAddress} current address: ${address} status: ${swapInfo.status}", "TRACE")
if (swapInfo.bitcoinAddress == address) {
if (swapInfo.paidMsat.toLong() > 0) {
notifySuccessAndShutdown()
notifySuccessAndShutdown(address)
}
}
}
Expand All @@ -60,8 +60,8 @@ class RedeemSwapJob(
}
}

private fun notifySuccessAndShutdown() {
logger.log(TAG, "Swap address redeemed succesfully", "INFO")
private fun notifySuccessAndShutdown(address: String) {
logger.log(TAG, "Swap address ${address} redeemed succesfully", "INFO")
notifyChannel(
context,
NOTIFICATION_CHANNEL_SWAP_TX_CONFIRMED,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import UserNotifications
import Foundation
import BreezSDK

struct AddressTxsConfirmedRequest: Codable {
let address: String
Expand Down Expand Up @@ -29,6 +28,7 @@ class RedeemSwapTask : TaskProtocol {
self.logger.log(tag: TAG, line: "Received swap updated event: \(swapInfo.bitcoinAddress), current address: \(address) status: \(swapInfo.status)\n", level: "INFO")
if address == swapInfo.bitcoinAddress {
if (swapInfo.paidMsat > 0) {
self.logger.log(tag: TAG, line: "Swap address \(swapInfo.bitcoinAddress) redeemed succesfully", level: "INFO")
let successRedeemSwap = ResourceHelper.shared.getString(key: Constants.SWAP_TX_CONFIRMED_NOTIFICATION_TITLE, fallback: Constants.DEFAULT_SWAP_TX_CONFIRMED_NOTIFICATION_TITLE)
self.displayPushNotification(title: successRedeemSwap, logger: self.logger, threadIdentifier: Constants.NOTIFICATION_THREAD_SWAP_TX_CONFIRMED)
}
Expand All @@ -53,6 +53,7 @@ class RedeemSwapTask : TaskProtocol {
guard let address = swapAddress else {
self.logger.log(tag: TAG, line: "Failed to process swap notification: swap address not in payload", level: "ERROR")
self.onShutdown()
return
}

do {
Expand Down

0 comments on commit fd219cc

Please sign in to comment.