MichielProost / Perfect-Plate

This Android application allows cheffs around the world to create, review and discover new recipes. Users can gain experience and level up in this app by completing challenges like creating a certain amount of recipes.
1 stars 2 forks source link

Feed breaks when user is not logged in. #26

Closed MichielProost closed 3 years ago

MichielProost commented 3 years ago

When a "not logged-in" user goes to the feed, an error pops up. "The getter .index was called on null" This happens in the method "searchRecipes". Somewhere in the UI, we pass the language variable as null (I think, I'm not sure). I'm out of time for today. I will look at this tomorrow. Perhaps you know the solution Dieter?

Nuytemans-Dieter commented 3 years ago

It used to be a different error, regarding a missing index. This changed due to now loading feed recipes based on user language, for an offline user we had not set a default language. That's why I wanted to go for default initialisation instead of defaulting everything to null. Fixed this in 12d298f6ff7a20c1996e2d8bb92e6b26c6d02500 though.

Now I am getting this error:

Exception has occurred. PlatformException (PlatformException(Error performing getDocuments, FAILED_PRECONDITION: The query requires an index. You can create it here: https://console.firebase.google.com/v1/r/project/recipeapplication-4a7e1/firestore/indexes?create_composite=Cldwcm9qZWN0cy9yZWNpcGVhcHBsaWNhdGlvbi00YTdlMS9kYXRhYmFzZXMvKGRlZmF1bHQpL2NvbGxlY3Rpb25Hcm91cHMvcmVjaXBlcy9pbmRleGVzL18QARoKCgZpc051bGwQARoMCghsYW5ndWFnZRABGhIKDndlaWdodGVkUmF0aW5nEAIaDAoIX19uYW1lX18QAg, null))

MichielProost commented 3 years ago

Fixed the error. RecipeTypePreference and DietFieldPreference were null. I've set languageTypePreference to "other". The user will see English & Dutch recipes in his or her feed. Only English recipes seemed odd. The user can make use of the search bar to filter the recipes to English OR Dutch. What do you think? We can easily set it back to English if you don't like it? @Nuytemans-Dieter

You can close the issue after your comment.

Nuytemans-Dieter commented 3 years ago

Fixed the error. RecipeTypePreference and DietFieldPreference were null. I've set languageTypePreference to "other". The user will see English & Dutch recipes in his or her feed. Only English recipes seemed odd. The user can make use of the search bar to filter the recipes to English OR Dutch. What do you think? We can easily set it back to English if you don't like it? @Nuytemans-Dieter

You can close the issue after your comment.

Dutch and English is great for Dutch people but weird for other countries so it seems more logical to go with English only by default. @MichielProost Perhaps you see additional benefits or use-cases for defaulting to any?

MichielProost commented 3 years ago

Let's go for English. I'm coding at the moment. I'll change it back to English