Skip to content

Commit 497202e

Browse files
awazgyawalithatfiredev
authored andcommitted
in and array contains fixes
* bump core version to 0.4.1+4 (firebase#1395) * Remove deprecated firebase-core dependency (firebase#1417) * Remove deprecated firebase-core dependency * [firebase_auth] getIdToken use actual refresh value instead of checking if object exists (firebase#1334) * getIdToken use actual refresh value instead of checking if object exists * getIdToken refresh integration test * update xcode to v11 (firebase#1420) * Update FirebaseApp creation in tests (firebase#1406) * [firebase_database] Support v2 android embedder. (firebase#287) * [firebase_remote_config] Support v2 android embedder. (firebase#282) * [CI] Add version to example apps (firebase#1426) * Add hardcode version to example apps * [firebase_core] Add platform interface (firebase#1324) * Move firebase_core to firebase_core/firebase_core * Add firebase_core_platform_interface package * Update cirrus scripts and documentation * [firebase_dynamic_links] Add support of expanding from short links (firebase#1381) * Fixes strict compilation errors. (firebase#1331) * Upgrade crashlytics to v2 plugin API (firebase#1370) * Upgraded Crashlytics to v2 of Flutter Plugins. * Format documentation lists (See also & Errors) correctly (firebase#298) Fix documentation list format. * [firebase_auth] Fix NoSuchMethodError exception in `reauthenticateWithCredential` (firebase#237) * [firebase_auth] Fix NoSuchMethodError exception Fix NoSuchMethodError exception when calling FirebaseUser.reauthenticateWithCredential * add integration test * Fix analyzer warnings Co-Authored-By: Collin Jackson <[email protected]> * [cloud_firestore] [firebase_performance] fix analyzer warnings (firebase#1453) * fix analyzer warnings * [CI] Skip flaky firebase_performance driver tests (firebase#1452) * Skip flaky firebase_performance driver tests * [firebase_auth] Added missing Exception to the reauthenticateWithCredential docs (firebase#1448) (firebase#1449) * Added missing Exception to the reauthenticateWithCredential docs (firebase#1448) * [firebase_remote_config] Bumps Android Firebase dependency to 19.0.3 (firebase#1443) * Bump AGP, Gradle & Google Services Plugin * Bumps dependency to Firebase Config 19.0.3 * Replaces a deprecated method usage with the updated version * [firebase_messaging] Use UNUserNotificationCenter for ios 10+ (firebase#121) * Use UNUserNotificationCenter for ios 10+ * Add swift documentation * Move http test to README * Update CONTRIBUTING.md (firebase#1473) Removes obsolete recommendations about removing mockito (which is now used in testing federated plugins). * [firebase_core] Migrate to platform_interface (firebase#1472) * [firebase_messaging] Add an ArgumentError when passing invalid background message (firebase#252) * [firebase_dynamic_links] support v2 embedding (firebase#1372) * [cloud_firestore] Fix test that used FirebaseApp.channel (firebase#1476) * [cloud_firestore] Fix test that used FirebaseApp.channel * dartfmt * bump version * Fixed dynamic issue * Fixed dynamic issue * FIxed Object to list of object mapping * Fixed text result expectation * Reverted some changes * Satisfying formatter * Added android x to pass the test * Fixed changed log auto formatting
1 parent 8c5b85f commit 497202e

File tree

202 files changed

+2386
-1063
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

202 files changed

+2386
-1063
lines changed

.cirrus.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ task:
6868
task:
6969
use_compute_credits: $CIRRUS_USER_COLLABORATOR == 'true'
7070
osx_instance:
71-
image: mojave-xcode-10.2-flutter
71+
image: mojave-xcode-11.2.1-flutter
7272
setup_script:
7373
- pod repo update
7474
upgrade_script:

AUTHORS

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,4 +41,5 @@ Jose Sanchez <[email protected]>
4141
Debkanchan Samadder <[email protected]>
4242
Audrius Karosevicius <[email protected]>
4343
Lukasz Piliszczuk <[email protected]>
44-
SoundReply Solutions GmbH <[email protected]>
44+
SoundReply Solutions GmbH <[email protected]>
45+
Michel Feinstein <[email protected]>

CONTRIBUTING.md

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -95,13 +95,6 @@ Plugins tests are run automatically on contributions using Cirrus CI. However, d
9595
cost constraints, pull requests from non-committers may not run all the tests
9696
automatically.
9797

98-
The plugins team prefers that unit tests are written using `setMockMethodCallHandler`
99-
rather than using mockito to mock out `MethodChannel`. For a list of the plugins that
100-
are still using the mockito testing style and need to be converted, see
101-
[issue 34284](https://github.com/flutter/flutter/issues/34284). If you are contributing
102-
tests to an existing plugin that uses mockito `MethodChannel`, consider converting
103-
them to use `setMockMethodCallHandler` instead.
104-
10598
Once you've gotten an LGTM from a project maintainer and once your PR has received
10699
the green light from all our automated testing, wait for one the package maintainers
107100
to merge the pull request and `pub submit` any affected packages.

packages/cloud_firestore/CHANGELOG.md

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,18 @@
22

33
* Added support for `in` and `array-contains-any` query operators.
44

5+
## 0.12.10+3
6+
7+
* Fixed test that used `FirebaseApp.channel`.
8+
9+
## 0.12.10+2
10+
11+
* Fixed analyzer warnings about unused fields.
12+
13+
## 0.12.10+1
14+
15+
* Formatted method documentations.
16+
517
## 0.12.10
618

719
* Added `FieldPath` class and `FieldPath.documentId` to refer to the document id in queries.
@@ -44,7 +56,7 @@
4456
## 0.12.9
4557

4658
* New optional `includeMetadataChanges` parameter added to `DocumentReference.snapshots()`
47-
and `Query.snapshots()`
59+
and `Query.snapshots()`
4860
* Fix example app crash when the `message` field was not a string
4961
* Internal renaming of method names.
5062

@@ -77,6 +89,7 @@
7789
* Automatically use version from pubspec.yaml when reporting usage to Firebase.
7890

7991
## 0.12.5+1
92+
8093
* Added support for combining any of `Query.startAtDocument` and `Query.startAfterDocument`
8194
with any of `Query.endAtDocument` and `Query.endBeforeDocument`.
8295

@@ -363,15 +376,19 @@ To update iOS SDK in existing projects run `pod update Firebase/Firestore`.
363376
* Add `DocumentSnapshot.exists`.
364377

365378
## 0.2.11
379+
366380
* Fix Dart 2 type errors.
367381

368382
## 0.2.10
383+
369384
* Fix Dart 2 type errors.
370385

371386
## 0.2.9
372-
* Relax sdk upper bound constraint to '<2.0.0' to allow 'edge' dart sdk use.
387+
388+
* Relax sdk upper bound constraint to '<2.0.0' to allow 'edge' dart sdk use.
373389

374390
## 0.2.8
391+
375392
* Support for Query.getDocuments
376393

377394
## 0.2.7

packages/cloud_firestore/android/src/main/java/io/flutter/plugins/firebase/cloudfirestore/CloudFirestorePlugin.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -291,18 +291,20 @@ private Query getQuery(Map<String, Object> arguments) {
291291
// Invalid type.
292292
}
293293
} else if ("array-contains-any".equals(operator)) {
294+
List<Object> values = (List<Object>) value;
294295
if (fieldName != null) {
295-
query = query.whereArrayContainsAny(fieldName, value);
296+
query = query.whereArrayContainsAny(fieldName, values);
296297
} else if (fieldPath != null) {
297-
query = query.whereArrayContainsAny(fieldPath, value);
298+
query = query.whereArrayContainsAny(fieldPath, values);
298299
} else {
299300
// Invalid type.
300301
}
301302
} else if ("in".equals(operator)) {
303+
List<Object> values = (List<Object>) value;
302304
if (fieldName != null) {
303-
query = query.whereIn(fieldName, value);
305+
query = query.whereIn(fieldName, values);
304306
} else if (fieldPath != null) {
305-
query = query.whereIn(fieldPath, value);
307+
query = query.whereIn(fieldPath, values);
306308
} else {
307309
// Invalid type.
308310
}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
11
org.gradle.jvmargs=-Xmx1536M
2+
android.useAndroidX=true
3+
android.enableJetifier=true

packages/cloud_firestore/example/test_driver/cloud_firestore.dart

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -340,8 +340,8 @@ void main() {
340340
await ref.document('maputo').setData(<String, dynamic>{
341341
'country': 'Mozambique',
342342
});
343-
QuerySnapshot snapshot = await ref
344-
.where('country', whereIn: ['USA', 'Mozambique'])
343+
final QuerySnapshot snapshot = await ref
344+
.where('country', whereIn: <String>['USA', 'Mozambique'])
345345
.orderBy('country')
346346
.getDocuments();
347347
final List<DocumentSnapshot> results = snapshot.documents;
@@ -356,23 +356,22 @@ void main() {
356356
final CollectionReference ref = firestore.collection('cities');
357357
await ref.document('la').setData(<String, dynamic>{
358358
'country': 'USA',
359-
'regions': ['west-coast', 'east-coast'],
359+
'regions': <String>['west-coast', 'east-coast'],
360360
});
361361
await ref.document('tokyo').setData(<String, dynamic>{
362362
'country': 'Japan',
363-
'regions': ['kanto', 'honshu'],
363+
'regions': <String>['kanto', 'honshu'],
364364
});
365-
QuerySnapshot snapshot = await ref
366-
.where('regions', arrayContainsAny: ['kanto', 'west-coast'])
365+
final QuerySnapshot snapshot = await ref
366+
.where('regions', arrayContainsAny: <String>['kanto', 'west-coast'])
367367
.orderBy('country')
368368
.getDocuments();
369369
final List<DocumentSnapshot> results = snapshot.documents;
370370
expect(results.length, 2);
371371
final DocumentSnapshot snapshot1 = results[0];
372372
final DocumentSnapshot snapshot2 = results[1];
373-
expect(snapshot1.documentID, 'moz');
374-
expect(snapshot2.documentID, 'usa');
373+
expect(snapshot1.documentID, 'la');
374+
expect(snapshot2.documentID, 'tokyo');
375375
});
376-
377376
});
378377
}

packages/cloud_firestore/lib/src/document_change.dart

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,22 +23,20 @@ enum DocumentChangeType {
2323
/// It contains the document affected and the type of change that occurred
2424
/// (added, modified, or removed).
2525
class DocumentChange {
26-
DocumentChange._(Map<dynamic, dynamic> data, this._firestore)
26+
DocumentChange._(Map<dynamic, dynamic> data, Firestore firestore)
2727
: oldIndex = data['oldIndex'],
2828
newIndex = data['newIndex'],
2929
document = DocumentSnapshot._(
3030
data['path'],
3131
_asStringKeyedMap(data['document']),
3232
SnapshotMetadata._(data["metadata"]["hasPendingWrites"],
3333
data["metadata"]["isFromCache"]),
34-
_firestore,
34+
firestore,
3535
),
3636
type = DocumentChangeType.values.firstWhere((DocumentChangeType type) {
3737
return type.toString() == data['type'];
3838
});
3939

40-
final Firestore _firestore;
41-
4240
/// The type of change that occurred (added, modified, or removed).
4341
final DocumentChangeType type;
4442

packages/cloud_firestore/lib/src/query.dart

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,8 +158,7 @@ class Query {
158158
addCondition(field, 'array-contains', arrayContains);
159159
if (arrayContainsAny != null)
160160
addCondition(field, 'array-contains-any', arrayContainsAny);
161-
if (whereIn != null)
162-
addCondition(field, 'in', whereIn);
161+
if (whereIn != null) addCondition(field, 'in', whereIn);
163162
if (isNull != null) {
164163
assert(
165164
isNull,
@@ -219,6 +218,7 @@ class Query {
219218
/// [endBefore], [endAtDocument] and [endBeforeDocument].
220219
///
221220
/// See also:
221+
///
222222
/// * [endAfterDocument] for a query that ends after a document.
223223
/// * [startAtDocument] for a query that starts at a document.
224224
/// * [endAtDocument] for a query that ends at a document.
@@ -253,6 +253,7 @@ class Query {
253253
/// [endBefore], [endAtDocument] and [endBeforeDocument].
254254
///
255255
/// See also:
256+
///
256257
/// * [startAfterDocument] for a query that starts after a document.
257258
/// * [endAtDocument] for a query that ends at a document.
258259
/// * [endBeforeDocument] for a query that ends before a document.
@@ -321,6 +322,7 @@ class Query {
321322
/// [startAfter], [startAtDocument] and [startAfterDocument].
322323
///
323324
/// See also:
325+
///
324326
/// * [startAfterDocument] for a query that starts after a document.
325327
/// * [startAtDocument] for a query that starts at a document.
326328
/// * [endBeforeDocument] for a query that ends before a document.
@@ -372,6 +374,7 @@ class Query {
372374
/// [startAfter], [startAtDocument] and [startAfterDocument].
373375
///
374376
/// See also:
377+
///
375378
/// * [startAfterDocument] for a query that starts after document.
376379
/// * [startAtDocument] for a query that starts at a document.
377380
/// * [endAtDocument] for a query that ends at a document.

packages/cloud_firestore/lib/src/query_snapshot.dart

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ part of cloud_firestore;
66

77
/// A QuerySnapshot contains zero or more DocumentSnapshot objects.
88
class QuerySnapshot {
9-
QuerySnapshot._(Map<dynamic, dynamic> data, this._firestore)
9+
QuerySnapshot._(Map<dynamic, dynamic> data, Firestore firestore)
1010
: documents = List<DocumentSnapshot>.generate(data['documents'].length,
1111
(int index) {
1212
return DocumentSnapshot._(
@@ -16,14 +16,14 @@ class QuerySnapshot {
1616
data['metadatas'][index]['hasPendingWrites'],
1717
data['metadatas'][index]['isFromCache'],
1818
),
19-
_firestore,
19+
firestore,
2020
);
2121
}),
2222
documentChanges = List<DocumentChange>.generate(
2323
data['documentChanges'].length, (int index) {
2424
return DocumentChange._(
2525
data['documentChanges'][index],
26-
_firestore,
26+
firestore,
2727
);
2828
}),
2929
metadata = SnapshotMetadata._(
@@ -39,6 +39,4 @@ class QuerySnapshot {
3939
final List<DocumentChange> documentChanges;
4040

4141
final SnapshotMetadata metadata;
42-
43-
final Firestore _firestore;
4442
}

packages/cloud_firestore/pubspec.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
name: cloud_firestore
2-
description: Flutter plugin for Cloud Firestore, a cloud-hosted, noSQL database with
2+
description:
3+
Flutter plugin for Cloud Firestore, a cloud-hosted, noSQL database with
34
live synchronization and offline support on Android and iOS.
45
author: Flutter Team <[email protected]>
56
homepage: https://github.com/FirebaseExtended/flutterfire/tree/master/packages/cloud_firestore

packages/cloud_firestore/test/cloud_firestore_test.dart

Lines changed: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,13 @@ void main() {
2828
"hasPendingWrites": false,
2929
"isFromCache": false,
3030
};
31+
const MethodChannel firebaseCoreChannel =
32+
MethodChannel('plugins.flutter.io/firebase_core');
33+
3134
setUp(() async {
3235
mockHandleId = 0;
3336
// Required for FirebaseApp.configure
34-
FirebaseApp.channel.setMockMethodCallHandler(
37+
firebaseCoreChannel.setMockMethodCallHandler(
3538
(MethodCall methodCall) async {},
3639
);
3740
app = await FirebaseApp.configure(
@@ -175,7 +178,7 @@ void main() {
175178
});
176179

177180
test('settings', () async {
178-
final FirebaseApp app = const FirebaseApp(name: "testApp2");
181+
final FirebaseApp app = FirebaseApp(name: "testApp2");
179182
final Firestore firestoreWithSettings = Firestore(app: app);
180183
await firestoreWithSettings.settings(
181184
persistenceEnabled: true,
@@ -396,10 +399,10 @@ void main() {
396399
});
397400
test('where in', () async {
398401
final StreamSubscription<QuerySnapshot> subscription =
399-
collectionReference
400-
.where('country', whereIn: ['USA', 'Japan'])
401-
.snapshots()
402-
.listen((QuerySnapshot querySnapshot) {});
402+
collectionReference
403+
.where('country', whereIn: <String>['USA', 'Japan'])
404+
.snapshots()
405+
.listen((QuerySnapshot querySnapshot) {});
403406
subscription.cancel();
404407
await Future<void>.delayed(Duration.zero);
405408
expect(
@@ -413,7 +416,11 @@ void main() {
413416
'isCollectionGroup': false,
414417
'parameters': <String, dynamic>{
415418
'where': <List<dynamic>>[
416-
<dynamic>['country', 'in', ['USA', 'Japan']],
419+
<dynamic>[
420+
'country',
421+
'in',
422+
<String>['USA', 'Japan']
423+
],
417424
],
418425
'orderBy': <List<dynamic>>[],
419426
},
@@ -429,10 +436,11 @@ void main() {
429436
});
430437
test('where array-contains-any', () async {
431438
final StreamSubscription<QuerySnapshot> subscription =
432-
collectionReference
433-
.where('regions', arrayContainsAny: ['west-coast', 'east-coast'])
434-
.snapshots()
435-
.listen((QuerySnapshot querySnapshot) {});
439+
collectionReference
440+
.where('regions',
441+
arrayContainsAny: <String>['west-coast', 'east-coast'])
442+
.snapshots()
443+
.listen((QuerySnapshot querySnapshot) {});
436444
subscription.cancel();
437445
await Future<void>.delayed(Duration.zero);
438446
expect(
@@ -446,7 +454,11 @@ void main() {
446454
'isCollectionGroup': false,
447455
'parameters': <String, dynamic>{
448456
'where': <List<dynamic>>[
449-
<dynamic>['regions', 'array-contains-any', ['west-coast', 'east-coast']],
457+
<dynamic>[
458+
'regions',
459+
'array-contains-any',
460+
<String>['west-coast', 'east-coast']
461+
],
450462
],
451463
'orderBy': <List<dynamic>>[],
452464
},

packages/cloud_functions/test/cloud_functions_test.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ void main() {
3434
.getHttpsCallable(functionName: 'baz')
3535
.call();
3636
final HttpsCallable callable =
37-
CloudFunctions(app: const FirebaseApp(name: '1337'), region: 'space')
37+
CloudFunctions(app: FirebaseApp(name: '1337'), region: 'space')
3838
.getHttpsCallable(functionName: 'qux')
3939
..timeout = const Duration(days: 300);
4040
await callable.call(<String, dynamic>{

packages/firebase_analytics/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 5.0.7
2+
3+
* Formatted `setCurrentScreen` documentation.
4+
15
## 5.0.6
26

37
* Updated README instructions for contributing for consistency with other Flutterfire plugins.

packages/firebase_analytics/lib/firebase_analytics.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,8 @@ class FirebaseAnalytics {
8686
///
8787
/// See also:
8888
///
89-
/// https://firebase.google.com/docs/reference/android/com/google/firebase/analytics/FirebaseAnalytics.html#setCurrentScreen(android.app.Activity, java.lang.String, java.lang.String)
90-
/// https://firebase.google.com/docs/reference/ios/firebaseanalytics/api/reference/Classes/FIRAnalytics#setscreennamescreenclass
89+
/// * https://firebase.google.com/docs/reference/android/com/google/firebase/analytics/FirebaseAnalytics.html#setCurrentScreen(android.app.Activity, java.lang.String, java.lang.String)
90+
/// * https://firebase.google.com/docs/reference/ios/firebaseanalytics/api/reference/Classes/FIRAnalytics#setscreennamescreenclass
9191
Future<void> setCurrentScreen(
9292
{@required String screenName,
9393
String screenClassOverride = 'Flutter'}) async {

packages/firebase_analytics/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ description: Flutter plugin for Google Analytics for Firebase, an app measuremen
33
solution that provides insight on app usage and user engagement on Android and iOS.
44
author: Flutter Team <[email protected]>
55
homepage: https://github.com/FirebaseExtended/flutterfire/tree/master/packages/firebase_analytics
6-
version: 5.0.6
6+
version: 5.0.7
77

88
flutter:
99
plugin:

0 commit comments

Comments
 (0)