Skip to content

Commit 38d2ebb

Browse files
authored
feat: update project dependencies and code refactoring (#1141)
1 parent b065eff commit 38d2ebb

Some content is hidden

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

45 files changed

+356
-805
lines changed

Diff for: .gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -45,3 +45,4 @@ jacoco.exec
4545
# Node
4646
node_modules/
4747
npm-debug.log
48+
*.hprof

Diff for: CONTRIBUTING.md

+13-19
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,7 @@
11
# Contributing to Parse SDK for Android
22
We want to make contributing to this project as easy and transparent as possible.
33

4-
## Our Development Process
5-
Most of our work will be done in public directly on GitHub. There may be changes done through our internal source control, but it will be rare and only as needed.
6-
7-
### `master` is unsafe
8-
Our goal is to keep `master` stable, but there may be changes that your application may not be compatible with. We'll do our best to publicize any breaking changes, but try to use our specific releases in any production environment.
9-
10-
### Pull Requests
4+
## Pull Requests
115
We actively welcome your pull requests. When we get one, we'll run some Parse-specific integration tests on it first. From here, we'll need to get a core member to sign off on the changes and then merge the pull request. For API changes we may need to fix internal uses, which could cause some delay. We'll do our best to provide updates and feedback throughout the process.
126

137
1. Fork the repo and create your branch from `master`.
@@ -16,13 +10,13 @@ We actively welcome your pull requests. When we get one, we'll run some Parse-sp
1610
4. Ensure the test suite passes.
1711
5. Make sure your code lints by running `./gradlew spotlessApply`.
1812

19-
## Bugs
20-
Although we try to keep developing on Parse easy, you still may run into some issues. Technical questions should be asked on [Stack Overflow][stack-overflow], and for everything else we'll be using GitHub issues.
13+
## Android API compatibility
2114

22-
### Known Issues
23-
We use GitHub issues to track public bugs. We will keep a close eye on this and try to make it clear when we have an internal fix in progress. Before filing a new issue, try to make sure your problem doesn't already exist.
15+
Consider the following to ensure a consistent Android API compatibility for the Parse Android SDK:
16+
- Target API level: Target the latest available stable API version.
17+
- Minimum API level: Cover at least ~90% of devices. The increment will be done only if dependencies requires it, if the statistics points that the API level covers at least ~90% of devices, or if a currently supported Android API level does not receive security updates anymore. Minimum API level changes must be marked in the release notes as breaking changes.
2418

25-
### Reporting New Issues
19+
## Reporting an Issue
2620
Not all issues are SDK issues. If you're unsure whether your bug is with the SDK or backend, you can test to see if it reproduces with our [REST API][rest-api] and [Parse API Console][parse-api-console]. If it does, you can report backend bugs [here][bug-reports].
2721

2822
To view the REST API network requests issued by the Parse SDK and responses from the Parse backend, please check out [OkHttp Interceptors][network-debugging-tool]. With this tool, you can either log network requests/responses to Android logcat, or log them to Chrome Debugger via Stetho.
@@ -41,10 +35,10 @@ This project adheres to the [Contributor Covenant Code of Conduct](https://githu
4135
## License
4236
By contributing to Parse Android SDK, you agree that your contributions will be licensed under its license.
4337

44-
[stack-overflow]: http://stackoverflow.com/tags/parse.com
45-
[bug-reports]: https://github.com/parse-community/parse-server
46-
[rest-api]: http://docs.parseplatform.org/rest/guide/
47-
[network-debugging-tool]: https://github.com/square/okhttp/wiki/Interceptors
48-
[parse-api-console]: http://blog.parseplatform.org/announcements/introducing-the-parse-api-console/
49-
[stacktrace-or-gtfo]: http://i.imgur.com/jacoj.jpg
50-
[tests-dir]: /parse/src/test/java/com/parse
38+
[stack-overflow]: http://stackoverflow.com/tags/parse.com
39+
[bug-reports]: https://github.com/parse-community/parse-server
40+
[rest-api]: http://docs.parseplatform.org/rest/guide/
41+
[network-debugging-tool]: https://github.com/square/okhttp/wiki/Interceptors
42+
[parse-api-console]: http://blog.parseplatform.org/announcements/introducing-the-parse-api-console/
43+
[stacktrace-or-gtfo]: http://i.imgur.com/jacoj.jpg
44+
[tests-dir]: /parse/src/test/java/com/parse

Diff for: README.md

+16-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
[![Snyk Badge](https://snyk.io/test/github/parse-community/Parse-SDK-Android/badge.svg)](https://snyk.io/test/github/parse-community/Parse-SDK-Android)
77
[![codecov](https://codecov.io/gh/parse-community/Parse-SDK-Android/branch/master/graph/badge.svg)](https://codecov.io/gh/parse-community/Parse-SDK-Android)
88

9-
[![android min api](https://img.shields.io/badge/Android_API->=16-66c718.svg)](https://github.com/parse-community/parse-dashboard/releases)
9+
[![android min api](https://img.shields.io/badge/Android_API->=21-66c718.svg)](https://github.com/parse-community/parse-dashboard/releases)
1010
[![auto-release](https://img.shields.io/badge/%F0%9F%9A%80-auto--release-9e34eb.svg)](https://github.com/parse-community/parse-dashboard/releases)
1111

1212
[![](https://jitpack.io/v/parse-community/Parse-SDK-Android.svg)](https://jitpack.io/#parse-community/Parse-SDK-Android)
@@ -25,13 +25,24 @@ A library that gives you access to the powerful Parse Server backend from your A
2525
---
2626

2727
- [Getting Started](#getting-started)
28+
- [Compatibility](#compatibility)
2829
- [Add Dependency](#add-dependency)
2930
- [Setup](#setup)
3031
- [Contributing](#contributing)
3132
- [More Parse Android Projects](#more-parse-android-projects)
3233

3334
# Getting Started
3435

36+
## Compatibility
37+
38+
The Parse Android SDK has the following Android API and [Gradle Plugin][gradle-plugin] compatibility.
39+
40+
| SDK version | Minimum API level | Targeting API level | Gradle Plugin |
41+
|-------------|-------------------|---------------------|---------------|
42+
| 1.26 | < API 16 | API 29 | 3.6.2 |
43+
| 2.0 | >= API 16 | API 30 | 4.2.2 |
44+
| 2.1 | >= API 21 | API 31 | 7.0.3 |
45+
3546
## Add Dependency
3647

3748
Add this in your root `build.gradle` file (**not** your module `build.gradle` file):
@@ -46,6 +57,7 @@ allprojects {
4657
```
4758

4859
Then, add the library to your project `build.gradle`
60+
4961
```gradle
5062
ext {
5163
parseVersion = "latest.version.here"
@@ -104,6 +116,7 @@ The custom `Application` class must be registered in `AndroidManifest.xml`:
104116
...
105117
</application>
106118
```
119+
107120
Note that if you are testing with a server using `http`, you will need to add `android:usesCleartextTraffic="true"` to your above `<application>` definition, but you should only do this while testing and should use `https` for your final product.
108121

109122
See the [guide][guide] for the rest of the SDK usage.
@@ -113,6 +126,7 @@ See the [guide][guide] for the rest of the SDK usage.
113126
We want to make contributing to this project as easy and transparent as possible. Please refer to the [Contribution Guidelines](CONTRIBUTING.md).
114127

115128
# More Parse Android Projects
129+
116130
These are other official libraries we made that can help you create your Parse app.
117131

118132
- [ParseGoogleUtils](/google) - Google login/signup.
@@ -131,3 +145,4 @@ As of April 5, 2017, Parse, LLC has transferred this code to the parse-community
131145

132146
[guide]: http://docs.parseplatform.org/android/guide/
133147
[open-collective-link]: https://opencollective.com/parse-server
148+
[gradle-plugin]: https://developer.android.com/studio/releases/gradle-plugin

Diff for: bolts-tasks/build.gradle

+18-16
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,12 @@ apply plugin: 'maven-publish'
88

99
dependencies {
1010
compileOnly 'com.google.android:android:4.1.1.4'
11-
testImplementation 'junit:junit:4.13.2'
11+
testImplementation "junit:junit:$rootProject.ext.junitVersion"
12+
}
13+
14+
java {
15+
sourceCompatibility = JavaVersion.VERSION_1_8
16+
targetCompatibility = JavaVersion.VERSION_1_8
1217
}
1318

1419
javadoc.options.addStringOption('Xdoclint:none', '-quiet')
@@ -28,6 +33,18 @@ artifacts {
2833
archives javadocJar
2934
}
3035

36+
//region Publishing
37+
38+
afterEvaluate {
39+
publishing {
40+
publications {
41+
boltsPublication(MavenPublication) {
42+
from components.java
43+
}
44+
}
45+
}
46+
}
47+
3148
//endregion
3249

3350
//region Code Coverage
@@ -44,18 +61,3 @@ jacocoTestReport {
4461
}
4562

4663
//endregion
47-
48-
java {
49-
sourceCompatibility = JavaVersion.VERSION_1_8
50-
targetCompatibility = JavaVersion.VERSION_1_8
51-
}
52-
53-
afterEvaluate {
54-
publishing {
55-
publications {
56-
boltsPublication(MavenPublication) {
57-
from components.java
58-
}
59-
}
60-
}
61-
}

Diff for: bolts-tasks/src/main/java/com/parse/boltsinternal/AggregateException.java

-25
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88

99
import java.io.PrintStream;
1010
import java.io.PrintWriter;
11-
import java.util.ArrayList;
1211
import java.util.Arrays;
1312
import java.util.Collections;
1413
import java.util.List;
@@ -101,28 +100,4 @@ public void printStackTrace(PrintWriter err) {
101100
err.append("\n");
102101
}
103102
}
104-
105-
/** @deprecated Please use {@link #getInnerThrowables()} instead. */
106-
@Deprecated
107-
public List<Exception> getErrors() {
108-
List<Exception> errors = new ArrayList<>();
109-
if (innerThrowables == null) {
110-
return errors;
111-
}
112-
113-
for (Throwable cause : innerThrowables) {
114-
if (cause instanceof Exception) {
115-
errors.add((Exception) cause);
116-
} else {
117-
errors.add(new Exception(cause));
118-
}
119-
}
120-
return errors;
121-
}
122-
123-
/** @deprecated Please use {@link #getInnerThrowables()} instead. */
124-
@Deprecated
125-
public Throwable[] getCauses() {
126-
return innerThrowables.toArray(new Throwable[0]);
127-
}
128103
}

Diff for: bolts-tasks/src/main/java/com/parse/boltsinternal/Task.java

-13
Original file line numberDiff line numberDiff line change
@@ -81,12 +81,6 @@ public static void setUnobservedExceptionHandler(UnobservedExceptionHandler eh)
8181
unobservedExceptionHandler = eh;
8282
}
8383

84-
/** @deprecated Please use {@link com.parse.boltsinternal.TaskCompletionSource ()} instead. */
85-
public static <TResult> Task<TResult>.TaskCompletionSource create() {
86-
Task<TResult> task = new Task<>();
87-
return task.new TaskCompletionSource();
88-
}
89-
9084
/** Creates a completed task with the given value. */
9185
@SuppressWarnings("unchecked")
9286
public static <TResult> Task<TResult> forResult(TResult value) {
@@ -988,11 +982,4 @@ public interface UnobservedExceptionHandler {
988982
*/
989983
void unobservedException(Task<?> t, UnobservedTaskException e);
990984
}
991-
992-
/** @deprecated Please use {@link com.parse.boltsinternal.TaskCompletionSource} instead. */
993-
public class TaskCompletionSource
994-
extends com.parse.boltsinternal.TaskCompletionSource<TResult> {
995-
996-
/* package */ TaskCompletionSource() {}
997-
}
998985
}

Diff for: bolts-tasks/src/test/java/com/parse/boltsinternal/TaskTest.java

-48
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88

99
import static org.junit.Assert.assertEquals;
1010
import static org.junit.Assert.assertFalse;
11-
import static org.junit.Assert.assertNotSame;
1211
import static org.junit.Assert.assertSame;
1312
import static org.junit.Assert.assertTrue;
1413

@@ -1133,51 +1132,4 @@ public void testSetCancelledOnCompletedTask() {
11331132
}
11341133

11351134
// endregion
1136-
1137-
// region deprecated
1138-
1139-
@SuppressWarnings("deprecation")
1140-
@Test
1141-
public void testDeprecatedTaskCompletionSource() {
1142-
Task<Void>.TaskCompletionSource tcsA = Task.create();
1143-
tcsA.setResult(null);
1144-
assertTrue(tcsA.getTask().isCompleted());
1145-
1146-
TaskCompletionSource<Void> tcsB = Task.create();
1147-
tcsB.setResult(null);
1148-
assertTrue(tcsA.getTask().isCompleted());
1149-
}
1150-
1151-
@SuppressWarnings("deprecation")
1152-
@Test
1153-
public void testDeprecatedAggregateExceptionMethods() {
1154-
final Exception error0 = new Exception("This is an exception (0).");
1155-
final Exception error1 = new Exception("This is an exception (1).");
1156-
final Error error2 = new Error("This is an error.");
1157-
1158-
List<Exception> exceptions = new ArrayList<>();
1159-
exceptions.add(error0);
1160-
exceptions.add(error1);
1161-
1162-
// Test old functionality
1163-
AggregateException aggregate = new AggregateException(exceptions);
1164-
assertEquals("There were multiple errors.", aggregate.getMessage());
1165-
assertEquals(2, aggregate.getErrors().size());
1166-
assertEquals(error0, aggregate.getErrors().get(0));
1167-
assertEquals(error1, aggregate.getErrors().get(1));
1168-
assertEquals(2, aggregate.getCauses().length);
1169-
assertEquals(error0, aggregate.getCauses()[0]);
1170-
assertEquals(error1, aggregate.getCauses()[1]);
1171-
1172-
// Test deprecated getErrors method returns sane results with non-Exceptions
1173-
aggregate = new AggregateException("message", new Throwable[] {error0, error1, error2});
1174-
assertEquals("message", aggregate.getMessage());
1175-
assertEquals(3, aggregate.getErrors().size());
1176-
assertEquals(error0, aggregate.getErrors().get(0));
1177-
assertEquals(error1, aggregate.getErrors().get(1));
1178-
assertNotSame(error2, aggregate.getErrors().get(2));
1179-
assertEquals(error2, aggregate.getErrors().get(2).getCause());
1180-
}
1181-
1182-
// endregion
11831135
}

Diff for: build.gradle

+10-8
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,18 @@ buildscript {
66
mavenCentral()
77
}
88
dependencies {
9-
classpath "com.android.tools.build:gradle:4.2.2"
10-
classpath "org.kt3k.gradle.plugin:coveralls-gradle-plugin:2.8.3"
11-
classpath "com.github.dcendents:android-maven-gradle-plugin:2.1"
9+
classpath "com.android.tools.build:gradle:7.0.3"
1210
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
1311
classpath "org.jacoco:org.jacoco.core:$jacocoVersion"
1412
classpath "com.dicedmelon.gradle:jacoco-android:0.1.5"
1513
classpath "io.freefair.gradle:android-gradle-plugins:4.2.0-m1"
16-
classpath "com.diffplug.spotless:spotless-plugin-gradle:5.16.0"
14+
classpath "com.diffplug.spotless:spotless-plugin-gradle:5.17.1"
1715
}
1816
}
1917

2018
plugins {
2119
id "com.github.ben-manes.versions" version "0.28.0"
22-
id "com.diffplug.spotless" version "5.16.0"
20+
id "com.diffplug.spotless" version "5.17.1"
2321
}
2422

2523
allprojects {
@@ -63,8 +61,12 @@ allprojects {
6361
}
6462

6563
ext {
66-
compileSdkVersion = 30
64+
compileSdkVersion = 31
6765

68-
minSdkVersion = 16
69-
targetSdkVersion = 30
66+
minSdkVersion = 21
67+
targetSdkVersion = 31
68+
69+
mockitoCoreVersion = "3.12.4"
70+
junitVersion = "4.13.2"
71+
robolectricVersion = "4.7"
7072
}

Diff for: coroutines/build.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ android {
4040
}
4141

4242
ext {
43-
coroutinesVersion = "1.5.0"
43+
coroutinesVersion = "1.5.2"
4444
}
4545

4646
dependencies {

Diff for: facebook/build.gradle

+5-4
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,13 @@ android {
3535
}
3636

3737
dependencies {
38-
api "com.facebook.android:facebook-login:8.2.0"
38+
api "com.facebook.android:facebook-login:12.1.0"
3939
implementation project(":parse")
4040

41-
testImplementation "junit:junit:4.13.2"
42-
testImplementation "org.mockito:mockito-core:3.9.0"
43-
testImplementation "org.robolectric:robolectric:4.6"
41+
testImplementation "junit:junit:$rootProject.ext.junitVersion"
42+
testImplementation "org.mockito:mockito-core:$rootProject.ext.mockitoCoreVersion"
43+
testImplementation "org.mockito:mockito-inline:$rootProject.ext.mockitoCoreVersion"
44+
testImplementation "org.robolectric:robolectric:$rootProject.ext.robolectricVersion"
4445
}
4546

4647
afterEvaluate {

0 commit comments

Comments
 (0)