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): properly handle multiple configures on Android #5740

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

tyllark
Copy link
Member

@tyllark tyllark commented Dec 1, 2024

Issue #, if available:
#5244
#5458

Description of changes:
Calling configure multiple times on Datastore results in exceptions and other unexpected behavior:

  1. Only add a user agent once when configuring multiple times. This ensures we properly throw AmplifyAlreadyConfiguredException rather than User-Agent was already configured successfully so it can be handle upstream.
  2. Added missing cleanup code from within onDetachedFromEngine otherwise events would be duplicated from the listeners that were not cleaned up.
  3. Made nativeAuthPlugin a companion object since we cannot add a new plugin after calling configure, but we need to handle the case where onDetachedFromEngine sets this value to null and it is reassigned via onAttachedToEngine from a new instance of AmplifyDataStorePlugin.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@tyllark tyllark requested a review from a team as a code owner December 1, 2024 22:40
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