Skip to content

Commit

Permalink
handle skip onboarding cases
Browse files Browse the repository at this point in the history
Signed-off-by: phuoc <[email protected]>
  • Loading branch information
phuocbitmark committed Aug 28, 2024
1 parent bf1ec48 commit e7db0fc
Showing 1 changed file with 17 additions and 5 deletions.
22 changes: 17 additions & 5 deletions lib/screen/onboarding_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ class _OnboardingPageState extends State<OnboardingPage>

final metricClient = injector.get<MetricClientService>();
final deepLinkService = injector.get<DeeplinkService>();
bool _skipMembership = false;

final _onboardingLogo = Semantics(
label: 'onboarding_logo',
Expand Down Expand Up @@ -175,6 +176,9 @@ class _OnboardingPageState extends State<OnboardingPage>
setState(() {
fromBranchLink = true;
});
if (data['source'] == 'gift_membership') {
_skipMembership = true;
}

await injector<AccountService>().restoreIfNeeded();
deepLinkService.handleBranchDeeplinkData(data);
Expand All @@ -200,13 +204,19 @@ class _OnboardingPageState extends State<OnboardingPage>
listener: (context, state) async {
final isSubscribed = await injector<IAPService>()
.isSubscribed(includeInhouse: false);
if (isSubscribed) {
_skipMembership = true;
}
if (_skipMembership) {
if (context.mounted) {
unawaited(Navigator.of(context)
.pushReplacementNamed(AppRouter.homePageNoTransition));
return;
}
}
switch (state.onboardingStep) {
case OnboardingStep.dashboard:

/// skip membership screen if user is already subscribed
/// or done new onboarding
if (injector<ConfigurationService>().isDoneNewOnboarding() ||
isSubscribed) {
if (injector<ConfigurationService>().isDoneNewOnboarding()) {
if (context.mounted) {
unawaited(Navigator.of(context)
.pushReplacementNamed(AppRouter.homePageNoTransition));
Expand All @@ -224,6 +234,8 @@ class _OnboardingPageState extends State<OnboardingPage>
if (state.onboardingStep != OnboardingStep.dashboard) {
await injector<VersionService>().checkForUpdate();
}


},
builder: (context, state) {
if (state.isLoading) {
Expand Down

0 comments on commit e7db0fc

Please sign in to comment.