Summary of the functions and features used across the various hooks and components so far - abhiram-shaji/Langroove GitHub Wiki

1. Authentication Management

  • Login and Sign-Up:

    • useLogin: Handles user login using Firebase Authentication, manages loading state, and navigates to different screens based on login status.
    • useSignUp: Manages user registration, including form validation, creating a user account, and storing user details in Firestore.
  • Logout:

    • useLogout: Handles user sign-out and navigation back to the login screen.

2. User Profile and Friends Management

  • Friend List:
    • useFriendList: Fetches the current user's friends from Firestore, allowing for searching and filtering friends based on a search term.

3. Chat Functionality

  • Chat List:

    • useChatList: Retrieves and filters the user's chat list, including real-time updates from Firestore.
  • Individual Chat Management:

    • useChat: Manages individual chat conversations, including sending messages and fetching chat history. This involves:
      • Real-time updates for messages.
      • Sending messages and updating chat metadata (like last message and participants).

4. Data Management with Firestore

  • Real-Time Updates:

    • onSnapshot: Listens for real-time changes in Firestore collections, allowing the app to respond to new data instantly.
  • CRUD Operations:

    • addDoc: Adds new documents (e.g., messages) to Firestore.
    • setDoc: Creates or updates documents in Firestore, used for chat metadata.
    • getDoc: Fetches specific documents from Firestore, used for retrieving user and friend details.

5. State Management

  • useState: Used extensively for managing local component states, such as current messages, loading states, errors, and search terms.

6. Effects Management

  • useEffect: Used to handle side effects, such as fetching data when components mount or when dependencies change (e.g., user login status or recipient changes).

7. Navigation

  • React Navigation:
    • Integration with React Navigation for navigating between different screens (e.g., switching between login, sign-up, and main app screens).
    • useNavigation: Hook to programmatically navigate between screens.

8. User Interface Elements

  • Loading Indicators and Alerts:
    • Use of loading states and alerts to provide feedback to users during authentication processes and data fetching.