NeoDay Android SDK - Reward Shop
The NeoDaySDK
factory methods are executed asynchronously in order to fetch the data and return a NeoDayViewController
.
/**
* @param completion returns NeoDayViewController or an ExceptionException
*/
fun makeRewardShop(completion: (Result<NeoDayViewController>) -> Unit)
/**
* @param completion returns NeoDayViewController or an ExceptionException
*/
fun makeRewardShopOrderHistory(completion: (Result<NeoDayViewController>) -> Unit)
Directly requesting a Reward Shop screen
val vc = remember { mutableStateOf<NeoDayViewController?>(null) }
neoDaySDK.makeRewardShop { result ->
try {
vc.value = result.getOrThrow()
} catch (ex: Exception) {
ex.printStackTrace()
}
}
vc.value?.getView()?.invoke()
Directly requesting a Reward Shop Order History screen
val vc = remember { mutableStateOf<NeoDayViewController?>(null) }
neoDaySDK.makeRewardShopOrderHistory { result ->
try {
vc.value = result.getOrThrow()
} catch (ex: Exception) {
ex.printStackTrace()
}
}
vc.value?.getView()?.invoke()
Directly requesting a Reward Shop Cart screen
// Since NeoDaySDK 1.16.6
val vc = remember { mutableStateOf<NeoDayViewController?>(null) }
neoDaySDK.makeRewardShop(RewardShopAction.ShowCart) { result ->
try {
vc.value = result.getOrThrow()
} catch (ex: Exception) {
ex.printStackTrace()
}
}
vc.value?.getView()?.invoke()
Directly requesting a Reward Shop Product Detail screen
// Since NeoDaySDK 1.16.6
val vc = remember { mutableStateOf<NeoDayViewController?>(null) }
neoDaySDK.makeRewardShop(RewardShopAction.ShowProductDetail(<productId>)) { result ->
try {
vc.value = result.getOrThrow()
} catch (ex: Exception) {
ex.printStackTrace()
}
}
vc.value?.getView()?.invoke()
Navigating to Reward Shop Cart using an existing Reward Shop ViewController
// Since NeoDaySDK 1.16.6
viewModel.rewardShopViewController.value?.getView()?.invoke()
LaunchedEffect(action) {
neoDaySDK.executeRewardShopAction(RewardShopAction.ShowCart)
}
Navigating to Reward Shop Product Detail using an existing Reward Shop ViewController
// Since NeoDaySDK 1.16.6
viewModel.rewardShopViewController.value?.getView()?.invoke()
LaunchedEffect(action) {
neoDaySDK.executeRewardShopAction(RewardShopAction.ShowProductDetail(<productId>))
}
Applying DismissalStyle.Back to the Reward Shop
// Since NeoDaySDK 2.1.5
if (viewController is RewardShopDismissStyling) {
viewController.dismissalStyle = DismissalStyle.Back
}
Applying DismissalStyle.Close to the Reward Shop
// Since NeoDaySDK 2.1.5
if (viewController is RewardShopDismissStyling) {
viewController.dismissalStyle = DismissalStyle.Close
}
Applying DismissalStyle.None to the Reward Shop
// Since NeoDaySDK 2.1.5
if (viewController is RewardShopDismissStyling) {
viewController.dismissalStyle = DismissalStyle.None
}