diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/dal/ThreadFeedFilter.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/dal/ThreadFeedFilter.kt index 21374035d..bc80e6fb2 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/dal/ThreadFeedFilter.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/dal/ThreadFeedFilter.kt @@ -27,11 +27,12 @@ import com.vitorpamplona.amethyst.model.Note import com.vitorpamplona.amethyst.model.ThreadAssembler import com.vitorpamplona.amethyst.model.ThreadLevelCalculator import com.vitorpamplona.quartz.utils.TimeUtils +import kotlinx.collections.immutable.toImmutableSet @Immutable class ThreadFeedFilter( val account: Account, - val noteId: String, + private val noteId: String, ) : FeedFilter() { override fun feedKey(): String = noteId @@ -40,7 +41,14 @@ class ThreadFeedFilter( val followingKeySet = account.liveKind3Follows.value.authors val eventsToWatch = ThreadAssembler().findThreadFor(noteId) ?: return emptyList() - val eventsInHex = eventsToWatch.allNotes.map { it.idHex }.toSet() + // Filter out drafts made by other accounts on device + val filteredEvents = + eventsToWatch.allNotes + .filter { !it.isDraft() || (it.author?.pubkeyHex == account.userProfile().pubkeyHex) } + .toImmutableSet() + val filteredThreadInfo = ThreadAssembler.ThreadInfo(eventsToWatch.root, filteredEvents) + + val eventsInHex = filteredThreadInfo.allNotes.map { it.idHex }.toSet() val now = TimeUtils.now() // Currently orders by date of each event, descending, at each level of the reply stack @@ -57,6 +65,6 @@ class ThreadFeedFilter( ).signature } - return eventsToWatch.allNotes.sortedWith(order) + return filteredThreadInfo.allNotes.sortedWith(order) } } diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/threadview/ThreadFeedView.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/threadview/ThreadFeedView.kt index ef45f6d63..ebfef9a94 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/threadview/ThreadFeedView.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/threadview/ThreadFeedView.kt @@ -243,9 +243,9 @@ fun RenderThreadFeed( // In that case, this screen will open with 0-1 items, and the scrollToItem below // will not change the state of the screen (too few items, scroll is not available) // as the app loads the reaming of the thread the position of the reply changes - // and becuase there wasn't a possibility to scroll before and now there is one, + // and because there wasn't a possibility to scroll before and now there is one, // the screen stays at the top. Once the thread has enough replies, the lazy column - // updates with new items correctly. It just needs a few items to start the scrool. + // updates with new items correctly. It just needs a few items to start the scroll. // // This hack allows the list 1 second to fill up with more // records before setting up the position on the feed. @@ -275,7 +275,6 @@ fun RenderThreadFeed( val modifier = Modifier .drawReplyLevel( - note = item, level = level, color = MaterialTheme.colorScheme.placeholderText, selected = @@ -323,7 +322,6 @@ fun RenderThreadFeed( // Creates a Zebra pattern where each bar is a reply level. fun Modifier.drawReplyLevel( - note: Note, level: State, color: Color, selected: Color, @@ -485,14 +483,11 @@ private fun FullBleedNoteCompose( Spacer(modifier = Modifier.height(10.dp)) - if (noteEvent is BadgeDefinitionEvent) { - BadgeDisplay(baseNote = baseNote) - } else if (noteEvent is LongTextNoteEvent) { - RenderLongFormHeaderForThread(noteEvent) - } else if (noteEvent is WikiNoteEvent) { - RenderWikiHeaderForThread(noteEvent, accountViewModel, nav) - } else if (noteEvent is ClassifiedsEvent) { - RenderClassifiedsReaderForThread(noteEvent, baseNote, accountViewModel, nav) + when (noteEvent) { + is BadgeDefinitionEvent -> BadgeDisplay(baseNote = baseNote) + is LongTextNoteEvent -> RenderLongFormHeaderForThread(noteEvent) + is WikiNoteEvent -> RenderWikiHeaderForThread(noteEvent, accountViewModel, nav) + is ClassifiedsEvent -> RenderClassifiedsReaderForThread(noteEvent, baseNote, accountViewModel, nav) } Row( @@ -513,11 +508,11 @@ private fun FullBleedNoteCompose( nav = nav, ) } else if (noteEvent is VideoEvent) { - VideoDisplay(baseNote, false, true, backgroundColor, false, accountViewModel, nav) + VideoDisplay(baseNote, makeItShort = false, canPreview = true, backgroundColor = backgroundColor, isFiniteHeight = false, accountViewModel = accountViewModel, nav = nav) } else if (noteEvent is FileHeaderEvent) { - FileHeaderDisplay(baseNote, true, false, accountViewModel) + FileHeaderDisplay(baseNote, roundedCorner = true, isFiniteHeight = false, accountViewModel = accountViewModel) } else if (noteEvent is FileStorageHeaderEvent) { - FileStorageHeaderDisplay(baseNote, true, false, accountViewModel) + FileStorageHeaderDisplay(baseNote, roundedCorner = true, isFiniteHeight = false, accountViewModel = accountViewModel) } else if (noteEvent is PeopleListEvent) { DisplayPeopleList(baseNote, backgroundColor, accountViewModel, nav) } else if (noteEvent is AudioTrackEvent) { @@ -564,9 +559,9 @@ private fun FullBleedNoteCompose( } else if (noteEvent is GitRepositoryEvent) { RenderGitRepositoryEvent(baseNote, accountViewModel, nav) } else if (noteEvent is GitPatchEvent) { - RenderGitPatchEvent(baseNote, false, true, quotesLeft = 3, backgroundColor, accountViewModel, nav) + RenderGitPatchEvent(baseNote, makeItShort = false, canPreview = true, quotesLeft = 3, backgroundColor = backgroundColor, accountViewModel = accountViewModel, nav = nav) } else if (noteEvent is GitIssueEvent) { - RenderGitIssueEvent(baseNote, false, true, quotesLeft = 3, backgroundColor, accountViewModel, nav) + RenderGitIssueEvent(baseNote, makeItShort = false, canPreview = true, quotesLeft = 3, backgroundColor = backgroundColor, accountViewModel = accountViewModel, nav = nav) } else if (noteEvent is AppDefinitionEvent) { RenderAppDefinition(baseNote, accountViewModel, nav) } else if (noteEvent is DraftEvent) { @@ -675,9 +670,8 @@ private fun FullBleedNoteCompose( } } - val noteEvent = baseNote.event - val zapSplits = remember(noteEvent) { noteEvent?.hasZapSplitSetup() ?: false } - if (zapSplits && noteEvent != null) { + val zapSplits = remember(noteEvent) { noteEvent.hasZapSplitSetup() } + if (zapSplits) { Spacer(modifier = DoubleVertSpacer) Row( modifier = Modifier.padding(horizontal = 12.dp), @@ -686,7 +680,7 @@ private fun FullBleedNoteCompose( } } - ReactionsRow(baseNote, true, true, editState, accountViewModel, nav) + ReactionsRow(baseNote, showReactionDetail = true, addPadding = true, editState = editState, accountViewModel = accountViewModel, nav = nav) } } @@ -938,14 +932,14 @@ private fun RenderWikiHeaderForThreadPreview() { RenderWikiHeaderForThread(noteEvent = event, accountViewModel = accountViewModel, nav) RenderTextEvent( baseNote!!, - false, - true, + makeItShort = false, + canPreview = true, quotesLeft = 3, unPackReply = false, - backgroundColor, - editState, - accountViewModel, - nav, + backgroundColor = backgroundColor, + editState = editState, + accountViewModel = accountViewModel, + nav = nav, ) } } diff --git a/amethyst/src/main/res/values-hi-rIN/strings.xml b/amethyst/src/main/res/values-hi-rIN/strings.xml index e94db4a15..b01302505 100644 --- a/amethyst/src/main/res/values-hi-rIN/strings.xml +++ b/amethyst/src/main/res/values-hi-rIN/strings.xml @@ -547,6 +547,8 @@ अवलम्बन करनेवाले ग्राहक ज्सापों को आगे भेजेंगे लै॰जाल पता को अथवा नीचे के उपयोगकर्ता परिचय को तथा आपके तक नहीं स्थान अनावृत करें ऐसे आपका भूगोलिक स्थान विभेदक जोडता है पत्र में। जनता जान जाएगी कि आप वर्तमान स्थान से ५ कि॰मे॰ (३ मी॰) की दूरी के अन्दर हैं + स्थान प्राप्त किया जा रहा है + स्थान प्राप्त करने की अनुमति नहीं आपके विषयवस्तु दिखाने से पूर्व संवेदनशील विषयवस्तु चेतावनी जोडता है। यह आदर्श है किसी कार्यालय अनुचित विषयवस्तु के लिए अथवा जो कुछ लोगों के लिए आपत्तिजनक अथवा व्याकुल करनेवाला लग सकता है नयी सुविधा इस कार्यशैली सक्षम करने के लिए अमेथिस्ट के द्वारा निप॰-१७ संदेश (उपहारकोषयुक्त, आच्छादित सीधा तथा झुण्ड संदेश) भेजना पडेगा। यह निप॰-१७ नया है तथा अनेक ग्राहक इसे कार्यान्वित किया नहीं अब तक। सुनिश्चित करें कि प्राप्तकर्ता एक अनुकूल ग्राहक का प्रयोग कर रहे हैं। diff --git a/amethyst/src/main/res/values-hu/strings.xml b/amethyst/src/main/res/values-hu/strings.xml index 343a3193d..a3c08b9d3 100644 --- a/amethyst/src/main/res/values-hu/strings.xml +++ b/amethyst/src/main/res/values-hu/strings.xml @@ -546,6 +546,8 @@ A funkciót támogató kliensek a Zap-eket az Ön tárcája helyett, az alábbi LN-címre vagy felhasználói profilra továbbítják A Hely megjelenítése mint A bejegyzéshez az Ön tartózkodási helyének Geohash-ét hozzáadja. A közönség tudni fogja, hogy az aktuális helytől 5 km-en (3 mérföldön) belül van + Hely betöltése + Helymeghatározás nincs engedélyezve A kényes tartalom miatt, azon megjelenítése előtt figyelmeztetést ad. Ez ideális minden Felnőtt tartalomhoz vagy olyan tartalomhoz, amelyet egyesek sértőnek vagy zavarónak találhatnak Új funkció Az Amethystnek ennek a módnak az aktiválásához NIP-17 üzenetet kell küldenie (GiftWrapped, Zárolt direkt és csoportos üzeneteket). A NIP-17 új, és a legtöbb kliens még nem implementálta. Győződj meg arról, hogy a fogadó fél kompatibilis klienst használ. diff --git a/amethyst/src/main/res/values-nl/strings.xml b/amethyst/src/main/res/values-nl/strings.xml index eb10f4c5b..6ee3196e7 100644 --- a/amethyst/src/main/res/values-nl/strings.xml +++ b/amethyst/src/main/res/values-nl/strings.xml @@ -547,6 +547,8 @@ Ondersteunende clients sturen zaps door naar het onderstaande LN-adres of gebruikersprofiel in plaats van naar het jouwe Locatie weergeven als Voegt een Geohash van je locatie toe aan het bericht. Het publiek weet dat je binnen 5 km (3mi) van de huidige locatie bent. + Locatie laden + Geen locatiemachtigingen Voegt een waarschuwing voor gevoelige inhoud toe voordat je inhoud wordt weergegeven. Dit is ideaal voor NSFW-inhoud of inhoud die sommige mensen beledigend of verontrustend vinden. Nieuwe functie Voor het activeren van deze modus is Amethyst nodig om een NIP-17 bericht te versturen. NIP-17 is nieuw en de meeste clients hebben deze nog niet geïmplementeerd. Zorg ervoor dat de ontvanger een compatibele client gebruikt. diff --git a/amethyst/src/main/res/values-pl-rPL/strings.xml b/amethyst/src/main/res/values-pl-rPL/strings.xml index abf5c440e..841f967c5 100644 --- a/amethyst/src/main/res/values-pl-rPL/strings.xml +++ b/amethyst/src/main/res/values-pl-rPL/strings.xml @@ -547,6 +547,8 @@ Wspierający klient podzieli i przekaże zapy na LNAdres lub profil użytkownika poniżej zamiast Ciebie Wyświetl lokalizację jako Dodaje Geohash twojej lokalizacji do wpisu. Użytkownicy będą wiedzieli, że jesteś mniej niż 5 km od bieżącej lokalizacji + Pobieranie lokalizacji + Brak dostępu do lokalizacji Dodaje ostrzeżenie o wrażliwych treściach przed wyświetleniem treści. Jest to idealne dla dowolnych treści NSFW lub treści, które niektóre osoby mogą uznać za obraźliwe lub przeszkadzające Nowa Funkcjonalność Aktywacja tego trybu wymaga wysłania wiadomości NIP-17 przez Ametyst. (Prezent, Zapieczętowane wiadomości bezpośrednie i grupowe). NIP-17 jest nowy, a większość klientów jeszcze go nie zaimplementowała. Upewnij się, że odbiorca używa kompatybilnego klienta.