Skip to content

Commit

Permalink
Merge pull request #256 from Automattic/update/enable-free-trial-feat…
Browse files Browse the repository at this point in the history
…ure-flag

Update/enable free trial feature flag
  • Loading branch information
ashiagr authored Aug 22, 2022
2 parents 0c746b7 + 9a321fa commit 5583fa7
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 16 deletions.
2 changes: 0 additions & 2 deletions base.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@ android {
buildConfigField "String", "SETTINGS_ENCRYPT_SECRET", "\"${project.properties["pocketcastsSettingsEncryptSecret"] ?: ""}\""
buildConfigField "String", "SHARING_SERVER_SECRET", "\"${project.properties["pocketcastsSharingServerSecret"] ?: ""}\""

buildConfigField "boolean", "ENABLE_FREE_TRIAL", "false"

testInstrumentationRunner project.testInstrumentationRunner
testApplicationId "au.com.shiftyjelly.pocketcasts.test" + project.name.replace("-", "_")
vectorDrawables.useSupportLibrary = true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ interface SubscriptionManager {
const val PLUS_PRODUCT_BASE = "com.pocketcasts.plus"
const val MONTHLY_PRODUCT_ID = "$PLUS_PRODUCT_BASE.monthly"
const val YEARLY_PRODUCT_ID = "$PLUS_PRODUCT_BASE.yearly"
const val TEST_FREE_TRIAL_PRODUCT_ID = "$PLUS_PRODUCT_BASE.testfreetrialoffer"
}

fun signOut()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,8 @@ import au.com.shiftyjelly.pocketcasts.models.type.SubscriptionPlatform
import au.com.shiftyjelly.pocketcasts.models.type.SubscriptionPricingPhase
import au.com.shiftyjelly.pocketcasts.models.type.SubscriptionType
import au.com.shiftyjelly.pocketcasts.preferences.Settings
import au.com.shiftyjelly.pocketcasts.repositories.BuildConfig
import au.com.shiftyjelly.pocketcasts.repositories.subscription.SubscriptionManager.Companion.MONTHLY_PRODUCT_ID
import au.com.shiftyjelly.pocketcasts.repositories.subscription.SubscriptionManager.Companion.PLUS_PRODUCT_BASE
import au.com.shiftyjelly.pocketcasts.repositories.subscription.SubscriptionManager.Companion.TEST_FREE_TRIAL_PRODUCT_ID
import au.com.shiftyjelly.pocketcasts.repositories.subscription.SubscriptionManager.Companion.YEARLY_PRODUCT_ID
import au.com.shiftyjelly.pocketcasts.servers.sync.SubscriptionPurchaseRequest
import au.com.shiftyjelly.pocketcasts.servers.sync.SubscriptionResponse
Expand Down Expand Up @@ -158,16 +156,7 @@ class SubscriptionManagerImpl @Inject constructor(private val syncServerManager:
.setProductId(YEARLY_PRODUCT_ID)
.setProductType(BillingClient.ProductType.SUBS)
.build(),
).apply {
if (isFreeTrialEligible()) {
add(
QueryProductDetailsParams.Product.newBuilder()
.setProductId(TEST_FREE_TRIAL_PRODUCT_ID)
.setProductType(BillingClient.ProductType.SUBS)
.build()
)
}
}
)

val params = QueryProductDetailsParams.newBuilder()
.setProductList(productList)
Expand Down Expand Up @@ -343,7 +332,7 @@ class SubscriptionManagerImpl @Inject constructor(private val syncServerManager:
subscriptionStatus.accept(Optional.empty())
}

override fun isFreeTrialEligible() = freeTrialEligible && BuildConfig.ENABLE_FREE_TRIAL
override fun isFreeTrialEligible() = freeTrialEligible

override fun updateFreeTrialEligible(eligible: Boolean) {
freeTrialEligible = eligible
Expand Down

0 comments on commit 5583fa7

Please sign in to comment.