diff --git a/core/src/main/java/org/openedx/core/presentation/IAPAnalytics.kt b/core/src/main/java/org/openedx/core/presentation/IAPAnalytics.kt index 475c7934d..78587e978 100644 --- a/core/src/main/java/org/openedx/core/presentation/IAPAnalytics.kt +++ b/core/src/main/java/org/openedx/core/presentation/IAPAnalytics.kt @@ -48,7 +48,7 @@ enum class IAPAnalyticsEvent(val eventName: String, val biValue: String) { "Payments: Restore Purchases Clicked", "edx.bi.app.payments.restore_purchases.clicked" ), - PAYMENTS_VALUE_PROP_VIEWED( + IAP_VALUE_PROP_VIEWED( "Payments: Value Prop Viewed", "edx.bi.app.payments.value_prop.viewed" ) diff --git a/core/src/main/java/org/openedx/core/presentation/dialog/IAPDialogFragment.kt b/core/src/main/java/org/openedx/core/presentation/dialog/IAPDialogFragment.kt index f5d24b655..8a1ff2b6a 100644 --- a/core/src/main/java/org/openedx/core/presentation/dialog/IAPDialogFragment.kt +++ b/core/src/main/java/org/openedx/core/presentation/dialog/IAPDialogFragment.kt @@ -74,7 +74,7 @@ class IAPDialogFragment : DialogFragment() { val isFullScreenLoader = (iapState as? IAPUIState.Loading)?.loaderType == IAPLoaderType.FULL_SCREEN - + isCancelable = !isFullScreenLoader Scaffold( modifier = Modifier.fillMaxSize(), backgroundColor = MaterialTheme.appColors.background, diff --git a/core/src/main/java/org/openedx/core/presentation/iap/IAPViewModel.kt b/core/src/main/java/org/openedx/core/presentation/iap/IAPViewModel.kt index 39e002063..618bb75e9 100644 --- a/core/src/main/java/org/openedx/core/presentation/iap/IAPViewModel.kt +++ b/core/src/main/java/org/openedx/core/presentation/iap/IAPViewModel.kt @@ -338,8 +338,8 @@ class IAPViewModel( }.toMutableMap()) } - private fun incorporateIAPEventParams(params: MutableMap = mutableMapOf()): MutableMap { - return params.apply { + private fun getIAPEventParams(): MutableMap { + return buildMap { purchaseFlowData.takeIf { it.courseId.isNullOrBlank().not() }?.let { put(IAPAnalyticsKeys.COURSE_ID.key, purchaseFlowData.courseId) put( @@ -360,36 +360,34 @@ class IAPViewModel( put(IAPAnalyticsKeys.COMPONENT_ID.key, componentId) } put(IAPAnalyticsKeys.CATEGORY.key, IAPAnalyticsKeys.IN_APP_PURCHASES.key) - } + }.toMutableMap() } private fun logIAPEvent( event: IAPAnalyticsEvent, params: MutableMap = mutableMapOf(), ) { + params.apply { + put(IAPAnalyticsKeys.NAME.key, event.biValue) + putAll(getIAPEventParams()) + } analytics.logIAPEvent( event = event, - params = incorporateIAPEventParams(params.apply { - put( - IAPAnalyticsKeys.NAME.key, - event.biValue - ) - }), + params = params, screenName = purchaseFlowData.screenName.orEmpty() ) } private fun loadIAPScreenEvent() { - val event = IAPAnalyticsEvent.PAYMENTS_VALUE_PROP_VIEWED - analytics.logScreenEvent( - screenName = event.eventName, - params = incorporateIAPEventParams(buildMap { - put(IAPAnalyticsKeys.NAME.key, event.biValue) - purchaseFlowData.screenName?.takeIfNotEmpty()?.let { screenName -> - put(IAPAnalyticsKeys.SCREEN_NAME.key, screenName) - } - }.toMutableMap()) - ) + val event = IAPAnalyticsEvent.IAP_VALUE_PROP_VIEWED + val params = buildMap { + put(IAPAnalyticsKeys.NAME.key, event.biValue) + purchaseFlowData.screenName?.takeIfNotEmpty()?.let { screenName -> + put(IAPAnalyticsKeys.SCREEN_NAME.key, screenName) + } + putAll(getIAPEventParams()) + } + analytics.logScreenEvent(screenName = event.eventName, params = params) } fun clearIAPFLow() { diff --git a/core/src/main/java/org/openedx/core/ui/IAPUI.kt b/core/src/main/java/org/openedx/core/ui/IAPUI.kt index e84b5be13..e6a0b4ac1 100644 --- a/core/src/main/java/org/openedx/core/ui/IAPUI.kt +++ b/core/src/main/java/org/openedx/core/ui/IAPUI.kt @@ -23,6 +23,7 @@ import androidx.compose.ui.text.style.TextOverflow import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp import androidx.compose.ui.window.Dialog +import androidx.compose.ui.window.DialogProperties import org.openedx.core.R import org.openedx.core.exception.iap.IAPException import org.openedx.core.presentation.iap.IAPAction @@ -183,6 +184,7 @@ fun NoSkuErrorDialog( onClick = onConfirm ) }, + properties = DialogProperties(dismissOnBackPress = false, dismissOnClickOutside = false), onDismissRequest = {} ) } @@ -252,6 +254,7 @@ fun CourseAlreadyPurchasedExecuteErrorDialog( ) } }, + properties = DialogProperties(dismissOnBackPress = false, dismissOnClickOutside = false), onDismissRequest = {} ) } @@ -302,13 +305,17 @@ fun UpgradeErrorDialog( onClick = onDismiss ) }, + properties = DialogProperties(dismissOnBackPress = false, dismissOnClickOutside = false), onDismissRequest = {} ) } @Composable fun CheckingPurchasesDialog() { - Dialog(onDismissRequest = {}) { + Dialog( + properties = DialogProperties(dismissOnBackPress = false, dismissOnClickOutside = false), + onDismissRequest = {} + ) { Column( Modifier .padding(16.dp) @@ -372,6 +379,7 @@ fun FakePurchasesFulfillmentCompleted(onCancel: () -> Unit, onGetHelp: () -> Uni onClick = onGetHelp ) }, + properties = DialogProperties(dismissOnBackPress = false, dismissOnClickOutside = false), onDismissRequest = {} ) } @@ -415,6 +423,7 @@ fun PurchasesFulfillmentCompletedDialog(onConfirm: () -> Unit, onDismiss: () -> onClick = onDismiss ) }, + properties = DialogProperties(dismissOnBackPress = false, dismissOnClickOutside = false), onDismissRequest = {} ) } diff --git a/core/src/main/res/values-night/colors.xml b/core/src/openedx/org/res/values-night/colors.xml similarity index 100% rename from core/src/main/res/values-night/colors.xml rename to core/src/openedx/org/res/values-night/colors.xml diff --git a/core/src/main/res/values/colors.xml b/core/src/openedx/org/res/values/colors.xml similarity index 100% rename from core/src/main/res/values/colors.xml rename to core/src/openedx/org/res/values/colors.xml