Skip to content
This repository has been archived by the owner on May 6, 2024. It is now read-only.

Commit

Permalink
feat: Hide upgrade button if course SKU is not available (#1763)
Browse files Browse the repository at this point in the history
Fixes: LEARNER-9285
  • Loading branch information
HamzaIsrar12 authored Mar 21, 2023
1 parent 9f74949 commit c71282d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,9 @@ class CourseUnitMobileNotSupportedFragment : CourseUnitFragment() {
private fun showGradedContent() {
unit?.let { unit ->
val isSelfPaced = getBooleanArgument(Router.EXTRA_IS_SELF_PACED, false)
val isPurchaseEnabled = unit.courseSku.isNullOrEmpty().not() &&
environment.appFeaturesPrefs.isIAPEnabled(environment.loginPrefs.isOddUserId)

binding.containerLayoutNotAvailable.setVisibility(false)
binding.llGradedContentLayout.setVisibility(true)
var experimentGroup: String? = null
Expand All @@ -94,7 +97,7 @@ class CourseUnitMobileNotSupportedFragment : CourseUnitFragment() {
experimentGroup,
unit.id
)
if (environment.appFeaturesPrefs.isIAPEnabled(environment.loginPrefs.isOddUserId)) {
if (isPurchaseEnabled) {
iapAnalytics.initCourseValues(
courseId = unit.courseId,
isSelfPaced = isSelfPaced,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,9 @@ class CourseModalDialogFragment : DialogFragment() {
KEY_COURSE_NAME,
arguments?.getString(KEY_COURSE_NAME)
)
val isPurchaseEnabled =
environment.appFeaturesPrefs.isIAPEnabled(environment.loginPrefs.isOddUserId)
val isPurchaseEnabled = courseSku.isNullOrEmpty().not() &&
environment.appFeaturesPrefs.isIAPEnabled(environment.loginPrefs.isOddUserId)

binding.layoutUpgradeBtn.root.setVisibility(isPurchaseEnabled)
binding.dialogDismiss.setOnClickListener {
dialog?.dismiss()
Expand Down

0 comments on commit c71282d

Please sign in to comment.