skip to Main Content

I’ve scoured Google but can’t seem to fin the solution.

Essentially I’m trying to find an example of what is said in the title. Users in my app create cards containing event data and can then invite friends to share the card on their homepage.

The "Creator" (all users can be Creators) is the person who originally made the event and is sharing the Card. only they can see their Card firstly and can edit it.

"Attendees" are those attending the event and are invited by the user. They can not edit the card but can interact with some buttons on it like an "add to calendar" option and a voting system I’m working on.

As its my first time using Firebase, I want to make sure I’m doing things correctly and be able to troubleshoot myself, but despite going through the documentation and researching the last 3 days, I can’t find anything specific to this or similar that I can learn from.

I basically need to know whether the Roles approach is suitable in this case and also could do with an example of "inviting" friends to events and how this would appear between Flutter and Firebase.

I have so far been through the Firebase documentation, scoured Google and YouTube, I checked on Reddit too but couldn’t find what I needed.

I think either the way I’m describing it is incorrect or I am thinking about it the wrong way.

EDIT: Just to be clear my issue isn’t with understanding the logic, but with needing an example. I learn better visually with this stuff and struggle to grasp topics without seeing someone do something similar.

Also, here is an image with the current Firestore data for events.

enter image description here

3

Answers


  1. Create two custom roles: Creator and Attendee.
    The Creator role can create, edit, and invite attendees to events.
    The Attendee role can view events they have been invited to.
    Use Firebase Cloud Functions to send an email or push notification to attendees with a link to the event card.

    Login or Signup to reply.
  2. I will explain logically what I caught,

    • Decide on the structure of your Firebase Realtime Database or Firestore, depending on which one you prefer to use. You’ll need to store data related to the cards and user invites.
    • When a user creates a new card or wants to share an existing card, store the card’s data in the Firebase database under the user’s unique identifier. You can also store some additional metadata like the shared status and invitees.
    • Add a button or action in the card interface to allow users to invite others to share the card.
    • When the user clicks on the invite button, you can display a dialog or a screen where they can enter the email addresses or phone numbers of the people they want to invite.
    • Upon entering the email addresses or phone numbers, your app should send the invites to those recipients.
    • Use Firebase Cloud Functions or a server-side script to handle the invitation process. This script can send emails or push notifications to the invitees with a link to view the shared card.
    • When the invitees receive the invitation, the link should direct them to your app with a unique invitation code or deep link. Your app should handle the incoming invitation code and navigate to the card-sharing screen.
    • In your Firebase database, track the status of the invitations, such as whether they have been accepted or declined.

    Remember to thoroughly test the feature to ensure it works as expected and handle any error cases gracefully. Also, always keep security and privacy in mind when dealing with user data and sharing features.

    Login or Signup to reply.
  3. Try this code:

    import'package:firebase_database/firebase_database.dart';
    class EventRepository {
      final FirebaseDatabase _database = FirebaseDatabase.instance;
      Future<void> inviteAttendee(String eventId, String attendeeId) async {
        // Get the event from Firebase.
        var eventRef = _database.ref('events/$eventId');
        var event = await eventRef.get();
        // Add the attendee to the event's attendeeIds list.event.child('attendeeIds').push(attendeeId);
        // Save the event to Firebase.
        await eventRef.update(event.data());
        // Send the attendee an invitation notification.
        var notificationRef = _database.ref('notifications/$attendeeId');
        notificationRef.push({
          'type': 'event_invitation',
          'eventId': eventId,
        });
      }
    }
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search