refactor(signup): type API errors with status-code-based enum

Introduce LegacySignupErrorEvent to map backend failures from
POST /auth/signup: 400 → emailAlreadyExists, 403 → invalidField,
429 → tooManyAttempts, timeout → network. The view state now
separates validationErrorKey (pre-submit i18n keys) from apiErrorEvent
(typed API outcomes), and the screen listens to both to show proper
i18n messages instead of leaking raw backend text.
This commit is contained in:
2026-04-17 11:11:52 +02:00
parent 56d89fcdc4
commit 73d9de45a2
12 changed files with 133 additions and 61 deletions

View File

@@ -0,0 +1,25 @@
import 'package:sf_infrastructure/sf_infrastructure.dart';
enum LegacySignupErrorEvent {
emailAlreadyExists,
invalidField,
tooManyAttempts,
network,
generic,
}
LegacySignupErrorEvent mapSignupError(Object error) {
if (error is! ApiException) return LegacySignupErrorEvent.generic;
if (error.isNetworkError) return LegacySignupErrorEvent.network;
switch (error.statusCode) {
case 400:
return LegacySignupErrorEvent.emailAlreadyExists;
case 403:
return LegacySignupErrorEvent.invalidField;
case 429:
return LegacySignupErrorEvent.tooManyAttempts;
default:
return LegacySignupErrorEvent.generic;
}
}

View File

@@ -1,3 +1,4 @@
import 'package:legacy_auth/src/features/sign_up/domain/entities/legacy_signup_error_event.dart';
import 'package:legacy_auth/src/features/sign_up/presentation/sign_up_steps.dart';
import 'package:legacy_auth/src/features/sign_up/presentation/state/sign_up_view_model.dart';
import 'package:legacy_auth/src/features/sign_up/presentation/screens/account_created_screen.dart';
@@ -8,6 +9,16 @@ import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:navigation/navigation.dart';
import 'package:sf_localizations/sf_localizations.dart';
String _signupApiErrorI18nKey(LegacySignupErrorEvent event) {
return switch (event) {
LegacySignupErrorEvent.emailAlreadyExists => I18n.errorEmailAlreadyRegistered,
LegacySignupErrorEvent.invalidField => I18n.signupErrorInvalidField,
LegacySignupErrorEvent.tooManyAttempts => I18n.authErrorTooManyAttempts,
LegacySignupErrorEvent.network => I18n.authErrorNetwork,
LegacySignupErrorEvent.generic => I18n.errorGeneric,
};
}
class LegacySignupScreen extends ConsumerWidget {
final NavigationContract navigationContract;
@@ -39,18 +50,33 @@ class LegacySignupScreen extends ConsumerWidget {
final vm = ref.read(legacySignUpViewModelProvider.notifier);
final state = ref.watch(legacySignUpViewModelProvider);
ref.listen(legacySignUpViewModelProvider.select((s) => s.errorMessage), (
previous,
next,
) {
if (next.isNotEmpty) {
showTopSnackbar(
context,
message: context.translate(next),
type: MessageType.error,
);
}
});
ref.listen(
legacySignUpViewModelProvider.select((s) => s.validationErrorKey),
(previous, next) {
if (next.isNotEmpty) {
showTopSnackbar(
context,
message: context.translate(next),
type: MessageType.error,
);
vm.clearValidationError();
}
},
);
ref.listen(
legacySignUpViewModelProvider.select((s) => s.apiErrorEvent),
(previous, next) {
if (next != null) {
showTopSnackbar(
context,
message: context.translate(_signupApiErrorI18nKey(next)),
type: MessageType.error,
);
vm.clearApiError();
}
},
);
final steps = signUpSteps(context);
final index = state.currentIndex.clamp(0, steps.length - 1);

View File

@@ -6,6 +6,7 @@ import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:legacy_auth/src/core/domain/repositories/sign_up_repository.dart';
import 'package:legacy_auth/src/core/providers/sign_up_repository_provider.dart';
import 'package:legacy_auth/src/core/utils/text_format_utils.dart';
import 'package:legacy_auth/src/features/sign_up/domain/entities/legacy_signup_error_event.dart';
import 'package:legacy_auth/src/features/sign_up/domain/entities/sign_up_request_entity.dart';
import 'package:legacy_auth/src/features/sign_up/presentation/mixins/sign_up_form_validation.dart';
import 'package:legacy_auth/src/features/sign_up/presentation/state/sign_up_view_state.dart';
@@ -68,14 +69,14 @@ class LegacySignUpViewModel extends Notifier<LegacySignUpViewState>
toCapitalizedController(firstNameController);
final text = firstNameController.text;
if (text == state.firstName) return;
state = state.copyWith(firstName: text, errorMessage: '');
state = state.copyWith(firstName: text, validationErrorKey: '');
}
void _onLastNameChanged() {
toCapitalizedController(lastNameController);
final text = lastNameController.text;
if (text == state.lastName) return;
state = state.copyWith(lastName: text, errorMessage: '');
state = state.copyWith(lastName: text, validationErrorKey: '');
}
void _onPhoneChanged() {
@@ -91,7 +92,7 @@ class LegacySignUpViewModel extends Notifier<LegacySignUpViewState>
void _onEmailChanged() {
final text = emailController.text;
if (text == state.email) return;
state = state.copyWith(email: text, errorMessage: '');
state = state.copyWith(email: text, validationErrorKey: '');
if (state.showErrors) {
state = state.copyWith(emailError: emailErrorFor(text));
@@ -101,7 +102,7 @@ class LegacySignUpViewModel extends Notifier<LegacySignUpViewState>
void _onPasswordChanged() {
final text = passwordController.text;
if (text == state.password) return;
state = state.copyWith(password: text, errorMessage: '');
state = state.copyWith(password: text, validationErrorKey: '');
if (state.showErrors) {
state = state.copyWith(
@@ -116,7 +117,7 @@ class LegacySignUpViewModel extends Notifier<LegacySignUpViewState>
void _onRepeatPasswordChanged() {
final text = repeatPasswordController.text;
if (text == state.repeatPassword) return;
state = state.copyWith(repeatPassword: text, errorMessage: '');
state = state.copyWith(repeatPassword: text, validationErrorKey: '');
if (state.showErrors) {
state = state.copyWith(
@@ -141,7 +142,7 @@ class LegacySignUpViewModel extends Notifier<LegacySignUpViewState>
void setAcceptTerms(bool value) {
if (value == state.acceptTerms) return;
state = state.copyWith(acceptTerms: value, errorMessage: '');
state = state.copyWith(acceptTerms: value, validationErrorKey: '');
}
void toggleShowPassword() {
@@ -194,35 +195,35 @@ class LegacySignUpViewModel extends Notifier<LegacySignUpViewState>
showErrors: true,
emailError: emailErr,
phoneError: phoneErr,
errorMessage: '',
validationErrorKey: '',
);
if (state.firstName.trim().isEmpty) {
state = state.copyWith(errorMessage: I18n.errorFirstNameRequired);
state = state.copyWith(validationErrorKey: I18n.errorFirstNameRequired);
return false;
}
if (!isNameValid(state.firstName)) {
state = state.copyWith(errorMessage: I18n.errorNameInvalidChars);
state = state.copyWith(validationErrorKey: I18n.errorNameInvalidChars);
return false;
}
if (state.lastName.trim().isEmpty) {
state = state.copyWith(errorMessage: I18n.errorLastNameRequired);
state = state.copyWith(validationErrorKey: I18n.errorLastNameRequired);
return false;
}
if (!isNameValid(state.lastName)) {
state = state.copyWith(errorMessage: I18n.errorNameInvalidChars);
state = state.copyWith(validationErrorKey: I18n.errorNameInvalidChars);
return false;
}
if (phoneErr.isNotEmpty) {
state = state.copyWith(errorMessage: phoneErr);
state = state.copyWith(validationErrorKey: phoneErr);
return false;
}
if (emailErr.isNotEmpty) {
state = state.copyWith(errorMessage: emailErr);
state = state.copyWith(validationErrorKey: emailErr);
return false;
}
if (!state.acceptTerms) {
state = state.copyWith(errorMessage: I18n.errorAcceptTerms);
state = state.copyWith(validationErrorKey: I18n.errorAcceptTerms);
return false;
}
return true;
@@ -237,7 +238,7 @@ class LegacySignUpViewModel extends Notifier<LegacySignUpViewState>
state = state.copyWith(
showErrors: true,
passwordError: passwordErr,
errorMessage: passwordErr,
validationErrorKey: passwordErr,
);
return passwordErr.isEmpty;
@@ -255,7 +256,7 @@ class LegacySignUpViewModel extends Notifier<LegacySignUpViewState>
);
if (parsedPhone == null) {
state = state.copyWith(
errorMessage: I18n.errorMessagePhoneIsInvalid,
validationErrorKey: I18n.errorMessagePhoneIsInvalid,
phoneError: I18n.errorMessagePhoneIsInvalid,
);
return false;
@@ -263,7 +264,8 @@ class LegacySignUpViewModel extends Notifier<LegacySignUpViewState>
state = state.copyWith(
isLoading: true,
errorMessage: '',
validationErrorKey: '',
apiErrorEvent: null,
showAccountCreated: false,
);
@@ -287,25 +289,32 @@ class LegacySignUpViewModel extends Notifier<LegacySignUpViewState>
state = state.copyWith(
isLoading: false,
isCreated: response.isCreated,
errorMessage: '',
showAccountCreated: true,
);
return true;
} catch (e) {
if (!ref.mounted) return false;
final msg = formatErrorMessage(e);
final errorMsg = msg == 'BadRequest'
? I18n.errorEmailAlreadyRegistered
: msg;
unawaited(_tracking.legacyAuthSignupFailed(formatErrorMessage(e)));
unawaited(_tracking.legacyAuthSignupFailed(errorMsg));
state = state.copyWith(isLoading: false, errorMessage: errorMsg);
state = state.copyWith(
isLoading: false,
apiErrorEvent: mapSignupError(e),
);
return false;
}
}
void clearApiError() {
if (state.apiErrorEvent != null) state = state.copyWith(apiErrorEvent: null);
}
void clearValidationError() {
if (state.validationErrorKey.isNotEmpty) {
state = state.copyWith(validationErrorKey: '');
}
}
String _deviceLanguage() {
final code = PlatformDispatcher.instance.locale.languageCode
.trim()

View File

@@ -1,4 +1,5 @@
import 'package:freezed_annotation/freezed_annotation.dart';
import 'package:legacy_auth/src/features/sign_up/domain/entities/legacy_signup_error_event.dart';
part 'sign_up_view_state.freezed.dart';
@@ -22,7 +23,8 @@ abstract class LegacySignUpViewState with _$LegacySignUpViewState {
@Default('') String emailError,
@Default('') String passwordError,
@Default('') String phoneError,
@Default('') String errorMessage,
@Default('') String validationErrorKey,
LegacySignupErrorEvent? apiErrorEvent,
@Default(false) bool isLoading,
@Default(false) bool showErrors,
@Default(false) bool isCreated,

View File

@@ -14,7 +14,7 @@ T _$identity<T>(T value) => value;
/// @nodoc
mixin _$LegacySignUpViewState {
int get currentIndex; String get firstName; String get lastName; String get email; String get phone; String get isoCode; String get password; String get repeatPassword; bool get isShowPassword; bool get acceptTerms; String get emailError; String get passwordError; String get phoneError; String get errorMessage; bool get isLoading; bool get showErrors; bool get isCreated; bool get showAccountCreated;
int get currentIndex; String get firstName; String get lastName; String get email; String get phone; String get isoCode; String get password; String get repeatPassword; bool get isShowPassword; bool get acceptTerms; String get emailError; String get passwordError; String get phoneError; String get validationErrorKey; LegacySignupErrorEvent? get apiErrorEvent; bool get isLoading; bool get showErrors; bool get isCreated; bool get showAccountCreated;
/// Create a copy of LegacySignUpViewState
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@@ -25,16 +25,16 @@ $LegacySignUpViewStateCopyWith<LegacySignUpViewState> get copyWith => _$LegacySi
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is LegacySignUpViewState&&(identical(other.currentIndex, currentIndex) || other.currentIndex == currentIndex)&&(identical(other.firstName, firstName) || other.firstName == firstName)&&(identical(other.lastName, lastName) || other.lastName == lastName)&&(identical(other.email, email) || other.email == email)&&(identical(other.phone, phone) || other.phone == phone)&&(identical(other.isoCode, isoCode) || other.isoCode == isoCode)&&(identical(other.password, password) || other.password == password)&&(identical(other.repeatPassword, repeatPassword) || other.repeatPassword == repeatPassword)&&(identical(other.isShowPassword, isShowPassword) || other.isShowPassword == isShowPassword)&&(identical(other.acceptTerms, acceptTerms) || other.acceptTerms == acceptTerms)&&(identical(other.emailError, emailError) || other.emailError == emailError)&&(identical(other.passwordError, passwordError) || other.passwordError == passwordError)&&(identical(other.phoneError, phoneError) || other.phoneError == phoneError)&&(identical(other.errorMessage, errorMessage) || other.errorMessage == errorMessage)&&(identical(other.isLoading, isLoading) || other.isLoading == isLoading)&&(identical(other.showErrors, showErrors) || other.showErrors == showErrors)&&(identical(other.isCreated, isCreated) || other.isCreated == isCreated)&&(identical(other.showAccountCreated, showAccountCreated) || other.showAccountCreated == showAccountCreated));
return identical(this, other) || (other.runtimeType == runtimeType&&other is LegacySignUpViewState&&(identical(other.currentIndex, currentIndex) || other.currentIndex == currentIndex)&&(identical(other.firstName, firstName) || other.firstName == firstName)&&(identical(other.lastName, lastName) || other.lastName == lastName)&&(identical(other.email, email) || other.email == email)&&(identical(other.phone, phone) || other.phone == phone)&&(identical(other.isoCode, isoCode) || other.isoCode == isoCode)&&(identical(other.password, password) || other.password == password)&&(identical(other.repeatPassword, repeatPassword) || other.repeatPassword == repeatPassword)&&(identical(other.isShowPassword, isShowPassword) || other.isShowPassword == isShowPassword)&&(identical(other.acceptTerms, acceptTerms) || other.acceptTerms == acceptTerms)&&(identical(other.emailError, emailError) || other.emailError == emailError)&&(identical(other.passwordError, passwordError) || other.passwordError == passwordError)&&(identical(other.phoneError, phoneError) || other.phoneError == phoneError)&&(identical(other.validationErrorKey, validationErrorKey) || other.validationErrorKey == validationErrorKey)&&(identical(other.apiErrorEvent, apiErrorEvent) || other.apiErrorEvent == apiErrorEvent)&&(identical(other.isLoading, isLoading) || other.isLoading == isLoading)&&(identical(other.showErrors, showErrors) || other.showErrors == showErrors)&&(identical(other.isCreated, isCreated) || other.isCreated == isCreated)&&(identical(other.showAccountCreated, showAccountCreated) || other.showAccountCreated == showAccountCreated));
}
@override
int get hashCode => Object.hash(runtimeType,currentIndex,firstName,lastName,email,phone,isoCode,password,repeatPassword,isShowPassword,acceptTerms,emailError,passwordError,phoneError,errorMessage,isLoading,showErrors,isCreated,showAccountCreated);
int get hashCode => Object.hashAll([runtimeType,currentIndex,firstName,lastName,email,phone,isoCode,password,repeatPassword,isShowPassword,acceptTerms,emailError,passwordError,phoneError,validationErrorKey,apiErrorEvent,isLoading,showErrors,isCreated,showAccountCreated]);
@override
String toString() {
return 'LegacySignUpViewState(currentIndex: $currentIndex, firstName: $firstName, lastName: $lastName, email: $email, phone: $phone, isoCode: $isoCode, password: $password, repeatPassword: $repeatPassword, isShowPassword: $isShowPassword, acceptTerms: $acceptTerms, emailError: $emailError, passwordError: $passwordError, phoneError: $phoneError, errorMessage: $errorMessage, isLoading: $isLoading, showErrors: $showErrors, isCreated: $isCreated, showAccountCreated: $showAccountCreated)';
return 'LegacySignUpViewState(currentIndex: $currentIndex, firstName: $firstName, lastName: $lastName, email: $email, phone: $phone, isoCode: $isoCode, password: $password, repeatPassword: $repeatPassword, isShowPassword: $isShowPassword, acceptTerms: $acceptTerms, emailError: $emailError, passwordError: $passwordError, phoneError: $phoneError, validationErrorKey: $validationErrorKey, apiErrorEvent: $apiErrorEvent, isLoading: $isLoading, showErrors: $showErrors, isCreated: $isCreated, showAccountCreated: $showAccountCreated)';
}
@@ -45,7 +45,7 @@ abstract mixin class $LegacySignUpViewStateCopyWith<$Res> {
factory $LegacySignUpViewStateCopyWith(LegacySignUpViewState value, $Res Function(LegacySignUpViewState) _then) = _$LegacySignUpViewStateCopyWithImpl;
@useResult
$Res call({
int currentIndex, String firstName, String lastName, String email, String phone, String isoCode, String password, String repeatPassword, bool isShowPassword, bool acceptTerms, String emailError, String passwordError, String phoneError, String errorMessage, bool isLoading, bool showErrors, bool isCreated, bool showAccountCreated
int currentIndex, String firstName, String lastName, String email, String phone, String isoCode, String password, String repeatPassword, bool isShowPassword, bool acceptTerms, String emailError, String passwordError, String phoneError, String validationErrorKey, LegacySignupErrorEvent? apiErrorEvent, bool isLoading, bool showErrors, bool isCreated, bool showAccountCreated
});
@@ -62,7 +62,7 @@ class _$LegacySignUpViewStateCopyWithImpl<$Res>
/// Create a copy of LegacySignUpViewState
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline') @override $Res call({Object? currentIndex = null,Object? firstName = null,Object? lastName = null,Object? email = null,Object? phone = null,Object? isoCode = null,Object? password = null,Object? repeatPassword = null,Object? isShowPassword = null,Object? acceptTerms = null,Object? emailError = null,Object? passwordError = null,Object? phoneError = null,Object? errorMessage = null,Object? isLoading = null,Object? showErrors = null,Object? isCreated = null,Object? showAccountCreated = null,}) {
@pragma('vm:prefer-inline') @override $Res call({Object? currentIndex = null,Object? firstName = null,Object? lastName = null,Object? email = null,Object? phone = null,Object? isoCode = null,Object? password = null,Object? repeatPassword = null,Object? isShowPassword = null,Object? acceptTerms = null,Object? emailError = null,Object? passwordError = null,Object? phoneError = null,Object? validationErrorKey = null,Object? apiErrorEvent = freezed,Object? isLoading = null,Object? showErrors = null,Object? isCreated = null,Object? showAccountCreated = null,}) {
return _then(_self.copyWith(
currentIndex: null == currentIndex ? _self.currentIndex : currentIndex // ignore: cast_nullable_to_non_nullable
as int,firstName: null == firstName ? _self.firstName : firstName // ignore: cast_nullable_to_non_nullable
@@ -77,8 +77,9 @@ as bool,acceptTerms: null == acceptTerms ? _self.acceptTerms : acceptTerms // ig
as bool,emailError: null == emailError ? _self.emailError : emailError // ignore: cast_nullable_to_non_nullable
as String,passwordError: null == passwordError ? _self.passwordError : passwordError // ignore: cast_nullable_to_non_nullable
as String,phoneError: null == phoneError ? _self.phoneError : phoneError // ignore: cast_nullable_to_non_nullable
as String,errorMessage: null == errorMessage ? _self.errorMessage : errorMessage // ignore: cast_nullable_to_non_nullable
as String,isLoading: null == isLoading ? _self.isLoading : isLoading // ignore: cast_nullable_to_non_nullable
as String,validationErrorKey: null == validationErrorKey ? _self.validationErrorKey : validationErrorKey // ignore: cast_nullable_to_non_nullable
as String,apiErrorEvent: freezed == apiErrorEvent ? _self.apiErrorEvent : apiErrorEvent // ignore: cast_nullable_to_non_nullable
as LegacySignupErrorEvent?,isLoading: null == isLoading ? _self.isLoading : isLoading // ignore: cast_nullable_to_non_nullable
as bool,showErrors: null == showErrors ? _self.showErrors : showErrors // ignore: cast_nullable_to_non_nullable
as bool,isCreated: null == isCreated ? _self.isCreated : isCreated // ignore: cast_nullable_to_non_nullable
as bool,showAccountCreated: null == showAccountCreated ? _self.showAccountCreated : showAccountCreated // ignore: cast_nullable_to_non_nullable
@@ -167,10 +168,10 @@ return $default(_that);case _:
/// }
/// ```
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( int currentIndex, String firstName, String lastName, String email, String phone, String isoCode, String password, String repeatPassword, bool isShowPassword, bool acceptTerms, String emailError, String passwordError, String phoneError, String errorMessage, bool isLoading, bool showErrors, bool isCreated, bool showAccountCreated)? $default,{required TResult orElse(),}) {final _that = this;
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( int currentIndex, String firstName, String lastName, String email, String phone, String isoCode, String password, String repeatPassword, bool isShowPassword, bool acceptTerms, String emailError, String passwordError, String phoneError, String validationErrorKey, LegacySignupErrorEvent? apiErrorEvent, bool isLoading, bool showErrors, bool isCreated, bool showAccountCreated)? $default,{required TResult orElse(),}) {final _that = this;
switch (_that) {
case _LegacySignUpViewState() when $default != null:
return $default(_that.currentIndex,_that.firstName,_that.lastName,_that.email,_that.phone,_that.isoCode,_that.password,_that.repeatPassword,_that.isShowPassword,_that.acceptTerms,_that.emailError,_that.passwordError,_that.phoneError,_that.errorMessage,_that.isLoading,_that.showErrors,_that.isCreated,_that.showAccountCreated);case _:
return $default(_that.currentIndex,_that.firstName,_that.lastName,_that.email,_that.phone,_that.isoCode,_that.password,_that.repeatPassword,_that.isShowPassword,_that.acceptTerms,_that.emailError,_that.passwordError,_that.phoneError,_that.validationErrorKey,_that.apiErrorEvent,_that.isLoading,_that.showErrors,_that.isCreated,_that.showAccountCreated);case _:
return orElse();
}
@@ -188,10 +189,10 @@ return $default(_that.currentIndex,_that.firstName,_that.lastName,_that.email,_t
/// }
/// ```
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( int currentIndex, String firstName, String lastName, String email, String phone, String isoCode, String password, String repeatPassword, bool isShowPassword, bool acceptTerms, String emailError, String passwordError, String phoneError, String errorMessage, bool isLoading, bool showErrors, bool isCreated, bool showAccountCreated) $default,) {final _that = this;
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( int currentIndex, String firstName, String lastName, String email, String phone, String isoCode, String password, String repeatPassword, bool isShowPassword, bool acceptTerms, String emailError, String passwordError, String phoneError, String validationErrorKey, LegacySignupErrorEvent? apiErrorEvent, bool isLoading, bool showErrors, bool isCreated, bool showAccountCreated) $default,) {final _that = this;
switch (_that) {
case _LegacySignUpViewState():
return $default(_that.currentIndex,_that.firstName,_that.lastName,_that.email,_that.phone,_that.isoCode,_that.password,_that.repeatPassword,_that.isShowPassword,_that.acceptTerms,_that.emailError,_that.passwordError,_that.phoneError,_that.errorMessage,_that.isLoading,_that.showErrors,_that.isCreated,_that.showAccountCreated);case _:
return $default(_that.currentIndex,_that.firstName,_that.lastName,_that.email,_that.phone,_that.isoCode,_that.password,_that.repeatPassword,_that.isShowPassword,_that.acceptTerms,_that.emailError,_that.passwordError,_that.phoneError,_that.validationErrorKey,_that.apiErrorEvent,_that.isLoading,_that.showErrors,_that.isCreated,_that.showAccountCreated);case _:
throw StateError('Unexpected subclass');
}
@@ -208,10 +209,10 @@ return $default(_that.currentIndex,_that.firstName,_that.lastName,_that.email,_t
/// }
/// ```
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( int currentIndex, String firstName, String lastName, String email, String phone, String isoCode, String password, String repeatPassword, bool isShowPassword, bool acceptTerms, String emailError, String passwordError, String phoneError, String errorMessage, bool isLoading, bool showErrors, bool isCreated, bool showAccountCreated)? $default,) {final _that = this;
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( int currentIndex, String firstName, String lastName, String email, String phone, String isoCode, String password, String repeatPassword, bool isShowPassword, bool acceptTerms, String emailError, String passwordError, String phoneError, String validationErrorKey, LegacySignupErrorEvent? apiErrorEvent, bool isLoading, bool showErrors, bool isCreated, bool showAccountCreated)? $default,) {final _that = this;
switch (_that) {
case _LegacySignUpViewState() when $default != null:
return $default(_that.currentIndex,_that.firstName,_that.lastName,_that.email,_that.phone,_that.isoCode,_that.password,_that.repeatPassword,_that.isShowPassword,_that.acceptTerms,_that.emailError,_that.passwordError,_that.phoneError,_that.errorMessage,_that.isLoading,_that.showErrors,_that.isCreated,_that.showAccountCreated);case _:
return $default(_that.currentIndex,_that.firstName,_that.lastName,_that.email,_that.phone,_that.isoCode,_that.password,_that.repeatPassword,_that.isShowPassword,_that.acceptTerms,_that.emailError,_that.passwordError,_that.phoneError,_that.validationErrorKey,_that.apiErrorEvent,_that.isLoading,_that.showErrors,_that.isCreated,_that.showAccountCreated);case _:
return null;
}
@@ -223,7 +224,7 @@ return $default(_that.currentIndex,_that.firstName,_that.lastName,_that.email,_t
class _LegacySignUpViewState implements LegacySignUpViewState {
const _LegacySignUpViewState({this.currentIndex = 0, this.firstName = '', this.lastName = '', this.email = '', this.phone = '', this.isoCode = 'ES', this.password = '', this.repeatPassword = '', this.isShowPassword = false, this.acceptTerms = false, this.emailError = '', this.passwordError = '', this.phoneError = '', this.errorMessage = '', this.isLoading = false, this.showErrors = false, this.isCreated = false, this.showAccountCreated = false});
const _LegacySignUpViewState({this.currentIndex = 0, this.firstName = '', this.lastName = '', this.email = '', this.phone = '', this.isoCode = 'ES', this.password = '', this.repeatPassword = '', this.isShowPassword = false, this.acceptTerms = false, this.emailError = '', this.passwordError = '', this.phoneError = '', this.validationErrorKey = '', this.apiErrorEvent, this.isLoading = false, this.showErrors = false, this.isCreated = false, this.showAccountCreated = false});
@override@JsonKey() final int currentIndex;
@@ -239,7 +240,8 @@ class _LegacySignUpViewState implements LegacySignUpViewState {
@override@JsonKey() final String emailError;
@override@JsonKey() final String passwordError;
@override@JsonKey() final String phoneError;
@override@JsonKey() final String errorMessage;
@override@JsonKey() final String validationErrorKey;
@override final LegacySignupErrorEvent? apiErrorEvent;
@override@JsonKey() final bool isLoading;
@override@JsonKey() final bool showErrors;
@override@JsonKey() final bool isCreated;
@@ -255,16 +257,16 @@ _$LegacySignUpViewStateCopyWith<_LegacySignUpViewState> get copyWith => __$Legac
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is _LegacySignUpViewState&&(identical(other.currentIndex, currentIndex) || other.currentIndex == currentIndex)&&(identical(other.firstName, firstName) || other.firstName == firstName)&&(identical(other.lastName, lastName) || other.lastName == lastName)&&(identical(other.email, email) || other.email == email)&&(identical(other.phone, phone) || other.phone == phone)&&(identical(other.isoCode, isoCode) || other.isoCode == isoCode)&&(identical(other.password, password) || other.password == password)&&(identical(other.repeatPassword, repeatPassword) || other.repeatPassword == repeatPassword)&&(identical(other.isShowPassword, isShowPassword) || other.isShowPassword == isShowPassword)&&(identical(other.acceptTerms, acceptTerms) || other.acceptTerms == acceptTerms)&&(identical(other.emailError, emailError) || other.emailError == emailError)&&(identical(other.passwordError, passwordError) || other.passwordError == passwordError)&&(identical(other.phoneError, phoneError) || other.phoneError == phoneError)&&(identical(other.errorMessage, errorMessage) || other.errorMessage == errorMessage)&&(identical(other.isLoading, isLoading) || other.isLoading == isLoading)&&(identical(other.showErrors, showErrors) || other.showErrors == showErrors)&&(identical(other.isCreated, isCreated) || other.isCreated == isCreated)&&(identical(other.showAccountCreated, showAccountCreated) || other.showAccountCreated == showAccountCreated));
return identical(this, other) || (other.runtimeType == runtimeType&&other is _LegacySignUpViewState&&(identical(other.currentIndex, currentIndex) || other.currentIndex == currentIndex)&&(identical(other.firstName, firstName) || other.firstName == firstName)&&(identical(other.lastName, lastName) || other.lastName == lastName)&&(identical(other.email, email) || other.email == email)&&(identical(other.phone, phone) || other.phone == phone)&&(identical(other.isoCode, isoCode) || other.isoCode == isoCode)&&(identical(other.password, password) || other.password == password)&&(identical(other.repeatPassword, repeatPassword) || other.repeatPassword == repeatPassword)&&(identical(other.isShowPassword, isShowPassword) || other.isShowPassword == isShowPassword)&&(identical(other.acceptTerms, acceptTerms) || other.acceptTerms == acceptTerms)&&(identical(other.emailError, emailError) || other.emailError == emailError)&&(identical(other.passwordError, passwordError) || other.passwordError == passwordError)&&(identical(other.phoneError, phoneError) || other.phoneError == phoneError)&&(identical(other.validationErrorKey, validationErrorKey) || other.validationErrorKey == validationErrorKey)&&(identical(other.apiErrorEvent, apiErrorEvent) || other.apiErrorEvent == apiErrorEvent)&&(identical(other.isLoading, isLoading) || other.isLoading == isLoading)&&(identical(other.showErrors, showErrors) || other.showErrors == showErrors)&&(identical(other.isCreated, isCreated) || other.isCreated == isCreated)&&(identical(other.showAccountCreated, showAccountCreated) || other.showAccountCreated == showAccountCreated));
}
@override
int get hashCode => Object.hash(runtimeType,currentIndex,firstName,lastName,email,phone,isoCode,password,repeatPassword,isShowPassword,acceptTerms,emailError,passwordError,phoneError,errorMessage,isLoading,showErrors,isCreated,showAccountCreated);
int get hashCode => Object.hashAll([runtimeType,currentIndex,firstName,lastName,email,phone,isoCode,password,repeatPassword,isShowPassword,acceptTerms,emailError,passwordError,phoneError,validationErrorKey,apiErrorEvent,isLoading,showErrors,isCreated,showAccountCreated]);
@override
String toString() {
return 'LegacySignUpViewState(currentIndex: $currentIndex, firstName: $firstName, lastName: $lastName, email: $email, phone: $phone, isoCode: $isoCode, password: $password, repeatPassword: $repeatPassword, isShowPassword: $isShowPassword, acceptTerms: $acceptTerms, emailError: $emailError, passwordError: $passwordError, phoneError: $phoneError, errorMessage: $errorMessage, isLoading: $isLoading, showErrors: $showErrors, isCreated: $isCreated, showAccountCreated: $showAccountCreated)';
return 'LegacySignUpViewState(currentIndex: $currentIndex, firstName: $firstName, lastName: $lastName, email: $email, phone: $phone, isoCode: $isoCode, password: $password, repeatPassword: $repeatPassword, isShowPassword: $isShowPassword, acceptTerms: $acceptTerms, emailError: $emailError, passwordError: $passwordError, phoneError: $phoneError, validationErrorKey: $validationErrorKey, apiErrorEvent: $apiErrorEvent, isLoading: $isLoading, showErrors: $showErrors, isCreated: $isCreated, showAccountCreated: $showAccountCreated)';
}
@@ -275,7 +277,7 @@ abstract mixin class _$LegacySignUpViewStateCopyWith<$Res> implements $LegacySig
factory _$LegacySignUpViewStateCopyWith(_LegacySignUpViewState value, $Res Function(_LegacySignUpViewState) _then) = __$LegacySignUpViewStateCopyWithImpl;
@override @useResult
$Res call({
int currentIndex, String firstName, String lastName, String email, String phone, String isoCode, String password, String repeatPassword, bool isShowPassword, bool acceptTerms, String emailError, String passwordError, String phoneError, String errorMessage, bool isLoading, bool showErrors, bool isCreated, bool showAccountCreated
int currentIndex, String firstName, String lastName, String email, String phone, String isoCode, String password, String repeatPassword, bool isShowPassword, bool acceptTerms, String emailError, String passwordError, String phoneError, String validationErrorKey, LegacySignupErrorEvent? apiErrorEvent, bool isLoading, bool showErrors, bool isCreated, bool showAccountCreated
});
@@ -292,7 +294,7 @@ class __$LegacySignUpViewStateCopyWithImpl<$Res>
/// Create a copy of LegacySignUpViewState
/// with the given fields replaced by the non-null parameter values.
@override @pragma('vm:prefer-inline') $Res call({Object? currentIndex = null,Object? firstName = null,Object? lastName = null,Object? email = null,Object? phone = null,Object? isoCode = null,Object? password = null,Object? repeatPassword = null,Object? isShowPassword = null,Object? acceptTerms = null,Object? emailError = null,Object? passwordError = null,Object? phoneError = null,Object? errorMessage = null,Object? isLoading = null,Object? showErrors = null,Object? isCreated = null,Object? showAccountCreated = null,}) {
@override @pragma('vm:prefer-inline') $Res call({Object? currentIndex = null,Object? firstName = null,Object? lastName = null,Object? email = null,Object? phone = null,Object? isoCode = null,Object? password = null,Object? repeatPassword = null,Object? isShowPassword = null,Object? acceptTerms = null,Object? emailError = null,Object? passwordError = null,Object? phoneError = null,Object? validationErrorKey = null,Object? apiErrorEvent = freezed,Object? isLoading = null,Object? showErrors = null,Object? isCreated = null,Object? showAccountCreated = null,}) {
return _then(_LegacySignUpViewState(
currentIndex: null == currentIndex ? _self.currentIndex : currentIndex // ignore: cast_nullable_to_non_nullable
as int,firstName: null == firstName ? _self.firstName : firstName // ignore: cast_nullable_to_non_nullable
@@ -307,8 +309,9 @@ as bool,acceptTerms: null == acceptTerms ? _self.acceptTerms : acceptTerms // ig
as bool,emailError: null == emailError ? _self.emailError : emailError // ignore: cast_nullable_to_non_nullable
as String,passwordError: null == passwordError ? _self.passwordError : passwordError // ignore: cast_nullable_to_non_nullable
as String,phoneError: null == phoneError ? _self.phoneError : phoneError // ignore: cast_nullable_to_non_nullable
as String,errorMessage: null == errorMessage ? _self.errorMessage : errorMessage // ignore: cast_nullable_to_non_nullable
as String,isLoading: null == isLoading ? _self.isLoading : isLoading // ignore: cast_nullable_to_non_nullable
as String,validationErrorKey: null == validationErrorKey ? _self.validationErrorKey : validationErrorKey // ignore: cast_nullable_to_non_nullable
as String,apiErrorEvent: freezed == apiErrorEvent ? _self.apiErrorEvent : apiErrorEvent // ignore: cast_nullable_to_non_nullable
as LegacySignupErrorEvent?,isLoading: null == isLoading ? _self.isLoading : isLoading // ignore: cast_nullable_to_non_nullable
as bool,showErrors: null == showErrors ? _self.showErrors : showErrors // ignore: cast_nullable_to_non_nullable
as bool,isCreated: null == isCreated ? _self.isCreated : isCreated // ignore: cast_nullable_to_non_nullable
as bool,showAccountCreated: null == showAccountCreated ? _self.showAccountCreated : showAccountCreated // ignore: cast_nullable_to_non_nullable

View File

@@ -83,6 +83,7 @@
"authErrorInvalidToken": "Ihre Sitzung ist abgelaufen. Bitte melden Sie sich erneut an.",
"authErrorTooManyAttempts": "Zu viele Versuche. Bitte warten Sie einige Minuten und versuchen Sie es erneut.",
"authErrorNetwork": "Keine Verbindung. Überprüfen Sie Ihr Netzwerk und versuchen Sie es erneut.",
"signupErrorInvalidField": "Eines der Felder ist ungültig. Bitte überprüfen Sie es und versuchen Sie es erneut.",
"stepUserContactSupertitle": "Benutzer und Kontakt",
"stepUserContactTitle": "Erstelle dein Konto",
"stepUserContactSubtitle": "Mit deiner E-Mail und deiner Telefonnummer können wir dich jederzeit informieren",

View File

@@ -83,6 +83,7 @@
"authErrorInvalidToken": "Your session has expired. Please log in again.",
"authErrorTooManyAttempts": "Too many attempts. Please wait a few minutes and try again.",
"authErrorNetwork": "No connection. Check your network and try again.",
"signupErrorInvalidField": "One of the fields is invalid. Please check and try again.",
"stepUserContactSupertitle": "User & contact",
"stepUserContactTitle": "Create your account",
"stepUserContactSubtitle": "With your email and phone number we can keep you informed at all times",

View File

@@ -83,6 +83,7 @@
"authErrorInvalidToken": "La sesión ha caducado. Vuelve a iniciar sesión.",
"authErrorTooManyAttempts": "Demasiados intentos. Espera unos minutos e inténtalo de nuevo.",
"authErrorNetwork": "No hay conexión. Comprueba tu red e inténtalo de nuevo.",
"signupErrorInvalidField": "Alguno de los campos no es válido. Revísalos e inténtalo de nuevo.",
"stepUserContactSupertitle": "Usuario y contacto",
"stepUserContactTitle": "Crea tu usuario",
"stepUserContactSubtitle": "Con tu email y tu número podremos mantenerte siempre informado",

View File

@@ -83,6 +83,7 @@
"authErrorInvalidToken": "Votre session a expiré. Veuillez vous reconnecter.",
"authErrorTooManyAttempts": "Trop de tentatives. Patientez quelques minutes avant de réessayer.",
"authErrorNetwork": "Pas de connexion. Vérifiez votre réseau et réessayez.",
"signupErrorInvalidField": "L'un des champs n'est pas valide. Vérifiez et réessayez.",
"stepUserContactSupertitle": "Utilisateur et contact",
"stepUserContactTitle": "Crée ton compte",
"stepUserContactSubtitle": "Avec ton e-mail et ton numéro, nous pourrons te tenir informé à tout moment",

View File

@@ -83,6 +83,7 @@
"authErrorInvalidToken": "La tua sessione è scaduta. Accedi di nuovo.",
"authErrorTooManyAttempts": "Troppi tentativi. Attendi qualche minuto e riprova.",
"authErrorNetwork": "Nessuna connessione. Controlla la tua rete e riprova.",
"signupErrorInvalidField": "Uno dei campi non è valido. Controlla e riprova.",
"stepUserContactSupertitle": "Utente e contatti",
"stepUserContactTitle": "Crea il tuo account",
"stepUserContactSubtitle": "Con la tua email e il tuo numero potremo tenerti sempre informato",

View File

@@ -83,6 +83,7 @@
"authErrorInvalidToken": "A tua sessão expirou. Volta a iniciar sessão.",
"authErrorTooManyAttempts": "Demasiadas tentativas. Aguarda alguns minutos e tenta novamente.",
"authErrorNetwork": "Sem ligação. Verifica a tua rede e tenta novamente.",
"signupErrorInvalidField": "Um dos campos não é válido. Verifica e tenta novamente.",
"stepUserContactSupertitle": "Utilizador e contacto",
"stepUserContactTitle": "Cria a tua conta",
"stepUserContactSubtitle": "Com o teu email e o teu número poderemos manter-te sempre informado",

View File

@@ -423,6 +423,7 @@ class I18n {
static const String authErrorInvalidToken = 'authErrorInvalidToken';
static const String authErrorTooManyAttempts = 'authErrorTooManyAttempts';
static const String authErrorNetwork = 'authErrorNetwork';
static const String signupErrorInvalidField = 'signupErrorInvalidField';
static const String errorGeofenceCreate = 'errorGeofenceCreate';
static const String errorGeofenceDelete = 'errorGeofenceDelete';
static const String errorGeofenceUpdate = 'errorGeofenceUpdate';