Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

feat: update librairies to be compatible with Flutter 3.10.0 #10944

Merged
merged 4 commits into from
May 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ void main() {
StandardMethodCodec(AggregateQueryMessageCodec()),
);

TestDefaultBinaryMessengerBinding.instance?.defaultBinaryMessenger
TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger
.setMockMethodCallHandler(MethodChannelFirebaseFirestore.channel,
(call) async {
if (call.method == 'AggregateQuery#count') {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ void main() {
StandardMethodCodec(TestFirestoreMessageCodec()),
);

TestDefaultBinaryMessengerBinding.instance?.defaultBinaryMessenger
TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger
.setMockMethodCallHandler(MethodChannelFirebaseFirestore.channel,
(call) async {
return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ void main() {
StandardMethodCodec(TestFirestoreMessageCodec()),
);

TestDefaultBinaryMessengerBinding.instance?.defaultBinaryMessenger
TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger
.setMockMethodCallHandler(MethodChannelFirebaseFirestore.channel,
(call) async {
DocumentReferencePlatform ref = call.arguments['reference'];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ void main() {
FirebaseFirestore? firestore;
FirebaseFirestore? firestoreSecondary;

TestDefaultBinaryMessengerBinding.instance?.defaultBinaryMessenger
TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger
.setMockMethodCallHandler(MethodChannelFirebaseFirestore.channel,
(call) async {
String path = call.arguments['path'];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ void main() {
});
group('get()', () {
setUp(() async {
TestDefaultBinaryMessengerBinding.instance?.defaultBinaryMessenger
TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger
.setMockMethodCallHandler(MethodChannelFirebaseFirestore.channel,
(MethodCall methodCall) async {
switch (methodCall.method) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ void initializeMethodChannel() {
}

void handleMethodCall(MethodCallCallback methodCallCallback) =>
TestDefaultBinaryMessengerBinding.instance?.defaultBinaryMessenger
TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger
.setMockMethodCallHandler(MethodChannelFirebaseFirestore.channel,
(call) async {
return await methodCallCallback(call);
Expand All @@ -51,13 +51,13 @@ void handleDocumentSnapshotsEventChannel(
final name = 'plugins.flutter.io/firebase_firestore/document/$id';
const codec = StandardMethodCodec(TestFirestoreMessageCodec());

TestDefaultBinaryMessengerBinding.instance?.defaultBinaryMessenger
TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger
.setMockMethodCallHandler(MethodChannel(name, codec),
(MethodCall methodCall) async {
log.add(methodCall);
switch (methodCall.method) {
case 'listen':
await TestDefaultBinaryMessengerBinding.instance?.defaultBinaryMessenger
await TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger
.handlePlatformMessage(
name,
codec.encodeSuccessEnvelope(
Expand All @@ -84,13 +84,13 @@ void handleQuerySnapshotsEventChannel(final String id, List<MethodCall> log) {
final name = 'plugins.flutter.io/firebase_firestore/query/$id';
const codec = StandardMethodCodec(TestFirestoreMessageCodec());

TestDefaultBinaryMessengerBinding.instance?.defaultBinaryMessenger
TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger
.setMockMethodCallHandler(MethodChannel(name, codec),
(MethodCall methodCall) async {
log.add(methodCall);
switch (methodCall.method) {
case 'listen':
await TestDefaultBinaryMessengerBinding.instance?.defaultBinaryMessenger
await TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger
.handlePlatformMessage(
name,
codec.encodeSuccessEnvelope(
Expand All @@ -117,12 +117,12 @@ void handleSnapshotsInSyncEventChannel(final String id) {
final name = 'plugins.flutter.io/firebase_firestore/snapshotsInSync/$id';
const codec = StandardMethodCodec(TestFirestoreMessageCodec());

TestDefaultBinaryMessengerBinding.instance?.defaultBinaryMessenger
TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger
.setMockMethodCallHandler(MethodChannel(name, codec),
(MethodCall methodCall) async {
switch (methodCall.method) {
case 'listen':
await TestDefaultBinaryMessengerBinding.instance?.defaultBinaryMessenger
await TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger
.handlePlatformMessage(
name, codec.encodeSuccessEnvelope({}), (_) {});
break;
Expand All @@ -142,12 +142,12 @@ void handleTransactionEventChannel(
final name = 'plugins.flutter.io/firebase_firestore/transaction/$id';
const codec = StandardMethodCodec(TestFirestoreMessageCodec());

TestDefaultBinaryMessengerBinding.instance?.defaultBinaryMessenger
TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger
.setMockMethodCallHandler(MethodChannel(name, codec),
(MethodCall methodCall) async {
switch (methodCall.method) {
case 'listen':
await TestDefaultBinaryMessengerBinding.instance?.defaultBinaryMessenger
await TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger
.handlePlatformMessage(
name,
codec.encodeSuccessEnvelope({
Expand All @@ -158,19 +158,19 @@ void handleTransactionEventChannel(

if (throwException!) {
await TestDefaultBinaryMessengerBinding
.instance?.defaultBinaryMessenger
.instance.defaultBinaryMessenger
.handlePlatformMessage(
name,
codec.encodeSuccessEnvelope({
'appName': app?.name,
'appName': app.name,
'error': {
'code': 'unknown',
},
}),
(_) {},
);
}
await TestDefaultBinaryMessengerBinding.instance?.defaultBinaryMessenger
await TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger
.handlePlatformMessage(
name,
codec.encodeSuccessEnvelope({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ void setupFirebaseFunctionsMocks([Callback? customHandlers]) {
}

void handleMethodCall(MethodCallCallback methodCallCallback) =>
TestDefaultBinaryMessengerBinding.instance?.defaultBinaryMessenger
TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger
.setMockMethodCallHandler(MethodChannelFirebaseFunctions.channel,
(call) async {
return await methodCallCallback(call);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ void setupFirebaseAnalyticsMocks([Callback? customHandlers]) {

setupFirebaseCoreMocks();

TestDefaultBinaryMessengerBinding.instance?.defaultBinaryMessenger
TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger
.setMockMethodCallHandler(MethodChannelFirebaseAnalytics.channel,
(MethodCall methodCall) async {
methodCallLog.add(methodCall);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ void setupFirebaseAnalyticsMocks([Callback? customHandlers]) {

setupFirebaseCoreMocks();

TestDefaultBinaryMessengerBinding.instance?.defaultBinaryMessenger
TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger
.setMockMethodCallHandler(MethodChannelFirebaseAnalytics.channel,
(MethodCall methodCall) async {
methodCallLog.add(methodCall);
Expand All @@ -32,7 +32,7 @@ void setupFirebaseAnalyticsMocks([Callback? customHandlers]) {
}

void handleMethodCall(MethodCallCallback methodCallCallback) =>
TestDefaultBinaryMessengerBinding.instance?.defaultBinaryMessenger
TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger
.setMockMethodCallHandler(MethodChannelFirebaseAnalytics.channel,
(call) async {
return await methodCallCallback(call);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ void setupFirebaseAppCheckMocks([Callback? customHandlers]) {

setupFirebaseCoreMocks();

TestDefaultBinaryMessengerBinding.instance?.defaultBinaryMessenger
TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger
.setMockMethodCallHandler(MethodChannelFirebaseAppCheck.channel,
(MethodCall methodCall) async {
if (methodCall.method != 'FirebaseAppCheck#registerTokenListener') {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ void setupFirebaseAppCheckMocks([Callback? customHandlers]) {

setupFirebaseCoreMocks();

TestDefaultBinaryMessengerBinding.instance?.defaultBinaryMessenger
TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger
.setMockMethodCallHandler(MethodChannelFirebaseAppCheck.channel,
(MethodCall methodCall) async {
methodCallLog.add(methodCall);
Expand All @@ -30,7 +30,7 @@ void setupFirebaseAppCheckMocks([Callback? customHandlers]) {
}

void handleMethodCall(MethodCallCallback methodCallCallback) =>
TestDefaultBinaryMessengerBinding.instance?.defaultBinaryMessenger
TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger
.setMockMethodCallHandler(MethodChannelFirebaseAppCheck.channel,
(call) async {
return await methodCallCallback(call);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ void main() {
when(mockAuthPlatform.userChanges()).thenAnswer((_) =>
Stream<UserPlatform>.fromIterable(<UserPlatform>[mockUserPlatform!]));

TestDefaultBinaryMessengerBinding.instance?.defaultBinaryMessenger
TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger
.setMockMethodCallHandler(MethodChannelFirebaseAuth.channel,
(call) async {
return <String, dynamic>{'user': user};
Expand Down
2 changes: 1 addition & 1 deletion packages/firebase_auth/firebase_auth/test/user_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ void main() {
languageCode: anyNamed('languageCode'),
)).thenAnswer((_) => mockAuthPlatform);

TestDefaultBinaryMessengerBinding.instance?.defaultBinaryMessenger
TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger
.setMockMethodCallHandler(MethodChannelFirebaseAuth.channel,
(call) async {
switch (call.method) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ void handleEventChannel(
final String name, [
List<MethodCall>? log,
]) {
TestDefaultBinaryMessengerBinding.instance?.defaultBinaryMessenger
TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger
.setMockMethodCallHandler(MethodChannel(name),
(MethodCall methodCall) async {
log?.add(methodCall);
Expand All @@ -46,7 +46,7 @@ Future<void> injectEventChannelResponse(
String channelName,
Map<String, dynamic> event,
) async {
await TestDefaultBinaryMessengerBinding.instance?.defaultBinaryMessenger
await TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger
.handlePlatformMessage(
channelName,
MethodChannelFirebaseAuth.channel.codec.encodeSuccessEnvelope(event),
Expand All @@ -55,14 +55,14 @@ Future<void> injectEventChannelResponse(
}

void handleMethodCall(MethodCallCallback methodCallCallback) =>
TestDefaultBinaryMessengerBinding.instance?.defaultBinaryMessenger
TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger
.setMockMethodCallHandler(MethodChannelFirebaseAuth.channel,
(call) async {
return await methodCallCallback(call);
});

Future<void> simulateEvent(String name, Map<String, dynamic>? user) async {
await TestDefaultBinaryMessengerBinding.instance?.defaultBinaryMessenger
await TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger
.handlePlatformMessage(
MethodChannelFirebaseAuth.channel.name,
MethodChannelFirebaseAuth.channel.codec.encodeMethodCall(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,15 @@
// found in the LICENSE file.

import 'dart:async';
import 'dart:js';

import 'package:firebase_auth_platform_interface/firebase_auth_platform_interface.dart';
import 'package:firebase_auth_web/src/firebase_auth_web_user_credential.dart';
import 'package:intl/intl.dart';

import 'firebase_auth_web_confirmation_result.dart';
import 'interop/auth.dart' as auth_interop;
import 'utils/web_utils.dart';

/// The format of an incoming metadata string timestamp from the firebase-dart library
final DateFormat _dateFormat = DateFormat('EEE, d MMM yyyy HH:mm:ss', 'en_US');

/// Web delegate implementation of [UserPlatform].
class UserWeb extends UserPlatform {
/// Creates a new [UserWeb] instance.
Expand All @@ -31,14 +28,12 @@ class UserWeb extends UserPlatform {
'isAnonymous': _webUser.isAnonymous,
'metadata': <String, int?>{
'creationTime': _webUser.metadata.creationTime != null
? _dateFormat
.parse(_webUser.metadata.creationTime!, true)
.millisecondsSinceEpoch
? context['Date']
.callMethod('parse', [_webUser.metadata.creationTime])
: null,
'lastSignInTime': _webUser.metadata.lastSignInTime != null
? _dateFormat
.parse(_webUser.metadata.lastSignInTime!, true)
.millisecondsSinceEpoch
? context['Date']
.callMethod('parse', [_webUser.metadata.lastSignInTime])
: null,
},
'phoneNumber': _webUser.phoneNumber,
Expand Down
1 change: 0 additions & 1 deletion packages/firebase_auth/firebase_auth_web/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ dependencies:
flutter_web_plugins:
sdk: flutter
http_parser: ^4.0.0
intl: ^0.17.0
js: ^0.6.3
meta: ^1.8.0

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ void setupFirebaseCrashlyticsMocks([Callback? customHandlers]) {

TestFirebaseCoreHostApi.setup(MockFirebaseAppWithCollectionEnabled());

TestDefaultBinaryMessengerBinding.instance?.defaultBinaryMessenger
TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger
.setMockMethodCallHandler(MethodChannelFirebaseCrashlytics.channel,
(MethodCall methodCall) async {
methodCallLog.add(methodCall);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ void setupFirebaseCrashlyticsMocks([Callback? customHandlers]) {
}

void handleMethodCall(MethodCallCallback methodCallCallback) =>
TestDefaultBinaryMessengerBinding.instance?.defaultBinaryMessenger
TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger
.setMockMethodCallHandler(MethodChannelFirebaseCrashlytics.channel,
(call) async {
return await methodCallCallback(call);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ void main() {
);

messenger =
TestDefaultBinaryMessengerBinding.instance?.defaultBinaryMessenger;
TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger;
});

group('MethodChannelDatabase', () {
Expand All @@ -45,7 +45,7 @@ void main() {
setUp(() async {
database = MethodChannelDatabase(app: app, databaseURL: databaseURL);

TestDefaultBinaryMessengerBinding.instance?.defaultBinaryMessenger
TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger
.setMockMethodCallHandler(channel, (MethodCall methodCall) async {
log.add(methodCall);

Expand Down Expand Up @@ -454,7 +454,7 @@ void main() {

Future<void> simulateError(String errorMessage) async {
await TestDefaultBinaryMessengerBinding
.instance?.defaultBinaryMessenger
.instance.defaultBinaryMessenger
.handlePlatformMessage(
eventChannel.name,
eventChannel.codec.encodeErrorEnvelope(
Expand Down Expand Up @@ -502,7 +502,7 @@ void main() {

Future<void> simulateEvent(Map<String, dynamic> event) async {
await TestDefaultBinaryMessengerBinding
.instance?.defaultBinaryMessenger
.instance.defaultBinaryMessenger
.handlePlatformMessage(
eventChannel.name,
eventChannel.codec.encodeSuccessEnvelope(event),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ class _MainScreenState extends State<_MainScreen> {
},
onLongPress: () {
if (_linkMessage != null) {
Clipboard.setData(ClipboardData(text: _linkMessage));
Clipboard.setData(ClipboardData(text: _linkMessage!));
ScaffoldMessenger.of(context).showSnackBar(
const SnackBar(content: Text('Copied Link!')),
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ void setupFirebaseDynamicLinksMocks([Callback? customHandlers]) {
}

void handleMethodCall(MethodCallCallback methodCallCallback) =>
TestDefaultBinaryMessengerBinding.instance?.defaultBinaryMessenger
TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger
.setMockMethodCallHandler(MethodChannelFirebaseDynamicLinks.channel,
(call) async {
return await methodCallCallback(call);
Expand All @@ -31,7 +31,7 @@ void handleEventChannel(
final String name, [
List<MethodCall>? log,
]) {
TestDefaultBinaryMessengerBinding.instance?.defaultBinaryMessenger
TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger
.setMockMethodCallHandler(MethodChannel(name),
(MethodCall methodCall) async {
log?.add(methodCall);
Expand All @@ -50,7 +50,7 @@ Future<void> injectEventChannelResponse(
String channelName,
Map<String, dynamic> event,
) async {
await TestDefaultBinaryMessengerBinding.instance?.defaultBinaryMessenger
await TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger
.handlePlatformMessage(
channelName,
MethodChannelFirebaseDynamicLinks.channel.codec
Expand Down
Loading