Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: update project dependencies and code refactoring #1141

Merged
merged 23 commits into from
Nov 25, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,4 @@ jacoco.exec
# Node
node_modules/
npm-debug.log
*.hprof
32 changes: 13 additions & 19 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@
# Contributing to Parse SDK for Android
We want to make contributing to this project as easy and transparent as possible.

## Our Development Process
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.

### `master` is unsafe
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.

### Pull Requests
## Pull Requests
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.

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

## Bugs
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.
## Android API compatibility

### Known Issues
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.
Consider the following to ensure a consistent Android API compatibility for the Parse Android SDK:
- Target API level: Target the latest available stable API version.
- 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.

### Reporting New Issues
## Reporting an Issue
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].

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.
Expand All @@ -41,10 +35,10 @@ This project adheres to the [Contributor Covenant Code of Conduct](https://githu
## License
By contributing to Parse Android SDK, you agree that your contributions will be licensed under its license.

[stack-overflow]: http://stackoverflow.com/tags/parse.com
[bug-reports]: https://github.com/parse-community/parse-server
[rest-api]: http://docs.parseplatform.org/rest/guide/
[network-debugging-tool]: https://github.com/square/okhttp/wiki/Interceptors
[parse-api-console]: http://blog.parseplatform.org/announcements/introducing-the-parse-api-console/
[stacktrace-or-gtfo]: http://i.imgur.com/jacoj.jpg
[tests-dir]: /parse/src/test/java/com/parse
[stack-overflow]: http://stackoverflow.com/tags/parse.com
[bug-reports]: https://github.com/parse-community/parse-server
[rest-api]: http://docs.parseplatform.org/rest/guide/
[network-debugging-tool]: https://github.com/square/okhttp/wiki/Interceptors
[parse-api-console]: http://blog.parseplatform.org/announcements/introducing-the-parse-api-console/
[stacktrace-or-gtfo]: http://i.imgur.com/jacoj.jpg
[tests-dir]: /parse/src/test/java/com/parse
17 changes: 16 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
[![Snyk Badge](https://snyk.io/test/github/parse-community/Parse-SDK-Android/badge.svg)](https://snyk.io/test/github/parse-community/Parse-SDK-Android)
[![codecov](https://codecov.io/gh/parse-community/Parse-SDK-Android/branch/master/graph/badge.svg)](https://codecov.io/gh/parse-community/Parse-SDK-Android)

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

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

- [Getting Started](#getting-started)
- [Compatibility](#compatibility)
- [Add Dependency](#add-dependency)
- [Setup](#setup)
- [Contributing](#contributing)
- [More Parse Android Projects](#more-parse-android-projects)

# Getting Started

## Compatibility

The Parse Android SDK has the following Android API and [Gradle Plugin][gradle-plugin] compatibility.

| SDK version | Minimum API level | Targeting API level | Gradle Plugin |
|-------------|-------------------|---------------------|---------------|
| 1.26 | < API 16 | API 29 | 3.6.2 |
| 2.0 | >= API 16 | API 30 | 4.2.2 |
| 2.1 | >= API 21 | API 31 | 7.0.3 |

## Add Dependency

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

Then, add the library to your project `build.gradle`

```gradle
ext {
parseVersion = "latest.version.here"
Expand Down Expand Up @@ -104,6 +116,7 @@ The custom `Application` class must be registered in `AndroidManifest.xml`:
...
</application>
```

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.

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

# More Parse Android Projects

These are other official libraries we made that can help you create your Parse app.

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

[guide]: http://docs.parseplatform.org/android/guide/
[open-collective-link]: https://opencollective.com/parse-server
[gradle-plugin]: https://developer.android.com/studio/releases/gradle-plugin
34 changes: 18 additions & 16 deletions bolts-tasks/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,12 @@ apply plugin: 'maven-publish'

dependencies {
compileOnly 'com.google.android:android:4.1.1.4'
testImplementation 'junit:junit:4.13.2'
testImplementation "junit:junit:$rootProject.ext.junitVersion"
}

java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}

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

//region Publishing

afterEvaluate {
publishing {
publications {
boltsPublication(MavenPublication) {
from components.java
}
}
}
}

//endregion

//region Code Coverage
Expand All @@ -44,18 +61,3 @@ jacocoTestReport {
}

//endregion

java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}

afterEvaluate {
publishing {
publications {
boltsPublication(MavenPublication) {
from components.java
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

import java.io.PrintStream;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
Expand Down Expand Up @@ -101,28 +100,4 @@ public void printStackTrace(PrintWriter err) {
err.append("\n");
}
}

/** @deprecated Please use {@link #getInnerThrowables()} instead. */
@Deprecated
public List<Exception> getErrors() {
List<Exception> errors = new ArrayList<>();
if (innerThrowables == null) {
return errors;
}

for (Throwable cause : innerThrowables) {
if (cause instanceof Exception) {
errors.add((Exception) cause);
} else {
errors.add(new Exception(cause));
}
}
return errors;
}

/** @deprecated Please use {@link #getInnerThrowables()} instead. */
@Deprecated
public Throwable[] getCauses() {
return innerThrowables.toArray(new Throwable[0]);
}
}
13 changes: 0 additions & 13 deletions bolts-tasks/src/main/java/com/parse/boltsinternal/Task.java
Original file line number Diff line number Diff line change
Expand Up @@ -81,12 +81,6 @@ public static void setUnobservedExceptionHandler(UnobservedExceptionHandler eh)
unobservedExceptionHandler = eh;
}

/** @deprecated Please use {@link com.parse.boltsinternal.TaskCompletionSource ()} instead. */
public static <TResult> Task<TResult>.TaskCompletionSource create() {
Task<TResult> task = new Task<>();
return task.new TaskCompletionSource();
}

/** Creates a completed task with the given value. */
@SuppressWarnings("unchecked")
public static <TResult> Task<TResult> forResult(TResult value) {
Expand Down Expand Up @@ -988,11 +982,4 @@ public interface UnobservedExceptionHandler {
*/
void unobservedException(Task<?> t, UnobservedTaskException e);
}

/** @deprecated Please use {@link com.parse.boltsinternal.TaskCompletionSource} instead. */
public class TaskCompletionSource
extends com.parse.boltsinternal.TaskCompletionSource<TResult> {

/* package */ TaskCompletionSource() {}
}
}
48 changes: 0 additions & 48 deletions bolts-tasks/src/test/java/com/parse/boltsinternal/TaskTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotSame;
import static org.junit.Assert.assertSame;
import static org.junit.Assert.assertTrue;

Expand Down Expand Up @@ -1133,51 +1132,4 @@ public void testSetCancelledOnCompletedTask() {
}

// endregion

// region deprecated

@SuppressWarnings("deprecation")
@Test
public void testDeprecatedTaskCompletionSource() {
Task<Void>.TaskCompletionSource tcsA = Task.create();
tcsA.setResult(null);
assertTrue(tcsA.getTask().isCompleted());

TaskCompletionSource<Void> tcsB = Task.create();
tcsB.setResult(null);
assertTrue(tcsA.getTask().isCompleted());
}

@SuppressWarnings("deprecation")
@Test
public void testDeprecatedAggregateExceptionMethods() {
final Exception error0 = new Exception("This is an exception (0).");
final Exception error1 = new Exception("This is an exception (1).");
final Error error2 = new Error("This is an error.");

List<Exception> exceptions = new ArrayList<>();
exceptions.add(error0);
exceptions.add(error1);

// Test old functionality
AggregateException aggregate = new AggregateException(exceptions);
assertEquals("There were multiple errors.", aggregate.getMessage());
assertEquals(2, aggregate.getErrors().size());
assertEquals(error0, aggregate.getErrors().get(0));
assertEquals(error1, aggregate.getErrors().get(1));
assertEquals(2, aggregate.getCauses().length);
assertEquals(error0, aggregate.getCauses()[0]);
assertEquals(error1, aggregate.getCauses()[1]);

// Test deprecated getErrors method returns sane results with non-Exceptions
aggregate = new AggregateException("message", new Throwable[] {error0, error1, error2});
assertEquals("message", aggregate.getMessage());
assertEquals(3, aggregate.getErrors().size());
assertEquals(error0, aggregate.getErrors().get(0));
assertEquals(error1, aggregate.getErrors().get(1));
assertNotSame(error2, aggregate.getErrors().get(2));
assertEquals(error2, aggregate.getErrors().get(2).getCause());
}

// endregion
}
18 changes: 10 additions & 8 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,18 @@ buildscript {
mavenCentral()
}
dependencies {
classpath "com.android.tools.build:gradle:4.2.2"
classpath "org.kt3k.gradle.plugin:coveralls-gradle-plugin:2.8.3"
classpath "com.github.dcendents:android-maven-gradle-plugin:2.1"
classpath "com.android.tools.build:gradle:7.0.3"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "org.jacoco:org.jacoco.core:$jacocoVersion"
classpath "com.dicedmelon.gradle:jacoco-android:0.1.5"
classpath "io.freefair.gradle:android-gradle-plugins:4.2.0-m1"
classpath "com.diffplug.spotless:spotless-plugin-gradle:5.16.0"
classpath "com.diffplug.spotless:spotless-plugin-gradle:5.17.1"
}
}

plugins {
id "com.github.ben-manes.versions" version "0.28.0"
id "com.diffplug.spotless" version "5.16.0"
id "com.diffplug.spotless" version "5.17.1"
}

allprojects {
Expand Down Expand Up @@ -63,8 +61,12 @@ allprojects {
}

ext {
compileSdkVersion = 30
compileSdkVersion = 31

minSdkVersion = 16
targetSdkVersion = 30
minSdkVersion = 21
targetSdkVersion = 31

mockitoCoreVersion = "3.12.4"
junitVersion = "4.13.2"
robolectricVersion = "4.7"
}
2 changes: 1 addition & 1 deletion coroutines/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ android {
}

ext {
coroutinesVersion = "1.5.0"
coroutinesVersion = "1.5.2"
}

dependencies {
Expand Down
9 changes: 5 additions & 4 deletions facebook/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,13 @@ android {
}

dependencies {
api "com.facebook.android:facebook-login:8.2.0"
api "com.facebook.android:facebook-login:12.1.0"
implementation project(":parse")

testImplementation "junit:junit:4.13.2"
testImplementation "org.mockito:mockito-core:3.9.0"
testImplementation "org.robolectric:robolectric:4.6"
testImplementation "junit:junit:$rootProject.ext.junitVersion"
testImplementation "org.mockito:mockito-core:$rootProject.ext.mockitoCoreVersion"
testImplementation "org.mockito:mockito-inline:$rootProject.ext.mockitoCoreVersion"
testImplementation "org.robolectric:robolectric:$rootProject.ext.robolectricVersion"
}

afterEvaluate {
Expand Down
Loading