Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions packages/firebase_ui_auth/example/lib/decorations.dart
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,7 @@ SideBuilder sideIcon(IconData icon) {
return (context, constraints) {
return Padding(
padding: const EdgeInsets.all(20),
child: Icon(
icon,
color: Colors.blue,
size: constraints.maxWidth / 3,
),
child: Icon(icon, color: Colors.blue, size: constraints.maxWidth / 3),
);
};
}
38 changes: 18 additions & 20 deletions packages/firebase_ui_auth/example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -85,18 +85,16 @@ class FirebaseAuthUIExample extends StatelessWidget {
),
);

final mfaAction = AuthStateChangeAction<MFARequired>(
(context, state) async {
final nav = Navigator.of(context);
final mfaAction = AuthStateChangeAction<MFARequired>((
context,
state,
) async {
final nav = Navigator.of(context);

await startMFAVerification(
resolver: state.resolver,
context: context,
);
await startMFAVerification(resolver: state.resolver, context: context);

nav.pushReplacementNamed('/profile');
},
);
nav.pushReplacementNamed('/profile');
});

return MaterialApp(
theme: ThemeData(
Expand Down Expand Up @@ -224,14 +222,15 @@ class FirebaseAuthUIExample extends StatelessWidget {
);
},
'/sms': (context) {
final arguments = ModalRoute.of(context)?.settings.arguments
as Map<String, dynamic>?;
final arguments =
ModalRoute.of(context)?.settings.arguments
as Map<String, dynamic>?;

return SMSCodeInputScreen(
actions: [
AuthStateChangeAction<SignedIn>((context, state) {
Navigator.of(context).pushReplacementNamed('/profile');
})
}),
],
flowKey: arguments?['flowKey'],
action: arguments?['action'],
Expand All @@ -240,8 +239,9 @@ class FirebaseAuthUIExample extends StatelessWidget {
);
},
'/forgot-password': (context) {
final arguments = ModalRoute.of(context)?.settings.arguments
as Map<String, dynamic>?;
final arguments =
ModalRoute.of(context)?.settings.arguments
as Map<String, dynamic>?;

return ForgotPasswordScreen(
email: arguments?['email'],
Expand Down Expand Up @@ -274,7 +274,8 @@ class FirebaseAuthUIExample extends StatelessWidget {
mfaAction,
],
actionCodeSettings: actionCodeSettings,
showMFATile: kIsWeb ||
showMFATile:
kIsWeb ||
platform == TargetPlatform.iOS ||
platform == TargetPlatform.android,
showUnlinkConfirmationDialog: true,
Expand Down Expand Up @@ -375,10 +376,7 @@ class _AppTrackingTransparencyCardState
children: [
const Text('App tracking allowed'),
const SizedBox(width: 12),
Switch(
value: _isAllowed,
onChanged: _onToggleChanged,
),
Switch(value: _isAllowed, onChanged: _onToggleChanged),
],
),
);
Expand Down
2 changes: 1 addition & 1 deletion packages/firebase_ui_auth/example/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ publish_to: "none" # Remove this line if you wish to publish to pub.dev
version: 1.0.0+1

environment:
sdk: ^3.5.0
sdk: ^3.9.0

resolution: workspace

Expand Down
7 changes: 2 additions & 5 deletions packages/firebase_ui_auth/lib/src/actions.dart
Original file line number Diff line number Diff line change
Expand Up @@ -103,11 +103,8 @@ class AccountDeletedAction extends FirebaseUIAction {
/// {@endtemplate}
class DisplayNameChangedAction extends FirebaseUIAction {
/// A callback that is being called when user has changed their display name.
final void Function(
BuildContext context,
String? oldName,
String newName,
) callback;
final void Function(BuildContext context, String? oldName, String newName)
callback;

/// {@macro ui.auth.actions.display_name_changed}
DisplayNameChangedAction(this.callback);
Expand Down
8 changes: 4 additions & 4 deletions packages/firebase_ui_auth/lib/src/auth_flow.dart
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,10 @@ class AuthFlow<T extends AuthProvider> extends ValueNotifier<AuthState>

/// {@macro ui.auth.auth_action}
AuthAction? action,
}) : auth = auth ?? fba.FirebaseAuth.instance,
_action = action,
_provider = provider,
super(initialState) {
}) : auth = auth ?? fba.FirebaseAuth.instance,
_action = action,
_provider = provider,
super(initialState) {
_provider.authListener = this;
_provider.auth = auth ?? fba.FirebaseAuth.instance;
}
Expand Down
7 changes: 2 additions & 5 deletions packages/firebase_ui_auth/lib/src/auth_state.dart
Original file line number Diff line number Diff line change
Expand Up @@ -199,11 +199,8 @@ class AuthStateTransition<T extends AuthController> extends Notification {
AuthStateTransition(this.from, this.to, this.controller);
}

typedef AuthStateListenerCallback<T extends AuthController> = bool? Function(
AuthState oldState,
AuthState state,
T controller,
);
typedef AuthStateListenerCallback<T extends AuthController> =
bool? Function(AuthState oldState, AuthState state, T controller);

/// {@template ui.auth.auth_state.auth_state_listener}
/// A [Widget] that could be used to listen auth state transitions.
Expand Down
10 changes: 5 additions & 5 deletions packages/firebase_ui_auth/lib/src/configs/countries.dart
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ final countries = [
{
'name': 'Democratic Republic of the Congo',
'phoneCode': '243',
'countryCode': 'CD'
'countryCode': 'CD',
},
{'name': 'Denmark', 'phoneCode': '45', 'countryCode': 'DK'},
{'name': 'Djibouti', 'phoneCode': '253', 'countryCode': 'DJ'},
Expand Down Expand Up @@ -166,12 +166,12 @@ final countries = [
{
'name': 'Saint Pierre and Miquelon',
'phoneCode': '508',
'countryCode': 'PM'
'countryCode': 'PM',
},
{
'name': 'Saint Vincent and the Grenadines',
'phoneCode': '1-784',
'countryCode': 'VC'
'countryCode': 'VC',
},
{'name': 'Samoa', 'phoneCode': '685', 'countryCode': 'WS'},
{'name': 'Sao Tome and Principe', 'phoneCode': '239', 'countryCode': 'ST'},
Expand Down Expand Up @@ -202,7 +202,7 @@ final countries = [
{
'name': 'Turks and Caicos Islands',
'phoneCode': '1-649',
'countryCode': 'TC'
'countryCode': 'TC',
},
{'name': 'U.S. Virgin Islands', 'phoneCode': '1-340', 'countryCode': 'VI'},
{'name': 'Uganda', 'phoneCode': '256', 'countryCode': 'UG'},
Expand All @@ -216,7 +216,7 @@ final countries = [
{'name': 'Vietnam', 'phoneCode': '84', 'countryCode': 'VN'},
{'name': 'Yemen', 'phoneCode': '967', 'countryCode': 'YE'},
{'name': 'Zambia', 'phoneCode': '260', 'countryCode': 'ZM'},
{'name': 'Zimbabwe', 'phoneCode': '263', 'countryCode': 'ZW'}
{'name': 'Zimbabwe', 'phoneCode': '263', 'countryCode': 'ZW'},
].map(_CountryCodeItem.fromJson);

final countriesByCountryCode = countries.fold<Map<String, _CountryCodeItem>>(
Expand Down
4 changes: 2 additions & 2 deletions packages/firebase_ui_auth/lib/src/email_verification.dart
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ class EmailVerificationController extends ValueNotifier<EmailVerificationState>
StreamSubscription<Uri>? _linkSubscription;

EmailVerificationController(this.auth, {AppLinks? appLinks})
: _appLinks = appLinks ?? AppLinks(),
super(EmailVerificationState.unresolved) {
: _appLinks = appLinks ?? AppLinks(),
super(EmailVerificationState.unresolved) {
final user = auth.currentUser;

if (user != null) {
Expand Down
5 changes: 1 addition & 4 deletions packages/firebase_ui_auth/lib/src/flows/email_flow.dart
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,7 @@ class EmailAuthFlow extends AuthFlow<EmailAuthProvider>

/// {@macro ui.auth.auth_action}
super.action,
}) : super(
initialState: AwaitingEmailAndPassword(),
provider: provider,
);
}) : super(initialState: AwaitingEmailAndPassword(), provider: provider);

@override
void onBeforeSignIn() {
Expand Down
5 changes: 1 addition & 4 deletions packages/firebase_ui_auth/lib/src/flows/email_link_flow.dart
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,7 @@ class EmailLinkFlow extends AuthFlow<EmailLinkAuthProvider>

/// {@macro ui.auth.auth_flow.ctor.provider}
required super.provider,
}) : super(
action: AuthAction.signIn,
initialState: const Uninitialized(),
);
}) : super(action: AuthAction.signIn, initialState: const Uninitialized());

@override
void sendLink(String email) {
Expand Down
4 changes: 1 addition & 3 deletions packages/firebase_ui_auth/lib/src/flows/oauth_flow.dart
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,7 @@ class OAuthFlow extends AuthFlow<OAuthProvider>

/// {@macro ui.auth.auth_controller.auth}
super.auth,
}) : super(
initialState: const Uninitialized(),
);
}) : super(initialState: const Uninitialized());

@override
void signIn(TargetPlatform platform) {
Expand Down
13 changes: 4 additions & 9 deletions packages/firebase_ui_auth/lib/src/flows/phone_auth_flow.dart
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,7 @@ class SMSCodeSent extends AuthState {
fba.ConfirmationResult? confirmationResult;

/// {@macro ui.auth.flows.phone_auth_flow}
SMSCodeSent({
this.verificationId,
this.resendToken,
this.confirmationResult,
});
SMSCodeSent({this.verificationId, this.resendToken, this.confirmationResult});
}

/// {@template ui.auth.flows.autoresolution_failed_exception}
Expand Down Expand Up @@ -112,9 +108,7 @@ class PhoneAuthFlow extends AuthFlow<PhoneAuthProvider>

/// {@macro ui.auth.auth_action}
super.action,
}) : super(
initialState: AwaitingPhoneNumber(),
);
}) : super(initialState: AwaitingPhoneNumber());

@override
void acceptPhoneNumber(
Expand Down Expand Up @@ -221,7 +215,8 @@ class SMSCodeRequestedAction extends FirebaseUIAction {
AuthAction? action,
Object flowKey,
String phoneNumber,
) callback;
)
callback;

/// {@macro ui.auth.flows.phone_auth_flow.sms_code_requested_action}
SMSCodeRequestedAction(this.callback);
Expand Down
18 changes: 8 additions & 10 deletions packages/firebase_ui_auth/lib/src/mfa.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,13 @@ import 'package:firebase_ui_auth/src/widgets/internal/universal_page_route.dart'
import 'package:flutter/scheduler.dart';
import 'package:flutter/widgets.dart';

typedef SMSCodeInputScreenBuilder = Widget Function(
BuildContext context,
List<FirebaseUIAction> actions,
Object flowKey,
AuthAction action,
);
typedef SMSCodeInputScreenBuilder =
Widget Function(
BuildContext context,
List<FirebaseUIAction> actions,
Object flowKey,
AuthAction action,
);

Future<fba.UserCredential> startMFAVerification({
required BuildContext context,
Expand Down Expand Up @@ -105,10 +106,7 @@ Future<fba.UserCredential> startPhoneMFAVerification({
);
}

final pageRoute = createPageRoute(
context: context,
builder: builder,
);
final pageRoute = createPageRoute(context: context, builder: builder);

navigator.push(pageRoute);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ Future<bool> showReauthenticateDialog({
context: context,
barrierDismissible: true,
barrierLabel: l.cancelButtonLabel,
pageBuilder: (_, __, ___) => FirebaseUIActions.inherit(
pageBuilder: (_, _, _) => FirebaseUIActions.inherit(
from: context,
child: ReauthenticateDialog(
providers: providers,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,10 @@ abstract class AuthListener {
/// An interface that all auth providers should implement.
/// Contains shared authentication logic.
/// {@endtemplate}
abstract class AuthProvider<T extends AuthListener,
K extends fba.AuthCredential> {
abstract class AuthProvider<
T extends AuthListener,
K extends fba.AuthCredential
> {
/// {@macro ui.auth.auth_controller.auth}
late fba.FirebaseAuth auth;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,9 @@ class EmailAuthProvider
String password, [
AuthAction action = AuthAction.signIn,
]) {
final credential = fba.EmailAuthProvider.credential(
email: email,
password: password,
) as fba.EmailAuthCredential;
final credential =
fba.EmailAuthProvider.credential(email: email, password: password)
as fba.EmailAuthCredential;

onCredentialReceived(credential, action);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,15 +100,18 @@ class PhoneAuthProvider
);
onCredentialReceived(credential, action);
} else {
confirmationResult!.confirm(code).then((userCredential) {
if (action == AuthAction.link) {
authListener.onCredentialLinked(userCredential.credential!);
} else {
authListener.onSignedIn(userCredential);
}
}).catchError((err) {
authListener.onError(err);
});
confirmationResult!
.confirm(code)
.then((userCredential) {
if (action == AuthAction.link) {
authListener.onCredentialLinked(userCredential.credential!);
} else {
authListener.onSignedIn(userCredential);
}
})
.catchError((err) {
authListener.onError(err);
});
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,17 +71,11 @@ class EmailLinkSignInScreen extends ProviderScreen<EmailLinkAuthProvider> {
desktopLayoutDirection: desktopLayoutDirection,
child: Padding(
padding: const EdgeInsets.all(32),
child: EmailLinkSignInView(
auth: auth,
provider: provider,
),
child: EmailLinkSignInView(auth: auth, provider: provider),
),
),
);

return FirebaseUIActions(
actions: actions ?? const [],
child: child,
);
return FirebaseUIActions(actions: actions ?? const [], child: child);
}
}
Loading
Loading