MOBILE PROGRAMMING
Tutorial 10
Activity 01: Authenticated GitHub Repositories Dashboard
Build an application that allows users to sign in using their Google account (via
Firebase). Once authenticated, the app will use TanStack Query to fetch and
display a list of repositories from the GitHub API.
Objectives:
Firebase Auth: Implement GoogleAuthProvider.
TanStack Query: Manage data fetching, loading states, and error handling.
Target API: [Link]
Technical Requirements:
• Conditional Fetching: Only fetch the repository list once
onAuthStateChanged confirms the user is logged in.
• Unique Query Keys: Use the user's uid or email as part of the query key to
ensure the cache is account-specific.
• UX/UI: Display a Skeleton screen or a Spinner during the isLoading state.
• Session Cleanup: Implement a "Sign Out" function that triggers
[Link]() to wipe sensitive data from the cache.
Activity 02: Secure Personal "To-Do" Manager (Mock API)
In this activity, you will create a React Native application that implements
a personal task management app. You will use Firebase for Email/Password
authentication. After logging in, use TanStack Query to interact with the
JSONPlaceholder API to simulate real-world CRUD (Create, Read, Update,
Delete) operations.
Objectives:
Implement signInWithEmailAndPassword and
createUserWithEmailAndPassword.
TanStack Query: Use both useQuery (to fetch the list) and useMutation (to add
or delete tasks).
Target API:
• Fetch list: [Link] (Assume
each Firebase user maps to a specific userId on the mock API).
• Add task (Mutation): POST [Link]
Technical Requirements:
• Protected Routes: Prevent unauthenticated users from accessing the
Dashboard; redirect them to the Login page.
• State Synchronization: After a successful useMutation (adding a task), use
[Link] to automatically re-fetch the list without a
page reload.
• Global Error Handling: Use a Toast notification system to display errors if
Firebase authentication fails or the API returns an error.