BPVA Calendar App - Changelog
Account Linking Implementation (October 2025)
✅ Completed Features
Manual Account Linking System
- Implemented
AccountLinkingServicefor Firestore-based account linking - Support for linking Apple and Google accounts with different email addresses
- Enabled “Hide My Email” compatibility for Apple Sign-In
- Created bidirectional lookup system:
users/{uid}/linkedAccounts/{provider}- User’s linked accountsaccount_links/{appleUserId}- Reverse lookup for Apple user IDs
Authentication Flow
- Primary Account: First sign-in method (Google or Apple)
- Secondary Account: Can be linked later with different email
- Google Calendar Access: Maintained regardless of sign-in method
- App Store Compliance: Apple Sign-In fully functional
Firestore Security Rules
- User Documents: Users can read/write their own profile and linked accounts
- Account Links: Users can create/update links they own (verified by
primaryFirebaseUid) - Privacy: Each user can only access their own linking data
🗑️ Removed Features
Debug/Test Code (No Longer Needed)
- Removed “Test Apple Sign-In” button from admin profile
- Removed “Debug Apple Sign-In” diagnostics button
- Deleted
testAppleSignIn()method fromAuthService - Deleted
checkAppleSignInStatus()method fromAuthService
Obsolete Documentation
apple-key-confusion-explained.md- JWT debugging docsapple-signin-issue-summary.md- Firebase linking issue analysisfirebase-config-diagnostic.md- Configuration troubleshootingipad-testing-guide.md- Initial testing notesipad-testing-session-summary.md- Session notes
📝 Updated Documentation
Kept & Updated
apple-signin-setup.md- Apple Developer Console configurationfirebase-apple-signin-setup.md- Firebase Console setupmanual-account-linking.md- Architecture and implementation detailsQUICK_START_MANUAL_LINKING.md- Developer implementation guideREADME.md- Updated with authentication features section
🔧 Technical Changes
Code Modifications
- auth_service.dart
- Added
AccountLinkingServiceimport - Replaced Firebase
linkWithCredential()with manual linking - Updated
unlinkAccount()to use manual unlinking - Added Firestore data loading in
loadUserProfile()andrefreshUserProfile() - Removed test/debug methods
- Added
- firestore.rules
- Added
account_linkscollection rules - Added
users/{userId}/linkedAccountssubcollection support (not used, but safe) - Fixed field name from
primaryUidtoprimaryFirebaseUid
- Added
- admin_my_profile_screen.dart
- Removed test/debug UI buttons
- Removed test dialog methods
- Kept only production linking functionality
🎯 Key Benefits
- Reliability: Manual linking via Firestore avoids Firebase SDK bugs
- Flexibility: Emails don’t need to match between Google and Apple accounts
- Privacy: Supports Apple’s “Hide My Email” feature
- Compliance: Meets App Store requirements for Apple Sign-In
- Maintainability: Clean, well-documented implementation
📱 User Experience
- Users sign in with Google (for Calendar access)
- Users can link their Apple ID from Admin Profile
- After linking, users can sign in with either method
- Unlinking is supported and properly cleans up Firestore data
- Linked accounts persist across app restarts
🔐 Security
- All linking operations verify user ownership
- Firestore rules prevent unauthorized access
- Primary Firebase UID controls data access
- Account links are user-specific and private
Status: Production-ready ✅
Tested: iPad (iOS 18.7), Manual linking works perfectly
Deployed: Firestore rules updated and deployed