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

fix(datastore): Update network connection availability checking status logic in ReachabilityMonitor of Datastore #2854

Open
wants to merge 15 commits into
base: main
Choose a base branch
from

Conversation

aladine
Copy link

@aladine aladine commented Jun 19, 2024

  • PR title and description conform to Pull Request guidelines.

Issue #, if available:
#2738

Description of changes:
Enhance the capability to detect network connection availabilities in syncengine of aws datastore. This includes:

  • Instead of checking activeNetwork, connectivity provider could retrieve getNetworkCapabilities and check the network capability is valid.
  • Network callback should have an extra onCapabilitiesChanged(). Since amplify-android supports API 23 and above, onCapabilitiesChanged should be called immediately after onAvailable callback and contains accurate information to determine network connection type.
  • A more fine grained detail to support different Android SDK version for network checking.

How did you test these changes?
(Please add a line here how the changes were tested)
Add unit test to verify the new change

Documentation update required?

  • No
  • Yes (Please include a PR link for the documentation update)

General Checklist

  • Added Unit Tests
  • Added Integration Tests
  • Security oriented best practices and standards are followed (e.g. using input sanitization, principle of least privilege, etc)

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@aladine aladine requested a review from a team as a code owner June 19, 2024 14:09
@aladine aladine changed the title Update Update network connection availability checking status logic in ReachabilityMonitor of Datastore Jun 19, 2024
@tylerjroach
Copy link
Member

Hi @aladine, thank you for your contribution submission. We will prioritize reviewing this PR and reply back!

@lawmicha lawmicha changed the title Update network connection availability checking status logic in ReachabilityMonitor of Datastore fix(datastore): Update network connection availability checking status logic in ReachabilityMonitor of Datastore Jul 16, 2024
@aladine
Copy link
Author

aladine commented Jul 29, 2024

Any update in this pull request?

@tylerjroach
Copy link
Member

Hi @aladine, sorry for the delay. I will try and provide some feedback within next few days and suggest any updates if needed.

@aladine
Copy link
Author

aladine commented Aug 2, 2024

No problem, I am happy to answer all the questions or concerns for this pull request.

Copy link
Member

@mattcreaser mattcreaser left a comment

Choose a reason for hiding this comment

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

Looks good to me! Only some minor stylistic things to clean up.

Copy link
Member

@tylerjroach tylerjroach left a comment

Choose a reason for hiding this comment

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

Overall changes look good. Can you take a look at an alternate implementation here: https://github.com/aws-amplify/amplify-android/tree/tjroach/improve-network-detection-datastore

I attempted to take in Matt's suggestions and simplify it a bit. I believe the code functions identically to yours. The tests would just need updated to use MockK

@aladine
Copy link
Author

aladine commented Aug 14, 2024

Overall changes look good. Can you take a look at an alternate implementation here: https://github.com/aws-amplify/amplify-android/tree/tjroach/improve-network-detection-datastore

I attempted to take in Matt's suggestions and simplify it a bit. I believe the code functions identically to yours. The tests would just need updated to use MockK

Thanks Tyler, I move the codes from NetworkUtil to extensions folder as your branch. Update test location and mock method also.

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.

3 participants