Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RegistrationCubit (KIDS-1597) #1212

Merged
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
3af20ff
move, copy & cleanup
MaikelStuivenberg Oct 30, 2024
69035c2
move registration repo
MaikelStuivenberg Oct 30, 2024
7233897
comma
MaikelStuivenberg Oct 30, 2024
e2b8554
remove stuff
MaikelStuivenberg Oct 30, 2024
d90f7c1
New cubit
MaikelStuivenberg Oct 30, 2024
bf5dd80
Merge branch 'feature/auth-refactor' into feature/kids-1597-registrat…
MaikelStuivenberg Oct 30, 2024
3cf877a
fix error
MaikelStuivenberg Oct 30, 2024
eae5495
spelling
MaikelStuivenberg Oct 31, 2024
3a44d0b
emit error when user not found
MaikelStuivenberg Oct 31, 2024
55ee55b
spelling
MaikelStuivenberg Oct 31, 2024
f05c2ef
comma
MaikelStuivenberg Oct 31, 2024
83eb51c
dispose cubit
MaikelStuivenberg Oct 31, 2024
49a80e9
more refactor
MaikelStuivenberg Oct 31, 2024
8c18d01
refactor of email signup (part 1) - New account EU and existing accou…
MaikelStuivenberg Nov 7, 2024
fa0867b
login EU
MaikelStuivenberg Nov 7, 2024
68af7df
Make sure EU isn't getting at this place
MaikelStuivenberg Nov 7, 2024
205b1db
rename stuff
MaikelStuivenberg Nov 7, 2024
a72c883
registration state (only decision part for US left)
MaikelStuivenberg Nov 7, 2024
87d7378
US reg or login decision -- now bugfixing -_-
MaikelStuivenberg Nov 7, 2024
a4b8b98
Create temp account
MaikelStuivenberg Nov 7, 2024
808bca9
temp user
MaikelStuivenberg Nov 12, 2024
549822e
Fix redirection logic from splash.
TammiLion Nov 12, 2024
ea47d80
Merge branch 'feature/kids-1597-registrationcubit' of https://github.…
TammiLion Nov 12, 2024
231fb99
Add email to signup route. Fix add member routing.
TammiLion Nov 12, 2024
39153f6
Do not check for temp user at splash.
TammiLion Nov 12, 2024
1e0e0d5
Check isLoggedIn during refreshtoken.
TammiLion Nov 12, 2024
8c7bbc8
Add snackbar error message. Make registration its own route. Remove a…
TammiLion Nov 12, 2024
4f8defe
Fix navigation after adding members.
TammiLion Nov 12, 2024
f74b503
Fix profiles not updating correctly after logout or login.
TammiLion Nov 12, 2024
1ce68c6
remove comment
MaikelStuivenberg Nov 12, 2024
566061e
Merge branch 'feature/auth-refactor' into feature/kids-1597-registrat…
MaikelStuivenberg Nov 12, 2024
364ed4f
loading spinner button
MaikelStuivenberg Nov 12, 2024
60eb934
cleanup
MaikelStuivenberg Nov 13, 2024
1a608ad
show spinner + correct style for EU
MaikelStuivenberg Nov 13, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .ruby-version
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
2.7.3
1 change: 0 additions & 1 deletion lib/app/app.dart
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,6 @@ class _AppState extends State<App> {
create: (context) => RegistrationBloc(
authCubit: context.read<AuthCubit>(),
authRepositoy: getIt(),
registrationRepository: getIt(),
),
),
],
Expand Down
7 changes: 1 addition & 6 deletions lib/app/injection/injection.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,14 @@ import 'package:givt_app/features/children/edit_profile/repositories/edit_parent
import 'package:givt_app/features/children/family_goal/repositories/create_family_goal_repository.dart';
import 'package:givt_app/features/children/family_history/repository/family_history_repository.dart';
import 'package:givt_app/features/children/parental_approval/repositories/parental_approval_repository.dart';
import 'package:givt_app/features/family/features/avatars/repositories/avatars_repository.dart';
import 'package:givt_app/features/family/features/creditcard_setup/cubit/stripe_cubit.dart';
import 'package:givt_app/features/give/repositories/beacon_repository.dart';
import 'package:givt_app/features/give/repositories/campaign_repository.dart';
import 'package:givt_app/features/impact_groups/repo/impact_groups_repository.dart';
import 'package:givt_app/features/recurring_donations/cancel/repositories/cancel_recurring_donation_repository.dart';
import 'package:givt_app/features/recurring_donations/create/repositories/create_recurring_donation_repository.dart';
import 'package:givt_app/features/recurring_donations/detail/repository/detail_recurring_donation_repository.dart';
import 'package:givt_app/features/recurring_donations/overview/repositories/recurring_donations_repository.dart';
import 'package:givt_app/features/registration/cubit/stripe_cubit.dart';
import 'package:givt_app/features/registration/domain/registration_repository.dart';
import 'package:givt_app/shared/models/user_ext.dart';
import 'package:givt_app/shared/repositories/repositories.dart';
import 'package:givt_app/utils/media_picker_service.dart';
Expand Down Expand Up @@ -124,9 +122,6 @@ void initRepositories() {
getIt(),
),
)
..registerLazySingleton<RegistrationRepository>(
RegistrationRepository.new,
)
..registerLazySingleton<CollectGroupRepository>(
() => CollectGroupRepositoryImpl(
getIt(),
Expand Down
3 changes: 0 additions & 3 deletions lib/app/routes/app_router.dart
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,6 @@ class AppRouter {
create: (context) => RegistrationBloc(
authCubit: context.read<AuthCubit>(),
authRepositoy: getIt(),
registrationRepository: getIt(),
)..add(const RegistrationInit()),
child: const GiftAidRequestPage(),
),
Expand All @@ -331,7 +330,6 @@ class AppRouter {
create: (context) => RegistrationBloc(
authCubit: context.read<AuthCubit>(),
authRepositoy: getIt(),
registrationRepository: getIt(),
)..add(const RegistrationInit()),
child: const BacsExplanationPage(),
),
Expand All @@ -341,7 +339,6 @@ class AppRouter {
create: (context) => RegistrationBloc(
authCubit: context.read<AuthCubit>(),
authRepositoy: getIt(),
registrationRepository: getIt(),
)..add(const RegistrationInit()),
child: const MandateExplanationPage(),
),
Expand Down
39 changes: 0 additions & 39 deletions lib/features/account_details/cubit/edit_stripe_cubit.dart

This file was deleted.

23 changes: 0 additions & 23 deletions lib/features/account_details/cubit/edit_stripe_state.dart

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:givt_app/core/enums/enums.dart';
import 'package:givt_app/features/account_details/bloc/personal_info_edit_bloc.dart';
import 'package:givt_app/features/registration/widgets/us_mobile_number_form_field.dart';
import 'package:givt_app/features/family/features/registration/widgets/us_mobile_number_form_field.dart';
import 'package:givt_app/features/registration/widgets/widgets.dart';
import 'package:givt_app/l10n/l10n.dart';
import 'package:givt_app/shared/widgets/widgets.dart';
Expand Down
104 changes: 18 additions & 86 deletions lib/features/account_details/pages/personal_info_edit_page.dart
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_stripe/flutter_stripe.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
import 'package:givt_app/app/injection/injection.dart';
import 'package:givt_app/core/enums/enums.dart';
import 'package:givt_app/core/logging/logging_service.dart';
import 'package:givt_app/features/account_details/bloc/personal_info_edit_bloc.dart';
import 'package:givt_app/features/account_details/pages/change_address_bottom_sheet.dart';
import 'package:givt_app/features/account_details/pages/change_bank_details_bottom_sheet.dart';
Expand All @@ -13,12 +10,9 @@ import 'package:givt_app/features/account_details/pages/change_phone_number_bott
import 'package:givt_app/features/auth/cubit/auth_cubit.dart';
import 'package:givt_app/features/auth/pages/change_password_page.dart';
import 'package:givt_app/features/family/app/family_pages.dart';
import 'package:givt_app/features/registration/cubit/stripe_cubit.dart';
import 'package:givt_app/l10n/l10n.dart';
import 'package:givt_app/shared/dialogs/dialogs.dart';
import 'package:givt_app/shared/pages/gift_aid_page.dart';
import 'package:givt_app/shared/widgets/parent_avatar.dart';
import 'package:givt_app/utils/stripe_helper.dart';
import 'package:givt_app/utils/utils.dart';
import 'package:go_router/go_router.dart';

Expand All @@ -34,7 +28,6 @@ class PersonalInfoEditPage extends StatelessWidget {
final locals = context.l10n;
final user = context.watch<AuthCubit>().state.user;
final isUkUser = Country.unitedKingdomCodes().contains(user.country);
final isUSUser = Country.us.countryCode == user.country;

return Scaffold(
appBar: AppBar(
Expand Down Expand Up @@ -108,40 +101,29 @@ class PersonalInfoEditPage extends StatelessWidget {
const SizedBox(
height: 20,
),
if (!isUSUser)
Column(
children: [
Text(
locals.personalPageHeader,
style: Theme.of(context).textTheme.bodyLarge,
),
const SizedBox(
height: 20,
),
Text(
locals.personalPageSubHeader,
style: Theme.of(context).textTheme.bodyLarge,
textAlign: TextAlign.center,
),
const SizedBox(
height: 20,
),
],
),
if (isUSUser)
Padding(
padding: const EdgeInsets.only(bottom: 20),
child: ParentAvatar(
firstName: user.firstName,
lastName: user.lastName,
pictureURL: user.profilePicture,
Column(
children: [
Text(
locals.personalPageHeader,
style: Theme.of(context).textTheme.bodyLarge,
),
),
const SizedBox(
height: 20,
),
Text(
locals.personalPageSubHeader,
style: Theme.of(context).textTheme.bodyLarge,
textAlign: TextAlign.center,
),
const SizedBox(
height: 20,
),
],
),
_buildInfoRow(
icon: const Icon(
Icons.person,
),
visible: !isUSUser,
value: '${user.firstName} ${user.lastName}',
),
_buildInfoRow(
Expand All @@ -161,7 +143,6 @@ class PersonalInfoEditPage extends StatelessWidget {
),
),
_buildInfoRow(
visible: !isUSUser,
icon: const Icon(
FontAwesomeIcons.house,
color: AppTheme.givtLightGreen,
Expand Down Expand Up @@ -196,7 +177,6 @@ class PersonalInfoEditPage extends StatelessWidget {
),
),
_buildInfoRow(
visible: !isUSUser,
icon: const Icon(
FontAwesomeIcons.creditCard,
color: AppTheme.givtOrange,
Expand All @@ -216,45 +196,6 @@ class PersonalInfoEditPage extends StatelessWidget {
),
),
),
_buildInfoRow(
visible: isUSUser,
icon: const Icon(
FontAwesomeIcons.creditCard,
color: AppTheme.givtOrange,
),
value:
'${user.accountBrand.toUpperCase()} ${user.accountNumber}',
onTap: () async {
await AnalyticsHelper.logEvent(
eventName: AmplitudeEvents.editPaymentDetailsClicked,
);

if (!context.mounted) return;
await getIt<StripeCubit>().fetchSetupIntent();

if (!context.mounted) return;

try {
await StripeHelper(context).showPaymentSheet();

if (!context.mounted) return;
await context.read<AuthCubit>().refreshUser();
} on StripeException catch (e, stackTrace) {
await AnalyticsHelper.logEvent(
eventName: AmplitudeEvents.editPaymentDetailsCanceled,
);

/* Logged as info as stripe is giving exception
when for example people close the bottomsheet.
So it's not a real error :)
*/
LoggingInfo.instance.info(
e.toString(),
methodName: stackTrace.toString(),
);
}
},
),
_buildInfoRow(
visible: isUkUser,
icon: Image.asset(
Expand Down Expand Up @@ -290,15 +231,6 @@ class PersonalInfoEditPage extends StatelessWidget {
const Divider(
height: 0,
),
if (isUSUser)
Padding(
padding: const EdgeInsets.only(left: 70, right: 70, top: 20),
child: Text(
locals.personalPageSubHeader,
style: Theme.of(context).textTheme.bodyLarge,
textAlign: TextAlign.center,
),
),
],
),
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ import 'package:givt_app/features/children/add_member/widgets/member_counter.dar
import 'package:givt_app/features/children/shared/profile_type.dart';
import 'package:givt_app/features/family/extensions/extensions.dart';
import 'package:givt_app/features/family/features/avatars/cubit/avatars_cubit.dart';
import 'package:givt_app/features/family/features/registration/widgets/random_avatar.dart';
import 'package:givt_app/features/family/shared/design/components/components.dart';
import 'package:givt_app/features/family/shared/widgets/buttons/givt_back_button_flat.dart';
import 'package:givt_app/features/family/shared/widgets/loading/custom_progress_indicator.dart';
import 'package:givt_app/features/family/shared/widgets/texts/label_medium_text.dart';
import 'package:givt_app/features/registration/widgets/avatar_selection_bottomsheet.dart';
import 'package:givt_app/features/registration/widgets/random_avatar.dart';
import 'package:givt_app/shared/models/analytics_event.dart';
import 'package:givt_app/shared/widgets/fun_scaffold.dart';
import 'package:givt_app/utils/app_theme.dart';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ import 'package:givt_app/features/children/overview/pages/models/edit_allowance_
import 'package:givt_app/features/children/overview/pages/models/top_up_success_uimodel.dart';
import 'package:givt_app/features/children/overview/pages/top_up_success_page.dart';
import 'package:givt_app/features/family/app/family_pages.dart';
import 'package:givt_app/features/family/features/creditcard_setup/pages/credit_card_details.dart';
import 'package:givt_app/features/family/shared/design/components/components.dart';
import 'package:givt_app/features/family/shared/widgets/buttons/givt_back_button_flat.dart';
import 'package:givt_app/features/registration/pages/credit_card_details.dart';
import 'package:givt_app/shared/widgets/extensions/route_extensions.dart';
import 'package:givt_app/utils/utils.dart';
import 'package:go_router/go_router.dart';
Expand Down
2 changes: 1 addition & 1 deletion lib/features/family/app/family_routes.dart
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,11 @@ import 'package:givt_app/features/family/features/recommendation/start_recommend
import 'package:givt_app/features/family/features/recommendation/tags/cubit/tags_cubit.dart';
import 'package:givt_app/features/family/features/recommendation/tags/screens/location_selection_screen.dart';
import 'package:givt_app/features/family/features/reflect/presentation/pages/reflect_intro_screen.dart';
import 'package:givt_app/features/family/features/registration/pages/us_signup_page.dart';
import 'package:givt_app/features/family/features/scan_nfc/nfc_scan_screen.dart';
import 'package:givt_app/features/permit_biometric/cubit/permit_biometric_cubit.dart';
import 'package:givt_app/features/permit_biometric/models/permit_biometric_request.dart';
import 'package:givt_app/features/permit_biometric/pages/permit_biometric_page.dart';
import 'package:givt_app/features/registration/pages/us_signup_page.dart';
import 'package:givt_app/features/unregister_account/cubit/unregister_cubit.dart';
import 'package:givt_app/features/unregister_account/unregister_page.dart';
import 'package:givt_app/l10n/l10n.dart';
Expand Down
6 changes: 4 additions & 2 deletions lib/features/family/app/injection.dart
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import 'package:givt_app/features/family/features/reflect/bloc/summary_cubit.dar
import 'package:givt_app/features/family/features/reflect/domain/grateful_recommendations_repository.dart';
import 'package:givt_app/features/family/features/reflect/domain/grateful_recommendations_repository_impl.dart';
import 'package:givt_app/features/family/features/reflect/domain/reflect_and_share_repository.dart';
import 'package:givt_app/features/family/features/registration/cubit/family_registration_cubit.dart';
import 'package:givt_app/features/family/features/reset_password/cubit/reset_password_cubit.dart';
import 'package:givt_app/features/family/features/reset_password/repositories/reset_password_repository.dart';
import 'package:givt_app/features/family/helpers/svg_manager.dart';
Expand Down Expand Up @@ -96,7 +97,6 @@ void initCubits() {
getIt(),
getIt(),
getIt(),
getIt(),
),
)
..registerFactory<FamilySelectionCubit>(
Expand Down Expand Up @@ -125,6 +125,9 @@ void initCubits() {
)
..registerLazySingleton<FamilyLoginCubit>(
() => FamilyLoginCubit(getIt()),
)
..registerLazySingleton<FamilyRegistrationCubit>(
() => FamilyRegistrationCubit(getIt()),
MaikelStuivenberg marked this conversation as resolved.
Show resolved Hide resolved
);
}

Expand Down Expand Up @@ -153,7 +156,6 @@ void initRepositories() {
getIt(),
getIt(),
getIt(),
getIt(),
),
)
..registerLazySingleton<OrganisationDetailsRepository>(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ import 'package:givt_app/features/account_details/pages/change_phone_number_bott
import 'package:givt_app/features/family/app/family_pages.dart';
import 'package:givt_app/features/family/features/auth/bloc/family_auth_cubit.dart';
import 'package:givt_app/features/family/features/auth/presentation/models/family_auth_state.dart';
import 'package:givt_app/features/family/features/creditcard_setup/cubit/stripe_cubit.dart';
import 'package:givt_app/features/family/features/reset_password/presentation/pages/reset_password_sheet.dart';
import 'package:givt_app/features/family/helpers/logout_helper.dart';
import 'package:givt_app/features/family/shared/design/components/components.dart';
import 'package:givt_app/features/family/utils/family_app_theme.dart';
import 'package:givt_app/features/family/utils/family_auth_utils.dart';
import 'package:givt_app/features/registration/cubit/stripe_cubit.dart';
import 'package:givt_app/l10n/l10n.dart';
import 'package:givt_app/shared/dialogs/dialogs.dart';
import 'package:givt_app/shared/pages/fingerprint_bottom_sheet.dart';
Expand Down
Loading