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

Reseting AWSPinpoint at runtime #5465

Open
RuiAAPeres opened this issue Nov 18, 2024 · 6 comments
Open

Reseting AWSPinpoint at runtime #5465

RuiAAPeres opened this issue Nov 18, 2024 · 6 comments
Labels
feature-request Request a new feature pinpoint Issues related to AWS Pinpoint

Comments

@RuiAAPeres
Copy link

RuiAAPeres commented Nov 18, 2024

I need to reset our AWSPinpointAnalyticsClient. Is there a way to do this at runtime?

The setup I am using:

let localConfiguration = AWSConfiguration.configuration

let credentialsProvider = AWSCognitoCredentialsProvider(regionType: localConfiguration.cognitoPoolRegion.toAWSRegionType,
                                                                identityPoolId: localConfiguration.cognitoPoolId)

let configuration = AWSServiceConfiguration(region: localConfiguration.pinpointRegion.toAWSRegionType,
                                                    credentialsProvider: credentialsProvider)

AWSServiceManager.default().defaultServiceConfiguration = configuration
pinpointConfiguration = AWSPinpointConfiguration(appId: localConfiguration.pinpointAppId, launchOptions: launchOptions)

/// later on:
pinpoint = configuration.pinpoint /// AWSPinpoint
pinpointAnalyticsClient = configuration.analyticsClient /// AWSPinpointAnalyticsClient

I would hope to have some kind of reset(), or clear(), but I couldn't find anything.

Thank you. 🙇


Which AWS Services are you utilizing?
AWSPinpoint


Environment(please complete the following information):

  • SDK Version: 2.37.1
  • Dependency Manager: SPM
  • Swift Version : 5.0
@github-actions github-actions bot added pending-triage Issue is pending triage pending-maintainer-response Issue is pending response from an Amplify team member labels Nov 18, 2024
@thisisabhash thisisabhash added question General question and removed pending-triage Issue is pending triage labels Nov 18, 2024
@thisisabhash
Copy link
Member

Hello, Thank you for posting this issue. Our team will take a look and post updates here.

@github-actions github-actions bot removed the pending-maintainer-response Issue is pending response from an Amplify team member label Nov 18, 2024
@edisooon edisooon added the pinpoint Issues related to AWS Pinpoint label Nov 19, 2024
@RuiAAPeres
Copy link
Author

I would really appreciate a reply on this one @thisisabhash. Thank you. 🙇

@github-actions github-actions bot added the pending-maintainer-response Issue is pending response from an Amplify team member label Nov 26, 2024
@tylerjroach
Copy link
Member

We do not currently support resetting plugins. I'm going to mark this as a feature request. If you could please provide more information on your use case, it would better help us understand scenarios where this may be needed. Thank you!

@tylerjroach tylerjroach added feature-request Request a new feature and removed question General question labels Nov 29, 2024
@github-actions github-actions bot removed the pending-maintainer-response Issue is pending response from an Amplify team member label Nov 29, 2024
@ruisebas
Copy link
Member

@RuiAAPeres could you please elaborate as to what exactly you'd like to achieve by "resetting" the AWSPinpointAnalyticsClient? Based on that, there might be other alternatives that we can provide to you.

You can always just recreate the whole AWSPinpoint client, but how useful that is depends on what your use case is.

@ruisebas ruisebas added the pending-community-response Issue is pending response from the issue requestor label Dec 18, 2024
@RuiAAPeres
Copy link
Author

Hi @ruisebas

We have a case where depending on the region of a user (EU, or US) we would create a Pinpoint entity with a different setup. We only know where they belong after login. So we want to be able to use Pinpoint before and after the login. So after the login, there might be a chance to change setup.

@github-actions github-actions bot added pending-maintainer-response Issue is pending response from an Amplify team member and removed pending-community-response Issue is pending response from the issue requestor labels Dec 18, 2024
@ruisebas
Copy link
Member

ruisebas commented Dec 19, 2024

In that case, you should be able to create a new AWSPinpoint instance after login. For example:

// Your new service configuration
let serviceConfiguration = AWSServiceConfiguration(
    region: region, endpoint:
        endpoint, credentialsProvider:
        credentialsProvider
)

// Your new pinpoint configuration
let pinpointConfiguration = AWSPinpointConfiguration(
    appId: pinpointAppId, // Or if it's the same as the old one, you could just do oldPinpointClient.configuration.appId
    launchOptions: oldPinpointClient.configuration.launchOptions
)
pinpointConfiguration.serviceConfiguration = serviceConfiguration
pinpointConfiguration.targetingServiceConfiguration = serviceConfiguration

let newPinpointClient = AWSPinpoint(configuration: pinpointConfiguration)
let newPinpointAnalyticsClient = newPinpointClient.analyticsClient

@github-actions github-actions bot removed the pending-maintainer-response Issue is pending response from an Amplify team member label Dec 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request Request a new feature pinpoint Issues related to AWS Pinpoint
Projects
None yet
Development

No branches or pull requests

5 participants