milestone/stable-1-reconcile-auth-3 #176
@ -14,6 +14,7 @@
 | 
			
		||||
// You should have received a copy of the GNU General Public License
 | 
			
		||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
 | 
			
		||||
 | 
			
		||||
import 'package:flutter/foundation.dart';
 | 
			
		||||
import 'package:wyatt_architecture/wyatt_architecture.dart';
 | 
			
		||||
import 'package:wyatt_authentication_bloc/wyatt_authentication_bloc.dart';
 | 
			
		||||
import 'package:wyatt_type_utils/wyatt_type_utils.dart';
 | 
			
		||||
@ -24,35 +25,35 @@ class ExampleAuthenticationCubit extends AuthenticationCubit<int> {
 | 
			
		||||
  @override
 | 
			
		||||
  FutureOrResult<int?> onReauthenticate(
 | 
			
		||||
      Result<Account, AppException> result) async {
 | 
			
		||||
    print('onReauthenticate');
 | 
			
		||||
    debugPrint('onReauthenticate');
 | 
			
		||||
 | 
			
		||||
    return const Ok(1);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  @override
 | 
			
		||||
  FutureOrResult<int?> onRefresh(Result<Account, AppException> result) {
 | 
			
		||||
    print('onRefresh');
 | 
			
		||||
    debugPrint('onRefresh');
 | 
			
		||||
 | 
			
		||||
    return const Ok(1);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  @override
 | 
			
		||||
  FutureOrResult<int?> onSignInFromCache(AuthenticationSession<int> session) {
 | 
			
		||||
    print('onSignInFromCache');
 | 
			
		||||
    debugPrint('onSignInFromCache');
 | 
			
		||||
 | 
			
		||||
    return const Ok(1);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  @override
 | 
			
		||||
  FutureOrResult<void> onSignOut() {
 | 
			
		||||
    print('onSignOut');
 | 
			
		||||
    debugPrint('onSignOut');
 | 
			
		||||
 | 
			
		||||
    return const Ok(null);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  @override
 | 
			
		||||
  FutureOrResult<void> onDelete() {
 | 
			
		||||
    print('onDelete');
 | 
			
		||||
    debugPrint('onDelete');
 | 
			
		||||
 | 
			
		||||
    return const Ok(null);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
@ -14,6 +14,7 @@
 | 
			
		||||
// You should have received a copy of the GNU General Public License
 | 
			
		||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
 | 
			
		||||
 | 
			
		||||
import 'package:flutter/foundation.dart';
 | 
			
		||||
import 'package:wyatt_architecture/wyatt_architecture.dart';
 | 
			
		||||
import 'package:wyatt_authentication_bloc/wyatt_authentication_bloc.dart';
 | 
			
		||||
import 'package:wyatt_form_bloc/wyatt_form_bloc.dart';
 | 
			
		||||
@ -27,7 +28,7 @@ class ExampleSignInCubit extends SignInCubit<int> {
 | 
			
		||||
  @override
 | 
			
		||||
  FutureOrResult<int?> onSignInWithEmailAndPassword(
 | 
			
		||||
      Result<Account, AppException> result, WyattForm form) {
 | 
			
		||||
    print('onSignInWithEmailAndPassword: ${result.ok?.accessToken}');
 | 
			
		||||
    debugPrint('onSignInWithEmailAndPassword: ${result.ok?.accessToken}');
 | 
			
		||||
 | 
			
		||||
    return const Ok(1);
 | 
			
		||||
  }
 | 
			
		||||
@ -35,7 +36,7 @@ class ExampleSignInCubit extends SignInCubit<int> {
 | 
			
		||||
  @override
 | 
			
		||||
  FutureOrResult<int?> onSignInAnonymously(
 | 
			
		||||
      Result<Account, AppException> result, WyattForm form) {
 | 
			
		||||
    print('onSignInAnonymously');
 | 
			
		||||
    debugPrint('onSignInAnonymously');
 | 
			
		||||
 | 
			
		||||
    return const Ok(1);
 | 
			
		||||
  }
 | 
			
		||||
@ -43,7 +44,7 @@ class ExampleSignInCubit extends SignInCubit<int> {
 | 
			
		||||
  @override
 | 
			
		||||
  FutureOrResult<int?> onSignInWithGoogle(
 | 
			
		||||
      Result<Account, AppException> result, WyattForm form) {
 | 
			
		||||
    print('onSignInWithGoogle');
 | 
			
		||||
    debugPrint('onSignInWithGoogle');
 | 
			
		||||
 | 
			
		||||
    return const Ok(1);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
@ -14,6 +14,7 @@
 | 
			
		||||
// You should have received a copy of the GNU General Public License
 | 
			
		||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
 | 
			
		||||
 | 
			
		||||
import 'package:flutter/foundation.dart';
 | 
			
		||||
import 'package:wyatt_architecture/wyatt_architecture.dart';
 | 
			
		||||
import 'package:wyatt_authentication_bloc/wyatt_authentication_bloc.dart';
 | 
			
		||||
import 'package:wyatt_form_bloc/wyatt_form_bloc.dart';
 | 
			
		||||
@ -27,7 +28,7 @@ class ExampleSignUpCubit extends SignUpCubit<int> {
 | 
			
		||||
  @override
 | 
			
		||||
  FutureOrResult<int?> onSignUpWithEmailAndPassword(
 | 
			
		||||
      Result<Account, AppException> result, WyattForm form) async {
 | 
			
		||||
    print('onSignUpWithEmailAndPassword');
 | 
			
		||||
    debugPrint('onSignUpWithEmailAndPassword');
 | 
			
		||||
 | 
			
		||||
    return const Ok(1);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
@ -14,6 +14,7 @@
 | 
			
		||||
// You should have received a copy of the GNU General Public License
 | 
			
		||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
 | 
			
		||||
 | 
			
		||||
import 'package:flutter/foundation.dart';
 | 
			
		||||
import 'package:wyatt_architecture/wyatt_architecture.dart';
 | 
			
		||||
import 'package:wyatt_authentication_bloc/wyatt_authentication_bloc.dart';
 | 
			
		||||
import 'package:wyatt_form_bloc/wyatt_form_bloc.dart';
 | 
			
		||||
@ -25,7 +26,7 @@ class ExampleEditAccountCubit extends EditAccountCubit<int> {
 | 
			
		||||
  @override
 | 
			
		||||
  FutureOrResult<int?> onEmailUpdated(
 | 
			
		||||
      Result<Account, AppException> result, WyattForm form) async {
 | 
			
		||||
    print('onEmailUpdated');
 | 
			
		||||
    debugPrint('onEmailUpdated');
 | 
			
		||||
 | 
			
		||||
    return const Ok(1);
 | 
			
		||||
  }
 | 
			
		||||
@ -33,7 +34,7 @@ class ExampleEditAccountCubit extends EditAccountCubit<int> {
 | 
			
		||||
  @override
 | 
			
		||||
  FutureOrResult<int?> onPasswordUpdated(
 | 
			
		||||
      Result<Account, AppException> result, WyattForm form) async {
 | 
			
		||||
    print('onPasswordUpdated');
 | 
			
		||||
    debugPrint('onPasswordUpdated');
 | 
			
		||||
 | 
			
		||||
    return const Ok(1);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
@ -91,12 +91,10 @@ class FetchSignInMethodsForEmailFailureMock
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/// {@macro sign_in_anonymously_failure}
 | 
			
		||||
class SignInAnonymouslyFailureMock
 | 
			
		||||
    extends SignInAnonymouslyFailureInterface {
 | 
			
		||||
class SignInAnonymouslyFailureMock extends SignInAnonymouslyFailureInterface {
 | 
			
		||||
  SignInAnonymouslyFailureMock([String? code, String? msg])
 | 
			
		||||
      : super(code ?? 'unknown', msg ?? 'An unknown error occurred.');
 | 
			
		||||
  SignInAnonymouslyFailureMock.fromCode(String code)
 | 
			
		||||
      : super.fromCode(code) {
 | 
			
		||||
  SignInAnonymouslyFailureMock.fromCode(String code) : super.fromCode(code) {
 | 
			
		||||
    switch (code) {
 | 
			
		||||
      case 'operation-not-allowed':
 | 
			
		||||
        msg = 'Operation is not allowed. Please contact support.';
 | 
			
		||||
@ -113,8 +111,7 @@ class SignInWithCredentialFailureMock
 | 
			
		||||
    extends SignInWithCredentialFailureInterface {
 | 
			
		||||
  SignInWithCredentialFailureMock([String? code, String? msg])
 | 
			
		||||
      : super(code ?? 'unknown', msg ?? 'An unknown error occurred.');
 | 
			
		||||
  SignInWithCredentialFailureMock.fromCode(String code)
 | 
			
		||||
      : super.fromCode(code) {
 | 
			
		||||
  SignInWithCredentialFailureMock.fromCode(String code) : super.fromCode(code) {
 | 
			
		||||
    switch (code) {
 | 
			
		||||
      case 'account-exists-with-different-credential':
 | 
			
		||||
        msg = 'Account exists with different credentials.';
 | 
			
		||||
@ -148,16 +145,14 @@ class SignInWithCredentialFailureMock
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/// {@macro sign_in_with_google_failure}
 | 
			
		||||
class SignInWithGoogleFailureMock
 | 
			
		||||
    extends SignInWithCredentialFailureMock
 | 
			
		||||
class SignInWithGoogleFailureMock extends SignInWithCredentialFailureMock
 | 
			
		||||
    implements SignInWithGoogleFailureInterface {
 | 
			
		||||
  SignInWithGoogleFailureMock([super.code, super.msg]);
 | 
			
		||||
  SignInWithGoogleFailureMock.fromCode(super.code) : super.fromCode();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/// {@macro sign_in_with_facebook_failure}
 | 
			
		||||
class SignInWithFacebookFailureMock
 | 
			
		||||
    extends SignInWithCredentialFailureMock
 | 
			
		||||
class SignInWithFacebookFailureMock extends SignInWithCredentialFailureMock
 | 
			
		||||
    implements SignInWithFacebookFailureInterface {
 | 
			
		||||
  SignInWithFacebookFailureMock([super.code, super.msg]);
 | 
			
		||||
  SignInWithFacebookFailureMock.fromCode(super.code) : super.fromCode();
 | 
			
		||||
@ -171,8 +166,7 @@ class SignInWithAppleFailureMock extends SignInWithCredentialFailureMock
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/// {@macro sign_in_with_twitter_failure}
 | 
			
		||||
class SignInWithTwitterFailureMock
 | 
			
		||||
    extends SignInWithCredentialFailureMock
 | 
			
		||||
class SignInWithTwitterFailureMock extends SignInWithCredentialFailureMock
 | 
			
		||||
    implements SignInWithAppleFailureInterface {
 | 
			
		||||
  SignInWithTwitterFailureMock([super.code, super.msg]);
 | 
			
		||||
  SignInWithTwitterFailureMock.fromCode(super.code) : super.fromCode();
 | 
			
		||||
@ -183,8 +177,7 @@ class SignInWithEmailLinkFailureMock
 | 
			
		||||
    extends SignInWithEmailLinkFailureInterface {
 | 
			
		||||
  SignInWithEmailLinkFailureMock([String? code, String? msg])
 | 
			
		||||
      : super(code ?? 'unknown', msg ?? 'An unknown error occurred.');
 | 
			
		||||
  SignInWithEmailLinkFailureMock.fromCode(String code)
 | 
			
		||||
      : super.fromCode(code) {
 | 
			
		||||
  SignInWithEmailLinkFailureMock.fromCode(String code) : super.fromCode(code) {
 | 
			
		||||
    switch (code) {
 | 
			
		||||
      case 'expired-action-code':
 | 
			
		||||
        msg = 'Action code has expired.';
 | 
			
		||||
@ -270,8 +263,7 @@ class VerifyPasswordResetCodeFailureMock
 | 
			
		||||
  VerifyPasswordResetCodeFailureMock([String? code, String? msg])
 | 
			
		||||
      : super(code ?? 'unknown', msg ?? 'An unknown error occurred.');
 | 
			
		||||
 | 
			
		||||
  VerifyPasswordResetCodeFailureMock.fromCode(super.code)
 | 
			
		||||
      : super.fromCode();
 | 
			
		||||
  VerifyPasswordResetCodeFailureMock.fromCode(super.code) : super.fromCode();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/// {@macro refresh_failure}
 | 
			
		||||
 | 
			
		||||
@ -121,7 +121,7 @@ void main() {
 | 
			
		||||
        'emits failure',
 | 
			
		||||
        setUp: () {
 | 
			
		||||
          when(() => authenticationRepository.sendEmailVerification())
 | 
			
		||||
              .thenAnswer((_) async => Err(ServerException('erreur')));
 | 
			
		||||
              .thenAnswer((_) async => const Err(ServerException('erreur')));
 | 
			
		||||
        },
 | 
			
		||||
        build: () => EmailVerificationCubit(
 | 
			
		||||
          authenticationRepository: authenticationRepository,
 | 
			
		||||
@ -222,7 +222,7 @@ void main() {
 | 
			
		||||
        'emits failure on refresh error',
 | 
			
		||||
        setUp: () {
 | 
			
		||||
          when(() => authenticationRepository.refresh())
 | 
			
		||||
              .thenAnswer((_) async => Err(ServerException('erreur')));
 | 
			
		||||
              .thenAnswer((_) async => const Err(ServerException('erreur')));
 | 
			
		||||
        },
 | 
			
		||||
        build: () => EmailVerificationCubit(
 | 
			
		||||
          authenticationRepository: authenticationRepository,
 | 
			
		||||
 | 
			
		||||
@ -272,7 +272,7 @@ void main() {
 | 
			
		||||
            () => authenticationRepository.sendPasswordResetEmail(
 | 
			
		||||
              email: any(named: 'email'),
 | 
			
		||||
            ),
 | 
			
		||||
          ).thenAnswer((_) async => Err(ServerException()));
 | 
			
		||||
          ).thenAnswer((_) async => const Err(ServerException()));
 | 
			
		||||
          when(
 | 
			
		||||
            () => formRepository.accessForm(AuthFormName.passwordResetForm),
 | 
			
		||||
          ).thenAnswer(
 | 
			
		||||
 | 
			
		||||
@ -435,7 +435,7 @@ void main() {
 | 
			
		||||
              email: any(named: 'email'),
 | 
			
		||||
              password: any(named: 'password'),
 | 
			
		||||
            ),
 | 
			
		||||
          ).thenAnswer((_) async => Err(ServerException()));
 | 
			
		||||
          ).thenAnswer((_) async => const Err(ServerException()));
 | 
			
		||||
          when(
 | 
			
		||||
            () => formRepository.accessForm(AuthFormName.signInForm),
 | 
			
		||||
          ).thenAnswer(
 | 
			
		||||
@ -615,7 +615,7 @@ void main() {
 | 
			
		||||
        setUp: () {
 | 
			
		||||
          when(
 | 
			
		||||
            () => authenticationRepository.signInAnonymously(),
 | 
			
		||||
          ).thenAnswer((_) async => Err(ServerException()));
 | 
			
		||||
          ).thenAnswer((_) async => const Err(ServerException()));
 | 
			
		||||
        },
 | 
			
		||||
        build: () => SignInCubit(
 | 
			
		||||
          authenticationRepository: authenticationRepository,
 | 
			
		||||
 | 
			
		||||
@ -406,7 +406,7 @@ void main() {
 | 
			
		||||
              email: any(named: 'email'),
 | 
			
		||||
              password: any(named: 'password'),
 | 
			
		||||
            ),
 | 
			
		||||
          ).thenAnswer((_) async => Err(ServerException()));
 | 
			
		||||
          ).thenAnswer((_) async => const Err(ServerException()));
 | 
			
		||||
          when(
 | 
			
		||||
            () => formRepository.accessForm(AuthFormName.signUpForm),
 | 
			
		||||
          ).thenAnswer(
 | 
			
		||||
 | 
			
		||||
@ -18,13 +18,17 @@ import 'package:wyatt_architecture/wyatt_architecture.dart';
 | 
			
		||||
import 'package:wyatt_crud_bloc/src/domain/entities/object_model.dart';
 | 
			
		||||
 | 
			
		||||
/// Defines every write operation in CRUD.
 | 
			
		||||
mixin CreateOperation<Model extends ObjectModel, Out> on AsyncUseCase<Model, Out> {}
 | 
			
		||||
mixin CreateOperation<Model extends ObjectModel, Out>
 | 
			
		||||
    on AsyncUseCase<Model, Out> {}
 | 
			
		||||
 | 
			
		||||
/// Defines every read operation in CRUD.
 | 
			
		||||
mixin ReadOperation<Model extends ObjectModel, In, Out> on AsyncUseCase<In, Out> {}
 | 
			
		||||
mixin ReadOperation<Model extends ObjectModel, In, Out>
 | 
			
		||||
    on AsyncUseCase<In, Out> {}
 | 
			
		||||
 | 
			
		||||
/// Defines every update operation in CRUD.
 | 
			
		||||
mixin UpdateOperation<Model extends ObjectModel, In> on AsyncUseCase<In, void> {}
 | 
			
		||||
mixin UpdateOperation<Model extends ObjectModel, In>
 | 
			
		||||
    on AsyncUseCase<In, void> {}
 | 
			
		||||
 | 
			
		||||
/// Defines every delete operation in CRUD.
 | 
			
		||||
mixin DeleteOperation<Model extends ObjectModel, In> on AsyncUseCase<In, void> {}
 | 
			
		||||
mixin DeleteOperation<Model extends ObjectModel, In>
 | 
			
		||||
    on AsyncUseCase<In, void> {}
 | 
			
		||||
 | 
			
		||||
@ -29,7 +29,7 @@ class Pipeline {
 | 
			
		||||
  /// {@macro pipeline}
 | 
			
		||||
  Pipeline.fromIterable(Iterable<Middleware> middlewares)
 | 
			
		||||
      : _middlewares = middlewares.toList();
 | 
			
		||||
  
 | 
			
		||||
 | 
			
		||||
  final List<Middleware> _middlewares;
 | 
			
		||||
 | 
			
		||||
  /// The length of the [Pipeline].
 | 
			
		||||
 | 
			
		||||
@ -38,7 +38,7 @@ class NavigationItem extends StatelessWidget {
 | 
			
		||||
                  context
 | 
			
		||||
                      .themeExtension<TopBarThemeExtension>()
 | 
			
		||||
                      ?.selectedIndicatorHeight,
 | 
			
		||||
                  // TODO: move default value
 | 
			
		||||
                  // TODO(wyatt): move default value
 | 
			
		||||
                  5,
 | 
			
		||||
                ],
 | 
			
		||||
                valueValidator: (value) => value != null,
 | 
			
		||||
@ -49,7 +49,7 @@ class NavigationItem extends StatelessWidget {
 | 
			
		||||
                  context
 | 
			
		||||
                      .themeExtension<TopBarThemeExtension>()
 | 
			
		||||
                      ?.selectedIndicatorWidth,
 | 
			
		||||
                  // TODO: move default value
 | 
			
		||||
                  // TODO(wyatt): move default value
 | 
			
		||||
                  70,
 | 
			
		||||
                ],
 | 
			
		||||
                valueValidator: (value) => value != null,
 | 
			
		||||
@ -72,16 +72,17 @@ class NavigationItem extends StatelessWidget {
 | 
			
		||||
          ConstrainedBox(
 | 
			
		||||
            constraints: BoxConstraints(
 | 
			
		||||
              minWidth: ThemeHelper.getThemeElement<double, double>(
 | 
			
		||||
                [
 | 
			
		||||
                  context
 | 
			
		||||
                      .themeExtension<TopBarThemeExtension>()
 | 
			
		||||
                      ?.selectedIndicatorWidth,
 | 
			
		||||
                  // TODO: move default value
 | 
			
		||||
                  70,
 | 
			
		||||
                ],
 | 
			
		||||
                valueValidator: (value) => value != null,
 | 
			
		||||
                transform: (value) => value,
 | 
			
		||||
              ) ?? double.infinity,
 | 
			
		||||
                    [
 | 
			
		||||
                      context
 | 
			
		||||
                          .themeExtension<TopBarThemeExtension>()
 | 
			
		||||
                          ?.selectedIndicatorWidth,
 | 
			
		||||
                      // TODO(wyatt): move default value
 | 
			
		||||
                      70,
 | 
			
		||||
                    ],
 | 
			
		||||
                    valueValidator: (value) => value != null,
 | 
			
		||||
                    transform: (value) => value,
 | 
			
		||||
                  ) ??
 | 
			
		||||
                  double.infinity,
 | 
			
		||||
            ),
 | 
			
		||||
            child: SizedBox(
 | 
			
		||||
              height: 50,
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user