@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
@@ -85,6 +85,7 @@ fun CashuPreview(
cashutoken: String, cashutoken: String,
accountViewModel: AccountViewModel, accountViewModel: AccountViewModel,
) { ) {
@Suppress("ProduceStateDoesNotAssignValue")
val cashuData by produceState( val cashuData by produceState(
initialValue = CachedCashuProcessor.cached(cashutoken), initialValue = CachedCashuProcessor.cached(cashutoken),
key1 = cashutoken, key1 = cashutoken,
@@ -69,13 +69,12 @@ fun LoadValueFromInvoice(
lnbcWord: String, lnbcWord: String,
inner: @Composable (invoiceAmount: InvoiceAmount?) -> Unit, inner: @Composable (invoiceAmount: InvoiceAmount?) -> Unit,
) { ) {
@Suppress("ProduceStateDoesNotAssignValue")
val lnInvoice by val lnInvoice by
produceState(initialValue = CachedLnInvoiceParser.cached(lnbcWord), key1 = lnbcWord) { produceState(initialValue = CachedLnInvoiceParser.cached(lnbcWord), key1 = lnbcWord) {
withContext(Dispatchers.IO) { val newLnInvoice = withContext(Dispatchers.Default) { CachedLnInvoiceParser.parse(lnbcWord) }
val newLnInvoice = CachedLnInvoiceParser.parse(lnbcWord) if (value != newLnInvoice) {
if (value != newLnInvoice) { value = newLnInvoice
value = newLnInvoice
}
} }
} }
@@ -41,6 +41,7 @@ fun LoadUrlPreview(
if (!accountViewModel.settings.showUrlPreview.value) { if (!accountViewModel.settings.showUrlPreview.value) {
ClickableUrl(urlText, url) ClickableUrl(urlText, url)
} else { } else {
@Suppress("ProduceStateDoesNotAssignValue")
val urlPreviewState by val urlPreviewState by
produceState( produceState(
initialValue = UrlCachedPreviewer.cache.get(url) ?: UrlPreviewState.Loading, initialValue = UrlCachedPreviewer.cache.get(url) ?: UrlPreviewState.Loading,
@@ -81,6 +81,7 @@ fun AccountSwitchBottomSheet(
accountViewModel: AccountViewModel, accountViewModel: AccountViewModel,
accountStateViewModel: AccountStateViewModel, accountStateViewModel: AccountStateViewModel,
) { ) {
@Suppress("ProduceStateDoesNotAssignValue")
val accounts by val accounts by
produceState(initialValue = LocalPreferences.cachedAccounts()) { produceState(initialValue = LocalPreferences.cachedAccounts()) {
if (value == null) { if (value == null) {
@@ -73,6 +73,7 @@ fun LoadDecryptedContentOrNull(
accountViewModel: AccountViewModel, accountViewModel: AccountViewModel,
inner: @Composable (String?) -> Unit, inner: @Composable (String?) -> Unit,
) { ) {
@Suppress("ProduceStateDoesNotAssignValue")
val decryptedContent by val decryptedContent by
produceState(initialValue = accountViewModel.cachedDecrypt(note), key1 = note.event?.id()) { produceState(initialValue = accountViewModel.cachedDecrypt(note), key1 = note.event?.id()) {
accountViewModel.decrypt(note) { accountViewModel.decrypt(note) {
@@ -229,6 +229,7 @@ fun DecryptAndRenderZapGallery(
accountViewModel: AccountViewModel, accountViewModel: AccountViewModel,
nav: INav, nav: INav,
) { ) {
@Suppress("ProduceStateDoesNotAssignValue")
val zapEvents by val zapEvents by
produceState(initialValue = accountViewModel.cachedDecryptAmountMessageInGroup(multiSetCard.zapEvents)) { produceState(initialValue = accountViewModel.cachedDecryptAmountMessageInGroup(multiSetCard.zapEvents)) {
accountViewModel.decryptAmountMessageInGroup(multiSetCard.zapEvents) { value = it } accountViewModel.decryptAmountMessageInGroup(multiSetCard.zapEvents) { value = it }
@@ -892,6 +892,7 @@ fun ObserveLikeIcon(
) { ) {
val reactionsState by baseNote.live().reactions.observeAsState() val reactionsState by baseNote.live().reactions.observeAsState()
@Suppress("ProduceStateDoesNotAssignValue")
val reactionType by val reactionType by
produceState(initialValue = null as String?, key1 = reactionsState) { produceState(initialValue = null as String?, key1 = reactionsState) {
val newReactionType = accountViewModel.loadReactionTo(reactionsState?.note) val newReactionType = accountViewModel.loadReactionTo(reactionsState?.note)
@@ -1226,6 +1227,7 @@ fun ObserveZapAmountText(
val zapsState by baseNote.live().zaps.observeAsState() val zapsState by baseNote.live().zaps.observeAsState()
if (zapsState?.note?.zapPayments?.isNotEmpty() == true) { if (zapsState?.note?.zapPayments?.isNotEmpty() == true) {
@Suppress("ProduceStateDoesNotAssignValue")
val zapAmountTxt by val zapAmountTxt by
produceState(initialValue = showAmount(baseNote.zapsAmount), key1 = zapsState) { produceState(initialValue = showAmount(baseNote.zapsAmount), key1 = zapsState) {
zapsState?.note?.let { zapsState?.note?.let {
@@ -122,6 +122,7 @@ fun RenderRelay(
accountViewModel: AccountViewModel, accountViewModel: AccountViewModel,
nav: INav, nav: INav,
) { ) {
@Suppress("ProduceStateDoesNotAssignValue")
val relayInfo by val relayInfo by
produceState( produceState(
initialValue = Nip11CachedRetriever.getFromCache(relay.url), initialValue = Nip11CachedRetriever.getFromCache(relay.url),
@@ -57,6 +57,7 @@ fun DisplayUncitedHashtags(
callbackUri: String? = null, callbackUri: String? = null,
nav: INav, nav: INav,
) { ) {
@Suppress("ProduceStateDoesNotAssignValue")
val unusedHashtags by val unusedHashtags by
produceState(initialValue = emptyList<String>()) { produceState(initialValue = emptyList<String>()) {
val tagsInEvent = event.hashtags() val tagsInEvent = event.hashtags()
@@ -87,6 +87,7 @@ fun RenderFhirResource(
@Composable @Composable
fun RenderFhirResource(event: FhirResourceEvent) { fun RenderFhirResource(event: FhirResourceEvent) {
@Suppress("ProduceStateDoesNotAssignValue")
val state by produceState(initialValue = FhirElementDatabase(), key1 = event) { val state by produceState(initialValue = FhirElementDatabase(), key1 = event) {
withContext(Dispatchers.Default) { withContext(Dispatchers.Default) {
parseResourceBundleOrNull(event.content)?.let { parseResourceBundleOrNull(event.content)?.let {
@@ -532,6 +532,7 @@ private fun RenderReply(
onWantsToEditDraft: (Note) -> Unit, onWantsToEditDraft: (Note) -> Unit,
) { ) {
Row(verticalAlignment = Alignment.CenterVertically) { Row(verticalAlignment = Alignment.CenterVertically) {
@Suppress("ProduceStateDoesNotAssignValue")
val replyTo = val replyTo =
produceState(initialValue = note.replyTo?.lastOrNull()) { produceState(initialValue = note.replyTo?.lastOrNull()) {
accountViewModel.unwrapIfNeeded(value) { accountViewModel.unwrapIfNeeded(value) {
@@ -30,6 +30,7 @@ fun <K, V> produceCachedStateAsync(
cache: AsyncCachedState<K, V>, cache: AsyncCachedState<K, V>,
key: K, key: K,
): State<V?> = ): State<V?> =
@Suppress("ProduceStateDoesNotAssignValue")
produceState(initialValue = cache.cached(key), key1 = key) { produceState(initialValue = cache.cached(key), key1 = key) {
cache.update(key) { cache.update(key) {
value = it value = it
@@ -42,6 +43,7 @@ fun <K, V> produceCachedStateAsync(
key: String, key: String,
updateValue: K, updateValue: K,
): State<V?> = ): State<V?> =
@Suppress("ProduceStateDoesNotAssignValue")
produceState(initialValue = cache.cached(updateValue), key1 = key) { produceState(initialValue = cache.cached(updateValue), key1 = key) {
cache.update(updateValue) { cache.update(updateValue) {
value = it value = it
@@ -30,6 +30,7 @@ fun <K, V> produceCachedState(
cache: CachedState<K, V>, cache: CachedState<K, V>,
key: K, key: K,
): State<V?> = ): State<V?> =
@Suppress("ProduceStateDoesNotAssignValue")
produceState(initialValue = cache.cached(key), key1 = key) { produceState(initialValue = cache.cached(key), key1 = key) {
val newValue = cache.update(key) val newValue = cache.update(key)
if (value != newValue) { if (value != newValue) {
@@ -43,6 +44,7 @@ fun <K, V> produceCachedState(
key: String, key: String,
updateValue: K, updateValue: K,
): State<V?> = ): State<V?> =
@Suppress("ProduceStateDoesNotAssignValue")
produceState(initialValue = cache.cached(updateValue), key1 = key) { produceState(initialValue = cache.cached(updateValue), key1 = key) {
val newValue = cache.update(updateValue) val newValue = cache.update(updateValue)
if (value != newValue) { if (value != newValue) {