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 section shows a single full-width flyer image to every user of the app. When a new workshop is scheduled, an admin replaces that flyer with an updated image. The upload can be triggered from two places in the app, and both paths automatically fire a broadcast push notification to all users via OneSignal as soon as the new URL is saved to Realtime Database.

How to update the workshop flyer

Option 1 — From the Admin tab

1

Open the Admin tab in Cuenta

Navigate to Cuenta and tap the Admin tab.
2

Tap 'Cambiar Flyer'

Scroll to the Taller section at the bottom of the Admin tab and tap the Cambiar Flyer button. A pop-up menu appears with two choices: Cámara and Galería.
3

Select the new image

Choose Cámara to take a photo on the spot, or Galería to pick an existing image from the device. The app requests the necessary permissions automatically if they have not been granted yet.
4

Wait for the upload to complete

A progress dialog shows first “Subiendo Imagen del Taller” and then “Actualizando Base de Datos”. When both steps finish, a toast confirms “Flyer actualizado correctamente” and the push notification is sent.

Option 2 — From TallerActivity

Admins also see a floating action button (FAB) directly on the workshop screen. The FAB is hidden for regular users — its visibility is determined at runtime:
private fun checkUserRole() {
    val uid = firebaseAuth.uid ?: return
    FirebaseDatabase.getInstance().getReference("Usuarios")
        .child(uid).child("esAdmin").get().addOnSuccessListener { snapshot ->
            val esAdmin = snapshot.getValue(Boolean::class.java) ?: false
            fabCambiarFlyer.visibility = if (esAdmin) View.VISIBLE else View.GONE
        }
}
Tapping the FAB opens the same camera/gallery pop-up menu and follows the identical upload flow.

Storage and database paths

The image is uploaded to Firebase Storage at a fixed path:
flyerTaller/flyer_actual
After a successful upload, the download URL is written to Realtime Database:
FirebaseDatabase.getInstance().getReference("TallerInfo")
    .child("flyerUrl").setValue(url)
The resulting database structure is:
{
  "TallerInfo": {
    "flyerUrl": "https://firebasestorage.googleapis.com/..."
  }
}
There is only one active flyer at a time. Because every upload uses the same Storage path (flyerTaller/flyer_actual), the new image overwrites the previous file automatically. The old image is not retained in Storage.

Automatic push notification

Immediately after flyerUrl is saved, FcmUtil.enviarNotificacionATodos() is called targeting the “All” OneSignal segment. Both upload paths use the same notification title but their body strings differ slightly depending on where the upload originates. From TallerActivity (FAB):
com.example.applacasadelbordadito.notificaciones.FcmUtil.enviarNotificacionATodos(
    "¡Nuevo Taller Disponible!",
    "Se ha abierto un nuevo taller. ¡Entra para ver los detalles!"
)
From the Admin tab (FragmentCuenta):
com.example.applacasadelbordadito.notificaciones.FcmUtil.enviarNotificacionATodos(
    "¡Nuevo Taller Disponible!",
    "Se ha abierto un nuevo taller de bordado. ¡Revisa la información!"
)
Under the hood, this sends a POST request to https://api.onesignal.com/notifications with included_segments: ["All"], so every user who has granted notification permission receives the alert at the same moment.
Use a high-resolution portrait image (e.g., 800 × 1200 px) for the flyer. The ImageView in TallerActivity stretches to fill the full screen width, so a taller image gives customers the most detail without cropping.

Build docs developers (and LLMs) love