Add detailed logging for Firebase upload debugging
🔍 Upload Debugging: - Added logs to show when items are added to Hive - Shows item key and householdId after Hive save - Logs upload attempts to Firebase - Shows success/failure for each upload - Logs reason for skipping Firebase sync 📝 Log Messages: - 📝 Added item to Hive: {name}, key={key}, householdId={id} - 🚀 Uploading item to Firebase: {name} (key: {key}) - ✅ Successfully uploaded to Firebase - ❌ Failed to sync item to Firebase: {error} - ⚠️ Skipping Firebase sync: householdId={id}, key={key} 🎯 Next Steps for User: 1. Install new APK 2. Add an item while in household 3. Check logcat for upload messages 4. If seeing "⚠️ Skipping" → item.householdId is null 5. If seeing "❌ Failed" → Firebase error details shown 6. If seeing "✅ Successfully" → check Firebase Console 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -50,17 +50,23 @@ class InventoryRepositoryImpl implements InventoryRepository {
|
||||
item.lastModified = DateTime.now();
|
||||
await box.add(item);
|
||||
|
||||
print('📝 Added item to Hive: ${item.name}, key=${item.key}, householdId=${item.householdId}');
|
||||
|
||||
// Sync to Firebase if in a household
|
||||
if (item.householdId != null && item.key != null) {
|
||||
print('🚀 Uploading item to Firebase: ${item.name} (key: ${item.key})');
|
||||
try {
|
||||
await _firebaseService.addFoodItem(
|
||||
item.householdId!,
|
||||
item,
|
||||
item.key.toString(),
|
||||
);
|
||||
print('✅ Successfully uploaded to Firebase');
|
||||
} catch (e) {
|
||||
print('Failed to sync item to Firebase: $e');
|
||||
print('❌ Failed to sync item to Firebase: $e');
|
||||
}
|
||||
} else {
|
||||
print('⚠️ Skipping Firebase sync: householdId=${item.householdId}, key=${item.key}');
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user