Enhancing Firebase Authentication and Firestore Integration

WEEK 7

Felipe de Souza

10/20/2025

Refactoring Google Sign-In Logic & Firestore Integration

This week’s focus was on improving the authentication workflow for our LifeLeveling app. I refactored the Google Sign-In logic that we created last week and divided it into two separate branches for better organization and scalability. The first branch, Auth-Google-Signin, introduced the AuthViewModel.kt, which now cleanly handles all Firebase authentication logic — from initializing the Google client, handling sign-in results, managing state updates, and logging health checks to Firestore.

The second branch, Firestore-Models, was dedicated to structuring our Firestore interactions. I created two new files — FirestoreModels.kt and FirestoreRepository.kt. The Users data class defines the schema for user information such as displayName, email, and in-app stats, while FirestoreRepository.kt ensures a user document is created and merged safely in Firestore using idempotent operations. This modular approach not only cleaned up our logic but also set a strong foundation for future expansions like profile stats tracking and daily streaks.

Unfortunately, midway through the week I came down with a cold, which slowed my progress. Initially, I felt like a burden to the team for not completing everything I had committed to in our Sprint 3 plan. However, hearing a teammate mention that my earlier work had helped her kick off her own tasks completely changed my perspective. It reminded me that even partial progress can have a ripple effect in teamwork.

During our sprint review, we also discovered an authentication inconsistency: the SHA1/SHA256 keys registered in Firebase were only tied to my local machine. This caused other teammates to experience login issues I wasn’t seeing. To fix this, we gathered everyone’s unique keys and added them to the Firebase project. We then updated the google-services.json file across all devices to keep the app configurations aligned. Moving forward, we’re discussing whether to unify under a shared team key or transition to a release key through Google Play Services.

Despite the setbacks, this week reinforced the importance of teamwork, adaptability, and writing maintainable code. It might not have been my most productive week in terms of commits, but it was one of the most meaningful in terms of collaboration and problem-solving.

Gallery