diff --git a/packages/wyatt_authentication_bloc/analysis_options.yaml b/packages/wyatt_authentication_bloc/analysis_options.yaml index b0c6aced..82177cd5 100644 --- a/packages/wyatt_authentication_bloc/analysis_options.yaml +++ b/packages/wyatt_authentication_bloc/analysis_options.yaml @@ -1,4 +1 @@ -include: package:wyatt_analysis/analysis_options.flutter.yaml - -analyzer: - exclude: "!example/**" \ No newline at end of file +include: package:wyatt_analysis/analysis_options.flutter.yaml \ No newline at end of file diff --git a/packages/wyatt_authentication_bloc/example/.gitignore b/packages/wyatt_authentication_bloc/example/.gitignore index f0edd542..891ead31 100644 --- a/packages/wyatt_authentication_bloc/example/.gitignore +++ b/packages/wyatt_authentication_bloc/example/.gitignore @@ -44,6 +44,4 @@ app.*.map.json # Android Studio will place build artifacts here /android/app/debug /android/app/profile -/android/app/release - -firebase_options.dart \ No newline at end of file +/android/app/release \ No newline at end of file diff --git a/packages/wyatt_authentication_bloc/example/.vscode/launch.json b/packages/wyatt_authentication_bloc/example/.vscode/launch.json index 61fa495d..11233cfe 100644 --- a/packages/wyatt_authentication_bloc/example/.vscode/launch.json +++ b/packages/wyatt_authentication_bloc/example/.vscode/launch.json @@ -4,7 +4,7 @@ * ----- * File: launch.json * Created Date: 19/08/2022 15:12:25 - * Last Modified: 19/08/2022 15:22:02 + * Last Modified: Tue Dec 13 2022 * ----- * Copyright (c) 2022 */ @@ -15,11 +15,18 @@ "version": "0.2.0", "configurations": [ { - "name": "example_router", + "name": "Mock", "request": "launch", "type": "dart", "program": "lib/main.dart", "flutterMode": "debug" + }, + { + "name": "Firebase", + "request": "launch", + "type": "dart", + "program": "lib/main_firebase.dart", + "flutterMode": "debug" } ] } \ No newline at end of file diff --git a/packages/wyatt_authentication_bloc/example/ios/Podfile.lock b/packages/wyatt_authentication_bloc/example/ios/Podfile.lock index 1a4d1789..bc6894a5 100644 --- a/packages/wyatt_authentication_bloc/example/ios/Podfile.lock +++ b/packages/wyatt_authentication_bloc/example/ios/Podfile.lock @@ -5,41 +5,30 @@ PODS: - AppAuth/Core (1.6.0) - AppAuth/ExternalUserAgent (1.6.0): - AppAuth/Core - - FBAEMKit (14.1.0): - - FBSDKCoreKit_Basics (= 14.1.0) - - FBSDKCoreKit (14.1.0): - - FBAEMKit (= 14.1.0) - - FBSDKCoreKit_Basics (= 14.1.0) - - FBSDKCoreKit_Basics (14.1.0) - - FBSDKLoginKit (14.1.0): - - FBSDKCoreKit (= 14.1.0) - - Firebase/Auth (10.0.0): + - Firebase/Auth (10.3.0): - Firebase/CoreOnly - - FirebaseAuth (~> 10.0.0) - - Firebase/CoreOnly (10.0.0): - - FirebaseCore (= 10.0.0) - - firebase_auth (4.1.1): - - Firebase/Auth (= 10.0.0) + - FirebaseAuth (~> 10.3.0) + - Firebase/CoreOnly (10.3.0): + - FirebaseCore (= 10.3.0) + - firebase_auth (4.2.0): + - Firebase/Auth (= 10.3.0) - firebase_core - Flutter - - firebase_core (2.1.1): - - Firebase/CoreOnly (= 10.0.0) + - firebase_core (2.4.0): + - Firebase/CoreOnly (= 10.3.0) - Flutter - - FirebaseAuth (10.0.0): + - FirebaseAuth (10.3.0): - FirebaseCore (~> 10.0) - GoogleUtilities/AppDelegateSwizzler (~> 7.8) - GoogleUtilities/Environment (~> 7.8) - - GTMSessionFetcher/Core (~> 2.1) - - FirebaseCore (10.0.0): + - GTMSessionFetcher/Core (< 4.0, >= 2.1) + - FirebaseCore (10.3.0): - FirebaseCoreInternal (~> 10.0) - GoogleUtilities/Environment (~> 7.8) - GoogleUtilities/Logger (~> 7.8) - - FirebaseCoreInternal (10.1.0): + - FirebaseCoreInternal (10.3.0): - "GoogleUtilities/NSData+zlib (~> 7.8)" - Flutter (1.0.0) - - flutter_facebook_auth (4.4.1): - - FBSDKLoginKit (= 14.1.0) - - Flutter - google_sign_in_ios (0.0.1): - Flutter - GoogleSignIn (~> 6.2) @@ -47,47 +36,36 @@ PODS: - AppAuth (~> 1.5) - GTMAppAuth (~> 1.3) - GTMSessionFetcher/Core (< 3.0, >= 1.1) - - GoogleUtilities/AppDelegateSwizzler (7.8.0): + - GoogleUtilities/AppDelegateSwizzler (7.10.0): - GoogleUtilities/Environment - GoogleUtilities/Logger - GoogleUtilities/Network - - GoogleUtilities/Environment (7.8.0): + - GoogleUtilities/Environment (7.10.0): - PromisesObjC (< 3.0, >= 1.2) - - GoogleUtilities/Logger (7.8.0): + - GoogleUtilities/Logger (7.10.0): - GoogleUtilities/Environment - - GoogleUtilities/Network (7.8.0): + - GoogleUtilities/Network (7.10.0): - GoogleUtilities/Logger - "GoogleUtilities/NSData+zlib" - GoogleUtilities/Reachability - - "GoogleUtilities/NSData+zlib (7.8.0)" - - GoogleUtilities/Reachability (7.8.0): + - "GoogleUtilities/NSData+zlib (7.10.0)" + - GoogleUtilities/Reachability (7.10.0): - GoogleUtilities/Logger - GTMAppAuth (1.3.1): - AppAuth/Core (~> 1.6) - GTMSessionFetcher/Core (< 3.0, >= 1.5) - - GTMSessionFetcher/Core (2.1.0) + - GTMSessionFetcher/Core (2.3.0) - PromisesObjC (2.1.1) - - sign_in_with_apple (0.0.1): - - Flutter - - twitter_login (0.0.1): - - Flutter DEPENDENCIES: - firebase_auth (from `.symlinks/plugins/firebase_auth/ios`) - firebase_core (from `.symlinks/plugins/firebase_core/ios`) - Flutter (from `Flutter`) - - flutter_facebook_auth (from `.symlinks/plugins/flutter_facebook_auth/ios`) - google_sign_in_ios (from `.symlinks/plugins/google_sign_in_ios/ios`) - - sign_in_with_apple (from `.symlinks/plugins/sign_in_with_apple/ios`) - - twitter_login (from `.symlinks/plugins/twitter_login/ios`) SPEC REPOS: trunk: - AppAuth - - FBAEMKit - - FBSDKCoreKit - - FBSDKCoreKit_Basics - - FBSDKLoginKit - Firebase - FirebaseAuth - FirebaseCore @@ -105,37 +83,24 @@ EXTERNAL SOURCES: :path: ".symlinks/plugins/firebase_core/ios" Flutter: :path: Flutter - flutter_facebook_auth: - :path: ".symlinks/plugins/flutter_facebook_auth/ios" google_sign_in_ios: :path: ".symlinks/plugins/google_sign_in_ios/ios" - sign_in_with_apple: - :path: ".symlinks/plugins/sign_in_with_apple/ios" - twitter_login: - :path: ".symlinks/plugins/twitter_login/ios" SPEC CHECKSUMS: AppAuth: 8fca6b5563a5baef2c04bee27538025e4ceb2add - FBAEMKit: a899515e45476027f73aef377b5cffadcd56ca3a - FBSDKCoreKit: 24f8bc8d3b5b2a8c5c656a1329492a12e8efa792 - FBSDKCoreKit_Basics: 6e578c9bdc7aa1365dbbbde633c9ebb536bcaa98 - FBSDKLoginKit: 787de205d524c3a4b17d527916f1d066e4361660 - Firebase: 1b810f3d0c0532e27a48f1961f8c0400a668a2cf - firebase_auth: dd33e93fce72a1c72040f7380dacf06e89db5705 - firebase_core: 5c0bb0ca7d0e70480a68a6e9ad9bf55d1edd5305 - FirebaseAuth: 493382cf533cc45e2862b00e9aa4cfe4c98daf71 - FirebaseCore: 97f48a3a567a72b8d4daa0f03c3aadb78df4e995 - FirebaseCoreInternal: 96d75228e10fd369564da51bd898414eb0f54df5 + Firebase: f92fc551ead69c94168d36c2b26188263860acd9 + firebase_auth: 579a0dc15451491cc83fccaa5102296635f24938 + firebase_core: 6f2f753e316765799d88568232ed59e300ff53db + FirebaseAuth: 0e415d29d846c1dce2fb641e46f35e9888d9bec6 + FirebaseCore: 988754646ab3bd4bdcb740f1bfe26b9f6c0d5f2a + FirebaseCoreInternal: 29b76f784d607df8b2a1259d73c3f04f1210137b Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854 - flutter_facebook_auth: 361ac7a57263ebf327f26089507ead0d66558ee8 google_sign_in_ios: 4f85eb9f937450765c8573bb85fd8cd6a5af675c GoogleSignIn: 5651ce3a61e56ca864160e79b484cd9ed3f49b7a - GoogleUtilities: 1d20a6ad97ef46f67bbdec158ce00563a671ebb7 + GoogleUtilities: bad72cb363809015b1f7f19beb1f1cd23c589f95 GTMAppAuth: 0ff230db599948a9ad7470ca667337803b3fc4dd - GTMSessionFetcher: ffbb25ec00ebcb5201adab0a56d808f6f1902d9f + GTMSessionFetcher: 3a63d75eecd6aa32c2fc79f578064e1214dfdec2 PromisesObjC: ab77feca74fa2823e7af4249b8326368e61014cb - sign_in_with_apple: f3bf75217ea4c2c8b91823f225d70230119b8440 - twitter_login: 2794db69b7640681171b17b3c2c84ad9dfb4a57f PODFILE CHECKSUM: ef19549a9bc3046e7bb7d2fab4d021637c0c58a3 diff --git a/packages/wyatt_authentication_bloc/example/ios/Runner/Info.plist b/packages/wyatt_authentication_bloc/example/ios/Runner/Info.plist index e2987027..e8c1f83a 100644 --- a/packages/wyatt_authentication_bloc/example/ios/Runner/Info.plist +++ b/packages/wyatt_authentication_bloc/example/ios/Runner/Info.plist @@ -28,6 +28,17 @@ LaunchScreen UIMainStoryboardFile Main + CFBundleURLTypes + + + CFBundleTypeRole + Editor + CFBundleURLSchemes + + com.googleusercontent.apps.405351917235-2jv4ff02kovoim58f8d6d0rsa14apgkj + + + UISupportedInterfaceOrientations UIInterfaceOrientationPortrait diff --git a/packages/wyatt_authentication_bloc/example/ios/firebase_app_id_file.json b/packages/wyatt_authentication_bloc/example/ios/firebase_app_id_file.json index 17445d1d..2a145385 100644 --- a/packages/wyatt_authentication_bloc/example/ios/firebase_app_id_file.json +++ b/packages/wyatt_authentication_bloc/example/ios/firebase_app_id_file.json @@ -1,7 +1,7 @@ { "file_generated_by": "FlutterFire CLI", "purpose": "FirebaseAppID & ProjectID for this Firebase app in this directory", - "GOOGLE_APP_ID": "1:136771801992:ios:bcdca68d2b7d227097203d", - "FIREBASE_PROJECT_ID": "tchat-beta", - "GCM_SENDER_ID": "136771801992" + "GOOGLE_APP_ID": "1:405351917235:ios:869f0ad8ace08db899f2c6", + "FIREBASE_PROJECT_ID": "meerabel-dev", + "GCM_SENDER_ID": "405351917235" } \ No newline at end of file diff --git a/packages/wyatt_authentication_bloc/example/lib/bootstrap.dart b/packages/wyatt_authentication_bloc/example/lib/bootstrap.dart index 4e0f4070..0f64001a 100644 --- a/packages/wyatt_authentication_bloc/example/lib/bootstrap.dart +++ b/packages/wyatt_authentication_bloc/example/lib/bootstrap.dart @@ -1,16 +1,16 @@ // Copyright (C) 2022 WYATT GROUP // Please see the AUTHORS file for details. -// +// // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // any later version. -// +// // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. -// +// // You should have received a copy of the GNU General Public License // along with this program. If not, see . @@ -18,9 +18,47 @@ import 'dart:async'; import 'package:example_router/core/dependency_injection/get_it.dart'; import 'package:example_router/core/utils/app_bloc_observer.dart'; +import 'package:example_router/firebase_options.dart'; +import 'package:firebase_core/firebase_core.dart'; import 'package:flutter/widgets.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; +class MockSettings { + static MockSettings? _instance; + + /// Data source mode + late bool enable = false; + + MockSettings._(this.enable); + + factory MockSettings.enable() { + _instance ??= MockSettings._(true); + if (_instance!.enable != true) { + throw Exception('Mock already initialized in: ${_instance!.enable}'); + } + return _instance!; + } + + factory MockSettings.disable() { + _instance ??= MockSettings._(false); + if (_instance!.enable != false) { + throw Exception('Mock already initialized in: ${_instance!.enable}'); + } + return _instance!; + } + + static bool isEnable() { + if (_instance == null) { + throw Exception('MockSettings not initialized!'); + } + return _instance!.enable == true; + } + + static bool isDisable() { + return !isEnable(); + } +} + Future bootstrap(FutureOr Function() builder) async { await runZonedGuarded( () async { @@ -30,6 +68,12 @@ Future bootstrap(FutureOr Function() builder) async { FlutterError.onError = (details) { debugPrint(details.toString()); }; + + if (MockSettings.isDisable()) { + await Firebase.initializeApp( + options: DefaultFirebaseOptions.currentPlatform, + ); + } await GetItInitializer.init(); runApp(await builder()); diff --git a/packages/wyatt_authentication_bloc/example/lib/core/constants/form_field.dart b/packages/wyatt_authentication_bloc/example/lib/core/constants/form_field.dart index 84636b9f..917131da 100644 --- a/packages/wyatt_authentication_bloc/example/lib/core/constants/form_field.dart +++ b/packages/wyatt_authentication_bloc/example/lib/core/constants/form_field.dart @@ -1,16 +1,16 @@ // Copyright (C) 2022 WYATT GROUP // Please see the AUTHORS file for details. -// +// // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // any later version. -// +// // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. -// +// // You should have received a copy of the GNU General Public License // along with this program. If not, see . diff --git a/packages/wyatt_authentication_bloc/example/lib/core/constants/form_name.dart b/packages/wyatt_authentication_bloc/example/lib/core/constants/form_name.dart index a5ce457e..b41b7335 100644 --- a/packages/wyatt_authentication_bloc/example/lib/core/constants/form_name.dart +++ b/packages/wyatt_authentication_bloc/example/lib/core/constants/form_name.dart @@ -1,16 +1,16 @@ // Copyright (C) 2022 WYATT GROUP // Please see the AUTHORS file for details. -// +// // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // any later version. -// +// // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. -// +// // You should have received a copy of the GNU General Public License // along with this program. If not, see . diff --git a/packages/wyatt_authentication_bloc/example/lib/core/dependency_injection/get_it.dart b/packages/wyatt_authentication_bloc/example/lib/core/dependency_injection/get_it.dart index a665ccb7..d1cb33ab 100644 --- a/packages/wyatt_authentication_bloc/example/lib/core/dependency_injection/get_it.dart +++ b/packages/wyatt_authentication_bloc/example/lib/core/dependency_injection/get_it.dart @@ -14,6 +14,8 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . +import 'package:example_router/bootstrap.dart'; +import 'package:example_router/firebase_options.dart'; import 'package:get_it/get_it.dart'; import 'package:wyatt_authentication_bloc/wyatt_authentication_bloc.dart'; import 'package:wyatt_type_utils/wyatt_type_utils.dart'; @@ -24,28 +26,32 @@ abstract class GetItInitializer { static Future init() async { getIt ..registerLazySingleton( - () => AuthenticationMockDataSourceImpl(registeredAccounts: [ - Pair( - AccountModel( - uid: '1', - emailVerified: true, - isAnonymous: false, - providerId: 'wyatt', - email: 'toto@test.fr', - ), - 'toto1234', - ), - Pair( - AccountModel( - uid: '2', - emailVerified: false, - isAnonymous: false, - providerId: 'wyatt', - email: 'tata@test.fr', - ), - 'tata1234', - ), - ]), + MockSettings.isEnable() + ? () => AuthenticationMockDataSourceImpl(registeredAccounts: [ + Pair( + AccountModel( + uid: '1', + emailVerified: true, + isAnonymous: false, + providerId: 'wyatt', + email: 'toto@test.fr', + ), + 'toto1234', + ), + Pair( + AccountModel( + uid: '2', + emailVerified: false, + isAnonymous: false, + providerId: 'wyatt', + email: 'tata@test.fr', + ), + 'tata1234', + ), + ]) + : () => AuthenticationFirebaseDataSourceImpl( + googleSignIn: GoogleSignIn( + clientId: DefaultFirebaseOptions.ios.iosClientId)), ) ..registerLazySingleton>( () => AuthenticationCacheDataSourceImpl(), diff --git a/packages/wyatt_authentication_bloc/example/lib/core/utils/app_bloc_observer.dart b/packages/wyatt_authentication_bloc/example/lib/core/utils/app_bloc_observer.dart index 3490aee1..1a25acfd 100644 --- a/packages/wyatt_authentication_bloc/example/lib/core/utils/app_bloc_observer.dart +++ b/packages/wyatt_authentication_bloc/example/lib/core/utils/app_bloc_observer.dart @@ -1,16 +1,16 @@ // Copyright (C) 2022 WYATT GROUP // Please see the AUTHORS file for details. -// +// // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // any later version. -// +// // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. -// +// // You should have received a copy of the GNU General Public License // along with this program. If not, see . diff --git a/packages/wyatt_authentication_bloc/example/lib/core/utils/custom_password.dart b/packages/wyatt_authentication_bloc/example/lib/core/utils/custom_password.dart index bdbb3552..d80b6d3e 100644 --- a/packages/wyatt_authentication_bloc/example/lib/core/utils/custom_password.dart +++ b/packages/wyatt_authentication_bloc/example/lib/core/utils/custom_password.dart @@ -1,16 +1,16 @@ // Copyright (C) 2022 WYATT GROUP // Please see the AUTHORS file for details. -// +// // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // any later version. -// +// // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. -// +// // You should have received a copy of the GNU General Public License // along with this program. If not, see . diff --git a/packages/wyatt_authentication_bloc/example/lib/firebase_options.dart b/packages/wyatt_authentication_bloc/example/lib/firebase_options.dart new file mode 100644 index 00000000..10987933 --- /dev/null +++ b/packages/wyatt_authentication_bloc/example/lib/firebase_options.dart @@ -0,0 +1,67 @@ +// File generated by FlutterFire CLI. +// ignore_for_file: lines_longer_than_80_chars, avoid_classes_with_only_static_members +import 'package:firebase_core/firebase_core.dart' show FirebaseOptions; +import 'package:flutter/foundation.dart' + show defaultTargetPlatform, kIsWeb, TargetPlatform; + +/// Default [FirebaseOptions] for use with your Firebase apps. +/// +/// Example: +/// ```dart +/// import 'firebase_options.dart'; +/// // ... +/// await Firebase.initializeApp( +/// options: DefaultFirebaseOptions.currentPlatform, +/// ); +/// ``` +class DefaultFirebaseOptions { + static FirebaseOptions get currentPlatform { + if (kIsWeb) { + throw UnsupportedError( + 'DefaultFirebaseOptions have not been configured for web - ' + 'you can reconfigure this by running the FlutterFire CLI again.', + ); + } + switch (defaultTargetPlatform) { + case TargetPlatform.android: + throw UnsupportedError( + 'DefaultFirebaseOptions have not been configured for android - ' + 'you can reconfigure this by running the FlutterFire CLI again.', + ); + case TargetPlatform.iOS: + return ios; + case TargetPlatform.macOS: + throw UnsupportedError( + 'DefaultFirebaseOptions have not been configured for macos - ' + 'you can reconfigure this by running the FlutterFire CLI again.', + ); + case TargetPlatform.windows: + throw UnsupportedError( + 'DefaultFirebaseOptions have not been configured for windows - ' + 'you can reconfigure this by running the FlutterFire CLI again.', + ); + case TargetPlatform.linux: + throw UnsupportedError( + 'DefaultFirebaseOptions have not been configured for linux - ' + 'you can reconfigure this by running the FlutterFire CLI again.', + ); + default: + throw UnsupportedError( + 'DefaultFirebaseOptions are not supported for this platform.', + ); + } + } + + static const FirebaseOptions ios = FirebaseOptions( + apiKey: 'AIzaSyDDmtf0KN7Xw12_pqUsxoBfAxMuvCMmMmk', + appId: '1:405351917235:ios:869f0ad8ace08db899f2c6', + messagingSenderId: '405351917235', + projectId: 'meerabel-dev', + storageBucket: 'meerabel-dev.appspot.com', + androidClientId: + '405351917235-4g1dh3475tq6t1sa2qoh7ol60nf4ta05.apps.googleusercontent.com', + iosClientId: + '405351917235-2jv4ff02kovoim58f8d6d0rsa14apgkj.apps.googleusercontent.com', + iosBundleId: 'com.example.exampleRouter', + ); +} diff --git a/packages/wyatt_authentication_bloc/example/lib/main.dart b/packages/wyatt_authentication_bloc/example/lib/main.dart index 0149dcb6..ddc4cb52 100644 --- a/packages/wyatt_authentication_bloc/example/lib/main.dart +++ b/packages/wyatt_authentication_bloc/example/lib/main.dart @@ -1,16 +1,16 @@ // Copyright (C) 2022 WYATT GROUP // Please see the AUTHORS file for details. -// +// // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // any later version. -// +// // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. -// +// // You should have received a copy of the GNU General Public License // along with this program. If not, see . @@ -18,5 +18,6 @@ import 'package:example_router/bootstrap.dart'; import 'package:example_router/presentation/features/app/app.dart'; void main() { + MockSettings.enable(); bootstrap(App.new); } diff --git a/packages/wyatt_authentication_bloc/lib/src/core/utils/utils.dart b/packages/wyatt_authentication_bloc/example/lib/main_firebase.dart similarity index 78% rename from packages/wyatt_authentication_bloc/lib/src/core/utils/utils.dart rename to packages/wyatt_authentication_bloc/example/lib/main_firebase.dart index 81005a25..d53f0050 100644 --- a/packages/wyatt_authentication_bloc/lib/src/core/utils/utils.dart +++ b/packages/wyatt_authentication_bloc/example/lib/main_firebase.dart @@ -1,17 +1,23 @@ // Copyright (C) 2022 WYATT GROUP // Please see the AUTHORS file for details. -// +// // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // any later version. -// +// // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. -// +// // You should have received a copy of the GNU General Public License // along with this program. If not, see . -export 'cryptography.dart'; +import 'package:example_router/bootstrap.dart'; +import 'package:example_router/presentation/features/app/app.dart'; + +void main() { + MockSettings.disable(); + bootstrap(App.new); +} diff --git a/packages/wyatt_authentication_bloc/example/lib/presentation/features/edit_profile/blocs/edit_profile_cubit.dart b/packages/wyatt_authentication_bloc/example/lib/presentation/features/edit_profile/blocs/edit_profile_cubit.dart index e82e2b4c..c92aa597 100644 --- a/packages/wyatt_authentication_bloc/example/lib/presentation/features/edit_profile/blocs/edit_profile_cubit.dart +++ b/packages/wyatt_authentication_bloc/example/lib/presentation/features/edit_profile/blocs/edit_profile_cubit.dart @@ -1,16 +1,16 @@ // Copyright (C) 2022 WYATT GROUP // Please see the AUTHORS file for details. -// +// // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // any later version. -// +// // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. -// +// // You should have received a copy of the GNU General Public License // along with this program. If not, see . @@ -71,4 +71,4 @@ class EditProfileCubit extends FormDataCubitImpl { } emit(state.copyWith(status: FormStatus.submissionSuccess)); } -} \ No newline at end of file +} diff --git a/packages/wyatt_authentication_bloc/example/lib/presentation/features/sign_in/sign_in_page.dart b/packages/wyatt_authentication_bloc/example/lib/presentation/features/sign_in/sign_in_page.dart index 5d7aa1e4..19dfd0b6 100644 --- a/packages/wyatt_authentication_bloc/example/lib/presentation/features/sign_in/sign_in_page.dart +++ b/packages/wyatt_authentication_bloc/example/lib/presentation/features/sign_in/sign_in_page.dart @@ -1,16 +1,16 @@ // Copyright (C) 2022 WYATT GROUP // Please see the AUTHORS file for details. -// +// // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // any later version. -// +// // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. -// +// // You should have received a copy of the GNU General Public License // along with this program. If not, see . diff --git a/packages/wyatt_authentication_bloc/example/lib/presentation/features/sign_in/widgets/sign_in_form.dart b/packages/wyatt_authentication_bloc/example/lib/presentation/features/sign_in/widgets/sign_in_form.dart index 865b6cec..f0e1dfa9 100644 --- a/packages/wyatt_authentication_bloc/example/lib/presentation/features/sign_in/widgets/sign_in_form.dart +++ b/packages/wyatt_authentication_bloc/example/lib/presentation/features/sign_in/widgets/sign_in_form.dart @@ -1,16 +1,16 @@ // Copyright (C) 2022 WYATT GROUP // Please see the AUTHORS file for details. -// +// // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // any later version. -// +// // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. -// +// // You should have received a copy of the GNU General Public License // along with this program. If not, see . @@ -94,6 +94,22 @@ class _SignInAnonymouslyButton extends StatelessWidget { } } +class _SignInWithGoogleButton extends StatelessWidget { + @override + Widget build(BuildContext context) { + return SubmitBuilder>( + builder: ((context, cubit, status) { + return status.isSubmissionInProgress + ? const CircularProgressIndicator() + : ElevatedButton( + onPressed: () => cubit.signInWithGoogle(), + child: const Text('Sign in Google'), + ); + }), + ); + } +} + class SignInForm extends StatelessWidget { const SignInForm({Key? key}) : super(key: key); @@ -116,6 +132,8 @@ class SignInForm extends StatelessWidget { _SignInButton(), const SizedBox(height: 16), _SignInAnonymouslyButton(), + const SizedBox(height: 16), + _SignInWithGoogleButton(), ], ), ), diff --git a/packages/wyatt_authentication_bloc/example/lib/presentation/features/sign_up/sign_up_page.dart b/packages/wyatt_authentication_bloc/example/lib/presentation/features/sign_up/sign_up_page.dart index 918f09cd..ff232348 100644 --- a/packages/wyatt_authentication_bloc/example/lib/presentation/features/sign_up/sign_up_page.dart +++ b/packages/wyatt_authentication_bloc/example/lib/presentation/features/sign_up/sign_up_page.dart @@ -1,16 +1,16 @@ // Copyright (C) 2022 WYATT GROUP // Please see the AUTHORS file for details. -// +// // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // any later version. -// +// // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. -// +// // You should have received a copy of the GNU General Public License // along with this program. If not, see . diff --git a/packages/wyatt_authentication_bloc/example/lib/presentation/features/sign_up/widgets/sign_up_form.dart b/packages/wyatt_authentication_bloc/example/lib/presentation/features/sign_up/widgets/sign_up_form.dart index 546ec326..bb3ebceb 100644 --- a/packages/wyatt_authentication_bloc/example/lib/presentation/features/sign_up/widgets/sign_up_form.dart +++ b/packages/wyatt_authentication_bloc/example/lib/presentation/features/sign_up/widgets/sign_up_form.dart @@ -1,16 +1,16 @@ // Copyright (C) 2022 WYATT GROUP // Please see the AUTHORS file for details. -// +// // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // any later version. -// +// // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. -// +// // You should have received a copy of the GNU General Public License // along with this program. If not, see . diff --git a/packages/wyatt_authentication_bloc/example/lib/presentation/features/sub/sub_page.dart b/packages/wyatt_authentication_bloc/example/lib/presentation/features/sub/sub_page.dart index 48a39986..a5c8a6b6 100644 --- a/packages/wyatt_authentication_bloc/example/lib/presentation/features/sub/sub_page.dart +++ b/packages/wyatt_authentication_bloc/example/lib/presentation/features/sub/sub_page.dart @@ -1,16 +1,16 @@ // Copyright (C) 2022 WYATT GROUP // Please see the AUTHORS file for details. -// +// // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // any later version. -// +// // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. -// +// // You should have received a copy of the GNU General Public License // along with this program. If not, see . @@ -30,10 +30,12 @@ class SubPage extends StatelessWidget { title: const Text('Sub'), actions: [ IconButton( - onPressed: () => context.read>().signOut(), + onPressed: () => + context.read>().signOut(), icon: const Icon(Icons.logout_rounded)), IconButton( - onPressed: () => context.read>().refresh(), + onPressed: () => + context.read>().refresh(), icon: const Icon(Icons.refresh)) ], ), diff --git a/packages/wyatt_authentication_bloc/example/lib/presentation/features/welcome/welcome_page.dart b/packages/wyatt_authentication_bloc/example/lib/presentation/features/welcome/welcome_page.dart index 5080183c..10d5c0cc 100644 --- a/packages/wyatt_authentication_bloc/example/lib/presentation/features/welcome/welcome_page.dart +++ b/packages/wyatt_authentication_bloc/example/lib/presentation/features/welcome/welcome_page.dart @@ -1,16 +1,16 @@ // Copyright (C) 2022 WYATT GROUP // Please see the AUTHORS file for details. -// +// // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // any later version. -// +// // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. -// +// // You should have received a copy of the GNU General Public License // along with this program. If not, see . diff --git a/packages/wyatt_authentication_bloc/example/test/widget_test.dart b/packages/wyatt_authentication_bloc/example/test/widget_test.dart index e69de29b..8b137891 100644 --- a/packages/wyatt_authentication_bloc/example/test/widget_test.dart +++ b/packages/wyatt_authentication_bloc/example/test/widget_test.dart @@ -0,0 +1 @@ + diff --git a/packages/wyatt_authentication_bloc/lib/src/core/core.dart b/packages/wyatt_authentication_bloc/lib/src/core/core.dart index 16b0264b..2d4165fc 100644 --- a/packages/wyatt_authentication_bloc/lib/src/core/core.dart +++ b/packages/wyatt_authentication_bloc/lib/src/core/core.dart @@ -18,4 +18,3 @@ export 'constants/form_field.dart'; export 'constants/form_name.dart'; export 'enums/enums.dart'; export 'exceptions/exceptions.dart'; -export 'utils/utils.dart'; diff --git a/packages/wyatt_authentication_bloc/lib/src/core/enums/authentication_status.dart b/packages/wyatt_authentication_bloc/lib/src/core/enums/authentication_status.dart index af10ceae..11386588 100644 --- a/packages/wyatt_authentication_bloc/lib/src/core/enums/authentication_status.dart +++ b/packages/wyatt_authentication_bloc/lib/src/core/enums/authentication_status.dart @@ -1,16 +1,16 @@ // Copyright (C) 2022 WYATT GROUP // Please see the AUTHORS file for details. -// +// // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // any later version. -// +// // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. -// +// // You should have received a copy of the GNU General Public License // along with this program. If not, see . diff --git a/packages/wyatt_authentication_bloc/lib/src/core/enums/enums.dart b/packages/wyatt_authentication_bloc/lib/src/core/enums/enums.dart index 67d107d6..db37d714 100644 --- a/packages/wyatt_authentication_bloc/lib/src/core/enums/enums.dart +++ b/packages/wyatt_authentication_bloc/lib/src/core/enums/enums.dart @@ -1,16 +1,16 @@ // Copyright (C) 2022 WYATT GROUP // Please see the AUTHORS file for details. -// +// // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // any later version. -// +// // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. -// +// // You should have received a copy of the GNU General Public License // along with this program. If not, see . diff --git a/packages/wyatt_authentication_bloc/lib/src/core/exceptions/exceptions.dart b/packages/wyatt_authentication_bloc/lib/src/core/exceptions/exceptions.dart index ba71af54..f60c915e 100644 --- a/packages/wyatt_authentication_bloc/lib/src/core/exceptions/exceptions.dart +++ b/packages/wyatt_authentication_bloc/lib/src/core/exceptions/exceptions.dart @@ -20,7 +20,6 @@ part 'exceptions_firebase.dart'; abstract class AuthenticationFailureInterface extends AppException implements Exception { - AuthenticationFailureInterface(this.code, this.msg); AuthenticationFailureInterface.fromCode(this.code) : msg = 'An unknown error occurred.'; @@ -277,3 +276,10 @@ abstract class UpdatePasswordFailureInterface UpdatePasswordFailureInterface.fromCode(super.code) : super.fromCode(); } + +abstract class ModelParsingFailureInterface + extends AuthenticationFailureInterface { + ModelParsingFailureInterface(super.code, super.msg); + + ModelParsingFailureInterface.fromCode(super.code) : super.fromCode(); +} diff --git a/packages/wyatt_authentication_bloc/lib/src/core/exceptions/exceptions_firebase.dart b/packages/wyatt_authentication_bloc/lib/src/core/exceptions/exceptions_firebase.dart index c36dcbd0..58e3c409 100644 --- a/packages/wyatt_authentication_bloc/lib/src/core/exceptions/exceptions_firebase.dart +++ b/packages/wyatt_authentication_bloc/lib/src/core/exceptions/exceptions_firebase.dart @@ -349,3 +349,10 @@ class UpdatePasswordFailureFirebase extends UpdatePasswordFailureInterface { } } } + +class ModelParsingFailureFirebase extends ModelParsingFailureInterface { + ModelParsingFailureFirebase([String? code, String? msg]) + : super(code ?? 'unknown', msg ?? 'An unknown error occurred.'); + + ModelParsingFailureFirebase.fromCode(super.code) : super.fromCode(); +} diff --git a/packages/wyatt_authentication_bloc/lib/src/core/utils/cryptography.dart b/packages/wyatt_authentication_bloc/lib/src/core/utils/cryptography.dart deleted file mode 100644 index f9a0b247..00000000 --- a/packages/wyatt_authentication_bloc/lib/src/core/utils/cryptography.dart +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright (C) 2022 WYATT GROUP -// Please see the AUTHORS file for details. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . - -import 'dart:convert'; -import 'dart:math'; - -import 'package:crypto/crypto.dart'; - -class Cryptography { - /// Generates a cryptographically secure random nonce, to be included in a - /// credential request. - static String generateNonce([int length = 32]) { - const charset = - '0123456789ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvwxyz-._'; - final random = Random.secure(); - return List.generate(length, (_) => charset[random.nextInt(charset.length)]) - .join(); - } - - /// Returns the sha256 hash of [input] in hex notation. - static String sha256ofString(String input) { - final bytes = utf8.encode(input); - final digest = sha256.convert(bytes); - return digest.toString(); - } -} diff --git a/packages/wyatt_authentication_bloc/lib/src/data/data.dart b/packages/wyatt_authentication_bloc/lib/src/data/data.dart index 42218c55..35d3fdd1 100644 --- a/packages/wyatt_authentication_bloc/lib/src/data/data.dart +++ b/packages/wyatt_authentication_bloc/lib/src/data/data.dart @@ -1,16 +1,16 @@ // Copyright (C) 2022 WYATT GROUP // Please see the AUTHORS file for details. -// +// // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // any later version. -// +// // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. -// +// // You should have received a copy of the GNU General Public License // along with this program. If not, see . diff --git a/packages/wyatt_authentication_bloc/lib/src/data/data_sources/local/authentication_cache_data_source_impl.dart b/packages/wyatt_authentication_bloc/lib/src/data/data_sources/local/authentication_cache_data_source_impl.dart index b224575a..abcb673a 100644 --- a/packages/wyatt_authentication_bloc/lib/src/data/data_sources/local/authentication_cache_data_source_impl.dart +++ b/packages/wyatt_authentication_bloc/lib/src/data/data_sources/local/authentication_cache_data_source_impl.dart @@ -20,7 +20,6 @@ import 'package:wyatt_type_utils/wyatt_type_utils.dart'; class AuthenticationCacheDataSourceImpl extends AuthenticationCacheDataSource { - AuthenticationCacheDataSourceImpl(); Account? _account; T? _data; diff --git a/packages/wyatt_authentication_bloc/lib/src/data/data_sources/remote/authentication_firebase_data_source_impl.dart b/packages/wyatt_authentication_bloc/lib/src/data/data_sources/remote/authentication_firebase_data_source_impl.dart index 0118776b..8a4ce432 100644 --- a/packages/wyatt_authentication_bloc/lib/src/data/data_sources/remote/authentication_firebase_data_source_impl.dart +++ b/packages/wyatt_authentication_bloc/lib/src/data/data_sources/remote/authentication_firebase_data_source_impl.dart @@ -14,34 +14,22 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -import 'package:firebase_auth/firebase_auth.dart'; +import 'package:wyatt_authentication_bloc/src/data/models/account_model_firebase.dart'; import 'package:wyatt_authentication_bloc/wyatt_authentication_bloc.dart'; import 'package:wyatt_type_utils/wyatt_type_utils.dart'; class AuthenticationFirebaseDataSourceImpl extends AuthenticationRemoteDataSource { + AuthenticationFirebaseDataSourceImpl({ + FirebaseAuth? firebaseAuth, + GoogleSignIn? googleSignIn, + }) : _firebaseAuth = firebaseAuth ?? FirebaseAuth.instance, + _googleSignIn = googleSignIn ?? GoogleSignIn(); - AuthenticationFirebaseDataSourceImpl({FirebaseAuth? firebaseAuth}) - : _firebaseAuth = firebaseAuth ?? FirebaseAuth.instance; final FirebaseAuth _firebaseAuth; + final GoogleSignIn _googleSignIn; UserCredential? _latestCreds; - Account _mapper(User user) => AccountModel( - uid: user.uid, - emailVerified: user.emailVerified, - isAnonymous: user.isAnonymous, - providerId: user.providerData.first.providerId, - creationTime: user.metadata.creationTime, - lastSignInTime: user.metadata.lastSignInTime, - isNewUser: (user.metadata.creationTime != null && - user.metadata.lastSignInTime != null) - ? user.metadata.lastSignInTime! == user.metadata.creationTime! - : null, - email: user.email, - phoneNumber: user.phoneNumber, - photoURL: user.photoURL, - ); - @override Future signInWithEmailAndPassword({ required String email, @@ -54,11 +42,7 @@ class AuthenticationFirebaseDataSourceImpl ); _latestCreds = userCredential; final user = userCredential.user; - if (user.isNotNull) { - return _mapper(user!); - } else { - throw Exception(); // Get caught just after. - } + return AccountModelFirebase.fromFirebaseUser(user); } on FirebaseAuthException catch (e) { throw SignInWithEmailAndPasswordFailureFirebase.fromCode(e.code); } catch (_) { @@ -80,11 +64,7 @@ class AuthenticationFirebaseDataSourceImpl ); _latestCreds = userCredential; final user = userCredential.user; - if (user.isNotNull) { - return _mapper(user!); - } else { - throw Exception(); // Get caught just after. - } + return AccountModelFirebase.fromFirebaseUser(user); } on FirebaseAuthException catch (e) { throw SignUpWithEmailAndPasswordFailureFirebase.fromCode(e.code); } catch (_) { @@ -121,8 +101,11 @@ class AuthenticationFirebaseDataSourceImpl @override Stream streamAccount() => _firebaseAuth.userChanges().map((user) { - final Account? account = (user.isNotNull) ? _mapper(user!) : null; - return account; + try { + return AccountModelFirebase.fromFirebaseUser(user); + } on FirebaseAuthException { + return null; + } }); @override @@ -170,11 +153,7 @@ class AuthenticationFirebaseDataSourceImpl final userCredential = await _firebaseAuth.signInAnonymously(); _latestCreds = userCredential; final user = userCredential.user; - if (user.isNotNull) { - return _mapper(user!); - } else { - throw Exception(); // Get caught just after. - } + return AccountModelFirebase.fromFirebaseUser(user); } on FirebaseAuthException catch (e) { throw SignInAnonymouslyFailureFirebase.fromCode(e.code); } catch (_) { @@ -182,6 +161,35 @@ class AuthenticationFirebaseDataSourceImpl } } + @override + Future signInWithGoogle() async { + try { + // Trigger the authentication flow + final GoogleSignInAccount? googleUser = await _googleSignIn.signIn(); + + // Obtain the auth details from the request + final GoogleSignInAuthentication? googleAuth = + await googleUser?.authentication; + + // Create a new credential + final credential = GoogleAuthProvider.credential( + accessToken: googleAuth?.accessToken, + idToken: googleAuth?.idToken, + ); + + final userCredential = + await _firebaseAuth.signInWithCredential(credential); + + _latestCreds = userCredential; + final user = userCredential.user; + return AccountModelFirebase.fromFirebaseUser(user); + } on FirebaseAuthException catch (e) { + throw SignInWithGoogleFailureFirebase.fromCode(e.code); + } catch (_) { + throw SignInWithGoogleFailureFirebase(); + } + } + @override Future verifyPasswordResetCode({required String code}) async { try { @@ -215,11 +223,7 @@ class AuthenticationFirebaseDataSourceImpl throw Exception(); // Get caught just after. } final user = _firebaseAuth.currentUser; - if (user.isNotNull) { - return _mapper(user!); - } else { - throw Exception(); // Get caught just after. - } + return AccountModelFirebase.fromFirebaseUser(user); } on FirebaseAuthException catch (e) { throw ReauthenticateFailureFirebase.fromCode(e.code); } catch (_) { @@ -232,11 +236,7 @@ class AuthenticationFirebaseDataSourceImpl try { await _firebaseAuth.currentUser!.updateEmail(email); final user = _firebaseAuth.currentUser; - if (user.isNotNull) { - return _mapper(user!); - } else { - throw Exception(); // Get caught just after. - } + return AccountModelFirebase.fromFirebaseUser(user); } on FirebaseAuthException catch (e) { throw UpdateEmailFailureFirebase.fromCode(e.code); } catch (_) { @@ -249,11 +249,7 @@ class AuthenticationFirebaseDataSourceImpl try { await _firebaseAuth.currentUser!.updatePassword(password); final user = _firebaseAuth.currentUser; - if (user.isNotNull) { - return _mapper(user!); - } else { - throw Exception(); // Get caught just after. - } + return AccountModelFirebase.fromFirebaseUser(user); } on FirebaseAuthException catch (e) { throw UpdatePasswordFailureFirebase.fromCode(e.code); } catch (_) { diff --git a/packages/wyatt_authentication_bloc/lib/src/data/data_sources/remote/authentication_mock_data_source_impl.dart b/packages/wyatt_authentication_bloc/lib/src/data/data_sources/remote/authentication_mock_data_source_impl.dart index a73b1913..1ee3a767 100644 --- a/packages/wyatt_authentication_bloc/lib/src/data/data_sources/remote/authentication_mock_data_source_impl.dart +++ b/packages/wyatt_authentication_bloc/lib/src/data/data_sources/remote/authentication_mock_data_source_impl.dart @@ -21,7 +21,6 @@ import 'package:wyatt_authentication_bloc/wyatt_authentication_bloc.dart'; import 'package:wyatt_type_utils/wyatt_type_utils.dart'; class AuthenticationMockDataSourceImpl extends AuthenticationRemoteDataSource { - AuthenticationMockDataSourceImpl({ this.idToken = 'fake-id-token', this.registeredAccounts, @@ -112,7 +111,26 @@ class AuthenticationMockDataSourceImpl extends AuthenticationRemoteDataSource { uid: 'mock-id-anom', emailVerified: false, isAnonymous: true, - providerId: 'wyatt', + providerId: 'wyatt-studio.fr', + creationTime: creation, + lastSignInTime: creation, + isNewUser: creation == creation, + ); + _streamAccount.add(mock); + _connectedMock = _connectedMock?.copyWith(left: mock); + _lastSignInTime = DateTime.now(); + return Future.value(mock); + } + + @override + Future signInWithGoogle() async { + await _randomDelay(); + final creation = DateTime.now(); + final mock = AccountModel( + uid: 'mock-id-google', + emailVerified: true, + isAnonymous: false, + providerId: 'google.com', creationTime: creation, lastSignInTime: creation, isNewUser: creation == creation, diff --git a/packages/wyatt_authentication_bloc/lib/src/data/models/account_model.dart b/packages/wyatt_authentication_bloc/lib/src/data/models/account_model.dart index d886d329..0077378b 100644 --- a/packages/wyatt_authentication_bloc/lib/src/data/models/account_model.dart +++ b/packages/wyatt_authentication_bloc/lib/src/data/models/account_model.dart @@ -72,16 +72,17 @@ class AccountModel extends Account { String? phoneNumber, String? photoURL, String? providerId, - }) => AccountModel( - uid: uid ?? this.uid, - email: email ?? this.email, - creationTime: creationTime ?? this.creationTime, - emailVerified: emailVerified ?? this.emailVerified, - isAnonymous: isAnonymous ?? this.isAnonymous, - isNewUser: isNewUser ?? this.isNewUser, - lastSignInTime: lastSignInTime ?? this.lastSignInTime, - phoneNumber: phoneNumber ?? this.phoneNumber, - photoURL: photoURL ?? this.photoURL, - providerId: providerId ?? this.providerId, - ); + }) => + AccountModel( + uid: uid ?? this.uid, + email: email ?? this.email, + creationTime: creationTime ?? this.creationTime, + emailVerified: emailVerified ?? this.emailVerified, + isAnonymous: isAnonymous ?? this.isAnonymous, + isNewUser: isNewUser ?? this.isNewUser, + lastSignInTime: lastSignInTime ?? this.lastSignInTime, + phoneNumber: phoneNumber ?? this.phoneNumber, + photoURL: photoURL ?? this.photoURL, + providerId: providerId ?? this.providerId, + ); } diff --git a/packages/wyatt_authentication_bloc/lib/src/data/models/account_model_firebase.dart b/packages/wyatt_authentication_bloc/lib/src/data/models/account_model_firebase.dart new file mode 100644 index 00000000..22313043 --- /dev/null +++ b/packages/wyatt_authentication_bloc/lib/src/data/models/account_model_firebase.dart @@ -0,0 +1,55 @@ +// ignore_for_file: public_member_api_docs, sort_constructors_first +// Copyright (C) 2022 WYATT GROUP +// Please see the AUTHORS file for details. +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +import 'package:wyatt_authentication_bloc/wyatt_authentication_bloc.dart'; + +class AccountModelFirebase extends AccountModel { + AccountModelFirebase._({ + required super.uid, + required super.emailVerified, + required super.isAnonymous, + required super.providerId, + super.lastSignInTime, + super.creationTime, + super.isNewUser, + super.email, + super.phoneNumber, + super.photoURL, + }); + + factory AccountModelFirebase.fromFirebaseUser(User? user) { + if (user != null) { + return AccountModelFirebase._( + uid: user.uid, + emailVerified: user.emailVerified, + isAnonymous: user.isAnonymous, + providerId: user.providerData.first.providerId, + creationTime: user.metadata.creationTime, + lastSignInTime: user.metadata.lastSignInTime, + isNewUser: (user.metadata.creationTime != null && + user.metadata.lastSignInTime != null) + ? user.metadata.lastSignInTime! == user.metadata.creationTime! + : null, + email: user.email, + phoneNumber: user.phoneNumber, + photoURL: user.photoURL, + ); + } else { + throw ModelParsingFailureFirebase('null-user', 'User cannot be null!'); + } + } +} diff --git a/packages/wyatt_authentication_bloc/lib/src/data/models/account_wrapper_model.dart b/packages/wyatt_authentication_bloc/lib/src/data/models/account_wrapper_model.dart index e99b774e..4dae7f6b 100644 --- a/packages/wyatt_authentication_bloc/lib/src/data/models/account_wrapper_model.dart +++ b/packages/wyatt_authentication_bloc/lib/src/data/models/account_wrapper_model.dart @@ -29,8 +29,9 @@ class AccountWrapperModel extends AccountWrapper { AccountWrapperModel copyWith({ Account? account, T? data, - }) => AccountWrapperModel( - account ?? this.account, - data ?? this.data, - ); + }) => + AccountWrapperModel( + account ?? this.account, + data ?? this.data, + ); } diff --git a/packages/wyatt_authentication_bloc/lib/src/data/models/models.dart b/packages/wyatt_authentication_bloc/lib/src/data/models/models.dart index 09cc76bf..14f991fe 100644 --- a/packages/wyatt_authentication_bloc/lib/src/data/models/models.dart +++ b/packages/wyatt_authentication_bloc/lib/src/data/models/models.dart @@ -1,16 +1,16 @@ // Copyright (C) 2022 WYATT GROUP // Please see the AUTHORS file for details. -// +// // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // any later version. -// +// // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. -// +// // You should have received a copy of the GNU General Public License // along with this program. If not, see . diff --git a/packages/wyatt_authentication_bloc/lib/src/data/repositories/authentication_repository_impl.dart b/packages/wyatt_authentication_bloc/lib/src/data/repositories/authentication_repository_impl.dart index 425d16a1..e2687ea8 100644 --- a/packages/wyatt_authentication_bloc/lib/src/data/repositories/authentication_repository_impl.dart +++ b/packages/wyatt_authentication_bloc/lib/src/data/repositories/authentication_repository_impl.dart @@ -41,8 +41,7 @@ typedef OnAuthChange = FutureOrResult Function( ); class AuthenticationRepositoryImpl - extends AuthenticationRepository { // Semaphore - + extends AuthenticationRepository { AuthenticationRepositoryImpl({ required AuthenticationCacheDataSource authenticationCacheDataSource, required AuthenticationRemoteDataSource authenticationRemoteDataSource, @@ -295,6 +294,17 @@ class AuthenticationRepositoryImpl (error) => error, ); + @override + FutureOrResult signInWithGoogle() => + Result.tryCatchAsync( + () async { + final account = + await _authenticationRemoteDataSource.signInWithGoogle(); + return account; + }, + (error) => error, + ); + @override FutureOrResult verifyPasswordResetCode({required String code}) => Result.tryCatchAsync( diff --git a/packages/wyatt_authentication_bloc/lib/src/data/repositories/repositories.dart b/packages/wyatt_authentication_bloc/lib/src/data/repositories/repositories.dart index 7858c9e7..d5979688 100644 --- a/packages/wyatt_authentication_bloc/lib/src/data/repositories/repositories.dart +++ b/packages/wyatt_authentication_bloc/lib/src/data/repositories/repositories.dart @@ -1,16 +1,16 @@ // Copyright (C) 2022 WYATT GROUP // Please see the AUTHORS file for details. -// +// // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // any later version. -// +// // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. -// +// // You should have received a copy of the GNU General Public License // along with this program. If not, see . diff --git a/packages/wyatt_authentication_bloc/lib/src/domain/data_sources/remote/authentication_remote_data_source.dart b/packages/wyatt_authentication_bloc/lib/src/domain/data_sources/remote/authentication_remote_data_source.dart index b379de92..8205bd8d 100644 --- a/packages/wyatt_authentication_bloc/lib/src/domain/data_sources/remote/authentication_remote_data_source.dart +++ b/packages/wyatt_authentication_bloc/lib/src/domain/data_sources/remote/authentication_remote_data_source.dart @@ -49,6 +49,8 @@ abstract class AuthenticationRemoteDataSource extends BaseRemoteDataSource { Future signInAnonymously(); + Future signInWithGoogle(); + Future updateEmail({required String email}); Future updatePassword({required String password}); diff --git a/packages/wyatt_authentication_bloc/lib/src/domain/domain.dart b/packages/wyatt_authentication_bloc/lib/src/domain/domain.dart index 7727f7ee..6f4ec438 100644 --- a/packages/wyatt_authentication_bloc/lib/src/domain/domain.dart +++ b/packages/wyatt_authentication_bloc/lib/src/domain/domain.dart @@ -1,16 +1,16 @@ // Copyright (C) 2022 WYATT GROUP // Please see the AUTHORS file for details. -// +// // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // any later version. -// +// // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. -// +// // You should have received a copy of the GNU General Public License // along with this program. If not, see . diff --git a/packages/wyatt_authentication_bloc/lib/src/domain/entities/entities.dart b/packages/wyatt_authentication_bloc/lib/src/domain/entities/entities.dart index 8ecf9215..e9a858fe 100644 --- a/packages/wyatt_authentication_bloc/lib/src/domain/entities/entities.dart +++ b/packages/wyatt_authentication_bloc/lib/src/domain/entities/entities.dart @@ -1,16 +1,16 @@ // Copyright (C) 2022 WYATT GROUP // Please see the AUTHORS file for details. -// +// // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // any later version. -// +// // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. -// +// // You should have received a copy of the GNU General Public License // along with this program. If not, see . diff --git a/packages/wyatt_authentication_bloc/lib/src/domain/repositories/authentication_repository.dart b/packages/wyatt_authentication_bloc/lib/src/domain/repositories/authentication_repository.dart index d4b2c23b..027c7525 100644 --- a/packages/wyatt_authentication_bloc/lib/src/domain/repositories/authentication_repository.dart +++ b/packages/wyatt_authentication_bloc/lib/src/domain/repositories/authentication_repository.dart @@ -73,6 +73,13 @@ abstract class AuthenticationRepository extends BaseRepository { /// {@endtemplate} FutureOrResult signInAnonymously(); + /// {@template signin_google} + /// Starts the Sign In with Google Flow. + /// + /// Throws a SignInWithGoogleFailureInterface if an exception occurs. + /// {@endtemplate} + FutureOrResult signInWithGoogle(); + /// {@template signin_pwd} /// Signs in with the provided [email] and [password]. /// @@ -105,8 +112,8 @@ abstract class AuthenticationRepository extends BaseRepository { }); /// {@template reauthenticate} - /// Some security-sensitive actions—such as deleting an account, - /// setting a primary email address, and changing a password—require that + /// Some security-sensitive actions—such as deleting an account, + /// setting a primary email address, and changing a password—require that /// the user has recently signed in. /// /// Throws a ReauthenticateFailureInterface if @@ -129,7 +136,7 @@ abstract class AuthenticationRepository extends BaseRepository { /// Stream of [AccountWrapper] which will emit the current account when /// the authentication state changes. /// - /// Emits [AccountWrapper] with null [Account] if the user is not + /// Emits [AccountWrapper] with null [Account] if the user is not /// authenticated. /// {@endtemplate} Stream>> streamAccount(); diff --git a/packages/wyatt_authentication_bloc/lib/src/domain/repositories/repositories.dart b/packages/wyatt_authentication_bloc/lib/src/domain/repositories/repositories.dart index 85f8ae88..8ff4eae1 100644 --- a/packages/wyatt_authentication_bloc/lib/src/domain/repositories/repositories.dart +++ b/packages/wyatt_authentication_bloc/lib/src/domain/repositories/repositories.dart @@ -1,16 +1,16 @@ // Copyright (C) 2022 WYATT GROUP // Please see the AUTHORS file for details. -// +// // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // any later version. -// +// // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. -// +// // You should have received a copy of the GNU General Public License // along with this program. If not, see . diff --git a/packages/wyatt_authentication_bloc/lib/src/features/authentication/cubit/authentication_cubit.dart b/packages/wyatt_authentication_bloc/lib/src/features/authentication/cubit/authentication_cubit.dart index 5db96018..eab1ffbb 100644 --- a/packages/wyatt_authentication_bloc/lib/src/features/authentication/cubit/authentication_cubit.dart +++ b/packages/wyatt_authentication_bloc/lib/src/features/authentication/cubit/authentication_cubit.dart @@ -26,7 +26,6 @@ import 'package:wyatt_type_utils/wyatt_type_utils.dart'; part 'authentication_state.dart'; class AuthenticationCubit extends Cubit> { - AuthenticationCubit({ required AuthenticationRepository authenticationRepository, }) : _authenticationRepository = authenticationRepository, diff --git a/packages/wyatt_authentication_bloc/lib/src/features/authentication/cubit/authentication_state.dart b/packages/wyatt_authentication_bloc/lib/src/features/authentication/cubit/authentication_state.dart index 9529ef2d..a5733bf2 100644 --- a/packages/wyatt_authentication_bloc/lib/src/features/authentication/cubit/authentication_state.dart +++ b/packages/wyatt_authentication_bloc/lib/src/features/authentication/cubit/authentication_state.dart @@ -17,11 +17,8 @@ part of 'authentication_cubit.dart'; class AuthenticationState extends Equatable { - - const AuthenticationState._({required this.status, this.accountWrapper}); - - const AuthenticationState.unknown() - : this._(status: AuthenticationStatus.unknown); + const AuthenticationState.unauthenticated() + : this._(status: AuthenticationStatus.unauthenticated); const AuthenticationState.authenticated(AccountWrapper accountWrapper) : this._( @@ -29,8 +26,10 @@ class AuthenticationState extends Equatable { accountWrapper: accountWrapper, ); - const AuthenticationState.unauthenticated() - : this._(status: AuthenticationStatus.unauthenticated); + const AuthenticationState.unknown() + : this._(status: AuthenticationStatus.unknown); + + const AuthenticationState._({required this.status, this.accountWrapper}); final AuthenticationStatus status; final AccountWrapper? accountWrapper; diff --git a/packages/wyatt_authentication_bloc/lib/src/features/email_verification/cubit/email_verification_cubit.dart b/packages/wyatt_authentication_bloc/lib/src/features/email_verification/cubit/email_verification_cubit.dart index 02c1f100..132dafd2 100644 --- a/packages/wyatt_authentication_bloc/lib/src/features/email_verification/cubit/email_verification_cubit.dart +++ b/packages/wyatt_authentication_bloc/lib/src/features/email_verification/cubit/email_verification_cubit.dart @@ -24,7 +24,6 @@ import 'package:wyatt_form_bloc/wyatt_form_bloc.dart'; part 'email_verification_state.dart'; class EmailVerificationCubit extends Cubit { - EmailVerificationCubit({ required AuthenticationRepository authenticationRepository, }) : _authenticationRepository = authenticationRepository, diff --git a/packages/wyatt_authentication_bloc/lib/src/features/password_reset/cubit/password_reset_cubit.dart b/packages/wyatt_authentication_bloc/lib/src/features/password_reset/cubit/password_reset_cubit.dart index 63a7b6a3..9ecfe309 100644 --- a/packages/wyatt_authentication_bloc/lib/src/features/password_reset/cubit/password_reset_cubit.dart +++ b/packages/wyatt_authentication_bloc/lib/src/features/password_reset/cubit/password_reset_cubit.dart @@ -25,7 +25,6 @@ import 'package:wyatt_type_utils/wyatt_type_utils.dart'; part 'password_reset_state.dart'; class PasswordResetCubit extends FormDataCubit { - PasswordResetCubit({ required AuthenticationRepository authenticationRepository, }) : _authenticationRepository = authenticationRepository, diff --git a/packages/wyatt_authentication_bloc/lib/src/features/password_reset/cubit/password_reset_state.dart b/packages/wyatt_authentication_bloc/lib/src/features/password_reset/cubit/password_reset_state.dart index bc94c01d..5c5205dd 100644 --- a/packages/wyatt_authentication_bloc/lib/src/features/password_reset/cubit/password_reset_state.dart +++ b/packages/wyatt_authentication_bloc/lib/src/features/password_reset/cubit/password_reset_state.dart @@ -17,7 +17,6 @@ part of 'password_reset_cubit.dart'; class PasswordResetState extends FormDataState { - const PasswordResetState({ required super.form, super.status = FormStatus.pure, diff --git a/packages/wyatt_authentication_bloc/lib/src/features/sign_in/cubit/sign_in_cubit.dart b/packages/wyatt_authentication_bloc/lib/src/features/sign_in/cubit/sign_in_cubit.dart index 9343fa91..91262ce3 100644 --- a/packages/wyatt_authentication_bloc/lib/src/features/sign_in/cubit/sign_in_cubit.dart +++ b/packages/wyatt_authentication_bloc/lib/src/features/sign_in/cubit/sign_in_cubit.dart @@ -23,7 +23,6 @@ import 'package:wyatt_type_utils/wyatt_type_utils.dart'; part 'sign_in_state.dart'; class SignInCubit extends FormDataCubit { - SignInCubit({ required AuthenticationRepository authenticationRepository, }) : _authenticationRepository = authenticationRepository, @@ -206,4 +205,24 @@ class SignInCubit extends FormDataCubit { ), ); } + + FutureOr signInWithGoogle() async { + if (state.status.isSubmissionInProgress) { + return; + } + // TODO(wyatt): maybe emit new state (to not carry an old errorMessage) + emit(state.copyWith(status: FormStatus.submissionInProgress)); + + final uid = await _authenticationRepository.signInWithGoogle(); + + emit( + uid.fold( + (value) => state.copyWith(status: FormStatus.submissionSuccess), + (error) => state.copyWith( + errorMessage: error.message, + status: FormStatus.submissionFailure, + ), + ), + ); + } } diff --git a/packages/wyatt_authentication_bloc/lib/src/features/sign_in/cubit/sign_in_state.dart b/packages/wyatt_authentication_bloc/lib/src/features/sign_in/cubit/sign_in_state.dart index 85892205..d98472ad 100644 --- a/packages/wyatt_authentication_bloc/lib/src/features/sign_in/cubit/sign_in_state.dart +++ b/packages/wyatt_authentication_bloc/lib/src/features/sign_in/cubit/sign_in_state.dart @@ -17,7 +17,6 @@ part of 'sign_in_cubit.dart'; class SignInState extends FormDataState { - const SignInState({ required super.form, super.status = FormStatus.pure, diff --git a/packages/wyatt_authentication_bloc/lib/src/features/sign_up/cubit/sign_up_cubit.dart b/packages/wyatt_authentication_bloc/lib/src/features/sign_up/cubit/sign_up_cubit.dart index 72c69397..2d7ed28b 100644 --- a/packages/wyatt_authentication_bloc/lib/src/features/sign_up/cubit/sign_up_cubit.dart +++ b/packages/wyatt_authentication_bloc/lib/src/features/sign_up/cubit/sign_up_cubit.dart @@ -25,7 +25,6 @@ import 'package:wyatt_type_utils/wyatt_type_utils.dart'; part 'sign_up_state.dart'; class SignUpCubit extends FormDataCubit { - SignUpCubit({ required AuthenticationRepository authenticationRepository, }) : _authenticationRepository = authenticationRepository, diff --git a/packages/wyatt_authentication_bloc/lib/src/features/sign_up/cubit/sign_up_state.dart b/packages/wyatt_authentication_bloc/lib/src/features/sign_up/cubit/sign_up_state.dart index 414e9916..40c870c5 100644 --- a/packages/wyatt_authentication_bloc/lib/src/features/sign_up/cubit/sign_up_state.dart +++ b/packages/wyatt_authentication_bloc/lib/src/features/sign_up/cubit/sign_up_state.dart @@ -17,7 +17,6 @@ part of 'sign_up_cubit.dart'; class SignUpState extends FormDataState { - const SignUpState({ required super.form, super.status = FormStatus.pure, diff --git a/packages/wyatt_authentication_bloc/lib/src/src.dart b/packages/wyatt_authentication_bloc/lib/src/src.dart index e5a07de0..3a660ea4 100644 --- a/packages/wyatt_authentication_bloc/lib/src/src.dart +++ b/packages/wyatt_authentication_bloc/lib/src/src.dart @@ -1,16 +1,16 @@ // Copyright (C) 2022 WYATT GROUP // Please see the AUTHORS file for details. -// +// // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // any later version. -// +// // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. -// +// // You should have received a copy of the GNU General Public License // along with this program. If not, see . diff --git a/packages/wyatt_authentication_bloc/lib/wyatt_authentication_bloc.dart b/packages/wyatt_authentication_bloc/lib/wyatt_authentication_bloc.dart index e40338b2..a010cfa4 100644 --- a/packages/wyatt_authentication_bloc/lib/wyatt_authentication_bloc.dart +++ b/packages/wyatt_authentication_bloc/lib/wyatt_authentication_bloc.dart @@ -17,4 +17,7 @@ /// An authentication library for BLoC. library wyatt_authentication_bloc; +export 'package:firebase_auth/firebase_auth.dart'; +export 'package:google_sign_in/google_sign_in.dart'; + export 'src/src.dart'; diff --git a/packages/wyatt_authentication_bloc/pubspec.yaml b/packages/wyatt_authentication_bloc/pubspec.yaml index 60b9cba1..23471ff1 100644 --- a/packages/wyatt_authentication_bloc/pubspec.yaml +++ b/packages/wyatt_authentication_bloc/pubspec.yaml @@ -10,17 +10,12 @@ environment: flutter: ">=1.17.0" dependencies: - flutter: - sdk: flutter - + flutter: { sdk: flutter } crypto: ^3.0.2 flutter_bloc: ^8.1.1 equatable: ^2.0.5 - firebase_auth: ^4.1.1 - google_sign_in: ^5.3.0 - flutter_facebook_auth: ^4.3.0 - sign_in_with_apple: ^3.3.0 - twitter_login: ^4.2.3 + firebase_auth: ^4.2.0 + google_sign_in: ^5.4.2 rxdart: ^0.27.7 wyatt_form_bloc: @@ -36,8 +31,7 @@ dependencies: version: ^0.0.4 dev_dependencies: - flutter_test: - sdk: flutter + flutter_test: { sdk: flutter } bloc_test: ^9.1.0 mocktail: ^0.3.0