Add @OptIns

Change to auto mirrored icons
Remove unnecessary inline
This commit is contained in:
David Kaspar
2025-04-25 15:59:54 +02:00
parent d25e89f41d
commit ad2387f8e9
11 changed files with 20 additions and 12 deletions
@@ -164,7 +164,7 @@ inline fun <T> logTime(
block()
}
inline fun debug(
fun debug(
tag: String,
debugMessage: String,
) {
@@ -181,6 +181,7 @@ import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.DelicateCoroutinesApi
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.FlowPreview
import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.MutableStateFlow
@@ -1086,6 +1087,7 @@ class Account(
)
}
@OptIn(FlowPreview::class)
val decryptBookmarks: Flow<BookmarkListEvent?> by lazy {
userProfile()
.flow()
@@ -24,6 +24,7 @@ import android.app.Application
import android.os.Build
import coil3.ImageLoader
import coil3.SingletonImageLoader
import coil3.annotation.DelicateCoilApi
import coil3.disk.DiskCache
import coil3.gif.AnimatedImageDecoder
import coil3.gif.GifDecoder
@@ -37,6 +38,7 @@ import okhttp3.Call
class ImageLoaderSetup {
companion object {
@OptIn(DelicateCoilApi::class)
fun setup(
app: Application,
diskCache: DiskCache,
@@ -50,7 +50,7 @@ fun observeNote(note: Note): State<NoteState> {
}
@Suppress("UNCHECKED_CAST")
@OptIn(ExperimentalCoroutinesApi::class, FlowPreview::class)
@OptIn(ExperimentalCoroutinesApi::class)
@Composable
fun <T : Event> observeNoteEvent(note: Note): State<T?> {
// Subscribe in the relay for changes in this note.
@@ -68,7 +68,7 @@ fun <T : Event> observeNoteEvent(note: Note): State<T?> {
return flow.collectAsStateWithLifecycle(note.event as? T?)
}
@OptIn(ExperimentalCoroutinesApi::class, FlowPreview::class)
@OptIn(ExperimentalCoroutinesApi::class)
@Composable
fun <T> observeNoteAndMap(
note: Note,
@@ -91,8 +91,8 @@ fun <T> observeNoteAndMap(
return flow.collectAsStateWithLifecycle(map(note))
}
@OptIn(ExperimentalCoroutinesApi::class)
@Suppress("UNCHECKED_CAST")
@OptIn(ExperimentalCoroutinesApi::class, FlowPreview::class)
@Composable
fun <T, U> observeNoteEventAndMap(
note: Note,
@@ -116,7 +116,7 @@ fun <T, U> observeNoteEventAndMap(
return flow.collectAsStateWithLifecycle((note.event as? T)?.let { map(it) })
}
@OptIn(ExperimentalCoroutinesApi::class, FlowPreview::class)
@OptIn(ExperimentalCoroutinesApi::class)
@Composable
fun observeNoteHasEvent(note: Note): State<Boolean> {
// Subscribe in the relay for changes in this note.
@@ -225,7 +225,7 @@ fun observeNoteReposts(note: Note): State<NoteState?> {
.collectAsStateWithLifecycle()
}
@OptIn(ExperimentalCoroutinesApi::class, FlowPreview::class)
@OptIn(ExperimentalCoroutinesApi::class)
@Composable
fun observeNoteRepostsBy(
note: Note,
@@ -565,7 +565,7 @@ data class RelayUsage(
val userRelayList: List<String> = emptyList(),
)
@OptIn(ExperimentalCoroutinesApi::class, FlowPreview::class)
@OptIn(FlowPreview::class)
@Composable
fun observeUserRelaysUsing(user: User): State<RelayUsage> {
// Subscribe in the relay for changes in the metadata of this user.
@@ -32,7 +32,7 @@ import androidx.compose.foundation.layout.width
import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.verticalScroll
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.Logout
import androidx.compose.material.icons.automirrored.filled.Logout
import androidx.compose.material.icons.filled.RadioButtonChecked
import androidx.compose.material3.AlertDialog
import androidx.compose.material3.ExperimentalMaterial3Api
@@ -285,7 +285,7 @@ private fun LogoutButton(
onClick = { logoutDialog = true },
) {
Icon(
imageVector = Icons.Default.Logout,
imageVector = Icons.AutoMirrored.Filled.Logout,
contentDescription = stringRes(R.string.log_out),
tint = MaterialTheme.colorScheme.onSurface,
)
@@ -26,7 +26,6 @@ import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.padding
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.automirrored.filled.OpenInNew
import androidx.compose.material.icons.filled.OpenInNew
import androidx.compose.material3.Icon
import androidx.compose.material3.IconButton
import androidx.compose.material3.LocalTextStyle
@@ -23,6 +23,7 @@ package com.vitorpamplona.amethyst.ui.note.creators.previews
import androidx.compose.ui.text.input.TextFieldValue
import com.vitorpamplona.amethyst.commons.richtext.RichTextParser
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.FlowPreview
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.debounce
import kotlinx.coroutines.flow.distinctUntilChanged
@@ -32,6 +33,7 @@ import kotlinx.coroutines.flow.map
class PreviewState {
var source = MutableStateFlow(TextFieldValue(""))
@OptIn(FlowPreview::class)
val results =
source
.debounce(200)
@@ -52,6 +52,7 @@ class UserSuggestionState(
.map(::userSearchTermOrNull)
.onEach(::updateDataSource)
@OptIn(FlowPreview::class)
val results =
combine(searchTerm, invalidations.debounce(100)) { prefix, version ->
if (prefix != null) {
@@ -21,7 +21,7 @@
package com.vitorpamplona.amethyst.ui.screen.loggedIn.chats.utils
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.Send
import androidx.compose.material.icons.automirrored.filled.Send
import androidx.compose.material3.Icon
import androidx.compose.material3.IconButton
import androidx.compose.runtime.Composable
@@ -42,7 +42,7 @@ fun ThinSendButton(
onClick = onClick,
) {
Icon(
imageVector = Icons.Default.Send,
imageVector = Icons.AutoMirrored.Filled.Send,
contentDescription = stringRes(id = R.string.accessibility_send),
modifier = Size20Modifier,
)
@@ -33,6 +33,7 @@ import com.vitorpamplona.ammolite.relays.BundledUpdate
import com.vitorpamplona.quartz.nip02FollowList.ReadWrite
import com.vitorpamplona.quartz.nip65RelayList.RelayUrlFormatter
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.FlowPreview
import kotlinx.coroutines.Job
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.asStateFlow
@@ -96,6 +97,7 @@ class RelayFeedViewModel :
return (userRelaysBeingUsed + currentUserRelays).sortedWith(order)
}
@OptIn(FlowPreview::class)
fun subscribeTo(user: User) {
if (currentUser != user) {
currentUser = user