Fix: Long running tasks cause crash if notification channel is not created.

This commit is contained in:
minibits-cash
2025-02-13 17:46:32 +01:00
parent 563da1b786
commit df736d7eb0
3 changed files with 13 additions and 3 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "minibits_wallet",
"version": "0.2.0-beta.7",
"version": "0.2.0-beta.8",
"private": true,
"scripts": {
"android:clean": "cd android && ./gradlew clean",
+5 -1
View File
@@ -40,7 +40,11 @@ export const sendTask = async function (
const mintUrl = mintBalanceToSendFrom.mintUrl
log.trace('[sendTask]', 'mintBalanceToSendFrom', mintBalanceToSendFrom)
log.trace('[sendTask]', 'amountToSend', {amountToSend, unit})
log.trace('[sendTask]', 'amountToSend', {amountToSend, unit})
if(amountToSend <= 0) {
throw new AppError(Err.VALIDATION_ERROR, 'Amount to send must be above zero.')
}
// create draft transaction
const transactionData: TransactionData[] = [
+7 -1
View File
@@ -420,6 +420,11 @@ const swapAllTask = async function (): Promise<WalletTaskResult> {
for (const unit of mint.units) {
const proofsToOptimize = proofsStore.getByMint(mint.mintUrl, { isPending: false, unit, ascending: true })
if(proofsToOptimize.length === 0) {
continue
}
initialProofsCount += proofsToOptimize.length
const mintBalance = mint.balances
@@ -459,7 +464,8 @@ const swapAllTask = async function (): Promise<WalletTaskResult> {
}
} else {
// If the length is less than or equal to limit, run with all proofs.
const proofsAmount = CashuUtils.getProofsAmount(proofsToOptimize)
const proofsAmount = CashuUtils.getProofsAmount(proofsToOptimize)
const sendResult = await sendTask(
mintBalance!,
proofsAmount,