From f88d427137592be7205e7d3d1941d58d9439d3fd Mon Sep 17 00:00:00 2001 From: David Martos Date: Sat, 29 Jul 2023 02:02:38 +0200 Subject: [PATCH 01/19] fix melos syntax --- melos.yaml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/melos.yaml b/melos.yaml index dd773cc6..b8804411 100644 --- a/melos.yaml +++ b/melos.yaml @@ -2,7 +2,7 @@ name: flutterfire_dart packages: - packages/** - - tests/* + - tests scripts: lint:all: @@ -22,18 +22,18 @@ scripts: test: description: Run tests in a specific package. run: melos exec --concurrency=1 -- "flutter test --no-pub --reporter expanded" - select-package: - dir-exists: + packageFilters: + dirExists: - 'test/' - + test:e2e: run: | melos exec -c 1 --fail-fast -- \ "flutter drive --no-pub --target=./test_driver/driver_e2e.dart" description: | Run all e2e tests. - select-package: - dir-exists: + packageFilters: + dirExists: - test_driver scope: '*tests*' From 07941405195100f919b29ae412bbba8b25cc50a0 Mon Sep 17 00:00:00 2001 From: David Martos Date: Sat, 29 Jul 2023 02:02:54 +0200 Subject: [PATCH 02/19] update mocks generated code --- .../test/firebase_auth_dart_test.mocks.dart | 696 +++++++++++++----- 1 file changed, 496 insertions(+), 200 deletions(-) diff --git a/packages/firebase_auth/firebase_auth_dart/test/firebase_auth_dart_test.mocks.dart b/packages/firebase_auth/firebase_auth_dart/test/firebase_auth_dart_test.mocks.dart index 7d09d967..089a0083 100644 --- a/packages/firebase_auth/firebase_auth_dart/test/firebase_auth_dart_test.mocks.dart +++ b/packages/firebase_auth/firebase_auth_dart/test/firebase_auth_dart_test.mocks.dart @@ -1,12 +1,12 @@ -// Mocks generated by Mockito 5.1.0 from annotations +// Mocks generated by Mockito 5.4.2 from annotations // in firebase_auth_dart/test/firebase_auth_dart_test.dart. // Do not manually edit this file. +// ignore_for_file: no_leading_underscores_for_library_prefixes import 'dart:async' as _i4; import 'package:firebase_auth_dart/firebase_auth_dart.dart' as _i2; -import 'package:firebase_auth_dart/src/api/authentication/recaptcha/recaptcha_verifier.dart' - as _i5; +import 'package:firebase_auth_dart/src/api/api.dart' as _i5; import 'package:firebase_auth_dart/src/providers/phone_auth.dart' as _i6; import 'package:firebase_core_dart/firebase_core_dart.dart' as _i3; import 'package:http/http.dart' as _i7; @@ -21,19 +21,69 @@ import 'package:mockito/mockito.dart' as _i1; // ignore_for_file: prefer_const_constructors // ignore_for_file: unnecessary_parenthesis // ignore_for_file: camel_case_types +// ignore_for_file: subtype_of_sealed_class -class _FakeUser_0 extends _i1.Fake implements _i2.User {} +class _FakeUser_0 extends _i1.SmartFake implements _i2.User { + _FakeUser_0( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); +} -class _FakeIdTokenResult_1 extends _i1.Fake implements _i2.IdTokenResult {} +class _FakeIdTokenResult_1 extends _i1.SmartFake implements _i2.IdTokenResult { + _FakeIdTokenResult_1( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); +} -class _FakeUserCredential_2 extends _i1.Fake implements _i2.UserCredential {} +class _FakeUserCredential_2 extends _i1.SmartFake + implements _i2.UserCredential { + _FakeUserCredential_2( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); +} -class _FakeConfirmationResult_3 extends _i1.Fake - implements _i2.ConfirmationResult {} +class _FakeConfirmationResult_3 extends _i1.SmartFake + implements _i2.ConfirmationResult { + _FakeConfirmationResult_3( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); +} -class _FakeFirebaseApp_4 extends _i1.Fake implements _i3.FirebaseApp {} +class _FakeFirebaseApp_4 extends _i1.SmartFake implements _i3.FirebaseApp { + _FakeFirebaseApp_4( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); +} -class _FakeFirebaseAuth_5 extends _i1.Fake implements _i2.FirebaseAuth {} +class _FakeFirebaseAuth_5 extends _i1.SmartFake implements _i2.FirebaseAuth { + _FakeFirebaseAuth_5( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); +} /// A class which mocks [User]. /// @@ -44,114 +94,221 @@ class MockUser extends _i1.Mock implements _i2.User { } @override - bool get emailVerified => - (super.noSuchMethod(Invocation.getter(#emailVerified), returnValue: false) - as bool); - @override - bool get isAnonymous => - (super.noSuchMethod(Invocation.getter(#isAnonymous), returnValue: false) - as bool); - @override - List<_i2.UserInfo> get providerData => - (super.noSuchMethod(Invocation.getter(#providerData), - returnValue: <_i2.UserInfo>[]) as List<_i2.UserInfo>); - @override - String get uid => - (super.noSuchMethod(Invocation.getter(#uid), returnValue: '') as String); - @override - _i4.Future<_i2.User> unlink(String? providerId) => - (super.noSuchMethod(Invocation.method(#unlink, [providerId]), - returnValue: Future<_i2.User>.value(_FakeUser_0())) - as _i4.Future<_i2.User>); - @override - _i4.Future delete() => - (super.noSuchMethod(Invocation.method(#delete, []), - returnValue: Future.value(), - returnValueForMissingStub: Future.value()) as _i4.Future); + bool get emailVerified => (super.noSuchMethod( + Invocation.getter(#emailVerified), + returnValue: false, + ) as bool); + @override + bool get isAnonymous => (super.noSuchMethod( + Invocation.getter(#isAnonymous), + returnValue: false, + ) as bool); + @override + List<_i2.UserInfo> get providerData => (super.noSuchMethod( + Invocation.getter(#providerData), + returnValue: <_i2.UserInfo>[], + ) as List<_i2.UserInfo>); + @override + String get uid => (super.noSuchMethod( + Invocation.getter(#uid), + returnValue: '', + ) as String); + @override + _i4.Future<_i2.User> unlink(String? providerId) => (super.noSuchMethod( + Invocation.method( + #unlink, + [providerId], + ), + returnValue: _i4.Future<_i2.User>.value(_FakeUser_0( + this, + Invocation.method( + #unlink, + [providerId], + ), + )), + ) as _i4.Future<_i2.User>); + @override + _i4.Future delete() => (super.noSuchMethod( + Invocation.method( + #delete, + [], + ), + returnValue: _i4.Future.value(), + returnValueForMissingStub: _i4.Future.value(), + ) as _i4.Future); @override _i4.Future getIdToken([bool? forceRefresh = false]) => - (super.noSuchMethod(Invocation.method(#getIdToken, [forceRefresh]), - returnValue: Future.value('')) as _i4.Future); + (super.noSuchMethod( + Invocation.method( + #getIdToken, + [forceRefresh], + ), + returnValue: _i4.Future.value(''), + ) as _i4.Future); @override _i4.Future<_i2.IdTokenResult> getIdTokenResult( [bool? forceRefresh = false]) => - (super.noSuchMethod(Invocation.method(#getIdTokenResult, [forceRefresh]), - returnValue: - Future<_i2.IdTokenResult>.value(_FakeIdTokenResult_1())) - as _i4.Future<_i2.IdTokenResult>); + (super.noSuchMethod( + Invocation.method( + #getIdTokenResult, + [forceRefresh], + ), + returnValue: _i4.Future<_i2.IdTokenResult>.value(_FakeIdTokenResult_1( + this, + Invocation.method( + #getIdTokenResult, + [forceRefresh], + ), + )), + ) as _i4.Future<_i2.IdTokenResult>); @override _i4.Future<_i2.UserCredential> linkWithCredential( _i2.AuthCredential? credential) => - (super.noSuchMethod(Invocation.method(#linkWithCredential, [credential]), - returnValue: - Future<_i2.UserCredential>.value(_FakeUserCredential_2())) - as _i4.Future<_i2.UserCredential>); + (super.noSuchMethod( + Invocation.method( + #linkWithCredential, + [credential], + ), + returnValue: _i4.Future<_i2.UserCredential>.value(_FakeUserCredential_2( + this, + Invocation.method( + #linkWithCredential, + [credential], + ), + )), + ) as _i4.Future<_i2.UserCredential>); @override _i4.Future<_i2.UserCredential> reauthenticateWithCredential( _i2.AuthCredential? credential) => (super.noSuchMethod( - Invocation.method(#reauthenticateWithCredential, [credential]), - returnValue: - Future<_i2.UserCredential>.value(_FakeUserCredential_2())) - as _i4.Future<_i2.UserCredential>); - @override - _i4.Future<_i2.ConfirmationResult> linkWithPhoneNumber(String? phoneNumber, - [_i5.RecaptchaVerifier? applicationVerifier]) => + Invocation.method( + #reauthenticateWithCredential, + [credential], + ), + returnValue: _i4.Future<_i2.UserCredential>.value(_FakeUserCredential_2( + this, + Invocation.method( + #reauthenticateWithCredential, + [credential], + ), + )), + ) as _i4.Future<_i2.UserCredential>); + @override + _i4.Future<_i2.ConfirmationResult> linkWithPhoneNumber( + String? phoneNumber, [ + _i5.RecaptchaVerifier? applicationVerifier, + ]) => (super.noSuchMethod( - Invocation.method( - #linkWithPhoneNumber, [phoneNumber, applicationVerifier]), - returnValue: Future<_i2.ConfirmationResult>.value( - _FakeConfirmationResult_3())) - as _i4.Future<_i2.ConfirmationResult>); - @override - _i4.Future reload() => - (super.noSuchMethod(Invocation.method(#reload, []), - returnValue: Future.value(), - returnValueForMissingStub: Future.value()) as _i4.Future); - @override - _i4.Future updateEmail(String? newEmail) => - (super.noSuchMethod(Invocation.method(#updateEmail, [newEmail]), - returnValue: Future.value(), - returnValueForMissingStub: Future.value()) as _i4.Future); - @override - _i4.Future sendEmailVerification() => - (super.noSuchMethod(Invocation.method(#sendEmailVerification, []), - returnValue: Future.value(), - returnValueForMissingStub: Future.value()) as _i4.Future); - @override - _i4.Future updatePassword(String? newPassword) => - (super.noSuchMethod(Invocation.method(#updatePassword, [newPassword]), - returnValue: Future.value(), - returnValueForMissingStub: Future.value()) as _i4.Future); + Invocation.method( + #linkWithPhoneNumber, + [ + phoneNumber, + applicationVerifier, + ], + ), + returnValue: + _i4.Future<_i2.ConfirmationResult>.value(_FakeConfirmationResult_3( + this, + Invocation.method( + #linkWithPhoneNumber, + [ + phoneNumber, + applicationVerifier, + ], + ), + )), + ) as _i4.Future<_i2.ConfirmationResult>); + @override + _i4.Future reload() => (super.noSuchMethod( + Invocation.method( + #reload, + [], + ), + returnValue: _i4.Future.value(), + returnValueForMissingStub: _i4.Future.value(), + ) as _i4.Future); + @override + _i4.Future updateEmail(String? newEmail) => (super.noSuchMethod( + Invocation.method( + #updateEmail, + [newEmail], + ), + returnValue: _i4.Future.value(), + returnValueForMissingStub: _i4.Future.value(), + ) as _i4.Future); + @override + _i4.Future sendEmailVerification() => (super.noSuchMethod( + Invocation.method( + #sendEmailVerification, + [], + ), + returnValue: _i4.Future.value(), + returnValueForMissingStub: _i4.Future.value(), + ) as _i4.Future); + @override + _i4.Future updatePassword(String? newPassword) => (super.noSuchMethod( + Invocation.method( + #updatePassword, + [newPassword], + ), + returnValue: _i4.Future.value(), + returnValueForMissingStub: _i4.Future.value(), + ) as _i4.Future); @override _i4.Future updatePhoneNumber( _i6.PhoneAuthCredential? phoneCredential) => (super.noSuchMethod( - Invocation.method(#updatePhoneNumber, [phoneCredential]), - returnValue: Future.value(), - returnValueForMissingStub: Future.value()) as _i4.Future); + Invocation.method( + #updatePhoneNumber, + [phoneCredential], + ), + returnValue: _i4.Future.value(), + returnValueForMissingStub: _i4.Future.value(), + ) as _i4.Future); @override _i4.Future updateDisplayName(String? displayName) => - (super.noSuchMethod(Invocation.method(#updateDisplayName, [displayName]), - returnValue: Future.value(), - returnValueForMissingStub: Future.value()) as _i4.Future); - @override - _i4.Future updatePhotoURL(String? photoUrl) => - (super.noSuchMethod(Invocation.method(#updatePhotoURL, [photoUrl]), - returnValue: Future.value(), - returnValueForMissingStub: Future.value()) as _i4.Future); - @override - _i4.Future updateProfile( - {String? photoUrl = r'', String? displayName = r''}) => (super.noSuchMethod( - Invocation.method(#updateProfile, [], - {#photoUrl: photoUrl, #displayName: displayName}), - returnValue: Future.value(), - returnValueForMissingStub: Future.value()) as _i4.Future); - @override - Map toMap() => - (super.noSuchMethod(Invocation.method(#toMap, []), - returnValue: {}) as Map); + Invocation.method( + #updateDisplayName, + [displayName], + ), + returnValue: _i4.Future.value(), + returnValueForMissingStub: _i4.Future.value(), + ) as _i4.Future); + @override + _i4.Future updatePhotoURL(String? photoUrl) => (super.noSuchMethod( + Invocation.method( + #updatePhotoURL, + [photoUrl], + ), + returnValue: _i4.Future.value(), + returnValueForMissingStub: _i4.Future.value(), + ) as _i4.Future); + @override + _i4.Future updateProfile({ + String? photoUrl = r'', + String? displayName = r'', + }) => + (super.noSuchMethod( + Invocation.method( + #updateProfile, + [], + { + #photoUrl: photoUrl, + #displayName: displayName, + }, + ), + returnValue: _i4.Future.value(), + returnValueForMissingStub: _i4.Future.value(), + ) as _i4.Future); + @override + Map toMap() => (super.noSuchMethod( + Invocation.method( + #toMap, + [], + ), + returnValue: {}, + ) as Map); } /// A class which mocks [FirebaseAuth]. @@ -163,126 +320,260 @@ class MockFirebaseAuth extends _i1.Mock implements _i2.FirebaseAuth { } @override - _i3.FirebaseApp get app => (super.noSuchMethod(Invocation.getter(#app), - returnValue: _FakeFirebaseApp_4()) as _i3.FirebaseApp); - @override - set app(_i3.FirebaseApp? _app) => - super.noSuchMethod(Invocation.setter(#app, _app), - returnValueForMissingStub: null); - @override - void setApiClient(_i7.Client? client) => - super.noSuchMethod(Invocation.method(#setApiClient, [client]), - returnValueForMissingStub: null); - @override - _i4.Stream<_i2.User?> authStateChanges() => - (super.noSuchMethod(Invocation.method(#authStateChanges, []), - returnValue: Stream<_i2.User?>.empty()) as _i4.Stream<_i2.User?>); - @override - _i4.Stream<_i2.User?> idTokenChanges() => - (super.noSuchMethod(Invocation.method(#idTokenChanges, []), - returnValue: Stream<_i2.User?>.empty()) as _i4.Stream<_i2.User?>); - @override - void setLanguageCode(String? languageCode) => - super.noSuchMethod(Invocation.method(#setLanguageCode, [languageCode]), - returnValueForMissingStub: null); + _i3.FirebaseApp get app => (super.noSuchMethod( + Invocation.getter(#app), + returnValue: _FakeFirebaseApp_4( + this, + Invocation.getter(#app), + ), + ) as _i3.FirebaseApp); + @override + set app(_i3.FirebaseApp? _app) => super.noSuchMethod( + Invocation.setter( + #app, + _app, + ), + returnValueForMissingStub: null, + ); + @override + set client(_i7.Client? client) => super.noSuchMethod( + Invocation.setter( + #client, + client, + ), + returnValueForMissingStub: null, + ); + @override + _i4.Stream<_i2.User?> authStateChanges() => (super.noSuchMethod( + Invocation.method( + #authStateChanges, + [], + ), + returnValue: _i4.Stream<_i2.User?>.empty(), + ) as _i4.Stream<_i2.User?>); + @override + _i4.Stream<_i2.User?> idTokenChanges() => (super.noSuchMethod( + Invocation.method( + #idTokenChanges, + [], + ), + returnValue: _i4.Stream<_i2.User?>.empty(), + ) as _i4.Stream<_i2.User?>); + @override + void setLanguageCode(String? languageCode) => super.noSuchMethod( + Invocation.method( + #setLanguageCode, + [languageCode], + ), + returnValueForMissingStub: null, + ); @override _i4.Future<_i2.UserCredential> signInWithEmailAndPassword( - String? email, String? password) => + String? email, + String? password, + ) => (super.noSuchMethod( - Invocation.method(#signInWithEmailAndPassword, [email, password]), - returnValue: - Future<_i2.UserCredential>.value(_FakeUserCredential_2())) - as _i4.Future<_i2.UserCredential>); + Invocation.method( + #signInWithEmailAndPassword, + [ + email, + password, + ], + ), + returnValue: _i4.Future<_i2.UserCredential>.value(_FakeUserCredential_2( + this, + Invocation.method( + #signInWithEmailAndPassword, + [ + email, + password, + ], + ), + )), + ) as _i4.Future<_i2.UserCredential>); @override _i4.Future<_i2.UserCredential> createUserWithEmailAndPassword( - String? email, String? password) => + String? email, + String? password, + ) => (super.noSuchMethod( - Invocation.method(#createUserWithEmailAndPassword, [email, password]), - returnValue: - Future<_i2.UserCredential>.value(_FakeUserCredential_2())) as _i4 - .Future<_i2.UserCredential>); - @override - _i4.Future> fetchSignInMethodsForEmail(String? email) => (super - .noSuchMethod(Invocation.method(#fetchSignInMethodsForEmail, [email]), - returnValue: Future>.value([])) - as _i4.Future>); - @override - _i4.Future sendPasswordResetEmail( - {String? email, String? continueUrl}) => + Invocation.method( + #createUserWithEmailAndPassword, + [ + email, + password, + ], + ), + returnValue: _i4.Future<_i2.UserCredential>.value(_FakeUserCredential_2( + this, + Invocation.method( + #createUserWithEmailAndPassword, + [ + email, + password, + ], + ), + )), + ) as _i4.Future<_i2.UserCredential>); + @override + _i4.Future> fetchSignInMethodsForEmail(String? email) => (super.noSuchMethod( - Invocation.method(#sendPasswordResetEmail, [], - {#email: email, #continueUrl: continueUrl}), - returnValue: Future.value('')) as _i4.Future); - @override - _i4.Future confirmPasswordReset(String? code, String? newPassword) => + Invocation.method( + #fetchSignInMethodsForEmail, + [email], + ), + returnValue: _i4.Future>.value([]), + ) as _i4.Future>); + @override + _i4.Future sendPasswordResetEmail({ + required String? email, + String? continueUrl, + }) => + (super.noSuchMethod( + Invocation.method( + #sendPasswordResetEmail, + [], + { + #email: email, + #continueUrl: continueUrl, + }, + ), + returnValue: _i4.Future.value(''), + ) as _i4.Future); + @override + _i4.Future confirmPasswordReset( + String? code, + String? newPassword, + ) => (super.noSuchMethod( - Invocation.method(#confirmPasswordReset, [code, newPassword]), - returnValue: Future.value('')) as _i4.Future); + Invocation.method( + #confirmPasswordReset, + [ + code, + newPassword, + ], + ), + returnValue: _i4.Future.value(''), + ) as _i4.Future); @override _i4.Future verifyPasswordResetCode(String? code) => - (super.noSuchMethod(Invocation.method(#verifyPasswordResetCode, [code]), - returnValue: Future.value('')) as _i4.Future); - @override - _i4.Future sendSignInLinkToEmail(String? email, - [String? continueUrl]) => (super.noSuchMethod( - Invocation.method(#sendSignInLinkToEmail, [email, continueUrl]), - returnValue: Future.value()) as _i4.Future); - @override - _i4.Future<_i2.UserCredential> signInAnonymously() => - (super.noSuchMethod(Invocation.method(#signInAnonymously, []), - returnValue: - Future<_i2.UserCredential>.value(_FakeUserCredential_2())) - as _i4.Future<_i2.UserCredential>); - @override - _i4.Future<_i2.UserCredential> signInWithPopup() => - (super.noSuchMethod(Invocation.method(#signInWithPopup, []), - returnValue: - Future<_i2.UserCredential>.value(_FakeUserCredential_2())) - as _i4.Future<_i2.UserCredential>); + Invocation.method( + #verifyPasswordResetCode, + [code], + ), + returnValue: _i4.Future.value(''), + ) as _i4.Future); + @override + _i4.Future<_i2.UserCredential> signInAnonymously() => (super.noSuchMethod( + Invocation.method( + #signInAnonymously, + [], + ), + returnValue: _i4.Future<_i2.UserCredential>.value(_FakeUserCredential_2( + this, + Invocation.method( + #signInAnonymously, + [], + ), + )), + ) as _i4.Future<_i2.UserCredential>); + @override + _i4.Future<_i2.UserCredential> signInWithPopup() => (super.noSuchMethod( + Invocation.method( + #signInWithPopup, + [], + ), + returnValue: _i4.Future<_i2.UserCredential>.value(_FakeUserCredential_2( + this, + Invocation.method( + #signInWithPopup, + [], + ), + )), + ) as _i4.Future<_i2.UserCredential>); @override _i4.Future<_i2.UserCredential> signInWithCredential( _i2.AuthCredential? credential) => (super.noSuchMethod( - Invocation.method(#signInWithCredential, [credential]), - returnValue: - Future<_i2.UserCredential>.value(_FakeUserCredential_2())) - as _i4.Future<_i2.UserCredential>); + Invocation.method( + #signInWithCredential, + [credential], + ), + returnValue: _i4.Future<_i2.UserCredential>.value(_FakeUserCredential_2( + this, + Invocation.method( + #signInWithCredential, + [credential], + ), + )), + ) as _i4.Future<_i2.UserCredential>); @override _i4.Future<_i2.UserCredential> signInWithCustomToken(String? token) => - (super.noSuchMethod(Invocation.method(#signInWithCustomToken, [token]), - returnValue: - Future<_i2.UserCredential>.value(_FakeUserCredential_2())) - as _i4.Future<_i2.UserCredential>); - @override - _i4.Future<_i2.UserCredential> signInWithEmailLink( - String? email, String? emailLink) => (super.noSuchMethod( - Invocation.method(#signInWithEmailLink, [email, emailLink]), - returnValue: - Future<_i2.UserCredential>.value(_FakeUserCredential_2())) - as _i4.Future<_i2.UserCredential>); - @override - _i4.Future<_i2.ConfirmationResult> signInWithPhoneNumber(String? phoneNumber, - [_i5.RecaptchaVerifier? verifier]) => + Invocation.method( + #signInWithCustomToken, + [token], + ), + returnValue: _i4.Future<_i2.UserCredential>.value(_FakeUserCredential_2( + this, + Invocation.method( + #signInWithCustomToken, + [token], + ), + )), + ) as _i4.Future<_i2.UserCredential>); + @override + _i4.Future<_i2.ConfirmationResult> signInWithPhoneNumber( + String? phoneNumber, [ + _i5.RecaptchaVerifier? verifier, + ]) => (super.noSuchMethod( - Invocation.method(#signInWithPhoneNumber, [phoneNumber, verifier]), - returnValue: Future<_i2.ConfirmationResult>.value( - _FakeConfirmationResult_3())) as _i4 - .Future<_i2.ConfirmationResult>); - @override - _i4.Future signOut() => - (super.noSuchMethod(Invocation.method(#signOut, []), - returnValue: Future.value(), - returnValueForMissingStub: Future.value()) as _i4.Future); - @override - _i4.Future> useAuthEmulator( - {String? host = r'localhost', int? port = 9099}) => + Invocation.method( + #signInWithPhoneNumber, + [ + phoneNumber, + verifier, + ], + ), + returnValue: + _i4.Future<_i2.ConfirmationResult>.value(_FakeConfirmationResult_3( + this, + Invocation.method( + #signInWithPhoneNumber, + [ + phoneNumber, + verifier, + ], + ), + )), + ) as _i4.Future<_i2.ConfirmationResult>); + @override + _i4.Future signOut() => (super.noSuchMethod( + Invocation.method( + #signOut, + [], + ), + returnValue: _i4.Future.value(), + returnValueForMissingStub: _i4.Future.value(), + ) as _i4.Future); + @override + _i4.Future> useAuthEmulator({ + String? host = r'localhost', + int? port = 9099, + }) => (super.noSuchMethod( - Invocation.method(#useAuthEmulator, [], {#host: host, #port: port}), - returnValue: - Future>.value({})) as _i4 - .Future>); + Invocation.method( + #useAuthEmulator, + [], + { + #host: host, + #port: port, + }, + ), + returnValue: + _i4.Future>.value({}), + ) as _i4.Future>); } /// A class which mocks [UserCredential]. @@ -294,6 +585,11 @@ class MockUserCredential extends _i1.Mock implements _i2.UserCredential { } @override - _i2.FirebaseAuth get auth => (super.noSuchMethod(Invocation.getter(#auth), - returnValue: _FakeFirebaseAuth_5()) as _i2.FirebaseAuth); + _i2.FirebaseAuth get auth => (super.noSuchMethod( + Invocation.getter(#auth), + returnValue: _FakeFirebaseAuth_5( + this, + Invocation.getter(#auth), + ), + ) as _i2.FirebaseAuth); } From eb2e02e0706e26bf21ec90a3544c0c744e8ba608 Mon Sep 17 00:00:00 2001 From: David Martos Date: Sat, 29 Jul 2023 02:07:57 +0200 Subject: [PATCH 03/19] fix tests and firebase deps --- .../workflows/scripts/functions/src/index.ts | 28 +++++++++++++ .../firebase_auth_desktop/pubspec.yaml | 8 ++-- .../firebase_auth_desktop/test/user_test.dart | 4 +- .../firebase_core_desktop/pubspec.yaml | 2 +- .../firebase_functions_integration_test.dart | 8 +++- .../test/firebase_functions_test.dart | 8 +--- .../firebase_functions_desktop/pubspec.yaml | 6 +-- tests/pubspec.yaml | 6 +-- .../firebase_auth_instance_e2e.dart | 41 ++++++++++++------- 9 files changed, 75 insertions(+), 36 deletions(-) diff --git a/.github/workflows/scripts/functions/src/index.ts b/.github/workflows/scripts/functions/src/index.ts index df7cd078..60f94a1c 100644 --- a/.github/workflows/scripts/functions/src/index.ts +++ b/.github/workflows/scripts/functions/src/index.ts @@ -23,6 +23,34 @@ export const testFunctionTimeout = functions.https.onCall((data) => { }); }); +export const foo = functions.https.onCall((data) => { + return data +}); + +// For e2e testing that the caller is authorized +export const testFunctionAuthorized = functions.https.onCall(async (data, context) => { + console.log("testFunctionAuthorized called", data, context.auth); + if (!context.auth) { + throw new functions.https.HttpsError( + "unauthenticated", + "testFunctionAuthorized must be called while authenticated." + ); + } + try { + return 'authorized'; + } catch (e) { + throw new functions.https.HttpsError("internal", (e as any).message, (e as any).details); + } +}); + +// For e2e testing that the caller is authorized +export const testExceptions = functions.https.onCall(async (data, context) => { + if (data == 'bad-status') { + throw new functions.https.HttpsError("invalid-argument", "", ""); + } + return {}; +}); + // For e2e testing errors & return values. // noinspection JSUnusedGlobalSymbols export const testFunctionDefaultRegion = functions.https.onCall((data) => { diff --git a/packages/firebase_auth/firebase_auth_desktop/pubspec.yaml b/packages/firebase_auth/firebase_auth_desktop/pubspec.yaml index dd066118..be0f1af7 100644 --- a/packages/firebase_auth/firebase_auth_desktop/pubspec.yaml +++ b/packages/firebase_auth/firebase_auth_desktop/pubspec.yaml @@ -10,10 +10,10 @@ environment: dependencies: desktop_webview_auth: ^0.0.8 - firebase_auth: ^3.6.2 + firebase_auth: 4.6.3 firebase_auth_dart: ^1.0.1 - firebase_auth_platform_interface: ^6.5.2 - firebase_core: ^1.20.0 + firebase_auth_platform_interface: 6.15.3 + firebase_core: ^2.15.0 firebase_core_dart: ^1.0.1 flutter: sdk: flutter @@ -21,7 +21,7 @@ dependencies: dev_dependencies: async: ^2.8.1 - firebase_core_platform_interface: ^4.5.0 + firebase_core_platform_interface: 4.8.0 flutter_test: sdk: flutter mockito: ^5.0.0 diff --git a/packages/firebase_auth/firebase_auth_desktop/test/user_test.dart b/packages/firebase_auth/firebase_auth_desktop/test/user_test.dart index f9e220d0..859ac5c5 100644 --- a/packages/firebase_auth/firebase_auth_desktop/test/user_test.dart +++ b/packages/firebase_auth/firebase_auth_desktop/test/user_test.dart @@ -332,8 +332,8 @@ void main() { 'uid: 12345)'; final userMetadata = 'UserMetadata(' - 'creationTime: ${DateTime.fromMillisecondsSinceEpoch(kMockCreationTimestamp)}, ' - 'lastSignInTime: ${DateTime.fromMillisecondsSinceEpoch(kMockLastSignInTimestamp)})'; + 'creationTime: ${DateTime.fromMillisecondsSinceEpoch(kMockCreationTimestamp, isUtc: true)}, ' + 'lastSignInTime: ${DateTime.fromMillisecondsSinceEpoch(kMockLastSignInTimestamp, isUtc: true)})'; expect( auth!.currentUser.toString(), diff --git a/packages/firebase_core/firebase_core_desktop/pubspec.yaml b/packages/firebase_core/firebase_core_desktop/pubspec.yaml index dc73da38..73a9e826 100644 --- a/packages/firebase_core/firebase_core_desktop/pubspec.yaml +++ b/packages/firebase_core/firebase_core_desktop/pubspec.yaml @@ -16,7 +16,7 @@ dependencies: meta: ^1.3.0 dev_dependencies: - firebase_core: ^1.20.0 + firebase_core: ^2.15.0 flutter_test: sdk: flutter mockito: ^5.0.0 diff --git a/packages/firebase_functions/firebase_functions_dart/test/firebase_functions_integration_test.dart b/packages/firebase_functions/firebase_functions_dart/test/firebase_functions_integration_test.dart index 0ca9c3b4..e8a7aaec 100644 --- a/packages/firebase_functions/firebase_functions_dart/test/firebase_functions_integration_test.dart +++ b/packages/firebase_functions/firebase_functions_dart/test/firebase_functions_integration_test.dart @@ -145,6 +145,9 @@ Future main() async { group('Authentication', () { late final HttpsCallable httpsCallable; late final FirebaseApp app; + late final config = + StorageBox(app.options.projectId, configPathPrefix: '.firebase-auth'); + setUp(() async { await emulatorClearAllUsers(); }); @@ -154,10 +157,11 @@ Future main() async { final functions = FirebaseFunctions.instanceFor(app: app); functions.useFunctionsEmulator('localhost', 5001); httpsCallable = functions.httpsCallable('testFunctionAuthorized'); + + // Clear auth storage + config.remove('${app.options.apiKey}:${app.name}'); }); tearDown(() { - final config = StorageBox(app.options.projectId); - // Clear auth storage config.remove('${app.options.apiKey}:${app.name}'); }); diff --git a/packages/firebase_functions/firebase_functions_dart/test/firebase_functions_test.dart b/packages/firebase_functions/firebase_functions_dart/test/firebase_functions_test.dart index e608d308..752e01a4 100644 --- a/packages/firebase_functions/firebase_functions_dart/test/firebase_functions_test.dart +++ b/packages/firebase_functions/firebase_functions_dart/test/firebase_functions_test.dart @@ -364,6 +364,8 @@ Future main() async { late final HttpsCallable httpsCallable; late final FirebaseApp app; late final FirebaseFunctions functions; + late final config = + StorageBox(app.options.projectId, configPathPrefix: '.firebase-auth'); Future _authCheck(http.Request value) async { if (value.headers.containsKey('Authorization')) { @@ -381,9 +383,6 @@ Future main() async { name: 'auth_functions', ); - // Clear auth storage - final config = StorageBox(app.options.projectId); - // Clear auth storage config.remove('${app.options.apiKey}:${app.name}'); functions = FirebaseFunctions.instanceFor(app: app); @@ -392,9 +391,6 @@ Future main() async { }); tearDown(() async { - // Clear auth storage - final config = StorageBox(app.options.projectId); - // Clear auth storage config.remove('${app.options.apiKey}:${app.name}'); }); diff --git a/packages/firebase_functions/firebase_functions_desktop/pubspec.yaml b/packages/firebase_functions/firebase_functions_desktop/pubspec.yaml index 0bc1d417..abb951ff 100644 --- a/packages/firebase_functions/firebase_functions_desktop/pubspec.yaml +++ b/packages/firebase_functions/firebase_functions_desktop/pubspec.yaml @@ -9,9 +9,9 @@ environment: flutter: '>=1.20.0' dependencies: - cloud_functions: ^3.3.1 - cloud_functions_platform_interface: ^5.1.10 - firebase_core: ^1.19.1 + cloud_functions: 4.0.13 + cloud_functions_platform_interface: 5.1.32 + firebase_core: ^2.15.0 firebase_core_dart: ^1.0.1 firebase_core_desktop: ^1.0.2 firebase_functions_dart: ^0.1.1+2 diff --git a/tests/pubspec.yaml b/tests/pubspec.yaml index b2b5e600..0927fc4c 100644 --- a/tests/pubspec.yaml +++ b/tests/pubspec.yaml @@ -27,9 +27,9 @@ environment: # the latest version available on pub.dev. To see which dependencies have newer # versions available, run `flutter pub outdated`. dependencies: - cloud_functions: ^3.2.10 - firebase_auth: ^3.3.11 - firebase_core: ^1.13.1 + cloud_functions: 4.0.13 + firebase_auth: 4.6.3 + firebase_core: ^2.15.0 firebase_auth_desktop: path: ../packages/firebase_auth/firebase_auth_desktop firebase_auth_dart: diff --git a/tests/test_driver/firebase_auth/firebase_auth_dart/firebase_auth_instance_e2e.dart b/tests/test_driver/firebase_auth/firebase_auth_dart/firebase_auth_instance_e2e.dart index 7360e488..6af7c12d 100644 --- a/tests/test_driver/firebase_auth/firebase_auth_dart/firebase_auth_instance_e2e.dart +++ b/tests/test_driver/firebase_auth/firebase_auth_dart/firebase_auth_instance_e2e.dart @@ -30,15 +30,20 @@ void setupTests() { } group('authStateChanges()', () { - StreamQueue? authStateChanges; + late StreamQueue authStateChanges; - setUpAll(() { - authStateChanges = - StreamQueue(FirebaseAuth.instance.authStateChanges()); + setUp(() async { + // Broadcast stream so that it is not paused while using the StreamQueue + final stream = + FirebaseAuth.instance.authStateChanges().asBroadcastStream(); + authStateChanges = StreamQueue(stream); + + // Skip current user + await authStateChanges.next; }); tearDown(() async { - await authStateChanges?.cancel(); + await authStateChanges.cancel(); await ensureSignedOut(); }); @@ -48,35 +53,41 @@ void setupTests() { String uid = FirebaseAuth.instance.currentUser!.uid; expect( - (await authStateChanges?.next)?.uid, + (await authStateChanges.next)?.uid, equals(uid), ); await FirebaseAuth.instance.signOut(); expect( - (await authStateChanges?.next), + (await authStateChanges.next), isNull, ); await FirebaseAuth.instance.signInAnonymously(); expect( - (await authStateChanges?.next)?.uid != uid, + (await authStateChanges.next)?.uid != uid, isTrue, ); }); }); group('idTokenChanges()', () { - StreamQueue? idTokenChanges; + late StreamQueue idTokenChanges; + + setUp(() async { + // Broadcast stream so that it is not paused while using the StreamQueue + final stream = + FirebaseAuth.instance.idTokenChanges().asBroadcastStream(); + idTokenChanges = StreamQueue(stream); - setUpAll(() { - idTokenChanges = StreamQueue(FirebaseAuth.instance.idTokenChanges()); + // Skip current user + await idTokenChanges.next; }); tearDown(() async { - await idTokenChanges?.cancel(); + await idTokenChanges.cancel(); await ensureSignedOut(); }); @@ -86,21 +97,21 @@ void setupTests() { String uid = FirebaseAuth.instance.currentUser!.uid; expect( - (await idTokenChanges?.next)?.uid, + (await idTokenChanges.next)?.uid, equals(uid), ); await FirebaseAuth.instance.signOut(); expect( - (await idTokenChanges?.next), + (await idTokenChanges.next), isNull, ); await FirebaseAuth.instance.signInAnonymously(); expect( - (await idTokenChanges?.next)?.uid != uid, + (await idTokenChanges.next)?.uid != uid, isTrue, ); }); From 7df2c89cb646e6877db12ece1ff452c165d177b7 Mon Sep 17 00:00:00 2001 From: David Martos Date: Sat, 29 Jul 2023 02:09:42 +0200 Subject: [PATCH 04/19] correct min Dart SDK --- packages/firebase_auth/firebase_auth_dart/pubspec.yaml | 2 +- .../firebase_auth/firebase_auth_desktop/example/pubspec.yaml | 2 +- packages/firebase_auth/firebase_auth_desktop/pubspec.yaml | 2 +- .../firebase_functions/firebase_functions_dart/pubspec.yaml | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/firebase_auth/firebase_auth_dart/pubspec.yaml b/packages/firebase_auth/firebase_auth_dart/pubspec.yaml index aed40fce..324d37af 100644 --- a/packages/firebase_auth/firebase_auth_dart/pubspec.yaml +++ b/packages/firebase_auth/firebase_auth_dart/pubspec.yaml @@ -5,7 +5,7 @@ repository: https://github.com/invertase/flutterfire_desktop version: 1.0.1 environment: - sdk: '>=2.12.0 <3.0.0' + sdk: '>=2.15.0 <3.0.0' dependencies: firebase_core_dart: ^1.0.1 diff --git a/packages/firebase_auth/firebase_auth_desktop/example/pubspec.yaml b/packages/firebase_auth/firebase_auth_desktop/example/pubspec.yaml index 430440ed..81b82d56 100644 --- a/packages/firebase_auth/firebase_auth_desktop/example/pubspec.yaml +++ b/packages/firebase_auth/firebase_auth_desktop/example/pubspec.yaml @@ -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: '>=2.12.0 <3.0.0' + sdk: '>=2.15.0 <3.0.0' dependencies: crypto: ^3.0.1 diff --git a/packages/firebase_auth/firebase_auth_desktop/pubspec.yaml b/packages/firebase_auth/firebase_auth_desktop/pubspec.yaml index be0f1af7..35c2fe1d 100644 --- a/packages/firebase_auth/firebase_auth_desktop/pubspec.yaml +++ b/packages/firebase_auth/firebase_auth_desktop/pubspec.yaml @@ -5,7 +5,7 @@ repository: https://github.com/invertase/flutterfire_desktop version: 1.0.2 environment: - sdk: '>=2.12.0 <3.0.0' + sdk: '>=2.15.0 <3.0.0' flutter: '>=1.20.0' dependencies: diff --git a/packages/firebase_functions/firebase_functions_dart/pubspec.yaml b/packages/firebase_functions/firebase_functions_dart/pubspec.yaml index fc74fcb7..7d7bd1cc 100644 --- a/packages/firebase_functions/firebase_functions_dart/pubspec.yaml +++ b/packages/firebase_functions/firebase_functions_dart/pubspec.yaml @@ -5,7 +5,7 @@ repository: https://github.com/invertase/flutterfire_desktop version: 0.1.1+2 environment: - sdk: '>=2.12.0 <3.0.0' + sdk: '>=2.15.0 <3.0.0' dependencies: collection: ^1.15.0 From e7ab68eed6f591b71b37c4cc63be0726b7fce423 Mon Sep 17 00:00:00 2001 From: David Martos Date: Sat, 29 Jul 2023 02:18:38 +0200 Subject: [PATCH 05/19] lint --- .../firebase_auth_dart/lib/src/firebase_auth.dart | 2 +- .../lib/src/providers/twitter_auth.dart | 2 +- .../firebase_auth_dart/lib/src/user_metadata.dart | 2 +- .../firebase_auth_desktop/example/lib/auth.dart | 4 ++-- .../firebase_auth_desktop/example/lib/main.dart | 2 +- .../firebase_auth_desktop/test/firebase_auth_test.dart | 10 +++++++--- .../firebase_auth_desktop/test/user_test.dart | 4 +++- .../firebase_core_dart/lib/src/firebase_exception.dart | 2 +- .../firebase_functions_dart/lib/src/exceptions.dart | 2 +- .../test/firebase_functions_integration_test.dart | 6 +++--- tests/lib/main.dart | 2 +- 11 files changed, 22 insertions(+), 16 deletions(-) diff --git a/packages/firebase_auth/firebase_auth_dart/lib/src/firebase_auth.dart b/packages/firebase_auth/firebase_auth_dart/lib/src/firebase_auth.dart index bfae069a..c0138cad 100644 --- a/packages/firebase_auth/firebase_auth_dart/lib/src/firebase_auth.dart +++ b/packages/firebase_auth/firebase_auth_dart/lib/src/firebase_auth.dart @@ -413,7 +413,7 @@ class FirebaseAuth { /// Resolve this by calling [fetchSignInMethodsForEmail] and then asking /// the user to sign in using one of the returned providers. /// Once the user is signed in, the original credential can be linked to - /// the user with [linkWithCredential]. + /// the user with [User.linkWithCredential]. /// - `invalid-credential` /// - Thrown if the credential is malformed or has expired. /// - `operation-not-allowed` diff --git a/packages/firebase_auth/firebase_auth_dart/lib/src/providers/twitter_auth.dart b/packages/firebase_auth/firebase_auth_dart/lib/src/providers/twitter_auth.dart index b0547a74..797ad4cb 100644 --- a/packages/firebase_auth/firebase_auth_dart/lib/src/providers/twitter_auth.dart +++ b/packages/firebase_auth/firebase_auth_dart/lib/src/providers/twitter_auth.dart @@ -72,11 +72,11 @@ class TwitterAuthProvider extends AuthProvider { /// Sets the OAuth custom parameters to pass in a Twitter OAuth request for /// popup and redirect sign-in operations. - // ignore: avoid_returning_this TwitterAuthProvider setCustomParameters( Map customOAuthParameters, ) { _parameters = customOAuthParameters; + // ignore: avoid_returning_this return this; } } diff --git a/packages/firebase_auth/firebase_auth_dart/lib/src/user_metadata.dart b/packages/firebase_auth/firebase_auth_dart/lib/src/user_metadata.dart index 65770d57..e75448f9 100644 --- a/packages/firebase_auth/firebase_auth_dart/lib/src/user_metadata.dart +++ b/packages/firebase_auth/firebase_auth_dart/lib/src/user_metadata.dart @@ -28,6 +28,6 @@ class UserMetadata { @override String toString() { - return 'UserMetadata(creationTime: ${creationTime.toString()}, lastSignInTime: ${lastSignInTime.toString()})'; + return 'UserMetadata(creationTime: $creationTime, lastSignInTime: $lastSignInTime)'; } } diff --git a/packages/firebase_auth/firebase_auth_desktop/example/lib/auth.dart b/packages/firebase_auth/firebase_auth_desktop/example/lib/auth.dart index 24b78912..22575056 100644 --- a/packages/firebase_auth/firebase_auth_desktop/example/lib/auth.dart +++ b/packages/firebase_auth/firebase_auth_desktop/example/lib/auth.dart @@ -426,7 +426,7 @@ class _AuthGateState extends State { if (mode != AuthMode.phone) RichText( text: TextSpan( - style: Theme.of(context).textTheme.bodyText1, + style: Theme.of(context).textTheme.bodyLarge, children: [ TextSpan( text: mode == AuthMode.login @@ -453,7 +453,7 @@ class _AuthGateState extends State { const SizedBox(height: 10), RichText( text: TextSpan( - style: Theme.of(context).textTheme.bodyText1, + style: Theme.of(context).textTheme.bodyLarge, children: [ const TextSpan(text: 'Or '), TextSpan( diff --git a/packages/firebase_auth/firebase_auth_desktop/example/lib/main.dart b/packages/firebase_auth/firebase_auth_desktop/example/lib/main.dart index 38ad1196..40a536e1 100644 --- a/packages/firebase_auth/firebase_auth_desktop/example/lib/main.dart +++ b/packages/firebase_auth/firebase_auth_desktop/example/lib/main.dart @@ -80,7 +80,7 @@ class AuthExampleApp extends StatelessWidget { children: [ Text( 'Firebase Auth Desktop', - style: Theme.of(context).textTheme.headline4, + style: Theme.of(context).textTheme.headlineMedium, ), ], ), diff --git a/packages/firebase_auth/firebase_auth_desktop/test/firebase_auth_test.dart b/packages/firebase_auth/firebase_auth_desktop/test/firebase_auth_test.dart index 40b836b8..f4e6f3ac 100644 --- a/packages/firebase_auth/firebase_auth_desktop/test/firebase_auth_test.dart +++ b/packages/firebase_auth/firebase_auth_desktop/test/firebase_auth_test.dart @@ -171,9 +171,13 @@ void main() { when(mockAuthPlatform.userChanges()).thenAnswer((_) => Stream.fromIterable([mockUserPlatform!])); - MethodChannelFirebaseAuth.channel.setMockMethodCallHandler((call) async { - return {'user': user}; - }); + TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger + .setMockMethodCallHandler( + MethodChannelFirebaseAuth.channel, + (call) async { + return {'user': user}; + }, + ); }); // incremented after tests completed, in case a test may want to use this diff --git a/packages/firebase_auth/firebase_auth_desktop/test/user_test.dart b/packages/firebase_auth/firebase_auth_desktop/test/user_test.dart index 859ac5c5..a5e64dca 100644 --- a/packages/firebase_auth/firebase_auth_desktop/test/user_test.dart +++ b/packages/firebase_auth/firebase_auth_desktop/test/user_test.dart @@ -130,7 +130,9 @@ void main() { languageCode: anyNamed('languageCode'), )).thenAnswer((_) => mockAuthPlatform); - MethodChannelFirebaseAuth.channel.setMockMethodCallHandler((call) async { + TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger + .setMockMethodCallHandler(MethodChannelFirebaseAuth.channel, + (call) async { switch (call.method) { default: return {'user': user}; diff --git a/packages/firebase_core/firebase_core_dart/lib/src/firebase_exception.dart b/packages/firebase_core/firebase_core_dart/lib/src/firebase_exception.dart index 1137ea47..caed936d 100644 --- a/packages/firebase_core/firebase_core_dart/lib/src/firebase_exception.dart +++ b/packages/firebase_core/firebase_core_dart/lib/src/firebase_exception.dart @@ -72,7 +72,7 @@ class FirebaseException implements Exception { var output = '[$plugin/$code] $message'; if (stackTrace != null) { - output += '\n\n${stackTrace.toString()}'; + output += '\n\n$stackTrace'; } return output; diff --git a/packages/firebase_functions/firebase_functions_dart/lib/src/exceptions.dart b/packages/firebase_functions/firebase_functions_dart/lib/src/exceptions.dart index 395c22c6..edd856b1 100644 --- a/packages/firebase_functions/firebase_functions_dart/lib/src/exceptions.dart +++ b/packages/firebase_functions/firebase_functions_dart/lib/src/exceptions.dart @@ -48,7 +48,7 @@ class FirebaseFunctionsException extends FirebaseException output += '\n$details'; } if (stackTrace != null) { - output += '\n\n${stackTrace.toString()}'; + output += '\n\n$stackTrace'; } return output; diff --git a/packages/firebase_functions/firebase_functions_dart/test/firebase_functions_integration_test.dart b/packages/firebase_functions/firebase_functions_dart/test/firebase_functions_integration_test.dart index e8a7aaec..ebf698fc 100644 --- a/packages/firebase_functions/firebase_functions_dart/test/firebase_functions_integration_test.dart +++ b/packages/firebase_functions/firebase_functions_dart/test/firebase_functions_integration_test.dart @@ -145,8 +145,8 @@ Future main() async { group('Authentication', () { late final HttpsCallable httpsCallable; late final FirebaseApp app; - late final config = - StorageBox(app.options.projectId, configPathPrefix: '.firebase-auth'); + late final config = + StorageBox(app.options.projectId, configPathPrefix: '.firebase-auth'); setUp(() async { await emulatorClearAllUsers(); @@ -157,7 +157,7 @@ Future main() async { final functions = FirebaseFunctions.instanceFor(app: app); functions.useFunctionsEmulator('localhost', 5001); httpsCallable = functions.httpsCallable('testFunctionAuthorized'); - + // Clear auth storage config.remove('${app.options.apiKey}:${app.name}'); }); diff --git a/tests/lib/main.dart b/tests/lib/main.dart index 79a78e40..fd8a7f30 100644 --- a/tests/lib/main.dart +++ b/tests/lib/main.dart @@ -115,7 +115,7 @@ class _MyHomePageState extends State { ), Text( '$_counter', - style: Theme.of(context).textTheme.headline4, + style: Theme.of(context).textTheme.headlineMedium, ), ], ), From 64aa104fa02510deae3c5f2696f068f83aad7cdb Mon Sep 17 00:00:00 2001 From: David Martos Date: Sat, 29 Jul 2023 02:44:56 +0200 Subject: [PATCH 06/19] regenerate desktop auth example app on linux --- .../firebase_auth_desktop/example/.metadata | 24 +++++++++++- .../example/analysis_options.yaml | 29 ++++++++++++++ .../example/linux/.gitignore | 2 - .../example/linux/CMakeLists.txt | 39 +++++++++++++++---- .../example/linux/flutter/CMakeLists.txt | 1 + .../flutter/generated_plugin_registrant.cc | 19 +++++++++ .../flutter/generated_plugin_registrant.h | 15 +++++++ .../linux/flutter/generated_plugins.cmake | 25 ++++++++++++ .../example/linux/my_application.cc | 19 +++++---- .../example/pubspec.yaml | 4 +- 10 files changed, 153 insertions(+), 24 deletions(-) create mode 100644 packages/firebase_auth/firebase_auth_desktop/example/analysis_options.yaml create mode 100644 packages/firebase_auth/firebase_auth_desktop/example/linux/flutter/generated_plugin_registrant.cc create mode 100644 packages/firebase_auth/firebase_auth_desktop/example/linux/flutter/generated_plugin_registrant.h create mode 100644 packages/firebase_auth/firebase_auth_desktop/example/linux/flutter/generated_plugins.cmake diff --git a/packages/firebase_auth/firebase_auth_desktop/example/.metadata b/packages/firebase_auth/firebase_auth_desktop/example/.metadata index 56bfc2c4..aa80d568 100644 --- a/packages/firebase_auth/firebase_auth_desktop/example/.metadata +++ b/packages/firebase_auth/firebase_auth_desktop/example/.metadata @@ -1,10 +1,30 @@ # This file tracks properties of this Flutter project. # Used by Flutter tool to assess capabilities and perform upgrades etc. # -# This file should be version controlled and should not be manually edited. +# This file should be version controlled. version: - revision: f4abaa0735eba4dfd8f33f73363911d63931fe03 + revision: f468f3366c26a5092eb964a230ce7892fda8f2f8 channel: stable project_type: app + +# Tracks metadata for the flutter migrate command +migration: + platforms: + - platform: root + create_revision: f468f3366c26a5092eb964a230ce7892fda8f2f8 + base_revision: f468f3366c26a5092eb964a230ce7892fda8f2f8 + - platform: linux + create_revision: f468f3366c26a5092eb964a230ce7892fda8f2f8 + base_revision: f468f3366c26a5092eb964a230ce7892fda8f2f8 + + # User provided section + + # List of Local paths (relative to this file) that should be + # ignored by the migrate tool. + # + # Files that are not part of the templates will be ignored by default. + unmanaged_files: + - 'lib/main.dart' + - 'ios/Runner.xcodeproj/project.pbxproj' diff --git a/packages/firebase_auth/firebase_auth_desktop/example/analysis_options.yaml b/packages/firebase_auth/firebase_auth_desktop/example/analysis_options.yaml new file mode 100644 index 00000000..61b6c4de --- /dev/null +++ b/packages/firebase_auth/firebase_auth_desktop/example/analysis_options.yaml @@ -0,0 +1,29 @@ +# This file configures the analyzer, which statically analyzes Dart code to +# check for errors, warnings, and lints. +# +# The issues identified by the analyzer are surfaced in the UI of Dart-enabled +# IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be +# invoked from the command line by running `flutter analyze`. + +# The following line activates a set of recommended lints for Flutter apps, +# packages, and plugins designed to encourage good coding practices. +include: package:flutter_lints/flutter.yaml + +linter: + # The lint rules applied to this project can be customized in the + # section below to disable rules from the `package:flutter_lints/flutter.yaml` + # included above or to enable additional rules. A list of all available lints + # and their documentation is published at + # https://dart-lang.github.io/linter/lints/index.html. + # + # Instead of disabling a lint rule for the entire project in the + # section below, it can also be suppressed for a single line of code + # or a specific dart file by using the `// ignore: name_of_lint` and + # `// ignore_for_file: name_of_lint` syntax on the line or in the file + # producing the lint. + rules: + # avoid_print: false # Uncomment to disable the `avoid_print` rule + # prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule + +# Additional information about this file can be found at +# https://dart.dev/guides/language/analysis-options diff --git a/packages/firebase_auth/firebase_auth_desktop/example/linux/.gitignore b/packages/firebase_auth/firebase_auth_desktop/example/linux/.gitignore index 2b96011e..d3896c98 100644 --- a/packages/firebase_auth/firebase_auth_desktop/example/linux/.gitignore +++ b/packages/firebase_auth/firebase_auth_desktop/example/linux/.gitignore @@ -1,3 +1 @@ flutter/ephemeral -flutter/generated_plugin_registrant.* -flutter/generated_plugins.cmake diff --git a/packages/firebase_auth/firebase_auth_desktop/example/linux/CMakeLists.txt b/packages/firebase_auth/firebase_auth_desktop/example/linux/CMakeLists.txt index 2d7085ea..9b6d9714 100644 --- a/packages/firebase_auth/firebase_auth_desktop/example/linux/CMakeLists.txt +++ b/packages/firebase_auth/firebase_auth_desktop/example/linux/CMakeLists.txt @@ -1,11 +1,19 @@ +# Project-level configuration. cmake_minimum_required(VERSION 3.10) project(runner LANGUAGES CXX) +# The name of the executable created for the application. Change this to change +# the on-disk name of your application. set(BINARY_NAME "firebase_auth_desktop_example") -set(APPLICATION_ID "com.example.firebase_auth_desktop") +# The unique GTK application identifier for this application. See: +# https://wiki.gnome.org/HowDoI/ChooseApplicationID +set(APPLICATION_ID "com.example.firebase_auth_desktop_example") +# Explicitly opt in to modern CMake behaviors to avoid warnings with recent +# versions of CMake. cmake_policy(SET CMP0063 NEW) +# Load bundled libraries from the lib/ directory relative to the binary. set(CMAKE_INSTALL_RPATH "$ORIGIN/lib") # Root filesystem for cross-building. @@ -18,7 +26,7 @@ if(FLUTTER_TARGET_PLATFORM_SYSROOT) set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) endif() -# Configure build options. +# Define build configuration options. if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) set(CMAKE_BUILD_TYPE "Debug" CACHE STRING "Flutter build mode" FORCE) @@ -27,6 +35,10 @@ if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) endif() # Compilation settings that should be applied to most targets. +# +# Be cautious about adding new options here, as plugins use this function by +# default. In most cases, you should add new options to specific targets instead +# of modifying this function. function(APPLY_STANDARD_SETTINGS TARGET) target_compile_features(${TARGET} PUBLIC cxx_std_14) target_compile_options(${TARGET} PRIVATE -Wall -Werror) @@ -34,9 +46,8 @@ function(APPLY_STANDARD_SETTINGS TARGET) target_compile_definitions(${TARGET} PRIVATE "$<$>:NDEBUG>") endfunction() -set(FLUTTER_MANAGED_DIR "${CMAKE_CURRENT_SOURCE_DIR}/flutter") - # Flutter library and tool build rules. +set(FLUTTER_MANAGED_DIR "${CMAKE_CURRENT_SOURCE_DIR}/flutter") add_subdirectory(${FLUTTER_MANAGED_DIR}) # System-level dependencies. @@ -45,16 +56,27 @@ pkg_check_modules(GTK REQUIRED IMPORTED_TARGET gtk+-3.0) add_definitions(-DAPPLICATION_ID="${APPLICATION_ID}") -# Application build +# Define the application target. To change its name, change BINARY_NAME above, +# not the value here, or `flutter run` will no longer work. +# +# Any new source files that you add to the application should be added here. add_executable(${BINARY_NAME} "main.cc" "my_application.cc" "${FLUTTER_MANAGED_DIR}/generated_plugin_registrant.cc" ) + +# Apply the standard set of build settings. This can be removed for applications +# that need different build settings. apply_standard_settings(${BINARY_NAME}) + +# Add dependency libraries. Add any application-specific dependencies here. target_link_libraries(${BINARY_NAME} PRIVATE flutter) target_link_libraries(${BINARY_NAME} PRIVATE PkgConfig::GTK) + +# Run the Flutter tool portions of the build. This must not be removed. add_dependencies(${BINARY_NAME} flutter_assemble) + # Only the install-generated bundle's copy of the executable will launch # correctly, since the resources must in the right relative locations. To avoid # people trying to run the unbundled copy, put it in a subdirectory instead of @@ -64,6 +86,7 @@ set_target_properties(${BINARY_NAME} RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/intermediates_do_not_run" ) + # Generated plugin build rules, which manage building the plugins and adding # them to the application. include(flutter/generated_plugins.cmake) @@ -94,11 +117,11 @@ install(FILES "${FLUTTER_ICU_DATA_FILE}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR} install(FILES "${FLUTTER_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" COMPONENT Runtime) -if(PLUGIN_BUNDLED_LIBRARIES) - install(FILES "${PLUGIN_BUNDLED_LIBRARIES}" +foreach(bundled_library ${PLUGIN_BUNDLED_LIBRARIES}) + install(FILES "${bundled_library}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" COMPONENT Runtime) -endif() +endforeach(bundled_library) # Fully re-copy the assets directory on each build to avoid having stale files # from a previous install. diff --git a/packages/firebase_auth/firebase_auth_desktop/example/linux/flutter/CMakeLists.txt b/packages/firebase_auth/firebase_auth_desktop/example/linux/flutter/CMakeLists.txt index 33fd5801..d5bd0164 100644 --- a/packages/firebase_auth/firebase_auth_desktop/example/linux/flutter/CMakeLists.txt +++ b/packages/firebase_auth/firebase_auth_desktop/example/linux/flutter/CMakeLists.txt @@ -1,3 +1,4 @@ +# This file controls Flutter-level build steps. It should not be edited. cmake_minimum_required(VERSION 3.10) set(EPHEMERAL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/ephemeral") diff --git a/packages/firebase_auth/firebase_auth_desktop/example/linux/flutter/generated_plugin_registrant.cc b/packages/firebase_auth/firebase_auth_desktop/example/linux/flutter/generated_plugin_registrant.cc new file mode 100644 index 00000000..f10ce1c4 --- /dev/null +++ b/packages/firebase_auth/firebase_auth_desktop/example/linux/flutter/generated_plugin_registrant.cc @@ -0,0 +1,19 @@ +// +// Generated file. Do not edit. +// + +// clang-format off + +#include "generated_plugin_registrant.h" + +#include +#include + +void fl_register_plugins(FlPluginRegistry* registry) { + g_autoptr(FlPluginRegistrar) desktop_webview_auth_registrar = + fl_plugin_registry_get_registrar_for_plugin(registry, "DesktopWebviewAuthPlugin"); + desktop_webview_auth_plugin_register_with_registrar(desktop_webview_auth_registrar); + g_autoptr(FlPluginRegistrar) url_launcher_linux_registrar = + fl_plugin_registry_get_registrar_for_plugin(registry, "UrlLauncherPlugin"); + url_launcher_plugin_register_with_registrar(url_launcher_linux_registrar); +} diff --git a/packages/firebase_auth/firebase_auth_desktop/example/linux/flutter/generated_plugin_registrant.h b/packages/firebase_auth/firebase_auth_desktop/example/linux/flutter/generated_plugin_registrant.h new file mode 100644 index 00000000..e0f0a47b --- /dev/null +++ b/packages/firebase_auth/firebase_auth_desktop/example/linux/flutter/generated_plugin_registrant.h @@ -0,0 +1,15 @@ +// +// Generated file. Do not edit. +// + +// clang-format off + +#ifndef GENERATED_PLUGIN_REGISTRANT_ +#define GENERATED_PLUGIN_REGISTRANT_ + +#include + +// Registers Flutter plugins. +void fl_register_plugins(FlPluginRegistry* registry); + +#endif // GENERATED_PLUGIN_REGISTRANT_ diff --git a/packages/firebase_auth/firebase_auth_desktop/example/linux/flutter/generated_plugins.cmake b/packages/firebase_auth/firebase_auth_desktop/example/linux/flutter/generated_plugins.cmake new file mode 100644 index 00000000..918b6b47 --- /dev/null +++ b/packages/firebase_auth/firebase_auth_desktop/example/linux/flutter/generated_plugins.cmake @@ -0,0 +1,25 @@ +# +# Generated file, do not edit. +# + +list(APPEND FLUTTER_PLUGIN_LIST + desktop_webview_auth + url_launcher_linux +) + +list(APPEND FLUTTER_FFI_PLUGIN_LIST +) + +set(PLUGIN_BUNDLED_LIBRARIES) + +foreach(plugin ${FLUTTER_PLUGIN_LIST}) + add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/linux plugins/${plugin}) + target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin) + list(APPEND PLUGIN_BUNDLED_LIBRARIES $) + list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) +endforeach(plugin) + +foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST}) + add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/linux plugins/${ffi_plugin}) + list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries}) +endforeach(ffi_plugin) diff --git a/packages/firebase_auth/firebase_auth_desktop/example/linux/my_application.cc b/packages/firebase_auth/firebase_auth_desktop/example/linux/my_application.cc index 15de46e2..3670315f 100644 --- a/packages/firebase_auth/firebase_auth_desktop/example/linux/my_application.cc +++ b/packages/firebase_auth/firebase_auth_desktop/example/linux/my_application.cc @@ -29,22 +29,21 @@ static void my_application_activate(GApplication* application) { // if future cases occur). gboolean use_header_bar = TRUE; #ifdef GDK_WINDOWING_X11 - GdkScreen *screen = gtk_window_get_screen(window); + GdkScreen* screen = gtk_window_get_screen(window); if (GDK_IS_X11_SCREEN(screen)) { - const gchar* wm_name = gdk_x11_screen_get_window_manager_name(screen); - if (g_strcmp0(wm_name, "GNOME Shell") != 0) { - use_header_bar = FALSE; - } + const gchar* wm_name = gdk_x11_screen_get_window_manager_name(screen); + if (g_strcmp0(wm_name, "GNOME Shell") != 0) { + use_header_bar = FALSE; + } } #endif if (use_header_bar) { - GtkHeaderBar *header_bar = GTK_HEADER_BAR(gtk_header_bar_new()); + GtkHeaderBar* header_bar = GTK_HEADER_BAR(gtk_header_bar_new()); gtk_widget_show(GTK_WIDGET(header_bar)); gtk_header_bar_set_title(header_bar, "firebase_auth_desktop_example"); gtk_header_bar_set_show_close_button(header_bar, TRUE); gtk_window_set_titlebar(window, GTK_WIDGET(header_bar)); - } - else { + } else { gtk_window_set_title(window, "firebase_auth_desktop_example"); } @@ -64,7 +63,7 @@ static void my_application_activate(GApplication* application) { } // Implements GApplication::local_command_line. -static gboolean my_application_local_command_line(GApplication* application, gchar ***arguments, int *exit_status) { +static gboolean my_application_local_command_line(GApplication* application, gchar*** arguments, int* exit_status) { MyApplication* self = MY_APPLICATION(application); // Strip out the first argument as it is the binary name. self->dart_entrypoint_arguments = g_strdupv(*arguments + 1); @@ -83,7 +82,7 @@ static gboolean my_application_local_command_line(GApplication* application, gch } // Implements GObject::dispose. -static void my_application_dispose(GObject *object) { +static void my_application_dispose(GObject* object) { MyApplication* self = MY_APPLICATION(object); g_clear_pointer(&self->dart_entrypoint_arguments, g_strfreev); G_OBJECT_CLASS(my_application_parent_class)->dispose(object); diff --git a/packages/firebase_auth/firebase_auth_desktop/example/pubspec.yaml b/packages/firebase_auth/firebase_auth_desktop/example/pubspec.yaml index 81b82d56..62119f2f 100644 --- a/packages/firebase_auth/firebase_auth_desktop/example/pubspec.yaml +++ b/packages/firebase_auth/firebase_auth_desktop/example/pubspec.yaml @@ -23,9 +23,9 @@ environment: dependencies: crypto: ^3.0.1 desktop_webview_auth: ^0.0.9 - firebase_auth: ^3.4.1 + firebase_auth: 4.6.3 firebase_auth_desktop: ^1.0.2 - firebase_core: ^1.19.1 + firebase_core: ^2.15.0 firebase_core_desktop: ^1.0.2 flutter: sdk: flutter From 485527fc57b17097faec0a8ac467a9f5d84e1ab1 Mon Sep 17 00:00:00 2001 From: David Martos Date: Fri, 28 Jul 2023 20:00:02 +0200 Subject: [PATCH 07/19] path overrides in example app --- .../firebase_auth_desktop/example/pubspec.yaml | 6 +++++- packages/firebase_core/firebase_core_desktop/pubspec.yaml | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/firebase_auth/firebase_auth_desktop/example/pubspec.yaml b/packages/firebase_auth/firebase_auth_desktop/example/pubspec.yaml index 62119f2f..107b68af 100644 --- a/packages/firebase_auth/firebase_auth_desktop/example/pubspec.yaml +++ b/packages/firebase_auth/firebase_auth_desktop/example/pubspec.yaml @@ -31,7 +31,7 @@ dependencies: sdk: flutter flutter_lints: ^1.0.4 flutter_signin_button: ^2.0.0 - google_sign_in: ^5.0.0-nullsafety + google_sign_in: ^6.1.4 google_sign_in_dartio: ^0.2.0 sign_in_with_apple: ^3.3.0 yaru: ^0.2.0 @@ -39,8 +39,12 @@ dependencies: dependency_overrides: firebase_auth_desktop: path: ../ + firebase_auth_dart: + path: ../../firebase_auth_dart firebase_core_desktop: path: ../../../firebase_core/firebase_core_desktop + firebase_core_dart: + path: ../../../firebase_core/firebase_core_dart dev_dependencies: flutter_test: diff --git a/packages/firebase_core/firebase_core_desktop/pubspec.yaml b/packages/firebase_core/firebase_core_desktop/pubspec.yaml index 73a9e826..74d4af32 100644 --- a/packages/firebase_core/firebase_core_desktop/pubspec.yaml +++ b/packages/firebase_core/firebase_core_desktop/pubspec.yaml @@ -16,7 +16,7 @@ dependencies: meta: ^1.3.0 dev_dependencies: - firebase_core: ^2.15.0 + firebase_core: ^2.0.0 flutter_test: sdk: flutter mockito: ^5.0.0 From ac09e06c43cceda43983986c5cc9449b0306e3c6 Mon Sep 17 00:00:00 2001 From: David Martos Date: Sat, 29 Jul 2023 09:04:33 +0200 Subject: [PATCH 08/19] update dependencies in example app --- .../example/linux/flutter/generated_plugin_registrant.cc | 4 ++++ .../example/linux/flutter/generated_plugins.cmake | 1 + .../firebase_auth_desktop/example/pubspec.yaml | 8 ++++---- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/packages/firebase_auth/firebase_auth_desktop/example/linux/flutter/generated_plugin_registrant.cc b/packages/firebase_auth/firebase_auth_desktop/example/linux/flutter/generated_plugin_registrant.cc index f10ce1c4..842c4f50 100644 --- a/packages/firebase_auth/firebase_auth_desktop/example/linux/flutter/generated_plugin_registrant.cc +++ b/packages/firebase_auth/firebase_auth_desktop/example/linux/flutter/generated_plugin_registrant.cc @@ -7,12 +7,16 @@ #include "generated_plugin_registrant.h" #include +#include #include void fl_register_plugins(FlPluginRegistry* registry) { g_autoptr(FlPluginRegistrar) desktop_webview_auth_registrar = fl_plugin_registry_get_registrar_for_plugin(registry, "DesktopWebviewAuthPlugin"); desktop_webview_auth_plugin_register_with_registrar(desktop_webview_auth_registrar); + g_autoptr(FlPluginRegistrar) gtk_registrar = + fl_plugin_registry_get_registrar_for_plugin(registry, "GtkPlugin"); + gtk_plugin_register_with_registrar(gtk_registrar); g_autoptr(FlPluginRegistrar) url_launcher_linux_registrar = fl_plugin_registry_get_registrar_for_plugin(registry, "UrlLauncherPlugin"); url_launcher_plugin_register_with_registrar(url_launcher_linux_registrar); diff --git a/packages/firebase_auth/firebase_auth_desktop/example/linux/flutter/generated_plugins.cmake b/packages/firebase_auth/firebase_auth_desktop/example/linux/flutter/generated_plugins.cmake index 918b6b47..9b84bf21 100644 --- a/packages/firebase_auth/firebase_auth_desktop/example/linux/flutter/generated_plugins.cmake +++ b/packages/firebase_auth/firebase_auth_desktop/example/linux/flutter/generated_plugins.cmake @@ -4,6 +4,7 @@ list(APPEND FLUTTER_PLUGIN_LIST desktop_webview_auth + gtk url_launcher_linux ) diff --git a/packages/firebase_auth/firebase_auth_desktop/example/pubspec.yaml b/packages/firebase_auth/firebase_auth_desktop/example/pubspec.yaml index 107b68af..89759447 100644 --- a/packages/firebase_auth/firebase_auth_desktop/example/pubspec.yaml +++ b/packages/firebase_auth/firebase_auth_desktop/example/pubspec.yaml @@ -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: '>=2.15.0 <3.0.0' + sdk: '>=3.0.0 <4.0.0' dependencies: crypto: ^3.0.1 @@ -29,12 +29,11 @@ dependencies: firebase_core_desktop: ^1.0.2 flutter: sdk: flutter - flutter_lints: ^1.0.4 flutter_signin_button: ^2.0.0 google_sign_in: ^6.1.4 google_sign_in_dartio: ^0.2.0 - sign_in_with_apple: ^3.3.0 - yaru: ^0.2.0 + sign_in_with_apple: ^5.0.0 + yaru: ^0.9.0 dependency_overrides: firebase_auth_desktop: @@ -49,6 +48,7 @@ dependency_overrides: dev_dependencies: flutter_test: sdk: flutter + flutter_lints: ^2.0.2 # For information on the generic Dart part of this file, see the # following page: https://dart.dev/tools/pub/pubspec From 4976da19d4acb1533ee94c2e8c4d2e6d76c4594f Mon Sep 17 00:00:00 2001 From: David Martos Date: Sat, 29 Jul 2023 09:10:37 +0200 Subject: [PATCH 09/19] actions in pr branch --- .github/workflows/validate.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/validate.yaml b/.github/workflows/validate.yaml index dba0c8f4..9cc51469 100644 --- a/.github/workflows/validate.yaml +++ b/.github/workflows/validate.yaml @@ -4,6 +4,7 @@ on: push: branches: - main + - fixes jobs: analyze: From 29f8eb00be33e3a8efc10863e475b989e2634a96 Mon Sep 17 00:00:00 2001 From: David Martos Date: Sat, 29 Jul 2023 09:24:27 +0200 Subject: [PATCH 10/19] update melos to 3.1.1 --- .github/workflows/scripts/install-tools.sh | 2 +- .../firebase_auth_dart/example/pubspec.yaml | 5 ----- .../example/pubspec_overrides.yaml | 6 ++++++ .../firebase_auth_dart/pubspec_overrides.yaml | 4 ++++ .../firebase_auth_desktop/example/pubspec.yaml | 10 ---------- .../example/pubspec_overrides.yaml | 10 ++++++++++ .../firebase_auth_desktop/pubspec_overrides.yaml | 6 ++++++ .../firebase_core_desktop/example/pubspec.yaml | 5 ----- .../example/pubspec_overrides.yaml | 6 ++++++ .../firebase_core_desktop/pubspec_overrides.yaml | 4 ++++ .../firebase_functions_dart/pubspec_overrides.yaml | 6 ++++++ .../example/pubspec.yaml | 6 ------ .../example/pubspec_overrides.yaml | 12 ++++++++++++ .../pubspec_overrides.yaml | 10 ++++++++++ tests/pubspec.yaml | 14 -------------- tests/pubspec_overrides.yaml | 14 ++++++++++++++ 16 files changed, 79 insertions(+), 41 deletions(-) create mode 100644 packages/firebase_auth/firebase_auth_dart/example/pubspec_overrides.yaml create mode 100644 packages/firebase_auth/firebase_auth_dart/pubspec_overrides.yaml create mode 100644 packages/firebase_auth/firebase_auth_desktop/example/pubspec_overrides.yaml create mode 100644 packages/firebase_auth/firebase_auth_desktop/pubspec_overrides.yaml create mode 100644 packages/firebase_core/firebase_core_desktop/example/pubspec_overrides.yaml create mode 100644 packages/firebase_core/firebase_core_desktop/pubspec_overrides.yaml create mode 100644 packages/firebase_functions/firebase_functions_dart/pubspec_overrides.yaml create mode 100644 packages/firebase_functions/firebase_functions_desktop/example/pubspec_overrides.yaml create mode 100644 packages/firebase_functions/firebase_functions_desktop/pubspec_overrides.yaml create mode 100644 tests/pubspec_overrides.yaml diff --git a/.github/workflows/scripts/install-tools.sh b/.github/workflows/scripts/install-tools.sh index 552c36bb..2d5ed19d 100755 --- a/.github/workflows/scripts/install-tools.sh +++ b/.github/workflows/scripts/install-tools.sh @@ -1,3 +1,3 @@ #!/bin/bash -dart pub global activate melos 1.0.0 +dart pub global activate melos 3.1.1 melos bootstrap diff --git a/packages/firebase_auth/firebase_auth_dart/example/pubspec.yaml b/packages/firebase_auth/firebase_auth_dart/example/pubspec.yaml index 6d2630f7..14bd4151 100644 --- a/packages/firebase_auth/firebase_auth_dart/example/pubspec.yaml +++ b/packages/firebase_auth/firebase_auth_dart/example/pubspec.yaml @@ -15,8 +15,3 @@ dependencies: cli_util: ^0.3.5 firebase_auth_dart: ^1.0.1 firebase_core_dart: ^1.0.1 -dependency_overrides: - firebase_auth_dart: - path: ../ - firebase_core_dart: - path: ../../../firebase_core/firebase_core_dart diff --git a/packages/firebase_auth/firebase_auth_dart/example/pubspec_overrides.yaml b/packages/firebase_auth/firebase_auth_dart/example/pubspec_overrides.yaml new file mode 100644 index 00000000..19d88812 --- /dev/null +++ b/packages/firebase_auth/firebase_auth_dart/example/pubspec_overrides.yaml @@ -0,0 +1,6 @@ +# melos_managed_dependency_overrides: firebase_auth_dart,firebase_core_dart +dependency_overrides: + firebase_auth_dart: + path: ../ + firebase_core_dart: + path: ../../../firebase_core/firebase_core_dart diff --git a/packages/firebase_auth/firebase_auth_dart/pubspec_overrides.yaml b/packages/firebase_auth/firebase_auth_dart/pubspec_overrides.yaml new file mode 100644 index 00000000..8b8142e6 --- /dev/null +++ b/packages/firebase_auth/firebase_auth_dart/pubspec_overrides.yaml @@ -0,0 +1,4 @@ +# melos_managed_dependency_overrides: firebase_core_dart +dependency_overrides: + firebase_core_dart: + path: ../../firebase_core/firebase_core_dart diff --git a/packages/firebase_auth/firebase_auth_desktop/example/pubspec.yaml b/packages/firebase_auth/firebase_auth_desktop/example/pubspec.yaml index 89759447..de7be08f 100644 --- a/packages/firebase_auth/firebase_auth_desktop/example/pubspec.yaml +++ b/packages/firebase_auth/firebase_auth_desktop/example/pubspec.yaml @@ -35,16 +35,6 @@ dependencies: sign_in_with_apple: ^5.0.0 yaru: ^0.9.0 -dependency_overrides: - firebase_auth_desktop: - path: ../ - firebase_auth_dart: - path: ../../firebase_auth_dart - firebase_core_desktop: - path: ../../../firebase_core/firebase_core_desktop - firebase_core_dart: - path: ../../../firebase_core/firebase_core_dart - dev_dependencies: flutter_test: sdk: flutter diff --git a/packages/firebase_auth/firebase_auth_desktop/example/pubspec_overrides.yaml b/packages/firebase_auth/firebase_auth_desktop/example/pubspec_overrides.yaml new file mode 100644 index 00000000..ce6407bd --- /dev/null +++ b/packages/firebase_auth/firebase_auth_desktop/example/pubspec_overrides.yaml @@ -0,0 +1,10 @@ +# melos_managed_dependency_overrides: firebase_auth_dart,firebase_auth_desktop,firebase_core_dart,firebase_core_desktop +dependency_overrides: + firebase_auth_dart: + path: ../../firebase_auth_dart + firebase_auth_desktop: + path: ../ + firebase_core_dart: + path: ../../../firebase_core/firebase_core_dart + firebase_core_desktop: + path: ../../../firebase_core/firebase_core_desktop diff --git a/packages/firebase_auth/firebase_auth_desktop/pubspec_overrides.yaml b/packages/firebase_auth/firebase_auth_desktop/pubspec_overrides.yaml new file mode 100644 index 00000000..1273e8be --- /dev/null +++ b/packages/firebase_auth/firebase_auth_desktop/pubspec_overrides.yaml @@ -0,0 +1,6 @@ +# melos_managed_dependency_overrides: firebase_auth_dart,firebase_core_dart +dependency_overrides: + firebase_auth_dart: + path: ../firebase_auth_dart + firebase_core_dart: + path: ../../firebase_core/firebase_core_dart diff --git a/packages/firebase_core/firebase_core_desktop/example/pubspec.yaml b/packages/firebase_core/firebase_core_desktop/example/pubspec.yaml index 51d38853..26dfec85 100644 --- a/packages/firebase_core/firebase_core_desktop/example/pubspec.yaml +++ b/packages/firebase_core/firebase_core_desktop/example/pubspec.yaml @@ -26,10 +26,6 @@ dependencies: flutter: sdk: flutter -dependency_overrides: - firebase_core_desktop: - path: ../ - dev_dependencies: flutter_test: sdk: flutter @@ -38,7 +34,6 @@ dev_dependencies: # following page: https://dart.dev/tools/pub/pubspec # The following section is specific to Flutter. flutter: - # The following line ensures that the Material Icons font is # included with your application, so that you can use the icons in # the material Icons class. diff --git a/packages/firebase_core/firebase_core_desktop/example/pubspec_overrides.yaml b/packages/firebase_core/firebase_core_desktop/example/pubspec_overrides.yaml new file mode 100644 index 00000000..d89d61d6 --- /dev/null +++ b/packages/firebase_core/firebase_core_desktop/example/pubspec_overrides.yaml @@ -0,0 +1,6 @@ +# melos_managed_dependency_overrides: firebase_core_dart,firebase_core_desktop +dependency_overrides: + firebase_core_dart: + path: ../../firebase_core_dart + firebase_core_desktop: + path: ../ diff --git a/packages/firebase_core/firebase_core_desktop/pubspec_overrides.yaml b/packages/firebase_core/firebase_core_desktop/pubspec_overrides.yaml new file mode 100644 index 00000000..a916a3c6 --- /dev/null +++ b/packages/firebase_core/firebase_core_desktop/pubspec_overrides.yaml @@ -0,0 +1,4 @@ +# melos_managed_dependency_overrides: firebase_core_dart +dependency_overrides: + firebase_core_dart: + path: ../firebase_core_dart diff --git a/packages/firebase_functions/firebase_functions_dart/pubspec_overrides.yaml b/packages/firebase_functions/firebase_functions_dart/pubspec_overrides.yaml new file mode 100644 index 00000000..e663c0dd --- /dev/null +++ b/packages/firebase_functions/firebase_functions_dart/pubspec_overrides.yaml @@ -0,0 +1,6 @@ +# melos_managed_dependency_overrides: firebase_auth_dart,firebase_core_dart +dependency_overrides: + firebase_auth_dart: + path: ../../firebase_auth/firebase_auth_dart + firebase_core_dart: + path: ../../firebase_core/firebase_core_dart diff --git a/packages/firebase_functions/firebase_functions_desktop/example/pubspec.yaml b/packages/firebase_functions/firebase_functions_desktop/example/pubspec.yaml index 54452db5..85558556 100644 --- a/packages/firebase_functions/firebase_functions_desktop/example/pubspec.yaml +++ b/packages/firebase_functions/firebase_functions_desktop/example/pubspec.yaml @@ -28,12 +28,6 @@ dependencies: flutter: sdk: flutter -dependency_overrides: - firebase_core_desktop: - path: ../../../firebase_core/firebase_core_desktop - firebase_functions_desktop: - path: ../ - dev_dependencies: flutter_test: sdk: flutter diff --git a/packages/firebase_functions/firebase_functions_desktop/example/pubspec_overrides.yaml b/packages/firebase_functions/firebase_functions_desktop/example/pubspec_overrides.yaml new file mode 100644 index 00000000..fcffdd6b --- /dev/null +++ b/packages/firebase_functions/firebase_functions_desktop/example/pubspec_overrides.yaml @@ -0,0 +1,12 @@ +# melos_managed_dependency_overrides: firebase_auth_dart,firebase_core_dart,firebase_core_desktop,firebase_functions_dart,firebase_functions_desktop +dependency_overrides: + firebase_auth_dart: + path: ../../../firebase_auth/firebase_auth_dart + firebase_core_dart: + path: ../../../firebase_core/firebase_core_dart + firebase_core_desktop: + path: ../../../firebase_core/firebase_core_desktop + firebase_functions_dart: + path: ../../firebase_functions_dart + firebase_functions_desktop: + path: ../ diff --git a/packages/firebase_functions/firebase_functions_desktop/pubspec_overrides.yaml b/packages/firebase_functions/firebase_functions_desktop/pubspec_overrides.yaml new file mode 100644 index 00000000..8c58ab3e --- /dev/null +++ b/packages/firebase_functions/firebase_functions_desktop/pubspec_overrides.yaml @@ -0,0 +1,10 @@ +# melos_managed_dependency_overrides: firebase_auth_dart,firebase_core_dart,firebase_core_desktop,firebase_functions_dart +dependency_overrides: + firebase_auth_dart: + path: ../../firebase_auth/firebase_auth_dart + firebase_core_dart: + path: ../../firebase_core/firebase_core_dart + firebase_core_desktop: + path: ../../firebase_core/firebase_core_desktop + firebase_functions_dart: + path: ../firebase_functions_dart diff --git a/tests/pubspec.yaml b/tests/pubspec.yaml index 0927fc4c..94e58358 100644 --- a/tests/pubspec.yaml +++ b/tests/pubspec.yaml @@ -45,20 +45,6 @@ dependencies: flutter: sdk: flutter -dependency_overrides: - firebase_auth_desktop: - path: ../packages/firebase_auth/firebase_auth_desktop - firebase_auth_dart: - path: ../packages/firebase_auth/firebase_auth_dart - firebase_core_desktop: - path: ../packages/firebase_core/firebase_core_desktop - firebase_core_dart: - path: ../packages/firebase_core/firebase_core_dart - firebase_functions_desktop: - path: ../packages/firebase_functions/firebase_functions_desktop - firebase_functions_dart: - path: ../packages/firebase_functions/firebase_functions_dart - dev_dependencies: drive: ^1.0.0-1.0.nullsafety.5 flutter_driver: diff --git a/tests/pubspec_overrides.yaml b/tests/pubspec_overrides.yaml new file mode 100644 index 00000000..f0b7576c --- /dev/null +++ b/tests/pubspec_overrides.yaml @@ -0,0 +1,14 @@ +# melos_managed_dependency_overrides: firebase_auth_dart,firebase_auth_desktop,firebase_core_dart,firebase_core_desktop,firebase_functions_dart,firebase_functions_desktop +dependency_overrides: + firebase_auth_dart: + path: ../packages/firebase_auth/firebase_auth_dart + firebase_auth_desktop: + path: ../packages/firebase_auth/firebase_auth_desktop + firebase_core_dart: + path: ../packages/firebase_core/firebase_core_dart + firebase_core_desktop: + path: ../packages/firebase_core/firebase_core_desktop + firebase_functions_dart: + path: ../packages/firebase_functions/firebase_functions_dart + firebase_functions_desktop: + path: ../packages/firebase_functions/firebase_functions_desktop From 24889ec25686c63e1bd08f93281cd6b0a9273c89 Mon Sep 17 00:00:00 2001 From: David Martos Date: Sat, 29 Jul 2023 09:28:02 +0200 Subject: [PATCH 11/19] root pubspec.yaml --- .gitignore | 1 - .../firebase_auth_dart/example/pubspec_overrides.yaml | 2 +- .../firebase_auth_desktop/example/pubspec_overrides.yaml | 2 +- .../firebase_core_desktop/example/pubspec_overrides.yaml | 2 +- .../example/pubspec_overrides.yaml | 2 +- pubspec.yaml | 7 +++++++ 6 files changed, 11 insertions(+), 5 deletions(-) create mode 100644 pubspec.yaml diff --git a/.gitignore b/.gitignore index 2024149f..24b4f10a 100644 --- a/.gitignore +++ b/.gitignore @@ -48,7 +48,6 @@ build/ .project .classpath .settings -/pubspec.yaml .last_build_id # Docs diff --git a/packages/firebase_auth/firebase_auth_dart/example/pubspec_overrides.yaml b/packages/firebase_auth/firebase_auth_dart/example/pubspec_overrides.yaml index 19d88812..5ccea0a7 100644 --- a/packages/firebase_auth/firebase_auth_dart/example/pubspec_overrides.yaml +++ b/packages/firebase_auth/firebase_auth_dart/example/pubspec_overrides.yaml @@ -1,6 +1,6 @@ # melos_managed_dependency_overrides: firebase_auth_dart,firebase_core_dart dependency_overrides: firebase_auth_dart: - path: ../ + path: .. firebase_core_dart: path: ../../../firebase_core/firebase_core_dart diff --git a/packages/firebase_auth/firebase_auth_desktop/example/pubspec_overrides.yaml b/packages/firebase_auth/firebase_auth_desktop/example/pubspec_overrides.yaml index ce6407bd..280400f6 100644 --- a/packages/firebase_auth/firebase_auth_desktop/example/pubspec_overrides.yaml +++ b/packages/firebase_auth/firebase_auth_desktop/example/pubspec_overrides.yaml @@ -3,7 +3,7 @@ dependency_overrides: firebase_auth_dart: path: ../../firebase_auth_dart firebase_auth_desktop: - path: ../ + path: .. firebase_core_dart: path: ../../../firebase_core/firebase_core_dart firebase_core_desktop: diff --git a/packages/firebase_core/firebase_core_desktop/example/pubspec_overrides.yaml b/packages/firebase_core/firebase_core_desktop/example/pubspec_overrides.yaml index d89d61d6..27d10911 100644 --- a/packages/firebase_core/firebase_core_desktop/example/pubspec_overrides.yaml +++ b/packages/firebase_core/firebase_core_desktop/example/pubspec_overrides.yaml @@ -3,4 +3,4 @@ dependency_overrides: firebase_core_dart: path: ../../firebase_core_dart firebase_core_desktop: - path: ../ + path: .. diff --git a/packages/firebase_functions/firebase_functions_desktop/example/pubspec_overrides.yaml b/packages/firebase_functions/firebase_functions_desktop/example/pubspec_overrides.yaml index fcffdd6b..230072a3 100644 --- a/packages/firebase_functions/firebase_functions_desktop/example/pubspec_overrides.yaml +++ b/packages/firebase_functions/firebase_functions_desktop/example/pubspec_overrides.yaml @@ -9,4 +9,4 @@ dependency_overrides: firebase_functions_dart: path: ../../firebase_functions_dart firebase_functions_desktop: - path: ../ + path: .. diff --git a/pubspec.yaml b/pubspec.yaml new file mode 100644 index 00000000..ab68fe43 --- /dev/null +++ b/pubspec.yaml @@ -0,0 +1,7 @@ +name: flutterfire_desktop_workspace + +environment: + sdk: '>=2.18.0 <3.0.0' + +dev_dependencies: + melos: ^3.1.1 From ad704650856f930bc3fc16e836eb4566c10d9267 Mon Sep 17 00:00:00 2001 From: David Martos Date: Sat, 29 Jul 2023 09:37:43 +0200 Subject: [PATCH 12/19] generated files --- .../firebase_auth_desktop/example/lib/auth_service.dart | 1 + .../windows/flutter/generated_plugin_registrant.cc | 3 +++ .../example/windows/flutter/generated_plugins.cmake | 1 + tests/linux/flutter/generated_plugins.cmake | 8 ++++++++ tests/windows/flutter/generated_plugin_registrant.cc | 3 +++ tests/windows/flutter/generated_plugins.cmake | 9 +++++++++ 6 files changed, 25 insertions(+) diff --git a/packages/firebase_auth/firebase_auth_desktop/example/lib/auth_service.dart b/packages/firebase_auth/firebase_auth_desktop/example/lib/auth_service.dart index e31fe4eb..d81ac846 100644 --- a/packages/firebase_auth/firebase_auth_desktop/example/lib/auth_service.dart +++ b/packages/firebase_auth/firebase_auth_desktop/example/lib/auth_service.dart @@ -70,6 +70,7 @@ class AuthService { final confirmationResult = await FirebaseAuth.instance.signInWithPhoneNumber(phoneNumber); + // ignore: no_leading_underscores_for_local_identifiers final _smsCode = await smsCode.call(); if (_smsCode != null) { diff --git a/packages/firebase_functions/firebase_functions_desktop/example/windows/flutter/generated_plugin_registrant.cc b/packages/firebase_functions/firebase_functions_desktop/example/windows/flutter/generated_plugin_registrant.cc index 8b6d4680..1a82e7d0 100644 --- a/packages/firebase_functions/firebase_functions_desktop/example/windows/flutter/generated_plugin_registrant.cc +++ b/packages/firebase_functions/firebase_functions_desktop/example/windows/flutter/generated_plugin_registrant.cc @@ -6,6 +6,9 @@ #include "generated_plugin_registrant.h" +#include void RegisterPlugins(flutter::PluginRegistry* registry) { + FirebaseCorePluginCApiRegisterWithRegistrar( + registry->GetRegistrarForPlugin("FirebaseCorePluginCApi")); } diff --git a/packages/firebase_functions/firebase_functions_desktop/example/windows/flutter/generated_plugins.cmake b/packages/firebase_functions/firebase_functions_desktop/example/windows/flutter/generated_plugins.cmake index b93c4c30..fa8a39ba 100644 --- a/packages/firebase_functions/firebase_functions_desktop/example/windows/flutter/generated_plugins.cmake +++ b/packages/firebase_functions/firebase_functions_desktop/example/windows/flutter/generated_plugins.cmake @@ -3,6 +3,7 @@ # list(APPEND FLUTTER_PLUGIN_LIST + firebase_core ) list(APPEND FLUTTER_FFI_PLUGIN_LIST diff --git a/tests/linux/flutter/generated_plugins.cmake b/tests/linux/flutter/generated_plugins.cmake index 5254f4fa..e5bf8b2e 100644 --- a/tests/linux/flutter/generated_plugins.cmake +++ b/tests/linux/flutter/generated_plugins.cmake @@ -6,6 +6,9 @@ list(APPEND FLUTTER_PLUGIN_LIST desktop_webview_auth ) +list(APPEND FLUTTER_FFI_PLUGIN_LIST +) + set(PLUGIN_BUNDLED_LIBRARIES) foreach(plugin ${FLUTTER_PLUGIN_LIST}) @@ -14,3 +17,8 @@ foreach(plugin ${FLUTTER_PLUGIN_LIST}) list(APPEND PLUGIN_BUNDLED_LIBRARIES $) list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) endforeach(plugin) + +foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST}) + add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/linux plugins/${ffi_plugin}) + list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries}) +endforeach(ffi_plugin) diff --git a/tests/windows/flutter/generated_plugin_registrant.cc b/tests/windows/flutter/generated_plugin_registrant.cc index 45e2647e..d71cf017 100644 --- a/tests/windows/flutter/generated_plugin_registrant.cc +++ b/tests/windows/flutter/generated_plugin_registrant.cc @@ -7,8 +7,11 @@ #include "generated_plugin_registrant.h" #include +#include void RegisterPlugins(flutter::PluginRegistry* registry) { DesktopWebviewAuthPluginRegisterWithRegistrar( registry->GetRegistrarForPlugin("DesktopWebviewAuthPlugin")); + FirebaseCorePluginCApiRegisterWithRegistrar( + registry->GetRegistrarForPlugin("FirebaseCorePluginCApi")); } diff --git a/tests/windows/flutter/generated_plugins.cmake b/tests/windows/flutter/generated_plugins.cmake index 08ec9fbf..e34ce28a 100644 --- a/tests/windows/flutter/generated_plugins.cmake +++ b/tests/windows/flutter/generated_plugins.cmake @@ -4,6 +4,10 @@ list(APPEND FLUTTER_PLUGIN_LIST desktop_webview_auth + firebase_core +) + +list(APPEND FLUTTER_FFI_PLUGIN_LIST ) set(PLUGIN_BUNDLED_LIBRARIES) @@ -14,3 +18,8 @@ foreach(plugin ${FLUTTER_PLUGIN_LIST}) list(APPEND PLUGIN_BUNDLED_LIBRARIES $) list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) endforeach(plugin) + +foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST}) + add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/windows plugins/${ffi_plugin}) + list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries}) +endforeach(ffi_plugin) From e48ed51d8e3651736eca81f1fafb660b48078b95 Mon Sep 17 00:00:00 2001 From: David Martos Date: Sat, 29 Jul 2023 09:38:35 +0200 Subject: [PATCH 13/19] melos 3.1.1 windows --- .github/workflows/scripts/install-tools.bat | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/scripts/install-tools.bat b/.github/workflows/scripts/install-tools.bat index fd7ada48..7815ebba 100755 --- a/.github/workflows/scripts/install-tools.bat +++ b/.github/workflows/scripts/install-tools.bat @@ -1,2 +1,2 @@ -CMD /K dart pub global activate melos 1.0.0 +CMD /K dart pub global activate melos 3.1.1 melos bootstrap From a2577d75805f8e370ba00024e59619ead419a21e Mon Sep 17 00:00:00 2001 From: David Martos Date: Sat, 29 Jul 2023 09:48:27 +0200 Subject: [PATCH 14/19] update gh actions --- .github/workflows/validate.yaml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/validate.yaml b/.github/workflows/validate.yaml index 9cc51469..bfb3c20d 100644 --- a/.github/workflows/validate.yaml +++ b/.github/workflows/validate.yaml @@ -17,7 +17,7 @@ jobs: - name: 'Install Tools' run: ./.github/workflows/scripts/install-tools.sh - name: 'Analyze' - uses: invertase/github-action-dart-analyzer@v1 + uses: invertase/github-action-dart-analyzer@v2 with: fatal-infos: true fatal-warnings: true @@ -43,10 +43,10 @@ jobs: - uses: actions/checkout@v3 with: fetch-depth: 0 - - uses: actions/setup-node@v2 - name: Install Node.js 16 + - uses: actions/setup-node@v3 + name: Install Node.js 18 with: - node-version: '16' + node-version: '18' - name: 'Install Flutter' run: ./.github/workflows/scripts/install-flutter.sh stable - name: 'Install Tools' @@ -74,10 +74,10 @@ jobs: - uses: actions/checkout@v3 with: fetch-depth: 0 - - uses: actions/setup-node@v2 - name: Install Node.js 16 + - uses: actions/setup-node@v3 + name: Install Node.js 18 with: - node-version: '16' + node-version: '18' - name: 'Install Flutter' run: .\.github\workflows\scripts\install-flutter.bat stable - name: 'Install Tools' From 2bdfacc80aff9ca45c50d7a25be9e49b2982bd2d Mon Sep 17 00:00:00 2001 From: David Martos Date: Sat, 29 Jul 2023 09:50:57 +0200 Subject: [PATCH 15/19] update tag --- .github/workflows/validate.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/validate.yaml b/.github/workflows/validate.yaml index bfb3c20d..19ffc0d7 100644 --- a/.github/workflows/validate.yaml +++ b/.github/workflows/validate.yaml @@ -17,7 +17,7 @@ jobs: - name: 'Install Tools' run: ./.github/workflows/scripts/install-tools.sh - name: 'Analyze' - uses: invertase/github-action-dart-analyzer@v2 + uses: invertase/github-action-dart-analyzer@v2.0.0 with: fatal-infos: true fatal-warnings: true From b7832f7e5d3346a3d1fef0a31191b58bbfda8f00 Mon Sep 17 00:00:00 2001 From: David Martos Date: Sat, 29 Jul 2023 10:37:20 +0200 Subject: [PATCH 16/19] utc dates in UserMetadata https://github.com/firebase/flutterfire/pull/9248 --- .../firebase_auth_dart/lib/src/user_metadata.dart | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/firebase_auth/firebase_auth_dart/lib/src/user_metadata.dart b/packages/firebase_auth/firebase_auth_dart/lib/src/user_metadata.dart index e75448f9..cffa2812 100644 --- a/packages/firebase_auth/firebase_auth_dart/lib/src/user_metadata.dart +++ b/packages/firebase_auth/firebase_auth_dart/lib/src/user_metadata.dart @@ -17,14 +17,14 @@ class UserMetadata { /// When this account was created as dictated by the server clock. DateTime? get creationTime => - DateTime.fromMillisecondsSinceEpoch(_creationTimestamp); + DateTime.fromMillisecondsSinceEpoch(_creationTimestamp, isUtc: true); /// When the user last signed in as dictated by the server clock. /// /// This is only accurate up to a granularity of 2 minutes for consecutive /// sign-in attempts. DateTime? get lastSignInTime => - DateTime.fromMillisecondsSinceEpoch(_lastSignInTime); + DateTime.fromMillisecondsSinceEpoch(_lastSignInTime, isUtc: true); @override String toString() { From 0580af68ca3c2137bef7cdbc61f8efd9206bad1b Mon Sep 17 00:00:00 2001 From: David Martos Date: Sun, 30 Jul 2023 12:55:42 +0200 Subject: [PATCH 17/19] update README and change pubspec constraints --- README.md | 8 ++++---- .../firebase_auth_desktop/example/pubspec.yaml | 2 +- packages/firebase_auth/firebase_auth_desktop/pubspec.yaml | 2 +- .../firebase_core_desktop/example/pubspec.yaml | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 45d10707..245aa32a 100644 --- a/README.md +++ b/README.md @@ -15,10 +15,10 @@ To use this plugin, add the following dependencies to your app's `pubspec.yaml` ```yaml dependencies: - firebase_auth: ^3.1.5 - firebase_auth_desktop: ^0.1.1-dev.0 - firebase_core: ^1.9.0 - firebase_core_desktop: ^0.1.1-dev.0 + firebase_auth: ^4.6.3 + firebase_auth_desktop: ^0.1.2 + firebase_core: ^2.0.0 + firebase_core_desktop: ^0.1.2 ``` ## Firebase App Initialization diff --git a/packages/firebase_auth/firebase_auth_desktop/example/pubspec.yaml b/packages/firebase_auth/firebase_auth_desktop/example/pubspec.yaml index de7be08f..e64b2a95 100644 --- a/packages/firebase_auth/firebase_auth_desktop/example/pubspec.yaml +++ b/packages/firebase_auth/firebase_auth_desktop/example/pubspec.yaml @@ -25,7 +25,7 @@ dependencies: desktop_webview_auth: ^0.0.9 firebase_auth: 4.6.3 firebase_auth_desktop: ^1.0.2 - firebase_core: ^2.15.0 + firebase_core: ^2.0.0 firebase_core_desktop: ^1.0.2 flutter: sdk: flutter diff --git a/packages/firebase_auth/firebase_auth_desktop/pubspec.yaml b/packages/firebase_auth/firebase_auth_desktop/pubspec.yaml index 35c2fe1d..2b990135 100644 --- a/packages/firebase_auth/firebase_auth_desktop/pubspec.yaml +++ b/packages/firebase_auth/firebase_auth_desktop/pubspec.yaml @@ -13,7 +13,7 @@ dependencies: firebase_auth: 4.6.3 firebase_auth_dart: ^1.0.1 firebase_auth_platform_interface: 6.15.3 - firebase_core: ^2.15.0 + firebase_core: ^2.0.0 firebase_core_dart: ^1.0.1 flutter: sdk: flutter diff --git a/packages/firebase_core/firebase_core_desktop/example/pubspec.yaml b/packages/firebase_core/firebase_core_desktop/example/pubspec.yaml index 26dfec85..a564cc35 100644 --- a/packages/firebase_core/firebase_core_desktop/example/pubspec.yaml +++ b/packages/firebase_core/firebase_core_desktop/example/pubspec.yaml @@ -21,7 +21,7 @@ environment: sdk: ">=2.12.0 <3.0.0" dependencies: - firebase_core: ^1.9.0 + firebase_core: ^2.0.0 firebase_core_desktop: ^1.0.2 flutter: sdk: flutter From 9e42ff5831d9fc3782198f94df55c99a6019b9d6 Mon Sep 17 00:00:00 2001 From: David Martos Date: Sun, 30 Jul 2023 13:11:49 +0200 Subject: [PATCH 18/19] update constraints with a range --- packages/firebase_auth/firebase_auth_desktop/pubspec.yaml | 5 +++-- .../firebase_functions_desktop/pubspec.yaml | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/packages/firebase_auth/firebase_auth_desktop/pubspec.yaml b/packages/firebase_auth/firebase_auth_desktop/pubspec.yaml index 2b990135..a39c2b48 100644 --- a/packages/firebase_auth/firebase_auth_desktop/pubspec.yaml +++ b/packages/firebase_auth/firebase_auth_desktop/pubspec.yaml @@ -10,9 +10,10 @@ environment: dependencies: desktop_webview_auth: ^0.0.8 - firebase_auth: 4.6.3 + # 4.7.0 adds pigeon for platform communication which breaks some things + firebase_auth: '>=4.0.0 <4.7.0' firebase_auth_dart: ^1.0.1 - firebase_auth_platform_interface: 6.15.3 + firebase_auth_platform_interface: '>=6.10.3 <6.16.0' firebase_core: ^2.0.0 firebase_core_dart: ^1.0.1 flutter: diff --git a/packages/firebase_functions/firebase_functions_desktop/pubspec.yaml b/packages/firebase_functions/firebase_functions_desktop/pubspec.yaml index abb951ff..0d3b7302 100644 --- a/packages/firebase_functions/firebase_functions_desktop/pubspec.yaml +++ b/packages/firebase_functions/firebase_functions_desktop/pubspec.yaml @@ -9,8 +9,9 @@ environment: flutter: '>=1.20.0' dependencies: - cloud_functions: 4.0.13 - cloud_functions_platform_interface: 5.1.32 + # 4.1.0 adss functions 2nd gen which is not supported + cloud_functions: '>=4.0.0 <4.1.0' + cloud_functions_platform_interface: '>=5.1.20 <5.2.0' firebase_core: ^2.15.0 firebase_core_dart: ^1.0.1 firebase_core_desktop: ^1.0.2 From 73df7385b344c118ebfa569cb571734a0d738328 Mon Sep 17 00:00:00 2001 From: David Martos Date: Wed, 23 Aug 2023 13:45:22 +0200 Subject: [PATCH 19/19] lint --- .../lib/src/api/account_managament/profile.dart | 2 +- .../firebase_auth_dart/lib/src/api/errors.dart | 2 +- .../lib/src/confirmation_result.dart | 2 +- .../firebase_auth_desktop/example/lib/profile.dart | 12 +++++++++--- .../firebase_functions_dart/lib/src/exceptions.dart | 2 +- 5 files changed, 13 insertions(+), 7 deletions(-) diff --git a/packages/firebase_auth/firebase_auth_dart/lib/src/api/account_managament/profile.dart b/packages/firebase_auth/firebase_auth_dart/lib/src/api/account_managament/profile.dart index c5b16644..f3c36324 100644 --- a/packages/firebase_auth/firebase_auth_dart/lib/src/api/account_managament/profile.dart +++ b/packages/firebase_auth/firebase_auth_dart/lib/src/api/account_managament/profile.dart @@ -27,7 +27,7 @@ class UserProfile extends APIDelegate { returnSecureToken: true, deleteAttribute: [ if (photoUrl == null) 'PHOTO_URL', - if (displayName == null) 'DISPLAY_NAME' + if (displayName == null) 'DISPLAY_NAME', ], ), ); diff --git a/packages/firebase_auth/firebase_auth_dart/lib/src/api/errors.dart b/packages/firebase_auth/firebase_auth_dart/lib/src/api/errors.dart index 88ec971d..66c6d0e7 100644 --- a/packages/firebase_auth/firebase_auth_dart/lib/src/api/errors.dart +++ b/packages/firebase_auth/firebase_auth_dart/lib/src/api/errors.dart @@ -454,5 +454,5 @@ Map verbose = { AuthErrorCode.ALREADY_INITIALIZED: 'initializeAuth() has already been called with ' 'different options. To avoid this error, call initializeAuth() with the ' 'same options as when it was originally called, or call getAuth() to return the' - ' already initialized instance.' + ' already initialized instance.', }; diff --git a/packages/firebase_auth/firebase_auth_dart/lib/src/confirmation_result.dart b/packages/firebase_auth/firebase_auth_dart/lib/src/confirmation_result.dart index 17fd60a0..1555f893 100644 --- a/packages/firebase_auth/firebase_auth_dart/lib/src/confirmation_result.dart +++ b/packages/firebase_auth/firebase_auth_dart/lib/src/confirmation_result.dart @@ -55,7 +55,7 @@ class ConfirmationResult { username: userData['screenName'], profile: { 'displayName': userData['displayName'], - 'photoUrl': userData['photoUrl'] + 'photoUrl': userData['photoUrl'], }, ), ); diff --git a/packages/firebase_auth/firebase_auth_desktop/example/lib/profile.dart b/packages/firebase_auth/firebase_auth_desktop/example/lib/profile.dart index 3ff69956..3e1971e7 100644 --- a/packages/firebase_auth/firebase_auth_desktop/example/lib/profile.dart +++ b/packages/firebase_auth/firebase_auth_desktop/example/lib/profile.dart @@ -197,7 +197,9 @@ class _ProfilePageState extends State { try { await authService.linkWithGoogle(); } on FirebaseAuthException catch (e) { - ScaffoldSnackbar.of(context).show('${e.message}'); + if (mounted) { + ScaffoldSnackbar.of(context).show('${e.message}'); + } log('$e'); } finally { setIsLoading(); @@ -221,7 +223,9 @@ class _ProfilePageState extends State { } } } on FirebaseAuthException catch (e) { - ScaffoldSnackbar.of(context).show('${e.message}'); + if (mounted) { + ScaffoldSnackbar.of(context).show('${e.message}'); + } log('$e'); } finally { setIsLoading(); @@ -254,7 +258,9 @@ class _ProfilePageState extends State { } } } on FirebaseAuthException catch (e) { - ScaffoldSnackbar.of(context).show('${e.message}'); + if (mounted) { + ScaffoldSnackbar.of(context).show('${e.message}'); + } log('$e'); } finally { setIsLoading(); diff --git a/packages/firebase_functions/firebase_functions_dart/lib/src/exceptions.dart b/packages/firebase_functions/firebase_functions_dart/lib/src/exceptions.dart index edd856b1..7ece4640 100644 --- a/packages/firebase_functions/firebase_functions_dart/lib/src/exceptions.dart +++ b/packages/firebase_functions/firebase_functions_dart/lib/src/exceptions.dart @@ -159,5 +159,5 @@ const _errorCodeMap = { 'UNIMPLEMENTED': 'unimplemented', 'INTERNAL': 'internal', 'UNAVAILABLE': 'unavailable', - 'DATA_LOSS': 'data-loss' + 'DATA_LOSS': 'data-loss', };