refactor: move logs to timber
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
package com.bitcointxoko.gudariwallet.ui
|
||||
|
||||
import android.util.Log
|
||||
import timber.log.Timber
|
||||
import androidx.lifecycle.ViewModel
|
||||
import androidx.lifecycle.viewModelScope
|
||||
import com.bitcointxoko.gudariwallet.api.LnurlScanResponse
|
||||
@@ -144,21 +144,21 @@ class WalletViewModel(
|
||||
// via SharingStarted.Eagerly — this coroutine only does the network refresh.
|
||||
viewModelScope.launch {
|
||||
if (!lnAddressStore.isCacheStale()) {
|
||||
Log.d(TAG, "LNADDR [TTL ] cache is fresh — skipping network fetch")
|
||||
Timber.d("LNADDR [TTL ] cache is fresh — skipping network fetch")
|
||||
return@launch
|
||||
}
|
||||
runCatching { repo.getLightningAddress() }
|
||||
.onSuccess { address ->
|
||||
if (address != null) {
|
||||
Log.d(TAG, "LNADDR [FETCH OK ] fetched from API: \"$address\" — updating cache")
|
||||
Timber.d("LNADDR [FETCH OK ] fetched from API: \"$address\" — updating cache")
|
||||
lnAddressStore.setLightningAddress(address)
|
||||
// StateFlow updates automatically via the DataStore flow
|
||||
} else {
|
||||
Log.d(TAG, "LNADDR [FETCH OK ] fetched from API: no pay link / username configured")
|
||||
Timber.d("LNADDR [FETCH OK ] fetched from API: no pay link / username configured")
|
||||
}
|
||||
}
|
||||
.onFailure { e ->
|
||||
Log.w(TAG, "LNADDR [FETCH ERR] API call failed (${e.message}) — falling back to cached value")
|
||||
Timber.w("LNADDR [FETCH ERR] API call failed (${e.message}) — falling back to cached value")
|
||||
// Nothing to do — DataStore flow already holds the last good value
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user