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

Clean up Android Support Library references, drop dependency on androidx.legacy, & Android 4.4 and older code #2147

Merged
merged 14 commits into from
Jul 16, 2024

Conversation

jkasten2
Copy link
Member

@jkasten2 jkasten2 commented Jul 15, 2024

Description

One Line Summary

Clean up Android Support Library references, androidx.legacy:legacy-support-v4 dependency, and code for Android 4.4 and older.

Details

  • We no longer use anything from the androidx.legacy namespace since 5.0.0, however not all reference nor the depency itself was removed.
  • Since OneSignal 5.0.0 we bumped the minimum Android version to 21 (Android 5.0), however some code supporting Android 4.4 and older was not removed.

Motivation

Scope

Code changes with any references to the Android Support Library or Android 4.4 or older.

Testing

Manual testing

Tested on an Android 5.0 and Android 14 emulators. Ensuring notifications and IAMs display and background job runs.

Affected code checklist

  • Notifications
    • Display
    • Open
    • Push Processing
    • Confirm Deliveries
  • Outcomes
  • Sessions
  • In-App Messaging
  • REST API requests
  • Public API changes

Checklist

Overview

  • I have filled out all REQUIRED sections above
  • PR does one thing
    • If it is hard to explain how any codes changes are related to each other then it most likely needs to be more than one PR
  • Any Public API changes are explained in the PR details and conform to existing APIs

Testing

  • I have included test coverage for these changes, or explained why they are not needed
  • All automated tests pass, or I explained why that is not possible
  • I have personally tested this on my device, or explained why that is not possible

Final pass

  • Code is as readable as possible.
    • Simplify with less code, followed by splitting up code into well named functions and variables, followed by adding comments to the code.
  • I have reviewed this PR myself, ensuring it meets each checklist item
    • WIP (Work In Progress) is ok, but explain what is still in progress and what you would like feedback on. Start the PR title with "WIP" to indicate this.

This change is Reviewable

The last reference to the legacy library was WakefulBroadcastReceiver,
however it was simply an exist check and the code is no longer using
the class.
@jkasten2 jkasten2 added the WIP Work In Progress label Jul 15, 2024
Rename our AndroidSupportLibraryStatus to JetpackLibraryStatus to
reflect the new name of the Android library under their AndroidX
namespace.
All versions of Jetpack / Android contain the JobIntentService class.
Jetpack will always include the new constructor
Switched to using Jetpack's implementation. The original purpose of the
this class was not require Android Support Library 23, but we are long
past needing to support that.

Null signature is more strict with Jetpack, so some of the code needed
a small refactor.

There is one last function, getColor, which didn't belong there that
will be cleaned up in a follow up commit.
Removed the last function, getColor, so we can fully remove this class.
Switched to Jetpack which handles the Android version checks for us.
@jkasten2 jkasten2 force-pushed the clean-up-android-support-library-references branch from d35ecde to 6f7fa97 Compare July 15, 2024 22:16
Remove no longer needed Android version checks for IAM and Notification
code. The SDK only support Android 5 (API Level 21) and higher since
OneSignal 5.0.0.
We no longer support Android 4.4 and older since OneSignal 5.0.0 so we
can clean up this older alarm and service code.
@jkasten2 jkasten2 force-pushed the clean-up-android-support-library-references branch from 6f7fa97 to 284558c Compare July 15, 2024 23:00
@jkasten2 jkasten2 removed the WIP Work In Progress label Jul 15, 2024
@jkasten2 jkasten2 requested a review from nan-li July 15, 2024 23:04
@jkasten2 jkasten2 changed the title Clean up Android Support Library references Clean up Android Support Library references & Android 4.4 and older code Jul 16, 2024
Copy link
Contributor

@jinliu9508 jinliu9508 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thanks for the effort to clean up the codes that we no longer use.

@jkasten2 jkasten2 merged commit 4a70a39 into main Jul 16, 2024
2 checks passed
@jkasten2 jkasten2 deleted the clean-up-android-support-library-references branch July 16, 2024 19:49
@jkasten2 jkasten2 changed the title Clean up Android Support Library references & Android 4.4 and older code Clean up Android Support Library references, drop dependency on androidx.legacy, & Android 4.4 and older code Jul 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants