Merge branch 'main' into add-ktlint

This commit is contained in:
Vitor Pamplona
2023-03-08 09:08:46 -05:00
committed by GitHub
6 changed files with 219 additions and 4 deletions
@@ -54,7 +54,6 @@ object ServiceManager {
NostrHomeDataSource.stop()
NostrChannelDataSource.stop()
NostrChatroomListDataSource.stop()
NostrUserProfileDataSource.stop()
NostrGlobalDataSource.stop()
NostrSingleChannelDataSource.stop()
@@ -90,7 +90,7 @@ open class Event(
createdAt = jsonObject.get("created_at").asLong,
kind = jsonObject.get("kind").asInt,
tags = jsonObject.get("tags").asJsonArray.map {
it.asJsonArray.map { s -> s.asString }
it.asJsonArray.mapNotNull { s -> if (s.isJsonNull) null else s.asString }
},
content = jsonObject.get("content").asString,
sig = jsonObject.get("sig").asString
@@ -1,5 +1,6 @@
package com.vitorpamplona.amethyst.service.model
import android.util.Log
import com.vitorpamplona.amethyst.model.HexKey
import com.vitorpamplona.amethyst.service.lnurl.LnInvoiceUtil
import com.vitorpamplona.amethyst.service.relays.Client
@@ -36,13 +37,16 @@ class LnZapEvent(
}
// Keeps this as a field because it's a heavier function used everywhere.
val amount = lnInvoice()?.let { LnInvoiceUtil.getAmountInSats(it) }
val amount by lazy {
lnInvoice()?.let { LnInvoiceUtil.getAmountInSats(it) }
}
override fun containedPost(): Event? = try {
description()?.let {
fromJson(it, Client.lenient)
}
} catch (e: Exception) {
Log.e("LnZapEvent", "Failed to Parse Contained Post ${description()}", e)
null
}
@@ -222,7 +222,6 @@ fun ListContent(
accountViewModel: AccountStateViewModel,
account: Account
) {
val coroutineScope = rememberCoroutineScope()
var backupDialogOpen by remember { mutableStateOf(false) }
Column(modifier = modifier.fillMaxHeight()) {