Skip to content

Commit e8c70ee

Browse files
authored
Merge pull request #48 from FrangSierra/development
Proguard, listen queries and testing
2 parents c6afb7b + 8916019 commit e8c70ee

File tree

6 files changed

+643
-35
lines changed

6 files changed

+643
-35
lines changed

app/build.gradle

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
buildscript {
22
ext {
3-
rx_version = "2.1.8"
3+
rx_version = "2.1.10"
44
rx_android_version = "2.0.1"
55
firebase_version = "11.8.0"
6-
support_version = "26.1.0"
6+
support_version = "27.0.2"
77
}
88
}
99
apply plugin: 'com.android.library'
@@ -24,12 +24,7 @@ android {
2424
targetSdkVersion 27
2525
versionCode 5
2626
versionName "1.3"
27-
}
28-
buildTypes {
29-
release {
30-
minifyEnabled false
31-
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
32-
}
27+
consumerProguardFiles 'consumer-proguard-rules.pro'
3328
}
3429
}
3530

app/consumer-proguard-rules.pro

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Firebase uses Gson annotations and Gson uses generic type information stored in a class file when working with fields.
2+
# Proguard removes such information by default, so configure it to keep all of it.
3+
-keepattributes Signature

app/proguard-rules.pro

Lines changed: 0 additions & 17 deletions
This file was deleted.

app/src/main/java/durdinapps/rxfirebase2/DocumentSnapshotMapper.java

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,15 @@ public static <U> DocumentSnapshotMapper<DocumentSnapshot, U> of(Class<U> clazz)
2323
}
2424

2525
public static <U> DocumentSnapshotMapper<QuerySnapshot, List<U>> listOf(Class<U> clazz) {
26-
return new DocumentSnapshotMapper.TypedListDocumentSnapshotMapper<>(clazz);
26+
return new TypedListQuerySnapshotMapper<>(clazz);
2727
}
2828

2929
public static <U> DocumentSnapshotMapper<QuerySnapshot, List<U>> listOf(Class<U> clazz, Function<DocumentSnapshot, U> mapper) {
30-
return new DocumentSnapshotMapper.TypedListDocumentSnapshotMapper<>(clazz, mapper);
30+
return new TypedListQuerySnapshotMapper<>(clazz, mapper);
3131
}
3232

33-
public static <U> TypedMapDocumentSnapshotMapper<U> mapOf(Class<U> clazz) {
34-
return new DocumentSnapshotMapper.TypedMapDocumentSnapshotMapper<>(clazz);
33+
public static <U> TypedMapQuerySnapshotMapper<U> mapOf(Class<U> clazz) {
34+
return new TypedMapQuerySnapshotMapper<>(clazz);
3535
}
3636

3737
private static <U> U getDataSnapshotTypedValue(DocumentSnapshot documentSnapshot, Class<U> clazz) {
@@ -52,16 +52,16 @@ public U apply(final DocumentSnapshot documentSnapshot) {
5252
}
5353
}
5454

55-
private static class TypedListDocumentSnapshotMapper<U> extends DocumentSnapshotMapper<QuerySnapshot, List<U>> {
55+
private static class TypedListQuerySnapshotMapper<U> extends DocumentSnapshotMapper<QuerySnapshot, List<U>> {
5656

5757
private final Class<U> clazz;
5858
private final Function<DocumentSnapshot, U> mapper;
5959

60-
TypedListDocumentSnapshotMapper(final Class<U> clazz) {
60+
TypedListQuerySnapshotMapper(final Class<U> clazz) {
6161
this(clazz, null);
6262
}
6363

64-
TypedListDocumentSnapshotMapper(final Class<U> clazz, Function<DocumentSnapshot, U> mapper) {
64+
TypedListQuerySnapshotMapper(final Class<U> clazz, Function<DocumentSnapshot, U> mapper) {
6565
this.clazz = clazz;
6666
this.mapper = mapper;
6767
}
@@ -79,11 +79,11 @@ public List<U> apply(final QuerySnapshot querySnapshot) throws Exception {
7979
}
8080

8181

82-
private static class TypedMapDocumentSnapshotMapper<U> extends DocumentSnapshotMapper<QuerySnapshot, LinkedHashMap<String, U>> {
82+
private static class TypedMapQuerySnapshotMapper<U> extends DocumentSnapshotMapper<QuerySnapshot, LinkedHashMap<String, U>> {
8383

8484
private final Class<U> clazz;
8585

86-
TypedMapDocumentSnapshotMapper(final Class<U> clazz) {
86+
TypedMapQuerySnapshotMapper(final Class<U> clazz) {
8787
this.clazz = clazz;
8888
}
8989

@@ -100,7 +100,7 @@ public LinkedHashMap<String, U> apply(final QuerySnapshot querySnapshot) {
100100
static final Predicate<QuerySnapshot> QUERY_EXISTENCE_PREDICATE = new Predicate<QuerySnapshot>() {
101101
@Override
102102
public boolean test(@NonNull QuerySnapshot querySnapshot) throws Exception {
103-
return querySnapshot.isEmpty();
103+
return !querySnapshot.isEmpty();
104104
}
105105
};
106106

0 commit comments

Comments
 (0)