diff --git a/docs/firebase-ui-auth/providers/universal-email-sign-in.md b/docs/firebase-ui-auth/providers/universal-email-sign-in.md deleted file mode 100644 index ceb4b014..00000000 --- a/docs/firebase-ui-auth/providers/universal-email-sign-in.md +++ /dev/null @@ -1,187 +0,0 @@ -# Universal email sign in - -Universal email sign in is a flow that will resolve connected auth providers with a given email. -This flow is intended to solve the problem where the user doesn't remember which provider was -previously used to authenticate. - -## Using screen - -Firebase UI provides a pre-built `UniversalEmailSignInScreen`. - -```dart -UniversalEmailSignInScreen( - // optional, shows a dialog with a sign in ui - // with all connected providers. - onProvidersFound: (email, providers) { - // navigate to a custom sign in that provides - // a UI for authentication for received providers. - } -); -``` - -## Using view - -If the pre-built screens don't suit the app's needs, you could use a `FindProvidersForEmailView` to build your custom screen: - -```dart -class MyLoginScreen extends StatelessWidget { - @override - Widget build(BuildContext) { - return Scaffold( - body: Row( - children: [ - MyCustomSideBar(), - Padding( - padding: const EdgeInsets.all(16), - child: FindProvidersForEmailView( - onProvidersFound: (email, providers) { - // navigate to a custom sign in that provides - // a UI for authentication for received providers. - }, - ), - ) - ], - ), - ); - } -} -``` - -## Building a custom widget with `AuthFlowBuilder` - -You could also use `AuthFlowBuilder` to facilitate the functionality of the `UniversalEmailSignInFlow`: - -```dart -class MyCustomWidget extends StatelessWidget { - @override - Widget build(BuildContext context) { - return AuthFlowBuilder( - listener: (oldState, newState, controller) { - if (newState is DifferentSignInMethodsFound) { - showDifferentMethodSignInDialog( - context: context, - availableProviders: newState.methods, - providers: FirebaseUIAuth.providersFor( - FirebaseAuth.instance.app, - ), - ); - } - }, - builder: (context, state, ctrl, child) { - if (state is Uninitialized) { - return TextField( - decoration: InputDecoration( - labelText: 'Email', - ), - onSubmitted: (email) { - ctrl.findProvidersForEmail(email); - }, - ); - } else if (state is FetchingProvidersForEmail) { - return CircularProgressIndicator(); - } else if (state is AuthFailed) { - return ErrorText(exception: state.exception); - } else { - return Text('Unknown state $state'); - } - }, - ); - } -} -``` - -## Building a custom stateful widget - -For full control over every phase of the authentication lifecycle, you could build a stateful widget which implements `UniversalEmailSignInListener`: - -```dart -class CustomUniversalEmailSignIn extends StatefulWidget { - const CustomUniversalEmailSignIn({super.key}); - - @override - State createState() => - _CustomUniversalEmailSignInState(); -} - -class _CustomUniversalEmailSignInState extends State - implements UniversalEmailSignInListener { - final auth = FirebaseAuth.instance; - late final UniversalEmailSignInProvider provider = - UniversalEmailSignInProvider()..authListener = this; - - late Widget child = TextField( - decoration: const InputDecoration( - labelText: 'Email', - ), - onSubmitted: provider.findProvidersForEmail, - ); - - @override - void onBeforeProvidersForEmailFetch() { - setState(() { - child = CircularProgressIndicator(); - }); - } - - @override - void onDifferentProvidersFound( - String email, - List providers, - AuthCredential? credential, - ) { - showDifferentMethodSignInDialog( - context: context, - availableProviders: providers, - providers: FirebaseUIAuth.providersFor(FirebaseAuth.instance.app), - ); - } - - @override - Widget build(BuildContext context) { - return Center(child: child); - } - - @override - void onBeforeCredentialLinked(AuthCredential credential) { - setState(() { - child = CircularProgressIndicator(); - }); - } - - @override - void onBeforeSignIn() { - setState(() { - child = CircularProgressIndicator(); - }); - } - - @override - void onCanceled() { - setState(() { - child = Text('Authenticated cancelled'); - }); - } - - @override - void onCredentialLinked(AuthCredential credential) { - Navigator.of(context).pushReplacementNamed('/profile'); - } - - @override - void onError(Object error) { - try { - // tries default recovery strategy - defaultOnAuthError(provider, error); - } catch (err) { - setState(() { - defaultOnAuthError(provider, error); - }); - } - } - - @override - void onSignedIn(UserCredential credential) { - Navigator.of(context).pushReplacementNamed('/profile'); - } -} -``` diff --git a/packages/firebase_ui_auth/example/pubspec.yaml b/packages/firebase_ui_auth/example/pubspec.yaml index 658356df..3ae00867 100644 --- a/packages/firebase_ui_auth/example/pubspec.yaml +++ b/packages/firebase_ui_auth/example/pubspec.yaml @@ -22,8 +22,8 @@ environment: dependencies: cupertino_icons: ^1.0.6 - firebase_auth: ^5.7.0 - firebase_core: ^3.15.2 + firebase_auth: ^6.0.0 + firebase_core: ^4.0.0 flutter: sdk: flutter flutter_localizations: diff --git a/packages/firebase_ui_auth/lib/firebase_ui_auth.dart b/packages/firebase_ui_auth/lib/firebase_ui_auth.dart index 38277d3b..5ee557a8 100644 --- a/packages/firebase_ui_auth/lib/firebase_ui_auth.dart +++ b/packages/firebase_ui_auth/lib/firebase_ui_auth.dart @@ -19,7 +19,6 @@ export 'src/auth_flow.dart'; export 'src/auth_state.dart' show Uninitialized, - FetchingProvidersForEmail, AuthStateListenerCallback, AuthState, AuthStateListener, @@ -29,16 +28,12 @@ export 'src/auth_state.dart' SigningIn, UserCreated, AuthFailed, - // ignore: deprecated_member_use_from_same_package - DifferentSignInMethodsFound, MFARequired; export 'src/email_verification.dart'; export 'src/flows/email_flow.dart'; export 'src/flows/email_link_flow.dart'; export 'src/flows/oauth_flow.dart' show OAuthController, OAuthFlow; export 'src/flows/phone_auth_flow.dart'; -export 'src/flows/universal_email_sign_in_flow.dart'; -// ignore_for_file: use_build_context_synchronously export 'src/mfa.dart' show startMFAVerification; export 'src/navigation/authentication.dart'; @@ -51,7 +46,6 @@ export 'src/providers/auth_provider.dart'; export 'src/providers/email_auth_provider.dart'; export 'src/providers/email_link_auth_provider.dart'; export 'src/providers/phone_auth_provider.dart'; -export 'src/providers/universal_email_sign_in_provider.dart'; export 'src/screens/email_link_sign_in_screen.dart'; export 'src/screens/email_verification_screen.dart'; export 'src/screens/forgot_password_screen.dart'; @@ -62,12 +56,9 @@ export 'src/screens/profile_screen.dart' show ProfileScreen; export 'src/screens/register_screen.dart'; export 'src/screens/sign_in_screen.dart'; export 'src/screens/sms_code_input_screen.dart'; -export 'src/screens/universal_email_sign_in_screen.dart'; export 'src/styling/style.dart' show FirebaseUIStyle; export 'src/styling/theme.dart' show FirebaseUITheme; -export 'src/views/different_method_sign_in_view.dart'; export 'src/views/email_link_sign_in_view.dart'; -export 'src/views/find_providers_for_email_view.dart'; export 'src/views/forgot_password_view.dart'; export 'src/views/login_view.dart'; export 'src/views/phone_input_view.dart'; @@ -75,7 +66,6 @@ export 'src/views/reauthenticate_view.dart'; export 'src/views/sms_code_input_view.dart'; export 'src/widgets/auth_flow_builder.dart'; export 'src/widgets/delete_account_button.dart'; -export 'src/widgets/different_method_sign_in_dialog.dart'; export 'src/widgets/editable_user_display_name.dart'; export 'src/widgets/email_form.dart' show EmailForm, ForgotPasswordAction, EmailFormStyle; diff --git a/packages/firebase_ui_auth/lib/src/auth_flow.dart b/packages/firebase_ui_auth/lib/src/auth_flow.dart index e886cea0..090a0ecc 100644 --- a/packages/firebase_ui_auth/lib/src/auth_flow.dart +++ b/packages/firebase_ui_auth/lib/src/auth_flow.dart @@ -113,11 +113,6 @@ class AuthFlow extends ValueNotifier value = CredentialReceived(credential); } - @override - void onBeforeProvidersForEmailFetch() { - value = const FetchingProvidersForEmail(); - } - @override void onBeforeSignIn() { value = const SigningIn(); @@ -128,24 +123,6 @@ class AuthFlow extends ValueNotifier value = CredentialLinked(credential, auth.currentUser!); } - @override - @Deprecated( - 'Email enumeration protection is on by default.' - 'Read more here https://cloud.google.com/identity-platform/docs/admin/email-enumeration-protection', - ) - @override - void onDifferentProvidersFound( - String email, - List providers, - fba.AuthCredential? credential, - ) { - value = DifferentSignInMethodsFound( - email, - providers, - credential, - ); - } - @override void onSignedIn(fba.UserCredential credential) { if (credential.additionalUserInfo?.isNewUser ?? false) { diff --git a/packages/firebase_ui_auth/lib/src/auth_state.dart b/packages/firebase_ui_auth/lib/src/auth_state.dart index f15d4c13..a8861a49 100644 --- a/packages/firebase_ui_auth/lib/src/auth_state.dart +++ b/packages/firebase_ui_auth/lib/src/auth_state.dart @@ -154,43 +154,6 @@ class UserCreated extends AuthState { UserCreated(this.credential); } -/// {@template ui.auth.auth_state.different_sign_in_methods_found} -/// An [AuthState] that indicates that there are different auth providers -/// associated with an email that was used to authenticate. -/// -/// See [AuthState] docs for usage examples. -/// {@endtemplate} -@Deprecated( - 'Email enumeration protection is on by default.' - 'Read more here https://cloud.google.com/identity-platform/docs/admin/email-enumeration-protection', -) -class DifferentSignInMethodsFound extends AuthState { - /// An email that has different auth providers associated with. - final String email; - - /// An instance of the auth credential that was obtained during sign in flow. - /// Could be used to link with the user account after a sign in using on of - /// the available [methods]. - final AuthCredential? credential; - - /// A list of provider ids that were found for the [email]. - final List methods; - - /// {@macro ui.auth.auth_state.different_sign_in_methods_found} - DifferentSignInMethodsFound(this.email, this.methods, this.credential); -} - -/// {@template ui.auth.auth_state.fetching_providers_for_email} -/// An [AuthState] that indicates that there is a lookup of available providers -/// for an email in progress. -/// -/// See [AuthState] docs for usage examples. -/// {@endtemplate} -class FetchingProvidersForEmail extends AuthState { - /// {@macro ui.auth.auth_state.fetching_providers_for_email} - const FetchingProvidersForEmail(); -} - /// {@template ui.auth.auth_state.mfa_required} /// An [AuthState] that indicates that multi-factor authentication is required. /// {@endtemplate} diff --git a/packages/firebase_ui_auth/lib/src/flows/universal_email_sign_in_flow.dart b/packages/firebase_ui_auth/lib/src/flows/universal_email_sign_in_flow.dart deleted file mode 100644 index f2565327..00000000 --- a/packages/firebase_ui_auth/lib/src/flows/universal_email_sign_in_flow.dart +++ /dev/null @@ -1,50 +0,0 @@ -// Copyright 2022, the Chromium project authors. Please see the AUTHORS file -// for details. All rights reserved. Use of this source code is governed by a -// BSD-style license that can be found in the LICENSE file. - -import 'package:firebase_ui_auth/firebase_ui_auth.dart'; - -/// A controller interface of the [UniversalEmailSignInFlow]. -@Deprecated( - 'Email enumeration protection is on by default.' - 'Read more here https://cloud.google.com/identity-platform/docs/admin/email-enumeration-protection', -) -abstract class UniversalEmailSignInController extends AuthController { - /// {@template ui.auth.auth_controller.find_providers_for_email} - /// Finds providers that can be used to sign in with a provided email. - /// Calls [AuthListener.onBeforeProvidersForEmailFetch], if request succeded – - /// [AuthListener.onDifferentProvidersFound] is called and - /// [AuthListener.onError] if failed. - /// {@endtemplate} - void findProvidersForEmail(String email); -} - -/// {@template ui.auth.flows.universal_email_sign_in_flow} -/// An auth flow that resolves providers that are accosicatied with the given -/// email. -/// {@endtemplate} -@Deprecated( - 'Email enumeration protection is on by default.' - 'Read more here https://cloud.google.com/identity-platform/docs/admin/email-enumeration-protection', -) -class UniversalEmailSignInFlow extends AuthFlow - implements UniversalEmailSignInController, UniversalEmailSignInListener { - // {@macro ui.auth.flows.universal_email_sign_in_flow} - UniversalEmailSignInFlow({ - /// {@macro ui.auth.auth_flow.ctor.provider} - required super.provider, - - /// {@macro ui.auth.auth_controller.auth} - super.auth, - - /// {@macro ui.auth.auth_action} - super.action, - }) : super( - initialState: const Uninitialized(), - ); - - @override - void findProvidersForEmail(String email) { - provider.findProvidersForEmail(email); - } -} diff --git a/packages/firebase_ui_auth/lib/src/navigation/authentication.dart b/packages/firebase_ui_auth/lib/src/navigation/authentication.dart index bbca8d35..3e4b37f5 100644 --- a/packages/firebase_ui_auth/lib/src/navigation/authentication.dart +++ b/packages/firebase_ui_auth/lib/src/navigation/authentication.dart @@ -47,40 +47,3 @@ Future showReauthenticateDialog({ if (reauthenticated == null) return false; return reauthenticated; } - -/// Shows [DifferentMethodSignInDialog]. -@Deprecated( - 'Email enumeration protection is on by default.' - 'Read more here https://cloud.google.com/identity-platform/docs/admin/email-enumeration-protection', -) -Future showDifferentMethodSignInDialog({ - required BuildContext context, - - /// A list of providers associated with the user account - required List availableProviders, - - /// A list of all supported providers - required List providers, - - /// {@macro ui.auth.auth_controller.auth} - fba.FirebaseAuth? auth, - - /// A callback that is being called after user has successfully signed in. - VoidCallback? onSignedIn, -}) async { - final l = FirebaseUILocalizations.labelsOf(context); - - await showGeneralDialog( - context: context, - barrierDismissible: true, - barrierLabel: l.cancelButtonLabel, - pageBuilder: (context, _, __) => DifferentMethodSignInDialog( - availableProviders: availableProviders, - providers: providers, - auth: auth, - onSignedIn: () { - Navigator.of(context).pop(); - }, - ), - ); -} diff --git a/packages/firebase_ui_auth/lib/src/providers/auth_provider.dart b/packages/firebase_ui_auth/lib/src/providers/auth_provider.dart index ea905f32..b2aa3080 100644 --- a/packages/firebase_ui_auth/lib/src/providers/auth_provider.dart +++ b/packages/firebase_ui_auth/lib/src/providers/auth_provider.dart @@ -50,25 +50,7 @@ abstract class AuthListener { /// Called if the credential was successfully linked with the user account. void onCredentialLinked(fba.AuthCredential credential); - /// Called before an attempt to fetch available providers for the email. - @Deprecated( - 'Email enumeration protection is on by default.' - 'Read more here https://cloud.google.com/identity-platform/docs/admin/email-enumeration-protection', - ) - void onBeforeProvidersForEmailFetch(); - - /// Called when available providers for the email were successfully fetched. - @Deprecated( - 'Email enumeration protection is on by default.' - 'Read more here https://cloud.google.com/identity-platform/docs/admin/email-enumeration-protection', - ) - void onDifferentProvidersFound( - String email, - List providers, - fba.AuthCredential? credential, - ); - - /// Called when the user cancells the sign in process. + /// Called when the user cancels the sign in process. void onCanceled(); /// Called when the user has to complete MFA. @@ -134,29 +116,6 @@ abstract class AuthProvider authListener.onDifferentProvidersFound( - email, - methods, - credential, - ), - ) - .catchError(authListener.onError); - } - /// {@template ui.auth.auth_provider.on_credential_received} /// A method that is called when the user has successfully completed the /// authentication process and decides what to do with the obtained diff --git a/packages/firebase_ui_auth/lib/src/providers/universal_email_sign_in_provider.dart b/packages/firebase_ui_auth/lib/src/providers/universal_email_sign_in_provider.dart deleted file mode 100644 index 2c0db8bb..00000000 --- a/packages/firebase_ui_auth/lib/src/providers/universal_email_sign_in_provider.dart +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright 2022, the Chromium project authors. Please see the AUTHORS file -// for details. All rights reserved. Use of this source code is governed by a -// BSD-style license that can be found in the LICENSE file. - -import 'package:firebase_auth/firebase_auth.dart' as fba; -import 'package:flutter/foundation.dart'; -import 'package:firebase_ui_auth/firebase_ui_auth.dart'; - -/// A [UniversalEmailSignInFlow] lifecycle listener. -@Deprecated( - 'Email enumeration protection is on by default.' - 'Read more here https://cloud.google.com/identity-platform/docs/admin/email-enumeration-protection', -) -abstract class UniversalEmailSignInListener extends AuthListener { - @override - void onBeforeProvidersForEmailFetch(); - - @override - void onDifferentProvidersFound( - String email, - List providers, - fba.AuthCredential? credential, - ); -} - -/// A provider that resolves available authentication methods for a given -/// email. -@Deprecated( - 'Email enumeration protection is on by default.' - 'Read more here https://cloud.google.com/identity-platform/docs/admin/email-enumeration-protection', -) -class UniversalEmailSignInProvider - extends AuthProvider { - @override - late UniversalEmailSignInListener authListener; - - @override - String get providerId => 'universal_email_sign_in'; - - @override - bool supportsPlatform(TargetPlatform platform) { - return true; - } -} diff --git a/packages/firebase_ui_auth/lib/src/screens/sign_in_screen.dart b/packages/firebase_ui_auth/lib/src/screens/sign_in_screen.dart index 82e6488d..cda57f1d 100644 --- a/packages/firebase_ui_auth/lib/src/screens/sign_in_screen.dart +++ b/packages/firebase_ui_auth/lib/src/screens/sign_in_screen.dart @@ -124,37 +124,10 @@ class SignInScreen extends MultiProviderScreen { this.maxWidth, }); - Future _signInWithDifferentProvider( - BuildContext context, - // ignore: deprecated_member_use_from_same_package - DifferentSignInMethodsFound state, - ) async { - // ignore: deprecated_member_use_from_same_package - await showDifferentMethodSignInDialog( - availableProviders: state.methods, - providers: providers, - context: context, - auth: auth, - onSignedIn: () { - Navigator.of(context).pop(); - }, - ); - - await auth.currentUser!.linkWithCredential(state.credential!); - } - @override Widget build(BuildContext context) { - final handlesDifferentSignInMethod = this - .actions - // ignore: deprecated_member_use_from_same_package - .whereType>() - .isNotEmpty; - final actions = [ ...this.actions, - if (!handlesDifferentSignInMethod) - AuthStateChangeAction(_signInWithDifferentProvider) ]; return FirebaseUIActions( diff --git a/packages/firebase_ui_auth/lib/src/screens/universal_email_sign_in_screen.dart b/packages/firebase_ui_auth/lib/src/screens/universal_email_sign_in_screen.dart deleted file mode 100644 index 03fe2573..00000000 --- a/packages/firebase_ui_auth/lib/src/screens/universal_email_sign_in_screen.dart +++ /dev/null @@ -1,127 +0,0 @@ -// Copyright 2022, the Chromium project authors. Please see the AUTHORS file -// for details. All rights reserved. Use of this source code is governed by a -// BSD-style license that can be found in the LICENSE file. - -import 'package:firebase_ui_shared/firebase_ui_shared.dart'; -import 'package:flutter/material.dart'; -import 'package:firebase_ui_auth/firebase_ui_auth.dart'; -import '../widgets/internal/universal_page_route.dart'; -import 'internal/multi_provider_screen.dart'; - -/// A screen that allows to resolve previously used providers for a given email. -@Deprecated( - 'Email enumeration protection is on by default.' - 'Read more here https://cloud.google.com/identity-platform/docs/admin/email-enumeration-protection', -) -class UniversalEmailSignInScreen extends MultiProviderScreen { - /// A callback that is being called when providers fetch request completed. - final ProvidersFoundCallback? onProvidersFound; - - const UniversalEmailSignInScreen({ - super.key, - - /// {@macro ui.auth.auth_controller.auth} - super.auth, - - /// A list of all supported auth providers - super.providers, - this.onProvidersFound, - }) : assert(onProvidersFound != null || providers != null); - - Widget _wrap(BuildContext context, Widget child) { - return AuthStateListener( - child: FirebaseUIActions.inherit( - from: context, - child: child, - ), - listener: (_, newState, controller) { - if (newState is SignedIn) { - Navigator.of(context).pop(); - } - return null; - }, - ); - } - - void _defaultAction( - BuildContext context, - String email, - List providerIds, - ) { - late Route route; - - if (providerIds.isEmpty) { - route = createPageRoute( - context: context, - builder: (context) => _wrap( - context, - RegisterScreen( - showAuthActionSwitch: false, - providers: providers, - auth: auth, - email: email, - ), - ), - ); - } else { - final providersMap = providers.fold>( - {}, - (acc, element) { - return { - ...acc, - element.providerId: element, - }; - }, - ); - - final authorizedProviders = providerIds - .where(providersMap.containsKey) - .map((id) => providersMap[id]!) - .toList(); - - route = createPageRoute( - context: context, - builder: (context) => _wrap( - context, - SignInScreen( - showAuthActionSwitch: false, - providers: authorizedProviders, - auth: auth, - email: email, - ), - ), - ); - } - - Navigator.of(context).push(route); - } - - @override - Widget build(BuildContext context) { - final content = FindProvidersForEmailView( - auth: auth, - onProvidersFound: onProvidersFound ?? - (email, providers) => _defaultAction(context, email, providers), - ); - - return UniversalScaffold( - body: Center( - child: LayoutBuilder( - builder: (context, constraints) { - if (constraints.biggest.width < 500) { - return Padding( - padding: const EdgeInsets.all(20), - child: content, - ); - } else { - return ConstrainedBox( - constraints: const BoxConstraints(maxWidth: 500), - child: content, - ); - } - }, - ), - ), - ); - } -} diff --git a/packages/firebase_ui_auth/lib/src/views/different_method_sign_in_view.dart b/packages/firebase_ui_auth/lib/src/views/different_method_sign_in_view.dart deleted file mode 100644 index 3a1e42b8..00000000 --- a/packages/firebase_ui_auth/lib/src/views/different_method_sign_in_view.dart +++ /dev/null @@ -1,81 +0,0 @@ -// Copyright 2022, the Chromium project authors. Please see the AUTHORS file -// for details. All rights reserved. Use of this source code is governed by a -// BSD-style license that can be found in the LICENSE file. - -import 'package:firebase_auth/firebase_auth.dart' as fba; -import 'package:flutter/widgets.dart'; -import 'package:firebase_ui_auth/firebase_ui_auth.dart'; - -/// {@template ui.auth.views.different_method_sign_in_view} -/// A view that renders a list of providers that were previously used by the -/// user to authenticate. -/// {@endtemplate} -@Deprecated( - 'Email enumeration protection is on by default.' - 'Read more here https://cloud.google.com/identity-platform/docs/admin/email-enumeration-protection', -) -class DifferentMethodSignInView extends StatelessWidget { - /// {@macro ui.auth.auth_controller.auth} - final fba.FirebaseAuth? auth; - - /// A list of all providers that were previously used to authenticate. - final List availableProviders; - - /// A list of all supported auth providers. - final List providers; - - /// A callback that is being called when the user has signed in using on of - /// the [availableProviders]. - final VoidCallback? onSignedIn; - - /// {@macro ui.auth.widgets.email_from.showPasswordVisibilityToggle} - final bool showPasswordVisibilityToggle; - - /// {@macro ui.auth.views.different_method_sign_in_view} - const DifferentMethodSignInView({ - super.key, - required this.availableProviders, - required this.providers, - this.auth, - this.onSignedIn, - this.showPasswordVisibilityToggle = false, - }); - - @override - Widget build(BuildContext context) { - final providersMap = this.providers.fold>( - {}, - (map, config) { - return { - ...map, - config.providerId: config, - }; - }, - ); - - List providers = []; - - for (final p in availableProviders) { - final providerConfig = providersMap[p]; - if (providerConfig != null) { - providers.add(providerConfig); - } - } - - return AuthStateListener( - child: LoginView( - action: AuthAction.signIn, - providers: providers, - showTitle: false, - showPasswordVisibilityToggle: showPasswordVisibilityToggle, - ), - listener: (oldState, newState, ctrl) { - if (newState is SignedIn) { - onSignedIn?.call(); - } - - return false; - }, - ); - } -} diff --git a/packages/firebase_ui_auth/lib/src/views/find_providers_for_email_view.dart b/packages/firebase_ui_auth/lib/src/views/find_providers_for_email_view.dart deleted file mode 100644 index 63b1925d..00000000 --- a/packages/firebase_ui_auth/lib/src/views/find_providers_for_email_view.dart +++ /dev/null @@ -1,112 +0,0 @@ -// Copyright 2022, the Chromium project authors. Please see the AUTHORS file -// for details. All rights reserved. Use of this source code is governed by a -// BSD-style license that can be found in the LICENSE file. - -import 'package:firebase_auth/firebase_auth.dart' as fba; -import 'package:firebase_ui_shared/firebase_ui_shared.dart'; -import 'package:flutter/material.dart' hide Title; -import 'package:firebase_ui_auth/firebase_ui_auth.dart'; -import 'package:firebase_ui_localizations/firebase_ui_localizations.dart'; - -import '../widgets/internal/title.dart'; - -/// A callback that is being called when providers fetch request is completed. -@Deprecated( - 'Email enumeration protection is on by default.' - 'Read more here https://cloud.google.com/identity-platform/docs/admin/email-enumeration-protection', -) -typedef ProvidersFoundCallback = void Function( - String email, - List providers, -); - -/// {@template ui.auth.views.find_providers_for_email_view} -/// A view that could be used to build a custom [UniversalEmailSignInScreen]. -/// {@endtemplate} -@Deprecated( - 'Email enumeration protection is on by default.' - 'Read more here https://cloud.google.com/identity-platform/docs/admin/email-enumeration-protection', -) -class FindProvidersForEmailView extends StatefulWidget { - final ProvidersFoundCallback? onProvidersFound; - - /// {@macro ui.auth.auth_controller.auth} - final fba.FirebaseAuth? auth; - - /// {@macro ui.auth.views.find_providers_for_email_view} - const FindProvidersForEmailView({ - super.key, - this.onProvidersFound, - this.auth, - }); - - @override - State createState() => - _FindProvidersForEmailViewState(); -} - -@Deprecated( - 'Email enumeration protection is on by default.' - 'Read more here https://cloud.google.com/identity-platform/docs/admin/email-enumeration-protection', -) -class _FindProvidersForEmailViewState extends State { - final formKey = GlobalKey(); - final emailCtrl = TextEditingController(); - - late final flow = UniversalEmailSignInFlow( - provider: UniversalEmailSignInProvider(), - auth: widget.auth, - ); - - void _submit(UniversalEmailSignInController ctrl, String email) { - if (formKey.currentState!.validate()) { - ctrl.findProvidersForEmail(email); - } - } - - @override - Widget build(BuildContext context) { - final l = FirebaseUILocalizations.labelsOf(context); - const spacer = SizedBox(height: 24); - - return AuthFlowBuilder( - auth: widget.auth, - flow: flow, - listener: (oldState, newState, controller) { - if (newState is DifferentSignInMethodsFound) { - widget.onProvidersFound?.call( - emailCtrl.text, - newState.methods, - ); - } - }, - builder: (context, state, ctrl, child) => Column( - mainAxisSize: MainAxisSize.min, - crossAxisAlignment: CrossAxisAlignment.stretch, - children: [ - Title( - text: l.findProviderForEmailTitleText, - ), - spacer, - Form( - key: formKey, - child: EmailInput( - controller: emailCtrl, - onSubmitted: (_) { - _submit(ctrl, emailCtrl.text); - }, - ), - ), - spacer, - LoadingButton( - isLoading: state is FetchingProvidersForEmail, - label: l.continueText, - onTap: () { - _submit(ctrl, emailCtrl.text); - }, - ) - ], - ), - ); - } -} diff --git a/packages/firebase_ui_auth/lib/src/widgets/auth_flow_builder.dart b/packages/firebase_ui_auth/lib/src/widgets/auth_flow_builder.dart index bd9b086d..e3cb74b1 100644 --- a/packages/firebase_ui_auth/lib/src/widgets/auth_flow_builder.dart +++ b/packages/firebase_ui_auth/lib/src/widgets/auth_flow_builder.dart @@ -225,11 +225,6 @@ class _AuthFlowBuilderState return EmailAuthProvider(); case PhoneAuthController: return PhoneAuthProvider(); - - // ignore: deprecated_member_use_from_same_package - case UniversalEmailSignInController: - // ignore: deprecated_member_use_from_same_package - return UniversalEmailSignInProvider(); default: throw Exception("Can't create $T provider"); } @@ -268,14 +263,6 @@ class _AuthFlowBuilderState action: widget.action, auth: widget.auth, ); - // ignore: deprecated_member_use_from_same_package - } else if (provider is UniversalEmailSignInProvider) { - // ignore: deprecated_member_use_from_same_package - return UniversalEmailSignInFlow( - provider: provider, - action: widget.action, - auth: widget.auth, - ); } else { throw Exception('Unknown provider $provider'); } diff --git a/packages/firebase_ui_auth/lib/src/widgets/different_method_sign_in_dialog.dart b/packages/firebase_ui_auth/lib/src/widgets/different_method_sign_in_dialog.dart deleted file mode 100644 index c69f0b23..00000000 --- a/packages/firebase_ui_auth/lib/src/widgets/different_method_sign_in_dialog.dart +++ /dev/null @@ -1,77 +0,0 @@ -// Copyright 2022, the Chromium project authors. Please see the AUTHORS file -// for details. All rights reserved. Use of this source code is governed by a -// BSD-style license that can be found in the LICENSE file. - -import 'package:firebase_auth/firebase_auth.dart' as fba; -import 'package:firebase_ui_shared/firebase_ui_shared.dart'; -import 'package:flutter/material.dart' hide Title; -import 'package:firebase_ui_auth/firebase_ui_auth.dart'; -import 'package:firebase_ui_localizations/firebase_ui_localizations.dart'; - -import '../widgets/internal/title.dart'; - -/// {@template ui.auth.widgets.different_method_sign_in_dialog} -/// A dialog that is shown when the user tries to sign in with a provider that -/// wasn't previously used, but there are other providers for a given email. -/// {@endtemplate} -@Deprecated( - 'Email enumeration protection is on by default.' - 'Read more here https://cloud.google.com/identity-platform/docs/admin/email-enumeration-protection', -) -class DifferentMethodSignInDialog extends StatelessWidget { - /// {@macro ui.auth.auth_controller.auth} - final fba.FirebaseAuth? auth; - - /// A list of all providers that were previously used to authenticate. - final List availableProviders; - - /// A list of all supported auth providers. - final List providers; - - /// A callback that is being called when the user has signed in using on of - /// the [availableProviders]. - final VoidCallback? onSignedIn; - - /// {@macro ui.auth.widgets.different_method_sign_in_dialog} - const DifferentMethodSignInDialog({ - super.key, - required this.availableProviders, - required this.providers, - this.auth, - this.onSignedIn, - }); - - @override - Widget build(BuildContext context) { - final l = FirebaseUILocalizations.labelsOf(context); - - return Center( - child: ConstrainedBox( - constraints: const BoxConstraints(maxWidth: 400), - child: Dialog( - child: Padding( - padding: const EdgeInsets.all(20), - child: Column( - crossAxisAlignment: CrossAxisAlignment.stretch, - mainAxisSize: MainAxisSize.min, - children: [ - Title(text: l.differentMethodsSignInTitleText), - const SizedBox(height: 32), - DifferentMethodSignInView( - auth: auth, - providers: providers, - availableProviders: availableProviders, - onSignedIn: onSignedIn, - ), - UniversalButton( - text: l.cancelButtonLabel, - onPressed: () => Navigator.of(context).pop(), - ), - ], - ), - ), - ), - ), - ); - } -} diff --git a/packages/firebase_ui_auth/pubspec.yaml b/packages/firebase_ui_auth/pubspec.yaml index 50956096..b7cd1b62 100644 --- a/packages/firebase_ui_auth/pubspec.yaml +++ b/packages/firebase_ui_auth/pubspec.yaml @@ -11,8 +11,8 @@ environment: dependencies: app_links: ^6.4.0 email_validator: ^2.1.17 - firebase_auth: ^5.7.0 - firebase_core: ^3.15.2 + firebase_auth: ^6.0.0 + firebase_core: ^4.0.0 firebase_ui_localizations: ^1.14.1 firebase_ui_oauth: ^1.7.1 firebase_ui_shared: ^1.4.1 diff --git a/packages/firebase_ui_auth/test/flows/universal_email_sign_in_flow_test.dart b/packages/firebase_ui_auth/test/flows/universal_email_sign_in_flow_test.dart deleted file mode 100644 index b84fc2cb..00000000 --- a/packages/firebase_ui_auth/test/flows/universal_email_sign_in_flow_test.dart +++ /dev/null @@ -1,154 +0,0 @@ -// Copyright 2022, the Chromium project authors. Please see the AUTHORS file -// for details. All rights reserved. Use of this source code is governed by a -// BSD-style license that can be found in the LICENSE file. - -// ignore_for_file: deprecated_member_use_from_same_package - -import 'package:firebase_auth/firebase_auth.dart' as fba; -import 'package:flutter_test/flutter_test.dart'; -import 'package:firebase_ui_auth/firebase_ui_auth.dart'; -import 'package:mockito/mockito.dart'; - -import '../test_utils.dart'; - -void main() { - late UniversalEmailSignInProvider provider; - late MockAuth auth; - late MockListener listener; - - setUp(() { - auth = MockAuth(); - listener = MockListener(); - - provider = UniversalEmailSignInProvider(); - provider.auth = auth; - provider.authListener = listener; - }); - - group('UniversalEmailSignInProvider', () { - test('has correct provider id', () { - expect(provider.providerId, 'universal_email_sign_in'); - }); - - group('#findProvidersForEmail', () { - test('calls fba.FirebaseAuth#fetchSignInMethodsForEmail', () { - provider.findProvidersForEmail('test@test.com'); - final invocation = verify(auth.fetchSignInMethodsForEmail(captureAny)); - - expect(invocation.callCount, 1); - expect(invocation.captured, ['test@test.com']); - }); - - test( - 'calls onBeforeProvidersForEmailFetch', - () { - provider.findProvidersForEmail('test@test.com'); - verify(listener.onBeforeProvidersForEmailFetch()).called(1); - }, - ); - - test('calls onDifferentProvidersFound', () async { - provider.findProvidersForEmail('test@test.com'); - await untilCalled(listener.onBeforeProvidersForEmailFetch()); - - final invocation = verify( - listener.onDifferentProvidersFound( - captureAny, - captureAny, - captureAny, - ), - ); - - invocation.called(1); - - expect(invocation.captured, [ - 'test@test.com', - ['phone'], - null, - ]); - }); - - test('calls onError if an error occured', () async { - final exception = TestException(); - when(auth.fetchSignInMethodsForEmail(any)).thenThrow(exception); - - provider.findProvidersForEmail('test@test.com'); - await untilCalled(listener.onError(any)); - - final invocation = verify(listener.onError(captureAny)); - - expect(invocation.callCount, 1); - expect(invocation.captured, [exception]); - }); - }); - - group('UniversalEmailSignInController', () { - group('#findProvidersForEmail', () { - test( - 'calls UniversalEmailSignInProvider#findProvidersForEmail', - () async { - final provider = MockProvider(); - - UniversalEmailSignInController ctrl = UniversalEmailSignInFlow( - provider: provider, - auth: auth, - ); - - ctrl.findProvidersForEmail('test@test.com'); - final invocation = verify( - provider.findProvidersForEmail(captureAny), - ); - - expect(invocation.callCount, 1); - expect(invocation.captured, ['test@test.com']); - }, - ); - }); - }); - }); -} - -class MockListener extends Mock implements UniversalEmailSignInListener { - @override - void onBeforeProvidersForEmailFetch() { - super.noSuchMethod( - Invocation.method(#onBeforeProvidersForEmailFetch, null), - ); - } - - @override - void onDifferentProvidersFound( - String? email, - List? providers, - fba.AuthCredential? credential, - ) { - super.noSuchMethod( - Invocation.method( - #onDifferentProvidersFound, - [email, providers, credential], - ), - ); - } - - @override - void onError(Object? error) { - super.noSuchMethod( - Invocation.method(#onError, [error]), - ); - } -} - -class MockProvider extends Mock implements UniversalEmailSignInProvider { - @override - void findProvidersForEmail( - String? email, [ - fba.AuthCredential? credential, - ]) { - super.noSuchMethod( - Invocation.method( - #findProvidersForEmail, - [email, credential], - ), - ); - } -} diff --git a/packages/firebase_ui_auth/test/test_utils.dart b/packages/firebase_ui_auth/test/test_utils.dart index bd1bb10e..20059ffe 100644 --- a/packages/firebase_ui_auth/test/test_utils.dart +++ b/packages/firebase_ui_auth/test/test_utils.dart @@ -193,18 +193,6 @@ class MockAuth extends Mock implements fba.FirebaseAuth { ); } - @override - Future> fetchSignInMethodsForEmail(String? email) async { - return super.noSuchMethod( - Invocation.method( - #fetchSignInMethodsForEmail, - [email], - ), - returnValue: ['phone'], - returnValueForMissingStub: ['phone'], - ); - } - @override Future verifyPhoneNumber({ String? phoneNumber, diff --git a/packages/firebase_ui_database/example/pubspec.yaml b/packages/firebase_ui_database/example/pubspec.yaml index d959e505..ab2d15b6 100644 --- a/packages/firebase_ui_database/example/pubspec.yaml +++ b/packages/firebase_ui_database/example/pubspec.yaml @@ -33,8 +33,8 @@ dependencies: # The following adds the Cupertino Icons font to your application. # Use with the CupertinoIcons class for iOS style icons. cupertino_icons: ^1.0.6 - firebase_core: ^3.15.2 - firebase_database: ^11.3.10 + firebase_core: ^4.0.0 + firebase_database: ^12.0.0 dev_dependencies: drive: ^1.0.0-1.0.nullsafety.5 flutter_test: diff --git a/packages/firebase_ui_database/lib/src/table_builder.dart b/packages/firebase_ui_database/lib/src/table_builder.dart index c3b3d7a5..09e6cbd6 100644 --- a/packages/firebase_ui_database/lib/src/table_builder.dart +++ b/packages/firebase_ui_database/lib/src/table_builder.dart @@ -51,8 +51,6 @@ class FirebaseDatabaseDataTable extends StatefulWidget { this.actions, this.sortColumnIndex, this.sortAscending = true, - @Deprecated('Migrate to use dataRowMinHeight and dataRowMaxHeight instead.') - double? dataRowHeight, double? dataRowMinHeight, double? dataRowMaxHeight, this.headingRowHeight = 56.0, @@ -69,10 +67,8 @@ class FirebaseDatabaseDataTable extends StatefulWidget { columnLabels is LinkedHashMap, 'only LinkedHashMap are supported as header', ), // using an assert instead of a type because `{}` types as `Map` but is an instance of `LinkedHashMap` - dataRowMinHeight = - dataRowHeight ?? dataRowMinHeight ?? kMinInteractiveDimension, - dataRowMaxHeight = - dataRowHeight ?? dataRowMaxHeight ?? kMinInteractiveDimension; + dataRowMinHeight = dataRowMinHeight ?? kMinInteractiveDimension, + dataRowMaxHeight = dataRowMaxHeight ?? kMinInteractiveDimension; /// The firestore query that will be displayed final Query query; diff --git a/packages/firebase_ui_database/pubspec.yaml b/packages/firebase_ui_database/pubspec.yaml index 04fb1ede..4715475d 100644 --- a/packages/firebase_ui_database/pubspec.yaml +++ b/packages/firebase_ui_database/pubspec.yaml @@ -9,7 +9,7 @@ environment: dependencies: collection: ^1.18.0 - firebase_database: ^11.3.10 + firebase_database: ^12.0.0 firebase_ui_localizations: ^1.14.1 flutter: sdk: flutter diff --git a/packages/firebase_ui_firestore/example/pubspec.yaml b/packages/firebase_ui_firestore/example/pubspec.yaml index 4944e04c..03512f02 100644 --- a/packages/firebase_ui_firestore/example/pubspec.yaml +++ b/packages/firebase_ui_firestore/example/pubspec.yaml @@ -30,9 +30,9 @@ dependencies: flutter: sdk: flutter firebase_ui_firestore: ^1.7.3 - cloud_firestore: ^5.6.12 + cloud_firestore: ^6.0.0 cupertino_icons: ^1.0.6 - firebase_core: ^3.15.2 + firebase_core: ^4.0.0 dev_dependencies: drive: ^1.0.0-1.0.nullsafety.5 flutter_test: diff --git a/packages/firebase_ui_firestore/lib/src/table_builder.dart b/packages/firebase_ui_firestore/lib/src/table_builder.dart index 339ddf1a..faa3402b 100644 --- a/packages/firebase_ui_firestore/lib/src/table_builder.dart +++ b/packages/firebase_ui_firestore/lib/src/table_builder.dart @@ -68,11 +68,6 @@ class FirestoreDataTable extends StatefulWidget { this.actions, this.sortColumnIndex, this.sortAscending = true, - @Deprecated( - 'Migrate to use dataRowMinHeight and dataRowMaxHeight instead. ' - 'This feature was deprecated after v3.7.0-5.0.pre.', - ) - double? dataRowHeight, double? dataRowMinHeight, double? dataRowMaxHeight, this.headingRowHeight = 56.0, @@ -93,10 +88,8 @@ class FirestoreDataTable extends StatefulWidget { columnLabels is LinkedHashMap, 'only LinkedHashMap are supported as header', ), - dataRowMinHeight = - dataRowHeight ?? dataRowMinHeight ?? kMinInteractiveDimension, - dataRowMaxHeight = - dataRowHeight ?? dataRowMaxHeight ?? kMinInteractiveDimension; + dataRowMinHeight = dataRowMinHeight ?? kMinInteractiveDimension, + dataRowMaxHeight = dataRowMaxHeight ?? kMinInteractiveDimension; /// When specified, the builder will be used to display your own widget for the cell final CellBuilder? cellBuilder; diff --git a/packages/firebase_ui_firestore/pubspec.yaml b/packages/firebase_ui_firestore/pubspec.yaml index 854eac40..683831e4 100644 --- a/packages/firebase_ui_firestore/pubspec.yaml +++ b/packages/firebase_ui_firestore/pubspec.yaml @@ -8,7 +8,7 @@ environment: flutter: ">=3.3.0" dependencies: - cloud_firestore: ^5.6.12 + cloud_firestore: ^6.0.0 firebase_ui_localizations: ^1.14.1 firebase_ui_shared: ^1.4.1 flutter: diff --git a/packages/firebase_ui_localizations/example/pubspec.yaml b/packages/firebase_ui_localizations/example/pubspec.yaml index e3b880a4..e8201412 100644 --- a/packages/firebase_ui_localizations/example/pubspec.yaml +++ b/packages/firebase_ui_localizations/example/pubspec.yaml @@ -31,7 +31,7 @@ environment: dependencies: cupertino_icons: ^1.0.6 - firebase_core: ^3.15.2 + firebase_core: ^4.0.0 firebase_ui_auth: ^2.0.0 firebase_ui_localizations: ^1.14.1 flutter: diff --git a/packages/firebase_ui_oauth/example/pubspec.yaml b/packages/firebase_ui_oauth/example/pubspec.yaml index 33db1f74..69cd2ac2 100644 --- a/packages/firebase_ui_oauth/example/pubspec.yaml +++ b/packages/firebase_ui_oauth/example/pubspec.yaml @@ -33,8 +33,8 @@ dependencies: # The following adds the Cupertino Icons font to your application. # Use with the CupertinoIcons class for iOS style icons. cupertino_icons: ^1.0.6 - firebase_auth: ^5.7.0 - firebase_core: ^3.15.2 + firebase_auth: ^6.0.0 + firebase_core: ^4.0.0 firebase_ui_oauth: ^1.7.1 firebase_ui_oauth_apple: ^1.3.3 firebase_ui_oauth_facebook: ^1.3.3 diff --git a/packages/firebase_ui_oauth/lib/src/oauth_provider_button_base.dart b/packages/firebase_ui_oauth/lib/src/oauth_provider_button_base.dart index c303d414..c12d5795 100644 --- a/packages/firebase_ui_oauth/lib/src/oauth_provider_button_base.dart +++ b/packages/firebase_ui_oauth/lib/src/oauth_provider_button_base.dart @@ -304,13 +304,6 @@ class _OAuthProviderButtonBaseState extends State startMFAVerification(context: context, resolver: resolver); } - @override - void onBeforeProvidersForEmailFetch() { - safeSetState(() { - isLoading = true; - }); - } - @override void onBeforeSignIn() { safeSetState(() { @@ -325,15 +318,6 @@ class _OAuthProviderButtonBaseState extends State }); } - @override - void onDifferentProvidersFound( - String email, - List providers, - fba.AuthCredential? credential, - ) { - widget.onDifferentProvidersFound?.call(providers, credential); - } - @override void onSignedIn(fba.UserCredential credential) { safeSetState(() { diff --git a/packages/firebase_ui_oauth/pubspec.yaml b/packages/firebase_ui_oauth/pubspec.yaml index d4030669..76b99ddc 100644 --- a/packages/firebase_ui_oauth/pubspec.yaml +++ b/packages/firebase_ui_oauth/pubspec.yaml @@ -9,7 +9,7 @@ environment: dependencies: desktop_webview_auth: ^0.0.14 - firebase_auth: ^5.7.0 + firebase_auth: ^6.0.0 firebase_ui_auth: ^2.0.0 firebase_ui_shared: ^1.4.1 flutter_svg: ^2.0.9 diff --git a/packages/firebase_ui_oauth_apple/pubspec.yaml b/packages/firebase_ui_oauth_apple/pubspec.yaml index 9665e1e2..25f1f438 100644 --- a/packages/firebase_ui_oauth_apple/pubspec.yaml +++ b/packages/firebase_ui_oauth_apple/pubspec.yaml @@ -8,7 +8,7 @@ environment: flutter: ">=3.3.0" dependencies: - firebase_auth: ^5.7.0 + firebase_auth: ^6.0.0 firebase_ui_oauth: ^1.7.1 flutter: sdk: flutter diff --git a/packages/firebase_ui_oauth_facebook/pubspec.yaml b/packages/firebase_ui_oauth_facebook/pubspec.yaml index 5f2e7e81..a5348c82 100644 --- a/packages/firebase_ui_oauth_facebook/pubspec.yaml +++ b/packages/firebase_ui_oauth_facebook/pubspec.yaml @@ -8,7 +8,7 @@ environment: flutter: ">=3.3.0" dependencies: - firebase_auth: ^5.7.0 + firebase_auth: ^6.0.0 firebase_ui_oauth: ^1.7.1 flutter: sdk: flutter diff --git a/packages/firebase_ui_oauth_google/pubspec.yaml b/packages/firebase_ui_oauth_google/pubspec.yaml index b4c87ac7..792ba245 100644 --- a/packages/firebase_ui_oauth_google/pubspec.yaml +++ b/packages/firebase_ui_oauth_google/pubspec.yaml @@ -8,7 +8,7 @@ environment: flutter: ">=3.3.0" dependencies: - firebase_auth: ^5.7.0 + firebase_auth: ^6.0.0 firebase_ui_oauth: ^1.7.1 flutter: sdk: flutter diff --git a/packages/firebase_ui_oauth_twitter/pubspec.yaml b/packages/firebase_ui_oauth_twitter/pubspec.yaml index 1b5faddb..071340f9 100644 --- a/packages/firebase_ui_oauth_twitter/pubspec.yaml +++ b/packages/firebase_ui_oauth_twitter/pubspec.yaml @@ -10,7 +10,7 @@ environment: dependencies: flutter: sdk: flutter - firebase_auth: ^5.7.0 + firebase_auth: ^6.0.0 firebase_ui_oauth: ^1.7.1 twitter_login: ^4.4.2 diff --git a/packages/firebase_ui_storage/example/pubspec.yaml b/packages/firebase_ui_storage/example/pubspec.yaml index 558e5f86..94e311f7 100644 --- a/packages/firebase_ui_storage/example/pubspec.yaml +++ b/packages/firebase_ui_storage/example/pubspec.yaml @@ -9,8 +9,8 @@ environment: dependencies: cupertino_icons: ^1.0.6 file_picker: ^6.1.1 - firebase_core: ^3.15.2 - firebase_storage: ^12.4.10 + firebase_core: ^4.0.0 + firebase_storage: ^13.0.0 firebase_ui_storage: ^2.1.3 firebase_ui_shared: ^1.4.1 diff --git a/packages/firebase_ui_storage/pubspec.yaml b/packages/firebase_ui_storage/pubspec.yaml index 75487c8a..e28f45bd 100644 --- a/packages/firebase_ui_storage/pubspec.yaml +++ b/packages/firebase_ui_storage/pubspec.yaml @@ -13,7 +13,7 @@ false_secrets: dependencies: flutter: sdk: flutter - firebase_storage: ^12.4.10 + firebase_storage: ^13.0.0 firebase_ui_localizations: ^1.14.1 firebase_ui_shared: ^1.4.1 path: ^1.8.3 diff --git a/tests/integration_test/firebase_ui_auth/firebase_ui_auth_e2e.dart b/tests/integration_test/firebase_ui_auth/firebase_ui_auth_e2e.dart index 542e86d1..22c8e648 100644 --- a/tests/integration_test/firebase_ui_auth/firebase_ui_auth_e2e.dart +++ b/tests/integration_test/firebase_ui_auth/firebase_ui_auth_e2e.dart @@ -7,8 +7,7 @@ import 'package:flutter_test/flutter_test.dart'; import 'email_form_test.dart' as email_form; import 'email_link_sign_in_view_test.dart' as email_link_sign_in_view; -import 'universal_email_sign_in_screen_test.dart' - as universal_email_sign_in_screen; + import 'phone_verification_test.dart' as phone_verification; import 'layout_test.dart' as layout; import 'actions_test.dart' as actions; @@ -17,7 +16,6 @@ Future main() async { group('Auth', () { email_form.main(); email_link_sign_in_view.main(); - universal_email_sign_in_screen.main(); actions.main(); switch (defaultTargetPlatform) { diff --git a/tests/integration_test/firebase_ui_auth/universal_email_sign_in_screen_test.dart b/tests/integration_test/firebase_ui_auth/universal_email_sign_in_screen_test.dart deleted file mode 100644 index ac938c04..00000000 --- a/tests/integration_test/firebase_ui_auth/universal_email_sign_in_screen_test.dart +++ /dev/null @@ -1,126 +0,0 @@ -// Copyright 2022, the Chromium project authors. Please see the AUTHORS file -// for details. All rights reserved. Use of this source code is governed by a -// BSD-style license that can be found in the LICENSE file. - -// ignore_for_file: deprecated_member_use - -import 'package:firebase_auth/firebase_auth.dart' as fba; -import 'package:firebase_core/firebase_core.dart'; -import 'package:flutter/foundation.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter_test/flutter_test.dart'; -import 'package:firebase_ui_auth/firebase_ui_auth.dart'; -import 'package:firebase_ui_localizations/firebase_ui_localizations.dart'; -import 'package:firebase_ui_oauth_google/firebase_ui_oauth_google.dart'; -import 'package:mockito/mockito.dart'; - -import '../utils.dart'; - -void main() { - const labels = DefaultLocalizations(); - - group('UniversalEmailSignInScreen', () { - testWidgets('validates email', (tester) async { - await render( - tester, - UniversalEmailSignInScreen( - providers: [ - EmailAuthProvider(), - PhoneAuthProvider(), - GoogleProvider(clientId: 'test-client-id'), - ], - ), - ); - - await tester.pump(); - - final input = find.byType(TextField); - expect(input, findsOneWidget); - - await tester.enterText(input, 'notavalidemail'); - await tester.testTextInput.receiveAction(TextInputAction.done); - - await tester.pumpAndSettle(); - - expect(find.text(labels.isNotAValidEmailErrorText), findsOneWidget); - }); - - testWidgets('shows RegisterScreen if no providers found', (tester) async { - await render( - tester, - UniversalEmailSignInScreen( - providers: [ - EmailAuthProvider(), - PhoneAuthProvider(), - GoogleProvider(clientId: 'test-client-id'), - ], - ), - ); - - await tester.pump(); - - final input = find.byType(TextField); - expect(input, findsOneWidget); - - await tester.enterText(input, 'test@test.com'); - await tester.testTextInput.receiveAction(TextInputAction.done); - - await tester.pumpAndSettle(); - - expect(find.byType(RegisterScreen), findsOneWidget); - }); - - testWidgets('shows SignInScreen with only available providers', - (tester) async { - await render( - tester, - UniversalEmailSignInScreen( - auth: MockAuth(), - providers: [ - EmailAuthProvider(), - PhoneAuthProvider(), - GoogleProvider(clientId: 'test-client-id'), - ], - ), - ); - - await tester.pump(); - - final input = find.byType(TextField); - expect(input, findsOneWidget); - - await tester.enterText(input, 'test@test.com'); - await tester.testTextInput.receiveAction(TextInputAction.done); - - await tester.pumpAndSettle(); - - expect(find.byType(SignInScreen), findsOneWidget); - - if (PhoneAuthProvider().supportsPlatform(defaultTargetPlatform)) { - expect(find.text(labels.signInWithPhoneButtonText), findsOneWidget); - } - expect(find.text(labels.signInWithGoogleButtonText), findsOneWidget); - expect(find.byType(EmailForm), findsNothing); - }); - }); -} - -// ignore: avoid_implementing_value_types -class MockApp extends Mock implements FirebaseApp {} - -class MockAuth extends Mock implements fba.FirebaseAuth { - @override - FirebaseApp get app => MockApp(); - - @override - Future> fetchSignInMethodsForEmail(String? email) async { - return super.noSuchMethod( - Invocation.method( - #fetchSignInMethodsForEmail, - [email], - ), - returnValue: ['phone', 'google.com'], - returnValueForMissingStub: ['phone', 'google.com'], - ); - } -} diff --git a/tests/ios/Podfile b/tests/ios/Podfile index db255869..7894e409 100644 --- a/tests/ios/Podfile +++ b/tests/ios/Podfile @@ -1,4 +1,4 @@ -platform :ios, '13.0' +platform :ios, '15.0' # CocoaPods analytics sends network stats synchronously affecting flutter build latency. ENV['COCOAPODS_DISABLE_STATS'] = 'true' @@ -29,7 +29,7 @@ flutter_ios_podfile_setup target 'Runner' do use_frameworks! use_modular_headers! - pod 'FirebaseFirestore', :git => 'https://github.com/invertase/firestore-ios-sdk-frameworks.git', :tag => '11.15.0' + pod 'FirebaseFirestore', :git => 'https://github.com/invertase/firestore-ios-sdk-frameworks.git', :tag => '12.0.0' flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__)) target 'RunnerTests' do diff --git a/tests/macos/Podfile b/tests/macos/Podfile index 0f8105e0..8c08cf5f 100644 --- a/tests/macos/Podfile +++ b/tests/macos/Podfile @@ -30,7 +30,7 @@ target 'Runner' do use_frameworks! use_modular_headers! - pod 'FirebaseFirestore', :git => 'https://github.com/invertase/firestore-ios-sdk-frameworks.git', :tag => '11.15.0' + pod 'FirebaseFirestore', :git => 'https://github.com/invertase/firestore-ios-sdk-frameworks.git', :tag => '12.0.0' flutter_install_all_macos_pods File.dirname(File.realpath(__FILE__)) target 'RunnerTests' do diff --git a/tests/pubspec.yaml b/tests/pubspec.yaml index 039a1b06..373d02b1 100644 --- a/tests/pubspec.yaml +++ b/tests/pubspec.yaml @@ -10,8 +10,8 @@ dependencies: flutter: sdk: flutter cupertino_icons: ^1.0.6 - firebase_auth: ^5.7.0 - firebase_core: ^3.15.2 + firebase_auth: ^6.0.0 + firebase_core: ^4.0.0 firebase_ui_auth: ^2.0.0 firebase_ui_localizations: ^1.14.1 firebase_ui_oauth_apple: ^1.3.3 @@ -21,12 +21,12 @@ dependencies: flutter_facebook_auth: ^6.0.3 twitter_login: ^4.4.2 firebase_ui_oauth_twitter: ^1.3.3 - cloud_firestore: ^5.6.12 + cloud_firestore: ^6.0.0 firebase_ui_firestore: ^1.7.3 http: ^1.1.2 google_sign_in: ^6.2.1 firebase_ui_shared: ^1.4.1 - firebase_database: ^11.3.10 + firebase_database: ^12.0.0 firebase_ui_database: ^1.5.3 dev_dependencies: