Skip to content

Commit 1d04ff4

Browse files
committed
Merge commit '8a5cd1f8de8db7db35d9f741bcfe30ef269100e5' into feat/contains-all-starting-with
2 parents 2bbac59 + 8a5cd1f commit 1d04ff4

File tree

23 files changed

+74
-256
lines changed

23 files changed

+74
-256
lines changed

.travis.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,13 @@ android:
1313
components:
1414
- tools
1515
- platform-tools
16-
- build-tools-26.0.1
17-
- android-26
18-
- doc-26
16+
- build-tools-27.0.0
17+
- android-27
18+
- doc-27
1919

2020
before_install:
2121
- pip install --user codecov
22+
- yes | sdkmanager "platforms;android-27"
2223

2324
script:
2425
- ./gradlew clean testDebugUnitTest jacocoTestReport

Parse/build.gradle

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ apply plugin: 'com.github.kt3k.coveralls'
55
apply plugin: 'com.jfrog.bintray'
66

77
group = 'com.parse'
8-
version = '1.16.3'
8+
version = '1.16.6'
99

1010
ext {
1111
projDescription = 'A library that gives you access to the powerful Parse cloud platform from your Android app.'
@@ -51,18 +51,18 @@ android {
5151
}
5252

5353
ext {
54-
okhttpVersion = '3.8.1'
54+
okhttpVersion = '3.9.0'
5555
}
5656

5757
dependencies {
58-
compile "com.android.support:support-annotations:$supportLibVersion"
59-
compile 'com.parse.bolts:bolts-tasks:1.4.0'
60-
compile "com.squareup.okhttp3:okhttp:$okhttpVersion"
61-
62-
testCompile 'org.robolectric:robolectric:3.3.2'
63-
testCompile 'org.skyscreamer:jsonassert:1.5.0'
64-
testCompile 'org.mockito:mockito-core:1.10.19'
65-
testCompile "com.squareup.okhttp3:mockwebserver:$okhttpVersion"
58+
api "com.android.support:support-annotations:$supportLibVersion"
59+
api 'com.parse.bolts:bolts-tasks:1.4.0'
60+
api "com.squareup.okhttp3:okhttp:$okhttpVersion"
61+
62+
testImplementation 'org.robolectric:robolectric:3.3.2'
63+
testImplementation 'org.skyscreamer:jsonassert:1.5.0'
64+
testImplementation 'org.mockito:mockito-core:1.10.19'
65+
testImplementation "com.squareup.okhttp3:mockwebserver:$okhttpVersion"
6666
}
6767

6868
android.libraryVariants.all { variant ->
@@ -244,7 +244,6 @@ bintray {
244244

245245
// Create the publication with the pom configuration:
246246
apply plugin: 'maven-publish'
247-
248247
publishing {
249248
publications {
250249
MyPublication(MavenPublication) {
@@ -264,7 +263,7 @@ publishing {
264263
def dependenciesNode = asNode().appendNode('dependencies')
265264

266265
//Iterate over the compile dependencies (we don't want the test ones), adding a <dependency> node for each
267-
configurations.compile.allDependencies.each {
266+
configurations.implementation.allDependencies.each {
268267
def dependencyNode = dependenciesNode.appendNode('dependency')
269268
dependencyNode.appendNode('groupId', it.group)
270269
dependencyNode.appendNode('artifactId', it.name)

Parse/src/main/java/com/parse/ParseDecoder.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,10 @@ public Object decode(Object object) {
7171
return convertJSONArrayToList((JSONArray) object);
7272
}
7373

74+
if (object == JSONObject.NULL) {
75+
return null;
76+
}
77+
7478
if (!(object instanceof JSONObject)) {
7579
return object;
7680
}

Parse/src/main/java/com/parse/ParseQuery.java

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -482,6 +482,14 @@ public Builder<T> whereGeoIntersects(String key, ParseGeoPoint point) {
482482
return addCondition(key, "$geoIntersects", dictionary);
483483
}
484484

485+
public Builder<T> whereText(String key, String value) {
486+
Map<String, String> termDictionary = new HashMap<>();
487+
Map<String, Map<String, String>> searchDictionary = new HashMap<>();
488+
termDictionary.put("$term", value);
489+
searchDictionary.put("$search", termDictionary);
490+
return addCondition(key, "$text", searchDictionary);
491+
}
492+
485493
public Builder<T> addCondition(String key, String condition,
486494
Collection<? extends Object> value) {
487495
return addConditionInternal(key, condition, Collections.unmodifiableCollection(value));
@@ -1681,6 +1689,23 @@ public ParseQuery<T> whereContainsAll(String key, Collection<?> values) {
16811689
return this;
16821690
}
16831691

1692+
/**
1693+
* Adds a constraint for finding string values that contain a provided
1694+
* string using Full Text Search
1695+
*
1696+
* Requires [email protected]
1697+
*
1698+
* @param key
1699+
* The key to be constrained.
1700+
* @param text
1701+
* String to be searched
1702+
* @return this, so you can chain this call.
1703+
*/
1704+
public ParseQuery<T> whereFullText(String key, String text) {
1705+
builder.whereText(key, text);
1706+
return this;
1707+
}
1708+
16841709
/**
16851710
* Add a constraint to the query that requires a particular key's value to contain each one of
16861711
* the provided list of strings entirely or just starting with given strings.

Parse/src/test/java/com/parse/ParseDecoderTest.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,12 @@ public void testNonJSONObject() {
7373
assertSame(obj, ParseDecoder.get().decode(obj));
7474
}
7575

76+
@Test
77+
public void testNull() {
78+
Object object = ParseDecoder.get().decode(JSONObject.NULL);
79+
assertNull(object);
80+
}
81+
7682
@Test
7783
public void testParseFieldOperations() throws JSONException {
7884
JSONObject json = new JSONObject();

Parse/src/test/java/com/parse/ParseQueryTest.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -365,6 +365,22 @@ public void testWhereContainedIn() throws Exception {
365365
verifyCondition(query, "key", "$in", values);
366366
}
367367

368+
@Test
369+
public void testWhereFullText() throws Exception {
370+
ParseQuery<ParseObject> query = new ParseQuery<>("Test");
371+
String text = "TestString";
372+
query.whereFullText("key", text);
373+
374+
// We generate a state to verify the content of the builder
375+
ParseQuery.State state = query.getBuilder().build();
376+
ParseQuery.QueryConstraints queryConstraints = state.constraints();
377+
ParseQuery.KeyConstraints keyConstraints = (ParseQuery.KeyConstraints) queryConstraints.get("key");
378+
Map searchDictionary = (Map) keyConstraints.get("$text");
379+
Map termDictionary = (Map) searchDictionary.get("$search");
380+
String value = (String) termDictionary.get("$term");
381+
assertEquals(value, text);
382+
}
383+
368384
@Test
369385
public void testWhereContainsAll() throws Exception {
370386
ParseQuery<ParseObject> query = new ParseQuery<>("Test");

ParseStarterProject/build.gradle

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

ParseStarterProject/proguard-rules.pro

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

ParseStarterProject/src/main/AndroidManifest.xml

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

ParseStarterProject/src/main/java/com/parse/starter/MainActivity.java

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

0 commit comments

Comments
 (0)