Skip to main content

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.

The Taller (Workshop) section gives La Casa del Bordadito a lightweight event-promotion channel built directly into the app. A single, always-current flyer image is stored in Firebase Storage and its download URL is kept in Firebase Realtime Database. Every customer sees the latest flyer the moment an admin publishes it, and a OneSignal broadcast notification announces the update to everyone — no app update required.

Accessing the Taller screen

TallerActivity can be reached from two entry points in the main navigation:
  • The Taller item in the bottom navigation bar.
  • The “Ver flyer” button on the Talleres Presenciales slide inside the home-screen ViewPager2 banner.

Flyer display

When TallerActivity opens, it attaches a ValueEventListener to TallerInfo/flyerUrl in Firebase Realtime Database. As soon as the URL is available, Glide loads the image into the full-screen ImageView (ivFlyerTaller), showing a placeholder icon while the download is in progress:
private fun cargarFlyer() {
    val ref = FirebaseDatabase.getInstance().getReference("TallerInfo")
    ref.child("flyerUrl").addValueEventListener(object : ValueEventListener {
        override fun onDataChange(snapshot: DataSnapshot) {
            val url = snapshot.value.toString()
            if (url.isNotEmpty() && url != "null") {
                Glide.with(this@TallerActivity)
                    .load(url)
                    .placeholder(R.drawable.aro_bordado)
                    .into(ivFlyerTaller)
            }
        }
        override fun onCancelled(error: DatabaseError) {}
    })
}
Because it is a live listener, if an admin uploads a new flyer while a customer has the screen open, the image refreshes automatically.

Firebase Realtime Database structure

{
  "TallerInfo": {
    "flyerUrl": "https://firebasestorage.googleapis.com/v0/b/lacasadelbordadito.appspot.com/o/flyerTaller%2Fflyer_actual?alt=media&token=..."
  }
}
The flyerUrl value is a Firebase Storage download URL. The storage path used is always flyerTaller/flyer_actual, so each upload overwrites the previous file and keeps storage usage minimal.

Admin: changing the flyer

The FAB to change the flyer (fabCambiarFlyer) is only visible when esAdmin = true for the currently signed-in user. The flag is read from Usuarios/{uid}/esAdmin in Realtime Database during checkUserRole() on activity start. Non-admin users see a read-only view with no FAB.
When an admin taps the FAB, a PopupMenu offers two upload sources:

Cámara

Requests camera (and, on Android 12 and below, storage write) permissions. Captures a new photo, saves it to MediaStore, and uploads it to Firebase Storage.

Galería

Opens the device gallery via Intent.ACTION_PICK. The selected image is uploaded directly to Firebase Storage without saving a local copy.

Update sequence

1

Upload to Storage

The image file is written to the flyerTaller/flyer_actual path in Firebase Storage. A progress dialog is shown while the upload is in progress.
2

Update Realtime Database

On upload success, the Storage download URL is written to TallerInfo/flyerUrl in Realtime Database, replacing the previous URL.
3

Broadcast push notification

Immediately after the database write succeeds, FcmUtil.enviarNotificacionATodos sends a OneSignal broadcast to all app users:
Title:  ¡Nuevo Taller Disponible!
Body:   Se ha abierto un nuevo taller. ¡Entra para ver los detalles!
Customers who receive the push notification can tap it to open the app and navigate directly to TallerActivity to see the new flyer.

Build docs developers (and LLMs) love