@Suppress("ProduceStateDoesNotAssignValue") until we figure out what's wrong with this lint.

This commit is contained in:
Vitor Pamplona 2024-09-26 11:36:52 -04:00
parent 35aeeb571c
commit 824cb4e5f1
13 changed files with 19 additions and 5 deletions

View File

@ -85,6 +85,7 @@ fun CashuPreview(
cashutoken: String,
accountViewModel: AccountViewModel,
) {
@Suppress("ProduceStateDoesNotAssignValue")
val cashuData by produceState(
initialValue = CachedCashuProcessor.cached(cashutoken),
key1 = cashutoken,

View File

@ -69,13 +69,12 @@ fun LoadValueFromInvoice(
lnbcWord: String,
inner: @Composable (invoiceAmount: InvoiceAmount?) -> Unit,
) {
@Suppress("ProduceStateDoesNotAssignValue")
val lnInvoice by
produceState(initialValue = CachedLnInvoiceParser.cached(lnbcWord), key1 = lnbcWord) {
withContext(Dispatchers.IO) {
val newLnInvoice = CachedLnInvoiceParser.parse(lnbcWord)
if (value != newLnInvoice) {
value = newLnInvoice
}
val newLnInvoice = withContext(Dispatchers.Default) { CachedLnInvoiceParser.parse(lnbcWord) }
if (value != newLnInvoice) {
value = newLnInvoice
}
}

View File

@ -41,6 +41,7 @@ fun LoadUrlPreview(
if (!accountViewModel.settings.showUrlPreview.value) {
ClickableUrl(urlText, url)
} else {
@Suppress("ProduceStateDoesNotAssignValue")
val urlPreviewState by
produceState(
initialValue = UrlCachedPreviewer.cache.get(url) ?: UrlPreviewState.Loading,

View File

@ -81,6 +81,7 @@ fun AccountSwitchBottomSheet(
accountViewModel: AccountViewModel,
accountStateViewModel: AccountStateViewModel,
) {
@Suppress("ProduceStateDoesNotAssignValue")
val accounts by
produceState(initialValue = LocalPreferences.cachedAccounts()) {
if (value == null) {

View File

@ -73,6 +73,7 @@ fun LoadDecryptedContentOrNull(
accountViewModel: AccountViewModel,
inner: @Composable (String?) -> Unit,
) {
@Suppress("ProduceStateDoesNotAssignValue")
val decryptedContent by
produceState(initialValue = accountViewModel.cachedDecrypt(note), key1 = note.event?.id()) {
accountViewModel.decrypt(note) {

View File

@ -229,6 +229,7 @@ fun DecryptAndRenderZapGallery(
accountViewModel: AccountViewModel,
nav: INav,
) {
@Suppress("ProduceStateDoesNotAssignValue")
val zapEvents by
produceState(initialValue = accountViewModel.cachedDecryptAmountMessageInGroup(multiSetCard.zapEvents)) {
accountViewModel.decryptAmountMessageInGroup(multiSetCard.zapEvents) { value = it }

View File

@ -892,6 +892,7 @@ fun ObserveLikeIcon(
) {
val reactionsState by baseNote.live().reactions.observeAsState()
@Suppress("ProduceStateDoesNotAssignValue")
val reactionType by
produceState(initialValue = null as String?, key1 = reactionsState) {
val newReactionType = accountViewModel.loadReactionTo(reactionsState?.note)
@ -1226,6 +1227,7 @@ fun ObserveZapAmountText(
val zapsState by baseNote.live().zaps.observeAsState()
if (zapsState?.note?.zapPayments?.isNotEmpty() == true) {
@Suppress("ProduceStateDoesNotAssignValue")
val zapAmountTxt by
produceState(initialValue = showAmount(baseNote.zapsAmount), key1 = zapsState) {
zapsState?.note?.let {

View File

@ -122,6 +122,7 @@ fun RenderRelay(
accountViewModel: AccountViewModel,
nav: INav,
) {
@Suppress("ProduceStateDoesNotAssignValue")
val relayInfo by
produceState(
initialValue = Nip11CachedRetriever.getFromCache(relay.url),

View File

@ -57,6 +57,7 @@ fun DisplayUncitedHashtags(
callbackUri: String? = null,
nav: INav,
) {
@Suppress("ProduceStateDoesNotAssignValue")
val unusedHashtags by
produceState(initialValue = emptyList<String>()) {
val tagsInEvent = event.hashtags()

View File

@ -87,6 +87,7 @@ fun RenderFhirResource(
@Composable
fun RenderFhirResource(event: FhirResourceEvent) {
@Suppress("ProduceStateDoesNotAssignValue")
val state by produceState(initialValue = FhirElementDatabase(), key1 = event) {
withContext(Dispatchers.Default) {
parseResourceBundleOrNull(event.content)?.let {

View File

@ -532,6 +532,7 @@ private fun RenderReply(
onWantsToEditDraft: (Note) -> Unit,
) {
Row(verticalAlignment = Alignment.CenterVertically) {
@Suppress("ProduceStateDoesNotAssignValue")
val replyTo =
produceState(initialValue = note.replyTo?.lastOrNull()) {
accountViewModel.unwrapIfNeeded(value) {

View File

@ -30,6 +30,7 @@ fun <K, V> produceCachedStateAsync(
cache: AsyncCachedState<K, V>,
key: K,
): State<V?> =
@Suppress("ProduceStateDoesNotAssignValue")
produceState(initialValue = cache.cached(key), key1 = key) {
cache.update(key) {
value = it
@ -42,6 +43,7 @@ fun <K, V> produceCachedStateAsync(
key: String,
updateValue: K,
): State<V?> =
@Suppress("ProduceStateDoesNotAssignValue")
produceState(initialValue = cache.cached(updateValue), key1 = key) {
cache.update(updateValue) {
value = it

View File

@ -30,6 +30,7 @@ fun <K, V> produceCachedState(
cache: CachedState<K, V>,
key: K,
): State<V?> =
@Suppress("ProduceStateDoesNotAssignValue")
produceState(initialValue = cache.cached(key), key1 = key) {
val newValue = cache.update(key)
if (value != newValue) {
@ -43,6 +44,7 @@ fun <K, V> produceCachedState(
key: String,
updateValue: K,
): State<V?> =
@Suppress("ProduceStateDoesNotAssignValue")
produceState(initialValue = cache.cached(updateValue), key1 = key) {
val newValue = cache.update(updateValue)
if (value != newValue) {