Store Configuration
Set Price Book
To set the price book, you can use this code:
import ai.mealz.core.Mealz
Mealz.basket.setPriceBook(priceBookId: pricebook.rawValue)
Set Store
For Mealz to work properly, a store is mandatory. Without a store, we cannot generate a Recipe price, see the products, or purchase anything.
However, Recipe Cards, & our catalog, CAN be shown without a store. When the user clicks on a Recipe Card, we prompt the user to select a store. You must pass in a function for us to navigate to your Store Selector.
import ai.mealz.core.Mealz
object MealzManager {
private var isInitialized = false
public fun initialize(applicationContext: Context) {
Mealz.user.setStoreLocatorRedirection { /** Your select store navigation method */ }
Mealz.Core {
sdkRequirement {
key = supplierKey
context = applicationContext
}
}
isInitialized = true
}
}
Force Store Update Callback
When using our SDK without a store, your users will be prompted by the "Select a Store" page.
Occasionally, they will decline this popup.
To prevent infinite loading or empty views that are blocked due to the user being storeless, we have created a function SetForceStoreUpdateCallback.
This function should navigate the user back to a certain page or a simple "return" to leave the current Mealz view they clicked.
Mealz.environment.setForceStoreUpdateCallBack { }