parse-community / Parse-SDK-Android

The Android SDK for Parse Platform
https://parseplatform.org/
Other
1.88k stars 739 forks source link

feat: update project dependencies and code refactoring #1141

Closed azlekov closed 2 years ago

azlekov commented 2 years ago

New Pull Request Checklist

Issue Description

The project should be up-to-date with all dependencies, Gradle version, Android Studio etc but is not. It uses an old versions of the integration libraries like Firebase, Facebook and also the Parse Android SDK is stuck on very old version of OkHttp which does not support newer TLS versions. Updating OkHttp requires bump of min Android SDK version to API 21. Also the new Firebase libraries also bump their min version to API 19

Also some of the modules uses deprecated APIs from Bolts and other libraries. The idea is to update the source base a bit.

Related issue: #1142 #1100 #1123 https://github.com/parse-community/Parse-SDK-Android/pull/1095 Closes: #1142

Approach

The approach here will be to update all dependencies, Gradle wrapper version and AGP to the latest versions. Also cleaning up all deprecated code calls and replace them with their new options or variants. Because there was no activity and new Parse Android SDK versions lately, it's save to remove all deprecated Parse APIs.

Breaking changes

TODOs before merging

parse-github-assistant[bot] commented 2 years ago

Thanks for opening this pull request!

codecov[bot] commented 2 years ago

Codecov Report

Merging #1141 (5a482ba) into master (d420371) will increase coverage by 0.53%. The diff coverage is 52.63%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master    #1141      +/-   ##
============================================
+ Coverage     66.27%   66.81%   +0.53%     
+ Complexity     2251     2249       -2     
============================================
  Files           122      121       -1     
  Lines          9983     9892      -91     
  Branches       1343     1332      -11     
============================================
- Hits           6616     6609       -7     
+ Misses         2850     2771      -79     
+ Partials        517      512       -5     
Impacted Files Coverage Δ
parse/src/main/java/com/parse/Parse.java 61.68% <ø> (+0.28%) :arrow_up:
parse/src/main/java/com/parse/ParseConfig.java 95.53% <ø> (ø)
.../src/main/java/com/parse/ParseEventuallyQueue.java 10.95% <0.00%> (ø)
parse/src/main/java/com/parse/ParseObject.java 61.35% <ø> (ø)
parse/src/main/java/com/parse/ParsePlugins.java 31.25% <0.00%> (+1.48%) :arrow_up:
parse/src/main/java/com/parse/ParsePolygon.java 82.27% <ø> (ø)
...ain/java/com/parse/ParsePushBroadcastReceiver.java 45.16% <0.00%> (+1.75%) :arrow_up:
parse/src/main/java/com/parse/ParseQuery.java 76.99% <ø> (ø)
parse/src/main/java/com/parse/PushRouter.java 0.00% <0.00%> (ø)
...rse/src/main/java/com/parse/ParseCommandCache.java 8.12% <50.00%> (ø)
... and 7 more

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update b065eff...5a482ba. Read the comment docs.

azlekov commented 2 years ago

@mtrezza in continue of https://github.com/parse-community/Parse-SDK-Android/pull/1095 I did another batch of dependencies updates to all modules dependencies and update again everything. Unfortunately it's time to update min SDK version to 21 as we discussed in #1123 because of two reasons:

  1. Firebase requires now min SDK API 19
  2. OkHttp requires min SDK API 21

The discussion here https://github.com/parse-community/Parse-SDK-Android/issues/1123#issuecomment-942281184

Fortunately the upgrades went smooth so far without big changes.

azlekov commented 2 years ago

@mtrezza again this PR is baby step ahead. I have updated the description adding the breaking changes this PR introduce. And because there was no activity on the Android SDK if you are okay I decide to clean up and remove the deprecated methods Parse Android SDK provides, so it will be less code to maintain and to migrate to Kotlin after that.

mtrezza commented 2 years ago

@L3K0V you marked this as DRAFT after requesting the review. If you still request the review please remove the DRAFT flag and request again.

azlekov commented 2 years ago

Sorry @mtrezza, I found few things which I should improve soon.

azlekov commented 2 years ago

@mtrezza here you go:

but was google play services required for 22 as well?

In the release notes they say nothing about bumping the API level, but the release we use (the latest available) is from July, so I expect soon new versions to be released.

Deprecated methods:

Parse

Twitter Utils

I wonder how to compose an COMPATIBILITY.md or something similar to define the API levels supported and close also https://github.com/parse-community/Parse-SDK-Android/issues/1123 I'm open for ideas. Can you help me with this?

azlekov commented 2 years ago

@mtrezza maybe I didn't get you right about

but was google play services required for 22 as well?

I think still Google Play Services are required for all versions of Firebase Messaging. In the release notes they said that:

Due to its dependency on Google Play services, this SDK now requires devices and emulators to target API level 19 (KitKat) or higher and to use Android 4.4 or higher.

So I expect that they still depend on it. Also here is mentioned that cloud messaing still requires Google Play Services

mtrezza commented 2 years ago

Yes, I have seen that table, but I couldn't tell from it whether they only added the Google Play Services dependency with version 23 or whether Cloud Messaging was already dependent on GPS in version 22. But if you say it was dependent also in version 22 then it's not a breaking change we need to mention.

I wonder how to compose an COMPATIBILITY.md or something similar to define the API levels supported and close also #1123 I'm open for ideas. Can you help me with this?

Maybe take a look at this compatibility table for inspiration, simple and it works; and you can also just add this as a headline to the README instead of creating a new .md doc.

mtrezza commented 2 years ago

I'm suggesting this breaking note in the release notes, any additions/changes? Never mind the formatting, it has to be written in 1 line for the changelog auto-generator to pick it up properly.

BREAKING CHANGE: The required minimum API level changes from 16 to 21. The following deprecated methods are removed: Parse.getParseDir() (use getParseCacheDir(String) or getParseFilesDir(String) instead), ParseTwitterUtils.link(ParseUser, Context) (use linkInBackground(Context, ParseUser) instead), ParseTwitterUtils.link(ParseUser, String, String, String, String) (use linkInBackground(ParseUser, String, String, String, String) instead).

azlekov commented 2 years ago

@mtrezza I have added some Compatibility section. It would be great if you check it.

azlekov commented 2 years ago

LGTM