This commit is contained in:
Salakar 2017-10-04 19:20:21 +01:00
commit 3d960fa7ba
2 changed files with 4 additions and 3 deletions

View File

@ -7,6 +7,7 @@ import com.google.firebase.firestore.DocumentChange;
import com.google.firebase.firestore.DocumentSnapshot;
import com.google.firebase.firestore.QuerySnapshot;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
@ -146,7 +147,7 @@ public class FirestoreSerialize {
writableArray.pushMap((objectMapToWritable((Map<String, Object>) item)));
} else if (itemClass == Arrays.class) {
writableArray.pushArray(objectArrayToWritable((Object[]) item));
} else if (itemClass == List.class) {
} else if (itemClass == List.class || itemClass == ArrayList.class) {
List<Object> list = (List<Object>) item;
Object[] listAsArray = list.toArray(new Object[list.size()]);
writableArray.pushArray(objectArrayToWritable(listAsArray));
@ -185,7 +186,7 @@ public class FirestoreSerialize {
map.putMap(key, (objectMapToWritable((Map<String, Object>) value)));
} else if (valueClass == Arrays.class) {
map.putArray(key, objectArrayToWritable((Object[]) value));
} else if (valueClass == List.class) {
} else if (valueClass == List.class || valueClass == ArrayList.class) {
List<Object> list = (List<Object>) value;
Object[] array = list.toArray(new Object[list.size()]);
map.putArray(key, objectArrayToWritable(array));

View File

@ -249,7 +249,7 @@ function collectionReferenceTests({ describe, it, context, firebase }) {
it('should create Document', () => {
return firebase.native.firestore()
.doc('document-tests/doc2')
.set({ name: 'doc2' })
.set({ name: 'doc2', testArray: [] })
.then(async () => {
const doc = await firebase.native.firestore().doc('document-tests/doc2').get();
doc.data().name.should.equal('doc2');