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