feature (room upgrade) : add "same room" permalink toast to localazy

This commit is contained in:
ganfra 2025-06-16 20:45:55 +02:00
parent b6c39594fe
commit cfc6362057
2 changed files with 6 additions and 4 deletions

View file

@ -63,6 +63,7 @@ import io.element.android.libraries.matrix.api.room.BaseRoom
import io.element.android.libraries.matrix.api.room.alias.matches import io.element.android.libraries.matrix.api.room.alias.matches
import io.element.android.libraries.matrix.api.timeline.item.TimelineItemDebugInfo import io.element.android.libraries.matrix.api.timeline.item.TimelineItemDebugInfo
import io.element.android.libraries.mediaplayer.api.MediaPlayer import io.element.android.libraries.mediaplayer.api.MediaPlayer
import io.element.android.libraries.ui.strings.CommonStrings
import io.element.android.services.analytics.api.AnalyticsService import io.element.android.services.analytics.api.AnalyticsService
import kotlinx.collections.immutable.ImmutableList import kotlinx.collections.immutable.ImmutableList
import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.CoroutineScope
@ -185,7 +186,7 @@ class MessagesNode @AssistedInject constructor(
eventSink(TimelineEvents.FocusOnEvent(eventId)) eventSink(TimelineEvents.FocusOnEvent(eventId))
} else { } else {
// Click on the same room, ignore // Click on the same room, ignore
context.sameRoomToast() displaySameRoomToast()
} }
} else { } else {
callbacks.forEach { it.onPermalinkClick(roomLink) } callbacks.forEach { it.onPermalinkClick(roomLink) }
@ -214,7 +215,7 @@ class MessagesNode @AssistedInject constructor(
override fun onNavigateToRoom(roomId: RoomId) { override fun onNavigateToRoom(roomId: RoomId) {
if (roomId == room.roomId) { if (roomId == room.roomId) {
context.sameRoomToast() displaySameRoomToast()
} else { } else {
val permalinkData = PermalinkData.RoomLink(roomId.toRoomIdOrAlias()) val permalinkData = PermalinkData.RoomLink(roomId.toRoomIdOrAlias())
callbacks.forEach { it.onPermalinkClick(permalinkData) } callbacks.forEach { it.onPermalinkClick(permalinkData) }
@ -241,8 +242,8 @@ class MessagesNode @AssistedInject constructor(
callbacks.forEach { it.onViewKnockRequests() } callbacks.forEach { it.onViewKnockRequests() }
} }
private fun Context.sameRoomToast() { private fun displaySameRoomToast() {
context.toast("Already viewing this room!") context.toast(CommonStrings.screen_room_permalink_same_room_android)
} }
@Composable @Composable

View file

@ -367,6 +367,7 @@ Are you sure you want to continue?"</string>
<string name="screen_room_error_failed_processing_media">"Failed processing media to upload, please try again."</string> <string name="screen_room_error_failed_processing_media">"Failed processing media to upload, please try again."</string>
<string name="screen_room_error_failed_retrieving_user_details">"Could not retrieve user details"</string> <string name="screen_room_error_failed_retrieving_user_details">"Could not retrieve user details"</string>
<string name="screen_room_event_pill">"Message in %1$s"</string> <string name="screen_room_event_pill">"Message in %1$s"</string>
<string name="screen_room_permalink_same_room_android">"Already viewing this room!"</string>
<string name="screen_room_pinned_banner_indicator">"%1$s of %2$s"</string> <string name="screen_room_pinned_banner_indicator">"%1$s of %2$s"</string>
<string name="screen_room_pinned_banner_indicator_description">"%1$s Pinned messages"</string> <string name="screen_room_pinned_banner_indicator_description">"%1$s Pinned messages"</string>
<string name="screen_room_pinned_banner_loading_description">"Loading message…"</string> <string name="screen_room_pinned_banner_loading_description">"Loading message…"</string>