Skip to content

Commit

Permalink
Merge pull request #1805 from vector-im/feature/bma/renderReadMarker
Browse files Browse the repository at this point in the history
Timeline: render TimelineItemReadMarkerModel
  • Loading branch information
bmarty authored Nov 15, 2023
2 parents 6bfb316 + 844768c commit 99783a6
Show file tree
Hide file tree
Showing 31 changed files with 83 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import androidx.compose.ui.Modifier
import io.element.android.features.messages.impl.timeline.session.SessionState
import io.element.android.features.messages.impl.timeline.components.virtual.TimelineEncryptedHistoryBannerView
import io.element.android.features.messages.impl.timeline.components.virtual.TimelineItemDaySeparatorView
import io.element.android.features.messages.impl.timeline.components.virtual.TimelineItemReadMarkerView
import io.element.android.features.messages.impl.timeline.model.TimelineItem
import io.element.android.features.messages.impl.timeline.model.virtual.TimelineItemDaySeparatorModel
import io.element.android.features.messages.impl.timeline.model.virtual.TimelineItemEncryptedHistoryBannerVirtualModel
Expand All @@ -34,7 +35,7 @@ fun TimelineItemVirtualRow(
) {
when (virtual.model) {
is TimelineItemDaySeparatorModel -> TimelineItemDaySeparatorView(virtual.model, modifier)
TimelineItemReadMarkerModel -> return
TimelineItemReadMarkerModel -> TimelineItemReadMarkerView()
is TimelineItemEncryptedHistoryBannerVirtualModel -> TimelineEncryptedHistoryBannerView(sessionState, modifier)
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
/*
* Copyright (c) 2023 New Vector Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package io.element.android.features.messages.impl.timeline.components.virtual

import androidx.compose.foundation.layout.Arrangement.spacedBy
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.dp
import io.element.android.features.messages.impl.R
import io.element.android.libraries.designsystem.preview.ElementPreview
import io.element.android.libraries.designsystem.preview.PreviewsDayNight
import io.element.android.libraries.designsystem.theme.components.HorizontalDivider
import io.element.android.libraries.designsystem.theme.components.Text
import io.element.android.libraries.theme.ElementTheme

@Composable
internal fun TimelineItemReadMarkerView(
modifier: Modifier = Modifier
) {
Column(
modifier = modifier
.fillMaxWidth()
.padding(vertical = 12.dp, horizontal = 18.dp),
horizontalAlignment = Alignment.End,
verticalArrangement = spacedBy(4.dp),
) {
Text(
text = stringResource(id = R.string.room_timeline_read_marker_title).uppercase(),
style = ElementTheme.typography.fontBodySmMedium,
color = ElementTheme.colors.textSecondary,
)
HorizontalDivider(
modifier = Modifier
.fillMaxWidth()
.padding(horizontal = 2.dp),
color = ElementTheme.colors.borderInteractivePrimary,
)
}
}

@PreviewsDayNight
@Composable
internal fun TimelineItemReadMarkerViewPreview() = ElementPreview {
TimelineItemReadMarkerView()
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
<string name="report_content_hint">"Důvod nahlášení tohoto obsahu"</string>
<string name="room_timeline_beginning_of_room">"Toto je začátek %1$s."</string>
<string name="room_timeline_beginning_of_room_no_name">"Toto je začátek této konverzace."</string>
<string name="room_timeline_read_marker_title">"Nové"</string>
<string name="screen_room_mentions_at_room_subtitle">"Informujte celou místnost"</string>
<string name="screen_report_content_block_user_hint">"Zaškrtněte, pokud chcete skrýt všechny aktuální a budoucí zprávy od tohoto uživatele"</string>
<string name="screen_room_attachment_source_camera">"Fotoaparát"</string>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
<string name="report_content_hint">"Grund für die Meldung dieses Inhalts"</string>
<string name="room_timeline_beginning_of_room">"Dies ist der Anfang von %1$s."</string>
<string name="room_timeline_beginning_of_room_no_name">"Dies ist der Anfang dieses Gesprächs."</string>
<string name="room_timeline_read_marker_title">"Neu"</string>
<string name="screen_report_content_block_user_hint">"Prüfe, ob du alle aktuellen und zukünftigen Nachrichten dieses Benutzers ausblenden möchtest"</string>
<string name="screen_room_attachment_source_camera">"Kamera"</string>
<string name="screen_room_attachment_source_camera_photo">"Foto machen"</string>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
<string name="report_content_hint">"Motivo para denunciar este contenido"</string>
<string name="room_timeline_beginning_of_room">"Este es el principio de %1$s."</string>
<string name="room_timeline_beginning_of_room_no_name">"Este es el principio de esta conversación."</string>
<string name="room_timeline_read_marker_title">"Nuevos"</string>
<string name="screen_report_content_block_user_hint">"Marque si quieres ocultar todos los mensajes actuales y futuros de este usuario"</string>
<string name="screen_report_content_block_user">"Bloquear usuario"</string>
</resources>
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
<string name="report_content_hint">"Raison du signalement de ce contenu"</string>
<string name="room_timeline_beginning_of_room">"Ceci est le début de %1$s."</string>
<string name="room_timeline_beginning_of_room_no_name">"Ceci est le début de cette conversation."</string>
<string name="room_timeline_read_marker_title">"Nouveau"</string>
<string name="screen_room_mentions_at_room_subtitle">"Notifier tout le salon"</string>
<string name="screen_report_content_block_user_hint">"Cochez si vous souhaitez masquer tous les messages actuels et futurs de cet utilisateur."</string>
<string name="screen_room_attachment_source_camera">"Appareil photo"</string>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
<string name="report_content_hint">"Motivo della segnalazione di questo contenuto"</string>
<string name="room_timeline_beginning_of_room">"Questo è l\'inizio di %1$s."</string>
<string name="room_timeline_beginning_of_room_no_name">"Questo è l\'inizio della conversazione."</string>
<string name="room_timeline_read_marker_title">"Nuovo"</string>
<string name="screen_report_content_block_user_hint">"Seleziona se vuoi nascondere tutti i messaggi attuali e futuri di questo utente"</string>
<string name="screen_report_content_block_user">"Blocca utente"</string>
</resources>
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
<string name="report_content_hint">"Motivul raportării acestui conținut"</string>
<string name="room_timeline_beginning_of_room">"Acesta este începutul conversației %1$s."</string>
<string name="room_timeline_beginning_of_room_no_name">"Acesta este începutul acestei conversații."</string>
<string name="room_timeline_read_marker_title">"Nou"</string>
<string name="screen_report_content_block_user_hint">"Confirmați că doriți să ascundeți toate mesajele curente și viitoare de la acest utilizator"</string>
<string name="screen_room_attachment_source_camera">"Cameră foto"</string>
<string name="screen_room_attachment_source_camera_photo">"Faceți o fotografie"</string>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
<string name="report_content_hint">"Причина, по которой вы пожаловались на этот контент"</string>
<string name="room_timeline_beginning_of_room">"Это начало %1$s."</string>
<string name="room_timeline_beginning_of_room_no_name">"Это начало разговора."</string>
<string name="room_timeline_read_marker_title">"Новый"</string>
<string name="screen_room_mentions_at_room_subtitle">"Уведомить всю комнату"</string>
<string name="screen_report_content_block_user_hint">"Отметьте, хотите ли вы скрыть все текущие и будущие сообщения от этого пользователя"</string>
<string name="screen_room_attachment_source_camera">"Камера"</string>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
<string name="report_content_hint">"Dôvod nahlásenia tohto obsahu"</string>
<string name="room_timeline_beginning_of_room">"Toto je začiatok %1$s."</string>
<string name="room_timeline_beginning_of_room_no_name">"Toto je začiatok tejto konverzácie."</string>
<string name="room_timeline_read_marker_title">"Nové"</string>
<string name="screen_room_mentions_at_room_subtitle">"Informovať celú miestnosť"</string>
<string name="screen_report_content_block_user_hint">"Označte, či chcete skryť všetky aktuálne a budúce správy od tohto používateľa"</string>
<string name="screen_room_attachment_source_camera">"Kamera"</string>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
<item quantity="other">"%1$d 個聊天室變更"</item>
</plurals>
<string name="report_content_hint">"檢舉這個內容的原因"</string>
<string name="room_timeline_read_marker_title">"新訊息"</string>
<string name="screen_room_attachment_source_camera">"照相機"</string>
<string name="screen_room_attachment_source_camera_photo">"拍照"</string>
<string name="screen_room_attachment_source_camera_video">"錄影"</string>
Expand Down
1 change: 1 addition & 0 deletions features/messages/impl/src/main/res/values/localazy.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
<string name="report_content_hint">"Reason for reporting this content"</string>
<string name="room_timeline_beginning_of_room">"This is the beginning of %1$s."</string>
<string name="room_timeline_beginning_of_room_no_name">"This is the beginning of this conversation."</string>
<string name="room_timeline_read_marker_title">"New"</string>
<string name="screen_room_mentions_at_room_subtitle">"Notify the whole room"</string>
<string name="screen_report_content_block_user_hint">"Check if you want to hide all current and future messages from this user"</string>
<string name="screen_room_attachment_source_camera">"Camera"</string>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,6 @@
<item quantity="other">"%d hlasů"</item>
</plurals>
<string name="preference_rageshake">"Zatřeste zařízením pro nahlášení chyby"</string>
<string name="room_timeline_read_marker_title">"Nové"</string>
<string name="screen_media_picker_error_failed_selection">"Výběr média se nezdařil, zkuste to prosím znovu."</string>
<string name="screen_media_upload_preview_error_failed_processing">"Nahrání média se nezdařilo, zkuste to prosím znovu."</string>
<string name="screen_media_upload_preview_error_failed_sending">"Nahrání média se nezdařilo, zkuste to prosím znovu."</string>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,6 @@
<item quantity="other">"%d Stimmen"</item>
</plurals>
<string name="preference_rageshake">"Schüttel heftig zum Melden von Fehlern"</string>
<string name="room_timeline_read_marker_title">"Neu"</string>
<string name="screen_media_picker_error_failed_selection">"Medienauswahl fehlgeschlagen, bitte versuche es erneut."</string>
<string name="screen_media_upload_preview_error_failed_processing">"Fehler beim Verarbeiten des hochgeladenen Mediums. Bitte versuche es erneut."</string>
<string name="screen_media_upload_preview_error_failed_sending">"Das Hochladen der Medien ist fehlgeschlagen. Bitte versuche es erneut."</string>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,6 @@
<item quantity="other">"%1$d miembros"</item>
</plurals>
<string name="preference_rageshake">"Agitar con fuerza para informar de un error"</string>
<string name="room_timeline_read_marker_title">"Nuevos"</string>
<string name="settings_version_number">"Versión: %1$s (%2$s)"</string>
<string name="test_language_identifier">"es"</string>
<string name="dialog_title_error">"Error"</string>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,6 @@
<item quantity="other">"%d votes"</item>
</plurals>
<string name="preference_rageshake">"Rageshake pour signaler un problème"</string>
<string name="room_timeline_read_marker_title">"Nouveau"</string>
<string name="screen_media_picker_error_failed_selection">"Échec de la sélection du média, veuillez réessayer."</string>
<string name="screen_media_upload_preview_error_failed_processing">"Échec du traitement des médias à télécharger, veuillez réessayer."</string>
<string name="screen_media_upload_preview_error_failed_sending">"Échec du téléchargement du média, veuillez réessayer."</string>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,6 @@
<item quantity="other">"%1$d membri"</item>
</plurals>
<string name="preference_rageshake">"Scuoti per segnalare un problema"</string>
<string name="room_timeline_read_marker_title">"Nuovo"</string>
<string name="settings_version_number">"Versione: %1$s (%2$s)"</string>
<string name="test_language_identifier">"it"</string>
<string name="dialog_title_error">"Errore"</string>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,6 @@
<item quantity="other">"%d voturi"</item>
</plurals>
<string name="preference_rageshake">"Rageshake pentru a raporta erori"</string>
<string name="room_timeline_read_marker_title">"Nou"</string>
<string name="screen_media_picker_error_failed_selection">"Selectarea fișierelor media a eșuat, încercați din nou."</string>
<string name="screen_media_upload_preview_error_failed_processing">"Procesarea datelor media a eșuat, vă rugăm să încercați din nou."</string>
<string name="screen_media_upload_preview_error_failed_sending">"Încărcarea fișierelor media a eșuat, încercați din nou."</string>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,6 @@
<item quantity="many">"%d голосов"</item>
</plurals>
<string name="preference_rageshake">"Rageshake сообщит об ошибке"</string>
<string name="room_timeline_read_marker_title">"Новый"</string>
<string name="screen_media_picker_error_failed_selection">"Не удалось выбрать носитель, попробуйте еще раз."</string>
<string name="screen_media_upload_preview_error_failed_processing">"Не удалось обработать медиафайл для загрузки, попробуйте еще раз."</string>
<string name="screen_media_upload_preview_error_failed_sending">"Не удалось загрузить медиафайлы, попробуйте еще раз."</string>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,6 @@
<item quantity="other">"%d hlasov"</item>
</plurals>
<string name="preference_rageshake">"Zúrivo potriasť pre nahlásenie chyby"</string>
<string name="room_timeline_read_marker_title">"Nové"</string>
<string name="screen_media_picker_error_failed_selection">"Nepodarilo sa vybrať médium, skúste to prosím znova."</string>
<string name="screen_media_upload_preview_error_failed_processing">"Nepodarilo sa spracovať médiá na odoslanie, skúste to prosím znova."</string>
<string name="screen_media_upload_preview_error_failed_sending">"Nepodarilo sa nahrať médiá, skúste to prosím znova."</string>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,6 @@
<plurals name="common_poll_votes_count">
<item quantity="other">"%d 票"</item>
</plurals>
<string name="room_timeline_read_marker_title">"新訊息"</string>
<string name="screen_media_upload_preview_error_failed_sending">"無法上傳媒體檔案,請稍後再試。"</string>
<string name="screen_share_location_title">"分享位置"</string>
<string name="screen_share_my_location_action">"分享我的位置"</string>
Expand Down
1 change: 0 additions & 1 deletion libraries/ui-strings/src/main/res/values/localazy.xml
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,6 @@
<item quantity="other">"%d votes"</item>
</plurals>
<string name="preference_rageshake">"Rageshake to report bug"</string>
<string name="room_timeline_read_marker_title">"New"</string>
<string name="screen_media_picker_error_failed_selection">"Failed selecting media, please try again."</string>
<string name="screen_media_upload_preview_error_failed_processing">"Failed processing media to upload, please try again."</string>
<string name="screen_media_upload_preview_error_failed_sending">"Failed uploading media, please try again."</string>
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 1 addition & 2 deletions tools/localazy/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -121,11 +121,10 @@
{
"name": ":features:messages:impl",
"includeRegex": [
"room_timeline_beginning_.*",
"room_timeline_.*",
"screen_room_.*",
"screen\\.room\\..*",
"screen_dm_details_.*",
"room_timeline_state_changes",
"emoji_picker_category_.*",
".*report_content_.*"
],
Expand Down

0 comments on commit 99783a6

Please sign in to comment.