Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(web): upgrade to support v9.8.1 Firebase JS SDK (#8235)
Co-authored-by: Elliot Hesp <elliot.hesp@gmail.com> Co-authored-by: Benjamin Koch <koch@lotum.de> Co-authored-by: Jorge Roncero <60613199+jorgeroncero@users.noreply.github.com> Co-authored-by: Guillaume Bernos <guillaume@bernos.dev> Co-authored-by: Mike Diarmid <mike.diarmid@gmail.com> Co-authored-by: Nils Reichardt <nils@reichardt.io> Co-authored-by: Russell Wheatley <russellwheatley85@gmail.com>
- Loading branch information
1 parent
c70e66a
commit 4b417af
Showing
65 changed files
with
1,584 additions
and
1,107 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
74 changes: 74 additions & 0 deletions
74
packages/cloud_firestore/cloud_firestore/example/test_driver/firebase_options_secondary.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
// File generated by FlutterFire CLI. | ||
// ignore_for_file: lines_longer_than_80_chars, avoid_classes_with_only_static_members | ||
import 'package:firebase_core/firebase_core.dart' show FirebaseOptions; | ||
import 'package:flutter/foundation.dart' | ||
show defaultTargetPlatform, kIsWeb, TargetPlatform; | ||
|
||
/// Default [FirebaseOptions] for use with your Firebase apps. | ||
/// | ||
/// Example: | ||
/// ```dart | ||
/// import 'firebase_options_secondary.dart'; | ||
/// // ... | ||
/// await Firebase.initializeApp( | ||
/// options: DefaultFirebaseOptions.currentPlatform, | ||
/// ); | ||
/// ``` | ||
class DefaultFirebaseOptions { | ||
static FirebaseOptions get currentPlatform { | ||
if (kIsWeb) { | ||
return web; | ||
} | ||
switch (defaultTargetPlatform) { | ||
case TargetPlatform.android: | ||
return android; | ||
case TargetPlatform.iOS: | ||
return ios; | ||
case TargetPlatform.macOS: | ||
return macos; | ||
default: | ||
throw UnsupportedError( | ||
'DefaultFirebaseOptions are not supported for this platform.', | ||
); | ||
} | ||
} | ||
|
||
static const FirebaseOptions web = FirebaseOptions( | ||
apiKey: 'AIzaSyAFh7c37C6MyAVwRJylz7EwvzZSECqmcus', | ||
appId: '1:866672724757:web:3a0fad9cba4848ea19f71c', | ||
messagingSenderId: '866672724757', | ||
projectId: 'flutterfire-e2e-tests-2', | ||
authDomain: 'flutterfire-e2e-tests-2.firebaseapp.com', | ||
storageBucket: 'flutterfire-e2e-tests-2.appspot.com', | ||
); | ||
|
||
static const FirebaseOptions android = FirebaseOptions( | ||
apiKey: 'AIzaSyAMoRmAcD_NW0DVoO40ThJO1zDF2vDB7Rs', | ||
appId: '1:866672724757:android:d069b410181b65cf19f71c', | ||
messagingSenderId: '866672724757', | ||
projectId: 'flutterfire-e2e-tests-2', | ||
storageBucket: 'flutterfire-e2e-tests-2.appspot.com', | ||
); | ||
|
||
static const FirebaseOptions ios = FirebaseOptions( | ||
apiKey: 'AIzaSyDfWh055gUcnS6_Gqd_Jjwy7boVm5_E8oI', | ||
appId: '1:866672724757:ios:142139d84dda4ed419f71c', | ||
messagingSenderId: '866672724757', | ||
projectId: 'flutterfire-e2e-tests-2', | ||
storageBucket: 'flutterfire-e2e-tests-2.appspot.com', | ||
iosClientId: | ||
'866672724757-rncbdu3qrn0j423e1tfk2jg7jdvrhd8i.apps.googleusercontent.com', | ||
iosBundleId: 'io.flutter.plugins.firebase.firestoreExample', | ||
); | ||
|
||
static const FirebaseOptions macos = FirebaseOptions( | ||
apiKey: 'AIzaSyDfWh055gUcnS6_Gqd_Jjwy7boVm5_E8oI', | ||
appId: '1:866672724757:ios:3e35357fc677cc5719f71c', | ||
messagingSenderId: '866672724757', | ||
projectId: 'flutterfire-e2e-tests-2', | ||
storageBucket: 'flutterfire-e2e-tests-2.appspot.com', | ||
iosClientId: | ||
'866672724757-fup6o8riklmmc7mbo3b1jolbeadbb84m.apps.googleusercontent.com', | ||
iosBundleId: 'io.flutter.plugins.firebase.firestore.example', | ||
); | ||
} |
49 changes: 49 additions & 0 deletions
49
packages/cloud_firestore/cloud_firestore/example/test_driver/second_app_e2e.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
// Copyright 2020, the Chromium project authors. Please see the AUTHORS file | ||
// for details. All rights reserved. Use of this source code is governed by a | ||
// BSD-style license that can be found in the LICENSE file. | ||
|
||
import 'package:cloud_firestore/cloud_firestore.dart'; | ||
import 'package:firebase_core/firebase_core.dart'; | ||
import 'package:flutter_test/flutter_test.dart'; | ||
|
||
import 'firebase_options_secondary.dart'; | ||
|
||
void runSecondAppTests() { | ||
group('$FirebaseFirestore', () { | ||
late FirebaseFirestore firestore; | ||
late FirebaseFirestore secondFirestoreProject; | ||
|
||
setUpAll(() async { | ||
firestore = FirebaseFirestore.instance; | ||
FirebaseApp secondApp = await Firebase.initializeApp( | ||
name: 'secondApp', | ||
options: DefaultFirebaseOptions.currentPlatform, | ||
); | ||
secondFirestoreProject = FirebaseFirestore.instanceFor( | ||
app: secondApp, | ||
); | ||
}); | ||
|
||
group('Secondary app Firestore instance', () { | ||
test( | ||
'Second Firestore instance should fail due to firestore.rules forbidding data writes', | ||
() async { | ||
// successful write on default app instance | ||
await firestore | ||
.collection('flutter-tests/banned/doc') | ||
.add({'foo': 'bar'}); | ||
|
||
// permission denied on second app with Firebase that denies database writes | ||
await expectLater( | ||
secondFirestoreProject | ||
.collection('flutter-tests/banned/doc') | ||
.add({'foo': 'bar'}), | ||
throwsA( | ||
isA<FirebaseException>() | ||
.having((e) => e.code, 'code', 'permission-denied'), | ||
), | ||
); | ||
}); | ||
}); | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 0 additions & 17 deletions
17
packages/cloud_firestore/cloud_firestore_web/lib/src/interop/firebase_interop.dart
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.