diff --git a/CHANGELOG.md b/CHANGELOG.md index e02552b58..e324c530d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +## Plan [1.18.3] + +22 Nov, 2021 + +### Changes +- Provide plans for signup and upgrade flow separately + ## Network [1.16.0] 22 Nov, 2021 diff --git a/coreexample/src/main/kotlin/me/proton/android/core/coreexample/di/PlansModule.kt b/coreexample/src/main/kotlin/me/proton/android/core/coreexample/di/PlansModule.kt index 992f53048..32916db19 100644 --- a/coreexample/src/main/kotlin/me/proton/android/core/coreexample/di/PlansModule.kt +++ b/coreexample/src/main/kotlin/me/proton/android/core/coreexample/di/PlansModule.kt @@ -18,13 +18,15 @@ package me.proton.android.core.coreexample.di +import dagger.Binds import dagger.Module import dagger.Provides import dagger.hilt.InstallIn import dagger.hilt.components.SingletonComponent import me.proton.core.network.data.ApiProvider import me.proton.core.plan.data.repository.PlansRepositoryImpl -import me.proton.core.plan.domain.SupportedPaidPlans +import me.proton.core.plan.domain.SupportedSignupPaidPlans +import me.proton.core.plan.domain.SupportedUpgradePaidPlans import me.proton.core.plan.domain.repository.PlansRepository import javax.inject.Singleton @@ -33,7 +35,7 @@ import javax.inject.Singleton object PlansModule { @Provides - @SupportedPaidPlans + @SupportedSignupPaidPlans fun provideClientSupportedPaidPlanNames(): List = listOf("plus") @@ -42,3 +44,11 @@ object PlansModule { fun providePlansRepository(apiProvider: ApiProvider): PlansRepository = PlansRepositoryImpl(provider = apiProvider) } + +@Module +@InstallIn(SingletonComponent::class) +interface PlansBindsModule { + @Binds + @SupportedUpgradePaidPlans + fun bindClientSupportedUpgradePaidPlanNames(@SupportedSignupPaidPlans plans: List): List +} diff --git a/plan/build.gradle.kts b/plan/build.gradle.kts index 4987dfb15..e3d743151 100644 --- a/plan/build.gradle.kts +++ b/plan/build.gradle.kts @@ -23,7 +23,7 @@ plugins { kotlin("android") } -libVersion = Version(1, 18, 2) +libVersion = Version(1, 18, 3) android() diff --git a/plan/domain/src/main/kotlin/me/proton/core/plan/domain/Qualifiers.kt b/plan/domain/src/main/kotlin/me/proton/core/plan/domain/Qualifiers.kt index e9b27f71e..4a11699e3 100644 --- a/plan/domain/src/main/kotlin/me/proton/core/plan/domain/Qualifiers.kt +++ b/plan/domain/src/main/kotlin/me/proton/core/plan/domain/Qualifiers.kt @@ -20,6 +20,16 @@ package me.proton.core.plan.domain import javax.inject.Qualifier +/** + * Plans supported in signup. + */ @Qualifier @Retention(AnnotationRetention.BINARY) -annotation class SupportedPaidPlans +annotation class SupportedSignupPaidPlans + +/** + * Plans supported in plan upgrade flow. + */ +@Qualifier +@Retention(AnnotationRetention.BINARY) +annotation class SupportedUpgradePaidPlans diff --git a/plan/presentation/src/main/kotlin/me/proton/core/plan/presentation/viewmodel/SignupPlansViewModel.kt b/plan/presentation/src/main/kotlin/me/proton/core/plan/presentation/viewmodel/SignupPlansViewModel.kt index f98c96b36..f8e39947b 100644 --- a/plan/presentation/src/main/kotlin/me/proton/core/plan/presentation/viewmodel/SignupPlansViewModel.kt +++ b/plan/presentation/src/main/kotlin/me/proton/core/plan/presentation/viewmodel/SignupPlansViewModel.kt @@ -24,21 +24,16 @@ import kotlinx.coroutines.flow.catch import kotlinx.coroutines.flow.flow import kotlinx.coroutines.flow.launchIn import kotlinx.coroutines.flow.onEach -import kotlinx.coroutines.launch -import me.proton.core.domain.entity.UserId -import me.proton.core.payment.domain.entity.SubscriptionCycle import me.proton.core.payment.presentation.PaymentsOrchestrator -import me.proton.core.payment.presentation.onPaymentResult -import me.proton.core.plan.domain.SupportedPaidPlans +import me.proton.core.plan.domain.SupportedSignupPaidPlans import me.proton.core.plan.domain.usecase.GetPlans import me.proton.core.plan.presentation.entity.PlanDetailsListItem -import me.proton.core.plan.presentation.entity.SelectedPlan import javax.inject.Inject @HiltViewModel internal class SignupPlansViewModel @Inject constructor( private val getPlans: GetPlans, - @SupportedPaidPlans val supportedPaidPlanNames: List, + @SupportedSignupPaidPlans val supportedPaidPlanNames: List, paymentsOrchestrator: PaymentsOrchestrator ) : BasePlansViewModel(paymentsOrchestrator) { diff --git a/plan/presentation/src/main/kotlin/me/proton/core/plan/presentation/viewmodel/UpgradePlansViewModel.kt b/plan/presentation/src/main/kotlin/me/proton/core/plan/presentation/viewmodel/UpgradePlansViewModel.kt index eff9a5641..e2d542db8 100644 --- a/plan/presentation/src/main/kotlin/me/proton/core/plan/presentation/viewmodel/UpgradePlansViewModel.kt +++ b/plan/presentation/src/main/kotlin/me/proton/core/plan/presentation/viewmodel/UpgradePlansViewModel.kt @@ -26,19 +26,15 @@ import kotlinx.coroutines.flow.catch import kotlinx.coroutines.flow.flow import kotlinx.coroutines.flow.launchIn import kotlinx.coroutines.flow.onEach -import kotlinx.coroutines.launch import me.proton.core.domain.entity.UserId -import me.proton.core.payment.domain.entity.SubscriptionCycle import me.proton.core.payment.domain.usecase.GetCurrentSubscription import me.proton.core.payment.presentation.PaymentsOrchestrator -import me.proton.core.payment.presentation.onPaymentResult -import me.proton.core.plan.domain.SupportedPaidPlans +import me.proton.core.plan.domain.SupportedUpgradePaidPlans import me.proton.core.plan.domain.usecase.GetPlans import me.proton.core.plan.presentation.entity.PlanCurrency import me.proton.core.plan.presentation.entity.PlanDetailsListItem import me.proton.core.plan.presentation.entity.PlanPricing import me.proton.core.plan.presentation.entity.PlanType -import me.proton.core.plan.presentation.entity.SelectedPlan import java.text.SimpleDateFormat import java.util.Calendar import java.util.Locale @@ -48,7 +44,7 @@ import javax.inject.Inject internal class UpgradePlansViewModel @Inject constructor( private val getPlans: GetPlans, private val getCurrentSubscription: GetCurrentSubscription, - @SupportedPaidPlans val supportedPaidPlanNames: List, + @SupportedUpgradePaidPlans val supportedPaidPlanNames: List, paymentsOrchestrator: PaymentsOrchestrator ) : BasePlansViewModel(paymentsOrchestrator) {