refactor: migrate to kotlinx serialization, eliminate gson dependency

This commit is contained in:
2026-06-10 23:06:11 +02:00
parent d1c3722781
commit e242c7b5d0
15 changed files with 326 additions and 262 deletions
@@ -7,7 +7,7 @@ import android.content.pm.ServiceInfo
import android.os.Build
import android.os.IBinder
import timber.log.Timber
import com.bitcointxoko.gudariwallet.api.GsonProvider
import com.bitcointxoko.gudariwallet.api.JsonProvider
import com.bitcointxoko.gudariwallet.api.LNbitsClient
import com.bitcointxoko.gudariwallet.api.PaymentRecord
import com.bitcointxoko.gudariwallet.api.WsPaymentMessage
@@ -98,7 +98,7 @@ class WalletNotificationService : Service() {
private var reconnectAttempts = 0
private var currentBackoffMs = WalletConstants.WS_INITIAL_BACKOFF_MS
private val gson = GsonProvider.gson
private val json = JsonProvider.json
// ── Lifecycle ─────────────────────────────────────────────────────────────
override fun onStartCommand(intent: Intent?, flags: Int, startId: Int): Int {
@@ -193,7 +193,7 @@ class WalletNotificationService : Service() {
private fun handleMessage(text: String) {
val msg = runCatching {
gson.fromJson(text, WsPaymentMessage::class.java)
json.decodeFromString(WsPaymentMessage.serializer(), text)
}.getOrNull() ?: return
val payment = msg.payment ?: return