Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
79 commits
Select commit Hold shift + click to select a range
ce9e8cf
feat(auth): move to Pigeon for Platform channels
Lyokone Apr 17, 2023
7e8b5f9
feat(auth): move to Pigeon for Platform channels
Lyokone Apr 20, 2023
17ce2af
feat(auth): move to Pigeon for Platform channels
Lyokone Apr 20, 2023
d8a4ab2
feat(auth): move to Pigeon for Platform channels
Lyokone Apr 20, 2023
eb0d9bd
feat(auth): move to Pigeon for Platform channels
Lyokone Apr 20, 2023
fb53ffc
feat(auth): move to Pigeon for Platform channels
Lyokone Apr 20, 2023
5bb2b0c
feat(auth): move to Pigeon for Platform channels
Lyokone Apr 20, 2023
10735d5
feat(auth): move to Pigeon for Platform channels
Lyokone Apr 20, 2023
19f9125
feat(auth): move to Pigeon for Platform channels
Lyokone Apr 20, 2023
187cf8d
feat(auth): move to Pigeon for Platform channels
Lyokone Apr 20, 2023
5aa7dd2
feat(auth): move to Pigeon for Platform channels
Lyokone Apr 20, 2023
5ceed08
feat(auth): move to Pigeon for Platform channels
Lyokone Apr 21, 2023
cecb05c
feat(auth): move to Pigeon for Platform channels
Lyokone Apr 21, 2023
77470c2
feat(auth): move to Pigeon for Platform channels
Lyokone Apr 21, 2023
456c2f9
feat(auth): move to Pigeon for Platform channels
Lyokone Apr 21, 2023
5c9fb61
feat(auth): move to Pigeon for Platform channels END Auth
Lyokone Apr 21, 2023
1855736
feat(auth): move to Pigeon for Platform channels START user
Lyokone Apr 21, 2023
fed08b6
feat(auth): move to Pigeon for Platform channels
Lyokone Apr 21, 2023
27a99a2
feat(auth): move to Pigeon for Platform channels
Lyokone Apr 21, 2023
a67334e
feat(auth): move to Pigeon for Platform channels
Lyokone Apr 21, 2023
50a0493
feat(auth): move to Pigeon for Platform channels
Lyokone Apr 21, 2023
ee79965
feat(auth): move to Pigeon for Platform channels
Lyokone Apr 21, 2023
e606958
feat(auth): move to Pigeon for Platform channels
Lyokone Apr 24, 2023
73cd3f2
feat(auth): move to Pigeon for Platform channels
Lyokone Apr 24, 2023
e9663ce
feat(auth): move to Pigeon for Platform channels
Lyokone Apr 24, 2023
277b3e8
feat(auth): move to Pigeon for Platform channels
Lyokone Apr 24, 2023
861abd1
feat(auth): move to Pigeon for Platform channels
Lyokone Apr 24, 2023
12ad2bd
feat(auth): move to Pigeon for Platform channels
Lyokone Apr 24, 2023
6d63edb
feat: start objc
Lyokone Apr 27, 2023
daf53c0
feat: ios
Lyokone May 2, 2023
332cb5a
feat: ios
Lyokone May 2, 2023
6e94847
feat: ios
Lyokone May 2, 2023
579d062
feat: ios
Lyokone May 2, 2023
55942ae
feat: ios
Lyokone May 3, 2023
1dfc864
feat: ios
Lyokone May 3, 2023
a0c5b7e
feat: ios
Lyokone May 3, 2023
4c875e6
feat: ios
Lyokone May 4, 2023
90aeae4
feat: ios
Lyokone May 4, 2023
3e0548f
feat: ios
Lyokone May 9, 2023
52d4488
feat: ios done
Lyokone May 9, 2023
bbc6df0
feat: ios done
Lyokone May 9, 2023
3c32439
merge master
Lyokone May 9, 2023
5e92bba
remove test code from demo
Lyokone May 9, 2023
c1c62a8
fix codes
Lyokone May 10, 2023
dab3992
fix codes
Lyokone May 10, 2023
15dbbcc
fix codes
Lyokone May 10, 2023
983dfe4
feat: update web
Lyokone May 11, 2023
fc4e6ac
feat: update tests
Lyokone May 11, 2023
d98fe76
Merge branch 'master' into feat/pigeon-auth
Lyokone May 15, 2023
c88de08
fix tests
Lyokone May 16, 2023
aff9125
Merge branch 'master' of https://github.com/firebase/flutterfire into…
Lyokone May 17, 2023
993073d
add licence
Lyokone May 17, 2023
616370e
fix analyze
Lyokone May 17, 2023
66af294
fix analyze
Lyokone May 17, 2023
76a88da
fix pod projects
Lyokone May 17, 2023
05c57ba
fix macos
Lyokone May 17, 2023
5fb6ff5
fix macos
Lyokone May 17, 2023
d43ea95
fix format
Lyokone May 17, 2023
a1fae45
fix ci
Lyokone May 17, 2023
0b72b60
remove useless file
Lyokone May 17, 2023
9aa06d6
fix ios crash
Lyokone May 17, 2023
8e0dded
swift 5.6
Lyokone May 17, 2023
7e239f1
fix tests
Lyokone May 22, 2023
c63cbed
fix tests
Lyokone May 22, 2023
2210890
fix tests
Lyokone May 22, 2023
4b460d9
fix tests
Lyokone May 22, 2023
2f8fd85
fix tests
Lyokone May 22, 2023
ae5dbad
fix ci
Lyokone May 22, 2023
7d2b1c9
fix ci
Lyokone May 22, 2023
719a21d
fix android
Lyokone May 23, 2023
1b5ed85
fix format
Lyokone May 23, 2023
a83fba5
fix format
Lyokone May 23, 2023
5311882
XL runner??
Lyokone May 23, 2023
785bc31
Merge branch 'master' of https://github.com/firebase/flutterfire into…
Lyokone May 23, 2023
02d7b5e
Update packages/firebase_auth/firebase_auth/android/src/main/java/io/…
Lyokone Jun 5, 2023
6b9d984
Update packages/firebase_auth/firebase_auth/ios/Classes/FLTFirebaseAu…
Lyokone Jun 5, 2023
887cc72
remove useless code and apply suggestions from review
Lyokone Jun 6, 2023
6894958
remove useless code and apply suggestions from review
Lyokone Jun 6, 2023
923811a
Merge remote-tracking branch 'origin/master' into feat/pigeon-auth
Lyokone Jul 10, 2023
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
Prev Previous commit
Next Next commit
feat: update tests
  • Loading branch information
Lyokone committed May 11, 2023
commit fc4e6ac2374ffbefdcdf0a14b26fef1649de48c3
23 changes: 23 additions & 0 deletions packages/firebase_auth/firebase_auth/lib/src/user.dart
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,17 @@ class User {
return _delegate.email;
}

/// Returns whether the users email address has been verified.
///
/// To send a verification email, see [sendEmailVerification].
///
/// Once verified, call [reload] to ensure the latest user information is
/// retrieved from Firebase.
@Deprecated('Use isEmailVerified instead')
bool get emailVerified {
return _delegate.isEmailVerified;
}

/// Returns whether the users email address has been verified.
///
/// To send a verification email, see [sendEmailVerification].
Expand Down Expand Up @@ -638,6 +649,18 @@ class User {
return _delegate.updateProfile(<String, String?>{'photoURL': photoURL});
}

/// 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,
'photoURL': photoURL,
});
}

/// Sends a verification email to a new email address. The user's email will
/// be updated to the new one after being verified.
///
Expand Down
49 changes: 27 additions & 22 deletions packages/firebase_auth/firebase_auth/test/firebase_auth_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -43,24 +43,25 @@ void main() {
final int kMockLastSignInTimestamp =
DateTime.now().subtract(const Duration(days: 1)).millisecondsSinceEpoch;

Map<String, dynamic> kMockUser = <String, dynamic>{
'isAnonymous': true,
'emailVerified': false,
'displayName': 'displayName',
'metadata': <String, int>{
'creationTime': kMockCreationTimestamp,
'lastSignInTime': kMockLastSignInTimestamp,
},
'providerData': <Map<String, String>>[
<String, String>{
final kMockUser = PigeonUserDetails(
userInfo: PigeonUserInfo(
uid: '12345',
displayName: 'displayName',
creationTimestamp: kMockCreationTimestamp,
lastSignInTimestamp: kMockLastSignInTimestamp,
isAnonymous: true,
isEmailVerified: false,
),
providerData: [
{
'providerId': 'firebase',
'uid': '12345',
'displayName': 'Flutter Test User',
'photoURL': 'http://www.example.com/',
'email': 'test@example.com',
},
}
],
};
);

MockUserPlatform? mockUserPlatform;
MockUserCredentialPlatform? mockUserCredPlatform;
Expand All @@ -72,7 +73,7 @@ void main() {
MockFirebaseAuth mockAuthPlatform = MockFirebaseAuth();

group('$FirebaseAuth', () {
Map<String, dynamic> user;
PigeonUserDetails user;
// used to generate a unique application name for each test
var testCount = 0;

Expand Down Expand Up @@ -171,7 +172,7 @@ void main() {
when(mockAuthPlatform.userChanges()).thenAnswer((_) =>
Stream<UserPlatform>.fromIterable(<UserPlatform>[mockUserPlatform!]));

TestDefaultBinaryMessengerBinding.instance?.defaultBinaryMessenger
TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger
.setMockMethodCallHandler(MethodChannelFirebaseAuth.channel,
(call) async {
return <String, dynamic>{'user': user};
Expand Down Expand Up @@ -247,8 +248,12 @@ void main() {
group('checkActionCode()', () {
test('should call delegate method', () async {
// Necessary as we otherwise get a "null is not a Future<void>" error
when(mockAuthPlatform.checkActionCode(any))
.thenAnswer((i) async => ActionCodeInfo(data: {}, operation: 0));
when(mockAuthPlatform.checkActionCode(any)).thenAnswer(
(i) async => ActionCodeInfo(
data: ActionCodeInfoData(email: null, previousEmail: null),
operation: ActionCodeInfoOperation.unknown,
),
);

await auth.checkActionCode(kMockActionCode);
verify(mockAuthPlatform.checkActionCode(kMockActionCode));
Expand Down Expand Up @@ -377,7 +382,7 @@ void main() {
final ActionCodeSettings kMockActionCodeSettingsNull =
ActionCodeSettings(url: kMockURL);
final ActionCodeSettings kMockActionCodeSettingsFalse =
ActionCodeSettings(url: kMockURL, handleCodeInApp: false);
ActionCodeSettings(url: kMockURL);

// when handleCodeInApp is null
expect(
Expand Down Expand Up @@ -840,7 +845,7 @@ class MockFirebaseAuth extends Mock

@override
FirebaseAuthPlatform setInitialValues({
Map<String, dynamic>? currentUser,
PigeonUserDetails? currentUser,
String? languageCode,
}) {
return super.noSuchMethod(
Expand Down Expand Up @@ -1034,7 +1039,7 @@ class FakeFirebaseAuthPlatform extends Fake

@override
FirebaseAuthPlatform setInitialValues({
Map<String, dynamic>? currentUser,
PigeonUserDetails? currentUser,
String? languageCode,
}) {
return this;
Expand All @@ -1045,7 +1050,7 @@ class MockUserPlatform extends Mock
with MockPlatformInterfaceMixin
implements TestUserPlatform {
MockUserPlatform(FirebaseAuthPlatform auth, MultiFactorPlatform multiFactor,
Map<String, dynamic> _user) {
PigeonUserDetails _user) {
TestUserPlatform(auth, multiFactor, _user);
}
}
Expand Down Expand Up @@ -1096,7 +1101,7 @@ class TestFirebaseAuthPlatform extends FirebaseAuthPlatform {

@override
FirebaseAuthPlatform setInitialValues({
Map<String, dynamic>? currentUser,
PigeonUserDetails? currentUser,
String? languageCode,
}) {
return this;
Expand Down Expand Up @@ -1165,7 +1170,7 @@ class TestAuthProvider extends AuthProvider {

class TestUserPlatform extends UserPlatform {
TestUserPlatform(FirebaseAuthPlatform auth, MultiFactorPlatform multiFactor,
Map<String, dynamic> data)
PigeonUserDetails data)
: super(auth, multiFactor, data);
}

Expand Down
55 changes: 27 additions & 28 deletions packages/firebase_auth/firebase_auth/test/user_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -31,42 +31,41 @@ void main() {

FirebaseAuth? auth;

const Map<String, dynamic> kMockIdTokenResult = <String, dynamic>{
'token': '12345',
'expirationTimestamp': 123456,
'authTimestamp': 1234567,
'issuedAtTimestamp': 12345678,
'signInProvider': 'password',
'claims': <dynamic, dynamic>{
final kMockIdTokenResult = PigeonIdTokenResult(
token: '12345',
expirationTimestamp: 123456,
authTimestamp: 1234567,
issuedAtTimestamp: 12345678,
signInProvider: 'password',
claims: {
'claim1': 'value1',
},
};
);

final int kMockCreationTimestamp =
DateTime.now().subtract(const Duration(days: 2)).millisecondsSinceEpoch;
final int kMockLastSignInTimestamp =
DateTime.now().subtract(const Duration(days: 1)).millisecondsSinceEpoch;

Map<String, dynamic> kMockUser = <String, dynamic>{
'isAnonymous': true,
'emailVerified': false,
'uid': '42',
'displayName': 'displayName',
'metadata': <String, int>{
'creationTime': kMockCreationTimestamp,
'lastSignInTime': kMockLastSignInTimestamp,
},
'providerData': <Map<String, String>>[
<String, String>{
final kMockUser = PigeonUserDetails(
userInfo: PigeonUserInfo(
uid: '12345',
displayName: 'displayName',
creationTimestamp: kMockCreationTimestamp,
lastSignInTimestamp: kMockLastSignInTimestamp,
isAnonymous: true,
isEmailVerified: false,
),
providerData: [
{
'providerId': 'firebase',
'uid': '12345',
'displayName': 'Flutter Test User',
'photoURL': 'http://www.example.com/',
'email': 'test@example.com',
},
}
],
};

);
MockUserPlatform? mockUserPlatform;
MockUserCredentialPlatform? mockUserCredPlatform;

Expand All @@ -84,7 +83,7 @@ void main() {
var mockAuthPlatform = MockFirebaseAuth();

group('$User', () {
Map<String, dynamic>? user;
PigeonUserDetails? user;

// used to generate a unique application name for each test
var testCount = 0;
Expand Down Expand Up @@ -130,7 +129,7 @@ void main() {
languageCode: anyNamed('languageCode'),
)).thenAnswer((_) => mockAuthPlatform);

TestDefaultBinaryMessengerBinding.instance?.defaultBinaryMessenger
TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger
.setMockMethodCallHandler(MethodChannelFirebaseAuth.channel,
(call) async {
switch (call.method) {
Expand Down Expand Up @@ -387,7 +386,7 @@ class MockFirebaseAuth extends Mock

@override
FirebaseAuthPlatform setInitialValues({
Map<String, dynamic>? currentUser,
PigeonUserDetails? currentUser,
String? languageCode,
}) {
return super.noSuchMethod(
Expand All @@ -404,7 +403,7 @@ class MockFirebaseAuth extends Mock
class MockUserPlatform extends Mock
with MockPlatformInterfaceMixin
implements TestUserPlatform {
MockUserPlatform(FirebaseAuthPlatform auth, Map<String, dynamic> _user) {
MockUserPlatform(FirebaseAuthPlatform auth, PigeonUserDetails _user) {
TestUserPlatform(auth, TestMultiFactorPlatform(auth), _user);
}

Expand Down Expand Up @@ -564,7 +563,7 @@ class TestFirebaseAuthPlatform extends FirebaseAuthPlatform {

@override
FirebaseAuthPlatform setInitialValues({
Map<String, dynamic>? currentUser,
PigeonUserDetails? currentUser,
String? languageCode,
}) {
return this;
Expand All @@ -573,7 +572,7 @@ class TestFirebaseAuthPlatform extends FirebaseAuthPlatform {

class TestUserPlatform extends UserPlatform {
TestUserPlatform(FirebaseAuthPlatform auth, MultiFactorPlatform multiFactor,
Map<String, dynamic> data)
PigeonUserDetails data)
: super(auth, multiFactor, data);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,14 @@ class ActionCodeInfo {
@protected
ActionCodeInfo({
required this.operation,
required this.data,
});
required ActionCodeInfoData data,
}) : _data = data;

ActionCodeInfoOperation operation;

ActionCodeInfoData data;
ActionCodeInfoData _data;

Map<String, dynamic> get data => _data.toMap();
}

/// The data associated with the action code.
Expand All @@ -37,4 +39,12 @@ class ActionCodeInfoData {

/// The previous email associated with the action code.
final String? previousEmail;

/// Converts the [ActionCodeInfoData] instance to a [Map].
Map<String, dynamic> toMap() {
return <String, dynamic>{
'email': email,
'previousEmail': previousEmail,
};
}
}
Loading