La Casa del Bordadito includes a full in-app messaging system so customers can reach support staff without leaving the app. Conversations are stored in Firebase Realtime Database, unread counts update in real time, and users who are offline receive a OneSignal push notification so no message is ever missed.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/AndresLopezCorrales/La-casa-del-bordadito/llms.txt
Use this file to discover all available pages before exploring further.
Starting a chat
Open support contacts
Navigate to the Cuenta tab, find the Configuración section, and tap Soporte Chat. This launches
ListaChatActivity.Select a support user
ListaChatActivity lists only users whose esSoporte flag is true in Realtime Database. If you are yourself a support user, the full user list is shown instead so you can reply to any customer. A search bar filters by name in real time using an ordered Realtime DB query.Chat data model
Sample Realtime Database message node
| Field | Type | Description |
|---|---|---|
idMensaje | String | Auto-generated Realtime DB push key |
tipoMensaje | String | TEXTO for plain text; IMAGEN for a Firebase Storage URL |
mensaje | String | Message text, or a Storage download URL when tipoMensaje is IMAGEN |
emisorUid | String | UID of the sender |
receptorUid | String | UID of the recipient |
tiempo | Long | System.currentTimeMillis() at send time |
Firebase Realtime Database paths
Message storage
chatRuta is computed by Constantes.rutaChat(uid1, uid2), which sorts the two UIDs alphabetically and joins them with an underscore:
Unread counts
- Incremented on every outgoing message, but only if the recipient’s
chattingWithfield does not already equal the sender’s UID (i.e. the recipient is not actively viewing this conversation). - Reset to
0when the recipient opensChatActivityviamarcarComoLeido().
Message types
TEXTO
Plain text entered in the message field. Sent by tapping the send FAB. The message is trimmed before validation — empty strings show a toast instead of sending.
IMAGEN
Image selected from the device gallery (or camera on supported versions). The file is uploaded to Firebase Storage under
ImagenesChat/{timestamp}, and the resulting download URL is stored as the mensaje value with tipoMensaje = "IMAGEN".In-app notification popup
When a new message arrives from a conversation that is not currently open,MainActivity shows a PopupWindow at the top of the screen displaying the sender’s name and the message preview. The popup auto-dismisses after 4 seconds.
Push notifications
For users who are offline (or not actively viewing the sender’s chat), a OneSignal push notification is sent viaFcmUtil.enviarNotificacionAUsuario. The notification is skipped when:
chattingWith == senderUid— recipient is already in this conversation.online == true— recipient is active in the app and will see the in-app popup instead.
Online and presence fields
Two fields on theUsuarios/{uid} node control notification routing:
| Field | Type | Description |
|---|---|---|
online | Boolean | true while the user has the app in the foreground |
chattingWith | String | UID of the contact whose chat is currently open; "" when no chat is active |
chattingWith is set in ChatActivity.onResume() and cleared in onPause(), ensuring it always reflects the currently viewed conversation.
Block system
Either participant can block the other. Blocks are stored underUsuarios/{uid}/usuariosBloqueados/{blockedUid} in Realtime Database. ChatActivity listens to both the current user’s block list and the other user’s block list simultaneously.