Show tutorial the first time a user enters the food scanner screen
The recognition results from the sdk are divided into 4 cases:
1) If no results are returned from the recognition callback, show the scanning view below the viewfinder
2) If the results is a visual candidate, show the food name and the icon in the bottom sheet (the figma design has 2 names, but the SDK produces only one so we show the one). If the user pulls the bottom sheet up, the alternative list is displayed (again, the alternatives only have one name and the figma design doesn't take this into account).
To populate the list of alternatives we will use two different types of results: the list of detected candidates and the alternatives of the first detected candidate. The first detected candidate (the one with the highest confidence) is the main result that is show to the user. The alternatives are a list constructed as: other items in the list of detected candidates + alternatives of the first result.
If the user clicks on an alternative results we navigate to the Edit Food screen.
3) If the results is a product candidate, we fetch the full PassioFoodItem before displaying the item on the screen.
4) If the SDK produces a barcode or packaged food code, but we don't get a result for the nutritional data, we display the barcode not recognized screen.
Keep in mind that for visual scanning we don't have the full PassioFoodItem object, but for product codes we do. This means that when we navigate to the Edit Food screen or Log a visual food, we then do the networking call and complete the action.
Camera flow:
The recognition results from the sdk are divided into 4 cases: 1) If no results are returned from the recognition callback, show the scanning view below the viewfinder 2) If the results is a visual candidate, show the food name and the icon in the bottom sheet (the figma design has 2 names, but the SDK produces only one so we show the one). If the user pulls the bottom sheet up, the alternative list is displayed (again, the alternatives only have one name and the figma design doesn't take this into account).
To populate the list of alternatives we will use two different types of results: the list of detected candidates and the alternatives of the first detected candidate. The first detected candidate (the one with the highest confidence) is the main result that is show to the user. The alternatives are a list constructed as: other items in the list of detected candidates + alternatives of the first result.
If the user clicks on an alternative results we navigate to the Edit Food screen.
3) If the results is a product candidate, we fetch the full PassioFoodItem before displaying the item on the screen. 4) If the SDK produces a barcode or packaged food code, but we don't get a result for the nutritional data, we display the barcode not recognized screen.