Fixes blocked lists on Videos.
This commit is contained in:
@@ -345,18 +345,22 @@ class Account(
|
|||||||
) { localLive, blockList, muteList ->
|
) { localLive, blockList, muteList ->
|
||||||
checkNotInMainThread()
|
checkNotInMainThread()
|
||||||
|
|
||||||
val resultBlockList = withTimeoutOrNull(1000) {
|
val resultBlockList = (blockList.note.event as? PeopleListEvent)?.let {
|
||||||
suspendCancellableCoroutine { continuation ->
|
withTimeoutOrNull(1000) {
|
||||||
(blockList.note.event as? PeopleListEvent)?.publicAndPrivateUsersAndWords(signer) {
|
suspendCancellableCoroutine { continuation ->
|
||||||
continuation.resume(it)
|
it.publicAndPrivateUsersAndWords(signer) {
|
||||||
|
continuation.resume(it)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} ?: PeopleListEvent.UsersAndWords()
|
} ?: PeopleListEvent.UsersAndWords()
|
||||||
|
|
||||||
val resultMuteList = withTimeoutOrNull(1000) {
|
val resultMuteList = (muteList.note.event as? MuteListEvent)?.let {
|
||||||
suspendCancellableCoroutine { continuation ->
|
withTimeoutOrNull(1000) {
|
||||||
(muteList.note.event as? MuteListEvent)?.publicAndPrivateUsersAndWords(signer) {
|
suspendCancellableCoroutine { continuation ->
|
||||||
continuation.resume(it)
|
it.publicAndPrivateUsersAndWords(signer) {
|
||||||
|
continuation.resume(it)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} ?: PeopleListEvent.UsersAndWords()
|
} ?: PeopleListEvent.UsersAndWords()
|
||||||
|
|||||||
@@ -76,6 +76,7 @@ import androidx.compose.ui.unit.dp
|
|||||||
import androidx.compose.ui.unit.sp
|
import androidx.compose.ui.unit.sp
|
||||||
import androidx.core.graphics.drawable.toBitmap
|
import androidx.core.graphics.drawable.toBitmap
|
||||||
import androidx.core.graphics.get
|
import androidx.core.graphics.get
|
||||||
|
import androidx.lifecycle.compose.collectAsStateWithLifecycle
|
||||||
import androidx.lifecycle.distinctUntilChanged
|
import androidx.lifecycle.distinctUntilChanged
|
||||||
import androidx.lifecycle.map
|
import androidx.lifecycle.map
|
||||||
import coil.compose.AsyncImage
|
import coil.compose.AsyncImage
|
||||||
@@ -434,8 +435,9 @@ fun WatchForReports(
|
|||||||
) {
|
) {
|
||||||
val userFollowsState by accountViewModel.userFollows.observeAsState()
|
val userFollowsState by accountViewModel.userFollows.observeAsState()
|
||||||
val noteReportsState by note.live().reports.observeAsState()
|
val noteReportsState by note.live().reports.observeAsState()
|
||||||
|
val userBlocks by accountViewModel.account.flowHiddenUsers.collectAsStateWithLifecycle()
|
||||||
|
|
||||||
LaunchedEffect(key1 = noteReportsState, key2 = userFollowsState) {
|
LaunchedEffect(key1 = noteReportsState, key2 = userFollowsState, userBlocks) {
|
||||||
accountViewModel.isNoteAcceptable(note, onChange)
|
accountViewModel.isNoteAcceptable(note, onChange)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -115,8 +115,9 @@ fun VideoScreen(
|
|||||||
@Composable
|
@Composable
|
||||||
fun WatchAccountForVideoScreen(videoFeedView: NostrVideoFeedViewModel, accountViewModel: AccountViewModel) {
|
fun WatchAccountForVideoScreen(videoFeedView: NostrVideoFeedViewModel, accountViewModel: AccountViewModel) {
|
||||||
val listState by accountViewModel.account.liveStoriesFollowLists.collectAsStateWithLifecycle()
|
val listState by accountViewModel.account.liveStoriesFollowLists.collectAsStateWithLifecycle()
|
||||||
|
val hiddenUsers = accountViewModel.account.flowHiddenUsers.collectAsStateWithLifecycle()
|
||||||
|
|
||||||
LaunchedEffect(accountViewModel, listState) {
|
LaunchedEffect(accountViewModel, listState, hiddenUsers) {
|
||||||
NostrVideoDataSource.resetFilters()
|
NostrVideoDataSource.resetFilters()
|
||||||
videoFeedView.checkKeysInvalidateDataAndSendToTop()
|
videoFeedView.checkKeysInvalidateDataAndSendToTop()
|
||||||
}
|
}
|
||||||
@@ -193,6 +194,7 @@ private fun LoadedState(
|
|||||||
SlidingCarousel(
|
SlidingCarousel(
|
||||||
state.feed,
|
state.feed,
|
||||||
pagerState,
|
pagerState,
|
||||||
|
state.showHidden.value,
|
||||||
accountViewModel,
|
accountViewModel,
|
||||||
nav
|
nav
|
||||||
)
|
)
|
||||||
@@ -204,6 +206,7 @@ private fun LoadedState(
|
|||||||
fun SlidingCarousel(
|
fun SlidingCarousel(
|
||||||
feed: MutableState<ImmutableList<Note>>,
|
feed: MutableState<ImmutableList<Note>>,
|
||||||
pagerState: PagerState,
|
pagerState: PagerState,
|
||||||
|
showHidden: Boolean,
|
||||||
accountViewModel: AccountViewModel,
|
accountViewModel: AccountViewModel,
|
||||||
nav: (String) -> Unit
|
nav: (String) -> Unit
|
||||||
) {
|
) {
|
||||||
@@ -216,7 +219,7 @@ fun SlidingCarousel(
|
|||||||
}
|
}
|
||||||
) { index ->
|
) { index ->
|
||||||
feed.value.getOrNull(index)?.let { note ->
|
feed.value.getOrNull(index)?.let { note ->
|
||||||
LoadedVideoCompose(note, accountViewModel, nav)
|
LoadedVideoCompose(note, showHidden, accountViewModel, nav)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -224,6 +227,7 @@ fun SlidingCarousel(
|
|||||||
@Composable
|
@Composable
|
||||||
fun LoadedVideoCompose(
|
fun LoadedVideoCompose(
|
||||||
note: Note,
|
note: Note,
|
||||||
|
showHidden: Boolean,
|
||||||
accountViewModel: AccountViewModel,
|
accountViewModel: AccountViewModel,
|
||||||
nav: (String) -> Unit
|
nav: (String) -> Unit
|
||||||
) {
|
) {
|
||||||
@@ -233,17 +237,19 @@ fun LoadedVideoCompose(
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
val scope = rememberCoroutineScope()
|
if (!showHidden) {
|
||||||
|
val scope = rememberCoroutineScope()
|
||||||
|
|
||||||
WatchForReports(note, accountViewModel) { newState ->
|
WatchForReports(note, accountViewModel) { newState ->
|
||||||
if (state != newState) {
|
if (state != newState) {
|
||||||
scope.launch(Dispatchers.Main) {
|
scope.launch(Dispatchers.Main) {
|
||||||
state = newState
|
state = newState
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Crossfade(targetState = state) {
|
Crossfade(targetState = state, label = "LoadedVideoCompose") {
|
||||||
RenderReportState(
|
RenderReportState(
|
||||||
it,
|
it,
|
||||||
note,
|
note,
|
||||||
@@ -262,7 +268,7 @@ fun RenderReportState(
|
|||||||
) {
|
) {
|
||||||
var showReportedNote by remember { mutableStateOf(false) }
|
var showReportedNote by remember { mutableStateOf(false) }
|
||||||
|
|
||||||
Crossfade(targetState = !state.isAcceptable && !showReportedNote) { showHiddenNote ->
|
Crossfade(targetState = (!state.isAcceptable || state.isHiddenAuthor) && !showReportedNote) { showHiddenNote ->
|
||||||
if (showHiddenNote) {
|
if (showHiddenNote) {
|
||||||
Column(remember { Modifier.fillMaxSize() }, verticalArrangement = Arrangement.Center) {
|
Column(remember { Modifier.fillMaxSize() }, verticalArrangement = Arrangement.Center) {
|
||||||
HiddenNote(
|
HiddenNote(
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
<string name="profile_image">Profile Image</string>
|
<string name="profile_image">Profile Image</string>
|
||||||
<string name="scan_qr">Scan QR</string>
|
<string name="scan_qr">Scan QR</string>
|
||||||
<string name="show_anyway">Show Anyway</string>
|
<string name="show_anyway">Show Anyway</string>
|
||||||
<string name="post_was_flagged_as_inappropriate_by">Post was reported by</string>
|
<string name="post_was_flagged_as_inappropriate_by">Post was muted or reported by</string>
|
||||||
<string name="post_not_found">Event is loading or can\'t be found in your relay list</string>
|
<string name="post_not_found">Event is loading or can\'t be found in your relay list</string>
|
||||||
<string name="channel_image">Channel Image</string>
|
<string name="channel_image">Channel Image</string>
|
||||||
<string name="referenced_event_not_found">Referenced event not found</string>
|
<string name="referenced_event_not_found">Referenced event not found</string>
|
||||||
|
|||||||
@@ -58,7 +58,10 @@ abstract class GeneralListEvent(
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun privateTags(signer: NostrSigner, onReady: (Array<Array<String>>) -> Unit) {
|
fun privateTags(signer: NostrSigner, onReady: (Array<Array<String>>) -> Unit) {
|
||||||
if (content.isBlank()) return
|
if (content.isEmpty()) {
|
||||||
|
onReady(emptyArray())
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
privateTagsCache?.let {
|
privateTagsCache?.let {
|
||||||
onReady(it)
|
onReady(it)
|
||||||
|
|||||||
Reference in New Issue
Block a user