diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/actions/NewMediaView.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/actions/NewMediaView.kt index 28df2df0f..a6576355e 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/actions/NewMediaView.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/actions/NewMediaView.kt @@ -49,6 +49,7 @@ import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.runtime.LaunchedEffect import androidx.compose.runtime.getValue +import androidx.compose.runtime.livedata.observeAsState import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.remember import androidx.compose.runtime.setValue @@ -71,6 +72,7 @@ import com.vitorpamplona.amethyst.ui.screen.loggedIn.TextSpinner import com.vitorpamplona.amethyst.ui.screen.loggedIn.TitleExplainer import com.vitorpamplona.amethyst.ui.stringRes import com.vitorpamplona.amethyst.ui.theme.placeholderText +import com.vitorpamplona.quartz.events.FileServersEvent import kotlinx.collections.immutable.toImmutableList import kotlinx.coroutines.CancellationException import kotlinx.coroutines.Dispatchers @@ -189,8 +191,25 @@ fun ImageVideoPost( postViewModel: NewMediaModel, accountViewModel: AccountViewModel, ) { + val listOfNip96ServersNote = + accountViewModel.account + .getFileServersNote() + .live() + .metadata + .observeAsState() + val fileServers = - Nip96MediaServers.DEFAULT.map { ServerOption(it, false) } + + ( + (listOfNip96ServersNote.value?.note?.event as? FileServersEvent)?.servers()?.map { + ServerOption( + Nip96MediaServers.ServerName( + it, + it, + ), + false, + ) + } ?: Nip96MediaServers.DEFAULT.map { ServerOption(it, false) } + ) + listOf( ServerOption( Nip96MediaServers.ServerName( diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/actions/NewPostView.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/actions/NewPostView.kt index b8f4019b9..ad69a8bec 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/actions/NewPostView.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/actions/NewPostView.kt @@ -168,6 +168,7 @@ import com.vitorpamplona.amethyst.ui.theme.placeholderText import com.vitorpamplona.amethyst.ui.theme.replyModifier import com.vitorpamplona.amethyst.ui.theme.subtleBorder import com.vitorpamplona.quartz.events.ClassifiedsEvent +import com.vitorpamplona.quartz.events.FileServersEvent import kotlinx.collections.immutable.ImmutableList import kotlinx.collections.immutable.toImmutableList import kotlinx.coroutines.CancellationException @@ -1620,8 +1621,25 @@ fun ImageVideoDescription( val isImage = mediaType.startsWith("image") val isVideo = mediaType.startsWith("video") + val listOfNip96ServersNote = + accountViewModel.account + .getFileServersNote() + .live() + .metadata + .observeAsState() + val fileServers = - Nip96MediaServers.DEFAULT.map { ServerOption(it, false) } + + ( + (listOfNip96ServersNote.value?.note?.event as? FileServersEvent)?.servers()?.map { + ServerOption( + Nip96MediaServers.ServerName( + it, + it, + ), + false, + ) + } ?: Nip96MediaServers.DEFAULT.map { ServerOption(it, false) } + ) + listOf( ServerOption( Nip96MediaServers.ServerName(