Skip to content

refactor(auth)!: remove deprecated API ahead of breaking change release #12859

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 31, 2024
Merged
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
54 changes: 0 additions & 54 deletions packages/firebase_auth/firebase_auth/lib/src/firebase_auth.dart
Original file line number Diff line number Diff line change
Expand Up @@ -74,47 +74,6 @@ class FirebaseAuth extends FirebasePluginPlatform {
return _delegate.languageCode;
}

/// Changes this instance to point to an Auth emulator running locally.
///
/// Set the [origin] of the local emulator, such as "http://localhost:9099"
///
/// Note: Must be called immediately, prior to accessing auth methods.
/// Do not use with production credentials as emulator traffic is not encrypted.
///
/// Note: auth emulator is not supported for web yet. firebase-js-sdk does not support
/// auth.useEmulator until v8.2.4, but FlutterFire does not support firebase-js-sdk v8+ yet
@Deprecated(
'Will be removed in future release. '
'Use useAuthEmulator().',
)
Future<void> useEmulator(String origin) async {
assert(origin.isNotEmpty);
String mappedOrigin = origin;

// Android considers localhost as 10.0.2.2 - automatically handle this for users.
if (defaultTargetPlatform == TargetPlatform.android && !kIsWeb) {
if (mappedOrigin.startsWith('http://localhost')) {
mappedOrigin =
mappedOrigin.replaceFirst('http://localhost', 'http://10.0.2.2');
} else if (mappedOrigin.startsWith('http://127.0.0.1')) {
mappedOrigin =
mappedOrigin.replaceFirst('http://127.0.0.1', 'http://10.0.2.2');
}
}

// Native calls take the host and port split out
final hostPortRegex = RegExp(r'^http:\/\/([\w\d.]+):(\d+)$');
final RegExpMatch? match = hostPortRegex.firstMatch(mappedOrigin);
if (match == null) {
throw ArgumentError('firebase.auth().useEmulator() origin format error');
}
// Two non-empty groups in RegExp match - which is null-tested - these are non-null now
final String host = match.group(1)!;
final int port = int.parse(match.group(2)!);

await useAuthEmulator(host, port);
}

/// Changes this instance to point to an Auth emulator running locally.
///
/// Set the [host] of the local emulator, such as "localhost"
Expand Down Expand Up @@ -646,19 +605,6 @@ class FirebaseAuth extends FirebasePluginPlatform {
}
}

/// Signs in with an AuthProvider using native authentication flow. This is
/// deprecated in favor of `signInWithProvider()`.
///
/// A [FirebaseAuthException] maybe thrown with the following error code:
/// - **user-disabled**:
/// - Thrown if the user corresponding to the given email has been disabled.
@Deprecated('You should use signInWithProvider instead')
Future<UserCredential> signInWithAuthProvider(
AuthProvider provider,
) async {
return signInWithProvider(provider);
}

/// Signs in with an AuthProvider using native authentication flow.
///
/// A [FirebaseAuthException] maybe thrown with the following error code:
Expand Down
4 changes: 0 additions & 4 deletions packages/firebase_auth/firebase_auth/lib/src/user.dart
Original file line number Diff line number Diff line change
Expand Up @@ -641,10 +641,6 @@ class User {
}

/// Updates a user's profile data.
@Deprecated(
'Will be removed in version 2.0.0. '
'Use updatePhotoURL and updateDisplayName instead.',
)
Future<void> updateProfile({String? displayName, String? photoURL}) {
return _delegate.updateProfile(<String, String?>{
'displayName': displayName,
Expand Down
Loading