Skip to content

Commit

Permalink
Update processing subscribe condition
Browse files Browse the repository at this point in the history
  • Loading branch information
hoangbtmrk committed Sep 6, 2024
1 parent d1b4244 commit f5d22bc
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 13 deletions.
10 changes: 6 additions & 4 deletions lib/screen/new_onboarding_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -207,8 +207,9 @@ class _NewOnboardingPageState extends State<NewOnboardingPage> {
price: _getEssentialPrice(subscriptionDetails),
isProcessing: _selectedMembershipCardType ==
MembershipCardType.essential &&
subscriptionDetails?.status ==
IAPProductStatus.pending,
(subscriptionDetails?.status ==
IAPProductStatus.pending ||
subscriptionState.isProcessing),
isEnable: true,
onTap: (type) {
_selectMembershipType(type);
Expand All @@ -221,8 +222,9 @@ class _NewOnboardingPageState extends State<NewOnboardingPage> {
price: _getPremiumPrice(subscriptionDetails),
isProcessing: _selectedMembershipCardType ==
MembershipCardType.premium &&
subscriptionDetails?.status ==
IAPProductStatus.pending,
(subscriptionDetails?.status ==
IAPProductStatus.pending ||
subscriptionState.isProcessing),
isEnable: true,
onTap: (type) async {
_selectMembershipType(type);
Expand Down
28 changes: 20 additions & 8 deletions lib/screen/settings/subscription/subscription_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,12 @@ class _SubscriptionPageState extends State<SubscriptionPage>
onIndexChanged: (index) {},
index: initialIndex,
loop: false,
itemBuilder: (context, index) => _subcribeView(
context, subscriptionDetails[index], subscriptionStatus),
itemBuilder: (context, index) => _subscribeView(
context,
subscriptionDetails[index],
subscriptionStatus,
state.isProcessing,
),
pagination: subscriptionDetails.length > 1
? const SwiperPagination(
builder: DotSwiperPaginationBuilder(
Expand All @@ -86,10 +90,12 @@ class _SubscriptionPageState extends State<SubscriptionPage>
);
}

Widget _subcribeView(
BuildContext context,
SubscriptionDetails subscriptionDetails,
SubscriptionStatus? subscriptionStatus) =>
Widget _subscribeView(
BuildContext context,
SubscriptionDetails subscriptionDetails,
SubscriptionStatus? subscriptionStatus,
bool? isProcessing,
) =>
Container(
color: AppColor.auGreyBackground,
padding: const EdgeInsets.all(3),
Expand All @@ -110,7 +116,11 @@ class _SubscriptionPageState extends State<SubscriptionPage>
padding:
ResponsiveLayout.pageHorizontalEdgeInsetsWithSubmitButton,
child: _actionSection(
context, subscriptionDetails, subscriptionStatus),
context,
subscriptionDetails,
subscriptionStatus,
isProcessing,
),
),
],
),
Expand Down Expand Up @@ -201,6 +211,7 @@ class _SubscriptionPageState extends State<SubscriptionPage>
BuildContext context,
SubscriptionDetails subscriptionDetails,
SubscriptionStatus? subscriptionStatus,
bool? isProcessing,
) {
final theme = Theme.of(context);
final dateFormater = DateFormat('dd/MM/yyyy');
Expand Down Expand Up @@ -305,7 +316,8 @@ class _SubscriptionPageState extends State<SubscriptionPage>
return MembershipCard(
type: MembershipCardType.premium,
price: subscriptionDetails.price,
isProcessing: subscriptionDetails.status == IAPProductStatus.pending,
isProcessing: isProcessing == true ||
subscriptionDetails.status == IAPProductStatus.pending,
isEnable: true,
onTap: (_) {
_onPressSubscribe(context,
Expand Down
3 changes: 2 additions & 1 deletion lib/view/cast_button.dart
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,8 @@ class _FFCastButtonState extends State<FFCastButton> {
return MembershipCard(
type: MembershipCardType.premium,
price: price,
isProcessing: upgradeState.isProcessing,
isProcessing: upgradeState.isProcessing ||
subscriptionDetail?.status == IAPProductStatus.pending,
isEnable: subscriptionDetail != null,
onTap: (_) {
_onPressSubscribe(subscriptionDetails: subscriptionDetail!);
Expand Down

0 comments on commit f5d22bc

Please sign in to comment.