refactor: migrate to kotlinx serialization, eliminate gson dependency
This commit is contained in:
+3
-3
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user