User customisation
Mealz can provide a personalized experience for customers. To achieve this we propose two solutions:
- Preferences: Locally stored Actionable without customer consent by the retailer
- Profiling : Back hosted tastes Can be disabled by the customer
These two solutions are GDPR-compliant
Preferences
Our preferences feature uses the native IOS local storage for persistence.
import MealziOSSDK
import MealzUIiOSSDK
// inside MealzViewConfig
static let catalogConfig = CatalogFeatureConstructor(
usesPreferences: true, // set this to true
// when creating Feature
// feature = MealzCatalogFeatureSwiftUI( // <--- for SwiftUI
feature = MealzCatalogFeatureUIKit(
catalogFeatureConstructor: MealzViewConfig.catalogConfig, // <--- this is what we add
)
Profiling
Mealz offers your customers a fully personalized experience based on their tastes. Our AI will learn from the customer's choices and suggest more and more specific recipes and product.
This feature can be disabled by the customer if they wish.
To do this, we expose this function:
// file MealzManager.swift
import mealzcore
public class MealzManager {
// allow profiling -> can we use your personal data to provide custom recipes?
Mealz.shared.user.setProfilingAllowance(allowance: true)
}
Like recipe
You can disable the Like feature as well
// file MealzManager.swift
import mealzcore
public class MealzManager {
// allow users to heart recipes
Mealz.shared.user.setEnableLike(isEnable: true)
}
The like feature will be set to TRUE by default
AuthLess
AuthLess mode allows Mealz to create an anonymous user and to find previous lists of non-connected users. Once the user connects to your app Mealz will merge anonymous user into the connected user.
You can enable AuthLess feature in mealz initialisation
public class MealzManager: ObservableObject {
public static let sharedInstance = MealzManager()
private init() {
Mealz.shared.Core(init: { coreBuilder in
coreBuilder.sdkRequirement(init: { requirementBuilder in
requirementBuilder.key = key
})
coreBuilder.option(init: { config in
config.isAnonymousModeEnabled = true
})
})
}
}
isAnonymousModeEnabled is defaulted to false
You can also provide Mealz a redirection function to your login page. We will use this function when connecting the user connection becomes mandatory, like adding the products to the basket. Even without supporting anonymous users, we can display Mealz Recipes on your apps, with CTAs requiring a user sign in.
public class MealzManager: ObservableObject {
public static let sharedInstance = MealzManager()
private init() {
// set the redirection when the user has not selected a store
Mealz.shared.user.setSignInRedirection { yourFunctionToSignInUser() }
Mealz.shared.Core(init: { coreBuilder in
coreBuilder.sdkRequirement(init: { requirementBuilder in
requirementBuilder.key = key
})
coreBuilder.option(init: { config in
// redirection work only if authless is disable
config.isAnonymousModeEnabled = false
})
})
}
}
if isAnonymousModeEnabled is set to true Mealz will never call your redirection function
Get Price Or Redirect
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, we provide a method that can fetch a price of a recipe, & if the store is not selected yet, redirect to the Store Selector. This is ideal when you have your own external Recipes that are not generated by Mealz (yet shared with us).
import mealzcore
let price = try await Mealz.shared.recipe.getPriceOrRedirect(recipeId: recipeId, numberOfGuest: 4).await()
let priceOfRecipe = price as? Double ?? 0